Skip to content

Instantly share code, notes, and snippets.

View rafaelrinaldi's full-sized avatar

Rafael Rinaldi rafaelrinaldi

View GitHub Profile
@rafaelrinaldi
rafaelrinaldi / randRange.as
Created February 11, 2011 13:53
Get a random number between any two numbers.
package tea.number
{
/**
* Get a random number between any two numbers.
*
* http://help.adobe.com/cs_CZ/AS2LCR/Flash_10.0/help.html?content=00001226.html
*
* @param p_start The first number.
* @param p_end The last number.
*
@rafaelrinaldi
rafaelrinaldi / place.as
Created February 18, 2011 00:03
Just align an object (anyone with x&y properties) based on a Point instance.
package tea.util
{
import flash.geom.Point;
/**
*
* Just align an object (anyone with x&y properties) based on a Point instance.
*
* @param p_object Object to be aligned.
@rafaelrinaldi
rafaelrinaldi / getPlaceHolder.as
Created February 18, 2011 13:33
Implementation of Bota's (ialmeida.com) "getPlaceHolder()".
package tea.display
{
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.Stage;
import flash.geom.Rectangle;
/**
*
@rafaelrinaldi
rafaelrinaldi / dispatch.as
Created February 24, 2011 17:57
Notify a new entry to an IEventDispatcher instance.
package tea.util
{
import flash.events.Event;
import flash.events.IEventDispatcher;
public function dispatch( p_dispatcher : IEventDispatcher, p_event : Object ) : void
{
if(p_event is String) {
p_dispatcher.dispatchEvent(new Event(p_event));
@rafaelrinaldi
rafaelrinaldi / toBitmap.as
Created February 25, 2011 21:44
Easy way to create a Bitmap instance based on a view.
package tea.display
{
import flash.display.Bitmap;
import flash.text.TextField;
import flash.display.Stage;
import flash.display.BitmapData;
import flash.display.BitmapDataChannel;
/**
@rafaelrinaldi
rafaelrinaldi / drawRect.as
Created March 1, 2011 01:18
Easy way to create a visible rectangle with basic parameters.
package tea.display
{
import flash.display.Sprite;
import flash.geom.Rectangle;
import tea.util.isUnassigned; // https://gist.github.com/848476
/**
*
* Easy way to create a visible rectangle with basic parameters.
@rafaelrinaldi
rafaelrinaldi / isUnassigned.as
Created March 1, 2011 02:16
Easy way to check if a value is unassigned or not.
package tea.util
{
/**
*
* Easy way to check if a value is unassigned or not.
*
* @param p_value Value to check.
* @return True if the value is unassigned, false otherwise.
*/
@rafaelrinaldi
rafaelrinaldi / isPublished.as
Created March 2, 2011 00:38
Easy way to check if the application is running online or locally.
package tea.util
{
import tea.util.isStandalone;
import flash.display.DisplayObjectContainer;
/**
*
* Easy way to check if the application is running online or locally.
*
* @param p_root Application root.
@rafaelrinaldi
rafaelrinaldi / drawRect.as
Created March 3, 2011 01:11
Easiest way to create a rectangle!
package tea.display
{
import flash.display.GradientType;
import flash.display.InterpolationMethod;
import flash.display.SpreadMethod;
import flash.display.Sprite;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.display.LineScaleMode;
@rafaelrinaldi
rafaelrinaldi / batch.as
Created March 16, 2011 20:27
Easy way to set the same properties set for multiple items.
package tea.util
{
/**
*
* Easy way to set the same properties set for multiple items.
*
* @param p_items Items to be processed.
* @param p_properties Properties to be setted.
*