Author Archives: Zevan

Project Time-bomb

CLICK HERE TO COPY
Actionscript:

var d:Date = new Date()

// payment deadline

var payMonth:int = 9;

var payDay:int = 5;

// add five days so it's not too obvious and so you can replace

// the swf on their server if they do pay

payDay+=5;

if (d.getMonth()>= payMonth){

    if (d.getDay()>= payDay){

        // very nasty code to crash flash, alternately [...]

Posted in misc | Tagged , , | 3 Comments

Is this swf in a container?

CLICK HERE TO COPY
Actionscript:

if(parent == stage){

   // no container

}else{

  // has container

}

Found myself writing this snippet today.... it figures out if the current swf is inside a container (Loader) or not... lots of other ways to do this... feel free to post your version in the comments...

Posted in Loader, external data, misc | Tagged , , | 5 Comments

ActionSnippet Contest

I started ActionSnippet last year in October. Excluding the last few months I posted pretty much everyday... resulting in about 350 posts including this one. If you haven't spent time looking at some of the early posts... I recommend digging around as there are lots of very compact tips and tricks... have a look (scroll [...]

Posted in Uncategorized | Tagged , , , | 11 Comments

JS Sketch Experiment

CLICK HERE TO COPY
Actionscript:

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

with (graphics) beginFill(0xefefef), drawRect(0,0,stage.stageWidth, stage.stageHeight);

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

with (btn.graphics) beginFill(0x666666), drawRect(0,0,100,20);

with(btn)  x=320, y=430, buttonMode = true;

btn.addEventListener(MouseEvent.ROLL_OVER, function():void{

  with(btn.graphics) clear(), beginFill(0x222222), drawRect(0,0,100,20);

});

btn.addEventListener(MouseEvent.ROLL_OUT, function():void{

  with(btn.graphics) clear(), beginFill(0x666666), drawRect(0,0,100,20);

});

btn.addEventListener(MouseEvent.CLICK, function():void{

    var res:*= ExternalInterface.call("function(){ plot=[]; colors=[]; " + txt.text + " return {plot:plot, colors:colors};}");

    render((res == null) ? {plot:[], colors:[]} : res);

});

 

var [...]

Posted in Graphics, Math, dynamic, external data, functions | Tagged , , , | Leave a comment