vendredi 7 avril 2017

actionscript 2 to actionscript 3 my code

can someone help me to transform this code from as2 to as3?

For a simple circle, i want when i go with mouse cursor to right , the circle to rotate (don't need to move my mouse cursor but the circle still rotating)

I know that _root._xmouse goes t mouseX and this._rotation goes to this.DisplayObject.rotation

onClipEvent(enterFrame)
{
    this.xmouse = Math.min(908, Math.max(0, _root._xmouse));
    if (_root._xmouse > 0) 
    {
        var offset = Stage.width / 2 - this.xmouse;
        this._rotation = this._rotation + offset / 2000;
    } else {
        this._rotation = this._rotation - 0.02;
    }
    this._rotation = this._rotation % 180;
}

Aucun commentaire:

Enregistrer un commentaire