Sunday, October 26, 2008

Flash NumericStepper : Setting the Background Color

Have you ever wanted to customize the appearance of the NumericStepper component in Flash (it's pretty easy in Flex). Specifically I wanted to change the color of the text input area. Looking at the NumericStepper class there is some mention of the upSkin and I tried setting this the way I would normally set a button upSkin but with no effect. So I started looking into how the component is constructed. It shouldn't surprise you to find out that the text in the NumericStepper uses the TextInput component. You can get a reference to this object by using the NumericStepper textField property. The next problem is that the TextInput component offers no direct way to change it's background. It turns out that TextInput uses a TextField to display it's text. You can get a reference to this object using the TextInputs textField property. Consequently to change the background color of a NumericStepper's text you need to access it's textFields textField. It looks like this:

myStepper.textField.textField.background = true;
myStepper.textField.textField.backgroundColor = 0x0F1A2F;

What makes this confusing for me is that the first textField returns a reference to a TextInput and then the second textField returns a reference to a TextField. There may be an easier way to do this and I hope to hear what it is. Perhaps I'm missing something regarding upSkin?

Thursday, October 16, 2008

Perpetual Motion : My New Game

Perpetual Motion Singapore

A few days ago we (myself and the nice people over at published my latest game : Perpetual Motion. This new game has much in common with my first physics based game : Wheel of Death. In Wheel Of Death you had to arrange props to get the wheel to the goal. Walls, bus and various other obstacles provided variety to the levels. Box2D was used as the physics engine to allow some realistic collision and physics. While I was developing Wheel Of Death I regularly found I was more interested in building perpetual machines with the available props than I was in completing the levels. By perpetual machines I mean a combination of props that cause the wheel to cycle for an indefinite period. It seemed to me at the time that it would be simple enough to "quickly" build this new game as it used much of the engine from the original. To be honest much of the engine from Wheel of Death remains unchanged except for a few enhancements to make it more reliable but as I became more interested in the concept I started to invest more time in refining the user experience (dialog transitions, a world map with each location having a unique landmark and a different background) and introducing instructional elements (numbers to show the sequence of prop interaction). Getting a meaningful scoring mechanism was probably one of the biggest challenges and from the comments on Kongregate I don't think I went far enough in explaining the scoring system. Still I feel Perpetual Motion is a real leap forward from my first game. I hope you enjoy playing it.

Wednesday, October 01, 2008

OzFlex October Meeting : Andrew Spaulding presents CS4

If you didn't make it to last weeks launch of Adobe Creative Suite 4 then you might be interested in joining Adobe's Andrew Spaulding as he presents an "exciting, fast‑paced, developer focused session on Adobe’s latest line‑up of their flagship Creative Suite products, and how they interface with Flex & AIR". This event will be hosted as part of OxFlex's October meetup and will take place at Melbournes Loop Bar from 6.30 PM on Monday 13 October (more details).