Groups | Blog | Home
all groups > flash actionscript > august 2005 >

flash actionscript : Anyone come accross this? or is there another way?


ActionScripter1
8/22/2005 8:25:21 PM
Hi Guys,

been trying to use setProperty to resize a movieclip but it seems that it only
works on press or release and I need it on Frame 1.
Any suggestions or work arounds welcome.

Thaks in advance.
Sudoku92
8/22/2005 8:39:52 PM
ActionScripter1
8/22/2005 8:46:16 PM
Unfortunatly I cannot do that because I am using loadMovie to load an external
..swf or jpg
I do not know the size of the swf or jpg as it is loaded in dynamically using
php and mysql.

Any help on this would be great. or anyone with experience of scale mc.

Thanks
Clown-Z
8/23/2005 7:05:46 AM
Hi, if i'm not mistaking you're trying to load an imge or swf in an container
and resize it after it is downloaded.
the problem is that your resizing actions are executed once a container
appears on the stage and after an image is downloaded into container your
resizing actions aren't executed again.
To avoid the problem you shall check if each image is already downloaded and
only then apply resizing actions.
You can do it several ways (for example, you can use MovieClipLoadr Class) or
you can try to do something like this:

stop();

images_to_load=["1.jpg","2.jpg","3.jpg"];////you shall receive this array from
your php script

function attachContainers(){
for(i in images_to_load){
_root.attachMovie("imgCont","imgCont"+i,i,{_y:150*i});
if(i==0){
target=eval("imgCont"+(images_to_load.length-1));
target.loadMovie(images_to_load.pop())
loadInt=setInterval(loading,100,target);
}
}
}

attachContainers();

function loading(target){
percentage=Math.round(target.getBytesLoaded()/target.getBytesTotal()*100);
MyPreloader.ProgressBar._xscale=percentage;//optional. if you have a
preloader for each image
if(target.getBytesLoaded()==target.getBytesTotal()){
target._width=50;
target._height=150;
clearInterval(loadInt);
getNextMovie();
}
}

function getNextMovie(){
if(images_to_load.length>0){
target=eval("imgCont"+(images_to_load.length-1));
target.loadMovie(images_to_load.pop())
loadInt=setInterval(loading,100,target);
}
}
ActionScripter1
8/23/2005 9:55:56 AM
Thanks very much for that, this will be very usefull.

AddThis Social Bookmark Button