A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] Elastic on Stage Resize

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    57

    resolved [RESOLVED] Elastic on Stage Resize

    I would like to know how to make the stuff being "resized" elastic while being "resized".

    This is the code.

    Code:
    import fl.transitions.Tween; //this is for the tweens in resizer
    import fl.transitions.TweenEvent; //this is for the tweens in resizer
    import fl.transitions.easing.*; //this is for the tweens in resizer
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    
    function resizeHandler(e:Event):void
    {
      fermez.x = fermez.stage.stageWidth - fermez.width - 30;
      fermez.y = fermez.stage.stageHeight - fermez.stage.stageHeight + 30;
      MP3_Player_BG.x = stage.stageWidth - stage.stageWidth + 30;
      MP3_Player_BG.y = MP3_Player_BG.stage.stageHeight - MP3_Player_BG.height;
      MP3_Player.x = stage.stageWidth - stage.stageWidth + 30;
      MP3_Player.y = MP3_Player.stage.stageHeight - 20;
    }
    stage.align = StageAlign.TOP_LEFT;
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    
    stage.dispatchEvent(new Event(Event.RESIZE));
    Now how do I make the mc's being resized have an elastic tween while being "resized"?

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    For starters, grab TweenLite instead of the Adobe tweening - it's much more reliable for this kind of work. With that included, you can use the same formulas you have now, just pass them into the tween:

    PHP Code:
    import com.greensock.*;
    import com.greensock.easing.*;

    // ...

    TweenLite.to(fermez.x1, {x:fermez.stage.stageWidth fermez.width 30ease:Elastic.easeOut}); 
    Please use [php] or [code] tags, and mark your threads resolved 8)

  3. #3
    Member
    Join Date
    Sep 2009
    Posts
    57
    Quote Originally Posted by neznein9 View Post
    For starters, grab TweenLite instead of the Adobe tweening - it's much more reliable for this kind of work. With that included, you can use the same formulas you have now, just pass them into the tween:

    PHP Code:
    import com.greensock.*;
    import com.greensock.easing.*;

    // ...

    TweenLite.to(fermez.x1, {x:fermez.stage.stageWidth fermez.width 30ease:Elastic.easeOut}); 
    does this also apply to the Elastic.easeOut tween. This is what I plan to use for the elastic tween.

  4. #4
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Yup - you can put in any easing function you want.
    Please use [php] or [code] tags, and mark your threads resolved 8)

  5. #5
    Member
    Join Date
    Sep 2009
    Posts
    57
    Quote Originally Posted by neznein9 View Post
    Yup - you can put in any easing function you want.
    ok, could you give me a sample of how I would type the script in?

  6. #6
    Member
    Join Date
    Sep 2009
    Posts
    57
    Quote Originally Posted by neznein9 View Post
    Yup - you can put in any easing function you want.
    the script did not work. Now the mc does not even "resize".

  7. #7
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Post your code and any errors you're seeing.
    Please use [php] or [code] tags, and mark your threads resolved 8)

Tags for this Thread

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