Ask a Question related to Macromedia Director Lingo, Design and Development.

  1. #1

    Default Global sound setup

    Hi,

    I am trying to setup global sound behaviour and attached to files to demostrate what I have done so far, but there is still some mistakes.

    First when the movie is started, then global gTheSoundOn is set to be true, yet the sound will not play when moving over the test button.

    Secondly when moving over the sound on/off button for the first time it will turn to display the sound off state although no mouse click has been issued.

    Thirdly, after clicking the sound on/off button and then moving off it, the display of the sound state is correctly dispalyed until the user move from one movie to the next. The sound on/off setting is correctly retained moving from one moving to the next, but the button display is incorrect.

    Please help.

    Thanks


    WWX webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. How to setup global values or configuration forcontainers
      I want to setup up standard widths and heights, etc. and wondered what the best method is to do this. For example, I want to setup the width of...
    2. Page setup/paper setup
      Hi I use Freehand MXa in MacOSX 13.2. I wonder, does Freehands own paper setup (in print dialog box) owerride all paper setup settings.(In...
    3. global sound and playlist
      I am making a music control panel. I have 4 music tracks that I want the user to be able to skip through. I used this lingo for the playlist and...
    4. Global Error handling in Applicatio_Error() of Global.asax
      Hi all, For a web application if we are using web farm, and if i want to do Global Error handling can i use Applicatio_Error() method in...
    5. help to setup a sound email service via sendmail
      Hello, As a first step, I want the outgoing email work. Currently I cannot send email using sendmail on RH8.0. The error message: type 1:...
  3. #2

    Default Re: Global sound setup

    Missed the attachment first time round.

    [url]http://webforums.macromedia.com/attachments/Sound11.zip[/url]


    WWX webforumsuser@macromedia.com Guest

  4. #3

    Default Re: Global sound setup

    Oaky I am still struggling with this.

    So far I have done the following:

    Created teo movies with the following lingo in the Behaviour channel:

    global gTheSoundOn

    on prepareMovie
    gTheSoundOn = True
    end

    on startMovie
    if gTheSoundOn = True then
    sprite(1).member = "Sound"
    else
    sprite(1).member = "Sound_off"
    end if
    end

    on exitFrame me
    go to the Frame
    end

    I also placed two simple button on the stage, one to turn the sound on and off and one to test if it is working i.e. if the mouse scroll over it and the sound is off no sound must be heard. The sound on/off button must also correctly display the sound state.

    To these I have assigned the following script respectively.

    The Sound on/off button:

    global gTheSoundOn

    on mouseEnter me
    sprite(1).member = "Sound_over"
    end mouseEnter

    on mouseLeave me
    if gTheSoundOn = True then
    sprite(1).member = "Sound"
    else
    sprite(1).member = "Sound_off"
    end if
    end mouseLeave

    on mouseUp me
    gTheSoundOn = not gTheSoundOn
    if gTheSoundOn = True then
    sprite(1).member = "Sound"
    else
    sprite(1).member = "Sound_off"
    end if
    end

    And the Test button:

    global gTheSoundOn

    on mouseEnter me
    sprite(2).member = "Test_over"
    if gTheSoundOn then
    sound(2).play(member("zap"))
    else
    nothing
    end if
    end

    on mouseUp me
    go to movie "test_sound2"
    end mouseUp

    Well I am getting closer to solve this problem but at present the following hick-ups still needs to be sorted out.

    Once I start running the movie the sound is off although I thought my code would have it to be on. The sound on/off button display as if the sound is on, but simply moving over it will change it to the sound off display which correctly reflects the sound state, but then it was suppose to be on, also the user should not have to move over the sound button to get it to correctly display the sound state.

    However once I have clicked on the sound on/button it's display and the sound state is then insync until I move from the one movie to the next. The sound state would be correctly get between the movies but the button display will not. For example if I turn the sound off in the one movie and move to the next, the sound will still be off, but the sound on/off button will now display the sound on state until the mouse moves over it after which it change to display the sound off state. (which off course is correct)

    Hope to get some help soon.

    Thanks


    WWX webforumsuser@macromedia.com Guest

  5. #4

    Default Here you go


    create the following members:
    -----------------------------
    -- for your sound switch
    "SoundOff"
    "SoundOn"

    -- for your sound status indicator
    "SoundOffIndicator"
    "SoundOnIndicator"

    -- your sound member
    "mySound"


    create this behaviour and attach it to your sound switch:
    ---------------------------------------------------------
    property spriteNum

    global SoundOn

    on mouseUp
    if (SoundOn = 1) then
    SoundOn = 0
    else if (SoundOn = 0) then
    SoundOn = 1
    (sprite spriteNum).member = member("SoundOn")
    end if
    updateStage
    end mouseUp
    --------------

    create this behaviour and attach it to the frame:
    ---------------------------------------------------------------------------------
    global SoundOn
    -- control the sound of your movie by simply setting this variable
    anywhere you want
    -- note that you have to attach this script to the according frame
    -- 0: sound is off
    -- 1: sound is on

    on exitFrame
    go to the frame
    end exitFrame

    on idle
    -- you could also test for other variables here, e.g. if a movie plays
    currently
    if (SoundOn = 0) then
    sound Stop 1
    sprite(1).member = member("SoundOff")
    sprite(2).member = member("SoundOffIndicator")
    else if SoundOn = 1 then
    if soundBusy(1) = false then -- leave out this and the next 3 lines if
    you don't wanna fade it
    sound(1).play(member ("mySound")) -- your sound member
    sound(1).fadeIn(3000) -- fade in sound (adjust value to alter the
    fade time)
    end if
    sprite(1).member = member("SoundOn")
    sprite(2).member = member("SoundOnIndicator")
    end if
    end
    -------

    write this into your movie script:
    ----------------------------------
    global SoundOn

    on prepareMovie
    set the volume of sound 1 to 150
    set SoundOn = 1
    end
    ------

    Hope this helps

    Chris
    Christian Grass Guest

  6. #5

    Default Here you go


    create the following members:
    -----------------------------
    -- for your sound switch
    "SoundOff"
    "SoundOn"

    -- for your sound status indicator
    "SoundOffIndicator"
    "SoundOnIndicator"

    -- your sound member
    "mySound"


    create this behaviour and attach it to your sound switch:
    ---------------------------------------------------------
    property spriteNum

    global SoundOn

    on mouseUp
    if (SoundOn = 1) then
    SoundOn = 0
    else if (SoundOn = 0) then
    SoundOn = 1
    (sprite spriteNum).member = member("SoundOn")
    end if
    updateStage
    end mouseUp
    --------------

    create this behaviour and attach it to the frame:
    ---------------------------------------------------------------------------------
    global SoundOn
    -- control the sound of your movie by simply setting this variable
    anywhere you want
    -- note that you have to attach this script to the according frame
    -- 0: sound is off
    -- 1: sound is on

    on exitFrame
    go to the frame
    end exitFrame

    on idle
    -- you could also test for other variables here, e.g. if a movie plays
    currently
    if (SoundOn = 0) then
    sound Stop 1
    sprite(1).member = member("SoundOff")
    sprite(2).member = member("SoundOffIndicator")
    else if SoundOn = 1 then
    if soundBusy(1) = false then -- leave out this and the next 3 lines if
    you don't wanna fade it
    sound(1).play(member ("mySound")) -- your sound member
    sound(1).fadeIn(3000) -- fade in sound (adjust value to alter the
    fade time)
    end if
    sprite(1).member = member("SoundOn")
    sprite(2).member = member("SoundOnIndicator")
    end if
    end
    -------

    write this into your movie script:
    ----------------------------------
    global SoundOn

    on prepareMovie
    set the volume of sound 1 to 150
    set SoundOn = 1
    end
    ------

    Hope this helps

    Chris
    Christian Grass Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139