Make buttonMode enabled dynamic text fields with AS3

January 4th, 2010

This is a little niggling problem that I find myself rediscovering every now and then when working with dynamic text – particularly dynamic text as part of an interface. When you have a movieclip with buttonMode set to true, you expect the cursor to change to a pointing hand whenever it is over any part of the movieclip, as in this example:

Mousing over the button gives you a hand cursor, updates the button to it’s ‘over’ state, and changes the text at the top, all as expected. The problems arise when using a dynamic text field to label the button, like this:

Mousing over the button still changes it’s state and alters the text, and to a certain extent changes the cursor. However, when you move the cursor over the text field it goes back to a regular arrow, despite the fact that flash can clearly tell it’s still over the button, as evidenced by the ‘over’ state of the button, and the top text field.

Read the rest of this entry »

Flickr Search Flash App

July 25th, 2009

Recently I’ve been looking at the APIs of a couple of websites, Twitter and Flickr. This post will be focusing on flickr, and the little app that I created using Actionscript 3 and the Flickr API.

The Flickr API really makes it easy to access all of the images on the site, and all of the information that it stores about them, using a series of http requests for everything from searching to obtaining geotag information. There are a number of API kits available, but the base Flickr API is so simple that on a small project such as this one it was just as easy to use as it would have been to learn to use one of the kits.

Read the rest of this entry »

Work in Progress – AS3 Settler’s of Catan Board Generator

July 21st, 2009

Every once in a while, a few friends come round to the flat to play board games, the standard game being Settler’s of Catan. Most of us being geeks, at some point in the evening someone usually mentions an idea for a way to integrate some sort of technology into the proceedings, such as a glass topped board game table with LED strips for roads. This is what prompted the following project.

As an exercise in OOP in AS3, I decided to try and recreate the game in flash. This is the first step, the random board generation. Read the rest of this entry »

AS3 Particle System/Color Transforming Flash Game

July 20th, 2009

Recently I was going back through some past projects and experiments, and I came across a particle system I had played with when making the jump from AS2 to AS3.  I ended up digging into the code and fiddling with it – a bit here, a bit there – until some kind of weird game/toy emerged.

Basically, your goal is to match the colour of the particles emerging from your mouse to the colour of the background in the center. You do this by adding or subtracting red, green, and blue from the colour of the particles, mousing over the colours in the left column to add them, and in the right column to subtract them. When one of the individual colours gets close to being the right value, the respective blobs will start to pulse. Match the colour to gain a point, and the target colour will change. You have until the target colour disappears to match as many as you can. Read the rest of this entry »

Actionscript 3 Cutting off your Tweens? Here’s why…

July 19th, 2009

One flash project that I’ve been working on recently is a dynamic image carousel for a website header. All was going well – the carousel was loading external images, spinning correctly, and could be interacted with via the mouse pointer. The header called for the carousel to load off screen and move up into view once the load was complete. No problem, a simple tween should do it…

The Problem

At first that was fine, the carousel loaded and tweened as expected, but after making a few changes to other parts of the header and testing a few more times, the tween stopped short leaving the carousel half visible and half off screen. The irritating thing was that it was seemingly random. Sometimes it would make it all the way, sometimes it would get part way and stop, and occasionally it would appear not to move at all.

Read the rest of this entry »