A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: smooth mouseover/off effects

  1. #1
    Junior Member
    Join Date
    Feb 2004
    Posts
    4

    smooth mouseover/off effects

    Hello, world!

    Any idea how to implement a menu that will roll gracefully from mouseover to mouseout?

    I set a word to scale to 1.25 over 1 sec on mouseover, and then scale back to 1 over 1 sec on mouseout, but if you just slide over the word without letting it slide smoothly all the way, it jumps to 1.25 and then back to 1.

    I want it to scale to 1.25 over 1 sec, but start scaling back to 1 from wherever it is when you mouseout.

    I would actually like to use the principle in a number of areas, but I'm working on a website navigation scheme right now.

    Thanks for your help!

  2. #2
    Junior Member
    Join Date
    Feb 2004
    Posts
    4


    Argh! I just ran into another place where I need to be able to do this. Have a movie or effect start, and then roll back gracefully when I mouseout.

    I will email a picure of a cookie to whoever can help me out!

  3. #3
    Senior Member zoranvedek's Avatar
    Join Date
    Aug 2001
    Location
    Wagoner OK
    Posts
    893
    On mosue over set your scale RATE. You'll want to put a failsafe in there using a vriable for scale(say 'x'), so that when it scales to a certain size you can stop it and set it there(if x=125 set scale to 125 set scale rate to 0). On mouseout do the opposite.............


    -J

  4. #4
    Junior Member
    Join Date
    Feb 2004
    Posts
    4
    Thanks for taking the time to help a newbie --

    I've tried to do that, but I can't seem to get the "failsafe" loop part to work. In 3dfa, where do I do that?

    I wrote the following "scripts" and attached them to the mouseover and out tabs of my text item:

    MOUSEOVER
    ===========================
    xsize = element ("Text 4").scale.x;
    element ("Text 4").scale_rate.x = 15;
    while (xsize <= 125)
    { xsize = element ("Text 4").scale.x; }
    element ("Text 4").scale.x = 200;
    element ("Text 4").scale_rate.x = 0;

    MOUSEOUT
    ===========================
    xsize = element ("Text 4").scale.x;
    element ("Text 4").scale_rate.x = -15;
    while (xsize >= 101)
    {
    xsize = element ("Text 4").scale.x;
    }
    element ("Text 4").scale_rate.x = 0;
    ============================

    Maybe someone who knows something about how this all works can tell me why I get the "Breaking out of possible infinite loop" warning, and my text just keeps scaling forever? )

    Thanks so much!

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    You mean like this:
    Test

    Source

    What I did in the event for the text just set and unset the variable over to true or false.

    Then in an action that is called once per frame I put
    PHP Code:

    if (over&&mytext.scale.x<maxsize){
        
    mytext.scale_rate.x=50
        mytext
    .scale_rate.y=50
        
    }else{
        
    mytext.scale_rate.x=0
        mytext
    .scale_rate.y=0
        
    }
        
    if (!
    over&&mytext.scale.x>minsize){
        
    mytext.scale_rate.x=-50
        mytext
    .scale_rate.y=-50
        
    }
        
    if (!
    over&&mytext.scale.x<=minsize){
        
    mytext.scale_rate.x=0
        mytext
    .scale_rate.y=0
        

    Oh and my start sctipt sets mytext to the element

    PHP Code:
    mytext=element ("Text 133")
    maxsize=125
    minsize
    =100
    over
    =false 

  6. #6
    Junior Member
    Join Date
    Feb 2004
    Posts
    4
    Wow! That's exactly what I want to do. )

    Thanks for the tremendous help!

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