On example 2, use var stg_run = function(url) . "var"  is missing.

Inner scope has this weird stuff. You can also open chrome console and check 
the object. You will note that this  variable didn't bind any object.

--
Robson Dantas
@robsondantas

Sent from my mobile device

Em 23/06/2011, às 17:03, "de...@chuwori.co.uk" <de...@chuwori.co.uk> escreveu:

> Could somebody please tell me why example 1 works and example 2 doesn't.
> Correct code would be appreciated.
> Thanks in advance.
> 
> I've included the contents of 2 external javascript files. 
> Example 1 is called from my gadget with: 
> emouseatlas.emap.stg_run("my url");
> This works OK.
> 
> Example 2 is called from another gadget with:
> emouseatlas.emap.RunMe.stg_run("my url");
> This does NOT work. I get the error: emouseatlas.emap.RunMe is undefined
> =========================================================
> Example 1:
> if(!emouseatlas) {
>    var emouseatlas = {};
> }
> if(!emouseatlas.emap) {
>    emouseatlas.emap = {};
> }
> emouseatlas.emap.stg_run =  function(url) {
>     var _debug=true;
>      //output to firebug  
>         if(_debug) {
>                  console.log("inner scope stg_run %s",url);
>         }
>     
>     };//end stg_run
> 
> ================================
> Example 2
> if(!emouseatlas) {
>    var emouseatlas = {};
> }
> if(!emouseatlas.emap) {
>    emouseatlas.emap = {};
> }
> emouseatlas.emap.RunMe = function() {
>     var _debug=true;
>     stg_run =  function(url) {
>     
>          //output to firebug  
>         if(_debug) {
>                  console.log("inner scope stg_run %s",url);
>         }    
>     };//end stg_run
> }();//end RunMe
> 
> ===========================================
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "orkut Developer Forum" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/opensocial-orkut/-/hq3EtahoacQJ.
> To post to this group, send email to opensocial-orkut@googlegroups.com.
> To unsubscribe from this group, send email to 
> opensocial-orkut+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/opensocial-orkut?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com.
To unsubscribe from this group, send email to 
opensocial-orkut+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en.

Reply via email to