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?
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();
}
}
Hi - Many thanks for this. I will try this now.
Can you please let me know if you have a min this page (seems new) on Adobe and says you can load in action scripts:
I am stuck with the bit saying *The minor change is that when loading the SWF, the application domain should be the same as that of the main SWF i.e. ApplicationDomain.currentDomain.
var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
_loader.load(_urlRequest, _lc);
Do I need to change "ApplicationDomain.currentDomain" (and what with)? or will this still not do what I am trying to do?
North America
Europe, Middle East and Africa
Asia Pacific