0
votes

I created an empty movie clip, where i loaded image from cliploader. I want the movie clip to have fixed height and width, and the image should fit in the movie clip.

I could not figure out any method to do that. Can anyone help?

Note: I am using Actionscript 2.0

1

1 Answers

0
votes

let's assume your movieclip that has loaded the image is called pic_holder you set it's width and height via pic_holder._width pic_holder._height properties

but i guess you have already tried this and your problem is that it doesn't work. the problem, most likely is that you are trying to resize it before the image has loaded. therefore you must resize the image after it's loaded.

therefore you may a) either loop continuously and check to see if it's loaded or not b) add an event listener that will call the resizing function when the picture is loaded

a)

this.pic_holder.onEnterFrame = function(){
  if(this._width>0){
    this._width=...your width...
    this._height=...your height...
    this.onEnterFrame=null;
  }
}

b) extracted from as2 language reference. note that we are using loadClip instead of loadMovie

  var loadListener:Object = new Object();
  loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
    target_mc._width=...your width...
    target_mc._height=...your height...
  }
  var mcLoader:MovieClipLoader = new MovieClipLoader();
  mcLoader.addListener(loadListener);
  mcLoader.loadClip("..path to image..", pic_holder);