1 person found this helpful
Try tracing myImage since it defines polaroid_image. I don't think you have a value defined for it. Especially not at this point since you just initiate loading and then try to assign it a value relative to the file that has not yet loaded...
var myImage = myXML.firstChild.childNodes;
You already know the problem... a variable out of scope problem.
So all you need to do is declare the "var polaroid_image:String;" outside the private init function.
EDIT: my bad, to quick to respond.
Your onload function will only be executed once the XML is loaded.
You should wait untill the XML is loaded, before running anything else.
That's why it'll return values as undefined, because they aren't loaded yet.
Put those actions into a seperate function, and call that function from within the onload statement.
done that, it outputs correct values. maybe its a 'out of scope' problem whcih i m now trying to resolve
It is not a scope issue. It is due to you trying to deal with a value that is not yet defined. Just because you place that code after the onload function does not mean it executes after the onload function. The onload function sits and waits for the loading to finish, but the rest of the code after it executes before the loading is done.
You need to have any processing that is supposed to happen after loading is complete within the onload function.
You can confirm it is not a scope issue by assigning a value to polaroid_image when it is declared... you should see that value when you run it...
var polaroid_image:String = "value before file is loaded";