1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| private function affichMedia(){
if (_nC != null){
_nS.pause();
_nS.close();
_nC.close();
_nS = null; _nC = null;
}
if (_spPlayer !=null) {
if(_media && _spPlayer.contains(_media)){
_spPlayer.removeChild(_media);
}
}
if(_tabRea[_numSelect].*[_nbVignet].@typ == "i"){
affichImage();
}
else if(_tabRea[_numSelect].*[_nbVignet].@typ == "v"){
affichVideo();
}
}
private function affichImage(){
_media = new URLLoader();
_media.contentLoaderInfo.addEventListener(Event.COMPLETE, completeImg);
_media.load(new URLRequest("medias/"+_tabRea[_numSelect].*[_nbVignet]));
addChild(_media);
}
private function completeImg(e:Event){
_media.contentLoaderInfo.removeEventListener(Event.COMPLETE, completeImg);
_spPlayer.addChild(_media);
}
private function affichVideo(){
_nC = new NetConnection();
_nC.connect(null);
var client:Object = {};
client.onMetaData = metaVid;
_nS = new NetStream(_nC);
_nS.addEventListener(NetStatusEvent.NET_STATUS,statusVid);
_media = new Video();
_media.attachNetStream(_nS);
_spPlayer.addChild(_media);
_nS.play("medias/"+_tabRea[_numSelect].*[_nbVignet]);
}
private function statusVid(e:NetStatusEvent){
trace ("NetStatusEvent : "+e.info.code);
}
private function metaVid(o:Object){
for (var m in o) trace(m, o[m]);
} |
Partager