dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Variable Question

  1. #1
    I have a flash movie that loads in a second movie. I need to have the second movie set a variable to the same value as a variable in the first movie. I have tried everything I can think of and no luck...any ideas?

    Cheers,
    Clayton

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    if you are loading it onto a specific level, you can use (I'm assuming level 4):

    Code:
    _level4.myvar = _root.myvar;

    Spyder

  3. #3

    Perfect

    That was it, thanks I appreciate the help.

    "sigh" darn fangled new actionscript...make my life all complicated"

    Cheers,
    Clayton

  4. #4
    Senior Member
    Join Date
    Oct 2000
    Posts
    182
    I have a variable question as well. I have a movie clip that has four frames... each with a stop and set variable code on it. The four frames are four different states that the movie clip could be on during the movie..... and, as you dynamically move through it... the states may change depending on where they currently are at any given time.

    The variables seemed to be changing properly.. as i tested the movie the variable (when list varibles was used) would be defined properly.

    But when I added an if then statement..... if doesn't seem to work properly..... It seems to reset the variables, so it switches the states at the wrong time.

    The first state/frame is empty (so that the movieclip will not be seen) and myvar = 1... the second is when it shows up myvar = 2, and 3 and 4 are different roll over states later when it turns into a menu option as opposed to a title.

    The if statement says if myvar = 2 goto moviclip frame 3.

    This code seems to SET myvar to 2 though.... because it immediately switches the movie clip to frame 3 (the button state) when it should be invisible... the movie clips myvar is now being set to 2 somehow, when, before I had added the if statement it seems to set fine (but of course, not do anything.... the varaibles appeared fine in the list variables thing during testing the movie).

    Any thoughts?

  5. #5
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    Code:
    if (myVar == 2)
    You have to use "==" not "=". "=" is an assignment operator, "==" is a comparison operator.

    Spyder

  6. #6
    Senior Member
    Join Date
    Oct 2000
    Posts
    182
    damn it.... i knew it was that easy. Thanks... i was thinking myself crazy for awhile there.

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