News:

If you need instructions on how to get through the hotels, check out the enclosed instruction book.

Main Menu

Need a little help in AS

Farted by RocketFetus, January 31, 2009, 08:19:26 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

RocketFetus

I'm trying to add a thing where a counter will go up every time an action is performed and also go back one frame

Specifically I want it to say THING (#)

I already have the if statement set up. I just need actionscript within the if statement that:

1. Makes the counter do the THING (#) starting with one and keep going up (don't know if there is supposed to be  a limit but if there is, 100 preferably.

2. takes the movie back one frame!

i'm a noob i know.

edit:

Thank you guys for the help. I'm having a little trouble though, the counter doesnt work. :\

I've tried naming the counter thing "counter" and named it's instance "counter" and then I put the actionscript as    counter++;

but it doesnt work... are there any additional settings?
Now everybody wants this thick afro body but I blow dry that hair and never let it down.

The Spoiler

I'm not sure what you mean for the THING part, but to go to the previous frame use prevFrame();
For obvious reasons use it after the other part.
For the THING part, do you want it to do a trace command or change something in a text box?

Edit: You said counter. I'm a dumbass.

If you want to have a counter in a text box/field, on the text field under 'Properties' or something theirs a text box that says 'Var' (If you make a dynamic text, which you should). Type in a variable name there then declare that variable somewhere in the code (On the first frame or something). Then in the if block (but before prevFrame) put
var++;
with var replaced with the variable's name. If you want to keep the variable from going beyond a certain limit put the var++ within an if block like so

if ( var>100){
var++;
}

Edit again: If you want some text next to the number make sure they're in different text fields. Make the text one static and the number one dynamic like I said above. You could have them in one field if you really wanted, but that would take more work.

RocketFetus

Yes it is possible even if it goes back one frame? The counter?
Now everybody wants this thick afro body but I blow dry that hair and never let it down.

Bigglesnoots

I'm not sure what you mean by "actions" but I take it that it's just buttons being clicked.

Include this on all buttons that would mean "preforming an action"

on(press){
     countervariablegoeshere++;
     framevariablegoeshere--;
     nameofthemovieclip.gotoAndStop(framevariablegoeshere);
}
_root works too instead of a movieclip, if you want the whole movie to go back one frame.

edit: ye prevframe works too, I just like using vars.
Quote from: Zombie Lincoln;1601675Waiting around to die is the most socially acceptable method of suicide, and it always works.

RocketFetus

Thank you guys for the help. I'm having a little trouble though, the counter doesnt work. :\

I've tried naming the counter thing "counter" and named it's instance "counter" and then I put the actionscript as    counter++;

but it doesnt work... are there any additional settings?
Now everybody wants this thick afro body but I blow dry that hair and never let it down.

RocketFetus

Quote from: Franklin G. Hamilton;1511726for dynamic textboxes you put var as counter, not the instance name.

then you can reference it like _root.counter = 343425453;


Resolved!

Thanks!!

edit: THANKS GUYS IT'S MY FIRST TIME MAKING A GAME
Now everybody wants this thick afro body but I blow dry that hair and never let it down.