I think I'm quite good with AS2 now, and I want to learn AS3.
I know AS3 only works on the main timeline, but here is a code I'd like to see in AS3. I hope it isn't too complicated.
Code:onClipEvent (load) { var mousecontrol:Boolean = false; } onClipEvent (mouseDown) { mousecontrol = true; } onClipEvent (mouseUp) { mousecontrol = false; } onClipEvent (mouseMove) { this._rotation = Math.atan2 (_root._ymouse - this._y, _root._xmouse - this._x) * 57.2; } onClipEvent (enterFrame) { if (mousecontrol == true) { if (Math.sqrt ((_root._xmouse - this._x) * (_root._xmouse - this._x) + (_root._ymouse - this._y) * (_root._ymouse - this._y)) > 50) { this._x += 2 * Math.cos (this._rotation / 57.2); this._y += 2 * Math.sin (this._rotation / 57.2); } } else { if (Key.isDown (Key.LEFT) && Key.isDown (Key.UP)) { this._rotation = -135; this._x--; this._y--; } else if (Key.isDown (Key.LEFT) && Key.isDown (Key.DOWN)) { this._rotation = 135; this._x--; this._y++; } else if (Key.isDown (Key.RIGHT) && Key.isDown (Key.UP)) { this._rotation = -45; this._x++; this._y--; } else if (Key.isDown (Key.RIGHT) && Key.isDown (Key.DOWN)) { this._rotation = +45; this._x++; this._y++; } else if (Key.isDown (Key.LEFT)) { this._rotation = 180; this._x -= 2; } else if (Key.isDown (Key.RIGHT)) { this._rotation = 0; this._x += 2; } else if (Key.isDown (Key.UP)) { this._rotation = -90; this._y -= 2; } else if (Key.isDown (Key.DOWN)) { this._rotation = 90; this._y += 2; } } }




Reply With Quote
