Hi, I’m new to Action Scripting, im using Flash CS4 and actionScript 3.0. I am trying to make a Song streaming player like the one on www.beemp3.com and other such sites… I know how to get a song to stream… and i also get the percentage of how much the song has been loaded… but cant make a progress bar according to it… can u guys plzz help me out…
so far i have done this…
play1_btn.visible = false;
// importing classes ---->
import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.net.URLRequest;
var req:URLRequest = new URLRequest("my.mp3");
var s:Sound = new Sound();
var context:SoundLoaderContext = new SoundLoaderContext(2000, true);
//Tracing progess----->
s.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
function onLoadProgress(event:ProgressEvent):void {
var loadedPct:int = ((event.bytesLoaded / event.bytesTotal) * 100);
trace(loadedPct + "% loaded");
}
//button scripting--->
play_btn.addEventListener(MouseEvent.CLICK, playF);
function playF(event:MouseEvent):void{
s.load(req, context);
s.play();
play_btn.visible = false;
play1_btn.visible = true;
}
stop_btn.addEventListener(MouseEvent.CLICK, stopF);
function stopF(event:MouseEvent):void{
SoundMixer.stopAll();
}
play1_btn.addEventListener(MouseEvent.CLICK, play1F);
function play1F(event:MouseEvent):void{
s.play();
}
What i want to do is use the progress percentage and visually show how much has been loaded via progress bar… plzz help !!!
and thnx in Advance…