How to create the mouse interaction using actionscript 2 in FLASH. Below are my as3. i would like to downgrade as2. Any one can help me to come of this? Also i would like to know can we do it in AS2 or not. i am very first in flash.
import flash.events.Event;
import flash.events.MouseEvent;
var w:int = 300;
var h:int = 250;
var mdist:int = _bg.width - w;
var mdisty:int = _bg.height - h;
var coef:Number = 0.1;
var autoX:Number = - mdist;
var autoSpeed:Number = ( mdist / (24 * 15) );// (distance in pixel / (fps * secs);
var autoMove:Boolean = true;
var autoDirection:int = 1;
stage.addEventListener(MouseEvent.MOUSE_OUT, stage_MouseOut);
stage.addEventListener(MouseEvent.MOUSE_OVER, stage_MouseOver);
this.addEventListener(Event.ENTER_FRAME, this_EnterFrame);
this.addEventListener(MouseEvent.CLICK, this_Click);
this.buttonMode = true;
_bg.x = - mdist;
_bg.y = - mdisty >> 1;
_copy.mouseEnabled = false;
_copy.mouseChildren = false;
_logo.mouseEnabled = false;
_logo.mouseChildren = false;
function this_EnterFrame(e:Event):void {
if (autoMove) {
_bg.x = autoX;
_bg.y += (-mdisty / 2 - _bg.y) * 0.2;
autoX += autoSpeed * autoDirection;
if (autoX > 0 && autoDirection == 1) {
autoX = 0;
autoDirection = -1;
} else if (autoX < -mdist && autoDirection == -1) {
autoX = - mdist;
autoDirection = 1;
}
} else {
moveScene(mouseX, mouseY);
}
}
function moveScene(px:int, py:int):void {
var xx:int = Math.min(w,Math.max(0,px));
var yy:int = Math.min(h,Math.max(0,py));
var dx:Number = xx / w;
var dy:Number = yy / h;
_bg.x += (-mdist * dx -_bg.x) * 0.2;
_bg.y += (-mdisty * dy -_bg.y) *0.2;
}
Regards, HH