Hi,
Not sure what you are trying to achieve with your onLoad function
Are dynamictext & dynamictext2 text boxes ?
Try tracing the size of the image like this
Sorry i didn’t realize that I could do that with the actionscript. What you suggested didn’t work. I’ll explain what I am doing…
[AS]
//I am loading a picture where “picture”
// is the name of the picture (mypic.jpg)
image.loadMovie("./images/" + this.picture);
//I want to make sure that the picture is
// loaded before i run my commands because of how
//Flash works that unless i make sure that the imgae
//is fully loaded it will continue to get its _height
//even if it isn’t loaded, resulting in a 0
image.onLoad = function(success){
if(success){
//I want to set the y pos of movieclip image
// (containing loaded picture). The image pos
// will be set below the textbox “dynamictext” according
//to its height.
image._y = dynamictext._height+50;
//“dynamictext2” (another textbox) will be placed
//underneath the image. So the order
// is “dynamictext”, “image”, "dynamictext2"
dynamictext2._y = 30 + image._y + image._height;
} else {
trace(“not loaded”);
}
};[/AS]
The main problem is that the onLoad function does not work. It can’t tell if the image is loaded or not. My picture loads but the function doesn’t run, it doesn’t even say “not loaded” and I substituted in what you suggested and it doesn’t even trace its height.
Hi,
yeah, I agree, what I suggested doesn’t work - just been testing it myself. After looking at the Flash help files (F1) the succes function needs to be in an onEnterFrame
What’s REALLY annoying is that if I press a button to advance to the next frame, with the image movieclip still there it can then find the attributes of the movieclip. It is driving me absolutely nuts
Hi,
Agree - it is starting to make me a little crazy as well. I have an idea that using the succes function with images doe not work the same way as when loading in text. Looking at the Flash help files I think you need to use getBytesLoaded and totalBytesLoaded a bit like loading in an swf.
I have seen a tute somewhere on loading jpg’s in this way, but cannot for the life of me remember where.
have you done a search on these forums for dynamically loading jpg’s ? Just an idea - i will keep looking for you tho’ i am getting short on time for today.
It might be an idea to repost this Q and hope that someone like senocular or lostinbeta jump in as I feel sure they will know the answer.
Sorry I couldn’t help more, will post if I find a solution
Hi bozo,
Didn’t jump into your new thread, neither has anyone else I notice !
Looked around a bit at actionscript.org for you and came up with a couple of threads that may be of use to you. You will definitely need to use getBytesLoaded etc etc before performing any actions on your jpg’s, try these, let us know how you get on
=) Thanks, for those links, much appreciated. I posted what I had found in the other thread. The code is rather large and cumbersome, but hopefully your links will help me to narrow the code down a bit more.
Creating engaging and entertaining content for designers and developers since 1998.