Skip to main content
June 13, 2010
Question

Movie clip inside a movie clip

  • June 13, 2010
  • 1 reply
  • 440 views

Hi everybody,


I'm creating a slideshow with Flash, like the  ones done with Powerpoint. I would like to create a movie clip inside  another movie clip, that is, say I have a clip called button1, and when I  click it, frame number 2 in this clip is displayed, and then more  information appears. Inside this frame 2, there are other clips, for  example an X button to close and return to frame number 1 in the clip  button1, as the image shows:


forum2.jpg


What I have done is convert the button1 text into a movie  clip, and assign an action to it:


on (press){
    gotoAndStop(2);
}


When frame 2 is displayed, I would like to  click to the X-button to get back to frame number1, so what I've done  is, again, convert it into a movie clip and assign the following action:


on (press){
    _root.gotoAndStop(1);
}


But this doesn't work. I've been trying as  well changing other things, but no way... At first I thought it had  something to do with the _root or _parent, but now it looks as when  using gotoAndStop in the "parent" button (button1), no actions work for  the "child" buttons.


I've loaded the fla and the swf files here, just in case  someone would like to check.


Thank you very much in advance for your help.  I've been checking other posts, but apparently I couldn't find the  appropriate info.

This topic has been closed for replies.

1 reply

k_bitgood
Inspiring
June 14, 2010

"_root" is only used to reference the very first level of your flash file. Right now you are telling flash to go to the second frame in your root timeline but you want to go to the second frame in your button1 timeline.

Change the code that is on the X-button to

on(press){

     gotoAndStop(1);

}

Remove the "_root" and it should work.

If it still doesn't work, make sure the button has an instance name of "button1" and use this code.

on(press){

     _root.button1.gotoAndStop(1);

}

This is using "_root.button1" as the 'address' of your movieclip and it wont matter where the code is.