Skip to main content
Apr 18, 2006 1:54 PM UTC
Answered

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

[ 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 is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
Apr 18, 2006 2:04 PM UTC
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

Apr 18, 2006 11:52 PM UTC
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
Translate
kglad
Community Expert
Community Expert
Apr 19, 2006 1:11 AM UTC
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.
Translate
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
Apr 18, 2006 2:04 PM UTC
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.
Translate