Do you have the actual .mp3 ?[EDIT] didn't saw the .fla... i'll have a look
Do you have a version compatible with flash CS3 ? ( do not have above... )
CS4 is the lowest I can save in
Here's the code, maybe that helps:
var timerResolution:int = 200;
var glp:GLPlayer;
var curPath:String;
var playOnce:Boolean = root.loaderInfo.parameters.playOnce;
pauseButton.visible = false;
function playTune(s:String) : void {
if (!glp || curPath != s) {
glp = new GLPlayer(new URLRequest(s));
curPath = s;
}
glp.position = 0;
if (playOnce) {
glp.playOnce();
} else {
glp.playLoop();
}
}
function pauseTune() : void {
if (!glp) return;
glp.pause();
}
function getTunePosition() : Number {
if (!glp) return 0.0;
return glp.position-50;
}
function getTuneLength() : Number {
if (!glp) return 0.0;
return glp.length;
}
function isTuneLoaded() : Boolean {
if (!glp) return false;
return glp.canSeek;
}
var pline:Sprite = new Sprite();
var progressTimer:Timer = new Timer(timerResolution);
progressTimer.addEventListener(TimerEvent.TIMER, showProgress);
pline.visible = false;
addChild(pline);
function drawProgress(cur:Number, total:Number) : void {
if (!total || total == 0) return pline.graphics.clear();
pline.graphics.clear();
var max:Number = cur/total*360.0;
var rad, cx, cy : Number;
var r:Number = 12.5;
pline.graphics.lineStyle(0.1, 0x888888);
for (var i=0; i rad = i*Math.PI/180.0;
cx = r*Math.sin(rad);
cy = r*Math.cos(rad);
pline.graphics.drawCircle(cx+15, cy+15, 1);
}
}
function showProgress(ev:TimerEvent):void {
var cpos:Number = getTunePosition();
var totalLen:Number = getTuneLength();
drawProgress(cpos, totalLen);
if (playOnce && cpos >= totalLen-timerResolution-100) {
setTimeout(function() {
onPauseClick();
}, timerResolution+150);
}
}
function onPlayClick(ev:MouseEvent):void {
playButton.y = 100;
pauseButton.y = 0;
pauseButton.visible = true;
playButton.visible = false;
pline.visible = true;
ExternalInterface.call("js_playTune", root.loaderInfo.parameters.pid);
playTune(root.loaderInfo.parameters.mp3_path);
progressTimer.start();
}
function onPauseClick(ev:MouseEvent=null):void {
pauseButton.y = 100;
playButton.y = 0;
pauseButton.visible = false;
playButton.visible = true;
pline.visible = false;
progressTimer.stop();
progressTimer.reset();
ExternalInterface.call("js_pauseTune", root.loaderInfo.parameters.pid);
pauseTune();
}
function onPauseOver(ev:MouseEvent):void {
pline.visible = false;
}
function onPauseOut(ev:MouseEvent):void {
pline.visible = true;
}
Security.allowInsecureDomain("*");
Security.allowDomain("*");
ExternalInterface.addCallback("halt", onPauseClick);
playButton.addEventListener(MouseEvent.CLICK, onPlayClick);
playButton.addEventListener(MouseEvent.MOUSE_OVER, onPauseOver);
pauseButton.addEventListener(MouseEvent.MOUSE_OVER, onPauseOver);
pauseButton.addEventListener(MouseEvent.MOUSE_OUT, onPauseOut);
pauseButton.addEventListener(MouseEvent.CLICK, onPauseClick);