Created
March 12, 2013 10:52
-
-
Save k0t0vich/5141979 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function decode(async: Boolean = true):void { | |
if (_decoded) | |
return; | |
_lenght = _bundle.atfTextures.length; | |
_counter = 0; | |
var me: StarlingWrapper = this; | |
for (var i: int = 0; i < _lenght; i++) { | |
var atf: ByteArray = _bundle.atfTextures[i]; | |
if (async) { | |
Texture.fromAtfData(atf, 1, true, createCallBack(i, atf)); | |
} else { | |
var texture: Texture = Texture.fromAtfData(atf); | |
_starlingTextures.push(texture); | |
atf.clear(); | |
} | |
} | |
} | |
private function createCallBack(i:int, atf:ByteArray):Function { | |
return function(texture: Texture):void { | |
_starlingTextures[i] = texture; | |
atf.clear(); | |
_counter++; | |
if (_counter == _lenght) { | |
_decoded = true; | |
dispatchEvent(new Event(Event.COMPLETE)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment