Showing posts with label Exopolis. Show all posts
Showing posts with label Exopolis. Show all posts

30 May 2008

Exopolis Online Ads

Just launched a new Flex minisite: Exopolis Online Ads.

(If you poke around long enough you might find a few little bugs, but it's mostly done.)

This is (obviously) a promotional piece for our banner ad capabilities. Doing the project in Flex made a lot of things easier: transitions, placement, deep-linking, back/forward button capabilities.

It's a bit risky loading banners directly into Flash, but fortunately Flex's AVM1Movie component largely keeps the banner functionality in its own "sandbox" (with a few exceptions that need tending to). Flash banner ads have some of the hackiest programming you'll ever care to see, but fortunately AVM1Movie prevents 99% of it from affecting the rest of the site.

I did get one nice, reuseable thing out of it, too: the MouseScrollCanvas component that controls those scrolling lists of links.

Which reminds me ... I really have to consolidate all the reuseable code I've written someday and release it....

15 February 2008

Happy Belated Valentine's Day!

We at Exopolis launched a "reboot" of our charming, wacky, retro Valentine's Day Mix Tape yesterday:

XOXO, Exo.


It features 26 songs selected by 26 of us. For my song, click here.


I did not actually have a hand in developing this thing, but I did have some "fun" reviving it. The original project was done two years ago by people who are no longer here, and the source files seem to have vanished. I had to decompile the SWF using Sothink SWF Decompiler. It did a pretty good job overall, but there were a couple of bugs that took me hours to track down.

First of all, functions seem to always be formatted this way:
function myFunction(arg1, arg2) {
// function body
}
...rather than this way:
myFunction = function(arg1, arg2) {
// function body
}
Now, normally that doesn't make a difference, and the former version is indeed preferable. But that changes if the declaration is actually supposed to be used to set a class field. A class field like, oh, say onEnterFrame. In that case, the former syntax simply declares a function and then does nothing with it, instead of actually setting the class's native handler. Fun.

Second of all (and this is not the decompiler's fault), Windows font names and Macintosh font names often differ. I spent hours trying to figure out why the "Send to a Friend" form wasn't working until I finally figured out that the dynamically-created text fields were referencing a font called "GFYKersti". In Windows, the exact same font's name is "GFY Kersti". Don'cha just love errors that boil down to a single character difference?

Anyway, now it works and we have the source properly archived in CVSDude. Back to developing new stuff in AS3 rather than trying to revive old stuff in AS2....

04 January 2008

Resolutions for 2008

I'm not going to bother you with personal resolutions (lose weight, save money, blah blah blah), but rather creative resolutions.

2007 was kind of a watershed year for me in many ways.
My girlfriend, Susan, also had a very productive year, since she started USC film school a year ago.

Of course, it wasn't entirely positive. I dropped the ball on Parry & Carney, and the Dinosauricon continues to languish. (Some day I plan to re-use code from March of Man and Names on NEXUS for a new version, but that day is still far off.)

Well, with 2007 in mind, here's what I'd like to get done in 2008:
  • Launch Names on NEXUS and give a talk on it at this year's ISPN meeting in Halifax, Nova Scotia (and also try for an SVP talk or poster). Perhaps start working on a related paper, if applicable.
  • Continue developing March of Man and add several dozen images to it. Continue promoting it and get at least another dozen artists to contribute. Perhaps do a poster or something at SVP.
  • Fix a few remaining issues with the PhyloCode website.
  • Help Susan on her filmic endeavors, and continue to develop a sci-fi concept we started.
  • Continue translating Genesis.
  • Release some ActionScript 3.0 source code into the public domain.

12 December 2007

Exobotics!

We at Exopolis just launched this today:



This is a hybrid Flash/Flex app that allows you to select robot parts (including a heart, which represents a musical track) and assemble them into a dancing robot which you control with the mouse and keystrokes. I have to say—I spent hours making this and it's still fun to me.

I'd actually started something similar back in Flash 4, if you can believe that. Yes, before true ActionScript. I had to manually create a sine lookup table. It was fun.

After a couple of false starts in intervening versions of Flash, I finally had my greatest success with a Flex version. Dynamic binding makes this sort of thing so much easier.

Basically, the way the robots work is that each joint is associated with a type of object called a Locator. Minimally, a Locator stores a point, dispatches updates whenever that point moves, and allows that point to be constrained. A Locator can be created as simply as:

<Locator id="myLocator" x="100" y="100"/>

Of course, that's not a very interesting Locator, since it doesn't move. Moving a Locator can be done in one of two ways. One way is to extend the basic Locator class, creating a specialized type of Locator. As an example, one of these is StageMouseLocator:

<StageMouseLocator id="mouseLocator"/>

The x and y properties of this Locator always correspond to the position of the mouse. If I wanted to bind another Locator to this, I could do it like so:

<StageMouseLocator id="mouseLocator"/>
<Locator id="myLocator" x="{mouseLocator.x}" y="{mouseLocator.y}"/>

Voila, now myLocator follows the mouse. Why would I want to do this when mouseLocator already does that? Good question. I wouldn't. But now I can do stuff like this:

<StageMouseLocator id="mouseLocator"/>
<Locator id="myLocator" x="{mouseLocator.x + 100}" y="{mouseLocator.y}">
    <constraint>
        <constrain:VerticalConstraint minY="100" maxY="500"/>
    </constraint>
</Locator>

Now it will always be 100 pixels to the right of the mouse, but it will constrain the vertical position to between 100 and 500 pixels in the display's coordinate system. You can see how this sort of binding with modification can lead to more complex behavior.

Another way to control a Locator object is by using an (aptly-named) Controller object. One such object is a SineController object:

<control:SineController id="beatController" speed="0.25" context="{this}"/>

This keeps an angle value, updates it on every frame (incrementing by 0.25 radians) and makes the sine value available through a property called sine. So if I wanted a controller that followed the mouse but oscillated up and down, I could do this:

<StageMouseLocator id="mouseLocator"/>
<control:SineController id="beatController" speed="0.25" context="{this}"/>
<Locator id="myLocator" x="{mouseLocator.x}" y="{mouseLocator.y + beatController.sine * 50}"/>

Of course, I have other types of Controller (StepController, which extends SineController; RandomController; ClickController; etc.), other types of Locator (JumpLocator, JointLocator, InterpolatedLocator, ModeLocator, etc.), and other types of constraints (DistanceContraint, RectangularConstraint, etc.). All of these I blend to create a basic skeleton of points.

Once I have the skeleton, I can attach various visible objects call Connector objects, each of which connect to a number of points and have rules for "squash & stretch". The robots all use MovieClipConnector objects, which each link a Flash movie clip to one or two connectors. I also have DrawnConnector, ImageConnector, etc., and hopefully I can use those on future projects.

I had actually started to make this as an application where you would sketch your own character and it would animate according to a skeleton, but this turned out to be much too processor-intensive, at least for now. Fortunately, one of our senior designers, Chuck Chugumlung, had this idea for a dancing robot factory and he and some other designers (Dan Duran, Jancy Liu), went to town.

Anyway, enough geekery. Go make some robots dance!