| Package | com.catalystapps.gaf.core |
| Class | public class ZipToGAFAssetConverter |
| Inheritance | ZipToGAFAssetConverter flash.events.EventDispatcher |
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:
GAFTimeline - is like a library symbol in Flash IDE. When you load GAF asset file you can not use it directly.
All you need to do is convert it into GAFTimeline using ZipToGAFAssetConverterGAFBundle - is a storage of all GAFTimeline's from BundleGAFMovieClip - is like an instance of Flash MovieClip.
You can create it from GAFTimeline and use in Starling Display Object
See also
| Property | Defined 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 | ||
| Method | Defined 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 | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when convertation completed | ZipToGAFAssetConverter | |||
| Dispatched when conversion failed for some reason | ZipToGAFAssetConverter | |||
| Constant | Defined 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 | ||
| actionWithAtlases | property |
public static var actionWithAtlases:String = actionLoadInGPUMemoryOnlyDefaultAction 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
| gafBundle | property |
gafBundle:GAFBundle [read-only]
Return converted GAFBundle. If GAF asset file created as single animation - returns null.
public function get gafBundle():GAFBundle| gafTimeline | property |
gafTimeline:GAFTimeline [read-only]
Returns the first GAFTimeline in a GAFBundle.
public function get gafTimeline():GAFTimeline| id | property |
id:String
The id of the converter.
If it is not empty ZipToGAFAssetConverter sets the name of produced bundle equal to this id.
public function get id():String public function set id(value:String):void| ignoreSounds | property |
ignoreSounds:Boolean [write-only] Prevents loading of sounds
public function set ignoreSounds(value:Boolean):void| keepZipInRAM | property |
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.
| parseConfigAsync | property |
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).
public function get parseConfigAsync():Boolean public function set parseConfigAsync(value:Boolean):void| textureFormat | property |
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.
| zip | property |
zip:FZip [read-only]
Return loaded zip file as FZip object
public function get zip():FZip| zipLoader | property |
zipLoader:FZipLibrary [read-only] Return zipLoader object
public function get zipLoader():FZipLibrary| ZipToGAFAssetConverter | () | Constructor |
public function ZipToGAFAssetConverter(id:String = null) Creates a new ZipToGAFAssetConverter instance.
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.
|
| 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
|
| complete | Event |
flash.events.EventDispatched when convertation completed
| error | Event |
flash.events.ErrorEventDispatched when conversion failed for some reason
| ACTION_DONT_LOAD_IN_GPU_MEMORY | Constant |
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_MEMORY | Constant |
public static const ACTION_LOAD_ALL_IN_GPU_MEMORY:String = actionLoadAllInGPUMemoryIn process of conversion create textures (load in GPU memory).
| ACTION_LOAD_IN_GPU_MEMORY_ONLY_DEFAULT | Constant |
public static const ACTION_LOAD_IN_GPU_MEMORY_ONLY_DEFAULT:String = actionLoadInGPUMemoryOnlyDefaultIn process of conversion create textures (load in GPU memory) only atlases for default scale and csf