Jump to content
Search Community

eyevolt

Members
  • Posts

    1
  • Joined

  • Last visited

eyevolt's Achievements

0

Reputation

  1. An alternate solution if you want to allow fast mouse clicks is to round the current mc.x value to the nearest whole width value. This will make sure that you are always using even increments. myBtn_left.addEventListener(MouseEvent.CLICK, moveleft); //<---tried wit CLICK, MOUSE_UP, MOUSE_DOWN, nothing function! function moveleft(e:MouseEvent):void{ // round to nearest whole width then subtract the width as the move increment var moveStep:Number = Math.round(myMc.x/myMc.nmbr_1.width)*myMc.nmbr_1.width - myMc.nmbr_1.width; //perform the tween TweenLite.to(myMc, 1, {x:moveStep, ease:Sine.easeOut}); if you need to constrain the x value to a minimum limit place a conditional statement around the Tween call like this: // if moveStep > 0 allow Tween otherwise Tween to 0 (min value) if (moveStep > 0) { TweenLite.to(myMc, 1, {x:moveStep, ease:Sine.easeOut}); } else { TweenLite.to(myMc, 1, {x:0, ease:Sine.easeOut}); }
×
×
  • Create New...