Latest Publications

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? :D )
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;
        }
    }
}

Image and Video Slideshow

Just uploaded a new project to ActiveDen. This is a slideshow that will let you display images and play videos.

You can play video from YouTube, Vimeo or your FLV, F4V, MP4 files.
It can load JPG, SWF and PNG files.

If you want to buy it, please check the image below ;)

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!

For those who say Flash is dying

I started with Flash 5 and many people said Flash will never be good enough and after that I’ve heard many people saying Flash is dying.

A very small part of the dying statement is true.
I believe the market is saturated with Flash portfolios / photo galleries / video players, but Flash is not only that.

I hear many developers who are doing just that and who are complaining about it.

My response is: Try something new! Stop doing the same video/photo galleries every single time and start experiment with different things. The Flash environment has a lot to offer, you don’t need to limit yourself only to galleries and video players.

A lot of those who complain are the stock Flash developers (the ones who sell stuff on ActiveDen and similar marketplaces).
Those people need to understand that any market gets saturated and not all the Flash developers are selling stock files and have a living doing so.

Flash may not be the perfect environment and AcionScript may not be the perfect programming language but I believe a lot of good things can come from Flash if you know how to take advantage of it.

And no, the iPad dose not bring the death of Flash. Not everyone sits on the can to surf the web. And Flash is not limited only to the web.

Paul Calver’s portfolio website

A few weeks ago I started working on some updates for a photography website. The project started a bit slow, but after I managed to get every information from the client I managed to understand what’s needed to be done in order to complete it. This project uses SlideShow PRO (at the request of my client) and SlideShow PRO Director for CMS. I like the final result and that’s why I wrote about this website. Enjoy ;)

What I’ve been up to lately

Lately I’ve been working on a lot of projects, one of them being this audio tool. This is my first Flex (aka. Flash Builder) project and it was delivered with big help from my partner Biro Barna.

The tool is made to let people create their own ringtones. You can simply upload any MP3 file and cut it up to 30 seconds, add fade in / fade out if you want and then give it a name and save it. Then a new page will let you download the ringtone in iPhone format or MP3 format.

I’m in the process of remaking my portfolio site. When it’s done I will post more of my projects.

Darth Vader “no” button


Last night I published my first application on the Android market. It’s just a cool button that plays the famous “noooo” scream made by Darth Vader in Star Wars: Episode III – Revenge of the Sith.

Enjoy! :D

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 :)

This is amazing! 3D Flash Game with P2P Multiplayer

I have to say, a Multiplayer 3D Game running in Flash Player is really exciting!
The future of gaming will change from now on. Take a look and tell me what you think ;)

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! :D

Video Tapestries:

(more…)

Photo camera wooden knob – made the news

The other day, a photo that I made and published on my flickr profile got picked by gizmodo.com and, consequently, got a lot of attention. It’s a photo of a wooden control knob from my old Fujifilm S5600 FinePix digital photo camera.

I’m really happy with the way the new knob looks and feels.

To all the gizmodo readers I want to say that my friend is a good friend and I appreciate the time end effort he put into this little wooden knob.

(more…)

Now you know what I did last summer. Bonus: what I’m working on

It’s been a long time since my last blog post. In the past few months, had time for a little vacation (I went to Anonimul Film Festival) and I worked on some very interesting projects.

Lately, I’ve started working on some projects with Biro Barna (a friend of mine and a highly trained ActionScript developer).

Moreover, I’ve started working with Flash Builder where I code my projects and Flash IDE to compile them. I’m starting to like this work flow, it’s more organized and I feel like I can code faster this way :D

In addition to all this, I’m working on a custom DailyMotion player and I’m using the official API.

The problem right now is that I can’t get the chromeless player to work, I believe it’s a problem with this API or something, I will be doing some more research and see what can be done to fix this problem.

I’ll let you know when or if this project will be done.

Shuffle text menu

This is text shuffle class that will help you make a nice flash menu for your site or your applications. I got inspired from a similar class made by Lee Brimelow. You can use it for open source or commercial projects (do anything you want).

Get Adobe Flash player

  Shuffle Text (20.8 KiB, 863 hits)

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 :D

Source files:

  mp3_player.zip (1.4 MiB, 1,739 hits)

YouTube Playlist Reader

Just wanted to let you guys know that I’ve been working on a YouTube playlist reader (based on the ActionScript 3 YouTube API). With this custom player you can send a YouTube playlist ID and the player will generate the list of videos with thumbnails and other info about the videos.

Just check it out and let me know what you think ;)

UserBooth.com is now live

We just lunched UserBooth.com. Please give us a lot of feedback so we can develop neat features and build the best flash webcam application :)

Password protected content in Flash with ActionScript 3 and PHP

This morning I was browsing through the gotoAndLearn forum and I saw a question about how to make a password protected section in a Flash site. So, I made a quick example and I thought I should share it with all my readers too ;)

You can download the source files from here:

  Password Protected Flash Content (800.5 KiB, 1,501 hits)

Here you can see the ActionScript 3 code:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.showDefaultContextMenu = false;
 
//path to the php file on your server
var phpPath:String = "login.php";
 
//make password text field (when you type the characters will be like "******")
pass.displayAsPassword = true;
 
login.addEventListener(MouseEvent.MOUSE_DOWN, loginDown);
 
