A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: "Playing" Sound Script

  1. #1
    haven't got a clue
    Join Date
    Nov 2004
    Location
    Toulouse - France
    Posts
    58

    "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

  2. #2
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    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

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Playing is just a variable's name, not a function...

  4. #4
    haven't got a clue
    Join Date
    Nov 2004
    Location
    Toulouse - France
    Posts
    58
    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

  5. #5
    Senior Member
    Join Date
    Mar 2004
    Posts
    112
    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.

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center