11 August 2009

Project - Female Form Factor

A campaign microsite for the Sony Ericsson mobile phone - T303. The site includes 4 stylish studios in which you will try out the new phone with its featured features: camera (capture a photo from the room and display it in a frame), music player (listen to some pieces of music that are chosen to match with the room's mood) and Internet access (buy some items and put them in the room). There is also a quiz to help user choosing the matching room for them. This site was finished in 8/2008.
The site is integrated as iframe in www.sonyericsson.com under T303 phone page. However, you can google the phrase 'Female Form Factor' to receive this direct link.
My role: Team leader, Flash developer
Technical notes:
  • Flash 8 / Actionscript 2
  • Object Oriented
  • Displacement Map Filter: used to make the camera viewport look wider
  • Dynamic font embedding: load the font set specific to a localized language. Since there's no dynamic font registering in Flash 8, a special technique was used involving dynamic shared library.
  • .NET service.

05 August 2009

Google Map for Flash with daylight layer

When I visit this site: www.daylightmap.com, I was excited how it could show the daylight on the world map in real time. Very interesting because I can visually know some friends of mine in other part of the Earth are in the light of sun or in the shadow of darkness. :)
The site is using Google Map API (javascript) for the map and its own service for the daylight layer. Although the author provides a limited free service there was no code for the Google Map API for Flash so I decided to examine the service call to get the input needed and port it to Flash-based Google Map.
I assume that you already know how to use TileLayerOverlay or extends the TileLayerBase in the API to create a new map layer above default ones.
Basically, like other tile layer, the Google map need to get the correct tile image via the tile's x and y coordinate in a certain zoom level.
Here's the service call break down:
tileURL = "http://www.daylightmap.com/tiles/cache/" + "tile_" + lightOn + zoom + "_" + tileX + "_" + tileY + "_" + secs + ".png";
Luckily, since the service is for Google Map API, there's no need to convert the zoom, tileX, tileY values forwarded from the API.
What we need to manipulate are:
- lightOn ("n_"|""): if you want to get the shadow images with city lights or not
- secs: number of seconds since 01/01/1970 00:00:00 UTC which, in AS3, can be get by:
  1. var now: Date = new Date(); //get local time
  2. var secs: int = int(now.getTime() / 1000); //convert from milliseconds to seconds
Here's the demo:
Side notes:
  • There's also a service in which we can get local time as well as current position of the Sun (in lat/long). However, the site currently doesn't allow crossdomain service call. So I just left an example in the demo but commented it out. If you need those features, you might need to ask the site's author to create a crossdomain.xml file in his website.
  • Since daylight layer is a kind of real time data, obviously, we need to reload the map after an interval of time. I haven't done this in my demo. But you should understand the situation: When I wrote this demo, the API was 1.9 and it doesn't support any way to force a tile layer to reload new data. However, a work-around is hinted on its developers' group forum that we can force the map to reload completely by resizing the map (maybe just 1 or 2 pixels). By the time of this article, API v1.16 was released and it provides a new refresh() method in the TileLayerOverlay which can be used to solve our problem. I leave this to anyone who wants to improve it.

02 August 2009

Project - Offset The Evil

Like its name, this flash site is to offset the evil from those played the bloody game Condemned 2. The site includes 3 simple fun games (one of them was removed for the reason I don't know) which are totally unrelated to Comdemned 2 and some other activities related to the game. This site was finished in 4/2008. By the time of this post, the site is still live at: http://www.offsettheevil.com/
The 3 games were developed by my team and I was in charge of the Lolipop Parade.
My role was: Flash Developer
Technology notes:
  • Object Oriented
  • Flash Player 8 / ActionScript 2
  • Tweener