function loginDown(e:MouseEvent):void{
	//check to see if something in both the user and pass text fields
	if (user.text != "" &amp;&amp; pass.text != "") {
		sendLoadData();
	}else{
		trace("Please fill in both username and password");
	}
}
stop();
 
function sendLoadData():void
{
	var dataRequest:URLRequest = new URLRequest(phpPath);
	dataRequest.method = URLRequestMethod.POST;				
 
	// define the custom parameters that will be sent to the .php file
	var params:URLVariables = new URLVariables();
	params.user = user.text;
	params.pass = pass.text;
 
	dataRequest.data = params;
 
	var urlLoader:URLLoader = new URLLoader();
	urlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
	urlLoader.addEventListener(Event.COMPLETE, urlLoaderComplete);
 
	try
	{
		urlLoader.load(dataRequest);
	}
	catch (event:Error)
	{
		trace("Incorrect PHP file path.");
	}
}
 
function urlLoaderComplete(event:Event):void
{
	// once all the data has been sent and we'll check for a message sent
	// from the php file to tell us if the operation has ended with success or not
	errorHandler(event.target.data.secure_response);
}
 
function errorHandler(message:Number):void
{
	// check the message that was sent back from the php file
	//trace(message)
	if (message == 1)
	{
		gotoAndStop(2);
	}
	else
	{
		trace("Wrong Username or Password");
	}
}

And here you have the PHP code:

<?php
//Your set username and password
$username = "vamapaull";
$password = "mypassword";
 
 
//Variables received from ActionScript
$user=$_POST['user'];
$pass=$_POST['pass'];
 
 
//Chack them against each other
if ($user == $username && $pass == $password){
	print "secure_response=1";
}else{
	print "secure_response=2";
}
 
?>

ActionScript 3 YouTube feed application

A few days ago I made a little application based on the new ActionScript 3 YouTube API and I thought I should share it with those who want to get started with this type of players. In the future I plan to make some more complex applications based on this API so I can sell them on ActiveDen.net

Here you can see the code:

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
 
Security.allowDomain("youtube.com","http://youtube.com","www.youtube.com");
 
 
var feedName:String = "MyDamnChannel";
 
 
// This will hold the API player instance once it is initialized.
var player:Object;
 
var playerLoader:Loader = new Loader();
playerLoader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
playerLoader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
 
function onLoaderInit(event:Event):void {
	addChild(playerLoader);
	playerLoader.content.addEventListener("onReady", onPlayerReady);
	playerLoader.content.addEventListener("onError", onPlayerError);
	playerLoader.content.addEventListener("onStateChange", onPlayerStateChange);
	playerLoader.content.addEventListener("onPlaybackQualityChange", 
		onVideoPlaybackQualityChange);
}
 
function onPlayerReady(event:Event):void {
	// Event.data contains the event parameter, which is the Player API ID 
	//trace("player ready:", Object(event).data);
 
	// Once this event has been dispatched by the player, we can use
	// cueVideoById, loadVideoById, cueVideoByUrl and loadVideoByUrl
	// to load a particular YouTube video.
	player = playerLoader.content;
	player.x = 300;
	player.y = 30;
	player.setSize(580,345);
}
 
function onPlayerError(event:Event):void {
	// Event.data contains the event parameter, which is the error code
	//trace("player error:", Object(event).data);
}
 
function onPlayerStateChange(event:Event):void {
	// Event.data contains the event parameter, which is the new player state
	//trace("player state:", Object(event).data);
}
 
function onVideoPlaybackQualityChange(event:Event):void {
	// Event.data contains the event parameter, which is the new video quality
	//trace("video quality:", Object(event).data);
}
 
 
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
 
lb.addEventListener(Event.CHANGE, itemChange);
 
function itemChange(e:Event):void
{
	player.loadVideoById(lb.selectedItem.data,0);
}
 
var xml:XML;
 
function onLoaded(e:Event):void
{
 
	var defaultNS:Namespace = new Namespace("http://www.w3.org/2005/Atom");
 
	xml = new XML(e.target.data);
	var il:XMLList = xml.defaultNS::entry;
	for(var i:uint=0; i<il.length(); i++)
	{
 
		var ytId:String = il[i].defaultNS::id.slice(42,53);
		lb.addItem({data:ytId, label:il[i].defaultNS::title});
	}
}
 
loader.load(new URLRequest("http://gdata.youtube.com/feeds/api/users/"+feedName+"/uploads"));

Download FLA:

  ActionScript 3 YouTube feed application (607.8 KiB, 1,540 hits)

Enjoy!

YouTube playlist with thumbnails

After I made the first YouTube player I thought it’s a good idea if I make another version with thumbnails inside each playlist item. So I started to work on the project, then I posted it on ActiveDen.net and then it got approved (on 8 October 2009, after nearly 1 month from the first YouTube playlist project). I don’t know how or why but right now this new player it’s the best seller in my ActiveDen portfolio.  I’ll try to make some more YouTube projects and see how this will turn out.youtube playlist with thumbnails

UserBooth (beta) – Flash Webcam Application – Photo maker

A few weeks ago I made a little Flash application named “Photo Booth”. Then I started to work with a friend of mine on a bigger project that will be very useful for those site owners who want to easily integrate a webcam application into their sites.
The project name is UserBooth. Right now we are still working on the application so please use it, take snapshots and let us know about your experience with the app. We need your feedback ;)

userbooth