TwelvestoneFlash

If else help


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
Suzy
 
2010-03-26

So sorry this is such a simple question but I'm rushing to meet a deadline and that plus no sleep means my brain has froze. What is the correct syntax in Flash to do the following:

Have a text box on the stage with the number 1 in it. When the playhead moves to the next frame it adds 1 to the number in that text box, checks if it is below 504 and if it is goes to the previous frame else it carries on playing forwards.

In theory it would go like

If kegnumber<504 then kegnumber = kegnumber + 1 goto previous frame else goto next frame end if

Thanks k

Suzy
 
2010-03-26

I can't even remember how to update text in a text field via actionscript???

Big Ern
 
2010-03-26

Obviously, first advice is to do it in AS3, but if you're in a hurry. Haven't tested it as I haven't written AS1 in ages, but...

Instance name for textbox: "textbox"

Frame 1: var kegnumber:Number = 1; textbox.text = kegnumber;

Frame 3: If ( kegnumber < 504 ) { kegnumber++; textbox.text = kegnumber; this.gotoAndPlay( 2 ); } else { this.gotoAndPlay( 4 ); }

However, this will go so fast, you'll probably not see the text change... it'll go to 504 almost instantly... you'll probably have to add a setInterval on frame 2 or summat.

What is this for?

Suzy
 
2010-03-26

Cheers for that you are a star k It's just for a banner animation that someone needs ASAP and rather than animate it counting I figured I'd just script it. I'll try it now. Thanks again k

Big Ern
 
2010-03-26

Like I said, I haven't tested that... there is probably a schoolboy error or two in it. k

Suzy
 
2010-03-26

Ahhh it's just not working. I have a text box on the stage in the root which I set to dynamic and gave the instance name textbox. And this on a frame:

textbox.text = "123";

Just to test it updates but when I test the movie the textbox is just blank? What am I stupidly doing wrong?

Can't believe it's been so long since I used code in Flash!!!

Suzy
 
2010-03-26

Ahhh I forgot - it's because the layer was masked!!

Big Ern
 
2010-03-26

Sorry, you also need to put a stop before the if/else statement. Told you there would be a schoolboy error.

Send me an email to robcutforth AT gmail DOT com and I'll send you my working version.

Big Ern
 
2010-03-26

Oh right, nevermind then. k

Suzy
 
2010-03-26

Hmm it's now setting it to 1 and is looping but it isn't updating the text field

Suzy
 
2010-03-26

Ohh email coming, thanks k

Big Ern
 
2010-03-26

I've sent you my file. Put a stop on frame 4 as well. k

Suzy
 
2010-03-26

Thank you sooo much for helping me fix this Big Ern k You are a star!!

daddybunchie
 
2010-03-26

Big Ern is a lycra wearing latte sipping bitch.

Expect nothing further from him in the way of help.

Big Ern
 
2010-03-26

But what if she needs help ordering a latte, what THEN? I'll be all over that problem like Oprah on a honey ham.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

If else help