Author Archives: Zevan

ActionScript Eval (well, not really)

CLICK HERE TO COPY
Actionscript:

var txt:TextField = TextField(addChild(new TextField()));

txt.autoSize = TextFieldAutoSize.LEFT;

 

var myVar:Number = 100;

// works as an expression parser

txt.text = js("return (" + myVar + " * 2 + 10) / 2");

txt.appendText("\n\n");

 

// parses javascript

txt.appendText(js("var a = []; for (var i = 0; i<10; i++){ a.push(i) } return a;"));

 

function js( data:String ):*{

   var res:*= ExternalInterface.call("function(){" + data [...]

Posted in Math, external data, functions, misc, string manipulation, strings | Tagged , , | Leave a comment

E8 Inspired Forms

This doesn't have much to do with E8.. but it is vaguely inspired by it...

View the demo... (source code is below)

CLICK HERE TO COPY
Actionscript:

var hw:Number = stage.stageWidth / 2;

var hh:Number = stage.stageHeight / 2;

 

var canvas:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight, false, 0x333333);

addChild(new Bitmap(canvas));

var vector:Shape = Shape(addChild(new Shape()));

 

// contrast

var cm:ColorMatrixFilter = new ColorMatrixFilter([2.6,0,0,0,-101.6,0,2.6,0,0,-101.6,0,0,2.6,0,-101.6,0,0,0,1,0]);

filters = [cm];

 

var over:BitmapData = new [...]

Posted in BitmapData, Math, misc | Tagged , , | Leave a comment

QuickBox2D Mini-Machine

Since this is a rather large snippet check out this demo first:

View Demo...

and here is the source:
CLICK HERE TO COPY
Actionscript:

import com.actionsnippet.qbox.*

import Box2D.Collision.Shapes.*;

import Box2D.Common.Math.*;

 

[SWF(width = 800, height = 600, backgroundColor = 0x000000, frameRate = 60)]

 

var sim:QuickBox2D = new QuickBox2D(this, {debug:true});

 

var sw:Number = stage.stageWidth / 30;

var sh:Number = stage.stageHeight / 30;

           

sim.addBox({x:sw [...]

Posted in Box2D, QuickBox2D | Tagged , , , , | 9 Comments

QuickFRIM

CLICK HERE TO COPY
Actionscript:

import com.actionsnippet.animation.*;

 

stage.frameRate = 60.0;

 

// args: main display object, Hz

var frim:QuickFRIM = new QuickFRIM(this, 60.0);

 

// start QuickFRIM internal loop

frim.start();

 

// listen for step and render

frim.addEventListener(QuickFRIM.STEP, onStep);

frim.addEventListener(QuickFRIM.RENDER, onRender);

 

// happes from 0 or more times per frame depending on your framerate and desired Hz

function onStep(evt:Event):void {

     //

}

 

// happens once per frame after all STEP events [...]

Posted in motion | Tagged , , | Leave a comment