Created
September 28, 2017 14:34
-
-
Save icecandy/40dff4525b8e80feab9df57a981990f2 to your computer and use it in GitHub Desktop.
Titanium example of defining an array of animation file names
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
Alloy.Globals.animationFilenames = []; | |
function initAnimationFilenames() { | |
var filename; | |
for (var i = 1; i <= 118; i++) { | |
filename = '/images/animation/animation_' + padNumber(i, 3) + '.png'; | |
Alloy.Globals.animationFilenames.push(filename); | |
} | |
} | |
//@_number Integer | |
//@_length Integer - length to pad string with '0's | |
function padNumber(_number, _length) { | |
var str = _number + ''; | |
while (str.length < _length) { | |
str = '0' + str; | |
} | |
return str; | |
} | |
initAnimationFilenames(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment