-
"Playing" Sound Script
Hi everyone,
i am going through a tutorial on how to use sound within Flash. I have got a "Play" and a "Stop" button in my project, obviously to play and stop !!! Part of the tutorial is code to avoid the track doubling if the user would happen to click the Play button once the song has started playing.
Here's the code: if (playing != true) {
playing = true;
_root.firstSound.start();
}
Could someone explain to me what the "playing" function (or is it not a function ?) is exactly please? When typing it in the Actions window it appears Blue so i guess it's not a variable.
Also, is there a way to find all these details in the Flash Help. I always seem to struggle finding anything in the Help.
Thx for your help,
OnAir
-
Here's the code: if (playing != true) {
playing = true;
_root.firstSound.start();
}
playing is not a function it is essentially a boolean - which means it has a value of either 1 or 0 or on or off or true or false . So the code is saying
if playing is not true or if you like - is unequal to true ( "!=" means inequality or unequal) then playing becomes true and so the sound starts.
hmm - looking at what i have written i wonder if you will be any the wiser.If you need embelishment let me know
-
Playing is just a variable's name, not a function...
-
Hi again,
thx for your replies guys.
I understand the overall meaning of the code. It is more the "playing" that i don't get. Oldnewbie, you say it is a variable but don't variables appear in black when you name them? Howcome when you type in "playing" it appears blue?
Also, do you guys know of any good books to learn ActionScript, Mx version ?
Thx for your help, most appreciated.
OnAir
-
yes variables do appear in black but "playing" in this case is in quotation marks ie: " " and whatever appears within these quotation marks will appear in blue.
-
There are no double quotes in his code, my friend!
OnAir, check your PMs for my answer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|