Password protected content in Flash with ActionScript 3 and PHP

This morning I was browsing through the gotoAndLearn forum and I saw a question about how to make a password protected section in a Flash site. So, I made a quick example and I thought I should share it with all my readers too 😉

Read more
ActionScript 3 YouTube feed application

A few days ago I made a little application based on the new ActionScript 3 YouTube API and I thought I should share it with those who want to get started with this type of players. In the future I plan to make some more complex applications based on this API so I can sell them on ActiveDen.net

Read more
Drawing app

Right now I’m still reading “Learning ActionScript 3.0” book so I can improve my AS 3 skills. In the “Draving with pixels” chapter there is a great example of a little drawing application that I like. Here you can see the code for that little application:

var mouseIsDown:Boolean;
var erasing:Boolean;
 
var canvas:Sprite = new Sprite();
addChild(canvas);
 
var w:Number = stage.stageWidth;
var h:Number = stage.stageHeight;
var bmd:BitmapData = new BitmapData(w, h, false, 0xffffffff);
var bm:Bitmap = new Bitmap(bmd);
canvas.addChild(bm);
 
var brush:Sprite = createBrush(0x66cc00);
var eraser:Sprite = createBrush(0xffffff);
 
function createBrush(col:uint):Sprite{
	var sp:Sprite = new Sprite();
	sp.graphics.beginFill(col, 1);
	sp.graphics.drawCircle(0, 0, 30);
	sp.graphics.endFill();
	return sp;
}
 
canvas.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
canvas.addEventListener(MouseEvent.MOUSE_UP, onUp);
this.addEventListener(Event.ENTER_FRAME, onLoop);
 
function onDown(e:MouseEvent):void{
	mouseIsDown = true;
	if(e.shiftKey)
		erasing = true;
}
 
function onUp(e:MouseEvent):void{
	mouseIsDown = false;
	erasing = false;
}
 
function onLoop(e:Event):void{
	if(mouseIsDown && erasing){
		eraser.x = mouseX;
		eraser.y = mouseY;
		bmd.draw(eraser, eraser.transform.matrix);
	}else if(mouseIsDown){
		brush.x = mouseX;
		brush.y = mouseY;
		bmd.draw(brush, brush.transform.matrix);
	}
}

And if you click here you can see the result (click to draw and hold the shift key + click to erase)
This book has a lot of good examples and it’s very easy to understand. I recommend it to anyone how wants to start with ActionScript 3.0 😉

Changes

Today I got my first glasses ever and two new books about flash and ActionScript.

books and glasses2

So those are the books I got:

I have to say that it feels weir to have glasses. I think I have to stick with them a little and then every thing will be back to normal. And by the way, I didn’t know how much I was missing without the glasses 😀