efrenmgp wrote:
> I have a class to lad data from a php script and it loads just fine, my problem
> is that I can't pass the data to a property of that class. (see example code):
>
> It loads the id value without any problem, my problem is about scope. the
> onLoad() function is a method of the lv object, and from there, the properties
> of my class are completely out of scope, at least I don't know how to reach
> them.
>
> Anybody can help?
>
>
> Thanks!!
>
> class test {
> public var id:Number = 0;
>
> function test() {
> var lv:LoadVars = new LoadVars();
>
> lv.onLoad = function(success:Boolean) {
> if (success) {
> trace("load was OK");
> trace(this.id); // Shows the received value
> id = this.id; // This is wrong because 'id' is not static, but it needs
> not to be static
> // How can I assign lv.id to the id property of the class from here?
> } else {
> trace("load was not OK");
> }
> }
>
> lv.load("
http://www.domain.com/id.txt");
> }
> }
the LoadVars event handlers. Look here for more info (applied to XML,