A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Attaching sound to Accordion Component

  1. #1
    Member
    Join Date
    Mar 2002
    Posts
    44

    Attaching sound to Accordion Component

    Could someone kindly post some sample code of how to attach a sound to the accordion component when each selection is clicked?

    i tried

    var s:sound = newSound();
    s.attachSound("click");

    but failed.

    mucho gracias

  2. #2
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    you would need to set up a listener, listening for the 'change' event to be broadcast.

    Code:
    var s:Sound = new Sound(this);
    s.attachSound("click");
    
    var listenerObject:Object = new Object();
    listenerObject.change = function(eventObject:Object)
    {
    	s.start();
    };
    // where acc is the name of your accordian component
    acc.addEventListener("change", listenerObject);
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  3. #3
    Member
    Join Date
    Mar 2002
    Posts
    44
    thanks for the reply. i tried your code but it gave 5 errors, all with this...

    "Statement must appear within on/onClipEvent handler"

    thanks again.

  4. #4
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    The code is meant for the timeline, not on a movieClip
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  5. #5
    What aboout when you want a sound to play when mouse-over/rollover the accordion headers?

    Phil

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