I have a movie clip object with a width of 306 and height of 194. I need to change the dimensions of the movie clip and still have the x and y scale set at 100. Currently when I change the movie clip width to 352.8, the x scale increases to 115.3%. I have to have the scale reset to 100% after I've adjusted the movie clip's width. Is there a way to do this in CS3? (this is all in design mode, not run time). Do I need to delete the movie clip and recreate it?
+1
A:
Perhaps there is a more proper way to do this, but you could resize a container inside your movieclip to the size you want.
...
Constructor() {
this.container = new Sprite();
addChild(container);
}
override public function set width(value:Number):void{
container.width = value;
}
override public function set height(value:Number):void{
container.height = value;
}
...
Les
2009-11-11 11:31:01
I'd be careful about overriding the width and height setters of the parent - you may conceivably need those later. Instead, I'd create new methods like nonscalingWidth() and nonscalingHeight() and do it that way. But yeah - this will achieve the functionality you want.
Myk
2009-11-11 18:49:20
I think this depends on which part of your code doesn't want the scale properties to change. If it's from within the object itself overriding is being careful.. (right?)
Les
2009-11-11 20:18:30
Interesting idea, I'll give that a try.@Myk - how would you implement nonscalingWidth/Height functions?
Jeff Schumacher
2009-11-11 21:49:40
+1
A:
You would need to set a movieclip in your movieclip to the new size. For instance a background movieclip (with alpha to 0 if you don't want to see it). The parent movieclip will take the size of its children or what is drawn in it.
Lieven Cardoen
2009-11-11 12:54:51
Thanks again, this helped me solve the problem. Once I resized the contents of the movieclip, everything else worked as expected.
Jeff Schumacher
2009-11-13 16:43:39