Skip to content

Instantly share code, notes, and snippets.

@loteixeira
loteixeira / IntPoint.as
Created August 11, 2013 02:41
Pack a point in a 32 bit unsigned integer value (uint) - each component uses 2 bytes. Thus, you work with points (x,y) as primitive value instead of objects (like flash.geom.Point class)
package
{
/**
* Packs a point in a uint (32 bit unsigned integer) primitive value.
* The advantage of using it instead of regular Point objects is that
* you won't create any object. Each point is a uint, thus it behaves
* as a primitive value (no memory allocation needed to use/copy it).
*
* Each component uses 2 bytes:
* x: 0xffff0000 - high bytes
@loteixeira
loteixeira / TimeCounter.as
Last active December 18, 2015 23:19
AS3 TimeCounter
//
// TimeCounter
// Copyright (C) 2013 Lucas Teixeira (Disturbed Coder)
// Profile page: https://github.com/loteixeira
//
// This software is distribuited under the terms of the WTFPL
// http://www.wtfpl.net/txt/copying/
//
package
{
@loteixeira
loteixeira / Pixel.as
Last active December 17, 2015 16:19
AS3 Pixel Conversion Utils - supports uint, Array and Object.
//
// AS3 Pixel Conversion Utils
// Copyright (C) 2013 Lucas Teixeira (Disturbed Coder)
// Profile page: https://github.com/loteixeira
//
// This software is distribuited under the terms of the WTFPL
// http://www.wtfpl.net/txt/copying/
//
package
{
@loteixeira
loteixeira / JSEventDispatcher.as
Created February 26, 2013 01:38
JSEventDispatcher as3 class created for the project https://github.com/vebersol/flash-fallback-player. The interface is very similar to native EventDispatcher class - and as the name suggests - the class creates a bridge between JS and Flash. Usage: var jsDispatcher:JSEventDispatcher = new JSEventDispatcher("addEvent", "removeEvent");
package {
import flash.external.ExternalInterface;
/**
* @author Lucas Teixeira (https://github.com/loteixeira)
* @date Feb 22, 2013
*/
public class JSEventDispatcher {
private var listeners:Object;