Solved

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

Posted on 2010-09-08
3
507 Views
Last Modified: 2013-11-11
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

0
Comment
Question by:BlueKarana
  • 2
3 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 33634698
this looks like something for the likes of lee brimlow. have you tried checking his blog or posting something on his forum?
0
 

Author Comment

by:BlueKarana
ID: 33636444
I'll try that. Thanks.
0
 

Accepted Solution

by:
BlueKarana earned 0 total points
ID: 33643118
I finally figured out that MSXML conversion to base64 was inserting line feeds and + signs. It's obvious why the line feeds are bad news. The + signs are a problem because the dynamicFlash base64 decode expects a - (minus), not a plus.

Two replaces later and I'm good to go.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Path of Workbook 3 86
XSL - change date format 3 49
Post xml via PHP Soap Client 3 61
XML Node Counting in MS Access VBA 4 31
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

809 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