A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: i think " IF " could solve this

  1. #1
    Senior Member
    Join Date
    Oct 2003
    Posts
    187

    i think " IF " could solve this

    Hi im working with this 3 buttons and 3 "stains "
    two are content and the other one will be for contact info.
    The stains are masked on sprites,that scale the mask in.
    when i was first creating this i assigned each button a
    action to play every sprite near a remove effect then the other appears.
    that was my way to remove each sprite and show the other.
    But now i came up with the idea that its way cooler that
    if im on the stain 1 (that scales in the mask) and want to go to stain 2 or contact,its scales to 0% it is perfectly done
    when you click button 2 and then click button 3.
    the stain scales out and dissapear.how cool.
    but wait...if im on "stain 1 " and want to go to "contact (bt 3)"
    the stain 2 appears ! and its really annoying,
    what i think is that i can do it this way.
    with the "IF" conditional method,i tried but i couldn't make it work.
    i need help.The idea is that the stain 2 scales out ..only if it was displayed before and so with the other..
    Attached Files Attached Files

  2. #2
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    seeing that you've meanwhile decided to... erm... buy, i mean update your swish version and are now able to open sample files, i modified your file. see if it helps.
    Attached Files Attached Files

  3. #3
    Senior Member
    Join Date
    Oct 2003
    Posts
    187
    AHHH Lys !
    that math think make the scale thing so much smooth!
    i wish i can script like you ..
    its so complicated.
    thanx but i need to know how to do it using if..
    thanx

  4. #4
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    hm. something like this maybe?
    Attached Files Attached Files

  5. #5
    Senior Member
    Join Date
    Oct 2003
    Posts
    187

    LYS

    LYS 12 IM AMAZED!!!!!!

    please explain me how you did that !!!!!!
    im amazed thanx !!!!!
    thanx but there is lots of codes on scene 1

    selection ..how does it work ?

  6. #6
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    "selection" is just a variable name. you can name it "milkshake", "x" or "calderone" instead.

    button 1 sets "selection" to "1" (could be anything as well, e.g. "a").

    the code in scene 1 checks for the value of the "selection" variable on every frame(onenterframe). e.g. button 2 sets it to 2, now the code for a value of 2 will run. the "_root." in front of "selection" simply makes the variables available across sprites, so you don't have to worry about paths.

    to learn more about the easing method, open the help files in swish, and do a search for "math.approach".

  7. #7
    Senior Member
    Join Date
    Oct 2003
    Posts
    187
    Thanx for your explanation,i will study more
    the math and all scripting,you can make wonders
    with that,and avoiding paths.
    well..im just starting to understand all the paths.
    as we can say "beginner scripting" .-
    Btw lys this can't be done following path scripting?

  8. #8
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    just to avoid confusion, all the _root.'s in front of the sprite names in the script aren't necessary of course - you'll have to leave it in the button actions though (i just copypasted them from the sprite i used in the example before).

    erm. what's path scripting?

  9. #9
    Senior Member
    Join Date
    Oct 2003
    Posts
    187
    LOL erm. what's path scripting?
    im referring if it can be done with
    simple scripts like this

    on (release) {
    _parent.sprite.gotoAndPlay(14);
    }

    or something like that ?

  10. #10
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    you probably want to combine it with if statemants? it can be done, but the objects will just disappear instead of downscale - as in the attached example. otherwise it'll get VERY involving.
    Attached Files Attached Files

  11. #11
    Senior Member
    Join Date
    Oct 2003
    Posts
    187

    YES

    YES !
    i've done that originally
    and i tought i could do something with the
    "revert" effect but it didnt happen.
    and yes ...i will stick to the dissapear.
    the other thing is too complicated.
    But i'll study your files anyway.
    You learn something new everyday !
    thanx lys !

  12. #12
    Senior Member
    Join Date
    Oct 2003
    Posts
    187
    i made that with other method maybe
    more confusing and not so organized
    on (press) {
    _parent.histmovie.gotoAndPlay(2);
    }
    on (release) {
    _parent.linksmov.gotoAndPlay(13);
    }
    on (release) {
    _parent.form.gotoAndPlay(135);
    }
    on (release) {
    _parent.gall.gotoAndPlay(14);
    }

    i will redo that
    thanx

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