A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Control 3 movie clip with one button [ as2,cs4 ]

  1. #1
    lost in AS
    Join Date
    Nov 2009
    Posts
    4

    Control 3 movie clip with one button [ as2,cs4 ]

    hello
    i have 1 button and 3 Movieclip
    there is 2 frame in each move clip .
    i want to control all mc with my button.
    when i press it all mc go to frame 2 .

    i use this action for button :

    Code:
    on (release) {
    	_root.f1 = true;
    }

    and use this action on first frame of each movie clip :


    Code:
    stop();
    if (_root.f1 == true) {
    	gotoAndStop(2);
    
    }
    but don't work , please help .

    i attach the fla file .
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Jan 2006
    Posts
    263
    PHP Code:

    on
    (release){
    _root.movieClip1name.gotoAndStop(2);
    _root.movieClip2name.gotoAndStop(2);
    _root.movieClip3name.gotoAndStop(2);







  3. #3
    lost in AS
    Join Date
    Nov 2009
    Posts
    4
    tanx for reply jamesloacher .
    but think if the movie clip number increase ( ex : 200 move clip ) your code is not logical anymore.
    i want to do something that could be control any number of movieclip .

    tanx again .

  4. #4
    Senior Member
    Join Date
    Jan 2006
    Posts
    263
    One wway would be to store the movieClips in an array;


    PHP Code:
    var myMovieClips = [mc1,mc2,mc3,mc4,mc5,mc5,mcn]

    on (release){
    for(
    i=0;_root.myMovieClips.length;i++){
    myMovieClips[i].gotoAndStop(2);

    }





  5. #5
    lost in AS
    Join Date
    Nov 2009
    Posts
    4
    tanx for your great script's .
    code work fine in frame 1 , but if movie clip separate in other frame they don't change .
    take look at attachment .(test3)

    i think could do this with ( if ) script but i don't know why my code don't work fine ?
    in my attachment ( test_myway) if you click on ( 1 change ) and then click to next frame , it's work , but i want to do it on same frame .
    help .
    Attached Files Attached Files

  6. #6
    Senior Member
    Join Date
    Jan 2006
    Posts
    263
    Can't open the files here in flashCS3.Could you save them in an older format?

  7. #7
    lost in AS
    Join Date
    Nov 2009
    Posts
    4
    i attached the cs3 version now .
    Attached Files Attached Files

  8. #8
    Senior Member
    Join Date
    Jan 2006
    Posts
    263
    The reason my way won't work is they go out of scope on the 2nd frame.

    It is best to try to keep everything in one frame if possible.

    I did not understand your way, maybe someone here can be of some assistance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center