A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Button Audio Problem

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    3

    Exclamation Button Audio Problem

    Hi there all!

    Fist off, Let me say I am new to Flash, so that's why I am posting this in the Newbie Forum, so sorry if this question belongs somewhere else. And yes, I have searched both this site and Google for a solution with no luck, so again sorry if it has been answered before.

    I am creating a 5-state button, something very similar to what this website has:
    http://www.sanctifiedstudios.com/adv...state-buttons/

    So, I successfully created everything, and all the animation work great, however, I want to add a sound to the button "Over" state, so that a sound plays when someone hovers over the button.

    So again this is not that much of a problem, however, the sound also plays when you click on the button. I only want to sound to play during onMouseOver, on not on onRelease.

    The Button is a Movie Clip itself, with 5 layers inside of it. You can see in in the screen shot below. (Also attached it, if you can;t see it)



    The sound is at Frame 6, which is also the Over state.

    What is interesting, is that if I also put the sound on the press state, it will play twice when the button is clicked on.

    So I am not sure if this is a flash problem, but I am really confused hear. Maybe one of you flash gurus can shed some light here.

    Thanks

    PS: Using Flash CS4 with ActionScript 2.0

    Code:
    this.Sub_Tab_1.onRollOver = function() {
    	Sub_Tab_1.gotoAndPlay("_over");
    }
    
    this.Sub_Tab_1.onRollOut = function() {
    	Sub_Tab_1.gotoAndPlay("_out");
    }
    
    this.Sub_Tab_1.onRelease = function() {
    	Sub_Tab_1.gotoAndPlay("_press");
    }
    Attached Images Attached Images

  2. #2
    Senior Member
    Join Date
    Jan 2010
    Location
    England
    Posts
    268
    Actionscript Code:
    //ID_name is the linkage ID of your music file in the library.

    this.Sub_Tab_1.onRollOver = function() {
    Sub_Tab_1.gotoAndPlay("_over");
    mySound = new Sound(this);
    mySound.attachSound("ID_name");
    mySound.start(0);
    }

    try that, give your sound an ID name with linkage(right click your sound file in your library and click linkage, set identifier to whatever you like)
    Last edited by stevehungry; 04-08-2010 at 10:34 PM. Reason: spelling mistake
    might be addicted to flash...
    _______________________________________

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    Thanks for your reply stevehungry. So i should just go with action script instead of putting the sound in the timeline? Sounds good. Well, it works, so again, thanks for your reply

  4. #4
    Senior Member
    Join Date
    Jan 2010
    Location
    England
    Posts
    268
    no problemo everythings better with actionscript once you know how.
    might be addicted to flash...
    _______________________________________

  5. #5
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    Quote Originally Posted by stevehungry View Post
    no problemo everythings better with actionscript once you know how.


    So I've heard, However I'm fairly new to Flash, but I will hopefully learn it in time.

    Thanks again

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