Hi  Ricardo,

what you need to provide to the addListener method call is the 3rd parameter
(the 'context').
So in your example :
<code>
  request.addListener("completed", function(e) {
  // ... cut the methods body for readability.
  // ... But the next line is important!
  }, this);
</code>

For further enlightenment here's an example using two different contexts:
  http://tinyurl.com/2e4jcgv
Play with it!

@Petr & Fritz : I know you were faster during my writing, but I wanted to shed
                more light on this...;)

Cheers,
  Peter

On 2010-07-14 17:03 rlbferreira wrote:
> Hi,
> 
> I'm trying to do a remote request/response - http://pastebin.com/NLZWpifw.
> 
> And the script is working just fine! My problem has to do with the variables
> scope.
> 
> If I try to access a variable of the script that I'm calling from, it gives
> me a error because the variable is not defined. But I defined in the
> "members" and even in "main". Can anyone help me?
> 
> -- Example --
> 
> request.addListener("completed", function(e){
>       if(e.getContent() == "true")
>       {
>             this.tmp_var = true;
>             alert('True');
>       }
>       else
>       {
>             this.tmp_var = false;
>             alert('False');
>       }
> });
> 
> -- --
> 
> Thanks in advance.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to