PDA

View Full Version : how to change a clip's height without affecting the width?



encaps
July 18th, 2010, 09:25 AM
Hello everybody!

There is movie clip "iGun" on the stage, when I change the clip's height, the width becomes automatically scaled ( I don't know why)
simple sample :


iGun.height = mouseScale * iGunH / 100;Full code:



public class Untitled extends MovieClip {

public function Untitled():void {
stage.addEventListener(MouseEvent.MOUSE_MOVE, m_mouseMove);
}

function m_mouseMove(event:MouseEvent):void {
var mouseAngle = Math.atan2(stage.mouseY - iGun.y,
stage.mouseX - iGun.x) * 180 / Math.PI + 270/Math.PI;
iGun.rotation = mouseAngle;

var iGunH:int = 200;
var iGunW:int = 50;
var mouseScale:int = (360 - mouseY) * 100 / 360;
iGun.height = mouseScale * iGunH / 100;

}

The demo:
http://www.encaps.net/software/flash/Untitled.swf

The question: how to change the clip's height, without affecting the width?

OMG
July 19th, 2010, 12:33 AM
try scaleY instead?