By registering with us, you'll be able to discuss, share and private message with other members of our community.

  1. Welcome to the 12ozProphet Forum...
    You are currently logged out and viewing our forum as a guest which only allows limited access to our discussions, photos and other forum features. If you are a 12ozProphet Member please login to get the full experience.

    If you are not a 12ozProphet Member, please take a moment to register to gain full access to our website and all of its features. As a 12ozProphet Member you will be able to post comments, start discussions, communicate privately with other members and access members-only content. Registration is fast, simple and free, so join today and be a part of the largest and longest running Graffiti, Art, Style & Culture forum online.

    Please note, if you are a 12ozProphet Member and are locked out of your account, you can recover your account using the 'lost password' link in the login form. If you no longer have access to the email you registered with, please email us at [email protected] and we'll help you recover your account. Welcome to the 12ozProphet Forum (and don't forget to follow @12ozprophet in Instagram)!

To anyone 12ozers who know about flash..

Discussion in 'Channel Zero' started by ledzep, Dec 11, 2004.

  1. ledzep

    ledzep Junior Member

    Joined: Feb 21, 2002 Messages: 146 Likes Received: 1
    I'm working on a project for a class in which I am basically supposed to make a flash movie, basically I have two questions:

    1. Is there anyway to make a loop that only loops x number of times and then keeps going?

    2.Is there anyway to make an x number of loops that play the same thing at first and then play different things? (for example that they all begin say with the same animation of a guy walking and then go to different animations)

  2. In the simplest of terms:

    1) Declare a variable on the first frame of the timeline:

    var timesLooped = 0;

    2) Start your loop animation on the second frame of the timeline. Name it "begin". On that very frame, write:

    timesLooped = timesLooped + 1;

    3) On the last frame of your loop animation, write:

    if (timesLooped >= x) {
    gotoAndPlay ("continue");
    else gotoAndPlay ("begin");

    ^In there, x will be the number of times you want it to loop. Every time the movie gets sent back to the beginning for looping, the variable will be incremented by one. Once it reaches the desired number (or higher), the code will tell the movie to go to a frame called "continue", which is where you will begin the remainder of your animation (next step).

    4) Create said frame after the last frame of the animation loop, and drop in the remainder of your animation.

    Ta daa. I'm not sure what it is you're trying to do with your second problem. more details?
  3. ledzep

    ledzep Junior Member

    Joined: Feb 21, 2002 Messages: 146 Likes Received: 1
    ok the basic idea with the second problem is that I want to make one animation that can branch off into differnt alternate endings.

    what i want to do is basically:

    a dude walks and then either he hunts a mastadon, he hunts an armadillo, or he hunts a bird, depending on what the viewer chooses.

    the order is basically:

    dude walks
    viewer chooses which prey he hunts
    dude walks

    if viewer chooses prey1 he hunts prey1
    if viewer chooses prey3 he hunts prey2
    and so forth.

    sorry its kind of hard to explain this way, if you still dont get what im sayin just forget it.
  4. Oh, OK, that's simple. I didn't know there was gonna be user interaction. Make different starting frames on the timeline with specific names for each "outcome". Then make buttons that show up at the end of the first animation that, when clicked, send the playhead to the starting frame of choice. If you want the guy to do the same walk AFTER the viewer has chosen, then you wanna do the whole variable schtick again...

    I can't be more specific right now, cause I gotta go watch the Klitschko fight. And I can't tomorrow cause I'm gonna be drinking on a boat all day. This isn't for Monday, is it? Maybe the heavyLox monster can help you out in the meantime. Sorry.
  5. ledzep

    ledzep Junior Member

    Joined: Feb 21, 2002 Messages: 146 Likes Received: 1
    nah this isnt due until friday, Im having difficulty getting the first loop thing you said to work, it says that its missing an 'if' for the 'else'.

    thanks anyways, if anything I'll just have to copy paste the animations (which even though its a waste of time and memory, at least I'll have it done).
  6. AngerCMKill

    AngerCMKill Member

    Joined: Jun 3, 2003 Messages: 363 Likes Received: 0
    what up ArmenHammer...
    this project must be a school favorite.
    i did a project similar to this...
    cept with an eyeball who got to either shoot or stab the rival red eyeball, or just try and run home.....
    El Mamerro pretty much got you all the info there for the animation...

    take your layer of the timeline,
    break off 3 seperate animations on that layer.

    label the seperate animation start frames "prey1", "prey2", or "prey3"
    make that whole animation including your ending that you'll have.

    make sure you put a "stop()" action at the end of each respective animation.
    or if you'll have them all end at the same ending do a

    gotoAndPlay ("ending");
    with ending labeled "ending"....

    i just put my two cents in....
    maybe i can get some help on a flash project i have due today...
    i need some quick code to make my character shoot projectiles.....
    someone, anyone?
  7. Sorry, my syntax was fucked. Here you go:

    if (timesLooped >= x) {
    gotoAndPlay ("continue");
    } else {
    gotoAndPlay ("begin");