dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: PLEASE HELP - kinda stuck... 100% width problem

  1. #1
    Newbie
    Join Date
    May 2009
    Posts
    4

    PLEASE HELP - kinda stuck... 100% width problem

    Little bit stuck, wondered if anyone had any advice, examples or links on how to do this. Basically this website here: http://www.spin.co.uk/ (site is a bit slow) and also this site here: http://www.elmwood.com/ do esactly what I am after.

    I'm aiming to get an image start 40 pixels in from the right edge (of the browser - using 100% width in css) and once clicked move to 40 pixels from the left edge.

    Now I've managed to (almost) do it fine in AS3, but, no problem with getting the image to glue to the right hand side, then tween to the left. It's when the user drags the browser to a nice size, the image jumps back over to the right!

    I almost need a bit of AS3 script that says 'once animation has completed, don't pay attention to the repositioning command!' if that makes sense!

    My coding is below; (ball_mc is my image)

    Code:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    
    this.ball_mc.startButton.addEventListener(MouseEvent.MOUSE_DOWN, playAnimation);
    this.ball_mc.startButton.addEventListener(MouseEvent.MOUSE_DOWN, nextframe);
    stage.addEventListener(Event.RESIZE, resizeListener);
    
    stage.frameRate = 60;
    
    ball_mc.x = stage.stageWidth -50;
    ball_mc.y = 20;
    
    function resizeListener (e:Event):void {
    ball_mc.x = stage.stageWidth -50;
    ball_mc.y = 20;
    }
    
    function resizeListenerEnd (e:Event):void {
    ball_mc.x = 40;
    ball_mc.y = 20;
    }
    
    {
    trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
    }
    
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
    
    var xTween:Tween;
    var yTween:Tween;
    
    function playAnimation(event:MouseEvent):void
    {
        var myTween:Tween = new Tween(ball_mc, "x", Strong.easeOut, ball_mc.x, (40), 2.5, true);
    myTween.looping = false;
    }
    Thanks if anyone has any idea!

  2. #2
    Newbie
    Join Date
    May 2009
    Posts
    4
    Doh, by 'nice' size I meant 'new' size!

  3. #3
    Newbie
    Join Date
    May 2009
    Posts
    4
    Well - I've just solved my own problem - for now!

    stage.removeEventListener(Event.RESIZE, resizeListener);

    but now I need another image to do the same... if anyone has any tips still would be much appreciated

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