Okay I'm using the LoadVars (object) to open a text file. Here is my AS [hr var input= new LoadVars() input.onLoad = function (success){ trace("Load Succeeded? " + success) if (success for (var p in this if (p != "onLoad" trace ("var " + p + " loadeded with value: "+ this[p]) input.load ("loadme.txt") trace (input.work) [hr [U]Here is what I get from my output box:[/U undefine Load Succeeded? tru var class1 loadeded with value: Monday330 var work loadeded with value: Sunday126Monday93033 [hr I'm trying to access the variable work, but it claims it is undefined. What is the corret syntax for accessing a variable from the LoadVars(object)? Or is the variable not loaded yet at the time the action-script tries to call it and if so, how do I get the actionscript to wait for everything to load. And are the variables from my text file regarded as global? Or are the varibles scope limited to just that frame
you're right, at thge time of that trace command the var is not laoded yet. It looks like you have the onLoad function there, just put the trace(input.work) within the onLoad function.
ye Flash will not wait for data to be loaded. Therefore the only way to garantee code is executed after external data is loaded is to use onload one way or another. You could actually force Flash to stop then paly onLoad, but basically you need to use onLoad/. Is there a reason you want it outside of the onLoad
Don't see what you're looking for? Try a search.
|