|
-
I am trying to do the same thing , ive tried so many scripts but cant figure out how to call the cript from the buttons, play stop etc...
I got this far from tuorials at as3 forums but even if the code in the script is right , I dont know how it will populate anything. How do i asscoitae it to a text or edit box ? Do you use the call script under button mousedown to call element by script and select function playsong ?
----------------
var my_songs:XMLList;
var my_total:Number;
var my_sound:Sound;
var my_channel:SoundChannel;
var url = "playlist.xml";
var my_xml = <xml><dummy>data</dummy></xml>
var loader = new URLLoader;
loader.addEventListener ("complete", completeHandler);
loader.load (new URLRequest (url));
function completeHandler (event:Event)
my_xml = new XML (loader.data);
my_songs = myXML.SONG;
my_total = my_songs.length();
function playSong(mySong:Number):void{
var myTitle = my_songs[mySong].@TITLE;
var myArtist = my_songs[mySong].@ARTIST;
var myURL = my_songs[mySong].@URL;
title_txt.text = myTitle;
artist_txt.text = myArtist;
if (my_channel){
my_channel.stop();
}
my_sound = new Sound();
my_sound.load(new URLRequest(myURL));
my_channel = my_sound.play();
}
my_sound = new Sound();
my_sound.load(new URLRequest(myURL));
my_channel = my_sound.play();
next_btn.addEventListener(MouseEvent.CLICK, onNext);
function onNext(e:MouseEvent):void{
current_song++;
if (current_song>=my_total){
current_song=0;
playSong(current_song);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|