Flash AS3 Problems
I have been working on building a Flash based in Video survey that loads its content dynamically at runtime from a PHP generated XML script. The process has been going good thus far. I ran into a lot of road bumps along the way for which I knew the solutions if the app was static but, it is not and thus had to brainstorm and figure out how to deal with the unknown. I learned a lot more code, methods and parameters along the way and eventually found a solution that works like a charm. That was my problem with loading the content on to the stage at runtime.
Now I have a new problem and the project is near it’s end and my brain is spent from worry over the end of the project and the pressures of finding a new contract position. The new problem has to do with the rendering of the text and its placement on the stage. My problem is that time is running out for me to figure this out and get it looking good.
Along the way I have learned properties which I can manipulate and figured out mathematical solutions to address the spacing issue but what works for one UI component does not work for another. I had figured out the math for the Radio Buttons to deal with spacing, wordwrap, textspace width and multilines that vary in size and it looked good. Then when it went to QA, and it broke.
When tested on another survey’s questions my Radio Buttons went from spacing 2 numlines more than the numlines each Radio Label contained plus the question height times that number index at which the label lived to spacing really far apart even though it was just one line of text. Another issue that came up is the truncation of the label. My trace statements output that there is 1 numline. On the stage I see 1 numline but, when I mouse over a second line appears. Thus there is really 2 numlines but the second line is only one word that can fit on the first line. I know it can fit b/c the textField.width is 400 pixels and the words are simply “10 to 20 or more” with the word “more” being hidden then appearing on the second line once the mouse over’s it.
When I began testing I added the long Radio Labels and the short ones to the same XML for visual comparison. Then the Long questions started truncating as well. Flash output that there was 5 numlines on one label but mouse over revealed 2 more numlines. What the heck is going on? I need to figure this out.
I guess I could write a conditional that spaced one way for short labels and another for long but how long is long? it can be 1 line or 100 lines I can know b/c that app is suppose to work independent of me. Hence it being fully dynamic. Even the url it’s loading the xml from is dynamic. SMH! and Scratching it to.
My Challenge today is to figure out…
1.) Why it Flash outputting an incorrect number of numlines.
2.) Why is the label truncating.
3.) What mathematical equation will get the desired spacing always.