Solved

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

Posted on 2010-09-08
3
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

749 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