Return to Starling Playback Library

Double converting

Questions related to Starling playback library should be asked here.

Double converting

Postby dvrbear » November 13th, 2014, 3:01 am

I have problems when i converting others .ZIPs at one time (at the same time).
Does the GAF support simultaneously convertation for many different files?
User avatar
dvrbear
 
Posts: 26
Joined: October 20th, 2014, 1:42 am

Re: Double converting

Postby dvrbear » November 13th, 2014, 4:22 am

I have write some solution for this problem.
All incoming requests for convert GAF - adding to "buffer" Array and converting one after other till buffer ends.

Code: Select all
public class ConvertGAF {

    private var mc:GAFMovieClip;
    private var canConvert:Boolean = true;
    public var converList:Array = [];

    public function ConvertGAF() {
    }

    public function convert(TargetMC:Sprite, ClassName:String, getFunction:Function=null, getFrame:String="1") {
        converList[converList.length] = [TargetMC, ClassName, getFunction, getFrame];
        tryToConvert();
    }

    private function tryToConvert():void{
        if(canConvert) {
            canConvert = false;
            var gaf:ByteArray = new EmbededIntroAssets[converList[0][1]] as ByteArray;
            var converter:ZipToGAFAssetConverter = new ZipToGAFAssetConverter();
            converter.addEventListener(Event.COMPLETE, this.onConverted);
            converter.convert(gaf);
        }
    }

    private function onConverted(event: Event): void
    {
        var timeline: GAFTimeline = (event.target as ZipToGAFAssetConverter).gafTimeline;
        mc = new GAFMovieClip(timeline);
        converList[0][0].addChild(mc);
        converList[0][2](mc, converList[0][3]);

        converList.shift();
        canConvert = true;
        if(converList.length>0) {
            tryToConvert();
        }
    }
}
User avatar
dvrbear
 
Posts: 26
Joined: October 20th, 2014, 1:42 am

Re: Double converting

Postby vadym.mitin » November 13th, 2014, 4:50 am

We did not write any solution for simultaneously conversion in our Starling GAF library because it can be implemented in a several ways and there is no one good solution for all cases. But it is easy to implement the best one for particular case and each developer has all tools to do that.
User avatar
vadym.mitin
 
Posts: 254
Joined: December 4th, 2013, 8:00 am

Return to Starling Playback Library

Who is online

Users browsing this forum: No registered users and 3 guests