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


----- Original Message ----- 
From: "Steven Sacks" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, August 09, 2007 1:56 AM
Subject: Re: [Flashcoders] Prevent flash from caching the loaded assets


>A solution is to convert the image into a textfile which is then used to draw 
>the image on the screen using bitmap drawing tools.
>
> This, of course, is easily hacked by anybody with a copy of Flash because 
> they can read your textfile and draw the bitmap 
> themselves.
>
> The next step is to encrypt that textfile.  Problem is, you have to put your 
> decryption code inside of Flash, which is, of course, 
> easily hacked by anybody with a free copy of SoThink.
>
> You cannot make secure games in Flash unless all logic is on the server and 
> Flash becomes a "dumb" interface.  This isn't going to 
> be possible with your game because you're using a mask to reveal an image.  
> You're also trying to control the browser and the OS 
> file system from inside a plug-in running in that browser.  Give up on that 
> idea.
>
> Basically, you're trying to secure an open file format (swf).  You cannot do 
> this.  Any swf files you put on any public server can 
> be downloaded and decompiled by anyone.  Flash source code is never safe.
>
> If you don't like that Flash isn't secure and is an open-format, then I 
> suggest you write a letter to Adobe, ATTN: Circular File.
>
> In other words, forget it.  Flash is not secure because it is open and that's 
> how it is.  If you want to do something like this, 
> you will have to use a lower-level technology, but I'm doubtful a Java 
> plug-in will support what you're trying to do, either.
>


_______________________________________________
[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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

_______________________________________________
[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

Reply via email to