No, you shouldn't use getPixels
it will be overkill for such task. Actually Loader
has content
property:
Contains the root display object of the SWF file or image (JPG, PNG, or GIF) file that was loaded by using the load() or loadBytes() methods.
You will be able to get desired green object by simply operating over display list, and understanding what are you doing after component is loaded. If you add content
to the display list after every loading operation (Ex: addChild(loader.content)); and for example your green object has name (Ex: 'greenLantern') after full loading you will be able to get reference on it:
//After full loading, Code in loader C
var containerB: DisplayObjectContainer = getChildAt(0) as DisplayObjectContainer;
var appA: DisplayObjectContainer = containerB.getChildAt(0) as DisplayObjectContainer;
var greenLantern: DisplayObject = appA.getChildByName("greenLantern");
trace(greenLantern.magicProperty1, greenLantern.x, greenLantern.y);
Another approach is event bubbling. You could spawn event from application A
and listen for it in loader C
:
//Loader C
addEventListener("greenLanternHere", onGreenLanternEvent);
function onGreenLanternEvent(e:Event):void {
//Heeeellooooo moving green object
trace(e.target);
}
//Application A
greenLanternInstance.dispatchEvent(new Event("greenLanternHere", true));