s2paganini.com as3 libEnhanced Sprite classA Sprite with useful methods
Public Methods
removeAllChilds() - removes all childs added in the Sprite setCustomProperty(propName : String, propValue) - useful when you want to store a variable on the Sprite getCustomProperty(propName : String) - gets the variable stored destroy() - remove all event listeners of the object get events() - returns all events assigned to the object
Usage
import com.s2paganini.display.EnhancedSprite;
var test : EnhancedSprite = new EnhancedSprite();
test.removeAllChilds();
test.setCustomProperty("xmlList", xmlList : XML);
test.getCustomProperty("xmlList");
test.destroy();
test._events;Flick classBlinks your object
Parameters
obj - object to tween visible - Set visibility of the object after it ends optional, default: true sequence - Array that sets the pattern of visibility optional, default: new Array(0, 1) repeat - Number of times that it should repeat the sequence optional, default: 1 delay - Delay to start Tweening optional, default: 0 interval - Interval between each blink in milliseconds optional, default: 30 onComplete - Function to call after Tween ends onCompleteParams - Array of params of the onComplete function
Usage
import com.s2paganini.tween.Flick;
Flick.addFlick(displayObject, {params : Object]});
Scroll ClassBased on the gskinner's AS2 Scroll Class
Parameters
scrollTrk - Track Reference to Drag (Rectangle or DisplayObject) contentMain - Content to Scroll scrollFace - Dragger maskedView - Content Mask stage - Stage Reference btnUp - Optional Button UP btnDown - Optional Button DOWN
Usage
First create all your objects then
import com.s2paganini.util.Scroll;
scroll = Scroll.getInstance();
scroll.setVars(scrollTrk, contentMain, scrollFace, maskedView, stage, btnUp, btnDown);
scroll.start();
UtilsCheck Valid Email with Regular Expression
import com.s2paganini.util.Utils;
Utils.checkEmail(whichEmail@toValidate.com);
// returns BooleanFormat Number
import com.s2paganini.util.Utils;
Utils.zeroFormat(1, 2);
// returns 01
Utils.zeroFormat(1, 3);
// returns 001Array Mix
import com.s2paganini.util.Utils;
Utils.ArrayMix(arrayToMIx);
// returns the array mixedDelete an Item on Array
import com.s2paganini.util.Utils;
Utils.deleteArrayItem(arrayRef, itemToDelete, paramToCompare = null, paramItemArrayToCompare = null)
// returns new Array Push an unique item to the Array
import com.s2paganini.util.Utils;
Utils.pushUnique(whichArray : Array, item : *)
// returns new Array Draw Regular Square
Based on Andre Elvan's code
Parameters
target - Graphics of the object to draw w - width h - height col - color a - alpha optional, default: 1 startX - x position to start drawing optional, default: 0 startY - y position to start drawing optional, default: 0 bitmapFill - name of the BitmapData to be a pattern optional, default: null Usage
import com.s2paganini.util.Utils;
Utils.drawSquareGraphic(target.graphics, w, h, col)
Assets FactoryRegister any Class or Embedded Object as a global variable Usage
import com.s2paganini.util.LoadEmbedAsset;
import com.s2paganini.util.AssetsFactory;
//Sounds
AssetsFactory.registerClass("Reference", LoadEmbedAsset.returnAssetByName(this.loaderInfo, "Sound Library Name"));
var test : Sound = AssetsFactory.getInstance("Reference");
test.play();
//Fonts
AssetsFactory.registerFont("Reference", this);
var textFormat : TextFormat = new TextFormat(AssetsFactory.getFontName("Reference"));
//Bitmap
AssetsFactory.registerClass("Reference", LoadEmbedAsset.returnAssetByName(this.loaderInfo, "Bitmap Library Name"));
AssetsFactory.getBitmap("Reference");
AssetsFactory.getBitmapData("Reference");
//General Use
AssetsFactory.registerClass("Reference", LoadEmbedAsset.returnAssetByName(this.loaderInfo, "Asset Library Name"));
AssetsFactory.getClass("Reference");
var test : * = AssetsFactory.getInstance("Reference");
//Multiple Classes
var assetsArray : Array = new Array("obj1", "obj2");
AssetsFactory.registerMultipleClasses(assetsArray, loaderInfoReference);
Default Text FieldCreates a new text field with default values
Parameters
defaultStyle - Text Format to apply antiAtias - Boolean optional, default: true dynamic - Boolean optional, default: true wordWrap - Boolean optional, default: false multiline - Boolean optional, default: false
Usage
import com.s2paganini.text.DefaultTextField;
var defaultTextField : DefaultTextField = new DefaultTextField(new TextFormat());
//Method cropText
//crops the text by the end of the width and height adding "..."
defaultTextField.cropText()
List Display FieldCreate a Text Field list Methods
addItem(s : String) - Adds an Item deleteItemAt(n : uint)- Removes a item at position deleteItem(s : String) - Removes item
Usage
import com.s2paganini.text.ListDisplayField;
var defaultTextField : ListDisplayField = new ListDisplayField();
defaultTextField.addItem("Bread");
defaultTextField.deleteItem("Trash");
defaultTextField.deleteItemAt(2);
addChild(defaultTextField);
30 Day Summary Apr 17 2013 — May 17 2013
|
12 Month Summary May 17 2012 — May 17 2013
|
Copyright
©
2013
Black Duck Software, Inc.
and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a
Creative Commons Attribution 3.0 Unported License
. Ohloh
®
and the Ohloh logo are trademarks of
Black Duck Software, Inc.
in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.