This may just be a molehill issue, but since there is lots of molehill
expertise in this group, I am hoping someone can suggest a way to find
a solution.

I am working on a video game.  I began in Papervision3D in 2010.
Because of unsatisfactory performance, I converted to Away3D 3.6/FP10
in early 2011.  Also for performance reasons, the strategic design of
the game involves creating each game level in its own swf and using a
master swf to unload the current swf level and load the next swf game
level when needed.  The strategy worked in Away3D 3.6/FP10.  However,
on slower machines the game ran at only 2-4 fps.  So I am now
converting to Broomstick/Molehill.  The game levels are great in
Broomstick/Molehill and we are even enhancing some of our graphics.
However, in Broomstick/Molehill, I am not able to make the same swf
loading logic work.  Here is my loader logic:

package {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.media.Sound;
        import flash.net.URLRequest;
        import flash.display.Loader;


        public class Test1Stub extends MovieClip {
                public var swfcounter:int=0;
                public var loader:Loader=new Loader  ;
                public var mcExternal:MovieClip;
                private var startup:Startup;
                public var Introswf:MovieClip;
                public var Playerdimensions:Object;


                public function Test1Stub():void {
                        startup=parent as Startup;
                        loadswf();
                }

                function loadswf():void {
                        this.addChild(loader);

                        loader.load(new URLRequest("Test1.swf"));
                        
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,swfIn);
                }

                function swfIn(e:Event):void {
                        loader.x=0;
                        loader.y=0;
                        
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,swfIn);
                        Introswf=loader.content as MovieClip;
                        loader.addEventListener("close",unloadSWF);
                }
                function unloadSWF(event:Event):void {
                        loader.unloadAndStop();
                        removeChild(loader);
                        loader.removeEventListener("close",unloadSWF);
                        loadnewswf();
                }
                public function loadnewswf():void {
                        startup.stepAhead("Test2");

                }
        }
}

Also, in the swf to be loaded, I use this logic:

if (stage == null)
                {
                        
this.addEventListener(Event.ADDED_TO_STAGE,addstagelisteners);
                }
private function addstagelisteners(e:Event):void
                {
                        stage.frameRate = 30;
                        createUI();
                        stage.addEventListener(Event.ENTER_FRAME,onEnterFramex);
                        init()
                }

Does anyone have any idea why this would work for FP10 but not FP11,
or how to make it work in FP11.

Thanks for your help.

Bryan Rickertsen

Reply via email to