Monday, June 25, 2012

[Action Script] Can't Access Global Variable Inside Function June,2012

I'm creating a multiplayer game with the SmartFoxServer API. I have a global variable declared in a function:

Code: if (type == "xml") {
                if (resObj._cmd == "findAfroCoins") {
                        _global.afro1frame = 2
                myDonut.av_pieces.av_afro1.gotoAndStop(afro1frame);The global variable is supposed to be used in a different part of the code but it needs to be called in that function because it needs to get data from my extension (SmartFox). Anyways, when I add a trace outside of the function, I get undefined, while if I put the _global variable outside of the function, it traces fine. So my problem is, how come the _global variable is undefined when created in the function? Thanks and sorry if a little bit of this has to do with SmartFox, the guys over there told me it was an actionscript problem.
Can't Access Global Variable Inside Function

Related Post



0 comments: