EZFLAR icon indicating copy to clipboard operation
EZFLAR copied to clipboard

a little wrap to ez the augmented reality works

h2. The EZest way

Ok, download the package of thinks and put this on your frame:

	import com.tchatcho.EZflar;//tcha-tcho.com
	import com.transmote.flar.FLARMarkerEvent;		
	private var _ezflar:EZflar;
	private var _symbols:Array = new Array();
	_symbols.push([["EZFLAR.pat", "cube"]]);//0
	_ezflar = new EZflar( _symbols );
	_ezflar.initializer(stage);

h2. A full complex case

initiate your code

	import com.tchatcho.EZflar;
	import com.transmote.flar.FLARMarkerEvent;	
	var _ezflar:EZflar;
	var _symbols:Array = new Array();

_symbols will take all your markers and models and work with this in couples... ezflar can handle a lot of formats for you, so enjoy :) you can also create names for your models to group or to access this models for your names later. Look how to do that in "myoptionalname". The markers will be access by your numbers, so remember that: begin with 0

	_symbols.push([["EZFLAR0.pat", "swffilename.swf"],["myoptionalname"]]);//0
	_symbols.push([["EZFLAR1.pat", "flvfilename.flv"]]);//1
	_symbols.push([["EZFLAR2.pat", "daefilename.dae", "OPTIONALtexture.jpg"]]);//2
	_symbols.push([["EZFLAR3.pat", "md2filename.md2", "OPTIONALtexture.jpg"]]);//3
	_symbols.push([["EZFLAR4.pat", "picturename.jpg"]]);//4
	_symbols.push([["EZFLAR5.pat", "picturename.jpeg"]]);//5
	_symbols.push([["EZFLAR6.pat", "picturename.png"]]);//6
	_symbols.push([["EZFLAR7.pat", "picturename.gif"]]);//7
	_symbols.push([["EZFLAR8.pat", "audioname.mp3"]]);//8
	_symbols.push([["EZFLAR9.pat", "text", "here goes my text up to 40 chars"]]);//9
	_symbols.push([["EZFLAR10.pat", "twitter", "nameoflogin"]]);//10
	_symbols.push([["EZFLAR11.pat", "url", "http//www.myexample.com"]]);//11
	_symbols.push([["EZFLAR12.pat", "cube", "OPTIONALtexture.jpg"]]);//12
	_symbols.push([["EZFLAR13.pat", "wire"]]);//13
	_symbols.push([["EZFLAR14.pat", "empty"]]);//14

Note about twitter: im a ruby developer, i dont know much about AS3. Connect Twitter from a external server need some adjustments in cross domain think. I made this by usin a rails server... someone can help me with this cross domain issues?

Now its time to build our AR optionally you can give: size, framerate and etc.

	_ezflar = new EZflar(_symbols);

lets begin! you can put your AR in any DisplayObject, like MovieClip or in this case "stage" if your resources folder is in other place than your swf folder then you can give this path in another argument in a string

	_ezflar.initializer(stage);

when ezflar dont find a camera he gonna show a message :) you can customize this message for your language and etc. the second color is the font color, the last is the background

	_ezflar.customizeNoCam("Precisamos de uma webcam", 0xFFFFFF, 0xCCCCCC);

checkout how your software are responding your changes with a framerate

	_ezflar.viewFrameRate();

is a little annoying to play with AR with the webcam going to the wrong way you can mirror the image, and de-mirror when you want

	_ezflar.mirror();

this will make somethink when your app start

	_ezflar.onStarted(function():void {
		trace("hey! im alive!");

		//you can work with more than one model for marker!!
		//ez like that to add more thinks to some marker
		_ezflar.addModelTo([1,"wire"]);//1 is the number of the _symbols remember?
		_ezflar.addModelTo([0,"cube", "OPTIONALtexture.jpg"], ["thecube"]);//here you can give names too
	});

and you have methods ready to work when markers are showed to the cam

	_ezflar.onAdded(function(marker:FLARMarkerEvent):void {
		//hey! remember the names you gave?? you can pick models and change it!
		_ezflar.getObject(0,"myoptionalname").rotationX = 90;
		_ezflar.getObject(0,"thecube").rotationZ = 270;
		_ezflar.getObject(3);//if you dont have a name he gonna take all without a name :P
	});

this will be used in each frame rendered

	_ezflar.onUpdated(function(marker:FLARMarkerEvent):void {
		//he returns this marker that you can use to look where the markers are and etc.
		trace("["+ marker.marker.patternId+"]>>" +
		"X:" + marker.x() + " || " +
		"Y:" + marker.y() + " || " +
		"Z:" + marker.z() + " || " +
		"RX:" + marker.rotationX() + " || " +
		"RY:" + marker.rotationY() + " || " +
		"RZ:" + marker.rotationZ() + " || "
		);
	});

play around with ezflar... we are in beta now and a lot of work to do.. pls help us :)

	_ezflar.onRemoved(function(marker:FLARMarkerEvent):void {
	});