3 Replies Latest reply on Dec 4, 2010 12:05 AM by kglad

    Issue with declaring variable

    Jimmathy

      I am developing a multiuser application in flash, using smartfox server and as 2.0, but i am having an issue with defining/declaring a variable/object/array, and then accessing it. I am attempting to define "curMap" (whether it be a variable, array, object, whatever works) within the following function, as the returned array from the server, "resObj". This works fine as long as i only call up "curMap" WITHIN this function(as you see in the  line :  r_txt.text = curMap;)  however whenever I try to call up "curMap" on the frame coding, outside the function, it comes back as undefined, or typically nothing.  Any Ideas as to how to properly do/assign this? I have tried various things(such as _root., _global, or defining the var "curMap" outside the function) with no luck.

       

       

      Here is my Code:

      smartfox.onExtensionResponse = function(resObj:Object, type:String)
      {
              if (type == "xml")
              {
                      if (resObj._cmd == "getMap")
                      {
                          curMap = resObj.db[0];
                          r_txt.text = curMap;
                      }else if (resObj._cmd == "getSurr"){
                       surrMap = resObj.db;
                       b_txt.text = surrMap[0];
                    }
              }
      }

       

       

      thanks