Lemieux Design

Flash | Interactive | Web | Graphics | Brand | Video

Archive for the ‘Uncategorized’ Category

My Blog has moved home

Posted on: March 17th, 2011 by alemieux

Installing a wordpress blog on your local domain may be easier than you think. My site is hosted with MediaTemple.net and they have some 1-click applications that make it easy to do just such a thing. In a few minutes, I was able to install my wordpress blog on my own domain. I was able to import my blogs posts from Blogger and it was really easy.

GoDaddy has a similar way of transferring a WordPress blog to your own domain. Now I need to get some juicy content up here.

Stay tuned.

ActionScript Editing in Flash Builder 4

Posted on: March 7th, 2011 by alemieux

I’ve been developing ActionScript for a long time now and have done most of my editing inside the Flash IDE. I’ve tried other ActionScript editors such as SEPY, but was never satisfied with anything else. Surely, the code hinting, code completion, and overall performance of the ActionScript editor in Flash CS5 is much better than any other version. When writing code that would require a class file, the Flash ActionScript panel now imports the appropriate classes, which is nice.

Recently however, I’ve been playing around with Flash Builder’s ActionScript editor, and I have to say, it’s pretty amazing. Not only is there code hinting, but it’s almost like coding with the ActionScript library in your hands. Available assets and their definitions appear side-by-side in an expandable view. Classes get imported when needed here too. When you start developing an ActionScript class in Flash, you have the option of developing it in the Flash IDE or in Flash Builder. I’m pretty sure I’ll be building them in Flash Builder from now on.

The code coloring in both apps (you think they would be) are not the same though, so for an average Flash user, it takes a while to get used to the code coloring in Flash Builder. Another thing that’s a little aggravating about Flash Builder is the way it manages class structure and packaging. I’m sure in time, I’ll get used to it.

So out of curiosity, what editor do you use? Can you recommend anything else?

Function with Return values

Posted on: March 5th, 2011 by alemieux

One of the questions I get most often from students about functions is “What is the :void for?” Indeed, most functions, especialy functions that are derivative of an event listener will have this form:

function someThing(e:MouseEvent):void { }

This is only when a function is not returning a value. Yes, functions can return values and if you think about it, it’s kind of a cool way to use functions. We can return numeric or string data from a function. In this quick example, we’ll use a function to assemble an address and then trace it out:

