Jump to content

Mr Pablo

"Resetting" SWFs in a loop

Recommended Posts

Using an XMLLoader, I have a few SWF files that loop one after the other.


I am using:





To start the SWF and using an eventListener:





To stop the SWF when the current frame equals the total number of frames.


SWF 1 plays through its timeline, 480 frames, with various pieces of text showing up at different intervals on the timeline ie not scripted.


After SWF 2 plays and SWF 1 is told to gotoAndPlay(2) again, the SWF displays, but as if it was at the end of its timeline, showing all the text without there timeline based tweens etc.


I have looked and looked and cannot find an answer for this.


Lots of chatter about load() and unload() but I simply cannot make them work for me. I tried:





but I got errors.


Where and how should I use load/unload(), bearing in mind I am using XMLLoader to load SWFLoaders.


Why isn't gotoAndPlay(2) working properly?


I have a listener to display the frame count and it always counts up properly, despite showing all the text at once as if they were there in the beginning.


Really need to sort this as its a major issue for me that needs to be fixed and work flawlessly.



Link to comment
Share on other sites

In order to figure this out we would need to be able to compile and test all the files in your project.

We don't need your actual production files though. Just create a very simple sample like


main.fla: file that loads the xml that loads the swfs

child1.fla: very simple swf with timeline animation

child2.fla: very simple swf with timeline animation

data.xml xml file


In general just strip out everything that isn't necessary to replicate the issue. You can zip up your files and attach them to this post using the "more reply" options


If your frame counter is reporting the currentFrame number accurately, I'm as puzzled as you as to why the animation isn't displaying properly. Sounds very strange.

Link to comment
Share on other sites

Hmm I seemed to have fixed it, by accident.


I was using the following code inside a function, to determine if the loader was a SWFLoader and do appropriate actions:




if(currentAsset is SWFLoader){
                            trace("SWFLoader detected");

                            addEventListener(Event.ENTER_FRAME, trackSWFPlayback);


Now, I moved the " addElement(currentAsset.content);" up, above the "currentAsset.rawContent.gotoAndPlay(2);" statement (no idea why, i just did) and it now works.


Very odd indeed!


Now I need to figure out why certain ordering of loaders in my XML don't want to work (i started another thread for it)

Link to comment
Share on other sites

Glad you figured it out. Thanks for letting us know.

And, yes, your solution is a little odd. I really don't know why that worked, but I'm happy it did.

Link to comment
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.