PDA

View Full Version : Whats wrong with _GLOBAL.....?



ShinFu
November 8th, 2002, 11:28 AM
I want a global var for selecting sounds (0 = no sound, 1 = loop1, 2 = loop2,....). a mc indicates what sound is selected but that mc
doesnt do anything:

Main Timeline
Action Keyframe 1 (only one frame):

_global.SoundLfo1 = 0;

Sub.Sub.Sub Button
Action in the Button:

on (press) {
if (_global.SoundLfo1 = 0 ) {
this.attachMovie("wave", "waveactive", 5);
}
}

i cant see any wave
if i delete the if thingy i can see the wave....:(
there is lots a code missing for the sound implementation but
if this _global doesnt work i doesnt want to push it forward
anymore.....:*(

sbeener
November 8th, 2002, 02:04 PM
i think you're meaning to use "==" in your if statement

Deril
November 9th, 2002, 06:11 AM
yes...
its a comon mistake of lot of people.. using asign (=) insted of equalation test (==).. actualy I do this mstake often to.. you get a zero in your if statment and c language like pprograms stati it ash FALSE.

:-) hare is one trick.. : use::
if ( 0 == _lobal.SoundLfo1){}

...

if you mis and tipe

if ( 0 = _lobal.SoundLfo1){} ypu get an error as you cant asign value to a number..

GL.

ShinFu
November 9th, 2002, 06:27 AM
thx a lot...it works now =)