Archive

Author Archive

ComboBox text formatting in AS3

April 15th, 2008 admin 41 comments

After struggling with it for a while, I’ve finally found the way to set embedFonts and a specific textFormat for all text in a Flash CS3 ComboBox component.

First of all, it is wise to create a subclass of fl.controls.ComboBox to represent your custom comboBox. In this class you can then set some styles in the constructor as follows:

package com.rockabit.utils.as3
{
import fl.controls.ComboBox;
import fl.controls.List;

import flash.text.TextFormat;

/**
* Customized ComboBox component. Graphic changes have been made inside the component itself,
* in the library, changes in textual display are made here.
*/
public class CustomComboBox extends ComboBox
{
private var textFormat:TextFormat;

public function CustomComboBox()
{
super();

textFormat = new TextFormat(”Arial”, 10, 0xffffff);

//textField is the top text, in the closed combobox
textField.setStyle(”embedFonts”, true);
textField.setStyle(”textFormat”, textFormat);

//dropdown is the list that shows when you open the combobox
dropdown.setStyle(”cellRenderer”, CustomCellRenderer);
}

override protected function drawLayout():void
{
super.drawLayout();
textField.y = 0;
}
}
}

So in the constructor, I create a TextFormat instance and assign that to the textField variable. I then set the cellRenderer style of the dropdown list, which is a class that describes how each item in the list is formatted. For that I use another custom class, which extends fl.controls.listClasses.CellRenderer:

package com.rockabit.utils.as3
{
import fl.controls.listClasses.CellRenderer;

import flash.text.TextFormat;

/**
* Custom cellRenderer for comboBox list items.
*/
public class CustomCellRenderer extends CellRenderer
{

public function CustomCellRenderer()
{
super();
this.setStyle(”embedFonts”, true);
this.setStyle(”textFormat”, new TextFormat(”Arial”, 10, 0×000000));
}

}

}

All this class does is extend the default CellRenderer class and set some styles in the constructor.

Using these two simple classes, you can easily make sure that all your fonts are embedded in the comboBox component, and give them custom text formatting.

I’ve made a small example .fla file. You’ll notice that I added the Tahoma font to the library with a linkage class, which I instantiate in the TextFormat constructor parameter to get the correct fontName. Because I set the library font to bitmap text andset embedFonts to true in code, you get a nice crisp font display in your combobox.

Edit: I have now also added functionality to the CustomComboBox class to set vertical positioning of the main textfield. Right now this is hardcoded, but that could be changed to listen to a custom style.

Download source:
http://www.rockabit.com/downloads/as3/combobox_example.zip

Categories: programming Tags:

Happyard is Japanese GameJam nominee!

March 27th, 2008 admin No comments

A couple of weeks ago four other guys and me developed a concept for a Japanese mobile game called Happyard. We did this in the context of the GameJam competition which was organized with the intent of promoting dutch design in Japan through mobile gaming.

The Japan Times describes Happyard very much to the point as a game that “(…) integrates real world parameters with a virtual garden environment and sets the player about hunting animals for their collection.” This concepts enthused the Japanese jury so much that they decided on us as the fourth competitor where a selection of just three was allowed (!) So on to the demo creation phase and perhaps this fall we’ll be representing dutch design in Tokyo!

Read more at:

http://search.japantimes.co.jp/cgi-bin/nc20080319a1.html
http://www.nieuwsbank.nl/inp/2008/03/18/G016.htm
http://www.florusvanbeek.nl/blog
http://blog.thingsdesigner.com

Categories: game design Tags:

Navigatable ArrayCollection for Flex

March 18th, 2008 admin 1 comment

I’ve written a NavigatableList class to provide the already handy ArrayCollection class with a simple cursor-like navigation option. You can call list.navigateTo() and provide for instance list.next or list.previous. You also specify the class to which items should belong and you can search for an item with list.findItem(property, value). And finally, you can clone it with list.clone().

Download it here

EDIT: the clone() method didn’t work correctly for some reason. I’ve removed it for now.
EDIT: added an equals() method which compares this list to another list. You  must specify the  name of a unique property which can be used to check if two items are the same.

Categories: Flex, programming Tags:

AS 3.0 layout manager

February 25th, 2008 admin 5 comments

I’ve created a custom layout manager in AS 3.0 which provides some of the automatic scaling and positioning that Flex provides.

You can register objects and specify a size to maintain relative to the stage size, alignment, padding and set a function that is called when the screen is resized.

This is a first version and it may (and most likely will) change in the future.

Download: LayoutManager.as and LayoutTarget.as

Categories: programming Tags:

Physical Emotion Induction

February 19th, 2008 admin No comments

The hour of my graduation draws nigh, and in preparation I would like to share the details.

Abstract

It is well known that our emotional response is related to our bodily state, and more specifically that our bodily state can directly influence particular emotions we feel. It appears, however, that this fact has so far not had a significant influence in the entertainment industry. We first review existing work on physical emotion induction. Based on this work we present several techniques to influence emotional responses through physical means in a non-cognitive manner. The basis for the different techniques is a two-factor model of emotion: Pleasure and Arousal. We selected 4 sets of movie clips that correspond to the 4 possible quadrants existing in the 2 factor model. We have implemented some of the emotion induction techniques in a physical device (interactive chair) and tested the effects on the immersiveness of the movie clips and the emotional experience of the participants.

The full research paper (16 pages) can be downloaded here, as well as a shortened 8 page version:
full paper (pdf)
short paper (pdf)

Categories: personal, science Tags:

The fun don’t stop with Johnyy Lee

December 25th, 2007 admin 1 comment

Another brilliant example of thinking outside of the box by Johnny Lee. This time he figured out how to do head tracking with the Wii remote to use in desktop VR applications. To find out what this means, watch his video below:

Categories: Nintendo, electronics Tags:

Zombie Love

December 23rd, 2007 admin No comments

Yesterday I was treated to a viewing of the brilliant thesis film of Yfke van Berckelaer, called Zombie Love.
It’s essentially a musical about, as the title may suggest, a zombie in love. It is incredibly funny and well written and I enjoyed every second of it, including the hilarious ‘chilling with my girlfriend’ trailer. An absolute must see!

Find more info on http://www.zombielovethemovie.com/ and please support Yfkes artistry by ordering a copy!

Categories: film Tags:

Multitouch displays using the Wiimote

December 12th, 2007 admin No comments

Johnny Lee gave us a taste of his brilliance by sharing his experiments in which he uses a simple Wii remote to create a low cost multi touch display either on a surface or in thin air as you see in the movie Minority Report.
Check out his website: http://www.cs.cmu.edu/~johnny/projects/wii/

Categories: Nintendo, electronics Tags:

Wireless (S)NES Controller for Wii

December 9th, 2007 admin 2 comments

All I can say is: “WOW!”

Mark Feldman felt (and who doesn’t) that Virtual Console games on Wii are experienced much better when played with their original controllers, so what did he do? He converted original NES and SNES controllers to wireless versions, compatible with the Nintendo Wii! And he even put up a website to show us how it’s done. See links below.

Mark Feldman’s tutorial website:
http://www.ppl-pilot.com/

Demo video:

Categories: Nintendo, electronics Tags:

The ‘Liar’ Bird

December 9th, 2007 admin No comments

Take a look at this brilliant bird, the Lyre Bird. It imitates anything it hears: other birds, but also camera shutters, car alarms and even chainsaws!

Categories: Various Tags: