Skip to content

Instantly share code, notes, and snippets.

@FrancescoMaisto
FrancescoMaisto / ScrollingPanel.as
Created July 16, 2013 10:18
Page flipping using swiping gestures
package navigation.screens
{
import constants.Colors;
import constants.Constants;
import constants.Fonts;
import constants.Navigation;
import constants.Text;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.utils.getTimer;
@PrimaryFeather
PrimaryFeather / gist:5983685
Last active February 29, 2020 09:35
Water distortion filter, implemented with Starling's "DisplacementMapFilter".
private function addDistortionTo(target:DisplayObject):void
{
var offset:Number = 0;
var scale:Number = Starling.contentScaleFactor;
var width:int = target.width;
var height:int = target.height;
var perlinData:BitmapData = new BitmapData(width * scale, height * scale, false);
perlinData.perlinNoise(200*scale, 20*scale, 2, 5, true, true, 0, true);
@FrancescoMaisto
FrancescoMaisto / SoundManager.as
Last active November 9, 2019 20:22
This ActionScript class makes dealing with sounds in Starling very easy and intuitive: once you add a sound to the SoundManager you can easily play it, stop it, change its volume, fade it in, fade it out or cross-fade it with another sound.See more details and usage examples below, in the first comment.
package starling.extensions {
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.utils.Dictionary;
import starling.core.Starling;
public class SoundManager {
@ekeeper
ekeeper / Gauge.as
Last active December 15, 2015 05:49 — forked from PrimaryFeather/Gauge.as
My version of Gauge extension for Starling (http://wiki.starling-framework.org/extensions/gauge). Vertical gauge was added. Thanks to Dima (deep).
package starling.extensions
{
import flash.geom.Point;
import starling.display.Image;
import starling.display.Sprite;
import starling.textures.Texture;
/* Usage:
var gauge:Gauge = new Gauge(texture);
@FrancescoMaisto
FrancescoMaisto / IdButton.as
Last active December 12, 2015 05:29
Extends the standard Starling Button by adding an id parameter. The id parameter can then be retrieved from the event dispatched to the 'onButtonTriggered' listener. (see usage example in the first comment)
package ui
{
import starling.display.Button;
import starling.textures.Texture;
/**
* Extends the standard Starling Button by adding an id parameter
*
* @author Francesco Maisto (www.francescomaisto.com)
*/
package
{
public final class ObjectPool
{
private var MAX_VALUE:uint;
private var GROWTH_VALUE:uint;
private var TYPE:Class;
private var counter:uint;
private var pool:Array;
@JulianG
JulianG / ObjectPool.as
Last active December 10, 2015 16:28
General purpose AS3 Object Pool class
package
{
/**
* ObjectPool Class
* @author Julian
*/
public class ObjectPool
{
private var _list:Array;
@jamikado
jamikado / TLFSprite.as
Created July 24, 2012 03:20
TLFSprite is a Starling extension that provides an alternative to starling.text.TextField to render text from OpenType or TrueType fonts (both device and embedded CFF) using the Text Layout Framework instead of flash.text.TextField
// =================================================================================================
//
// based on starling.text.TextField
// modified to use text layout framework engine for rendering text
//
// =================================================================================================
package starling.extensions
{
import flash.display.BitmapData;
@PrimaryFeather
PrimaryFeather / Polygon.as
Last active July 31, 2017 14:53
A custom display object for Starling, rendering a regular n-sided polygon.
package utils
{
import com.adobe.utils.AGALMiniAssembler;
import flash.display3D.*;
import flash.geom.*;
import starling.core.RenderSupport;
import starling.core.Starling;
import starling.display.DisplayObject;
@PrimaryFeather
PrimaryFeather / Gauge.as
Last active February 29, 2020 09:35
This Starling extension class displays a texture, trimmed to its left side, depending on a ratio. This can be used to create a progress bar or a rest-time display.
package starling.extensions
{
import starling.display.Image;
import starling.display.Sprite;
import starling.textures.Texture;
import starling.utils.MathUtil;
public class Gauge extends Sprite
{
private var _image:Image;