Author Archives: Zevan

Frame Differencing

CLICK HERE TO COPY
Actionscript:

[SWF(width = 800, height= 600)]

var sw:Number = 800;

var sh:Number = 600;

var pixelNum:int = sw * sh;

var blurAmount:Number = 10;

var pnt:Point = new Point(0,0);

var rect:Rectangle = new Rectangle(0,0,sw,sh);

 

var canvas:BitmapData = new BitmapData(sw, sh, false, 0x000000);

var buffer:BitmapData = new BitmapData(sw, sh, false, 0x000000);

var feed  :BitmapData = new BitmapData(sw, sh, false, 0x000000);

var prev  :BitmapData = [...]

Posted in BitmapData, Video, graphics algorithms, pixel manipulation | Tagged , , | 5 Comments

Functions as Object Review

Something I do a fair bit on this website is use functions as objects. Here is a simple example post on wonderfl. Timeline code and a brief description are available below.
Function Use - wonderfl build flash online
Here is a still of what it generates and below you'll find the timeline as code:

CLICK HERE TO COPY
Actionscript:

[SWF(width [...]

Posted in BitmapData, functions | Tagged , , | 7 Comments

Bracket Syntax Reminder

If you haven't looked at every post on this site it's possible you've missed one of my favorite actionscript features.... Bracket Syntax:
CLICK HERE TO COPY
Actionscript:

var s:Sprite = Sprite(addChild(new Sprite()));

s["x"] = 100;

s["y"] = 100;

 

s["graphics"]["beginFill"](0xFF0000);

s["graphics"]["drawCircle"](0,0,10);

 

this["addChild"](s);

If you don't realize how powerful this is then there is something wrong with you (joking). If you don't see how powerful this [...]

Posted in dynamic, functions | Tagged , , | 4 Comments

URLVariables Replacement

CLICK HERE TO COPY
Actionscript:

function decode(str:String):Object {

    var vars:Object={};

    var parse:Array =str.split("&");

    var i:int=0;

    for (i = 0; i<parse.length; i++) {

        var pair:Array=parse[i].split("=");

        if (pair.length==2) {

            vars[pair[0]]=pair[1];

        }

    }

    return vars;

}

 

var nameValuePairs="one=1&&two=éllo&three=1000&four=0xFF0000";

var parsed:Object=decode(nameValuePairs);

 

trace(parsed.one);

trace(parsed.two);

trace(parsed.three);

trace(parsed.four);

 

/*outputs:

1

éllo

1000

0xFF0000

*/

Well not exactly [...]

Posted in external data, string manipulation, strings | Tagged , , | 3 Comments