apache-flexactionscript-3signedrsl

signed RSL without Flex (pure AS3 project)


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.


Solution

  • 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