Blog

  • Case Sensitivity in Unexpected Place: XML Object

    Skip to the last sentence for the advice.

    Many Flashers already know about the caveats one faces when going from Flash Player 6 to Flash Player 7 development in dealing with case sensitivity. This new feature helps speed, and also allows for more freedom of naming in code since color can now be an instance of the Color class. Additionally, one mispell of mY_btn (instead of my_btn), will have the Output gettin’ all in yer face about “Yo, this variable doesn’t exist anywhere man… weird, what’s he doing here?”. It’s nice to know an uppercase Y makes one so distinctive. How about a capital J, biotch!?

    Anyway, re-writing some AS1 XML parsing code, and it was working fine when I published to Flash Player 6, but not 7. I was like, wtf. So, started debugging, making mad traces, long debugging window sessions, digging deep in XML objects in the Debug Window to inspect each and every property.

    Turns out, someXmlNode.attributes.href is different than someXmlNode.attributes.HREF. You may go, “No sh… thanks for wasting 3 paragraphs of my life Jester.” If your still here, you r0x0r. Ah… but is href a variable or a string? Attributes in XML have the neat distinction of being neatly placed on a vanilla object called “attributes”, so you can access them like you would any other plain object, such as a data provider item (item.label). Because they are vanilla, though, you typically don’t have classes defined that represent them. For instance, EventDispatcher, when it does a dispatchEvent, throws out an object. You’ve seen the familiar syntax:

    dispatchEvent({type: “event”, target: this});

    It’s just “known” that you make at the very least a type attribute, and usually a target. The “known” attitude is what led us from Flash MX to Flash MX 2004. No more mispellings of variables, objects… we now have real-world syntax checking!

    But again, you can’t for vanilla, one time use objects like EventDispatcher and the XML Object’s attribute construct do. Therefore, one must be extremely careful. For the knowns, like label and data, or for events like type and target, your fine because everyone and their mom knows you type it in lowercase.

    However, for some events, they aren’t. For instance, all UIComponents get “focusIn” and “focusOut” events. See the capitalized In and Out? Tricky, tricky…

    XML is even worse. The second you utilize an attribute, you’ve immediately hardcoded your code. Now, as a seasoned Flash developer, I’m cool with that. XML parsing is my daily bread, and it’s just known that you quickly navigate your document to get the data in. Some people think that using recursion is more encapsulated, but that is dangerous as hell in Flash, can be slow for large objects, and if your in your Model class, who gives a flying flizz-narg?

    So, just some advice. When parsing XML attributes, make sure your capitalization in your XML node’s attributes (or internal structure) is the same as what your using in your code.

  • Scout Walker (AT-ST) Kama Sutra

    Via Johnny Bag o’ Doughnuts.

    It’s not Friday, but I’m off tomorrow, so…

    This is an online version of the book Kama Sutra, but for AT-ST’s (the 2 legged Imperial walkers in Star Wars). Some interesting pictures, reminiscent of Kermit the Frog and that bear whose various scenes of copulation, captured in SWF’s, were floating around the internet a couple of years ago. Anyway, the prose is off the wall, but the pictures are where the immediate comedy is.

    *** Not Work Safe ***

    Scout Walker Kama Sutra

  • asdf hyperlink in Flash goes to Microsoft Support Docs

    I can’t even think of a correct title. If you have a Flash hyperlink in an input text field that displays html with an href of “asdf” and a target of “”, and Firefox Preview Release 1.0 is your default browser, and you click the link, it’ll open the browser. The first tab will be blank. The second will go to a Microsoft Support Link, but it has a local path to your current working directory in the url field + “asdf” at the end.

  • Super Size Me

    Saw the documentary “Super Size Me” last night. It’s about this guy who eats McDonalds food, the entire menu, 3 meals a day which he has to finish, and has to get a super size if they ask, for 30 days straight. Effectively, living off of McDonalds, and only McDonalds, for a month with his vegan girlfriend stressing about it.

    The guy gained a considerable amount of weight in just 30 days, almost half the last week. It took him 14 total months to lose the weight he gained. God knows how bad his liver and kidneys were damaged through the whole process. He even suffered mild impotence because of restricted bloodflow. Aside from a myriad of other negative things, at parts it was just painful to watch, ecspecially when his new health problems became real and life threatening.

    My initial reaction was to never eat fast food again, at least McDonalds, but I was even having second thoughts about my bi-weekly Chik Fila excursions. The guys sources, in movie, are only half there, and he throws around mad statistics, but I have yet to hear a challenge to his claims, therefore, I’m taking it as sound info with questionable accountability for now.

    I really liked it and was really woken up to the nutrition problem this country faces in the form of obesity.

    All I have to say to non-US residents is see this movie, and keep our food franchises the f$)%* out of your country!

    Now, granted, to me Subway is a good one and is ok with moderation and responsible choosing of their menu. I, however, work out as a crutch for nutritional freedom, and even that is a stretch. I assume since I do strength training and cardio 3 days (sometimes 2) a week, that I can eat pretty much whatever I want. As I got more in tune with my body, I realized what made me feel bad, and what didn’t, so it got easier to tone down the blatantly horrible parts of my diet, mainly sodas. I merely switched to sugary, processed lemonaide though (not the Aussie kind, the Aussie-Pakistani kind), which has the same amount of sugar, or more, than sodas such as a Coke.

    Anyway, pretty crazy stuff in the flic. Real sobering, and another wonderful challenge I can’t wait (no really) to have when attempting to raise kids in the future with good habits. Parents have their work cut out for them. Heck, I still haven’t quit coffee, although, I’ve switched to tea midday so I’m making better progress than my cold turkey approach with ciggarettes. I don’t need ciggarettes, but I do need coffee.