Solved

Display a base64 encoded image in flash?

Posted on 2004-09-22
3
379 Views
Last Modified: 2009-07-06

Hi all,

I am using a service on the net which provides dynamic map images. The idea is basically that you make a "GET" request to the mapping server providing them with co-ordinates of what area of the map would you like to view and the scale to display, and then they send you back XML which has details of the area inside it - and most importantly, a map image which has been dynamically generated for you (can be any format you choose including jpg, gif, png etc).

The image is inside the XML in Base64Binary encoded format (raw image data), for example (truncated this example a lot):

<Image>/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODw...etc</Image>

You are then supposed to base64 decode this, and that will give you your map image.

I have flash/actionscript code that will make a GET request to their server and retrieve the XML. It then goes through the XML and obtains the data between the <Image></Image> tags and puts it into a myImage variable.

My question is...what would I then need to do in flash/actionscript to get this raw image data into something displayed on the screen to the user  as a proper image? Is there any way to create a new image on the fly using raw image data?

The only thing I can think of is that I would make the actionscript write the data out to the hard drive as "newfile.jpg" and then make it read the image back in and display it from there...but I am wondering if there is a better way since a lot of people will be using this and I would like to avoid creating tons of temporary image files on the hard drive.

Does anyone know how to solve this problem (or alternatively, can provide me code on how to write the image data out to a file on the hard drive, and then make flash display the newly created image file on the fly?)

Thank you in advance!
0
Comment
Question by:WangProducts
3 Comments
 

Author Comment

by:WangProducts
ID: 12169022

i'm surprised no-one answered this :) I asked on other flash forums and everyone was eager to help with a genuinely advanced question.

The answer is - this can't be done on the fly in flash/actionscript...however PHP can do it using something similar to:

Therefore, you can put a php script up that grabs the base64 image, decodes it, and displays is - then make flash/actionscript read it in on the fly using loadMovie();

:)
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 13130126
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SWF won't scale? 4 520
Can't play a movie website which used to be playable 4 619
free flash maker 5 205
How to block online streaming via TMG2010 ? 2 122
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now