Archive for June, 2008

Scaling a DisplayObject to fit to a container’s dimensions

Monday, June 30th, 2008

I’ve often run into the problem of proportionally scaling an image (or other DisplayObject) to the dimensions of its parent container. I always end up having to scavenge around in my code bank for the line of code to do this—which really is a simple bit of code—but I prefer to copy-and-paste it than rewrite it. SO I am posting it here so I never have to search for it again:

var scale:Number = ((container.height/container.width) > (image.height/image.width)) ? (container.width/image.width) : (container.height/image.height);
image.scaleX = scale;
image.scaleY = scale;

Download an example here

Busy times

Saturday, June 28th, 2008

In between working full-time at the Voinovich School of Leadership and Public Affairs, digitizing 22 hours of video footage from the Spring <br /> Conference 2008 and providing a technical review of chapters in the upcoming O’Reilly Media, Inc. title ActionScript 3.0: The Quick Answer Guide for Flash Professionals I have not been able to get a post up here recently… but I hope to change that soon.

Spring <br /> 2008 Presentation

Wednesday, June 4th, 2008

Speaker - Spring Break 2008 ConferenceThis past Tuesday I spoke about Data Structures at the 2008 Spring <br /> Conference in Baker Center, at Ohio University in Athens, Ohio. Since I was involved in organizing the conference this year, it was a pleasure to have the big day finally arrive. I enjoyed some technical wizardry by Samuel Agesilas Pastel, a dreamy walk down the Internet’s memory lane in Eric Meyer’s lunchtime presentation, open source wonders in Orson Bradford’s (yes we’re related) Introduction to Drupal and Eric Kramer’s Using the Firebug & WebDeveloper Extensions in Firefox.

The slides from my presentation, Data Structures in AS3, are available online.