4 Replies Latest reply on May 4, 2012 10:18 AM by Adam Ashby

    ActionScript Project - Export classes in frame 2?

    Adam Ashby

      I have a holder swf that loads in a swf that has its own built in preloader. Problem is those preloaders are not seen. The loaded swf only displays after it is 100% complete. On its own, the swf with preloader works fine.


      I created the preloader by using the Frame metadata tag:


      (import classes etc.)


      [SWF(frameRate=60, width=900, height=580, backgroundColor='#2A3146')]



      public class MainClass extends Sprite


      Then in the Preloader class when all is loaded:


              private function onLoaded():void



               var mainClass:Class = Class(getDefinitionByName("MainClass"));




                   app = new mainClass();

                   addChild(app as DisplayObject);





      In the holder swf it does something like this to load the swf:


                  gameLoader = new Loader();

                  gameLoader.load(new URLRequest(gamepath));

                  gameLoader.contentLoaderInfo.addEventListener(Event.INIT, onGameLoadStart);

                  gameLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);



              private function onGameLoadStart(e:Event):void


                  preloader = gameLoader.content;




      I thought this was the to do a "export classes in frame 2" kind of thing in an actionscript project, and it works great on its own but not when loaded inside another swf. Is there something I'm missing?


      I know I could just built a preloader in the holder swf, but the holder swf is loading in games that all have a unique style on thier own and the games' preloaders all dipict its games style.