You can't send raw binary data over http, it has to be Base64 encoded.
This part is required in the Coldfusion page:
<cfset img64 = toBase64(imgBinary) />
<cfoutput>#img64#</cfoutput>
Coldfusion throws an error when using the following:
<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<cfset imgPath = ExpandPath ("leaves.jpg") />
<cffile action="readBinary" file="#imgPath#" variable="imgBinary">
<cfoutput>#imgBinary#</cfoutput>
<quote>
ByteArray objects cannot be converted to strings
</quote>
If you'd use remoting or a socket, then the Base64 encoding is not required.
regards,
Muzak
----- Original Message -----
From: "Rkos Attila" <[EMAIL PROTECTED]>
To: "Muzak" <[email protected]>
Sent: Thursday, August 09, 2007 2:03 PM
Subject: Re[2]: [Flashcoders] Prevent flash from caching the loaded assets
>
> Base64 is superfluous here, since you can load raw binary data - see
> URLLoader.dataFormat.
>
> Attila
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> From: Muzak <[EMAIL PROTECTED]>
> To: [email protected] <[email protected]>
> Date: Thursday, August 9, 2007, 4:37:02 AM
> Subject: [Flashcoders] Prevent flash from caching the loaded assets
> --====----====----====----====----====----====----====----====----====----===--
> With AS3 you can load the image as binary data (Base64 encoded).
>
>
> import flash.events.*;
> import flash.net.*;
> import flash.display.Loader;
> import flash.utils.ByteArray;
> import com.dynamicflash.util.Base64;
>
> var url:String =
> "http://www.muzakdeezign.com/flashcoders/binary_image/image.cfm"
> var imgLoader:Loader;
> var imgReq:URLRequest;
> var imgURLLoader:URLLoader;
>
> function imgLoaderCompleteHandler(evt:Event):void {
> trace("Application ::: imgLoaderCompleteHandler");
> var imgData:ByteArray = Base64.decodeToByteArray(evt.currentTarget.data);
> imgLoader = new Loader();
> imgLoader.loadBytes(imgData);
> addChild(imgLoader);
> }
>
> imgReq = new URLRequest(url);
>
> imgURLLoader = new URLLoader();
> imgURLLoader.addEventListener(Event.COMPLETE, imgLoaderCompleteHandler);
> imgURLLoader.load(imgReq);
>
>
>
> // see it in action
> http://www.muzakdeezign.com/flashcoders/binary_image/load_binary.html
>
>
> The Coldfusion file contains the following:
>
> <cfsetting enablecfoutputonly="yes" showdebugoutput="no">
> <cfcontent type="application/x-shockwave-flash" />
>
> <cfset imgPath = ExpandPath("leaves.jpg") />
> <cffile action="readBinary" file="#imgPath#" variable="imgBinary" />
> <cfset img64 = toBase64(imgBinary) />
>
> <cfoutput>#img64#</cfoutput>
>
>
> Note that I added a cfcontent tag that changes the content type to Flash, so
> when viewing the cfm page directly in your browser,
> it
> will *try* to display an swf (and fail) ;-)
> http://www.muzakdeezign.com/flashcoders/binary_image/image.cfm
>
> I used a Binary64 class to convert the loaded binary data to ByteArray.
> http://www.dynamicflash.com/goodies/base64
>
> regards,
> Muzak
>
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com