Flash

Flash sound

OJR 2008. 11. 7. 11:26
// 외부 파일 로드후 실행
_root.loadSoundbtn.onRelease = function(){
 _root.click_loadSoundBtn();
}
var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean) {
 if (success) {
  my_sound.start();
  status_txt.text = "Sound loaded";
 } else {
  status_txt.text = "Sound failed";
 }
 trace( success );
};
function click_loadSoundBtn(){
 my_sound.loadSound("song2.mp3", true);
}

/////////////////////////////////////////////////

// 라이브러리에 있는 사운드 실행
// 단 이경우 로드되어진 자식swf파일의 라이브러리는 안된다.
var my_sound2:Sound = new Sound();
my_sound2.attachSound("mySoundID");
my_sound2.onSoundComplete = function() {
 trace("mySoundID completed");
 status_txt2.text = "attachSound 성공";
};
_root.attachSoundbtn.onRelease = function(){
 my_sound2.start();
}






반응형

'Flash' 카테고리의 다른 글

flash swf 가로세로가 동적으로 변할때  (0) 2008.11.11
flash player 9  (0) 2008.11.07
flash Drag & Drop 예  (0) 2008.10.30
Action Scrambler  (0) 2008.10.21
Flash wmode - openx 에서 플래시 광고 문제  (0) 2008.10.07