plus-api-as3 is a library to use Google+ API. It allows developers to create mobile applications and games for Android and iOS connected to Google+, facilitating the communication through the use of Google+ API connectivity. Using the methods related to people, it’s possible to read profile information, as well as search, get, list, and list by activity.

Using the methods related to activities, it’s possible to load, search, list and get user activities. The library also allows access to comments and moments, with methods to list and fetch those information.



ND2Dx is a 2D GPU accelerated game engine. It is a big revision of the already existing ND2D engine, but with several changes. ND2Dx is based on a component entity system, where the common object (or entity) is Node2D. It is a very basic object that acts like a DisplayObjectContainer in flash. It has transformation properties (x, y, scaleX, scaleY), color properties (alpha, tint), can contain components and acts as a container for other Node2D objects.

In order to show something, a rendering component is required. This rendering component is added to the node itself, making it able to appear on the screen. The built-in MeshRendererComponent, which uses the same concept used by Unity game engine, can contain a Material and a Mesh2D object. The Material object holds the texture and shader data. The Mesh2D object holds the vertices that will make the triangles required to show something on screen.


public var world2D:World2D;
public var gameScene:GameScene;

public function Main() {
    addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);

private function onAddedToStageHandler(e:Event):void {
    removeEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);

    // init our assets

    // this is our main and primary object for ND2Dx, it automatically
    // configures itself to take the size and framerate of our document
    // you only need to create one
    world2D = new World2D();

    // we need to add it to the stage in order for it to setup itself

    // a scene is necessary to start rendering anything it is a more
    // convenient way of managing different parts of our game
    // (main menu, secondary menus, game, other screens...)
    // as you can switch between them easily
    gameScene = new GameScene();

    // set our scene as the active one

    // and start the rendering process


Inspector is tool to peek inside SWF files. Working as an AIR application and built on top of as3swf, the tool has a complete GUI to inspect the files. It’s possible to see tags, movieclips (with their timeline) and shapes. Regarding shapes, a developer can export them to a JSON file.

The tool is under development, but some new features are planned. Among them are animations (positioning on stage, masking etc., make selecting a frame easier/work), Fonts (display them, add export), Bitmaps (add export), Tags (display proper bytecode for DoAction, DoABC etc).




b2dLite is a quick Stage3D quad rendering engine. It batches the draw calls automatically, drastically improving the application performance. In order to take full advantage of the lib,  a developer must use spritesheets, trying to draw objects with the same texture together, which avoids context switches.

The lib has an API that is easy to use and understand. It starts with the instantiation of a b2dLite object, which will be used to performed all the drawing. After the object must initialized with on of the two rendering methods (state or context). Once it’s ready, a developer can create a texture and draw it as many times as needed. The developer is responsible for clearing the rendering buffer before any new frame is rendered.


