Global Fuction??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Spencer
    Forum Member
    • May 2005
    • 9

    Global Fuction??

    I am trying to add a stop background music button than when checked it would apply to all pages... Im lost on how to do this. help.....Thanks
  • rhosk
    Indigo Rose Customer
    • Aug 2003
    • 1698

    #2
    Regards,

    -Ron

    Music | Video | Pictures

    Comment

    • Spencer
      Forum Member
      • May 2005
      • 9

      #3
      Any examples? Im still lost.

      Comment

      • Intrigued
        Indigo Rose Customer
        • Dec 2003
        • 6138

        #4
        Try this code in your Button's On Click event (tab):

        Code:
        tblPages = Application.GetPages()
        
        for i,v in tblPages do
        	Audio.Stop(CHANNEL_BACKGROUND)
        end
        Intrigued

        Comment

        • Intrigued
          Indigo Rose Customer
          • Dec 2003
          • 6138

          #5
          But, I believe the power in this little code chunk would be for the stopping of all sounds in the project! Here below I have created a function (the code can be "called" (which means "used)) by just one line of code then in the rest of your program. Now, you usually want to put functions (that you create) in the Global Functions section.

          Here's that new function code:

          Code:
          function fnStopAllSounds()
          	tblPages = Application.GetPages()
          		for i,v in tblPages do
          			Audio.Stop(CHANNEL_ALL)
          		end
          end
          Now, to use it (call the function) you just add this line of code to the On Click of your Button Object, for example:

          Code:
          fnStopAllSounds()
          Intrigued

          Comment

          • Intrigued
            Indigo Rose Customer
            • Dec 2003
            • 6138

            #6
            Oh, not sure what I was going to do with that function but it looks like I got my wires crossed, sorry.

            If you are using the Audio actions then try this line of code, sorry again:

            Audio.Stop(CHANNEL_ALL) -- All sounds

            Audio.Stop(CHANNEL_BACKGROUND) -- Just the Background sound


            I believe I had "function creation on the brain" due to rhosk's post linking to functions. D'oh!
            Intrigued

            Comment

            • rhosk
              Indigo Rose Customer
              • Aug 2003
              • 1698

              #7
              I too misinterpreted because of the original subject line. Intrigued has nailed the answer for you, sorry for the confusion.
              Regards,

              -Ron

              Music | Video | Pictures

              Comment

              Working...
              X