Posts tagged with “as3”

February 11, 10

Including imports

Do you remember the #include "filename.as" AS2 directive? It was often used to include predefined prototype functions in AS2. Since using prototypes become obsolete in AS3 (in favour of the inheritance) the include in often underused.

For example, Darron Shall suggests using include directive to mimic multiple inheritance. Recently, I had been given a glimpse of brain damage enlightenment and I started using it again in AS3 for including all project specific libs only. If you want to pass me the hammer now, please read on.

How?

Using wildcards (like import flash.display.*) is often considered a bad practice (or laziness) as we don't know what classes/packages are actually being imported. So we are left with typing all import directives for every class we write. Very commonly we use the same shared functionality (either a framework or built-in classes) in the SWF. The idea is that instead of having to import the same classes in every project class, we can have a list of them in a file, i.e.:

import flash.display.Bitmap;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.utils.setTimeout;
import gs.TweenLite;

and then stop worrying anymore about what needs to be imported.

All you need to do is to place include "../../imports.as"; where your import directives would normally live. I've personally chosen to put it in the same location as the source directory.

package net.blog2t
{
    include "../../imports.as";

    public class Banner extends Sprite
    {
    }
}

Then you can do it for every project specific class you add.

If you're on OS X and using Textmate, you can use the shortcut – F5 key to sort lines and remove duplicated entries.

06:00 PM | | 2 Comments | Tags: , , ,
January 30, 10

Static Mirror installation for Hidden Door festival

I have a pleasure to announce that I am a part of the Hidden Door Festival - the event is happening during this weekend at Roxy Art Club, Edinburgh.

I got commissioned to make an interactive installation that I've called Static Mirror. So, if you're Edinburger – come along to see the exceptional maze full of art and bands performing live, otherwise just enjoy my piece on-line.

Hidden Door installation live

Click the image above to activate (webcam required.) There's a accompanying noise, so mute the sound if you are i.e. at work.
© 2010 Tomek Augustyn. All rights reserved.

If you're looking for a deeper meaning, please read the artist's statement.

Coming out of the underground club, Tomek brings the idea of interactive VJing into a gallery space by confronting visitors with the imagination they might have about themselves.
He asks the old question – “Do our bodies exist for real or are we just a bunch of particles bound together by invisible forces as a temporal form of expression?”
The answer could be found by observing the nature of static noise reflection – as long as you move, you are.

On a technical note, the piece uses my HiSlope (alpha) video processing engine (shortly available as open-source.)

You can also press '/' to play with the manual controls and '\' to view the stats for the camera.

06:11 PM | | 2 Comments | Tags: , , , , ,
December 18, 09

Pump my snowman

tictoc xmas 2009

Christmas trees up! We've just created this funky game at tictoc – go, give it a try... or pump yourself.

AS3 developers - try to find all the cheats and beat (pump) us up! (I mean highscores of course.)

05:30 PM | | 0 Comments | Tags: , , ,
November 14, 09

Nostalgia in Parts

The nostalgia definitely came back. With the recent re-release of the C64 emulator for iPhone I felt that I am somehow thrown back into C64 world again – the only difference is that I am twice as old as I used to be when being active on C64 demoscene and it feels a bit tight. Some time ago I bumped into this amazing ICU64 project - realtime debugging/hacking tool by Mathfigure. Do you remember Matrix the movie?

The first part

I sooooo wanted to have all that working in AS3, that I have resurrected FC64 – low level C64 emulator written by Claus Wahlers (Codeazur) with Darron Shall. The code was moved to GitHub recently, so I just had forked it and thus give it its new life.

Let's roll with a small demo.

FC64 player

Click to activate and watch this (very buggy here but interesting) part from Parts, great demo from 1995 by Oxyron.
Red and green indicate memory write/read, grayscale map represents memory values.
Click on the map and use mouse wheel or +/- keys to zoom in and out.
(Memory debugger idea shamefully borrowed from Mathfigure.)

The demo itself doesn't play nicely with FC64 and it's quiet as there's still a lot of work to do on the emulator, but just pay attention the memory snapshot – discover how data is being populated in the memory. The image of girl's face is decompressed and overwrites BASIC area.

I am kind of quietly hoping to get other (ex-)demosceners involved to cooperate and improve FC64 as there's loads to do. The most important thing is to re-enable the SID (maybe using Ralph's TinySID alchemy port) as there are traces of early SID implementation in the FC64 source.
There's another idea for a secret project involving KickAssembler, but shhhh for now...

...and yet another part of the same story

Yes, there is more to it. I am supposed to work on the HTML/CSS templates for the new, cool (web2.0) version of Intros C64 - the biggest online C64 cracking intros repository. The design (also be me) has been approved a year ago, and I am somehow in stuck in the middle - need to work out the roadmap.

Anyway, I wrote a tiny a little bookmarklet to enable live preview of the intros, here are two example links:

Dynamic Duo 3D stars
Dynamic Duo (pictured above)

And the Bookmarklet itself - just drag the link to your toolbar and use on Intros C64 site (you have to select an intro first - get the view with the comments).

06:30 PM | | 0 Comments | Tags: , , , , , , ,
October 23, 09

AS3 version of PHP's print_r

A very nice little utility nicked from here. Thanks Nate!

package
{
    public function print_r(obj:*, level:int = 0, output:String = ""):*
    {
        var tabs:String = "";
        for (var i:int = 0; i < level; i++, tabs += "\t");

        for (var child:* in obj)
        {
            output += tabs + "["+ child + "] => " + obj[child];

            var childOutput:String = print_r(obj[child], level + 1);
            if (childOutput != "") output += " {\n"+ childOutput + tabs + "}";

            output += "\n";
        }

        if (level > 20) return "";
        else if (level == 0) trace(output); else return output;
    }
}

/* USAGE:

// Save as print_r.as, change package name if needed

var obj:Object = {};
obj.var1 = "test";
obj.var2 = { var2a: "a", var2b: 10 };

print_r(obj);
print_r(("a,b,c").split(","));

*/
09:32 PM | | 0 Comments | Tags: ,
← Previous Next → Page 2 of 5