function address():String {
var street:String = "156 Primrose Hill Rd";
var cityState:String = "Dracut, MA";
var zip:String = "01826";

var fullAddress:String = street + cityState + zip;
return fullAddress;

Notice here that we use :String instead of :void. This indicates to the compiler what type of data is going to be returned by the function.

Next, we set up a few variables to hold the information for street, city, and zip. We use another variable to pull all of that info together. Then w use the return statement to return the fullAddress variable.

In our trace statement, we actually call on the function to return the value we want. We could also set up the function to return numeric data by datatyping the function to :Number or :int or :uint for that matter.

24 hour – 12 hour conversion in AS3

Posted on: September 23rd, 2010 by alemieux 3 Comments

Getting the current time is easy in AS3 with the Date() class, however the default clock is the 24 hour (military) clock.

Start by creating a new Date object:

var myDate:Date = new Date();

The Date class allows you to get to the month, day, hours, minutes, seconds and other Date-based information. If we try to trace out the time like this:

trace(myDate.hours + “:” + myDate.minutes + “:” + myDate.seconds);

We’ll get 16 for the hours at 4 pm. The solution is really simple. Just subtract 12 from the hours to get the 12 hour hour.

trace(myDate.hours – 12 + “:” + myDate.minutes + “:” + myDate.seconds);


Time Machine to the Rescue

Posted on: July 30th, 2010 by alemieux

So there’s a lot of negative talk out there about Time Machine and yes, I can agree to most of it. Time Machine, OS X’s built-in backup program, is a little slim on the configuration options and fills up a hard drive pretty quickly with backups. There doesn’t seem to be a lot of flexibility with the program. (If you know of other Mac-based backup solutions, please list them here.)

In the past few weeks however, Time Machine has actually saved me some trouble. A file that I was working with became corrupted or unusable. Then I remembered Time Machine and went into it. Every time I do, my kids’ jaws drop as the desktop changes and the spaceship like interface takes over. I went back in history, grabbed an older version of the file and restored it to the desktop. I was then able to open the file and modify it. Of course, I had lost some development time, but being able to resurrect a file like that is really priceless.

So as much as there is negative talk out there, Time Machine really proved useful for me.

Building a Flash Class

Posted on: April 22nd, 2010 by alemieux

Making the transition from procedural (inline) ActionScript to Class-based scripting has been – admittedly – pretty challenging for me. Understanding what’s public and what’s private, how to structure your code, what are the necessary imports, getting class paths right, there’s just so much to think about that normally, with procedural scripting, you don’t have to.

For example, importing classes is a complete nightmare of a task. What I discovered of late is that anything that is in the flash class library (ex. flash.display.MovieClip) is already available to you in the Flash IDE. Anything in the fl library (ex. fl.transitions.Tween) isn’t, so those need to be imported. Flash CS4 doesn’t automatically add the class import statements, but I hear that Flash Builder does and maybe CS5 will.

With procedural scripting, the objects that you are talking to; movie clips, buttons, textfields, are all there on the timeline, so there’s no mystery going into it. Everything is right there. Most classes, as perfectly as they are built, will require additional code in the FLA anyway.

I know about all of the benefits of class-based programming and it must be great to build modular code that is reusable – especially when you are working on a team – but I’m a one man show here.

So, I ventured to try to create a simple example of a class file to illustrate how to program and test it.

Begin by starting a new ActionScript file in Flash. Save it as NameCaller.as. When you’re building a class, the name of the class is the same name as the name of the file. We’ll start by writing out a typical class package:

package {
public class NameCaller extends MovieClip {
public function NameCaller() {


Save the file.
Start a new Flash ActionScript 3.0 file and also save it as NameCaller.fla. be sure to save it in the same location as the NameCaller.as class file. In the Properties panel, you’ll see a Class field. This is the document class. Enter NameCaller and hit enter. You shouldn’t see any warnings or errors when you do this. If you do, then you may have not saved the files in the same place.

In the Flash file, add a dynamic textfield to the stage and give it an instance name of output. Save the file and return to the NameCaller.as class file.

This really basic example will simply concatenate two variables with a sentence and display it in the dynamic textfield.

Since the class extends the MovieClip class, we’ll have to import that class. At the top of your script, after the package declaration, add the following:

import flash.display.MovieClip;

How do you know when you need to import something? Well, if you see compiler errors that complain about it, then you’ll have to add them.

Next, we’ll define our variables. In the class definition, add the following:

public var fname:String;
public var expletive:String;

Variables and functions can either be private or public. This has to do with security and access rights. Since these variables are public, we can use them outside of the class, such as in our fla file.

Every class has methods (functions) in it, but there’s one method that is required, which has the same name as the class. Add the following to the NameCaller function:

init(fname, expletive);

We’re going to define the init function now. I’ve seen this in common practice – that the main function isn’t doing much other than calling on another function.

Now, we can define the init function:

public function init(fname:String, expletive:String) {
output.text = fname + " is a complete " + expletive;

We’ve given this function two parameters: fname and expletive. By doing this, we can set those parameters when we call on this function later in the fla file. The dynamic textfield will receive the full message.

Be sure to save the class file and then go to the Fla file. In the Actions panel, add the following:

init("Joe Biden", "Asshole");

We don’t have to import the class because it’s a document class. Here, we didn’t use a class path and save the file in an obscure location, as in the following example:


We just saved the class file in the same location as the fla. If we were building a complete application that required multiple classes, then we would need to explore that more, but this is just a simple example.

When you test your Fla file, you should see the concatenated statement in the dynamic textfield.

Homework: Try adding input text fields that would allow users to enter in a name and expletive. Try adding a Combo box component that allows users to pick an expletive.

Here’s all of the code for the class:

package {
import flash.display.MovieClip;

public class NameCaller extends MovieClip {

public var fname:String;
public var expletive:String;

public function NameCaller() {
init(fname, expletive);
public function init(fname:String, expletive:String) {
output.text = fname + " is a complete " + expletive;