Blog

  • Class Deserialization: OpenAMF & Flashcom

    Had a hell of a time debugging some OpenAMF calls yesterday. Turns out, when Flash deserializes your class, it basically takes a vanilla object, puts properties on it and assigns their values, and then points that instance’s __proto__ property to the prototype of the class you registered via Object.registerClass. The downside to this is it doesn’t run your setter functions on any getter/setters you have set on the class. Naturally, your getters fail immediately because they look to a private equivalent variable which is different, and when you call the setter… it’s really a function.

    How Flash manages to keep “firstName” the public property and “firstName” the public getter function in the same namespace is beyond me, but regardless, I’ve tested in Flashcom last night, and the same thing happens there, too, so it appears to be how Flash deserializes your class.

    The way we, “solved it” as my manager says, or “worked around it” as I claim, is emulating, EXACTLY the Java class equivalents. So, you have private properties in the Java model class, like:

    private String firstName;

    And same on the Flash side:

    private var firstName:String;

    And instead of getter/setter functions in Flash, you just use the get/set function methology:

    public function getFirstName():String
    {
    return firstName;
    }

    public function setFirstName(val:String):Void
    {
    firstName = val;
    }

    I really don’t like this at all, and personally feel that there should either be an event letting you know when the class is deserialized (Flashcom does this for server-side ActionScript classes via the onInitialize event) so you can then run the getter/setters yourself, OR Flash should just intrinsically know there are getter/setters in place, and set the private variables accordingly. This gets sticky though because you’re now having the Flash Player run code on your classes. Thus, I vote for the first.

  • Adobe Acquires Macromedia

    Adobe Systems Incorporated (Nasdaq:ADBE) today announced a definitive agreement to acquire Macromedia (Nasdaq:MACR) in an all-stock transaction valued at approximately $3.4 billion.

    Curious; regarding the Yahoo deal where Macromedia partnered with Yahoo, does Yahoo want to purchase Adobe, or does Adobe want to purchase Yahoo? Adobe already does the Yahoo Toolbar installer bundling with their Acrobat Reader, the PDF viewer.

    Adobe helped spawn the print revolution, and did the same for video; empowering the masses to create great content. This teaming up with Flashcom & Flash Video in general seems promising.

  • Flash Panel: ViewMaker

    For those projects where you’re creating a plethora of Flash forms because you’re not using Flex, don’t use authortime layout, and are sick of writing the same types of code 14+ times in a row, hopefully this panel will make it go easier.

    Typically, when you’re creating the View portion of your app, you can look at a comp, and go “That section has a Label component, a Button it uses twice, and a TextInput it uses about 6 times”. You then proceed to import those 3 classes, define their variable names, and code their creation and initialization variables in a createChildren function.

    …you then repeat the process ump-teen times.

    This panel provides a GUI to quickly add the controls, type their names, choose their type (all Flash MX 2004 control components are in there), add any other private/public/getter setter variables if you want, and then click “Generate Code”. It gives you some base level ActionScript 2.0 code with which you can copy into any class that extends mx.core.View. If you’re just extending UIComponent, you can do a find and replace for createChild to createClassObject, and add getNextHighestDepth() as the 3rd parameter.

    There is a quick help tutorial included to show you how it works.

    ViewMaker Flash Panel (Window SWF) – MXP | ZIP

    Currently, there is a bug where if you manually select the control type via the ComboBox, it doesn’t show 1 of the form labels properly.. and if you select it by typing the first letter of the component name (when the ComboBox is highlighted and you type “b” for example), it doesn’t show up at all…. It’s a Flex thing, so trying to figure it out.

  • JSFL: Create Flash Project File Extension

    Originally created by a chick in Hungary (per Jim), then updated by Jim Kremens to ignore CVS files, and then updated by me to ignore .svn directories from Tortoise SVN, I re-packaged this extension.

    It creates a Flash Project file (FLP) based off of the current working directory you choose (where a blank project file sits). It’s really helpful since Flash’s Project Panel isn’t a real file explorer. Instead you have to create and add files & folders manually… which can lead to errors, and makes it tough to change. This extension changes that process to 4 clicks!

    Only works with Flash MX 2004 7.2 (Ellipsis) since that version of the IDE implemented the File API for Flash’ JavaScript API.

    Create Flash Project File – MXP | ZIP