Hu4ley
11-21-2007, 11:26 AM
Hey!
I have been trying to sort this problem out for a few days now without any joy! Its driving me crazy!
Im creating a flash music quiz which loads in mp3 samples and questions from an xml file. This is working fine. What I want to do is change the enabled property of 2 movieclips in an externally loaded swf so when the mp3 is loaded the play button for the mp3 enables. Its working when I test it in flash but not when I test it outside? Its probably a quick fix but to be honest im lost as to what the problem could be?
Hopefully somebody with a better understanding of AS can help me.
my code looks like this...
////////////////////////////////////////////////////////////////////////////
var songTrack:Sound = new Sound();
songTrack.loadSound(qList[questionNbr].ans_z); // takes the mp3 from the xml
function checkProgress (soundObj:Object):Void {
var numBytesLoaded:Number = soundObj.getBytesLoaded();
var numBytesTotal:Number = soundObj.getBytesTotal();
var numPercentLoaded:Number = Math.floor(numBytesLoaded / numBytesTotal * 100);
if (!isNaN(numPercentLoaded)) {
trace(numPercentLoaded + "% loaded.");
}
};
songTrack.onLoad = function (){
songTrack.stop;
displayLoad();
};
loaded_mc.play_btn.onRelease= function (){
button_a.enabled= true;
button_b.enabled= true;
button_c.enabled= true;
button_d.enabled= true;
loaded_mc.play_btn.enabled= false;
cover_mc.gotoAndPlay("fade");
songTrack.start(1,0);
};
function displayLoad() {
loaded_mc._alpha = 100;
loaded_mc.play_btn.enabled= true;
load_mc._alpha = 0;
load_mc.enabled= false;
};
loaded_mc._alpha = 10;
this.loaded_mc.play_btn.enabled= false;
loaded_mc.enabled= false;
button_a.enabled= false;
button_b.enabled= false;
button_c.enabled= false;
button_d.enabled= false;
stop();
////////////////////////////////////////////////////////////////////////////
BTW
this is the code in the external swf! I tried to make the links relative but yet it still wont work! Where's that baseball bat!?
I have been trying to sort this problem out for a few days now without any joy! Its driving me crazy!
Im creating a flash music quiz which loads in mp3 samples and questions from an xml file. This is working fine. What I want to do is change the enabled property of 2 movieclips in an externally loaded swf so when the mp3 is loaded the play button for the mp3 enables. Its working when I test it in flash but not when I test it outside? Its probably a quick fix but to be honest im lost as to what the problem could be?
Hopefully somebody with a better understanding of AS can help me.
my code looks like this...
////////////////////////////////////////////////////////////////////////////
var songTrack:Sound = new Sound();
songTrack.loadSound(qList[questionNbr].ans_z); // takes the mp3 from the xml
function checkProgress (soundObj:Object):Void {
var numBytesLoaded:Number = soundObj.getBytesLoaded();
var numBytesTotal:Number = soundObj.getBytesTotal();
var numPercentLoaded:Number = Math.floor(numBytesLoaded / numBytesTotal * 100);
if (!isNaN(numPercentLoaded)) {
trace(numPercentLoaded + "% loaded.");
}
};
songTrack.onLoad = function (){
songTrack.stop;
displayLoad();
};
loaded_mc.play_btn.onRelease= function (){
button_a.enabled= true;
button_b.enabled= true;
button_c.enabled= true;
button_d.enabled= true;
loaded_mc.play_btn.enabled= false;
cover_mc.gotoAndPlay("fade");
songTrack.start(1,0);
};
function displayLoad() {
loaded_mc._alpha = 100;
loaded_mc.play_btn.enabled= true;
load_mc._alpha = 0;
load_mc.enabled= false;
};
loaded_mc._alpha = 10;
this.loaded_mc.play_btn.enabled= false;
loaded_mc.enabled= false;
button_a.enabled= false;
button_b.enabled= false;
button_c.enabled= false;
button_d.enabled= false;
stop();
////////////////////////////////////////////////////////////////////////////
BTW
this is the code in the external swf! I tried to make the links relative but yet it still wont work! Where's that baseball bat!?