Blog

  • AS3 and Flash Document Class

    October 31, 2012

    I’ve been thinking about porting some old ActionScript 2 code to ActionScript 3 and building an AIR app. The big advantage of ActionScript 3 is that it’s faster AND has a new package hierarchy that makes way more sense than the old one. For example, you can now instantiate a MovieClip or TextField with var mc:MovieClip = new MovieClip(), which looks totally normal. In ActionScript 2, you’d actually have to call DuplicateMovieClip() on an existing MovieClip instance.

    Anyway, there’s always a little bit of magic involved in setting up a new “Hello World” style program. As is the norm, the official “Getting Started” material that I could find is simplistic to the point of uselessness…who writes these things? I don’t want to print “hello world”; I want to set up the basis of a rich flourishing application. Here’s the basic steps I followed with Flash Professional CS 5.5.

    1. Create a New Project

    Switched to the “Developer” Workspace Layout, which exposes the Project Panel. Created a new project, which creates a Flash .FLA stub file. We’ll be setting properties here later.

    On a side note, the Project Manager is as terrible as I remember it from 2007, but at least it is just a mirror of an underlying directory structure. Nothing fancy here!

    2. Create the Startup Class

    The Flash file will end up holding any static library assets I create such as animations and graphics, but I will be using code attached to instances I create dynamically with my own scripting. Rather than stuff this all in Frame 1 of the timeline, there’s a way of binding a particular class to the Flash file. This is a class that is instantiated on startup. It’s known officially as the document class, and you set it under Properties for the .FLA file.

    Class files in Actionscript 3 have the .as extension, and the filename must match the class name. There is also the notion of packages. I created a package path of dseah, which is implemented as a folder relative to the .FLA file.

    project_folder/
        dseah/
            MainClass.as
        DaveTest01.fla
        DaveTest01.swf
    

    My DaveTest01.fla file is at the same level as the dseah folder. Inside this folder I created MainClass.as, which is declared as follows:

    package dseah { 
        
        import flash.display.MovieClip; 
    
        public class MainClass extends MovieClip { 
            public function MainClass() { 
                trace ('Hello World'); 
            }
        } 
    }
    

    Two Important Notes:

    • See how MainClass extends MovieClip? That’s because the class we’re setting as the document class is a representation of the .FLA file, which is a MovieClip.
    • When we go to properties to set the document class, we also have to use the entire package path, which here is dseah.MainClass.

    3.0 Compile and Test!

    I clicked the “Test Project” button and did see that the trace worked, outputing “Hello World” to the console. Whee! So that’s it. Took me 90 minutes to dig up these basic setup facts while I was at Starbucks. I suppose that if I’d had a copy of Colin Moock’s Actionscript 3: The Complete Reference I would have saved myself some time. Grumble grumble.

    Read more
    DSri Seah
  • NaNoWriMo 2012 Word Count Tracking Calendar

    October 28, 2012

    NaNoWriMo Tracking Word Count Calendar
    NOTE: There is an updated calendar for 2013

    National Novel Writing Month AKA NaNoWriMo is about to start this November 1st; the goal is to bang out 50,000 words of a rough draft novel in 30 days. I declared that I would do it this year, having been inspired by several friends who have done it in the past. This is my first year, and I’m not sure exactly how it’s going to go, so I just made a tracking calendar to help me visualize just how many words I need to write every day.

    NaNoWriMo Calendar It’s a full-sized piece of paper (US Letter 8.5 x 11 inches) that has some instructions at the bottom. The basic idea is to fill-in boxes that represent 250 words of writing. The boxes are shaped like a pyramid; you fill in at least 7 of them to get to the first plateau of 1750 words, which is enough to comfortably finish in 30 days if you are writing every day. There are a couple higher boost levels: 2250 for writing just on Monday-Friday, and 2500 for people who want to fill-in that last block. Every week, there’s a review worksheet that helps me assess the week, which allows me to compute a new minimum word count. For example, if I somehow wrote 25,000 words in the four days, this would lower my minimum word count from 1667 to 960 words per day. Not that this is likely to happen, but the review will be a good way of keeping tabs on my progress.

    Since this is the first year I’m doing NaNoWriMo, I’m not sure how useful this form will be. But it certainly was fun making it :)

    Download NaNoWriMo Tracking Calendar

    NaNoWriMo Tracking CalendarDownload NaNoWrimo Calendar PDF (Portrait, US Letter)

    The calendar covers half the sheet, with instructions


    NaNoWriMo Tracking CalendarDownload NaNoWrimo Calendar PDF (Landscape, US Letter)
    Download NaNoWrimo Calendar PDF (Landscape/Binder, US Letter)

    The calendar takes up the full sheet, with no instructions


    Having trouble saving? Right-click or option-click and choose “save link as” if you are having trouble saving the file.

    This is free to use for non-commercial purposes. Enjoy!


    Read more
    DSri Seah
  • iPad Mini Wireframe Template Update

    October 23, 2012

    iPad Mini Design Template After seeing the announcement of the new iPad Mini, I wanted to get a sense of how much information I could pack on a smaller screen. It’s about 80% of the size of a full-sized iPad, but the minimum physical size of a hit target (around 44 points according to Apple’s Guidelines) is the same. That has ramifications for UI design.

    To visualize this, I just made an update to my iPad Wireframe Template PDF to include the new Mini dimensions. Download the PDF then print it out at 1:1 scale on your printer by turning-off “scale to fit”, and you can get a sense of how big things on the iPad Mini screen will be.

    Read more
    DSri Seah
  • Outlining Books Faster, Revisited

    October 17, 2012

    "The Fast Book Outliner V3" A year ago I wanted a better way to outline books for review purposes, and wrote about The Fast Book Outliner (FBO). I used it on a few book outlining projects, and while it was an improvement I still found that it still felt physically awkward to use. If I’m reading a book, the note-taking action has to be efficiently done with one hand, and I found that writing toward the bottom of the page was difficult. Also, although a single sheet of FBO could handle up to 100 pages, that meant I still needed multiple pages to cover a good-sized book.

    Fast-forward to today: I’ve been re-reading Stephen Pressfield’s The War of Art, and have been in the mood to outline its lessons. It occurred to me that I could adapt the principles from The Compact Calendar to book outlining, which has resulted in version 3 of the FBO.

    (more…)

    Read more
    DSri Seah
  • Improved Productivity Tools Page

    October 15, 2012

    New Productivity Tools Page One of this month’s goals has been to redesign the Productivity Tools page so it was easier to display both free downloads and items for sale. I’ve been slowly plugging away at it to make the October 15 deadline that I agreed on with my cousin Ben; if there’s an increase in sales, I’m planning on putting 50% of any additional profits into a shared “Expensive Scotch and Cigar Fund”. It’s just a fun way of putting a little extra accountability on myself. I also happened to find Shawn Blanc & Ben Brooks’ B&B Podcast Episode #80, which mentioned the Emergent Task Planner at around +12:45; I listened in horror as the hosts attempted to find the form while “on the air”, only to get stuck. This was quite a kick in the pants, so I was extra-motivated to fix the problems this weekend.

    The changes are live now, with plenty of new custom WordPress coding and CSS to make the new layout possible. I now have to revamp the actual content on each page by adding slideshows and (maybe) better custom headers for each page that shows the tool in use. I’ll be switching into Photographer mode next to take a heap o’ pictures.

    I think this is a significant improvement. Let me know what you think!

    Read more
    DSri Seah