A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Conditional functions

  1. #1
    Swollen Member jhbiddle's Avatar
    Join Date
    Jan 2001
    Location
    Cambridge, England
    Posts
    141

    Angry

    Hello everyone!

    I am wanting to set a variable, and if this variable is a certain value, reveal a movie. I know the variables are being written okay, as I have some dynamic text boxes saying so. What I have so far is:

    if (input == z) {
    setProperty ("movie_ins", _visible, 1);
    } else if (input == x) {
    setProperty ("movie_ins", _visible, 0);
    }

    Also, where to put this code? In a loop in the timeline? In a ' onClipEvent (load) '? In the button?

    Simple problem, except I just swapped Flash 4 for Flash 5. hmmmmm. Many thanks for any help at all!

    cheers, Heresjonny

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    150
    Are you making the value of z a number? It may help to make it a number because '==' is checking for a value of TRUE and if the value is a string, I think this can jumble stuff up.

    Let me know if this works.

    And if that doesn't help, the other thing i could suggest to try, is to put 'movie_ins' into it's own movie clip, and have a frame that has it present, and one frame empty - but this route makes the level of communication a little deeper and that can get confusing also.

    Good luck.

  3. #3
    Senior Member
    Join Date
    Nov 2000
    Posts
    168
    stereokitchen is correct, the boolean value for a letter is false so neither of those if statements would work, unless you have declared z and x as numbers previously.

  4. #4
    Swollen Member jhbiddle's Avatar
    Join Date
    Jan 2001
    Location
    Cambridge, England
    Posts
    141

    Smile

    stereokitchen, stork1515...

    I LOVE YOU!

    thankyou thankyou thankyou

    You are Flash Jedis. The force is indeed strong in you.


    Come visit my web site some time, you are welcome. The new one "should" be running in a week or so (yeah right). But at the moment it is:

    http://www.heresjonny.com


    THANKS GUYS!

    jonny

  5. #5
    Swollen Member jhbiddle's Avatar
    Join Date
    Jan 2001
    Location
    Cambridge, England
    Posts
    141
    ... and as a PS too, for people moving from Flash 4 to 5;

    I spent several days trying to work out why my if (input = z) was not working.

    In Flash 4, = is the operator, while in 5 it is replaced by == for equality.

    If you use = it SETS the variable to 'z' ignoring the 'if', which certainly had me confused.

    just a thought,

    j

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