Skip to main content
April 18, 2006
Answered

how to control the movieclip embeded into another movieclip to play or stop

  • April 18, 2006
  • 3 replies
  • 310 views
[ flash source file

I created a movieclip MCA. there are 4 embedded movieclips within MCA. I hope the button " Next" to control the movieclip "slide2" within MCA to play. but I failed. it doesn't play. what's wrong ?

by the way, the first frame within "slide2" is set to "stop". this is important for me. I need this.


the code is as follow,

/////////////////////////////////////////////////////////////////

_root.btn_next.onRelease = function() {
_root.mca.gotoAndStop(2);// movie "MCA" go to the 2nd frame to show "slide2"
_root.mca.slide2.gotoAndPlay(2);//hope to control movice clip "slide2" within "MCA" to play
};

could you help solve the issue ?

thanks

This topic has been closed for replies.
Correct answer kglad
remove slide2 from frame 2 of mca and put it on frame 1 of mca. add actionscript to make slide2 not visible on frame 1 of mc1 and make it visible on frame 2 of mca.

3 replies

April 18, 2006
hi Kglad,

thank you very much for the answer. the approach you said is a solution. Another solution is add actionscript " play " in the Frame2 of "Slide2".

well, i'm wondering why I can't directly control the embedded movieclip? could you please explain the reason ? thanx

jim
kglad
Community Expert
Community Expert
April 19, 2006
your approach fails because of the order in which flash executes its actions. in your situation, flash will execute your button handler code first (after that button is released).

so, _root.mca goes to its frame 2 and stops. _root.mca.slide2 goes to its frame 2 and would play, except _root.mca.slide2 is instantiated on frame 2 of _root.mca so the code in _root.mca's frame 1 executes immediately after your button handler code and it directs _root.mca to stop.

bottomline: _root.mca.slide2 stops on its frame 2 instead of continuing to play because the code on _root.mca.slide2's frame 1 executes after the button handler code.
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
April 18, 2006
remove slide2 from frame 2 of mca and put it on frame 1 of mca. add actionscript to make slide2 not visible on frame 1 of mc1 and make it visible on frame 2 of mca.