Skip navigation
Vendita3
Currently Being Moderated

External SWF Looping in IOS

Mar 6, 2013 2:36 AM

Tags: #flash_cs6

My main SWF has buttons that load other SWF files.

When I preview this with Flash it works as I would expect. The external SWF runs a simple movie and the last frame of the movie I have added stop(); so it will not loop.

This works fine in my browser and with Flash Preview. It even works fine with XCode when I preview it on their IOS Simulator.

 

When I load this on my IPhone the movies will load correctly, but will loop continusly.

 

Any ideas how I can stop the looping?

 
Replies
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 4:56 AM   in reply to Vendita3

    iOS won't allow any code in your loaded swf to execute.

     

    so, one solution is to execute the stop from the loading (main) swf:

     

    var loader:Loader=new Loader();

    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);

    loader.load(new URLRequest("yourexternalswf.swf"));

    function completeF(e:Event):void{

    MovieClip(loader.content).addEventListener(Event.ENTER_FRAME,enterfram eF);

    }

    function enterframeF(e:Event):void{

    if(MovieClip(loader.content).currentFrame==MovieClip(loader.content).t otalFrames){

    MovieClip(loader.content).removeEventListener(Event.ENTER_FRAME,enterf rameF);

    MovieClip(loader.content).stop();

    }

    }

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 6, 2013 9:13 AM   in reply to Vendita3

    no, leave that code just the way it is.

     

    if you're using an air version that allows code in external swfs, you should be good to go.

     

    unfortunately, i don't see which air versions allow external swf code.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points