Link to home
Start Free TrialLog in
Avatar of BlueKarana
BlueKarana

asked on

How do I decode an image in Actionscript encoded in vbscript using MSXML?

I'm creating a Flash/Actionscript tool that displays data and an image on the screen. I have an ASP page that retrieves the data and sends it back to the Flash tool. I need to encode the image, using base64, in VBscript within the ASP page, then decode it in actionscript.

Currently I'm using MSXML to do the encoding in the asp page. I then wrap the encoded string in some XML, then use Server.URLEncode(XMLString) and write it out.

So, given this approach, what's the best way to decode the data into a byteArray for loading into an image on the stage? I'm currently trying to use, without success, com.dynamicflash.util, decodeToByteArray.

Is there a better way? The images could be fairly large. (They're photos people take using digital cameras so it's all over the map.)

Thanks!
<%
'vbscript code in asp page

Function Base64Encode(inData)

  Dim dom: Set dom = CreateObject("MSXML2.DOMDocument.3.0")
   Dim elem: Set elem = dom.appendChild(dom.createElement("root"))
   elem.dataType = "bin.base64"
   elem.nodeTypedValue = inData
  
   Base64Encode = elem.Text
   
End Function
%>

Open in new window

//AS3 Code snippet:

	photoBA = Base64.decodeToByteArray(xml.BADGEREQUEST.PHOTO);

	requestPanelInst.requestPhoto.loadBytes(photoBA);

Open in new window

Avatar of blue-genie
blue-genie
Flag of South Africa image

this looks like something for the likes of lee brimlow. have you tried checking his blog or posting something on his forum?
Avatar of BlueKarana
BlueKarana

ASKER

I'll try that. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of BlueKarana
BlueKarana

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial