vendredi 17 février 2017

Actionscript 3 scaling

I've recently started coding in Actionscript 3, and I've run into a problem when trying to scale a MovieClip.

    private var valGrandX:Number;
    private var valGrandY:Number;
    public function Bonhomme_Fil()
        valGrandX = this.scaleX;
        valGrandY = this.scaleY;

        this.addEventListener(MouseEvent.ROLL_OVER, big);
        this.addEventListener(MouseEvent.ROLL_OUT, small);
    private function big(event:MouseEvent):void
        this.scaleX *=  1.5;
        this.scaleY *=  1.5;
    private function small(event:MouseEvent):void
        this.scaleX = valGrandX;
        this.scaleY = valGrandY;

My goal is to have the Clip become larger when the user's mouse hovers over it, and return to its normal size when he hovers outside of it. What ends up happening is that when it scales to a bigger size it moves towards the bottom and right, and ends up flickering back and forth.

Aucun commentaire:

Enregistrer un commentaire