Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Take off the stage part of that listener and it should work.</p> <p>What your doing is asking flash to tell you when that object has finished being created and has been added to the Display List. Thus it is now safe to manipulate to your hearts content.</p> <p>saying stage.add~ defeats the purpose.</p> <p>Edit: You really need to have that ADDED_TO_STAGE in the swf your loading. That is the only way you can be 100% sure it is loaded up before you try to use it. </p> <p>Here is basically how it should work...</p> <p>First our external swf that we made that we are going to load up for testing.</p> <pre><code>package src { import flash.display.Sprite; import flash.events.Event; public class ExternalSWFDocumentClass extends Sprite { public function ExternalSWFDocumentClass() { addEventListener(Event.ADDED_TO_STAGE, initializeThisClass); } private function initializeThisClass(e:Event):void { removeEventListener(Event.ADDED_TO_STAGE, initializeThisClass); // I am now added to the display list. Have fun. // Now when Some other swf loads me up I will know // for sure I have access to the stage etc. // Below this is for testing var sp:Sprite = new Sprite(); sp.graphics.clear(); sp.graphics.lineStyle(1, 0); sp.graphics.beginFill(0xccccff); sp.graphics.drawCircle(0, 0, 20); sp.graphics.endFill(); sp.x = stage.stageWidth * 0.5; sp.y = stage.stageHeight * 0.5; addChild(sp); } } } </code></pre> <p>Now since you said your wanting to load it from an FLA file you do it like this.</p> <pre><code>import flash.display.Loader; import flash.net.URLRequest; import flash.events.Event; var loader:Loader = new Loader(); var file:URLRequest = new URLRequest("externalSWFTest.swf"); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteLoad); loader.load(file); function onCompleteLoad (loadEvent:Event):void { addChild(loadEvent.currentTarget.content); } </code></pre> <p>Edit: Reading your post again makes me think this might not be the problem. It might be but might be something else given the error you got. There is no reason to addChild the loader or set it's x and y properties.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload