Packagecom.catalystapps.gaf.core
Classpublic class ZipToGAFAssetConverter
InheritanceZipToGAFAssetConverter Inheritance flash.events.EventDispatcher

The ZipToGAFAssetConverter simply converts loaded GAF file into GAFTimeline object that is used to create GAFMovieClip - animation display object ready to be used in starling display list. If GAF file is created as Bundle it converts as GAFBundle

Here is the simple rules to understand what is GAFTimeline, GAFBundle and GAFMovieClip:

See also

com.catalystapps.gaf.data.GAFTimeline
com.catalystapps.gaf.data.GAFBundle
com.catalystapps.gaf.display.GAFMovieClip


Public Properties
 PropertyDefined By
  actionWithAtlases : String = actionLoadInGPUMemoryOnlyDefault
[static] Action that should be applied to atlases in process of conversion.
ZipToGAFAssetConverter
  gafBundle : GAFBundle
[read-only] Return converted GAFBundle.
ZipToGAFAssetConverter
  gafTimeline : GAFTimeline
Deprecated Since 5.0: Please Use com.catalystapps.gaf.data.GAFBundle.getGAFTimeline()
[read-only] Returns the first GAFTimeline in a GAFBundle.
ZipToGAFAssetConverter
  id : String
The id of the converter.
ZipToGAFAssetConverter
  ignoreSounds : Boolean
[write-only] Prevents loading of sounds
ZipToGAFAssetConverter
  keepZipInRAM : Boolean = false
[static] Indicates keep or not to keep zip file content as ByteArray for further usage.
ZipToGAFAssetConverter
  parseConfigAsync : Boolean
Indicates whether to convert gaf config file asynchronously.
ZipToGAFAssetConverter
  textureFormat : String = bgra
Defines the values to use for specifying a texture format.
ZipToGAFAssetConverter
  zip : FZip
[read-only] Return loaded zip file as FZip object
ZipToGAFAssetConverter
  zipLoader : FZipLibrary
[read-only] Return zipLoader object
ZipToGAFAssetConverter
Public Methods
 MethodDefined By
  
ZipToGAFAssetConverter(id:String = null)
Creates a new ZipToGAFAssetConverter instance.
ZipToGAFAssetConverter
  
convert(data:*, defaultScale:Number, defaultContentScaleFactor:Number):void
Converts GAF file (zip) into GAFTimeline or GAFBundle depending on file content.
ZipToGAFAssetConverter
Events
 Event Summary Defined By
  Dispatched when convertation completedZipToGAFAssetConverter
  Dispatched when conversion failed for some reasonZipToGAFAssetConverter
Public Constants
 ConstantDefined By
  ACTION_DONT_LOAD_IN_GPU_MEMORY : String = actionDontLoadInGPUMemory
[static] In process of conversion doesn't create textures (doesn't load in GPU memory).
ZipToGAFAssetConverter
  ACTION_LOAD_ALL_IN_GPU_MEMORY : String = actionLoadAllInGPUMemory
[static] In process of conversion create textures (load in GPU memory).
ZipToGAFAssetConverter
  ACTION_LOAD_IN_GPU_MEMORY_ONLY_DEFAULT : String = actionLoadInGPUMemoryOnlyDefault
[static] In process of conversion create textures (load in GPU memory) only atlases for default scale and csf
ZipToGAFAssetConverter
Property Detail
actionWithAtlasesproperty
public static var actionWithAtlases:String = actionLoadInGPUMemoryOnlyDefault

Action that should be applied to atlases in process of conversion. Possible values are action constants. By default loads in GPU memory only atlases for default scale and csf

gafBundleproperty 
gafBundle:GAFBundle  [read-only]

Return converted GAFBundle. If GAF asset file created as single animation - returns null.


Implementation
    public function get gafBundle():GAFBundle
gafTimelineproperty 
gafTimeline:GAFTimeline  [read-only]
Deprecated Since 5.0: Please Use com.catalystapps.gaf.data.GAFBundle.getGAFTimeline()

Returns the first GAFTimeline in a GAFBundle.


Implementation
    public function get gafTimeline():GAFTimeline
idproperty 
id:String

The id of the converter. If it is not empty ZipToGAFAssetConverter sets the name of produced bundle equal to this id.


Implementation
    public function get id():String
    public function set id(value:String):void
ignoreSoundsproperty 
ignoreSounds:Boolean  [write-only]

Prevents loading of sounds


Implementation
    public function set ignoreSounds(value:Boolean):void
keepZipInRAMproperty 
public static var keepZipInRAM:Boolean = false

Indicates keep or not to keep zip file content as ByteArray for further usage. It's available through get zip property. By default converter won't keep zip content for further usage.

parseConfigAsyncproperty 
parseConfigAsync:Boolean

Indicates whether to convert gaf config file asynchronously. If true - conversion is divided by chunk of 20 ms (may be up to 2 times slower than synchronous conversion, but conversion won't freeze the interface). If false - conversion goes within one stack (up to 2 times faster than async conversion, but conversion freezes the interface).


Implementation
    public function get parseConfigAsync():Boolean
    public function set parseConfigAsync(value:Boolean):void
textureFormatproperty 
public var textureFormat:String = bgra

Defines the values to use for specifying a texture format. If you prefer to use 16 bit-per-pixel textures just set Context3DTextureFormat.BGR_PACKED or Context3DTextureFormat.BGRA_PACKED. It will cut texture memory usage in half.

zipproperty 
zip:FZip  [read-only]

Return loaded zip file as FZip object


Implementation
    public function get zip():FZip
zipLoaderproperty 
zipLoader:FZipLibrary  [read-only]

Return zipLoader object


Implementation
    public function get zipLoader():FZipLibrary
Constructor Detail
ZipToGAFAssetConverter()Constructor
public function ZipToGAFAssetConverter(id:String = null)

Creates a new ZipToGAFAssetConverter instance.

Parameters
id:String (default = null) — The id of the converter. If it is not empty ZipToGAFAssetConverter sets the name of produced bundle equal to this id.
Method Detail
convert()method
public function convert(data:*, defaultScale:Number, defaultContentScaleFactor:Number):void

Converts GAF file (zip) into GAFTimeline or GAFBundle depending on file content. Because conversion process is asynchronous use Event.COMPLETE listener to trigger successful conversion. Use ErrorEvent.ERROR listener to trigger any conversion fail.

Parameters

data:* — zip file binary or File object represents a path to a gaf file or directory with gaf config files
 
defaultScale:Number (default = NaN) — Scale value for GAFTimeline that will be set by default
 
defaultContentScaleFactor:Number (default = NaN) — Content scale factor (csf) value for GAFTimeline that will be set by default

Event Detail
complete Event
Event Object Type: flash.events.Event

Dispatched when convertation completed

error Event  
Event Object Type: flash.events.ErrorEvent

Dispatched when conversion failed for some reason

Constant Detail
ACTION_DONT_LOAD_IN_GPU_MEMORYConstant
public static const ACTION_DONT_LOAD_IN_GPU_MEMORY:String = actionDontLoadInGPUMemory

In process of conversion doesn't create textures (doesn't load in GPU memory). Be sure to set up Starling.handleLostContext = true when using this action, otherwise Error will occur

ACTION_LOAD_ALL_IN_GPU_MEMORYConstant 
public static const ACTION_LOAD_ALL_IN_GPU_MEMORY:String = actionLoadAllInGPUMemory

In process of conversion create textures (load in GPU memory).

ACTION_LOAD_IN_GPU_MEMORY_ONLY_DEFAULTConstant 
public static const ACTION_LOAD_IN_GPU_MEMORY_ONLY_DEFAULT:String = actionLoadInGPUMemoryOnlyDefault

In process of conversion create textures (load in GPU memory) only atlases for default scale and csf