passage de variable vers un swf
Bonjour,
Voila 3 jours que j'essaie d'esesperement de trouver le moyen de passer une variable vers le swf mais je n'y arrive pas ... J'ai bien lu bcp de tuto ou exemple mais rien n'y fait.
Le but : recuperer une variable unique ( id ) est la passé ensuite en parametredans le swf.
voila ou j'en suis coté php :
Code:
1 2 3 4 5 6 7 8 9 10 11
| <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','263','height','500','src','fileUpload','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','fileUpload' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="263" height="500">
<param name="movie" value="fileUpload.swf?id=<? echo $id; ?>">
<param name="quality" value="high">
<param name=FlashVars value="id=<? echo $id; ?>">
<embed src="fileUpload.swf?id=<? echo $id; ?>" width="263" height="500" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
</object>
</noscript> |
A priori je declare bien ma variable non ?
coté script du swf :
Code:
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
| import flash.net.FileReference;
var file_fr:FileReference = new FileReference();
var list_obj:Object = new Object();
file_fr.addListener(list_obj);
var my_pb:mx.controls.ProgressBar;
// voila ce que j'ai fait qui ne marche pas ! mais j'ai essayé plein de trucs ...
// Le but c'est de mettre cette variable unique
// en parametre de l'adresse en vert plus bas
var id:LoadVars = new LoadVars();
_root.id.text = this.id;
// We must use the progress bar in manual mode
// because we'll tell it what to display
my_pb.mode = "manual";
// Some makup for the progress bar
my_pb.conversion = 1024;
my_pb.labelPlacement = "top";
my_pb.label = "%3%% Uploaded (%1Ko/%2Ko)";
// The progress bar will be visible when we neet it
my_pb._visible = true;
// File type that the browse windows accept
browse_butn.clickHandler = function(){
file_fr.browse([{description: "All", extension: "*"}]);
}
// Display the name of the file
// call the PHP page for upload
list_obj.onSelect = function(){
name_txt.text = file_fr.name;
file_fr.upload("upload.php?id=" + this.id );
}
// Action while uploading
// display the progress bar
list_obj.onProgress = function (bytesTotal, bytesLoaded){
my_pb._visible = true;
my_pb.minimum = 0;
my_pb.maximum = file_fr.size;
my_pb.setProgress(bytesLoaded, my_pb.maximum);
}
// Action when upload is finished
list_obj.onComplete = function(){
name_txt.text = "File uploaded ! ";
my_pb._visible = false;
}
// Here is some handler function
list_obj.onCancel = function(){
name_txt.text = "Canceled";
}
list_obj.onIOError = function(fileRef){
name_txt.text = "IO error with " + fileRef.name;
}
list_obj.onSecurityError = function(fileRef, error){
name_txt.text = "Security error with " + fileRef.name + ":" + error;
}
list_obj.onHTTPError = function(fileRef:FileReference, error:Number){
name_txt.text += "HTTP error: with " + fileRef.name + ":error #" + error;
} |
Je suis sur que la solution est simple mais je tourne en rond et je me perd plus qu'autre chose ...
Donc si vous pouvez ne serait ce que me donner des indices ...
Merci bcp !