I was working on Axe, adding an extra link into the bottom nav... simple task!
...or it should be... but the system wasn't designed properly, links were in the wrong places in the database, the flash parsed the xml using absolute positions. The first 3 elements were ignored, they're the main sections, the next 3 were the original bottom navs, a few more elements make up forms and other areas of the site, and the last, which I've just added sits at position 11.
The original code looks similar to this:
Actionscript:
-
for (i = 3; i <6; i++) {
-
var element:XMLNode = xmlnode.childNodes[ i ];
-
// blah blah
-
}
The best practice thing to do would be to move all the bottom nav links into one section, but as usual, time, money, client - all the usual reasons means that the work had to be done yesterday, I needed to find a quick hack.
So this is what I came up with:
Actionscript:
-
var elementIDs:Array = [3, 4, 11, 5];
-
for (i in elementIDs) {
-
var element:XMLNode = xmlnode.childNodes[ elementIDs[ i ] ];
-
// blah blah
-
}
Hard coding the posisions into an array allowed me to place the elements in any order I like, it's a good thing because the client wanted the new link between existing links.
Quite a neat trick I think!