var _present:Date = new Date();
var _present_ms = _present.getTime();
var loader:URLLoader = new URLLoader();
var myURL = "?" + _present_ms;
//위에서 부터 이것까지는 xml 캐싱문제를 해결하기 위한 가짜파라미터를 달아주는 일입니다
//이걸 걸면 xml업뎃하는데로 바로 플짤에 xml이 적용되는것이죠
loader.load(new URLRequest("http://cfs.tistory.com/custom/blog/43/430892/skin/images/random_mp3.xml" + myURL));
//아까 만든 가짜파라미터와 함께 xml를 불러오고요
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, completeHandler);
var soundObj = new Sound();
//사운드 채널을 만들어줍니다
var channelObj:SoundChannel;
function completeHandler(e:Event):void
{
var xml:XML = new XML(e.currentTarget.data);
var l:int = xml.child(0).child("*").length();
soundObj.load(new URLRequest(xml.child(0).child(Math.floor(Math.random()*l))));
//랜덤으로 값을 뽑아내서 그걸 로드 하는겁니다
channelObj = soundObj.play();
//그 다음에 재생을 해야죠
channelObj.addEventListener("soundComplete", soundPlayComplete);
//재생이 끝난다고 멈춘채로 계속두면 안되니까 끝나는 시점에 이벤트리스너를 달아줍니다
function soundPlayComplete(e:Event):void
{
channelObj = soundObj.play();
//다시 재생하도록 하는 코드입니다
channelObj.addEventListener("soundComplete", soundPlayComplete);
}
}
https://gall.dcinside.com/list.php?id=flash&no=116306
https://gall.dcinside.com/list.php?id=flash&no=83950
이 두 글 참조 바랍니다
아 xml 설명을 안했는데 xml은
<?xml version="1.0" encoding="UTP-8" ?>
<ㅎㅎ>
<mp3>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
<노래>http://~~~.mp3</노래>
</mp3>
</ㅎㅎ>
이런식으로 되어있습니다
댓글 영역
획득법
① NFT 발행
작성한 게시물을 NFT로 발행하면 일주일 동안 사용할 수 있습니다. (최초 1회)
② NFT 구매
다른 이용자의 NFT를 구매하면 한 달 동안 사용할 수 있습니다. (구매 시마다 갱신)
사용법
디시콘에서지갑연결시 바로 사용 가능합니다.