A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: referring a variable to a single frame only?

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    I am trying to get a variable take a specific value in a specific frame. I don't want it to be defined for the whole timeline.

    Currently, it looks like that:

    var cool;
    ifFrameloaded(instance1.labelx) {cool=2};
    ifFrameloaded(instance1.labely) {cool=3};

    but var always takes the value of the most recent ifFrameloaded statement....

    Thanks

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Posts
    390
    try this
    var cool;
    if (_currentframe==instance1.labelx) {
    cool = 2;
    } else if ( _currentframe==instance1.labely) {
    cool = 3;
    }


    hth,

    -g

  3. #3
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    can i do that with more than two values, too?

    I am not that familiar with ActionScript (or any other programming language ;-)yet. I was missing the case[] option
    that I know from C. I actually have about five frames to jump to.
    I cannot do that with if - else because that only allows tow options, right?


  4. #4
    Senior Member
    Join Date
    Sep 2000
    Posts
    390
    sure you can, you can, you can string together as many if else statements as you want.
    there is probably more elegant way to do it, but i don't know enough about progrmming to know what that might be.

    hth,

    -g

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