Skip to content

Instantly share code, notes, and snippets.

@icecandy
Created September 28, 2017 14:34
Show Gist options
  • Save icecandy/40dff4525b8e80feab9df57a981990f2 to your computer and use it in GitHub Desktop.
Save icecandy/40dff4525b8e80feab9df57a981990f2 to your computer and use it in GitHub Desktop.
Titanium example of defining an array of animation file names
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