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.

Layered Content kick-off

Today we had our first Layered Content meeting. We used Adobe Connect but had a lot of troubles with the audio. So it wasn’t recorded and we won’t be using that again. Not for awhile. I went over some of the generals of Layered Content. It’s a content management system for websites, it will use AIR and PHP/MySQL, it will have online/offline modes, it won’t have complex template markup but use a descriptor file and ids/classes as the entry points for content, and other general coolness. We talked about the major pieces needing to be done, roles to be filled, and goals of the project. Below are the slides I used. We didn’t actually make any decisions, as per the project. I will continue work on the client and we will have another meeting (maybe IRC this time) in a few weeks. Until then I’ll see you on the Google Group.

Better-than-Flex Binding

Tyler has ‘officially’ released his weak-reference databinding. It is smaller and faster than Flex’s but can be used in Flex and even has an MXML tag to create a bind. Check it out: http://www.xtyler.com/code/177.

Update: I’ve refactored it and unit-tested it, fixing several bugs. The new version can be found on github.

Flight Framework Highlights

The Flight Framework is basically a collection of great utilities and independent tidbits that are organized to help us build our application. So I thought I’d make a call out to all the great standalone features in Flight, tell what they are, and leave it to another day to go more in depth on them.

  1. Fix for abstract classes
    The tiny static classes in the flight.error package allow you to ensure an abstract class is not instantiated and that abstract methods are overriden.
  2. Registry
    A global registry to store objects or data that anything in an application can have access too.
  3. Reflection
    The “Type” class handles all your reflection needs, including caching the expensive describeType calls and helping pull out needed metadata.
  4. Nice base for models
    The ValueObject class is a lazy IEventDispatcher that implements an equals() and clone() method which will work with all subclasses.
  5. ValueObjectEditor
    This nifty utility lets you “edit” a ValueObject and then either commit the changes or revert them. Great for dialogs that let ValueObjects be changed but can then either Cancel or Ok the change.
  6. AS3 ArrayContainer
    When working in an AS3 project, it would be nice to know when an array is changed, but Flex’s ArrayCollection brings in half the framework when referenced. This little guy is the little brother AS3 has been wishing for.
  7. Services
    Some common services (RPC services, e.g. remoting, HTTP, etc.) that can be used in Flex or AS3. Much smaller than Flex’s built in services.
  8. Configuration
    Config lets you define your application configurations in the app, an XML file, SharedObjects, and even the URL. Not only that, you can have multiple sources with some overriding others, and it is all accessible to your classes through a global config property. Super neat!
  9. Undo framework
    With CommandHistory and all the command interfaces available, you can build undo-redo into your application without using any of the rest of Flight. Way, way awesome.
  10. Weak-referenced binding
    Using the Bind class you can create faster, smaller, and weak-referenced binds. With two-way deep binds and being able to use in AS3-only projects without importing half the Flex framework, this is my favorite nugget.

None of the above pieces references any of the others. They can all be used independently in your own frameworks or applications. That’s my favorite part about Flight, is I can use it 100% if I want to, but if I can’t that doesn’t mean I have to give up my favorite features. I could use any/all of the above with any other framework, AS3 only, or Flex.

Undo/Redo for all your TextFields

I made the TextField undo component. Add this component to any Flash or Flex application and all your text components will have undo and redo. This has been open sourced and is on http://code.google.com/p/undo-textfields/.

Instead of making different Flex and Flash components to use in place of the available components, I made one that adds undo to existing text components. It should work in Flash and in Flex, though I just have a Flex example to show you today. You can see that it can be container specific, though you would probably just put it on the root of your application or the stage. Type in the text components in the top panel. Then do the same in the bottom. You should be able to press Ctrl+Z and Ctrl+Y (or Ctrl+Shift+Z) to undo and redo. If you’re on a Mac just substitute Ctrl with Cmd. I’ve only tested it in Safari and Firefox on a Mac. I hope the key command work on other machines without issue. But I also added a couple of menu items to the right-click context menu. Give it a whirl below, view the source, and see how easy it is to add text undo and redo to all your existing applications without any refactoring.

Update: The keyboard shortcuts don’t work in the ActiveX version of Flash (Internet Explorer on Windows).

Let me know if the key-shortcuts don’t work on your system. Maybe phase 2 can be some javascript magic to capture those better.

« Previous Page — Next Page »