Friday, March 30, 2007

The worst problem

I find myself at a new "stumping" place. Essentially, I've created code that separates the county number/name from the magnitude. These are being fed as 2.5 -- where the first number represents a particular county and the second is how many times that county appears for that topic. My code splits the values at the ".", translates the first number into a county name (which is displayed in the output area), and then colors the county movieclip according to the second number.

So, while my code appears to be splitting everything up and spitting out the right information in the right place, it's cutting a number of the topics' information off. This is evident in the "undefined" variables that are showing up at the end of some of the topics' output.

I have no idea what is going on with this. I'll have to dissect the code and try to back up enough to a place where it does work correctly. Lucky for me, I'm saving this iterations and can check to see if "map_options2" had the same problem.

--

"map_options2" is doing this to some degree, although not in a matching manner. This is frustrating. All I can tell so far is that somehow my loop to determine the counties will only go so high, per topic. Each topic is cutting off or showing different numbers of items. It's possible I've reused a variable by accident, or called the wrong array. I'll have to check.

I'm also contemplating putting my variables together in a more compact manner. I'm having serious issues with the titles that have commas in them, versus the commas I need to separate my values. I might be able to fix this if I can get my program to recognize whether the surrounding characters are numerical or not. At this point, I feel like my actionscript for this is growing out of control and a bit bulky for what I'm attempting to accomplish.

--

It's been a few frustrating hours now. I've run a lot of tests to try to isolate my problem. I've found out that my link on the topic name has the right content, but somehow it's just not passing through to the next step. Some topics pass all of their information, while others get truncated.

I just looked up the array property ".length" and see that this is used to determine how many characters are in a string. I'm thouroughly confused now, because I think I've been using it to determine how many nodes I have in my array. But, it seems like this has been returning the correct information in some instances. Needless to say, this is aggravating.

I will note that I've been referring to the chapter on "strings" in my actionscript book, for probably the past few weeks. I'm turning to the array section now. I *hope* that there will be an answer for me! Otherwise, I may determine to abandon this aspect.

--

9:54 - still struggling, although I've taken a long break! I think that I've figured out more of the problem, although I still don't know how to fix it. Essentially, I'm using "asfunction:" to pass variables when a topic is chosen. This feeds the variables to a selected function that expects a certain number of variables (1) in it's format. Since all of my data is comma-delimited... it's totally freaking out the function. I honestly can't see a method around this. I'm thinking that if I can swap out the comma for another character when the variable is passed, that this would work. I can't take the commas out of my external AS -- I've tried and broken the file on that side in addition.

Now it's me versus the machine. I think I could give this up, but I've been taken in by this problem. At least I'm learning more about scripting, so that's good. For every mistake I make, I learn how NOT to do it!

--

11:42 - Success! And relief, now I won't have to think about this particular thing anymore. I might try not to touch the map for a while and work on some other projects.

Here's the final for today: map_options_mag

What's the difference? Ah-ha, the user would never know the difference, but I do. The data is complete, no longer truncated. I ended up passing a single, relevant number and then using that number to call up the right array. I've discovered, through blood-sweat-and-tears, that there is a limit to the characters passable per string -- atleast in the context that I was doing it.

The counties on this map also link to the Impacts database. It's not relevant to the topic, yet. It is forming a new URL on the fly though, so that's cool.

I need to fix the rollover buttons so that the counties return to the right color when you roll-off.

I can't do any more today! I think I'm going to take a break. At least for a day.

--

I just had a thought. I wonder if this would be easily translatable to other political maps? If I can get the basic mechanisms down... it just might be. That would be a neat expansion.

0 comments: