Tag: Flash

Day by day

January 19th, 2009 — 4:53pm

I’ve just finished the interface for browsing the work day by day. It took much more time then anticipated. This was because as soon as I jumped to another day the program started slowing down to an unacceptable level. I had to figure out why that happened before I could carry on. Finding that out and fixing it took me about five hours!

I finally discovered that a drawing new heart-beat graph slowed down the program because it got bigger with every new day you clicked. This graph is build up from thousands of dots and lines. To make the animation go faster I had to remove those first. But I put them in the wrong place so I couldn’t remove them. I had to rewrite the code for building the graph so I knew where all the lines and dots were and then I could remove them. Now with every day you pick the old graph is removed and a new one is drawn and the speed stays the same.

On the net I found this really nice code for adding listeners to the seven buttons in a dynamic way:

addEventListener(MouseEvent.CLICK, mouse_click);
function mouse_click(event:MouseEvent):void {
 var object_name=String(event.target.name);
    for (var i:int = 0; i < 7; i++){
  if (object_name == day_btn_array[i])

So instead of writing all the listeners by hand I now only have three eventlisteners (only one is shown here.) With every click the function finds out what button was clicked. It calls the appropriate function and passes the original click event. In the called function I again retrieve the name of the button from that event using event.target.name again.

3 comments » | Uncategorized


December 16th, 2008 — 7:08pm

prototype of the first heart-beat graph

prototype of the first heart-beat graph

I’ve managed to code my first heart-rate graphic. And it’s CUTE!
By looping through the big data file I can isolate the heart-beats, take the different values to draw lines and put in the dots at the right coordinates. The next step is to draw a big graph in Flash and move it to the right at certain intervals (500 milliseconds for example). Now it still is a drawing that is animated from left to right. It disappears from view after a while, as you can see in the picture.

5 comments » | Uncategorized

Getting things on a map

December 10th, 2008 — 2:16pm

Custom marker in Google maps for Flash

Custom marker in Google maps for Flash

Yesterday I continued with my Flash web app. I’d already done some tests with part of the application. For example displaying a map inside Flash. Only recently Google maps have released an API for working with Google maps inside Flash. This makes it very easy to include (interactive) maps inside your Flash app. Of course when you want different things it’s harder :)

I want to display two maps, one for Amsterdam and one for Breda. On the map you can follow me around for two weeks. I wanted to use a fitting icon to display where I have been. So I designed a heart to indicate where it was beating at a certain time. I thought it would be simple to display my custom marker. But I could only find difficult and not so logical examples explaining how this is done. So with a fresh mind in the morning I took a new look at the documentation and worked it out. As it took me quite some time to work this simple code out I’ll just repeat it here for those interested:

function onMapaReady(event:Event):void {   
   map_a.setCenter(new LatLng(b_line_array[2],b_line_array[3]), 14, MapType.NORMAL_MAP_TYPE);   
   var a_icon:Marker = new Marker(   new LatLng(b_line_array[2],b_line_array[3]),   
   new MarkerOptions({    
      icon: new my_icon()       

So in my library I have a movie clip called (linkage) my_icon. I use this for the Amsterdam and the Breda map, except that it’s called b_icon there, the rest of the code is the same. Make sure you import the marker classes:

import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;

And add the overlay, then you’re done.

3 comments » | Uncategorized

I give up

December 4th, 2008 — 9:15pm

Flash Lite app with Shuriken component

Flash Lite app with Shuriken component

Part of the data I want to log and show are my activities. I’ve wrecked my brain trying to think of an easy but digital way of keeping track of my activities during the day. That data should consist of a time stamp and of course my activity. I imagined an application which would run either on my PDA or on my mobile phone. I would have to be really easy to work with as I’ll be using it for two whole weeks on a constant basis. I was thinking of a drop-down menu or combo-box which would hold all my possible activities (hmm, is that possible). Once I’d have selected an activity it would be stored on the device together with a time stamp indicating the current time. The next morning I would download the data from the device and integrate it with other data collected the previous day. Sounds simple right?

My first thought was Excel, as this is an easy way to store structured data and output it in different formats. But the power of my pocket Excel is limited and after some time I realized that you can’t use VB Script so that solution went down the drain.

By chance I realized that Flash (dear Flash) can also store persistent data. This wasn’t something I had worked with before but it sounded promising and I could use it on my Nokia. At first I developed a desktop version. When I got that working (sorting the collected data proved to be the most difficult task) I discovered that I couldn’t use the combo-box component on my Nokia, it wasn’t supported. But thankfully there are geniuses out there who made custom components for handheld devices! After I’d finally set them up other parts of my AS3 code weren’t working on Flash Lite, which supports AS2. But after a about a days work I can’t get the application to really store all the data. The sorting again is a problem (1, 10, 11, 2) pfffff. So this afternoon I made the very uncharacteristic decision to give up this application. Time is pressing. I still have to build… everything really.

So now I feel quite relieved and have decided I’ll use pencil, paper and my watch to collect my activities.

11 comments » | Uncategorized

Back to top