This Blog contains About Action script 3.0 Variables, Data types, Access specifies, Keywords, Operators, Conditional statements, Control statements, Arrays (Indexed, Associative, Multidimensional, Cloning), Functions, Symbols, Movie clips (Transformation point, Registration point, Loading images), Buttons, Events (Key board, Mouse, Timer, XML)Pre- defined function :- Random, Hit test object, Drag and drop, Sort, Loader, Tween,URL Loader, Video components, Audio Components, Sound Channel.
Friday, 21 December 2012
play sound using button in action script 3.0
var my_sound:SoundId = new SoundId();
var my_channel:SoundChannel = new SoundChannel();
play_btn.addEventListener(MouseEvent.CLICK, playSound);
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
function playSound(event:MouseEvent):void{
my_channel = my_sound.play();
}
function stopSound(event:MouseEvent):void{
my_channel.stop();
}
1. Create play button instance of 'play_btn'.
2. Create stop button instance of 'stop_btn'.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment