//another way to scale smoother but harder to control conditional needed
//controls scaling --you don't want to scale until you click the ball
var OnScale:Boolean;
//another way to scale smoother but harder to control conditional needed
//sets cond boolean to true
this.addEventListener(MouseEvent.MOUSE_DOWN, ongo, false, 0, true);
//sets cond boolean to false
//stage is the object here becuse while dragging the cursor is off the stage
this.addEventListener(MouseEvent.MOUSE_UP, onstop, false, 0, true);
//loops trough scaling process
this.addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
//cicle clicked scaling is allowed to begin
function ongo(evt:MouseEvent):void {(OnScale=true);}
//mouse up scaling stops
function onstop(evt:MouseEvent):void {(OnScale=false);
}
//loop for scaling, loop is controlled by conditional.
function onLoop(evt:Event):void {
if (OnScale)
{
evt.target.width = Math.max(mouseX - this.x, 10);
evt.target = Math.max(mouseY - this.y, 10);
}
}
Bookmarks