Sometimes you spend an inordinate amount of time on a project, and in the course of it come across a problem you just can't solve. You struggle and struggle with it, and ultimately -- after lots of fruitless effort -- end up going with some half-assed workaround that's incredibly inelegant and stupid, but which gets the job done. You hate doing it, but you just can't figure out any other way, and there's a deadline so you just say "To hell with it" and move on.
And then in a blinding flash of light some time later, the right solution comes to you and you realize you were going about the entire thing exactly backwards.
Naturally the insight comes much too late to do you any actual good, thus making you feel twice the fool for not having thought of it before.
This is the situation I am in currently with the whole "FaceMaker/HeroMachine 3" preview items. In HeroMachine 2.x, keeping the preview items updated was a big pain. I had to manually cut and paste the lineart in to the preview boxes, and manually rename the button to match the item. If I misspelled anything, it wouldn't work. If I later wanted to change a name, I had to manually retype it in, again avoiding any silly mistakes. Adding new items was a pain.
So when I started working on this new code base upon which first the "HeroMachine Mini" apps would be built, and hopefully later HeroMachine 3, I wanted to figure out a way to have the preview items auto-populate. Only I couldn't figure out how. I really didn't want to go back to manually adding them all, but I couldn't see any other way around it.
Until today, just now, when I finally finished adding all the art and all the programming and it's too late to go back and change it all. So I'm going to have to manually add all the preview items in FaceMaker, knowing now that had I had this insight at the beginning instead of the end, I could have easily made it all work.
Very frustrating, even though at least now I see a way forward for the next version.
Of course I'm basically going to have to rewrite the program from scratch to make it all happen in the next version, which is also not appealing.
Feh. Sometimes a good insight too late is worse than never having had it at all.
That’s sour. Then again, acting on this insight for version 4, will make it easier for versions 5 through 10 and above. 😉
The breakthrough conceptually is, I am currently putting all of the items (and the three movies that make up each item, one each for lineart, color1, and color2) into its own frame within the holding movie clip. So the Mustache movie clip might have 30 frames, each with one item on it. The problem was you can’t do anything with the items in a frame until that frame is shown on the stage, which meant I couldn’t just tear through each item slot and dynamically duplicate the items onto preview boxes.
And then it hit me — I could do it the opposite way. Put all of the items not in the holding movie clips at all! Just load them into preview boxes and, when the user clicks them, duplicate them onto the character canvas box. When they pick a different Mustache, dynamically unload the previous one, and load in the new one.
That way I don’t have to manually copy and paste anything, it all happens automatically.
I could kick myself for not thinking of this earlier. Double feh.
There are still a lot of logistical problems to solve with this approach, but it’s just details. The overall concept works, it’s just totally ass-backwards from the way I was doing it.
But you’re right, Maxx, at least it sets me up to do it properly the next time!