PDA

View Full Version : back button not working in loaded swf


asadzubi
11-23-2004, 04:55 PM
Hi All

I have an image which i have tweened and am moving it across the stage by pressing a button. I also have another button which moves it backwords by playing the timeline in reverse. I acheived this by using a movie clip controller on this button and using prevFrame() in the controller actions. Everything works nicely upto this point. However, I am now trying to load this swf into another .fla file in frame 1 and it does not give me the same result. Specifically the back button is not working. My guess is that it is not recognising the contoller movie clip or that it does not have a prevFrame() to jump to.

Any ideas as to how i can get my back button working in the file where i am loading my swf in ?
(The button is in the loaded swf just to confirm)

Thanks in advance :)

Gibberish
11-23-2004, 06:14 PM
when a swf works on it's own and breaks when loaded into a parent 90% of them time it is a targeting issue.

Is the loaded swf using _root on any of the script? If it is it is no longer calling it's own root but the root of the parent swf. So you would need to change these to target the loaded swf's root by using _parent, or if you are using Flash 7 _lockroot

asadzubi
11-25-2004, 08:59 PM
Hello hello

Thanks for giving me that _parent tip. That solved almost all of my problems except one. The back button now does not work when i reach the end of the animation ( I have a stop(); action at the end). Any advice would be highly qpreciated.

Thanks

asadzubi
11-26-2004, 02:28 PM
Hi Again

Ok maybe my reply wasnt that clear or helpful. Unofrtunately i cannot post the .fla file as it is too large. So i will try to explain in detail what my movie looks like.
I have a picture on one layer which i have motion tweened to go across the stage. Then i have 3 buttons on another layer, forward, stop and back. Then i have a movie clip controller (called control) which i use to operate the back button. The codes in the play and stop are pretty straightforward. They are

For play:
on (release) {
play();
}

For stop:
on (press) {
stop();
control.stop(); //control is the name of the mc controller
}

I have a stop action on the first and last frame of my animation.

This is the code for the back button
on (release) {
control.gotoAndPlay(2);
}

In the controller i have 3 frames. The code in each of the frames is as below.

1st frame: stop()
2nd frame: _parent.prevFrame()
3rd frame: gotoAndPlay(2);

This all works fine if you play it by itself. However, when i load this into another flash movie, the back button does not work after reaching the end of the animation. I am guessing it has something to do with the stop() action I have at end. However. I am not sure how to fix it. Any advice would be highly appreciated

Thanks :)