Question

Here there's a brief explanation of how we can "simulate" the RSL system used in Flex with pure AS3: loading an RSL without using flex?

But what about signed RSLs? can we use that technique to load SWZ files too? will them be cached by the player? how can we "reuse" a SWZ cached by the player in a pure AS3 project?

Thanks! Enrique.

Was it helpful?

Solution 2

OK, This is the solution (not tested yet but I'm pretty sure it works)
Example from the Adobe's AS3 Reference:
//URLRequest, digest property:

var myURLReq:URLRequest = new URLRequest();
myURLReq.url = "http://yourdomain/users/jdoe/test01/_rsc/Automated/AssetCaching_rsc/test01/rsl.swz";
myURLReq.digest = "3B0AA28C7A990385E044D80F5637FB036317BB41E044D80F5637FB036317BB41";
var myURLLoader:URLLoader = new URLLoader();
myURLLoader.dataFormat = URLLoaderDataFormat.BINARY;
myURLLoader.addEventListener("complete", onC);

myURLLoad.load(myURLReq);

function onC(e) {
    var someLoader:Loader = new Loader();
    addChild(someLoader);
    someLoader.loadBytes((ByteArray)(myURLLoad.data)); 
}

So, we can load a signed RSL (.SWZ) like any other SWF, BUT! we must use URLLoader, not Loader, and provide the digest property. Then we use Loader to load the byteArray from URLLoader. The signed SWZ is checked internally by the Player, and if it detects is signed by adobe, then it will be cached by the Player, we don't need to do anything. I think Flash Player checks automatically, and before loading any SWZ, if that SWZ is already cached by the player.

That's all I think.

if you want to see more details, check my reply in FlexCoders:
http://tech.groups.yahoo.com/group/flexcoders/message/159010

OTHER TIPS

Signed SWC (ie SWZ) are loaded into the flash player cache rather than the browser cache. Therefore only uber trusted code is allowed which at the moment comes from Adobe only.

For preloading? Only way i know is not really a way, but say you have an info page or login page before your Flex app, load the RSLs when the user is maybe reading something by including a lightweight SWF that uses the same RSLs as your main app. Its a cheat, but seen it used when bandwidth is a minimum and want to get bang for buck when an app first loads.

Preloading any other way outside the player I could see security concerns with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top