LoadVars is only used to send and retrieve variables, and also to retrieve the contents of a file. In this case, you won't be loading watermark.jpg, but rather just its content in text format, but Flash is not capable to get the RAW data of an image file. It will return nothing, and what you're doing is that after it loads the image file as nothing (no text) into Flash, you're then loading the actual image into a movieclip into Flash, and that code is executed once the image's RAW data (no text) has been loaded into Flash, while your if statement is static, meaning that it is only executed ONCE and that is when you enter the Frame that code is on. So, when you enter that frame, LoadVars is created and then the if statement is checked, but after a few milliseconds, then the actual image is loaded (because onLoad takes a bit time to load the data into Flash), but the if statement has long since been executed once, so it won't be checking again, because there's no code around it that tells it to continuously check whether wm's width and height are greater than certain numbers. What you can do, is to simply wrap the if statement with an onEnterFrame loop, which keeps executing the code (keeps checking), but this is not adviced to do, but here's the code (for if statement):
but what you can do, which is also MUCH better, is to use the MovieClipLoader class, which ships with an event handler for when the image has been loaded into Flash, and THEN you can run the if statement once, or, if you only want to check when the image has loaded, you don't even need to do that:
loader = newObject(); loader.onLoadInit = function(){ // codes here will be executed once the image has been loaded into Flash _root.wm.attachMovie("zastepczy", "zastepczy2", 1); } mcLoader.addListener(loader);
17 Years old boy, who loves the Computer Technology
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
loader = newObject(); loader.onLoadInit = function(){ // codes here will be executed once the image has been loaded into Flash [B]ImageIsLoaded=true;[/B] _root.wm.attachMovie("zastepczy", "zastepczy2", 1); } mcLoader.addListener(loader);
Then in an onEnterframe:
Actionscript Code:
onEnterframe=function(){
if(ImageLoaded==true){ //do nothing } else{ load the .png } };
Hope this helps , and that I really understood what's going on with your situation.