Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As sometimes happens, asking the question leads to finding your answer. After reading the manual, again, I saw that once you add a new swf in AS3, you need to add your new DisplayObject as a child to an existing DisplayObject in an existing DisplayObjectContainer.</p> <p>So, the problem I had is that I loaded the external swf properly but didn't add it to a DisplayList, so it wasn't displayed.</p> <p>Here is a fixed version of the code blocks I quoted earlier</p> <h2>test_tsscreen.as</h2> <p>package {</p> <pre><code>import flash.display.MovieClip; import TSScreen; public class test_tsscreen extends MovieClip{ var tsScreen1:TSScreen; public function test_tsscreen(){ tsScreen1 = new TSScreen(10,10,100,100,0.5,0); //tsScreen1 = new TSScreen(); this.addChildAt(tsScreen1,1); } } </code></pre> <p>}</p> <h2>TSScreen.as</h2> <p>package { import flash.display.MovieClip;</p> <pre><code>import flash.display.*; import flash.net.URLRequest; import flash.system.ApplicationDomain; import flash.system.LoaderContext; import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; public class TSScreen extends MovieClip { private var _xPos:int; private var _yPos:int; private var _width:int; private var _height:int; private var _xScale:int; private var _yScale:int; private var _visible:Boolean; private var _alpha:Boolean; private var _shadow:Boolean; private var _backgroundColor:uint; private var _rotation:Boolean; private var _displayTime:int; public function TSScreen():void{ startLoad(); } function startLoad() { var mLoader:Loader = new Loader(); var mRequest:URLRequest = new URLRequest("C:/FlashProjects/test_as3.swf"); mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler); mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler); addChild(mLoader); mLoader.load(mRequest); } function onCompleteHandler(loadEvent:Event) { addChild(loadEvent.currentTarget.content); } function onProgressHandler(mProgress:ProgressEvent) { var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal; trace(percent); } } </code></pre> <p>}</p> <p>If you'd like more information please chapter 04 of the book "FriendsofED Foundation Actionscript 3.0 With Flash CS3" which contains helpful introduction into this subject.</p> <p>Hope this helps others with the same problem.</p>
    singulars
    1. This table or related slice is empty.
    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.
    3. 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