views:

164

answers:

2

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
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
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
Interesting idea, I'll give that a try.@Myk - how would you implement nonscalingWidth/Height functions?
Jeff Schumacher
+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
Thanks, I didn't realize that could be happening.
Jeff Schumacher
Thanks again, this helped me solve the problem. Once I resized the contents of the movieclip, everything else worked as expected.
Jeff Schumacher