Skip to main content
Participant
August 22, 2007
Answered

DONT KNOW : How to Resize a movieclip created at runtime

  • August 22, 2007
  • 2 replies
  • 436 views
I don't know how to resize a movieclip created at runtime......



This topic has been closed for replies.
Correct answer BobbyDreamer
my_mcl is a MovieClipLoader, but the onLoadComplete event acts on a listener object, which you don't seem to have defined... so you also need to add to your code the following:

var listener:Object = new Object();
my_mcl.addListener(listener);
listener.onLoadComplete = function() {
// code here...
};

but I would recommend that you use:

listener.onLoadInit = function() {
// code here
}

because onLoadInit actually initializes the loaded image thus allowing you to set properties to your heart's content...

Good luck,

Albee

Thank You. It works. I used _xscale and _yscale.

var listener:Object = new Object();
my_mcl.addListener(listener);
listener.onLoadComplete = function() {
my_mc._xscale=25;
my_mc._yscale=25;

};

2 replies

Inspiring
August 22, 2007
wow. i'm really getting used to AS3. lol. my mistake bobby. I forgot to add the listener object and attach it to the MovieClipLoader in my example. My apologies. Looks like you've got things moving along now. Good for you.
Inspiring
August 22, 2007
any time you are using MovieClipLoader, loadMovie or loadMovieNum you have to wait until the load is complete before you can do anything with the mc's properties.

my_mcl.onLoadComplete = function() {
this.width = 100;
this.height = 100;
}
Participant
August 22, 2007
Thank you, for the reply. Iam still getting an error, saying

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 14: There is no property with the name 'onLoadComplete'.
my_mcl.onLoadComplete = function():Void {

How can this error be solved.
August 22, 2007
my_mcl is a MovieClipLoader, but the onLoadComplete event acts on a listener object, which you don't seem to have defined... so you also need to add to your code the following:

var listener:Object = new Object();
my_mcl.addListener(listener);
listener.onLoadComplete = function() {
// code here...
};

but I would recommend that you use:

listener.onLoadInit = function() {
// code here
}

because onLoadInit actually initializes the loaded image thus allowing you to set properties to your heart's content...

Good luck,

Albee