Ultrashock Forums > Flash > Flash Newbie
[AS3] Imported swf won't stop looping

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
[AS3] Imported swf won't stop looping
Old 2008-07-29

I have a swf file which i have imported into another by adding it to the library and then giving it a linkage class to be imported at runtime.

The child swf file contains code to stop it's timeline at frame 1, then wait for a given amount of time, and then carry on. This works fine when run stand alone, however when run from within the parent, it just loops, disregarding the stop() function at frame 1.

Any ideas why this is ?

The code im using to stop the child swf is simply

Code:
this.stop();
And the code im using to import the child swf at runtime (within the parent one) is

Code:
var childSwf:Child = new Child();
addChild(childSwf);

Any help would be greatly appreciated.
www.viaus.co.uk
postbit arrow 4 comments | 1870 views postbit arrow Reply: with Quote   
Registered User
dbrandon is offline
seperator
Posts: 10
2008-03-02
Age: 21
dbrandon lives in United Kingdom
seperator

Ultrashock Member Comments:
djnorthyy's Avatar djnorthyy djnorthyy is offline djnorthyy lives in United Kingdom 2008-08-04 #2 Old  
Have you tried loading the SWF using URLRequest()? This is the method I have always used, and have never come across this sort of problem.

Look it up in here: http://www.iheartactionscript.com/lo...al-swf-in-as3/

Hope it works
Harry.
Reply With Quote  
dbrandon dbrandon is offline dbrandon lives in United Kingdom 2008-08-05 #3 Old  
Thank you for your suggestion. I had considered doing it this way (as you are right, it solves the problem i was having), but i need to create multiple instances of the loaded swf, which i dont believe is possible using a URLRequest ?
Reply With Quote  
ServerSide's Avatar ServerSide ServerSide is offline ServerSide lives in Canada 2008-08-05 #4 Old  
If it works fine when run on its own and breaks when loaded into parent then it sounds like a scope problem. Have you tried dropping 'this.' and just use 'stop();' on frame 1 of the child swf?
Reply With Quote  
Darth-Awesome Darth-Awesome is offline Darth-Awesome lives in Canada Creative Assets 2008-08-05 #5 Old  
Hey D, you can in fact make as many instances as you want.

lets say you have finished loading your swf into a loader call movieLoader. Don't add movieLoader as a child in stead do this.

Code:
var clip1:MoiveClip = movieLoader.content;
var clip2:MoiveClip = movieLoader.content;
var clip3:MoiveClip = movieLoader.content;
var clip4:MoiveClip = movieLoader.content;
var clip5:MoiveClip = movieLoader.content;

addChild(clip1);
addChild(clip2);
addChild(clip3);
addChild(clip4);
addChild(clip4);

if you are doing it dynamically use an array to store the refrences to the clips, and there you go, multiple instances of a loaded swf.
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: