I have an image uploader that runs on a separate PHP script, and then updates the Preview Url after the file has been uploaded. But what I'd like to do is have a Flash SWF embedded in the same HTML that's running the PHP Uploader to get that Preview URL and display it in the Flash Application.
What would you suggest be the best way to go about sending this PHP variable to Flash?
Gracias de antemano!
preguntado el 27 de agosto de 11 a las 21:08
You cannot asynchronously enviar a value from PHP (server-side) to Flash (client-side). You have to either pass it in on embed-time through a flashvar (although I doubt this will work in your case since you want this transfer of information to occur after a load operation) or your Flash application will need to query the server, and have the server return the correct value.
Una tercera opción sería utilizar el
Since I don't know your general set-up, it's hard to recommend one way over another, but the general reasons for going with one over the other are:
- Elija el flashvar approach if the value is known when the embedding HTML is loaded, so that you can pass it in to the SWF as it's being initialized, e.g. using the query-string: myflash.swf?previewUrl=<?php echo $previewUrl;?>
- Elija el server query approach if none of the above works, but you have some way of knowing when the upload is complete. Just use a regular
URLLoaderto query the server for the preview URL, specifying the file id or similar as a GET or POST variable.
Hope this helps. Please elaborate on the details of your architecture for a more thorough answer.
See these pages