
Some software have the ability to detect the presence of files named in a sequential order.
I want to add similar functionality to some experimental scripts I'm working on.
For my purposes I'm only focusing on sequential files with numeric prefixes or suffixes in the filenames.
The function I've written returns a new filepath thats incremented. Using regular expressions I diced the filepath up into pieces I could change then concatenate into the next potential filepath. This function is for generating a possible next filepath, so testing the existence of the actual file is not my concern.
Example 1
trace(getIncrementFilePath("gallery/image01.png")); //returns gallery/image02.png
Example 2
Creating incremented filepaths in a loop.
var path:String="gallery/image01.png";
var i:int=0;
while (i < 10)
{
path=getIncrementFilePath(path);
trace(path);
i++;
}
/*
trace output
===================
gallery/image02.png
gallery/image03.png
gallery/image04.png
gallery/image05.png
gallery/image06.png
gallery/image07.png
gallery/image08.png
gallery/image09.png
gallery/image10.png
gallery/image11.png
*/
Read the rest of this entry »
No Comments »
Posted by: Keith H in ActionScript 3, JavaScript, JSFL, XML, tags: ActionScript 3, CAML, combo, Concatenation, JavaScript, Jquery, JSFL, Python, SharePoint, String, videogames, XML, XUL
String'n together combos isn't always as fun as doing them in a fighting videogame.

If you write script that has a lot String content mixed with variables, I'm sure you're doing a lot of heavy concatenation.
Building string combos with quotes and apostrophes sprinkled all over a script gets confusing. The way I like to keep this confusion to a minimum is to write my static markup separately. This allows me to make sure it shows up as intended. Then I concatenate my variables in all the places that need to have dynamic content.
Taking static markup or script and wrapping quotes around every line is a chore so I made this Concatenation Tool to help with that.
Currently I've only made this support languages I'm using mostly. If I have to use a new language I'd just add it in.
Read the rest of this entry »
2 Comments »

I been writing JavaScript recently and had to conjure up the older syntax I'd usually write in ActionScript 2
This post is possibly "beating a dead horse" but I'll post it anyway.
JavaScript or ActionScript 2
function isArray(o)
{
return o instanceof Array;
//Alternative way
//return Object(o.constructor) == [].constructor;
}
var A=new Array();
var B=new Object();
var C="dog";
var D=function(){};
alert(isArray(A)+","+isArray(B)+","+isArray(C)+","+isArray(D));
//Outputs: true,false,false,false
ActionScript 3
function isArray(o:Object=null):Boolean
{
return o is Array;
}
var A:Array=new Array();
var B:Object=new Object();
var C:String="dog";
var D:Function=function(){};
trace(isArray(A)+","+isArray(B)+","+isArray(C)+","+isArray(D));
//Outputs: true,false,false,false
No Comments »