Skip to main content
carolins26908893
Participant
June 7, 2017
Question

Flash AS 2 One global variable updates fine in a Symbol the other not...

  • June 7, 2017
  • 1 reply
  • 375 views

Flash makes my brain melt. I really have no ide whats going wrong -.-

I have two global variables:

_global.IsGreat = 0;

_global.Bronze = 0;

Both are updatet in my Maincode...

The working one:

if (Maske._y <= DrittelMaske)
{
_global.Bronze = 1;
trace ("Bronze " + Bronze);
Mask_n_v._alpha = 0;
Mask_s_v._alpha = 0;
Mask_m_v._alpha = 100;
Schnell = 0;
//Normal._alpha = 0;
//Mittel._alpha = 100;
//Schnell._alpha = 0;
}

The Symbol that reacts...

if (_global.Bronze == 0)

{

  gotoAndPlay (1);

}

else

{

  gotoAndPlay (3);

}

if (player._y <= PlayerLowest) //Best Position!
{
IsGreat = 1;
trace ("IsGreat " + IsGreat)
}

- In the Mainscene "IsGreat" gets an update and changes to 1 when the Position is reached... But no alternate Animation from frame 10 of the symbol is played...

In the Symbol that doesn't react

if (_global.IsGreat == 0)
{
gotoAndPlay (1);
}
else
{
gotoAndPlay (10);
}

I had it onece in a while that I had to delete and paste code in aain that flash got it that I changed something... but this isn*t working at ALL!

I don't get what the problem is.

Both variables are updating in the maincode just fine. But the "new" global" doesn't want to update...

I am glad for any helü. I had this "updating" problem several times the last days and I really have no idea what I have to do that the codes get the link between the symbol and the code

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 9, 2017

isGreat is not the same as _global.isGreat

ie, if you want to use global variables use the fully qualified name.