PDA

View Full Version : trouble after dynamically loading .jpg



rysolag
September 9th, 2003, 07:22 PM
I use the following to load a jpg:

this.createEmptyMovieClip("loader_mc", 1);
this.loader_mc.loadMovie("mypic.jpg");

I can only set its position:

this.loader._x = 10;
this.loader._y = 10;

and change its size with the _scale properites:

this.loader_mc._xscale *= .25;
this.loader_mc._yscale *= .25;

If I do something like:

this.loader_mc._width = 500;

everything disappers. Or, with:

this.loader_mc.onEnterFrame = function()
{
this.loader_mc._x += 2;
}

does not produce any motion.


I want to change the size with the _width and _height properties and move it around. Is this possible?

Thanks

Voetsjoeba
September 10th, 2003, 07:12 AM
Move it around ? In what way ?

You made an error in you script: when using

this.loader_mc.onEnterFrame = function(){
this.loader_mc._x += 2;
}
The this inside the onEnterFrame handler will refer to loader_mc, so what you are doing is calling loader_mc.loader_mc._x, which doesn't exist of course. Use this._x += 2 =)

About the _width; I don't know why that happens, it shouldn't. I'd have to see the FLA for that.

kode
September 10th, 2003, 08:35 AM
Once the image is loaded into the MovieClip, most of its properties are set to their default value (the _width and _height properties are set to the width and height of the image), event handlers are cleared and variables/objects defined in the MovieClip will be lost.

There are several threads about this issue, you can run a search for those threads by clicking here (http://www.kirupaforum.com/forums/search.php?s=). ;)

Eric Jr.
September 10th, 2003, 11:55 AM
rysolag, why didn't you ever reply to this thread?

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=31973

:-\