PDA

View Full Version : Adjusting the width of a movieclip



sharvan11
October 13th, 2003, 12:22 PM
I need to read two image locations from a file and join it together.
For this i used the following code.

Part A:

//this reads from the file images.txt and puts in an array "images"
//the size of the array "images" is 2
//
m = new LoadVars();
m.onLoad = function(ok) {
if (ok) {
images = this.Images.split("|");
Trace(images.length);
Buildmovie();
}
};
m.load('images.txt', this);


Partb:
//

var count = 0;
_root.createEmptyMovieClip('preloader', 10);

function BuildMovie() {
_root.preloader.createEmptyMovieClip('holder',coun t);
_root.preloader.holder.loadmovie(images[count]);

setproperty ("_root.preloader.holder", _x, 20);
setproperty ("_root.preloader.holder", _y, 20);

count++;
_root.preloader.createEmptyMovieClip('holder_1',co unt);
_root.preloader.holder_1.loadmovie(images[count]);

setproperty ("_root.preloader.holder_1", _x, 20+ _root.preloader.holder._width);
setproperty ("_root.preloader.holder_1", _y, 20);


}


With this code I can load two images but I can't adjust the position of the second image with respect to first i.e: iam unable to capture the width of the first image.

Help needed!! :)

norie
October 13th, 2003, 02:25 PM
when you externally load jpgs into a flash movie, flash does NOT know the width or height of the movie you are loading into it. Flash only recognizes widths of objects that were previoulsy drawn in flash or drawn during runtime.
so your use of
setproperty ("_root.preloader.holder_1", _x, 20+ _root.preloader.holder._width);
always is going to set _x to 20.

sharvan11
October 13th, 2003, 04:01 PM
Thanks for the reply.

In my case movieclip "_root.preloader.holder" is drawn during runtime.

So is it mandatory that we need to predetermine the size of the images that are loaded during runtime?