Skip to content

Instantly share code, notes, and snippets.

@fenixkim
fenixkim / gist:821547
Created February 10, 2011 22:55
Adding Social Networks to ShareButton
import gT.display.shareButton.*;
var settings:Object = {
itemWidth: 48,
items: [{id:"twitter", icon:"twitter-48x48.png"},
{id:"facebook", icon:"facebook-48x48.png"}]
}
var sb:ShareButton = new ShareButton;
sb.initWithObject(settings);
@fenixkim
fenixkim / ScaleBitmap.as
Created September 19, 2012 15:41 — forked from didierbrun/ScaleBitmap.as
ScaleBitmap and ScaleBitmapSprite
/**
*
*
* ScaleBitmap
*
* @author Didier Brun
* @author Jerôme Decoster
* @version 1.1
*
*/
@fenixkim
fenixkim / Stats.as
Created September 19, 2012 15:56
HI-Res-Stats AS3 class from Mr.doob
/**
* stats.as
* https://github.com/mrdoob/Hi-ReS-Stats
*
* Released under MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* How to use:
*
* addChild( new Stats() );
@fenixkim
fenixkim / DivideArray.as
Last active December 11, 2015 11:58
Divide an array object in equals parts
/**
Divide array in equal parts
@param array:Array reference array
@param parts:uint Number of Parts to divide
@returns Divided Array thus [[1,2,3],[4,5,6],[7,8,9,10]]
*/
public static function divideArray (array:Array, parts:uint):Array
{
if (parts <= 1)
throw new ArgumentError("Parts arguments must be integer greater than 1");
var cuadrado = new Cuadrado();
var cuadrado2 = new Cuadrado();
cuadrado.x = contenedor1.width/2 - cuadrado.width/2;
cuadrado.y = contenedor1.height/2 - cuadrado.height/2;
contenedor1.addChild(cuadrado);
contenedor2.addChild(cuadrado2);
import com.greensock.TweenMax;
import fl.motion.easing.*;
stop();
var splatSounds:Array = [new SplatSound1(), new SplatSound2()];
function crearSapoPintable(color1, color2, xPos, yPos) {
var sapo = new Sapos();
sapo.addEventListener(MouseEvent.CLICK, intercambiar);
@fenixkim
fenixkim / CountdownTimer.as
Last active December 13, 2015 17:09
This snippet allows create a countdown for milliseconds usefull for games. It must be included into a movieclip which contains a dynamic text field called 'tf'.
import com.greensock.TweenMax;
var now:Date;
var endDate:Date;
var seconds:Number;
var isRunning:Boolean;
var wasInitialized:Boolean;
function updateTime(e:Event):void {
var currentDate:Date = new Date();
@fenixkim
fenixkim / CustomCursor.as
Created February 20, 2013 21:23
This snippet set up a custom cursor. You must include it into a MovieClip with is the cursor representation. Require: Flash timeline based project
import flash.events.MouseEvent;
mouseChildren = false;
mouseEnabled = false;
// Adds the events listener to the stage
stage.addEventListener(MouseEvent.MOUSE_MOVE, actualizarCursor);
stage.addEventListener(MouseEvent.MOUSE_DOWN, actualizarCursor);
stage.addEventListener(MouseEvent.MOUSE_UP, actualizarCursor);
stage.addEventListener(Event.MOUSE_LEAVE, mouseLeave);
@fenixkim
fenixkim / Menu.as
Last active December 16, 2015 02:39
Este código sirve para configurar los items de un menu en flash Este código debe ser incluido en el primer fotograma de un movieclip (Menu) que contiene todos los items del Menu.
import flash.display.MovieClip;
import com.greensock.*;
import com.greensock.easing.*;
// Agrupa los items del menu en un arreglo
var items:Array = [item1, item2, item3, item4];
// Esta función sirve para configurar el estado inicial de cada item
function createItem (item:MovieClip, label:String) {
item.tf.text = label;
@fenixkim
fenixkim / Reel.as
Created April 16, 2013 15:00
Crea una galería de vistas previas en un riel Horizontal, deben tener las imágenes en la carpeta images
import com.goto.display.ImageView;
import com.goto.display.layout.HLayout;
import com.greensock.*;
import com.greensock.easing.*;
import flash.events.Event;
// Creo un layout horizotal para agregar las imágenes
var layout:HLayout = new HLayout();
// Agrego una separación de 10 px para cada objeto del layout
layout.gab = 10;