I'm trying to understand how the following scenario could be done using SVG 1.2, but I'm confused about event handling in SVG 1.2 (I'm used to onclick attributes and the like):
Ultimately what I'd want is a collection of arbitrarily-shaped buttons, when you click on them a sound is heard. Sounds simple enough... The media01.svg example given in http://www.w3.org/TR/2005/WD-SVGMobile12-20051207/multimedia.html#AudioElement shows how to do this for a specific button, but the audio element specifically targets a specific button. So I don't think I can use this simple method. If this can't be done by specifying a SMIL attribute on the <audio> element, I assume it has to be done via script or event handlers/listeners. I leafed through the spec (including the DOM IDL at http://www.w3.org/TR/2005/WD-SVGMobile12-20051207/svgudomidl.html) and I can see that: - an <audio> element is considered a "Timed Event": http://www.w3.org/TR/2005/WD-SVGMobile12-20051207/intro.html#TermTimedElement - a Timed Event implements the SVGAnimationElement interface: http://www.w3.org/TR/2005/WD-SVGMobile12-20051207/svgudom.html - the SVGAnimationElement interface extends the smil::ElementTimeControl - the smil::ElementTimeControl has the beginElement() method So I guess I could do this: <audio xml:id="audioClip1" .../> <handler xml:id="buttonClicker" type="application/ecmascript" ev:event="ev:click"> var myAnimationElement = document.getElementById("audioClip1"); myAnimationElement.beginElement(); </handler> And then a bunch of these: <ev:listener event="ev:click" observer="#button1" handler="#buttonClicker"/> <ev:listener event="ev:click" observer="#button2" handler="#buttonClicker"/> <ev:listener event="ev:click" observer="#button3" handler="#buttonClicker"/> Or of course I could handle it directly in a <script> element and use addEventListener() for a given JS function that plays the element. Have I got it right? Thanks, Jeff ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/u8TY5A/tzNLAA/yQLSAA/1U_rlB/TM --------------------------------------------------------------------~-> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

