Jump to content
Search Community

Looping through SWF assets, how to reset SWF?

Mr Pablo test
Moderator Tag

Recommended Posts

When lopoing through an XMLLoader with SWF assets, the previously played SWFs are not starting from the beginning, despite the following code:

 

 

 

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


                            currentAsset.rawContent.gotoAndPlay(2);
                            addEventListener(Event.ENTER_FRAME, trackSWFPlayback);
                            
                            addElement(currentAsset.content);
                        }
 

Seems like the gotoAndPlay command isn't working?

 

The event listener "trackSWFPlayback" is as follows:

 

 

 

private function trackSWFPlayback(e:Event):void
            {
                if (currentAsset.rawContent.currentFrame == currentAsset.rawContent.totalFrames) {
                    currentAsset.rawContent.stop();
                    removeEventListener(Event.ENTER_FRAME, trackSWFPlayback);
                    getNextAssetIndex();
                }
            }
 

Any idea whats going on?

Link to comment
Share on other sites

Hmm...kinda tough to say without seeing your file and publishing it - have you tried adding a trace() to see whether or not the rawContent is hitting the correct frame immediately after you do the gotoAndPlay()? Kinda like:

 

currentAsset.rawContent.gotoAndPlay(2);
trace(currentAsset.rawContent.currentFrame);

And also check to see if your ENTER_FRAME handler is causing a stop() at the wrong time or something. 

 

If you're still having trouble, please create a very simple FLA that clearly demonstrates the problem and post it here (zip it first). Thanks!

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.
×
×
  • Create New...