You cannot asynchronously send 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.
A third option would be to use the ExternalInterface API in Flash to let your HTML notify the Flash application via javascript when the URL is available.
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:
- Choose the 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;?>
- Choose the ExternalInterface approach if you are using an asynchronous approach (so the above is not possible) and the HTML/JS part of your application already is being notified. This way you can just invoke a javascript method on the SWF embed DOM object, and have it be received inside your ActionScript.
- Choose the 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
URLLoader to 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.
flashVar.