Flash: on imageLoad
- Started
- Last post
- 6 Responses
- usrper
im having big trouble trying to find this out:
images load dynamically into MC from a text file, along with a preloader.
what i want is to have an mc to play, when a CERTAIN image is loaded...
i know i have to write an "if" script on the preloader when the pic is loaded, but no idea what,..
- Anarchitect0
if(mc.getBytesLoaded() == mc.getBytesTotal( && mc.getyteesTotal() > 4) {
mc.play();
} else {
mc.gotoAndStop(1);
}
- System-Idle0
do you have one pre loader, or a pre loader in each image yr loading?
in yr text file you could set an extra var that holds the correct mc name that you want to play.
text file: &imageURL=myPic &mcToPlay=mc1
- System-Idle0
when yr image has loaded feed a function with the mc name to play
- usrper0
system-idle,
i have only one preloader for all images. the text in my file is like this:
&image=bumers.jpg, bumers2.jpgso you mean i can do something like
&image=bumers.jpg&bumersMC=mc1, bumers2.jpgand because i have only one loader, what should i put after the:
if(mc.getBytesLoaded () == 100
thanks for the help...
- usrper0
sory i have to bring this up again.
so i set the variable in the text file, but should i place the function to play the variable after the getbytesLoaded?
- System-Idle0
not 100% sure how yr loading the data. from what you have said it looks like yr loading all yr image URL's as one string var.
I asume then that you are loading all yr images in one shot, and when each image finishes loading you whant something to happen?
The old way of doing this would be to use an onEnterFrame to check each mc and see if its bytesLoaded==bytesTotal
then call the function.
The newer way would be to use the LOAD class
and then call the function with onLoad