PDA

View Full Version : mediaController


dex002
04-22-2005, 03:18 PM
The following code is on a button. I want it to create a MediaController which will autoplay an mp3. It doesn't work. ??

on(release){
_parent.createClassObject(MediaController,can_hi_m c,{mediaType:MP3,contentPath:audio/can_hi.mp3,autoPlay:true});
}

Any help would be awesome!

saintjava
04-25-2005, 09:21 PM
Hey dex002,

First, make sure that you have a copy of the MediaController in your library. Then you can try this code:


import mx.controls.MediaController;
var obj:Object = new Object();
obj.click = function(evtObj:Object){
createClassObject(MediaController, "myMedia", this._parent.getNextHighestDepth(),{mediaType:"MP3",contentPath:"audio/can_hi.mp3",autoPlay:true});
}
myBtn.addEventListener("click", obj);


I think the problem you were having is you didn't import the MediaController class, and you didn't put quotation marks around the values you were passing as part of the init object.

Anyway, I was able to get it to work by doing what I described.

Cheers :-)

mikhak
05-17-2005, 08:47 AM
do you have any example file (FLA) for this ???????

dex002
05-17-2005, 11:13 AM
Hi Mikhak, I abandoned the media components out of frustration. I ended up making my own mp3 player which works pretty well, although it doesn't have all the features of the component. You can see it here (http://mattbodman.info/audience/sounds_player.swf)