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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
/**
* Directives d'importations
*/
import mx.controls.VideoDisplay;
import mx.events.VideoEvent;
import mx.controls.Alert ;
import mx.utils.UIDUtil;
import gs.*;
/**
* variables
*/
private var _id:String = UIDUtil.createUID();
private var isOpen:Boolean = false;
[Bindable]
private var vid:VideoDisplay ;
[Bindable]
private var tabImg:Array = new Array;
[Bindable]
private var gal:Image = new Image;
[Bindable]
private var img:Image = new Image;
private var _localAdress:String = "http://localhost:8888/GoogleMap/";
/**
* Fonctions
*/
private function init():void {
ecran.height = 0;
this.height = 56;
//this.loadContent(data);
}
// gère l'ouverture et la fermeture du composant
private function onClick(event:MouseEvent):void {
if (!this.isOpen) {
TweenMax.to(ecran, 1, {height:200});
TweenMax.to(this, 1, {height:256,onComplete:loadContent,onCompleteParams:[data]});
//TweenMax.to(this, 1, {height:256});
TweenMax.to(myBox, 1, {height: 24});
prec.enabled = true;
suiv.enabled = true;
play.enabled = true;
pause.enabled = true;
icone.source = this._localAdress +"ressources/petit.png";
modText.text = "Fermer";
this.isOpen = true;
}
else {
TweenMax.to(ecran, 1, {height:0});
TweenMax.to(this, 1, {height:32});
TweenMax.to(myBox, 1, {height: 0});
prec.enabled = false;
suiv.enabled = false;
play.enabled = false;
pause.enabled = false;
icone.source = this._localAdress + "ressources/grand.png";
modText.text = "Ouvrir";
this.isOpen = false;
}
}
//fonction qui charge le contenu dans le visionneur, apellé après qu'il soit ouvert
private function loadContent (p:Object):void {
//Alert.show(p.type);
var type:String = p.type ;
var conte:XMLList = p.urlMedia as XMLList;
var xml:XML;
switch (type) {
case 'Image':
try {this.ecran.removeChildAt(0);} catch (e:Error) {}
this.img = new Image();
this.img.id = UIDUtil.createUID();
this.img.width = 190;
this.img.height = 190;
xml = XML("<urlMedia>" + conte.media + "</urlMedia>");
this.img.source = this._localAdress + "img/" +xml.toString()+ "?forcerefresh=" + new Date().getTime();
this.ecran.addChild(this.img);
prec.enabled = false;
suiv.enabled = false;
play.enabled = false;
pause.enabled = false;
break;
case 'Vidéo':
try {this.ecran.removeChildAt(0);} catch (e:Error) {}
this.vid = new VideoDisplay;
this.vid.id = UIDUtil.createUID();
this.vid.width = 190;
this.vid.height = 190;
xml = XML("<urlMedia>" + conte.media + "</urlMedia>");
this.vid.source = this._localAdress + "img/" +xml.toString()+ "?forcerefresh=" + new Date().getTime();
this.vid.addEventListener(VideoEvent.READY,stopVid);
this.ecran.addChild(this.vid);
prec.enabled = false;
suiv.enabled = false;
play.enabled = true;
pause.enabled = true;
break;
case 'Gallerie' :
try {this.ecran.removeChildAt(0);} catch (e:Error) {}
prec.enabled = true;
suiv.enabled = true;
play.enabled = false;
pause.enabled = false;
this.gal = new Image ;
this.gal.id = UIDUtil.createUID();
tabImg = new Array;
this.gal.width = 190;
this.gal.height = 190;
var i:Number = 0;
for each (var x:XML in conte.media) {
tabImg[i] = x.toString();
i++;
}
this.gal.source = this._localAdress +"img/" + tabImg[0]+ "?forcerefresh=" + new Date().getTime();
this.ecran.addChild(this.gal);
break;
case 'Texte' : break;
}
} |
Partager