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?

Jeff Schumacher
  • 3,126
  • 3
  • 23
  • 23

2 Answers2

2

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
  • 2,316
  • 16
  • 17
  • 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 Nov 11 '09 at 18:49
  • 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 Nov 11 '09 at 20:18
  • Interesting idea, I'll give that a try. @Myk - how would you implement nonscalingWidth/Height functions? – Jeff Schumacher Nov 11 '09 at 21:49
2

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
  • 25,140
  • 52
  • 153
  • 244