dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: HELP!!!!!!!!!!ANYONE!!!!!!!!!

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Posts
    106
    Basically, I want a certain set of actions to be applied to bunch of different movie clips (ie MC1 MC2 MC3....). Can anyone help me with the new F5 code on how to do this?
    The code in F4 was something like this:

    Set Variable "i"=1
    Loop While (i<3) <---this is the total number of clips
    Begin Tell Target ("mc"&i)
    Go To and Play (2) <--actions section
    End Tell Target
    Set Variable "i"=i+1
    End Loop

    someone end my angst!!!!!
    thanking all in advance!

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    911
    In Flash 5 I would code it like this:

    Code:
    i = 1;
    while (i <= 3) {
       _root["mc"+i].gotoAndPlay(2)
       i++;
    }
    I dont know if you have gotten familiar with the new syntax so I will explain it. The first part is just a simple set variable "i" equal to 1. Then you have your "while" loop that goes until "i" is greater than 3. The next part is just a tell-target-go-to-and-play all wrapped into one. The _root part evaluates the movie clip you want to tell and the rest is just the "goto" action. Then the i++ increments your counter variable by one.

    Hope it helps.

  3. #3
    Junior Member
    Join Date
    Aug 2000
    Posts
    24
    Originally posted by johntesh
    Basically, I want a certain set of actions to be applied to bunch of different movie clips (ie MC1 MC2 MC3....). Can anyone help me with the new F5 code on how to do this?
    The code in F4 was something like this:

    Set Variable "i"=1
    Loop While (i<3) <---this is the total number of clips
    Begin Tell Target ("mc"&i)
    Go To and Play (2) <--actions section
    End Tell Target
    Set Variable "i"=i+1
    End Loop

    someone end my angst!!!!!
    thanking all in advance!
    Try this:
    Code:
    var j=1
    for(j=1;j<3;j++)
    {
       mc[j].play();
    }
    I do not think you can tell a MC to "goToAndPlay" a certain frame within it's own timeline because that action (from the help file)
    "...sends the playhead to the specified frame in a scene and plays from that frame. If no scene is specified, the playhead goes to the specified frame in the current scene..."

    Am I wrong anyone?

    (I used "j" as the counter to avoid this board interperting the i to convert to italics.)

  4. #4
    Junior Member
    Join Date
    Aug 2000
    Posts
    24
    ...ahab's code looks better than what I said. I got the syntax for targeting wrong. It should be:

    _root.["MC" + j]

    Sorry.

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Posts
    911
    Actaully I thought your method looked better because you used the temporary variable that way it wont cause mess ups with the rest of the person's script...just in case. Also Jeremy you said:

    Originally posted by Jeremyx
    _root.["MC" + j]
    But you dont put the "." in there...its just _root["mc"+j]...or maybe it doesnt matter...its just the way Ive been doing things.

  6. #6
    Junior Member
    Join Date
    Aug 2000
    Posts
    24
    I think you are right about not including the dot, becasue what the code is doing is looking at the array of Movie Clips on the root timeline.......

    I know I'll get blasted for this but you could also do:
    Code:
    var j = 1
    for(j=1;j<3;j++)
    {
       var currentClip = eval("_root.MC" + j);
       currentClip.play();
    }

  7. #7
    Senior Member
    Join Date
    Apr 2000
    Posts
    106

    thanks bros

    This is more of the problem I am having, hopefully you all can help:
    I am trying to emulate the praystation effect from sept 4th
    the parabolic effect (www.praystation.com)
    But instead of using the same box over and over, I want to use a whole image that is broken up into a bunch of mc (boxes) then reassembled to make the whole image, but when moused over breaks up in that fashion.
    I just got F5 today and am having trouble with the new syntax. I was just wondering if you could give the same actions to a whole slue of MC's. Any insight would be appreciated....thanks

  8. #8
    Senior Member
    Join Date
    Apr 2000
    Posts
    106

    another thing.....

    that goto and play was just and example of were I put the actions......

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