Keynote Remote Straight to Computer

After purchasing Keynote Remote from the iTunes store a couple of months back I was disappointed that it only worked over WIFI (why do we have bluetooth in the iPhone again?). Most conferences have spotty WIFI at best.

I had an idea today though about using my computer’s built-in network creating ability. I set up a network from my laptop, connected to it from my iPhone, and had the Keynote Remote working in no time. No WIFI network. Yay! After I had figured it out I looked up on google to see if anyone else had done it and found they had. There’s a tutorial with screenshots here: http://www.italkmagazine.com/using-apple-keynote-remote-without-wifi/. I should have googled it earlier. :)

ActionScript 3 Wildcard Setters

All credit goes to Tyler for this trick, but I’m sure I would have thought of it too. :)

Tyler has been working on an XML specification, what he things Adobe should have done in place of FXG which is a standard that was built around implementation with Flex. During this process he has also done tests from time to time to see how it might actually pan out using Flex builder, and we’re pretty confident it could all be done there. One of the issues is this new standard should support shortcuts. An example in the XML is:

<group>
    <layout padding="10px 10px 10px 50%"/>
</group>
<group transform="rotate(30)"></group>

(note: this xml is not necessarily from the actual specification)

This is impossible with current Flex implementations if you want your properties typed to their type. For example, the padding property may be an Bounds object with top, left, right, and bottom properties of type Length which could be a hard value or a percent.

What he found though was that you can have wildcard setters with your strictly typed getters. This allows you to set anything to the property, but when you get it you expect the proper type (and get compile-time errors, autocomplete, etc.). This allows us to take a string of “10px 10px 10px 50%” or “rotate(30)” and parse it into the proper type.

public function get padding():Bounds
{
    return _padding;
}
public function set padding(value:*):void
{
    if ( !(value is Bounds) ) {
        // convert it to a Bounds object
        value = ValueUtils.parseBounds(value);
    }

    if (value.equals(_padding)) {
        return;
    }

    _padding = value;
    dispatchEvent(new Event("paddingChanged"));
}

This will allow the XML specification to continue being defined without regards to the Flex compiler and we can also feel confident that it will still work with Flex. Now we can have our cake and eat it too!

This may also be a cool trick in other scenarios than just MXML. But think of all the shortcuts you wished you could do and how this makes it possible while still keeping good standards and typing your variables.