views:

245

answers:

1

Let me preface this by saying that I am something of an actionscript newbie.

We have a system that allows a user to upload any image, which we store on the server. Of course, it is simple to load an image (that you know the path to) using loadMovie, but I also want to load certain pieces of meta data about the image that is precalculated and stored on the server; we may one day want to retrieve things completely unrelated to the image as well, so consider the non-image data to be arbitrary.

So, that said, is there a way to simply return the image as a variable (urlencoded and returned in a loadVars request, perhaps) and then load that data into a movie clip?

Bonus Lightning Round Question: Is there a way to check the output of a PHP script which processes uploads when the request is sent via FileReference.upload(url:String)? Should I load/escape the binary data and then send it using a loadVars() request if I want to see the output?

+1  A: 

I don't think you need to import the image as 'raw binary data' - you can just store a URL (ie a string) of the path and filename of your image file. Then use the string as an argument to loadMovie (or better still MovieClipLoader.loadClip()) to display the image in your movieClip.

You could call loadVars to get the URL (and your metadata) from a database.

Richard Inglis
Technically correct, but I'm looking for a way (if any such way exists) to avoid having two separate HTTP requests for Metadata and Image Data.
Dereleased
I have accepted this answer as it is what we ended up implementing. Would I still prefer to magically do it in just one call? Yes. Am I realistically going to get this accomplished with the resources in front of me? Probably not. Thanks for the suggestion to use MoveClipLoader, by the way, as the callback functionality allowed us to implement progress bars!
Dereleased