5 Replies Latest reply on Aug 24, 2009 12:28 PM by sandc666-YGfr5p

    Calling a Function in a Component


      Hi I know this is simple but I can not get this to work I ahve looked for example but come uo with nothing


      I want to call a function in a  Component


      I created  acompoinent based on a label















      <?xml version="1.0" encoding="utf-8"?>















             public var mp3:String;




           private var soundChannel:SoundChannel;





      // this function will load and play the sound



          public function playSound():void{



             var urlRequest:URLRequest = new URLRequest(mp3);



            var sound:Sound = new Sound();



      // will stop sound of no device is found



           if(soundChannel != null ) {




           soundChannel = sound.play();




      // this function stops the sound from playing, this need tos work on the sound channel



          private function stopSound():void











      calling looks like





      <?xml version="1.0" encoding="utf-8"?>




      xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:uofs="uofs.*" >




      <uofs:ulable text="hellow" id="b21" x="200" y="300" mp3="jazz.mp3" click="playSound()" />






      also how wolud you pass a string in the click


      click="playSound(jazz.mp3)"  or click="playSound("jazz.mp3")"


      do not work