Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
ash allen

works in Flash but not on device

Recommended Posts

Hi - I have an app working in flash but when I deploy to a device only the first swf loads then unloads and nothing else happens.  I'm not sure how to debug what is happening on the device.

 

I am loading several swfs using loadermax - some of the code is below and I will note where it stops working:

 

Grateful for any advice, am currently thinking of starting again without using GS code to see if I'm doing something wrong in there.

 

Thanks.

 

private var swfs:LoaderMax = new  LoaderMax({onComplete:completeHandler,onProgress:progressHandler,onChildComplete:childCompleteHandler});

 

private function buttonListeners():void
        {
            homePage_mc.start_btn.addEventListener(MouseEvent.CLICK, loadswfs);
        }

        //LOAD MOVIES;

        private function loadswfs(event:MouseEvent):void
        {
            swfs.append(new SWFLoader("Movie1.swf",{container:this,autoPlay:false,width:480,height:480,x:300,scaleMode:"proportionalInside"}));
            swfs.append(new SWFLoader("Movie2.swf",{container:this,autoPlay:false,width:480,height:480,x:300,scaleMode:"proportionalInside"}));
          // there are 8 more swfs loaded this way

            swfs.load(true);
            loadMovie1();
           homePage_mc.start_btn.removeEventListener(MouseEvent.CLICK, loadswfs);
        }

        private function loadMovie1():void
        {
            swfName = "1";
            trace("Movie1");
            currentSWFLoader = LoaderMax.getLoader("Movie1.swf");
        }

        private function loadMovie2():void
        {
            swfName = "2";
            currentSWFLoader = LoaderMax.getLoader("Movie2.swf");
            trace(currentSWFLoader.content);
            initCurrentSWFLoader();

           //  this swf doesn't start playing on device - it does in Flash
        }

        //SWF LOADER EVENTS;

        function progressHandler(event:LoaderEvent):void
        {
            progress_mc.scaleX = event.target.progress;
            trace("progress: " + event.target.progress);
        }
        function childCompleteHandler(e:LoaderEvent):void
        {
            trace(e.target + " loaded");
            e.target.content.visible = false
        }

        function completeHandler(e:LoaderEvent):void
        {
            trace("all loaded");
            progress_mc.visible = false;
            initCurrentSWFLoader();
        }
        function initCurrentSWFLoader()
        {
            currentSWFLoader.content.visible = true;
            currentSWFLoader.rawContent.gotoAndPlay(1);
            trace(currentSWFLoader.rawContent.name + "playing");
            addEventListener(Event.ENTER_FRAME, trackSWFPlayback);
        }

        function trackSWFPlayback(e:Event):void
        {
            if (currentSWFLoader.rawContent.currentFrame == currentSWFLoader.rawContent.totalFrames)
            {
                removeEventListener(Event.ENTER_FRAME, trackSWFPlayback);
              switch (swfName)
                {
                    case "1" :
                        currentSWFLoader.content.visible = false;
                        currentSWFLoader.rawContent.stop();
                        loadMovie2();
                        
                break;
  
                    case "2" :
                        currentSWFLoader.content.visible = false;
                        currentSWFLoader.rawContent.stop();
                        loadMovie3();
               break;
                    }
                
            }

        }

Link to post
Share on other sites

Not sure what to tell you here. If the code works in Flash then there aren't any syntax issues. 

 

I can only imagine that your device can't handle memory or processor demands of your child swfs. I would make really really simple swfs that only contain a singe shape for movie2.swf, movie3.swf, movie4.swf etc. If those super simple swfs work than perhaps you can find ways of optimizing for your device.

 

With the information provided that's the best I can think of right now.

Link to post
Share on other sites

Hi - thanks for the suggestion, I will give that a go.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×