Voici le code :
player.swf://------------------------esseye de passer la variable par un sharedpobject-------------------------
//var mesVars:SharedObject = SharedObject.getLocal("moncookie");
//trace( mesVars.data.maVar1);
//-------------------------------------------------------------------------------
trace(this.parent.parent.parent["videoUrl"]);
//testVar.swf\\
var urlVariable:String ;
try
{
// on récupère la variable maVar du swf appelant\\
(urlVariable= this.parent.parent.parent["videoUrl"]);
}
// on récupère l'erreur si la variable n'est pas passée\\
catch (e:Error)
{
// on affiche l'erreur, s'il y a lieu\\
trace ("zut : "+e);
}
// on affiche la variable récupérée dans le swf appelant, si tout s'est bien passé\\
trace(urlVariable);
//---------------Essaye du gars sur mediabox-----------------------------
/*addEventListener(Event.ADDED_TO_STAGE, maFunction);
var strSource:String
function maFunction(pEvt:Event):void
{
var urlVariable:String = this.parent.parent.parent["videoUrl"];
strSource = urlVariable;
initVideoPlayer();
}*/
//-----------------------------------------------------------------------------------------
// le tutoriel a été pris sur ce site :
//http://www.thetechlabs.com/tutorials/audionvideo/how-to-build-a-as3-videoplayer/
// ##########################
// ############# CONSTANTS
// ##########################
// time to buffer for the video in sec.
const BUFFER_TIME:Number = 8;
// start volume when initializing player
const DEFAULT_VOLUME:Number = 0.6;
// update delay in milliseconds.
const DISPLAY_TIMER_UPDATE_DELAY:int = 10;
// smoothing for video. may slow down old computers
const SMOOTHING:Boolean = true;
// ##########################
// ############# VARIABLES
// ##########################
// flag for knowing if flv has been loaded
var bolLoaded:Boolean = false;
// flag for volume scrubbing
var bolVolumeScrub:Boolean = false;
// flag for progress scrubbing
var bolProgressScrub:Boolean = false;
// holds the last used volume, but never 0
var intLastVolume:Number = DEFAULT_VOLUME;
// net connection object for net stream
var ncConnection:NetConnection;
// net stream object
var nsStream:NetStream;
// object holds all meta data
var objInfo:Object;
// url to flv file
// #########################
// ##### variable qui contient le URL
// #########################
//var strSource:String = mesVars.data.maVar1;
var strSource:String = urlVariable;
// timer for updating player (progress, volume...)
var tmrDisplay:Timer;
function playClicked(e:MouseEvent):void {
// check's, if the flv has already begun
// to download. if so, resume playback, else
// load the file
if(!bolLoaded) {
nsStream.play(strSource);
bolLoaded = true;
}
else{
nsStream.resume();
}
// show video display
player_mc.vidDisplay.visible = true;
// switch play/pause visibility
player_mc.mcVideoControls.btnPause.visible = true;
player_mc.mcVideoControls.btnPlay.visible = false;
}
main.swf :- var videoUrl:String;
- var map:Array = new Array();
- map.push(["photo/5/images1.jpg", 555, 241, "Collège de ","5",2,"(1908) Maison de ville d'architecture française. Occupée au XIX siècle par un forgeron et un aubergiste. Propriété de la Ville de , elle abrite maintenant le siège de l'Association des gens d'affaires de et un bureau de tourisme.","non"]);
- map.push(["photo/6/images1.jpg", 553, 209, "Maison Rollin-Blais","6",4,"(1774) Maison de ville d'architecture française. Occupée au XIX siècle par un forgeron et un aubergiste. Propriété de la Ville de , elle abrite maintenant le siège de l'Association des gens d'affaires de Longueuil et un bureau de tourisme.","mr-b.flv"]);
-
-
- var hotspot_mc:MovieClip =new hotspot();
- hotspot_mc.monImage = map[i][0];
- hotspot_mc.nom = map[i][3];
- hotspot_mc.numero = map[i][4];
- hotspot_mc.nombre = map[i][5];
- hotspot_mc.texte = map[i][6];
- hotspot_mc.videoUrl=map[i][7];
- hotspot_mc.x = map[i][1];
- hotspot_mc.y = map[i][2];
- hotspot_mc.addEventListener(MouseEvent.MOUSE_OVER, mouseover);
- hotspot_mc.addEventListener(MouseEvent.MOUSE_OUT, mouseout);
- hotspot_mc.addEventListener(MouseEvent.MOUSE_DOWN, mousedown);
- addChild(hotspot_mc);
-
-
-
-
- function mousedown(pEvt:Event):void
- {
- if(pEvt.currentTarget.videoUrl != "non")
- {
-
- videoUrl = pEvt.currentTarget.videoUrl;
-
- video = new TextField();
-
- video.wordWrap=true;
- video.width = 100;
- video.height = 40;
- video.x = 300;
- video.y = 320;
- video.text = "Voir vidéo";
- plusinfo.addChild(video);
-
- video.setTextFormat( format2 );
- video.addEventListener(MouseEvent.CLICK,creeLecteur)
- }
- else
- {
- videoUrl = "non";
-
- }
- }
-
-
-
-
- function creeLecteur(pEvt:MouseEvent):void
- {
- if(plusinfo.contains(loadergrandeImages))
- {
- plusinfo.removeChild(loadergrandeImages);
- }
-
- var format3:TextFormat = new TextFormat();
- format3.font = "Verdana";
- format3.align = "justify";
- format3.color = 0x000000;
- format3.size = 12;
- format3.bold=false;
- format3.bullet=false;
-
-
- var adresse:URLRequest = new URLRequest("player.swf");
- ploader = new Loader();
- ploader.load(adresse);
- ploader.x=100;
- ploader.y=75;
- plusinfo.addChild (ploader);
-
- plusinfo.removeChild(video);
- video = new TextField();
- video.wordWrap=true;
- video.width = 100;
- video.height = 40;
- video.x = 300;
- video.y = 320;
- video.text = "Quitter vidéo";
- plusinfo.addChild(video);
- video.setTextFormat( format3 );
- video.addEventListener(MouseEvent.CLICK,quitterVideo)
-
- }