AS3 MagicWand

In one concept for a webshop I designed a tool where the user could fit clothes on her own image. One problem – images are not transparent, there was always a background, but usually a solid color. Well, the magic wand in Photoshop would be useful, but too many images to go through then and everytime new items are added. So I studied if Flash could be used and voilá: the MagicWand.as was created. Jatka lukemista ”AS3 MagicWand”

Ignoring black frames while starting a webcam

While playing with motion detection with a Webcam, I ran into a surprising problem. First n frames are 100% black. The number of frames vary, so this problem wasn’t solved with ignoring first 10 frames or anything similar. So I used getColorBoundsRect to detect any non-black pixels and when found, the WebCam class would start to send an event. The video will be visible before dispatching events, but it could be hidden until the event is dispatched. Jatka lukemista ”Ignoring black frames while starting a webcam”

My new best friend – describeType

Praise to the flash.utils.describeType – a method that became my number one friend when I was validating parameters set by user and solving how to validate proper data types without knowing what they were.

So, what does flash.utils.describeType do? In a nutshell it converts any class into a xml that describes

What’s in your Utils?

The Utils class is a collection of simple methods that carry out small tasks such as data converting and mathematical calculations. They are very general (and usually static) methods and therefore reusable in multiple projects. Actionscript has an inbuilt utils package (flash.utils).  What’s in your own Utils? Or are you using some other Utils package?

My Utils class includes i.a.:

getAsset – gets a class even from externally loaded SWF-files

convertClassToObject – converts a class into an object by collecting all properties that are readable and writable. Appends also new values if assigned and returns data types of all properties. This method uses the flash.utils.describeType method to convert classes to XML objects. Read my praise to this method!

cloneBitmap – clones a bitmap

HEXtoARGB & ARBGtoHEX – these methods converts an ARGB value to  HEX values and vice versa Jatka lukemista ”What’s in your Utils?”

From the archives: Lordi the Game

Back in the days of SolidLoop (2003 AD), we had the honor to create the first ever computer game for the band Lordi. The demo broke the daylight, but the game was never finished. The game is an action-horror adventure where the heroess is controlled with the mouse in the ”point and click” -style. The player can collect weapons and other items in a simulated 3D world. Fights are fought with the keyboard. This was made with Actionscript 1 for Flash 6  and I must say the code looks like a total mess to the AS3 eye!

The game is about a mother whose family disappeared after the family’s road trip ended in a car crash with a hideous monster. Jatka lukemista ”From the archives: Lordi the Game”

From the archives II: Breath of Evil

This was one of advergames we (SolidLoop) published in 2003. The game could be played at msn.fi. Playing was free to a certain point and then the user had to pay by a mobile phone.

It’s a fantasy game with 4 levels and 3 different game styles: run & jump, sneak and a combination of the former styles. This game was also made with ActionScript 1 and published for Flash Player 6.

Watch the intro and play the game. (I still like the outro with a cliffhanger like in the hit series 24!) Jatka lukemista ”From the archives II: Breath of Evil”