Book Creator For Kids

Update: At the beginning of this year, the client requested a few new features and a some features removed. Above you have a screen shot of the new app and below you can find an image with the old interface.

Lately I’ve been absent because I have been working on a cool Book Creator Flash application.

This project was a new experience for me since I got to work with Flash and server-side code.

The application is made for kids between the ages of 8 and 12 years.

It’s a Book Creator type of app that lets you configure a simple book. You can then print the book to your local printer or save on your profile.

Read more
Timecode Utility

Today I’m sharing simple utility that I use from time to time when I need to convert time (see what I did there? πŸ˜€ )
It’s very useful if you build a FLV player for example, and want to convert the time into minutes:seconds

Example of how to apply it to your project:

import com.vamapaull.utils.TimeUtil;
 
time.text = TimeUtil.getTimecode(timeValue);

Results:

The ActionScript class:

package com.vamapaull.utils
{
    public class TimeUtil
    {
        public static function getTimecode(value:Number):String
        {
            var t:Number    = Math.round(value),
                min:Number  = Math.floor(t/60),
                sec:Number  = t%60,
                tc:String   = "";
 
            if(min < 10)                  tc += "0";                          if(min >= 1)
            {
                if (isNaN(min) == true) tc += "0";
                else tc += min.toString();
            }
            else 
                tc += "0";
 
            tc += ":";
 
            if(sec < 10) 
            {
                tc += "0";
 
                if (isNaN(sec) == true) tc += "0";
                else tc += sec.toString();
            }
            else 
            {
                if (isNaN(sec) == true) tc += "0";
                else tc += sec.toString();
            }
 
            return tc;
        }
    }
}
Device Shake – Accelerometer

Here you have an easy way to detect shakes on mobile devices with equipped accelerometer:

var lastShake:Number = 0;
var shakeWait:Number = 600;
 
var acc:Accelerometer = new Accelerometer();
acc.addEventListener(AccelerometerEvent.UPDATE, onAccUpdate);
 
function onAccUpdate(e:AccelerometerEvent):void
{
	if(getTimer() - lastShake > shakeWait && 
			(e.accelerationX >= 1.5 
			|| e.accelerationY >= 1.5 
			|| e.accelerationZ >= 1.5))
	{
		shakeIt();
		lastShake = getTimer();
	}
}
 
function shakeIt()
{
	trace("device has been shaked");
}

Enjoy!

First encounter with AIR for Android

Today I made some experiments with AIR for Android. The process was very smooth and I like how simple everything is, in just a few minutes I managed to compile an application and play with it on my Android device. Totally love the way that I can reuse the ActionScript 3 code and make beautiful applications for Android!

Not so many good words about the Android Market. I started an account, then I was asked to pay a fee of $25 and then when my account was created I noticed that I can’t really make paid applications for the Android market since Google Checkout is not available in Romania. How messed up is that? You want people to develop applications for your marketplace, you request a fee and then they have no way to at least get some of that money back. It’s not that I can’t live without 25 bucks, but that really sucks, I feel like I’m giving them money so I can develop for their marketplace and help it grow a little more (so they can earn even more money). I love Flash related technologies and Android, but this doesn’t have any logic.

Anyway, I tried to implement an older youtube player into my AIR application so I can test it out and see how it works. The problem was that when I played a video and hit the hardware back button on my device, the video was still playing because the application minimized instead of closing (as I imagined it would). Then I started to search for a solution, and sure enough, I found it very fast on Tom Krcha’s blog. To close the button when you hit the back button you first need to register a handler:

if(Capabilities.cpuArchitecture=="ARM")
{
	NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys);
}

Then you need to make the function for that handler:

function handleKeys(event:KeyboardEvent):void
{
	if(event.keyCode == Keyboard.BACK)
	NativeApplication.nativeApplication.exit();
}

That’s it. I will continue to work with AIR for Android and hopefully make some cool apps πŸ™‚

Interesting videos from MAX 2010

I have found some very interesting videos from MAX 2010 and I want to share them with you, I believe you’ll love the new stuff as I do! πŸ˜€

Video Tapestries:

Read more
Simple AS3 MP3 Player

Last night I was browsing around 365psd.com and I found a very interesting design for an mp3 player. Then I thought it would be a good idea to make it functional with Flash and ActionScript 3.0 and then share it for free on my blog πŸ˜€

Source files:

  mp3_player.zip (1.4 MiB, 9,229 hits)