This content has been marked as final. Show 4 replies
the trace statements at the end of the code get executed right after all the load() calls; it is very likely that the vars didn't finish loading at that moment. To be on the safe side, use those vars in the onLoad event of LoadVars, this makes sure the code executes after the loading finished.
thanks so much for your reply, totally stumped on this one.
Just to clarify, do you mean that the variables are being given values but that when they are being printed out at the bottom they are not yet assigned properly? If this is the case, how will I be able to ensure that they have values in time for me to use them elsewhere in the code. Would an interval do the job?
Thanks again for your help, you're saving a poor master thesis group here :)
Well clarified. :)
To use those vars, you can make use of the onLoad event. Code in this gets executed when the loading finished. The usage of the loaded vars can be placed there, or a function can be called, that uses the loaded values. I like to use nextFrame() to jump to the next frame, and use the vars in that frame.
Now there are several loading processes, which makes this a bit difficult. Using an interval seems to be a good idea, you can set variables like 'name1loaded' in each onLoad event, and have the interval check all those vars. When all are true, everything is loaded and you can go on.
Another way might be to load all variables in one go, but then you would need to change the php, so maybe the interval is better.
I got it working!! thank you sooooo much! You've saved our lives. I'll have to remember this problem..cause I think it might the source of a few other hiccups throughout our game. You've made my day!!