public class Main extends Sprite 
    private var b2d:b2dLite;
    private var textureMap:BitmapData;
    private var texture:Texture;

    public function Main():void {
        if (stage) init();
        else addEventListener(Event.ADDED_TO_STAGE, init);

    private function init(e:Event = null):void  {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        // entry point          
        b2d = new b2dLite();
        b2d.initializeFromStage(stage, start, 512, 512);

    private function start():void {
        textureMap = new BitmapData(32, 32, false, 0xFF0000);
        texture = b2d.createTexture(textureMap);

        stage.addEventListener(Event.ENTER_FRAME, update);

    private function update(e:Event):void {
        //draw stuff
        b2d.renderQuad(32, 32, stage.mouseX, stage.mouseY, texture);
Comments Off on b2dLite

Codebot devlog 002 – alpha status

This post is part of a series describing the development of Codebot, an open-source IDE focused on game development. Check out the other posts of the series here.

I’ve been quiet about Codebot lately, but that’s for a good reason: I was really busy working on it :). This week I was still on vacation and at home, so I was able to work on Codebot almost full-time. I closed almost all open issues on the alpha milestone, which gives the project an “alpha” status. Here’s a nice gif:

Codebot devlog 002 - Overall

The main goal of this milestone was to create a code editor powered by a filesystem panel, where the user could open a folder (something like a project), then move, create, delete and edit files/folders. That’s the bare minimum I needed to start using Codebot as my day-to-day editor. And I did it! From now on, I will use Codebot to develop Codebot itself instead of using Brackets.

In order to make Codebot usable, I focused on improving and fixing several small details, e.g. a dialog to ask what to do with unsaved changes. Codebot still has a lot of (really) rough edges regarding usability and stability, but it’s usable.

Right now I’m working on issues of the beta milestone. Most of them are intended to iron out the application, laying down the foundations for the first release. One of the issues I managed to implement was the stackable panels, which are a key part of the “magic slide panels” idea. Here is a demo:

Codebot devlog 002 - Stackable panels

This panel is using the first version of the plugin’s API, which will be used to create all sorts of awesome features in the future. I’m planning to ship the first release of Codebot with a slide panel about SFX/music.

As a side note, I switched from CodeMirror to Ace as the internal code editing lib. That was easier than I expected and as a bonus I got find/replace already built-in:

Codebot devlog 002 - Find and replace

I also got lots of themes and an easy way to switch among them:

Codebot devlog 002 - Themes

University classes will start next week, so my development spree will end. After I close all issues in the beta milestone, Codebot should be usable by other developers. When that happens, I will start sending kind e-mails (begging) asking for some feedback :)

There’s a lot more to come, stay tuned!

codebot gamedev IDE


NativeMailExtension is a native extension to use an in-app mail composer on iOS. After instantiating an object of the extension, a developer can call two methods: one to check if the extension is available for use and other to use the in-app mail composer. This last method receives several parameters, such as the message subject/body and to/cc/bcc. It’s also possible to attach files from the file system, changing its original name.

The extension also provides a set of events useful to monitor the process. Some of those events are fired when the mail was canceled, saved, sent or when something failed.


Messaging = new MailExtension();
Messaging.addEventListener(MailExtensionEvent.MAIL_COMPOSER_EVENT, onMailEvent);

var fileToAttach:File = File.documentsDirectory.resolvePath('Example file.dat');

	"Hello", "You can use HTML on the message too!", 
Comments Off on NativeMailExtension


ANE-RecordAudio is a native extension to record and Convert audio in many formats. The extension can record a single stream at a time, which means it has some sort of global state. When a developer wants to record something, a method must be invoked. Another method can be invoked to stop the recording. All subsequent method calls will operate over the recorded data, e.g. play it.

The extension has a significant range of file formats, such as AC3, MPEG4 AAC, MPEG Layer3, and more. The format can be informed before the recording process begins. It’s also possible to choose the name of the resulting file and its sample rate. After the file has been recorded, the extension allows it to be converted to mp3 or AMR. An AMR file can be played by the extension.


}, 3000);

        var f:File = new File(url);
        trace(f.exists, url);

}, 6000);

        var f:File = new File(url);
        trace(f.exists, url);

}, 8000);


GeoCapabilities is a native extension designed to expose more granular information on whether GPS is enabled or disabled. Geolocation API only tells if access has been denied to location information. The extension tells whether GPS is turned on or not, or if Network-based location has been denied.

The extension  allows a developer to listen for status events from location providers, tell how long it took to get the first GPS fix, and to use the addProximityAlert() method of the Android API to listen for an event when within a certain radius of a given point. GPS status events are dispatched only after an application attempts to use the GPS. GPS status events can also be dispatched when Network location providers (wi-fi and towers) are disabled or enabled. The extension API has methods to stop and start the events, which help prevent battery draining.


var geo:GeoCapabilities;
var airGeo:Geolocation;

