Category: Flash

  • FListBox: getSelectedIndex Hack

    If you remove all items from an FListBox after selecting an item, it will still report that you have the 0 index selected. Obviously, this bs. After a post on the list, I found some code from a dude with a similiar problem, but no go. So, here’s the best way I know to “reset” the FListBox to go, “Oh yeah, I need to actually look at myself and see if anything is selected before returning bs information.” No, I didn’t look under the hood to find out why… it’s Friday, mofo’s.

    Issuing:
    <pre><code>this.list_lb.setSelectedIndex(null);</code></pre>
    Will effectively refresh it, so to speak, and give you the correct index of “undefined” if nothing is selected.

  • Never Use createTextField Alone

    If you ever use createTextField, never create a text field without first creating a movie clip to put it in. If you don’t, there is no way to remove it. This wreaks havoc with custom components as I just found out. At least you can always put it at a depth of 0. …there is FLabel, of course, which proves my point: It’s a text field in a movie clip.

  • Dynamic Duo: Branden & Josh Kick It

    Branden Hall & Joshua Davis completed one of their first projects. A little confusing while things load because your not sure what’s happening, but still, she looks good!

    <a href=”http://www.vw.com/newModels.htm”>Click the “GO” button next to the Phaeton</a>.

  • Found a use for Class.prototype.property

    For those of you uber coders, this may seem trite, and “duh”. To me, though, I’m still learning, so I thought it was kind of a neat step in my education.

    I found a use for putting properties on prototypes Sunday. I was coding about 6 classes who each had similiar properties, but a few had 2 or 3 that were different as well as all having about the same defaults. A lot of these properties won’t really get set either, therefore, not causing the instance of the class to get it’s own copy.

    So, I put them all on prototype because:
    – all 6 classes have them
    – most classes only modify half of the properties to be different from the defaults
    – majority of instances will only read the properties, not set them resulting in very few local instance copies

    Ever since I learned that prototpye properties get transferred to local copies upon a setting of that property, I was distraught at how to implement constants. I then found if I just put my functions on prototype, but all of my properties in the constructor, things worked great. Glad to know I can still save some memory this way!