Bonjour,

Je travaille sur un script qui charge deux images aléatoires, tirées d'une base de données grâce à un appel PHP. En passant, je charge aussi le titre à afficher sous l'image et le lien qui correspond.

Et c'est là que le bât blesse. Je n'arrive pas à appliquer le lien à chaque image... Il me paraissait pourtant logique de faire un truc comme ça:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
	photo.onRelease = function (){
		getURL("http://www.asdepique.com","_blank","GET");
	};
Quelle serait la bonne méthode?

Le reste du code pour la bonne bouche:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
_quality = "BEST";
 
//function random
lv=new LoadVars();
lv.onLoad = function() {
	createEmptyMovieClip("photo",0);
	photo.loadMovie("../img_ref/"+lv.id1+".jpg");
	//trace("../img_ref/"+lv.id1+".jpg");
	photo._x = 450;
	photo._y = 365;
 
	photo.onRelease = function (){
		getURL("http://www.asdepique.com","_blank","GET");
	};
 
	trace(lv.leg1);
 
	//create a blank text box and set its parameters
	_root.createTextField("theTextBox",400,500,490,150,20);
	theTextBox.background=false;
	theTextBox.font="arial";
	theTextBox.border=false;
	theTextBox.backgroundColor=0xFFFFFF;//white
	theTextBox.borderColor=0x000000;//black
	theTextBox.multiline=true;
	theTextBox.wordWrap=true;
	theTextBox.text=lv.leg1;
 
	//create a blank text box and set its parameters
	trace(lv.leg2);
	_root.createTextField("theTextBox2",350,700,490,200,30);
	theTextBox2.background=true;
	theTextBox2.border=false;
	theTextBox2.backgroundColor=0xFFFFFF;//white
	theTextBox2.borderColor=0x000000;//black
	theTextBox2.multiline=true;
	theTextBox2.wordWrap=true;
	theTextBox2.text=lv.leg2;
 
	createEmptyMovieClip("photo2",1);
	photo2.loadMovie("../img_ref/"+lv.id2+".jpg");
	photo2._x = 640;
	photo2._y = 365;
 
};
 
lv.load("http://www.asdecarreau.com/asdepique/img_rand.php");