if( Geolocation.isSupported && !airGeo ) {
	airGeo = new Geolocation();
	airGeo.addEventListener( GeolocationEvent.UPDATE, _onGPSUpdate );
	airGeo.setRequestedUpdateInterval( 20000 );

	geo = new GeoCapabilities();
	geo.addEventListener( StatusEvent.STATUS, _onStatusEvent );
	geo.addEventListener( ProviderStatusChangeEvent.GPS_STATUS_CHANGED, _onGPSStatusEvent );
	geo.addEventListener( ProviderStatusChangeEvent.NETWORK_STATUS_CHANGED, _onNetworkStatusEvent );
	geo.addEventListener( ProximityAlertEvent.PROXIMITY_ALERT, _onProximityAlert );

function _onStatusEvent( event:StatusEvent ):void {
	trace( 'test received status event ' + event.level );

function _onGPSStatusEvent( event:ProviderStatusChangeEvent ):void {
	if( event.status == GPSStatus.GPS_STARTED || event.status == GPSStatus.GPS_STOPPED ) {

	} else if( event.status == GPSStatus.GPS_FIRST_FIX ) {


function _onNetworkStatusEvent( event:ProviderStatusChangeEvent ):void {
	if( event.status == NetworkStatus.AVAILABLE || event.status == NetworkStatus.ENABLED || 
		event.status == NetworkStatus.OUT_OF_SERVICE || event.status == NetworkStatus.DISABLED ) {

function _onProximityAlert( event:ProximityAlertEvent ):void {

function _onGPSUpdate( event:GeolocationEvent ):void {



ChunkEMail is native extension designed to use the Android email composer to send emails. Even though a developer can launch the e-mail composer using a mailto: link in a navigateToURL() call, there are limitations in that approach, such as the number of characters. The extension is useful, for instance, when the e-mail must be populated with a big chunk text.

The extension works using the singleton pattern and its most important method is sendMail(), used to open the email composer. When invoking that method, a developer can specify the destination address, subject, body (email text), title, cc and bcc addresses.


if(ChunkEMail.getInstance().isSupported()) {
  sendMail('', 'Hi from ANE', 'This is the message');
Comments Off on ChunkEMail


NSLibrary is a set of utility classes for developing pure AS3 project. It consists of several helper classes ranging from text fields to keyboard listeners. The TextField class has invalidation and is based on TLF to work with DF4 fonts. The DataManager class is a wrapper for the SharedObjectRollButton and ControlledMovieClip allow a developer to create fancy buttons and handmade auxiliary animations.

The Transform class helps scale and align components in dedicated frames. CurvedPath creates complex shapes with rounded corners. The library also has SFXEngine, which is a manager for sound channels. Finally CodeListener and KeyListener are keyboard helpers with some quite useful methods, such as the ability to register magic words for callback.


// Textfield
//Specify base class as RollButton in the Flash Professional or create it:
var button: RollButton = new RollButton(new SomeMovieClip());

var myClip: ControlledMovieClip = new SomePredefinedMovieClip();

// DataManager
//Save state, where Cache.SOUNDS, Cache.DOMAIN - some strings
DataManager.getInstance().registerVar(player.isSoundsPlaying, Cache.SOUNDS, Cache.DOMAIN);

//Restore state
private function restoreSoundsState():Boolean {
    var isSet:Object = DataManager.getInstance().getValue(Cache.SOUNDS, Cache.DOMAIN);

    if (isSet != null) {
        var soundState:Boolean = Boolean(isSet);
        SoundMixer.soundTransform = new SoundTransform(int(soundState));
        return soundState;

    return true;
Comments Off on NSLibrary


SWFWire is a set of tools for Flash development. It has three main components: an inspector, a debugger and a decompiler. The inspector is an AIR application for viewing images, shapes, and even syntax-highlighted AS3 within SWF files. It’s useful to check what parts of the code are taking up the most space or making sure sensitive data isn’t being exposed. Among its features are the ability to view the data structure of each tag in the swf, preview vector shapes and JPEG images and examine classes.

The debugger is an AIR application with several features, such as a  console tab to see the full trace of function calls, a tab to view and change object properties, a tab to track object creation, ability to inspect DisplayObjects, a network tab to view the status of files loaded by URLLoaders. It’s also possible to check FPS, memory usage and , object count graph to quickly monitor performance, custom FlashVars,  save loaded and recompiled SWF files and take one-click snapshots.


// Parse a SWF file and view the result.
public function parse(bytes:ByteArray):void {
    var reader:AsyncSWFReader = new AsyncSWFReader();

    reader.addEventListener(AsyncSWFReaderEvent.TAG_READ, tagReadHandler);
    reader.addEventListener(AsyncSWFReaderEvent.READ_COMPLETE, completeHandler); SWFByteArray(bytes));

private function tagReadHandler(ev:AsyncSWFReaderEvent):void {
    var current:uint = ev.context.bytes.getBytePosition();
    var max:uint = ev.context.bytes.getLength();
    trace('Read '+current+' bytes out of '+max);

private function completeHandler(ev:AsyncSWFReaderEvent):void {


RevMob is a native extension to display ads from RevMov network. RevMob is a worldwide leading ad network when it comes to mobile traffic monetization. The company delivers its publishers with eCPMs well above the average of the industry with a simple SDK implementation. To achieve this they have built a sophisticated campaign targeting algorithm, which maximizes return for both publishers and advertisers.

The native extension allows a developer to use all ad types available, such as fullscreen, banner, link and popup. It’s also possible to use events, which are fired for every important change in the ad state, which can be used to check if an ad was loaded or clicked. The extension has a test mode that displays ads but doesn’t count their clicks/installs/etc nor include them in the statistics.


var appId:String = null;
if (isIOS()) {
    appId = IOS_APP_ID;
} else if (isAndroid()) {
    appId = ANDROID_APP_ID;
var revmob:RevMob = new RevMob(appId);
// fullscreen

// banner   
// the origin (0, 0) is the top left corner of the screen
var positionX:int = 10;
var positionY:int = 10;
var width:int = 400;
var height:int = 60;
revmob.showBanner(positionX, positionY, width, height);

// link

// popup

Facebook For Games

Facebook For Games is a library to facilitate the authentication process of Facebook games. It is an extension of the Facebook Actionscript API, which is packaged within the library with some changes, providing methods for authentication with the ability to check if a user has logged-in within a Facebook web games. The library takes care of all the work related to logging in the user, if they are not logged in already.

Once the game is authenticated, it’s possible to get access to the game’s and user’s scores. The library also makes it extremely easy to save the score to Facebook and to share or post it to the user’s wall.

Main classes:

  • FacebookForGames – handles the authentication and login all under the hood.
  • ShareManager – Allows you to post the the users wall or open a share link popup.
  • ScoreManager – Allows you to get the scores for the game, for the user and the user’s frinds. Also allows you to save the user’s score.
  • FacebookGameModel – Holds all the pertinent session, user and game data.

Data objects:

  • FacebookUser – Holds all the pertinent information for the currently logged in user. An instance of this class for the current user is saved in FacebookGameModel.
  • Score – Holds the score data including the application name and id and also the user name and id as well as their score.



	import com.facebook.graph.controls.Distractor;
	import com.reycogames.facebook.FacebookForGames;
	import com.reycogames.facebook.manager.ScoreManager;
	import com.reycogames.facebook.manager.ShareManager;
	import com.reycogames.facebook.model.FacebookGameModel;

	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;

	[SWF( width="600", height="450", frameRate="60" )]
	public class FacebookGraphTest extends Sprite
		private var appID:String        = "";
		private var appSecret:String    = "";
		private var permissions:Array   = [ "publish_stream" ];
		private var distractor:Distractor;

		private var someRandomScore:int = 500;

		public function FacebookGraphTest() {
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;

			distractor = new Distractor();
			distractor.text = "Loading";
			addChild( distractor );

			FacebookForGames.authenticate( appID, appSecret, permissions, handleFBInit );

		private function handleFBInit( facebookUser:FacebookUser ):void {
			removeChild( distractor );
			distractor = null;

			trace( FacebookGameModel.currentUser.first_name + " is ready to go!" );
			ScoreManager.getScoresForGame( handleGotScores );

		private function handleGotScores( scores:Vector. ):void {
			for (var a:int = 0; a < scores.length; a++) {
				trace( scores[a].userName, scores[a].score );


		private function sendScores():void {
			ScoreManager.postScore( someRandomScore, handleScorePosted );

		private function handleScorePosted():void {
			trace( "score saved" );

			var postToWallProps:PostToWallProperties = new PostToWallProperties(); = " I just scored " + someRandomScore + "!";
			postToWallProps.description = "[some description about your game]"; = "http://[link to my game].com";
			postToWallProps.picture = "http://[some link to an image]";

			ShareManager.postToWall( postToWallProps, handlePostSuccess );

		private function handlePostSuccess( result:Object ):void {
			trace( "score shared on wall" );


iBeacon is a native extension to monitor iBeacon signals. iBeacon is a technology that extends Location Services in iOS 7, allowing devices to alert apps when they approach or leave a location with iBeacons. In addition to monitoring a location, an app can estimate its proximity to an iBeacon (immediate, near or far proximity). The system uses a low energy bluetooth signal which can be detected by iPhone or iPad devices.

The extension allows a developer to register a beacon region by passing an UUID and an identifier (e.g. UUID: “F0BCDC1E-7366-43A7-BDD3-29C289D1A6B3″, identifier:”your company name”). It can start and stop the monitoring of iBeacons (it scans for all major and minor values), including a custom event that transfers the current iBeacon information from nearby signals. It also provides the number of ibeacons, range (immediate, near, far), rssi (received signal strength indicator in dB), major and minor value, accuracy, identifier  and uuid.


import com.caffaware.extensions.ibeaconane.Ibeaconane;
import com.caffaware.extensions.ibeaconane.Beaconevent;

var _ibeacon:Ibeaconane = new Ibeaconane();
_ibeacon.addEventListener(StatusEvent.STATUS, onStatusEvent);
_ibeacon.addEventListener(Beaconevent.BEACONS_FOUND, beaconsFound);
_ibeacon.registerBeacons("your UUID","your beacons identifier");


function onStatusEvent(event:StatusEvent):void {

function beaconsFound(event:Beaconevent):void {
  trace("Number of beacons found: "+event.beacons.length);

  for(var i:int = 0;i < event.beacons.length; i++) {


ANE-CameraRoll is a native extension to access the CameraRoll of a mobile device (iOS only for now). It has a significant set of methods available, including synchronous and a asynchronous ones. A developer is able to load thumbnails and images differently, which means an application can show a set of small images before loading their full resolution correspondents, for instance.

Some methods receive an index and an amount of images to load, which can be used to create pagination. It’s also possible to load a specific image using its URL. Several methods fire events, e.g. an image was loaded, and some methods are exclusively dedicated to get image information, such as resolution.


public function LoadImagesExample() {
	_roll = new CameraRollExtension();
	// first do the thumbnail size determination
	trace("first the thumbnail default size...");
		function(e:PhotoAppEvent):void {
			var data:PhotoDimensions = as PhotoDimensions;
			trace("thumbnail dimensions are " + data.width + "x" + data.height);