this is portable

A little bit of SxSW Inspiration (and I wasn’t even there)

I wasn’t at SXSW this year, and neither was Ben. But a little project of ours, ThemeSong, was mentioned at Kathy Sierra’s Making Breakthroughs Happens Session. I thought that was pretty cool.

Honestly, the only reason it came into being beyond our office was that there was a PittMFUG meeting coming up and it seemed like a cool thing to show at a meeting. We’re both amazed at how much attention it’s getting on twitter.

I read about roomware server one night and brought it up to Ben at work the next morning. I came up with the idea to make an app that played a song when you enter or leave the room with your phone or other bluetooth device. Ben built the app. That became ThemeSong.

The server was a little wonky, but it’s fun to play with.

It goes to show that you never know where a quick little idea will go. It reminds me of a point Dan Saffer made at his CMU talk last night: an idea is nothing until you make something with it. (not an exact quote, obviously).

So what’s my point? Make stuff! Even if it’s a silly idea, you never know what it might lead you to next and you never know who else might think it’s interesting.

And if you’re wondering, my theme song is the first few seconds of Drive Like Jehu’s Step on Chameleon.

Quick Bit of Code: Using ColorPicker Component (AS3)

This little example comes from a recent freelance project I was working on. The task was to switch the colour of both a TextArea and a MovieClip that were already placed on the stage. This is the first time I had a reason to use the colorPicker component, and for a first time around it was a pretty darn easy to use.

Here’s what it does:
The colorPicker is disabled at first because there’s nothing to change the colour of if you don’t have the text or MovieClip selected. Once one is selected (Most likely the TextArea being that you’re asked to type in it), it becomes active and displays the current colour assigned to the object you selected.

If you click on the background MovieClip, it becomes the currently selected item and the colorPicker’s selection changes its colour instead. Pretty simple, huh?

 

The Code

[as]
import fl.events.ColorPickerEvent;
import fl.controls.ColorPicker;

/*variables to track the currently selected object and it’s colour.
we start with black on white.*/
var currentSelect:Object;
var currentCols:Array = new Array(”0xFFFFFF”,”0×000000″);

//a TextFormat is needed to be able to change the appearance of our TextArea on the stage.
var typeFormat:TextFormat = new TextFormat();
typeText.setTextFormat(typeFormat);

//initial state of the colorPicker
cp.selectedColor = 0×000000;
cp.enabled = false;

//listeners set up
typeBox.addEventListener(MouseEvent.CLICK, setSelect);
typeText.addEventListener(MouseEvent.CLICK, setSelect);
cp.addEventListener(ColorPickerEvent.CHANGE,changeCol);

//keep track which of our two objects is currently selected
function setSelect(e:MouseEvent):void {
currentSelect = e.target;

if (currentSelect.name == “typeBox”) {
cp.enabled = true;
cp.selectedColor = currentCols[0];

}else if (currentSelect.name == “typeText”) {
cp.enabled = true;
cp.selectedColor = currentCols[1];
}
}

//change the colour of the selected object
function changeCol(event:ColorPickerEvent):void {
if (currentSelect.name == “typeBox”) {
var myTransform:ColorTransform = new ColorTransform();
myTransform.color = event.target.selectedColor;
typeBox.transform.colorTransform = myTransform;
currentCols[0] = event.target.selectedColor;
trace(event.target.selectedColor);

}else if (currentSelect.name == “typeText”) {
typeFormat.color = event.target.selectedColor;
typeText.setTextFormat(typeFormat);
currentCols[1] = event.target.selectedColor;
}
}
[/as]

The Source

Source