├── deploy ├── js │ ├── .DS_Store │ └── swfobject.js ├── swf │ ├── slider.swf │ ├── collection.swf │ ├── flashvars.swf │ ├── bitmaputils.swf │ ├── pulloutmenu.swf │ ├── soundmanager.swf │ ├── textmanager.swf │ ├── expressInstall.swf │ └── mousepositionpanel.swf ├── sounds │ ├── birds.mp3 │ ├── frogs.mp3 │ └── elephant.mp3 ├── css │ ├── styles.css │ └── english-styles.css └── index.html ├── source ├── fla │ ├── slider │ │ └── slider.fla │ ├── flashvars │ │ └── flashvars.fla │ ├── collection │ │ └── collection.fla │ ├── bitmaputils │ │ └── bitmaputils.fla │ ├── pulloutmenu │ │ └── pulloutmenu.fla │ ├── soundmanager │ │ └── soundmanager.fla │ ├── textmanager │ │ └── textmanager.fla │ └── mousepositionpanel │ │ └── mousepositionpanel.fla ├── libs │ └── com │ │ └── reintroducing │ │ ├── data │ │ ├── base │ │ │ ├── IValueObject.as │ │ │ ├── ICollection.as │ │ │ ├── ValueObject.as │ │ │ ├── Iterator.as │ │ │ └── Collection.as │ │ ├── text │ │ │ ├── config │ │ │ │ ├── ITextConfig.as │ │ │ │ ├── StaticTextConfig.as │ │ │ │ ├── InputTextConfig.as │ │ │ │ └── HTMLTextConfig.as │ │ │ ├── TextManagerConstants.as │ │ │ └── lang │ │ │ │ ├── Language.as │ │ │ │ └── Languages.as │ │ ├── flashvars │ │ │ ├── FlashVar.as │ │ │ └── FlashVars.as │ │ ├── utils │ │ │ └── ExternalInterfaceMethod.as │ │ ├── slider │ │ │ └── SliderData.as │ │ ├── mousepositionpanel │ │ │ └── MousePositionPanelData.as │ │ ├── pulloutmenu │ │ │ └── PullOutMenuData.as │ │ └── link │ │ │ └── LinkData.as │ │ ├── utils │ │ ├── GarbageCollection.as │ │ ├── FontUtils.as │ │ ├── CacheUtils.as │ │ ├── SoundUtils.as │ │ ├── LibraryUtils.as │ │ ├── ObjectUtils.as │ │ ├── BitmapUtils.as │ │ ├── LayoutUtils.as │ │ ├── SharedObjectManager.as │ │ ├── DateUtils.as │ │ ├── ArrayUtils.as │ │ ├── DisplayObjectUtils.as │ │ ├── LinkUtils.as │ │ ├── ExternalInterfaceManager.as │ │ ├── ColorUtils.as │ │ ├── StringUtils.as │ │ ├── FlashVarsManager.as │ │ ├── Validator.as │ │ └── MathUtils.as │ │ ├── events │ │ ├── MouseIdleMonitorEvent.as │ │ ├── SliderEvent.as │ │ └── SoundManagerEvent.as │ │ ├── text │ │ ├── types │ │ │ ├── HTMLTextField.as │ │ │ ├── StaticTextField.as │ │ │ └── InputTextField.as │ │ └── TextManager.as │ │ ├── debug │ │ └── Environment.as │ │ ├── ui │ │ ├── mousepositionpanel │ │ │ └── MousePositionPanel.as │ │ ├── pulloutmenu │ │ │ └── PullOutMenu.as │ │ └── slider │ │ │ └── Slider.as │ │ ├── mouse │ │ └── MouseIdleMonitor.as │ │ └── sound │ │ └── SoundItem.as └── src │ ├── collection │ ├── TestVO.as │ └── MainCollection.as │ ├── flashvars │ └── MainFlashVarsManager.as │ ├── bitmaputils │ └── MainBitmapUtils.as │ ├── slider │ └── MainSlider.as │ ├── mousepositionpanel │ └── MainMousePositionPanel.as │ ├── pulloutmenu │ └── MainPullOutMenu.as │ ├── textmanager │ └── MainTextManager.as │ └── soundmanager │ └── MainSoundManager.as └── README.txt /deploy/js/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/js/.DS_Store -------------------------------------------------------------------------------- /deploy/swf/slider.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/slider.swf -------------------------------------------------------------------------------- /deploy/sounds/birds.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/sounds/birds.mp3 -------------------------------------------------------------------------------- /deploy/sounds/frogs.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/sounds/frogs.mp3 -------------------------------------------------------------------------------- /deploy/swf/collection.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/collection.swf -------------------------------------------------------------------------------- /deploy/swf/flashvars.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/flashvars.swf -------------------------------------------------------------------------------- /deploy/sounds/elephant.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/sounds/elephant.mp3 -------------------------------------------------------------------------------- /deploy/swf/bitmaputils.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/bitmaputils.swf -------------------------------------------------------------------------------- /deploy/swf/pulloutmenu.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/pulloutmenu.swf -------------------------------------------------------------------------------- /deploy/swf/soundmanager.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/soundmanager.swf -------------------------------------------------------------------------------- /deploy/swf/textmanager.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/textmanager.swf -------------------------------------------------------------------------------- /deploy/swf/expressInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/expressInstall.swf -------------------------------------------------------------------------------- /source/fla/slider/slider.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/source/fla/slider/slider.fla -------------------------------------------------------------------------------- /deploy/swf/mousepositionpanel.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/deploy/swf/mousepositionpanel.swf -------------------------------------------------------------------------------- /source/fla/flashvars/flashvars.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/source/fla/flashvars/flashvars.fla -------------------------------------------------------------------------------- /source/fla/collection/collection.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/source/fla/collection/collection.fla -------------------------------------------------------------------------------- /source/fla/bitmaputils/bitmaputils.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/source/fla/bitmaputils/bitmaputils.fla -------------------------------------------------------------------------------- /source/fla/pulloutmenu/pulloutmenu.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/source/fla/pulloutmenu/pulloutmenu.fla -------------------------------------------------------------------------------- /source/fla/soundmanager/soundmanager.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/source/fla/soundmanager/soundmanager.fla -------------------------------------------------------------------------------- /source/fla/textmanager/textmanager.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/source/fla/textmanager/textmanager.fla -------------------------------------------------------------------------------- /source/fla/mousepositionpanel/mousepositionpanel.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reintroducing/as3/HEAD/source/fla/mousepositionpanel/mousepositionpanel.fla -------------------------------------------------------------------------------- /deploy/css/styles.css: -------------------------------------------------------------------------------- 1 | html, body, #containerA, #containerB 2 | { 3 | height: 100%; 4 | } 5 | 6 | body 7 | { 8 | margin: 0; 9 | padding: 0; 10 | overflow: hidden; 11 | backgroundcolor: #FCF1DC; 12 | } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/base/IValueObject.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.base { /** * Interface for ValueObject. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public interface IValueObject { function output():void; //- END INTERFACE ----------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/text/config/ITextConfig.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.text.config { /** * Interface for TextConfig value objects. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public interface ITextConfig { function output():void; //- END INTERFACE ----------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/text/TextManagerConstants.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.text { /** * Constants used in the TextManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class TextManagerConstants { public static const TYPE_STATIC:String = "text.type.static"; public static const TYPE_HTML:String = "text.type.html"; public static const TYPE_INPUT:String = "text.type.input"; } } -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | This library contains a portion of my AS3 classes that I use almost every day. 2 | 3 | Feel free to do whatever you want with them. If you find any bugs, please let me know. 4 | 5 | Dependent on: 6 | - Greensock Tweening Platform [http://www.greensock.com] 7 | - Greensock LoaderMax [http://www.loadermax.com] 8 | 9 | source/fla - contains the FLAs to go with the examples 10 | source/libs - contains the core class files 11 | source/src - contains the example code for the FLAs -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/base/ICollection.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.base { /** * Interface for Collection. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public interface ICollection { function getName():String; function addItem($item:*):Boolean; function addItems(...$items):void; function addItemAt($index:int, $item:*):void; function removeItem($item:*):Boolean; function clear():void; function contains($item:*):Boolean; function getItemAt($index:int):*; function getIterator():Iterator; function getLength():int; function isEmpty():Boolean; function output():void; //- END INTERFACE ----------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /deploy/css/english-styles.css: -------------------------------------------------------------------------------- 1 | /* ----------------------------------- 2 | COMMON 3 | ----------------------------------- */ 4 | 5 | .header { 6 | font-family: Trade Gothic Bold Condensed No. 20; 7 | font-size: 20pt; 8 | color: #000000; 9 | } 10 | 11 | .bodyCopy { 12 | font-family: Trade Gothic; 13 | font-size: 12pt; 14 | color: #666666; 15 | } 16 | 17 | .footer { 18 | font-family: Trade Gothic Light; 19 | font-size: 10pt; 20 | color: #000000; 21 | } 22 | 23 | .htmlTest1 { 24 | font-family: Trade Gothic; 25 | font-size: 14pt; 26 | color: #FF0000; 27 | } 28 | 29 | .htmlTest2 { 30 | font-family: Trade Gothic; 31 | font-size: 14pt; 32 | color: #00FF00; 33 | } 34 | 35 | .inputTest { 36 | font-family: Trade Gothic; 37 | font-size: 12pt; 38 | color: #888888; 39 | } -------------------------------------------------------------------------------- /deploy/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FlashVars Example 5 | 6 | 7 | 8 | 9 | 10 | 18 | 19 | 20 |
21 |

Alternative content

22 |

Get Adobe Flash player

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /source/src/collection/TestVO.as: -------------------------------------------------------------------------------- 1 | package collection { import com.reintroducing.data.base.ValueObject; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class TestVO extends ValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var id:*; public var name:String; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function TestVO():void { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/flashvars/FlashVar.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.flashvars { import com.reintroducing.data.base.ValueObject; import flash.utils.getQualifiedClassName; /** * Strongly typed data object for use in the FlashVarsManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class FlashVar extends ValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var name:String; public var value:String; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function FlashVar() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/utils/ExternalInterfaceMethod.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.utils { import com.reintroducing.data.base.ValueObject; import flash.utils.getQualifiedClassName; /** * Strongly typed value object for use with the ExternalInterfaceManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class ExternalInterfaceMethod extends ValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var methodName:String; public var methodParameters:Object; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function ExternalInterfaceMethod() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/text/lang/Language.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.text.lang { import com.reintroducing.data.base.ValueObject; import flash.text.StyleSheet; import flash.utils.getQualifiedClassName; /** * Strongly typed data object for use with the TextManager and Languages collection. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class Language extends ValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var name:String = "english"; public var iso:String = "en-us"; public var embed:Boolean = true; public var styleSheet:StyleSheet; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function Language() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/src/collection/MainCollection.as: -------------------------------------------------------------------------------- 1 | package collection { import com.reintroducing.data.base.Collection; import flash.display.MovieClip; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MainCollection extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private var _obs:Collection; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MainCollection():void { super(); this._obs = new Collection("Objects"); this.init(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- /** * */ private function init():void { var ob:TestVO; for (var i:int = 0; i < 10; i++) { ob = new TestVO(); ob.id = i; ob.name = String("object" + i); this._obs.addItem(ob); } } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/GarbageCollection.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.net.LocalConnection; import flash.utils.getQualifiedClassName; /** * Static utility methods to aid in running the garbage collector in the Flash Player. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class GarbageCollection { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function GarbageCollection() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Forces the Flash Player to run garbage collection. * Use only as a development aide. Not recommended for production. * * @return void */ public static function force():void { try { new LocalConnection().connect("gc"); new LocalConnection().connect("gc"); } catch (e:*) { } } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/slider/SliderData.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.slider { import flash.display.Sprite; 2 | import flash.display.Stage; 3 | import com.reintroducing.data.base.ValueObject; import flash.utils.getQualifiedClassName; /** * Strongly typed data object for use with the Slider. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class SliderData extends ValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public static const AXIS_X:String = "x"; public static const AXIS_Y:String = "y"; public var stage:Stage; public var axis:String; public var track:Sprite; public var slider:Sprite; public var lowValue:Number; public var highValue:Number; public var startValue:Number = 0; public var precision:int = 0; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function SliderData() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/src/flashvars/MainFlashVarsManager.as: -------------------------------------------------------------------------------- 1 | package flashvars { import com.reintroducing.utils.FlashVarsManager; import flash.display.MovieClip; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MainFlashVarsManager extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MainFlashVarsManager():void { super(); this.init(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- /** * */ private function init():void { var fvm:FlashVarsManager = FlashVarsManager.getInstance(loaderInfo); fvm.addDefault("testPath", "../test/folder/here"); fvm.addDefault("servicePath", "../service/here"); fvm.addDefault("imagePath", "../img/folder/here"); fvm.initialize(); fvm.flashVars.output(); trace(fvm.getByName("servicePath").value); trace(fvm.getValueByName("imagePath")); } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/base/ValueObject.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.base { import flash.utils.describeType; import flash.utils.getQualifiedClassName; /** * A base class for storing strongly typed data. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class ValueObject implements IValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function ValueObject() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Outputs the data in the value object. * * @return void */ public function output():void { trace(this.toString()); trace("\t-----------------------------------------"); var props:XMLList = describeType(this).variable; for (var i:int = 0; i < props.length(); i++) { trace("\t" + props[i].@name + ":" + props[i].@type + " = " + this[props[i].@name]); } trace("\t-----------------------------------------\n"); } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/text/config/StaticTextConfig.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.text.config { import com.reintroducing.data.base.ValueObject; import flash.text.AntiAliasType; import flash.text.TextFieldAutoSize; import flash.utils.getQualifiedClassName; /** * Strongly typed value object for StaticTextField usage in the TextManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class StaticTextConfig extends ValueObject implements ITextConfig { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var antiAliasType:String = AntiAliasType.ADVANCED; public var autoSize:String = TextFieldAutoSize.LEFT; public var selectable:Boolean = false; public var wordWrap:Boolean = false; public var multiline:Boolean = false; public var width:Number = 100; public var height:Number = 100; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function StaticTextConfig() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/events/MouseIdleMonitorEvent.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.events { import flash.events.Event; /** * Event dispatched by the MouseIdleMonitor. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MouseIdleMonitorEvent extends Event { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- // event constants public static const MOUSE_IDLE:String = "mouseIdle"; public static const MOUSE_ACTIVE:String = "mouseActive"; public var idleTime:Number; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MouseIdleMonitorEvent($type:String, $idleTime:Number = 0, $bubbles:Boolean = false, $cancelable:Boolean = false) { super($type, $bubbles, $cancelable); this.idleTime = $idleTime; } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public override function clone():Event { return new MouseIdleMonitorEvent(type, idleTime, bubbles, cancelable); } /** * @private */ public override function toString():String { return formatToString("MouseIdleMonitorEvent", "idleTime", "type", "bubbles", "cancelable"); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/FontUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.text.Font; import flash.utils.getQualifiedClassName; /** * Static utility methods to manipulate fonts. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class FontUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function FontUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Traces the currently embedded fonts out in the Output panel. The names can be used in CSS files * in conjunction with the TextManager. * * @return void */ public static function outputFonts():void { var loadedFonts:Array = Font.enumerateFonts(); var len:int = loadedFonts.length; for(var i:int = 0; i < len; i++) { var item:Font = loadedFonts[i]; trace("\tName:\t" + item.fontName); trace("\tStyle:\t" + item.fontStyle); trace("\tType:\t" + item.fontType); trace("\t. . . . .\n"); } } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/mousepositionpanel/MousePositionPanelData.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.mousepositionpanel { import com.reintroducing.data.base.ValueObject; import flash.display.Sprite; import flash.utils.getQualifiedClassName; /** * Strongly typed data object for use with the MousePositionPanel. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MousePositionPanelData extends ValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public static const AXIS_X:String = "x"; public static const AXIS_Y:String = "y"; public static const TYPE_AGAINST_MOUSE:String = "againstMouse"; public static const TYPE_WITH_MOUSE:String = "withMouse"; public var itemHolder:Sprite; public var content:Sprite; public var masker:Sprite; public var axis:String = AXIS_X; public var moveType:String = TYPE_AGAINST_MOUSE; public var speed:Number = 10; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MousePositionPanelData() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/text/lang/Languages.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.text.lang { import com.reintroducing.data.base.Collection; import com.reintroducing.data.base.Iterator; import flash.utils.getQualifiedClassName; /** * Strongly typed Language collection for use in the TextManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class Languages extends Collection { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function Languages($name:String) { super($name); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Retrieves a Language by its name value. * * @param $name The name of the Language to retrieve * * @return Language */ public function getItemByName($name:String):Language { var itr:Iterator = this.getIterator(); var testVO:Language; var rVO:Language; while (itr.hasNext()) { testVO = Language(itr.next()); if (testVO.name == $name) { rVO = testVO; break; } } return rVO; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/CacheUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.utils.getQualifiedClassName; /** * Static utility methods used to manipulate cache settings on URLs. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class CacheUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function CacheUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Cache-busts and returns a single URL. * * @param $url A string value of the URL to bust. * * @return String */ public static function bust($url:String):String { if ($url.indexOf("?") == -1) { $url += "?v=" + new Date().getTime(); } else { $url += "&v=" + new Date().getTime(); } return $url; } /** * Cache-busts and returns an array of URLs. * * @param $arr An array that holds the string values of the URLs to bust. * * @return Array */ public static function bustArray($arr:Array):Array { for (var i:String in $arr) $arr[i] += "?v=" + new Date().getTime(); return $arr; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/text/config/InputTextConfig.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.text.config { import com.reintroducing.data.base.ValueObject; import flash.text.AntiAliasType; import flash.text.TextFieldAutoSize; import flash.text.TextFieldType; import flash.utils.getQualifiedClassName; /** * Strongly typed value object for InputTextField usage in the TextManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class InputTextConfig extends ValueObject implements ITextConfig { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var antiAliasType:String = AntiAliasType.ADVANCED; public var autoSize:String = TextFieldAutoSize.LEFT; public var wordWrap:Boolean = false; public var multiline:Boolean = false; public var width:Number = 100; public var height:Number = 100; public var type:String = TextFieldType.INPUT; public var mouseEnabled:Boolean = true; public var background:Boolean = false; public var backgroundColor:Number = 0xFFFFFF; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function InputTextConfig() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/flashvars/FlashVars.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.flashvars { import com.reintroducing.data.base.Collection; import com.reintroducing.data.base.Iterator; import flash.utils.getQualifiedClassName; /** * Strongly typed FlashVar collection. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class FlashVars extends Collection { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- /** * Creates a FlashVars collection. * * @param @name The name to give the collection. */ public function FlashVars($name:String) { super($name); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Returns a FlashVar by its name value. * * @param $name The name of the FlashVar to retrieve * * @return FlashVar */ public function getItemByName($name:String):FlashVar { var itr:Iterator = this.getIterator(); var testVO:FlashVar; var rVO:FlashVar; while (itr.hasNext()) { testVO = FlashVar(itr.next()); if (testVO.name == $name) { rVO = testVO; break; } } return rVO; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/SoundUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.media.Sound; 2 | import flash.utils.getQualifiedClassName; /** * Static utility methods for working with sounds. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class SoundUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function SoundUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Estimate the duration by calculating the bytes per second (sound.bytesLoaded / sound.length) and divide sound.bytesTotal by that number. * That gives you an estimated duration. Just call this script repeatedly until the sound is finished loading, such as a 10ms timer. * NOTE: Works only on CBR mp3 files. * * @param $sound The sound to calculate the duration of * * @return Number The estimated length of the sound (in seconds) */ public static function calculateEstimatedDuration($sound:Sound):Number { if ($sound && $sound.length > 0) { return (($sound.bytesTotal / ($sound.bytesLoaded / $sound.length)) / 1000); } return -1; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/LibraryUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.utils.getDefinitionByName; import flash.utils.getQualifiedClassName; /** * Static utility methods used to help in accessing library items from an FLA. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class LibraryUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function LibraryUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Creates a castable class instance of an object by pulling its library linkage identifier. * * @param $libraryLinkage The name of the class as specified in the properties panel of the object in the library * *
		 * 		// an image exists in the FLA's library with a linkage class name of "Roses"
		 * 		var roses:BitmapData = LibraryUtils.createClassFromObject("Roses") as BitmapData;
		 * 
* * @return * The new (castable) class */ public static function createClassFromObject($libraryLinkage:String):* { var ref:Class = getDefinitionByName($libraryLinkage) as Class; var obj:* = new ref(); return obj; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/pulloutmenu/PullOutMenuData.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.pulloutmenu { import com.greensock.easing.Linear; import com.reintroducing.data.base.ValueObject; import flash.display.Sprite; import flash.utils.getQualifiedClassName; /** * Strongly typed data object for use with the PullOutMenu. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class PullOutMenuData extends ValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public static const AXIS_X:String = "x"; public static const AXIS_Y:String = "y"; public static const TYPE_ROLL_OVER:String = "rollover"; public static const TYPE_PRESS:String = "press"; public static const TYPE_RELEASE:String = "release"; public var hitButton:Sprite; public var itemHolder:Sprite; public var startPosition:Number; public var endPosition:Number; public var openSpeed:Number = .25; public var closeSpeed:Number = .25; public var axis:String = AXIS_Y; public var tweenEase:Function = Linear.easeOut; public var eventType:String = TYPE_ROLL_OVER; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function PullOutMenuData() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/src/bitmaputils/MainBitmapUtils.as: -------------------------------------------------------------------------------- 1 | package bitmaputils { import com.reintroducing.utils.BitmapUtils; import com.reintroducing.utils.LibraryUtils; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.MovieClip; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MainBitmapUtils extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var bmp:Bitmap; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MainBitmapUtils():void { super(); init(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- /** * */ private function init():void { // var rosesRef:Class = getDefinitionByName("Roses") as Class; // var roses:BitmapData = new rosesRef(); var roses:BitmapData = LibraryUtils.createClassFromObject("Roses") as BitmapData; bmp = new Bitmap(roses); var tiles:Array = BitmapUtils.createTiles(bmp, 3, 3); var tile:Bitmap; for (var i:int = 0; i < tiles.length; i++) { for (var j:int = 0; j < tiles[i].length; j++) { tile = tiles[i][j]; tile.x = ((j * tile.width) + (j * 10)); tile.y = ((i * tile.height) + (i * 10)); addChild(tile); } } } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/base/Iterator.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.base { import flash.utils.getQualifiedClassName; /** * Works in conjunction with a Collection to iterate through its contents. * * @author Adobe [http://www.adobe.com] * @author Ported to AS3 by Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class Iterator { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- protected var _collection:Collection; protected var _cursor:int; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- /** * Initializes the Iterator and maintain a link to its Collection. * * @param $coll Collection to which this Iterator belongs. */ public function Iterator($coll:Collection) { _collection = $coll; _cursor = 0; } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Returns true if the iteration has more items. * * @return Boolean true if iteration has more items. */ public function hasNext():Boolean { return (_cursor < _collection.getLength()); } /** * Return the next item in the iteration and increment the cursor. Returns null if the * iteration has no more items. * * @return * the next item in the Iteration. */ public function next():* { return (_collection.getItemAt(_cursor++)); } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/text/config/HTMLTextConfig.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.text.config 2 | { 3 | import com.reintroducing.data.base.ValueObject; 4 | 5 | import flash.text.AntiAliasType; 6 | import flash.text.TextFieldAutoSize; 7 | import flash.utils.getQualifiedClassName; 8 | 9 | /** 10 | * Strongly typed value object for HTMLTextField usage in the TextManager. 11 | * 12 | * @author Matt Przybylski [http://www.reintroducing.com] 13 | * @version 1.0 14 | */ 15 | public class HTMLTextConfig extends ValueObject implements ITextConfig 16 | { 17 | //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- 18 | 19 | 20 | 21 | //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- 22 | 23 | public var antiAliasType:String = AntiAliasType.ADVANCED; 24 | public var autoSize:String = TextFieldAutoSize.LEFT; 25 | public var selectable:Boolean = false; 26 | public var wordWrap:Boolean = true; 27 | public var multiline:Boolean = true; 28 | public var width:Number = 100; 29 | public var height:Number = 100; 30 | 31 | //- CONSTRUCTOR ------------------------------------------------------------------------------------------- 32 | 33 | public function HTMLTextConfig() 34 | { 35 | super(); 36 | } 37 | 38 | //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- 39 | 40 | 41 | 42 | //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- 43 | 44 | 45 | 46 | //- EVENT HANDLERS ---------------------------------------------------------------------------------------- 47 | 48 | 49 | 50 | //- GETTERS & SETTERS ------------------------------------------------------------------------------------- 51 | 52 | 53 | 54 | //- HELPERS ----------------------------------------------------------------------------------------------- 55 | 56 | /** 57 | * @private 58 | */ 59 | override public function toString():String 60 | { 61 | return getQualifiedClassName(this); 62 | } 63 | 64 | //- END CLASS --------------------------------------------------------------------------------------------- 65 | } 66 | } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/link/LinkData.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.link { import com.reintroducing.data.base.ValueObject; import flash.utils.getQualifiedClassName; /** * Strongly typed data object for use with the LinkUtils. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class LinkData extends ValueObject { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public static const WINDOW_POPUP:String = "window.popup"; public static const WINDOW_NEW:String = "_blank"; public static const WINDOW_SELF:String = "_self"; public static const WINDOW_PARENT:String = "_parent"; public var sourceURL:String = ""; public var targetWindow:String = WINDOW_SELF; public var windowName:String = "new.popup.window"; public var windowWidth:Number = 600; public var windowHeight:Number = 500; public var windowX:Number = 100; public var windowY:Number = 100; public var copyHistory:Boolean = false; public var statusBar:Boolean = true; public var toolBar:Boolean = true; public var location:Boolean = true; public var menuBar:Boolean = true; public var directories:Boolean = true; public var resizable:Boolean = true; public var scrollBars:Boolean = true; public var fullScreen:Boolean = false; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function LinkData() { super(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/ObjectUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.utils.describeType; import flash.utils.getQualifiedClassName; /** * Static utility methods for working with Objects. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class ObjectUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function ObjectUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Traces out all properties in a given object. * * @param $o The object to inspect * * @return void */ public static function trace($o:Object):void { trace("\n"); trace("OBJECT TRACE:"); for (var val:* in $o) { trace(" [" + typeof($o[val]) + "] " + val + " => " + $o[val]); } trace("\n"); } /** 2 | * Traces out all the properties as provided by describeType. * * @param $o The object to trace * @param $type The type of properties the object has. "variable" traces out public, "accessor" traces out bindable/getter & setters. * * @return void 3 | */ 4 | public static function describe($o:*, $type:String = "variable"):void 5 | { 6 | var props:XMLList = ($type == "variable") ? describeType($o)..variable : describeType($o)..accessor; for (var i:int = 0; i < props.length(); i++) { trace(props[i].@name + ': ' + $o[props[i].@name]); } 7 | } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/events/SliderEvent.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.events { import flash.display.DisplayObject; import flash.events.Event; /** * Event dispatched by the Slider. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class SliderEvent extends Event { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- // event constants public static const ON_UPDATE:String = "onUpdate"; public static const ON_PRESS:String = "onPress"; public static const ON_RELEASE:String = "onRelease"; public static const ON_ENABLED:String = "onEnabled"; public static const ON_DISABLED:String = "onDisabled"; // parameters public var percent:Number; public var currentValue:Number; public var slider:DisplayObject; public var track:DisplayObject; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function SliderEvent($type:String, $percent:Number, $currentValue:Number, $slider:DisplayObject, $track:DisplayObject, $bubbles:Boolean = false, $cancelable:Boolean = false) { super($type, $bubbles, $cancelable); percent = $percent; currentValue = $currentValue; slider = $slider; track = $track; } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public override function clone():Event { return new SliderEvent(type, percent, currentValue, slider, track, bubbles, cancelable); } /** * @private */ public override function toString():String { return formatToString("SliderUIEvent", "percent", "currentValue", "slider", "track", "type", "bubbles", "cancelable"); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/text/types/HTMLTextField.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.text.types { import com.reintroducing.data.text.config.ITextConfig; 2 | import com.reintroducing.data.text.config.HTMLTextConfig; import com.reintroducing.data.text.lang.Language; import flash.text.TextField; import flash.utils.getQualifiedClassName; /** * Utility class used to create an HTML TextField in the TextManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class HTMLTextField { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function HTMLTextField() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Creates the TextField. * * @param $language The Language to use from the TextManager * @param $config The text configuration to use * @param $content The text which will populate the TextField * * @return TextField */ public static function create($language:Language, $config:ITextConfig, $content:String):TextField { var config:HTMLTextConfig = ($config as HTMLTextConfig); var tf:TextField = new TextField(); tf.styleSheet = $language.styleSheet; tf.antiAliasType = config.antiAliasType; tf.embedFonts = $language.embed; tf.autoSize = config.autoSize; tf.selectable = config.selectable; tf.wordWrap = config.wordWrap; tf.multiline = config.multiline; tf.width = config.width; tf.height = config.height; tf.htmlText = $content; return tf; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/src/slider/MainSlider.as: -------------------------------------------------------------------------------- 1 | package slider { import com.reintroducing.data.slider.SliderData; 2 | import com.reintroducing.events.SliderEvent; import com.reintroducing.ui.slider.Slider; import flash.display.MovieClip; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MainSlider extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private var _slider:Slider; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var sliderBtn:MovieClip; public var track:MovieClip; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MainSlider():void { super(); init(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- /** * */ private function init():void { var sd:SliderData = new SliderData(); sd.stage = stage; sd.axis = SliderData.AXIS_X; sd.track = track; sd.slider = sliderBtn; sd.lowValue = 100; sd.highValue = 0; sd.startValue = 10; sd.precision = 0; _slider = new Slider(sd); _slider.addEventListener(SliderEvent.ON_PRESS, onSliderPress, false, 0, true); _slider.addEventListener(SliderEvent.ON_RELEASE, onSliderRelease, false, 0, true); _slider.addEventListener(SliderEvent.ON_UPDATE, onSliderUpdate, false, 0, true); } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- /** * */ private function onSliderPress($evt:SliderEvent):void { trace("slider pressed"); } /** * */ private function onSliderRelease($evt:SliderEvent):void { trace("slider released"); } /** * */ private function onSliderUpdate($evt:SliderEvent):void { trace("CURRENT VALUE: " + $evt.currentValue); trace("CURRENT PERCENT: " + $evt.percent); } //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/src/mousepositionpanel/MainMousePositionPanel.as: -------------------------------------------------------------------------------- 1 | package mousepositionpanel { import flash.events.MouseEvent; 2 | import com.reintroducing.ui.mousepositionpanel.MousePositionPanel; 3 | import com.reintroducing.data.mousepositionpanel.MousePositionPanelData; import flash.display.MovieClip; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MainMousePositionPanel extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private var _mpp:MousePositionPanel; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var holder:MovieClip; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MainMousePositionPanel() { super(); init(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- /** * */ private function init():void { var mppData:MousePositionPanelData = new MousePositionPanelData(); mppData.itemHolder = holder; mppData.content = holder.content; mppData.masker = holder.masker; mppData.axis = MousePositionPanelData.AXIS_X; mppData.moveType = MousePositionPanelData.TYPE_AGAINST_MOUSE; mppData.speed = 10; _mpp = new MousePositionPanel(mppData); holder.addEventListener(MouseEvent.ROLL_OVER, handleStartPanel, false, 0, true); holder.addEventListener(MouseEvent.ROLL_OUT, handleStopPanel, false, 0, true); } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- /** * */ private function handleStartPanel($evt:MouseEvent):void { trace("MainMousePositionPanel.handleStartPanel(",[$evt],")"); _mpp.startPanel(); } /** * */ private function handleStopPanel($evt:MouseEvent):void { trace("MainMousePositionPanel.handleStopPanel(",[$evt],")"); _mpp.stopPanel(); } //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/text/types/StaticTextField.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.text.types { import com.reintroducing.data.text.config.ITextConfig; 2 | import com.reintroducing.data.text.config.StaticTextConfig; import com.reintroducing.data.text.lang.Language; import flash.text.TextField; import flash.utils.getQualifiedClassName; /** * Utility class used to create a Static TextField in the TextManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class StaticTextField { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function StaticTextField() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Creates the TextField. * * @param $language The Language to use from the TextManager * @param $config The text configuration to use * @param $style The name of the CSS style to use to style the TextField * @param $content The text which will populate the TextField * * @return TextField */ public static function create($language:Language, $config:ITextConfig, $style:String, $content:String):TextField { var config:StaticTextConfig = ($config as StaticTextConfig); var styleObj:Object = $language.styleSheet.getStyle(String("." + $style)); var tf:TextField = new TextField(); tf.defaultTextFormat = $language.styleSheet.transform(styleObj); tf.antiAliasType = config.antiAliasType; tf.embedFonts = $language.embed; tf.autoSize = config.autoSize; tf.selectable = config.selectable; tf.wordWrap = config.wordWrap; tf.multiline = config.multiline; tf.width = config.width; tf.height = config.height; tf.text = $content; return tf; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/text/types/InputTextField.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.text.types { import com.reintroducing.data.text.config.ITextConfig; 2 | import com.reintroducing.data.text.config.InputTextConfig; import com.reintroducing.data.text.lang.Language; import flash.text.TextField; import flash.utils.getQualifiedClassName; /** * Utility class used to create an Input TextField in the TextManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class InputTextField { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function InputTextField() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Creates the TextField. * * @param $language The Language to use from the TextManager * @param $config The text configuration to use * @param $style The name of the CSS style to use to style the TextField * @param $content The text which will populate the TextField * * @return TextField */ public static function create($language:Language, $config:ITextConfig, $style:String, $content:String):TextField { var config:InputTextConfig = ($config as InputTextConfig); var styleObj:Object = $language.styleSheet.getStyle(String("." + $style)); var tf:TextField = new TextField(); tf.type = config.type; tf.defaultTextFormat = $language.styleSheet.transform(styleObj); tf.antiAliasType = config.antiAliasType; tf.embedFonts = $language.embed; tf.autoSize = config.autoSize; tf.wordWrap = config.wordWrap; tf.multiline = config.multiline; tf.width = config.width; tf.height = config.height; tf.mouseEnabled = config.mouseEnabled; tf.background = config.background; tf.backgroundColor = config.backgroundColor; tf.text = $content; return tf; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/BitmapUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.display.Bitmap; import flash.display.BitmapData; import flash.geom.Point; import flash.geom.Rectangle; import flash.utils.getQualifiedClassName; /** * Static utility methods used to manipulate bitmaps. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class BitmapUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function BitmapUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Creates a new bitmap which is a clone of the original. * * @param $bmp The bitmap to be cloned * * @return Bitmap */ public static function getClone($bmp:Bitmap):Bitmap { return new Bitmap($bmp.bitmapData.clone()); } /** * Clears the BitmapData's contents. * * @param $bmd The bitmap data to be cleared * * @return void */ public static function clearBitmapData($bmd:BitmapData):void { $bmd.fillRect($bmd.rect, 0); } /** * Slices a bitmap into a grid of tiles specified by row and column count. * * @param $bmp The bitmap to be tiled * @param $numRows Number of rows * @param $numCols Number of columns * * @return Array 2-Dimensional array of bitmaps */ public static function createTiles($bmp:Bitmap, $numRows:int = 3, $numCols:int = 3):Array { var w:Number = ($bmp.width / $numCols); var h:Number = ($bmp.height / $numRows); var tiles:Array = []; var rect:Rectangle; var bmpTile:Bitmap; var bmd:BitmapData; for (var i:int = 0; i < $numRows; i++) { tiles[i] = new Array(); for (var j:int = 0; j < $numCols; j++) { bmd = new BitmapData(w, h, true, 0x00000000); rect = new Rectangle((j * w), (i * h), w, h); bmd.copyPixels($bmp.bitmapData, rect, new Point(0, 0)); bmpTile = new Bitmap(bmd); tiles[i][j] = bmpTile; } } return tiles; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/LayoutUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.geom.Point; import flash.utils.getQualifiedClassName; /** * Static utility methods used to aid in laying out objects on the stage. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class LayoutUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function LayoutUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Creates a grid and returns a vector of points with x and y values based on passed parameters. * The $leftToRight addition was contributed by Skye Giordano. * * @param $columns An integer representing the number of columns to be created in the grid * @param $rows An integer representing the number of rows to be created in the grid * @param $xSpacing An integer representing the spacing between columns * @param $ySpacing An integer representing the spacing between rows * @param $xPadding An integer representing the padding between each column * @param $yPadding An integer representing the padding between each row * @param $leftToRight An optional boolean that creates the grid from left-to-right or top-to-bottom (default: true) * * @return Vector. */ public static function createGrid($columns:int, $rows:int, $xSpacing:int, $ySpacing:int, $xPadding:int, $yPadding:int, $leftToRight:Boolean = true):Vector. { var points:Vector. = new Vector.(); var pt:Point; var row:Number; var col:Number; var num:int = ($columns * $rows); for (var i:int = 0; i < num; i++) { pt = new Point(); if ($leftToRight) { row = (i % $columns); col = Math.floor(i / $columns); pt.x = (row * ($xSpacing + $xPadding)); pt.y = (col * ($ySpacing + $yPadding)); } else { row = (i % $rows); col = Math.floor(i / $rows); pt.x = (col * ($xSpacing + $xPadding)); pt.y = (row * ($ySpacing + $yPadding)); } points.push(pt); } return points; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/src/pulloutmenu/MainPullOutMenu.as: -------------------------------------------------------------------------------- 1 | package pulloutmenu { import com.reintroducing.data.pulloutmenu.PullOutMenuData; import com.reintroducing.ui.pulloutmenu.PullOutMenu; import flash.display.MovieClip; import flash.display.Sprite; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MainPullOutMenu extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var itemHolder:MovieClip; public var hitBtn:MovieClip; public var pomDown:PullOutMenu; public var pomRight:PullOutMenu; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MainPullOutMenu():void { super(); this.init(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- /** * */ private function init():void { var pomDownData:PullOutMenuData = new PullOutMenuData(); pomDownData.hitButton = this.hitBtn; pomDownData.itemHolder = this.itemHolder; pomDownData.startPosition = -129; pomDownData.endPosition = 26; pomDown = new PullOutMenu(pomDownData); pomDown.x = pomDown.y = 100; addChild(pomDown); createDynamicRightMenu(); } /** * */ private function createDynamicRightMenu():void { var rightHit:Sprite = new Sprite(); rightHit.graphics.beginFill(0x111111); rightHit.graphics.drawRect(0, 0, 20, 100); rightHit.graphics.endFill(); rightHit.buttonMode = true; var menu:Sprite = new Sprite(); var item:Sprite; for (var i:int = 0; i < 5; i++) { item = new Sprite(); item.graphics.beginFill(Math.random() * 0xFFFFFF); item.graphics.drawRect(0, 0, 20, 100); item.graphics.endFill(); item.x = (i * 20); item.buttonMode = true; menu.addChild(item); } var pomRightData:PullOutMenuData = new PullOutMenuData(); pomRightData.axis = PullOutMenuData.AXIS_X; pomRightData.eventType = PullOutMenuData.TYPE_RELEASE; pomRightData.hitButton = rightHit; pomRightData.itemHolder = menu; pomRightData.startPosition = -100; pomRightData.endPosition = 20; pomRight = new PullOutMenu(pomRightData); pomRight.x = 300; pomRight.y = 100; addChild(pomRight); } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/events/SoundManagerEvent.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.events { import com.reintroducing.sound.SoundItem; import flash.events.Event; /** * Event dispatched by the SoundManager. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class SoundManagerEvent extends Event { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- // event constants public static const SOUND_ITEM_ADDED:String = "sound.item.added"; public static const SOUND_ITEM_REMOVED:String = "sound.item.removed"; public static const SOUND_ITEM_PLAY_START:String = "sound.item.play.start"; public static const SOUND_ITEM_PAUSE:String = "sound.item.pause"; public static const SOUND_ITEM_STOP:String = "sound.item.stop"; public static const SOUND_ITEM_PLAY_COMPLETE:String = "sound.item.play.complete"; public static const SOUND_ITEM_FADE:String = "sound.item.fade"; public static const SOUND_ITEM_FADE_COMPLETE:String = "sound.item.fade.complete"; public static const SOUND_ITEM_LOAD_ERROR:String = "sound.item.load.error"; public static const SOUND_ITEM_LOAD_PROGRESS:String = "sound.item.load.progress"; public static const SOUND_ITEM_LOAD_COMPLETE:String = "sound.item.load.complete"; public static const REMOVED_ALL:String = "removed.all"; public static const PLAY_ALL:String = "play.all"; public static const STOP_ALL:String = "stop.all"; public static const PAUSE_ALL:String = "pause.all"; public static const MUTE_ALL:String = "mute.all"; public static const UNMUTE_ALL:String = "unmute.all"; public var soundItem:SoundItem; public var duration:Number; public var percent:Number; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function SoundManagerEvent($type:String, $soundItem:SoundItem = null, $duration:Number = 0, $percent:Number = 0, $bubbles:Boolean = false, $cancelable:Boolean = false) { super($type, $bubbles, $cancelable); this.soundItem = $soundItem; this.duration = $duration; this.percent = $percent; } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public override function clone():Event { return new SoundManagerEvent(type, this.soundItem, this.duration, this.percent, bubbles, cancelable); } /** * @private */ public override function toString():String { return formatToString("SoundManagerEvent", "soundItem", "duration", "percent", "type", "bubbles", "cancelable"); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/SharedObjectManager.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.events.Event; import flash.events.EventDispatcher; import flash.events.NetStatusEvent; import flash.net.SharedObject; import flash.utils.getQualifiedClassName; /** * A simple utility to manage shared objects and their properties. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.1 */ public class SharedObjectManager extends EventDispatcher { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private var _so:SharedObject; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- /** * Creates a new instance of the SharedObjectManager class. * * @param $name A string value representing the shared object to create/retrieve from the user's hard drive * @param $localPath (Optional) A string value representing the path to where the shared object is stored locally * @param $secure (Optional) A boolean that determines whether access to this shared object is restricted to SWF files that are delievered over an HTTPS connection */ public function SharedObjectManager($name:String, $localPath:String = null, $secure:Boolean = false) { _so = SharedObject.getLocal($name, $localPath, $secure); _so.addEventListener(NetStatusEvent.NET_STATUS, onStatus); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- private function onStatus($evt:NetStatusEvent):void { switch ($evt.info.code) { case "SharedObject.Flush.Success": dispatchEvent(new Event(Event.COMPLETE)); break; case "SharedObject.Flush.Failed": dispatchEvent(new Event(Event.CANCEL)); break; } } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Sets a "cookie" (property/value pair) object in the current shared object and saves it to the user's hard drive. * * @param $obj An object that represents the property/value pair to be stored in the shared object * * @return void */ public function setProperty($obj:Object):void { var prop:String; for (prop in $obj) { _so.data[prop] = $obj[prop]; _so.flush(); } } /** * Returns the value for the requested property. * * @param $name A string that represents the name of the property you want to retrieve * * @return String */ public function getProperty($name:String):String { return _so.data[$name]; } /** * Clears the current shared object. * * @return void */ public function clear():void { _so.clear(); } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public override function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/src/textmanager/MainTextManager.as: -------------------------------------------------------------------------------- 1 | package textmanager { import com.greensock.events.LoaderEvent; import com.greensock.loading.CSSLoader; import com.greensock.loading.LoaderMax; import com.reintroducing.data.text.TextManagerConstants; import com.reintroducing.data.text.config.InputTextConfig; import com.reintroducing.data.text.lang.Language; import com.reintroducing.text.TextManager; import com.reintroducing.utils.FontUtils; import flash.display.MovieClip; import flash.text.StyleSheet; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MainTextManager extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private var _tm:TextManager; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MainTextManager():void { super(); this.init(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- /** * */ private function init():void { FontUtils.outputFonts(); var loader:CSSLoader = new CSSLoader("../css/english-styles.css", {name: "textStyles", onComplete: handleCSSLoaded}); loader.load(); } /** * */ private function createText():void { var header:TextField = _tm.createTextField(TextManagerConstants.TYPE_STATIC, "The Header", "header"); var body:TextField = _tm.createTextField(TextManagerConstants.TYPE_STATIC, "This is body copy that would go underneath the header", "bodyCopy"); body.y = (header.y + header.height + 5); var footer:TextField = _tm.createTextField(TextManagerConstants.TYPE_STATIC, "Copyright ME 2010", "footer"); footer.y = (body.y + body.height + 5); var htmlTest:TextField = _tm.createTextField(TextManagerConstants.TYPE_HTML, "It's
Christmas"); htmlTest.x = 100; htmlTest.y = (footer.y + footer.height + 20); var inputConfig:InputTextConfig = new InputTextConfig(); inputConfig.autoSize = TextFieldAutoSize.NONE; inputConfig.width = 200; inputConfig.height = 30; inputConfig.background = true; inputConfig.backgroundColor = 0x222222; var inputTest:TextField = _tm.createTextField(TextManagerConstants.TYPE_INPUT, "Type here!", "inputTest", inputConfig); inputTest.x = 50; inputTest.y = (htmlTest.y + htmlTest.height + 20); addChild(header); addChild(body); addChild(footer); addChild(htmlTest); addChild(inputTest); } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- /** * */ private function handleCSSLoaded($evt:LoaderEvent):void { var sheet:StyleSheet = LoaderMax.getContent("textStyles"); var lang:Language = new Language(); lang.styleSheet = sheet; _tm = TextManager.getInstance(lang); createText(); } //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/DateUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.utils.getQualifiedClassName; /** * Static utility methods used to manipulate dates. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class DateUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private static const MONTHS:Array = [" JANUARY JAN 01 1 ", " FEBRUARY FEB 02 2 ", " MARCH MAR 03 3 ", " APRIL APR 04 4 ", " MAY 05 5 ", " JUNE JUN 06 6 ", " JULY JUL 07 7 ", " AUGUST AUG 08 8 ", " SEPTEMBER SEP 09 9 ", " OCTOBER OCT 10 ", " NOVEMBER NOV 11 ", " DECEMBER DEC 12 "]; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function DateUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- private static function parseYear($n:Number):Number { if ($n > 100) { return $n; } else { var today:Date = new Date(); var localYear:Number = (today.getFullYear() - 2000); if ($n < localYear) { return ($n + 2000); } else { return ($n + 1900); } } } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Returns time in hh:mm:ss format from seconds. * * @param $time The time to convert, in seconds * * @return String */ public static function formatTime($time:Number):String { var remainder:Number; var hours:Number = ($time / (60 * 60)); remainder = (hours - Math.floor(hours)); hours = Math.floor(hours); var minutes:Number = (remainder * 60); remainder = (minutes - Math.floor(minutes)); minutes = Math.floor(minutes); var seconds:Number = (remainder * 60); remainder = (seconds - Math.floor(seconds)); seconds = Math.floor(seconds); var hString:String = hours < 10 ? "0" + hours : "" + hours; var mString:String = minutes < 10 ? "0" + minutes : "" + minutes; var sString:String = seconds < 10 ? "0" + seconds : "" + seconds; if ($time < 0 || isNaN($time)) return "00:00"; if (hours > 0) { return hString + ":" + mString + ":" + sString; } else { return mString + ":" + sString; } } /** * Converts a date provided as a string into a Date object. * Pass something like "January 1, 2007" or "Jan 1 2007" or "1/1/2007" * * @param $s The date to convert * * @return Date */ public static function stringToDate($s:String):Date { $s = $s.toUpperCase(); $s = $s.split(",").join(""); // eliminate commas $s = $s.split("/").join(" "); // replace slashes with spaces var a:Array = $s.split(" "); var paddedMonth:String = String(" " + a[0] + " "); var m:Number; var i:int; for (i = 0; i < MONTHS.length; i++) { if (MONTHS[i].indexOf(paddedMonth) != -1) { m = i; break; } } if (isNaN(m) || isNaN(a[1]) || Number(a[1]) > 31 || Number(a[1]) < 1 || isNaN(a[2])) { return null; } return new Date(parseYear(a[2]), m, a[1]); } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/ArrayUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.utils.getQualifiedClassName; /** * Static utility methods used to manipulate arrays. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class ArrayUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function ArrayUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Randomizes the order of items in an array. * * @param $array The array to randomize * * @return Array */ public static function randomize($array:Array):Array { var returnArray:Array = []; var orgArray:Array = $array.slice(); while (orgArray.length > 0) { var r:int = (Math.random() * orgArray.length) >> 0; returnArray.push(orgArray.splice(r, 1)[0]); } return returnArray; } /** * Removes duplicate items from an array. * * @param $array The array to remove duplicates in * * @return Array */ public static function removeDuplicates($array:Array):Array { return $array.filter(function(e:*, i:int, a:Array):Boolean {return a.indexOf(e) == i;}); } /** * Duplicates an array without altering the original. * * @param $array The array to duplicate * * @return Array */ public static function clone($array:Array):Array { return $array.concat(); } /** * Returns the index of the specified value. * * @param $array The array to check * @param $value The value to test against * * @return int */ public static function getIndex($array:Array, $value:*):int { for (var i:int = 0; i < $array.length; i++) { if ($array[i] == $value) {return i;} } return -1; } /** * Choose an item randomly from a number of different values. * * @param args The items to choose from * *
		 * 		var val:* = ArrayUtils.getRandomItem(10, "Hello", "0xFF0000", 1000);
		 * 
* * @return An unspecified value that is selected at random */ public static function getRandomItem(...args:Array):* { return args[int(Math.random() * args.length)]; } /** * Returns the number of instances of an item within a given array. * * @param $array The array to check in * @param $item The item to check for * * @return uint */ public static function contains($array:Array, $item:*):uint { var i:int = $array.indexOf($item, 0); var t:uint = 0; while (i != -1) { i = $array.indexOf($item, (i + 1)); t++; } return t; } /** * Removes all instances of the specified value from an array. * * @param $array The array to check in * @param $value The value to check for * * @return void */ public static function removeValue($array:Array, $value:Object):void { var len:uint = $array.length; for (var i:Number = len; i > -1; i--) { if ($array[i] === $value) { $array.splice(i, 1); } } } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/debug/Environment.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.debug { import flash.display.Stage; import flash.system.Capabilities; import flash.utils.getQualifiedClassName; /** * A small Singleton utility class that allows you to set debug and live path variables for local and remote testing without having to toggle anything. * * @author Joshua Perez [http://www.joshua-studios.com] * @author Matt Przybylski [http://www.reintroducing.com] * @version 2.0 */ public class Environment { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- // singleton instance private static var _instance:Environment; private static var _allowInstance:Boolean; private var _debugPath:String; private var _livePath:String; private var _basePath:String; private var _isLive:Boolean; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- // singleton instance of Environment public static function getInstance():Environment { if (_instance == null) { _allowInstance = true; _instance = new Environment(); _allowInstance = false; } return _instance; } public function Environment() { if (!_allowInstance) { throw new Error("Error: Use Environment.getInstance() instead of the new keyword."); } } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- private function setProperPath($useServerCheck:Boolean, $stage:Stage):void { if ($useServerCheck) { if ($stage.loaderInfo.url.indexOf("file:") != -1) { _basePath = _debugPath; _isLive = false; } else { _basePath = _livePath; _isLive = true; } } else { if (Capabilities.playerType == "PlugIn" || Capabilities.playerType == "ActiveX") { _basePath = _livePath; _isLive = true; } else { _basePath = _debugPath; _isLive = false; } } } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Sets the proper debug/live paths. * * @param $debugPath A string representing the local (debug) path * @param $livePath A string representing the remote (live) path * @param $useServerCheck Check against path of file as it pertains to the server rather than player type * @param $stage If using $useServerCheck, pass the stage reference * * @return void */ public function setPaths($debugPath:String, $livePath:String, $useServerCheck:Boolean = false, $stage:Stage = null):void { _debugPath = $debugPath; _livePath = $livePath; setProperPath($useServerCheck, $stage); } /** * Returns a player and environment info string. * * @return String */ public function getPlayerInfo():String { var debugger:String = (Capabilities.isDebugger) ? " / Debugger" : ""; var info:String = String("Flash Platform: " + Capabilities.version + " / " + Capabilities.playerType + debugger + " / " + Capabilities.os + " / " + Capabilities.screenResolutionX + "x" + Capabilities.screenResolutionY); return info; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- /** * Returns the basePath for use in loading assets. * * @return String */ public function get basePath():String { return _basePath; } /** * Returns a Boolean value if the site is on a live server or being tested locally. * * @return Boolean */ public function get isLive():Boolean { return _isLive; } //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/DisplayObjectUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.display.MovieClip; import flash.utils.getQualifiedClassName; /** * Static utility methods used to manipulate DisplayObjects. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class DisplayObjectUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function DisplayObjectUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Removes all the children from the specified DisplayObjectContainer. * * @param $do The DisplayObjectContainer to remove children from * * @return void */ public static function removeAllChildren($do:DisplayObjectContainer):void { while ($do.numChildren) { $do.removeChildAt(0); } } /** * Resizes a DisplayObject to the specified width/height and allows to control aspect ratio. * Originally written by Evan Mullins [http://blog.circlecube.com/] * * @param $do The DisplayObject to resize * @param $maxW The maximum desired width * @param $maxH The maximum desired height (default: 0, matches $maxW and resizes into a square) * @param $constrainProportions A boolean that identifies if you should maintain the aspect ratio * * @return void */ public static function resizeTo($do:DisplayObject, $maxW:Number, $maxH:Number = 0, $constrainProportions:Boolean = true):void { $maxH = ($maxH == 0) ? $maxW : $maxH; $do.width = $maxW; $do.height = $maxH; if ($constrainProportions) { ($do.scaleX < $do.scaleY) ? $do.scaleY = $do.scaleX : $do.scaleX = $do.scaleY; } } /** * Plays all MovieClips (and any of their children) on the specified object's timeline. * If any of the clips have reached their last frame, they will not replay. * * @param $obj The timeline (and all of its children) to play the MovieClips of * * @return void */ protected function playMovieClips($obj:DisplayObject):void { var mc:MovieClip = $obj as MovieClip; if (mc == null) { return; } if (mc.currentFrame != mc.totalFrames) mc.play(); var i:int = mc.numChildren; while (--i > -1) { playMovieClips(mc.getChildAt(i)); } } /** * Stops all MovieClips (and any of their children) on the specified object's timeline. * * @param $obj The timeline (and all of its children) to stop the MovieClips of * * @return void */ protected function stopMovieClips($obj:DisplayObject):void { var mc:MovieClip = $obj as MovieClip; if (mc == null) { return; } mc.stop(); var i:int = mc.numChildren; while (--i > -1) { stopMovieClips(mc.getChildAt(i)); } } /** * Determines the frame number for the specified label. * * @param $target The MovieClip to search for the frame label in * @param $label The name of the frame label * * @return int The frame number of the label or -1 if the frame label was not found */ public function getFrameNumberForLabel($target:MovieClip, $label:String):int { var labels:Array = $target.currentLabels; var l:int = labels.length; while (l--) { if (labels[l].name == $label) return labels[l].frame; } return -1; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/LinkUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import com.reintroducing.data.link.LinkData; import flash.external.ExternalInterface; import flash.net.URLRequest; import flash.net.navigateToURL; import flash.utils.getQualifiedClassName; /** * Static utility methods to easily create external links. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class LinkUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function LinkUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Launches a link with the specified data. * * @param $linkData The LinkData to pass in to the request * * @return void */ public static function launch($linkData:LinkData):void { var url:URLRequest = new URLRequest($linkData.sourceURL); navigateToURL(url, $linkData.targetWindow); } /** * Opens a popup window with the specified data. * * @param $linkData The LinkData to pass in to the popup * * @return void */ public static function openPopup($linkData:LinkData):void { if (ExternalInterface.available) { var params:String = ""; params += "width=" + $linkData.windowWidth; params += ",height=" + $linkData.windowHeight; params += ",left=" + $linkData.windowX; params += ",top=" + $linkData.windowY; params += ",status=" + String(($linkData.statusBar) ? "1" : "0"); params += ",toolbar=" + String(($linkData.toolBar) ? "1" : "0"); params += ",location=" + String(($linkData.location) ? "1" : "0"); params += ",menubar=" + String(($linkData.menuBar) ? "1" : "0"); params += ",directories=" + String(($linkData.directories) ? "1" : "0"); params += ",resizable=" + String(($linkData.resizable) ? "1" : "0"); params += ",scrollbars=" + String(($linkData.scrollBars) ? "1" : "0"); params += ",copyhistory=" + String(($linkData.scrollBars) ? "1" : "0"); params += ",fullscreen=" + String(($linkData.fullScreen) ? "1" : "0"); ExternalInterface.call("window.open", $linkData.sourceURL, $linkData.windowName, params); } else { var javaScriptStr:String = "javascript:NewWindow=window.open('"; javaScriptStr += $linkData.sourceURL; javaScriptStr += "','" + $linkData.windowName + "','"; javaScriptStr += "height=" + $linkData.windowHeight; javaScriptStr += ",width=" + $linkData.windowWidth; javaScriptStr += ",left=" + $linkData.windowX; javaScriptStr += ",top=" + $linkData.windowY; javaScriptStr += ",status=" + String(($linkData.statusBar) ? "yes" : "no"); javaScriptStr += ",toolbar=" + String(($linkData.toolBar) ? "yes" : "no"); javaScriptStr += ",location=" + String(($linkData.location) ? "yes" : "no"); javaScriptStr += ",menubar=" + String(($linkData.menuBar) ? "yes" : "no"); javaScriptStr += ",directories=" + String(($linkData.directories) ? "yes" : "no"); javaScriptStr += ",resizable=" + String(($linkData.resizable) ? "yes" : "no"); javaScriptStr += ",scrollbars=" + String(($linkData.scrollBars) ? "yes" : "no"); javaScriptStr += ",copyhistory=" + String(($linkData.copyHistory) ? "yes" : "no"); javaScriptStr += ",fullscreen=" + String(($linkData.fullScreen) ? "yes" : "no"); javaScriptStr += "'); NewWindow.focus(); void(0);"; var url:URLRequest = new URLRequest(javaScriptStr); navigateToURL(url); } } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/ExternalInterfaceManager.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils 2 | { 3 | import com.reintroducing.data.utils.ExternalInterfaceMethod; 4 | import flash.external.ExternalInterface; 5 | import flash.utils.clearInterval; 6 | import flash.utils.getQualifiedClassName; 7 | import flash.utils.setInterval; 8 | 9 | /** 10 | * Utility to buffer outgoing ExternalInterface calls. Simultaneous calls get dropped if they aren't buffered. It seems both Firefox and IE's script engine gets overloaded and either drops calls or 11 | * throws a JavaScript error. This buffer ensures the script engines only get one call at a time. 12 | * 13 | *
 14 | 	 * 		var eiMethod:ExternalInterfaceMethod = new ExternalInterfaceMethod();
 15 | 	 * 		eiMethod.methodName = "jsMethodName";
 16 | 	 * 		eiMethod.methodParameters = {argA: "blah", argB: "merp", argC: "DOH"};
 17 | 	 * 		
	 * 		ExternalInterfaceManager.getInstance().call(eiMethod);
 18 | 	 * 
19 | * 20 | * @author Scott Morgan for Yahoo! Maps AS3 Communication Kit (2007) 21 | * @author Matt Przybylski [http://www.reintroducing.com] - Modified to use strongly typed ExternalInterfaceMethod value object 22 | * @version 1.0 23 | */ 24 | public class ExternalInterfaceManager 25 | { 26 | //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- 27 | 28 | // singleton instance 29 | private static var _instance:ExternalInterfaceManager; 30 | private static var _allowInstance:Boolean; 31 | 32 | private var methodQueue:Array = []; 33 | private var methodCallInterval:Number; 34 | 35 | //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- 36 | 37 | 38 | 39 | //- CONSTRUCTOR ------------------------------------------------------------------------------------------- 40 | 41 | // singleton instance of ExternalInterfaceManager 42 | public static function getInstance():ExternalInterfaceManager 43 | { 44 | if (_instance == null) 45 | { 46 | _allowInstance = true; 47 | _instance = new ExternalInterfaceManager(); 48 | _allowInstance = false; 49 | } 50 | 51 | return _instance; 52 | } 53 | 54 | public function ExternalInterfaceManager() 55 | { 56 | if (!_allowInstance) 57 | { 58 | throw new Error("Error: Use ExternalInterfaceManager.getInstance() instead of the new keyword."); 59 | } 60 | } 61 | 62 | //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- 63 | 64 | /** 65 | * Called every 50 milliseconds until the methodQueue array is empty. This method sends the first method listed in the methodQueue array to the 66 | * ExternalInterface.call method. 67 | * 68 | * @return void 69 | */ 70 | private function methodChurn():void 71 | { 72 | var eiMethod:ExternalInterfaceMethod = (methodQueue[0] as ExternalInterfaceMethod); 73 | 74 | if (eiMethod.methodName) ExternalInterface.call(eiMethod.methodName, eiMethod.methodParameters); 75 | 76 | methodQueue.shift(); 77 | 78 | if (methodQueue.length == 0) 79 | { 80 | clearInterval(methodCallInterval); 81 | 82 | methodCallInterval = undefined; 83 | } 84 | } 85 | 86 | //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- 87 | 88 | /** 89 | * Adds calls to the methodQueue array. If the length of the methodQueue array is greater than 0 the methodChurn interval is kicked off and runs every 50 90 | * milliseconds until the methodQueue's length is 0 at which point the interval is cleared. 91 | * 92 | * @param $eiMethod The ExternalInterfaceMethod object to send to the queue. 93 | * 94 | * @return void 95 | */ 96 | public function call($eiMethod:ExternalInterfaceMethod):void 97 | { 98 | methodQueue.push($eiMethod); 99 | 100 | if (isNaN(methodCallInterval) || methodCallInterval == 0) methodCallInterval = setInterval(methodChurn, 50); 101 | } 102 | 103 | //- EVENT HANDLERS ---------------------------------------------------------------------------------------- 104 | 105 | 106 | 107 | //- GETTERS & SETTERS ------------------------------------------------------------------------------------- 108 | 109 | 110 | 111 | //- HELPERS ----------------------------------------------------------------------------------------------- 112 | 113 | /** 114 | * @private 115 | */ 116 | public function toString():String 117 | { 118 | return getQualifiedClassName(this); 119 | } 120 | 121 | //- END CLASS --------------------------------------------------------------------------------------------- 122 | } 123 | } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/ColorUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.utils.getQualifiedClassName; /** * Static utility methods used to manipulate colors. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class ColorUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function ColorUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Returns the value of red in the specified color (0 - 255). * * @param $color The color, in hexadecimal format, to extract the red value from * * @return uint */ public static function extractRed($color:uint):uint { return (($color >> 16) & 0xFF); } /** * Returns the value of green in the specified color (0 - 255). * * @param $color The color, in hexadecimal format, to extract the green value from * * @return uint */ public static function extractGreen($color:uint):uint { return (($color >> 8) & 0xFF); } /** * Returns the value of blue in the specified color (0 - 255). * * @param $color The color, in hexadecimal format, to extract the blue value from * * @return uint */ public static function extractBlue($color:uint):uint { return ($color & 0xFF); } /** * Returns the value of alpha in the specified color (0 - 255). * * @param $color The color, in hexadecimal format, to extract the blue value from * * @return uint */ public static function extractAlpha($color:uint):uint { return (($color >> 24 ) & 0xFF); } /** * Combines red, blue, and green components into a color value. * * @param $r The red value * @param $g The green value * @param $b The blue value * * @return uint The numerical representation of the combined colors */ public static function combineRGB($r:uint, $g:uint, $b:uint):uint { return (($r << 16) | ($g << 8) | $b); } /** * Combines alpha, red, blue, and green components into a color value. * * @param $a The alpha value * @param $r The red value * @param $g The green value * @param $b The blue value * * @return uint The numerical representation of the combined colors */ public static function combineARGB($a:uint, $r:uint, $g:uint, $b:uint):uint { return (($a << 24) | ($r << 16) | ($g << 8) | $b); } /** * Displays the specified numerical representation of a color (RGB) as a hexadecimal string. * * @param $color The numerical value of a color * * @return String The color represented in hexadecimal RGB */ public static function displayRGBasHex($color:uint):String { var r:String = extractRed($color).toString(16).toUpperCase(); var g:String = extractGreen($color).toString(16).toUpperCase(); var b:String = extractBlue($color).toString(16).toUpperCase(); var zero:String = "0"; if (r.length == 1) r = zero.concat(r); if (g.length == 1) g = zero.concat(g); if (b.length == 1) b = zero.concat(b); return String(r + g + b); } /** * Displays the specified numerical representation of a color (ARGB) as a hexadecimal string. * * @param $color The numerical value of a color * * @return String The color represented in hexadecimal ARGB */ public static function displayARGBasHex($color:uint):String { var a:String = extractAlpha($color).toString(16).toUpperCase(); var r:String = extractRed($color).toString(16).toUpperCase(); var g:String = extractGreen($color).toString(16).toUpperCase(); var b:String = extractBlue($color).toString(16).toUpperCase(); var zero:String = "0"; if (a.length == 1) a = zero.concat(a); if (r.length == 1) r = zero.concat(r); if (g.length == 1) g = zero.concat(g); if (b.length == 1) b = zero.concat(b); return String(a + r + g + b); } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/StringUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.utils.getQualifiedClassName; import flash.xml.XMLDocument; import flash.xml.XMLNode; import flash.xml.XMLNodeType; /** * Static utility methods for working with strings. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class StringUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function StringUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Converts the given string into a boolean. * * @param $string The string value to convert * * @return Boolean */ public static function stringToBoolean($string:String):Boolean { return ($string.toLowerCase() == "true" || $string.toLowerCase() == "1"); } /** * Counts the number of words in the given string. * * @param $string The string value to count the number of words in * * @return int */ public static function countWords($string:String):int { if ($string == null) { return 0; } return $string.match(/\b\w+\b/g).length; } /** * Checks if a string is empty or not. * * @param $string The string to check against * * @return Boolean */ public static function isEmpty($string:String):Boolean { if ($string == null || $string == " " || $string == "") { return true; } return !$string.length; } /** * Uses Regular Expressions to escape backslashes in the provided string. * Without using this method, a backslash will be removed from the string * because it is used to escape other characters. * * @param $string The string to escape slashes in * *
		 * 		trace(StringUtils.escapeBackslashes("this is \ the way to do it")); // traces "this is \ the way to do it"
		 * 
* * @return String */ public static function escapeBackslashes($string:String):String { return $string.replace(/\\/g, "\\\\"); } /** * Uses Regular Expressions to trim beginning and trailing white space. * * @param $string The string to trim white space in * * @return String */ public static function trimWhitespace($string:String):String { if ($string == null) { return ""; } return $string.replace(/^\s+|\s+$/g, ""); } /** * Unescapes html entities. * *
		 * 		trace(htmlUnescape("ham & eggs")); // traces ham & eggs
		 * 
* * @param $str The string to unescape * * @return String */ public static function htmlUnescape($str:String):String { return new XMLDocument($str).firstChild.nodeValue; } /** * Escapes html entities. * *
		 * 		trace(htmlEscape("ham & eggs")); // traces ham & eggs
		 * 
* * @param $str The string to escape * * @return String */ public static function htmlEscape($str:String):String { return XML(new XMLNode(XMLNodeType.TEXT_NODE, $str)).toXMLString(); } /** * Converts all XML tags to lowercase * *
		 * 		var x:XML = xmlTagsToLowerCase(new XML("test"));
		 * 		trace(x); // Output: test
		 * 
* * @param $xml The XML to convert * * @return XML */ public static function xmlTagsToLowerCase($xml:XML):XML { // convert the root tag to lowercase $xml.setName($xml.name().toString().toLowerCase()); for each (var attribute:XML in $xml.@*) { attribute.setName(attribute.name().toString().toLowerCase()); } // convert all descendant tags to lowercase for each (var child:XML in $xml..*) { // if the node is an element... if (child.nodeKind() == "element") { // ...change its name to lowercase. child.setName(child.name().toString().toLowerCase()); // if the node has any attributes, change their names to lowercase. for each (attribute in child.@*) { attribute.setName(attribute.name().toString().toLowerCase()); } } } return $xml; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/ui/mousepositionpanel/MousePositionPanel.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.ui.mousepositionpanel { import flash.display.Sprite; 2 | import com.reintroducing.data.mousepositionpanel.MousePositionPanelData; 3 | import flash.events.Event; import flash.events.MouseEvent; import flash.utils.getQualifiedClassName; /** * Creates a scrolling panel that allows for scrolling on the x or y axis depending on where the * mouse pointer is within the panel as well as going with or against the mouse. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.2 */ public class MousePositionPanel { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- protected var _holder:Sprite; protected var _mc:Sprite; protected var _mask:Sprite; protected var _axis:String; protected var _moveType:String; protected var _moveDir:Number; protected var _mouseAxis:String; protected var _changeProp:String; protected var _speed:Number; protected var _end:Number; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- /** * Creates a new instance of the MousePositionPanel class. * * @param $mousePositionPanelData The MousePositionPanelData to use with the MousePositionPanel * *

* The $mousePositionPanelData object takes the following values: *

    *
  • itemHolder: The sprite that holds the content and mask clips
  • *
  • content: The sprite to be scrolled
  • *
  • masker: The sprite that is used as the mask for the scrollable content area
  • *
  • axis: A string value of either MousePositionPanelData.AXIS_X or MousePositionPanelData.AXIS_Y that determines what axis the content is scrolled along (default: MousePositionPanelData.AXIS_X)
  • *
  • moveType: A string, MousePositionPanelData.TYPE_WITH_MOUSE (moves with the mouse) or MousePositionPanelData.TYPE_AGAINST_MOUSE (moves away from the mouse), (default: MousePositionPanelData.TYPE_AGAINST_MOUSE)
  • *
  • speed: A number that represents how fast to scroll the content (default: 10)
  • *
*

*/ public function MousePositionPanel($mousePositionPanelData:MousePositionPanelData) { _holder = $mousePositionPanelData.itemHolder; _mc = $mousePositionPanelData.content; _mask= $mousePositionPanelData.masker; _axis = $mousePositionPanelData.axis; _moveType = $mousePositionPanelData.moveType; _speed = $mousePositionPanelData.speed; manageAxis(); manageMoveType(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- // sets the proper axis properties private function manageAxis():void { if (_axis == MousePositionPanelData.AXIS_X) { _changeProp = "width"; _mouseAxis = "mouseX"; } else { _changeProp = "height"; _mouseAxis = "mouseY"; } } // sets the proper move direction private function manageMoveType():void { (_moveType == MousePositionPanelData.TYPE_WITH_MOUSE) ? _moveDir = 1 : _moveDir = -1; } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Starts the panel scrolling in the proper direction. * * @return void */ public function startPanel():void { _holder.addEventListener(MouseEvent.MOUSE_MOVE, movePanel); } /** * Stops the panel from scrolling any further. * * @return void */ public function stopPanel():void { _mc.removeEventListener(Event.ENTER_FRAME, manageMovement); _holder.removeEventListener(MouseEvent.MOUSE_MOVE, movePanel); } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- // initializes the movement of the panel protected function movePanel($evt:Event):void { var mousePercent:Number = (_holder[_mouseAxis] / _mask[_changeProp]); var mSpeed:Number = (_moveDir == 1) ? (1 - mousePercent) : mousePercent; _end = Math.round(-1 * ((_mc[_changeProp] - _mask[_changeProp]) * mSpeed)); _mc.addEventListener(Event.ENTER_FRAME, manageMovement); } // moves the panel protected function manageMovement($evt:Event):void { if (_mc[_axis] == _end) { _mc.removeEventListener(Event.ENTER_FRAME, manageMovement); } else if (_mc[_axis] > _end) { _mc[_axis] -= Math.ceil((_mc[_axis] - _end) * (_speed / 100)); } else if (_mc[_axis] < _end) { _mc[_axis] += Math.ceil((_end - _mc[_axis]) * (_speed / 100)); } } //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/text/TextManager.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.text { import com.reintroducing.data.text.TextManagerConstants; import com.reintroducing.data.text.config.HTMLTextConfig; import com.reintroducing.data.text.config.ITextConfig; import com.reintroducing.data.text.config.InputTextConfig; import com.reintroducing.data.text.config.StaticTextConfig; import com.reintroducing.data.text.lang.Language; import com.reintroducing.text.types.HTMLTextField; import com.reintroducing.text.types.InputTextField; import com.reintroducing.text.types.StaticTextField; import flash.text.TextField; import flash.utils.getQualifiedClassName; /** * A singleton which allows you to easily create any type of TextField dynamically while using external CSS files. * You can create a Language to go along with it making it very easy to swap out different text styles for localization. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class TextManager { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- // singleton instance private static var _instance:TextManager; private static var _allowInstance:Boolean; private var _language:Language; private var _debugMode:Boolean = false; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- // singleton instance of TextManager public static function getInstance($language:Language = null):TextManager { if (_instance == null) { _allowInstance = true; _instance = new TextManager($language); _allowInstance = false; } return _instance; } public function TextManager($language:Language) { if (!_allowInstance) { throw new Error("Error: Use TextManager.getInstance() instead of the new keyword."); } else { if ($language == null) throw new Error("Language cannot be null. Please define a Language with an associated styleSheet and pass it to TextManager.getInstance()"); _language = $language; } } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Creates a TextField of the specified type. * If debugMode is set to true the TextField will spit out the configuration into the trace panel. * * @param $type The type of TextField to create (TextManagerConstants.TYPE_STATIC, TextManagerConstants.TYPE_HTML, or TextManagerConstants.TYPE_INPUT) * @param $content The text to populate the TextField with * @param $style The CSS style to use for the TextField (not used for HTML TextFields as those can be specified inline with the span tag) * @param $config The configuration to use for the TextField * * @return TextField */ public function createTextField($type:String, $content:String, $style:String = null, $config:ITextConfig = null):TextField { var config:ITextConfig; var tf:TextField; switch ($type) { case TextManagerConstants.TYPE_STATIC: config = ($config != null) ? ($config as StaticTextConfig) : new StaticTextConfig(); tf = StaticTextField.create(_language, config, $style, $content); break; case TextManagerConstants.TYPE_HTML: config = ($config != null) ? ($config as HTMLTextConfig) : new HTMLTextConfig(); tf = HTMLTextField.create(_language, config, $content); break; case TextManagerConstants.TYPE_INPUT: config = ($config != null) ? ($config as InputTextConfig) : new InputTextConfig(); tf = InputTextField.create(_language, config, $style, $content); break; } if (_debugMode) config.output(); return tf; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- /** * Returns the Language associated with the TextManager. * * @return Language */ public function get language():Language { return _language; } /** * Sets the Language associated with the TextManager. * * @param $val The Language to use * * @return void */ public function set language($val:Language):void { _language = $val; } /** * Returns if the debug mode is set or not. * * @return Boolean */ public function get debugMode():Boolean { return _debugMode; } /** * Sets the debug mode. * * @param $val Turns the debug mode on or off * * @return void */ public function set debugMode($val:Boolean):void { _debugMode = $val; } //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/src/soundmanager/MainSoundManager.as: -------------------------------------------------------------------------------- 1 | package soundmanager { import flash.events.MouseEvent; import com.greensock.events.LoaderEvent; import com.greensock.loading.LoaderMax; import com.greensock.loading.MP3Loader; import com.reintroducing.debug.Environment; import com.reintroducing.events.SoundManagerEvent; import com.reintroducing.sound.SoundManager; import flash.display.MovieClip; import flash.display.Sprite; import flash.media.Sound; import flash.utils.getDefinitionByName; import flash.utils.getQualifiedClassName; /** * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MainSoundManager extends MovieClip { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private var _env:Environment; private var _sm:SoundManager; private var _mp3Loader:MP3Loader; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MainSoundManager() { super(); init(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- /** * */ private function init():void { _env = Environment.getInstance(); _env.setPaths("../", ""); var s:Sprite = new Sprite(); s.graphics.beginFill(0xff0000, 1); s.graphics.drawRect(0, 0, 100, 100); s.graphics.endFill(); s.addEventListener(MouseEvent.MOUSE_UP, handleBoxClicked); addChild(s); var s2:Sprite = new Sprite(); s2.graphics.beginFill(0xffff00, 1); s2.graphics.drawRect(0, 0, 100, 100); s2.graphics.endFill(); s2.addEventListener(MouseEvent.MOUSE_UP, handleBox2Clicked); s2.x = 100; addChild(s2); var s3:Sprite = new Sprite(); s3.graphics.beginFill(0xff00ff, 1); s3.graphics.drawRect(0, 0, 100, 100); s3.graphics.endFill(); s3.addEventListener(MouseEvent.MOUSE_UP, handleBox3Clicked); s3.x = 200; addChild(s3); // Set up the sound manager and its listeners _sm = SoundManager.getInstance(); _sm.addEventListener(SoundManagerEvent.SOUND_ITEM_ADDED, onSoundAdded); _sm.addEventListener(SoundManagerEvent.SOUND_ITEM_LOAD_PROGRESS, onSoundProgress); _sm.addEventListener(SoundManagerEvent.SOUND_ITEM_LOAD_COMPLETE, onSoundLoadComplete); _sm.addEventListener(SoundManagerEvent.SOUND_ITEM_FADE_COMPLETE, onFadeComplete); _sm.addEventListener(SoundManagerEvent.SOUND_ITEM_PLAY_COMPLETE, onPlayComplete); // add a library sound var Elephant:Class = (getDefinitionByName("Elephant") as Class); _sm.addLibrarySound(Elephant, "elephant"); // add an external sound _sm.addExternalSound(String(_env.basePath + "sounds/birds.mp3"), "birds"); // load an external sound through LoaderMax and upon load add it to the SoundManager _mp3Loader = new MP3Loader(String(_env.basePath + "sounds/frogs.mp3"), {name: "frogs", autoPlay: false, onComplete: handleMP3Loaded}); _mp3Loader.load(); // _sm.playSound("birds"); // _sm.playSound("elephant"); } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- //- EVENT HANDLERS ---------------------------------------------------------------------------------------- /** * */ protected function handleBoxClicked($evt:MouseEvent):void { // _sm.playSound("birds"); _sm.playSound("elephant"); } /** * */ protected function handleBox2Clicked($evt:MouseEvent):void { // _sm.playSound("birds"); //_sm.stopSound("elephant"); (_sm.areAllMuted) ? _sm.unmuteAllSounds() : _sm.muteAllSounds(); } /** * */ protected function handleBox3Clicked($evt:MouseEvent):void { _sm.playSound("birds"); } /** * */ private function handleMP3Loaded($evt:LoaderEvent):void { var frogs:Sound = LoaderMax.getContent("frogs"); _sm.addPreloadedSound(frogs, "frogs"); // _sm.playSound("frogs"); } /** * */ private function onSoundAdded($evt:SoundManagerEvent):void { // trace("SOUND: " + $evt.soundItem.name); } /** * */ private function onSoundProgress($evt:SoundManagerEvent):void { // trace("SOUND: " + $evt.soundItem.name + " & PROGRESS: " + $evt.percent); } /** * */ private function onSoundLoadComplete($evt:SoundManagerEvent):void { // trace("SOUND: " + $evt.soundItem.name + " & LENGTH: " + $evt.duration); // trace("ALTERNATE METHOD: " + ($evt.soundItem.sound.length * .001)); } /** * */ private function onFadeComplete($evt:SoundManagerEvent):void { // trace("SOUND: " + $evt.soundItem.name + " FADE COMPLETE"); } /** * */ private function onPlayComplete($evt:SoundManagerEvent):void { trace("SOUND: " + $evt.soundItem.name + " PLAY COMPLETE"); } //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/mouse/MouseIdleMonitor.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.mouse 2 | { 3 | import com.reintroducing.events.MouseIdleMonitorEvent; 4 | 5 | import flash.display.Stage; 6 | import flash.events.EventDispatcher; 7 | import flash.events.MouseEvent; 8 | import flash.events.TimerEvent; 9 | import flash.utils.Timer; 10 | import flash.utils.getQualifiedClassName; 11 | 12 | /** 13 | * A small utility class that allows you to see if a user has been inactive with the mouse. The class will dispatch a custom MouseIdleMonitorEvent 14 | * with a params object that contains the time the user has been idle, in milliseconds. 15 | * 16 | * @author Matt Przybylski [http://www.reintroducing.com] 17 | * @version 1.1 18 | */ 19 | public class MouseIdleMonitor extends EventDispatcher 20 | { 21 | //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- 22 | 23 | private var _stage:Stage; 24 | private var _inactiveTime:int; 25 | private var _timer:Timer; 26 | private var _idleTime:int; 27 | private var _isMouseActive:Boolean; 28 | 29 | //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- 30 | 31 | 32 | 33 | //- CONSTRUCTOR ------------------------------------------------------------------------------------------- 34 | 35 | /** 36 | * Creates an instance of hte MouseIdleMonitor class. 37 | * 38 | *

39 | * The class will dispatch two events: 40 | *

    41 | *
  • MouseIdleMonitorEvent.MOUSE_ACTIVE: Dispatched when the mouse becomes active, repeatedly on MOUSE_MOVE
  • 42 | *
  • MouseIdleMonitorEvent.MOUSE_IDLE: Dispatched when the mouse becomes inactive, idleTime param holds idle time
  • 43 | *
44 | *

45 | * 46 | * @param $stage The stage object to use for the mouse tracking 47 | * @param $inactiveTime The time, in milliseconds, to check if the user is active or not (default: 1000) 48 | * 49 | * @return void 50 | */ 51 | public function MouseIdleMonitor($stage:Stage, $inactiveTime:int = 1000) 52 | { 53 | super(); 54 | 55 | _stage = $stage; 56 | _inactiveTime = $inactiveTime; 57 | _timer = new Timer(_inactiveTime); 58 | } 59 | 60 | //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- 61 | 62 | 63 | 64 | //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- 65 | 66 | /** 67 | * Starts the MouseIdleMonitor and allows it to check for mouse inactivity. 68 | * 69 | * @return void 70 | */ 71 | public function start():void 72 | { 73 | _stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); 74 | _stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseMove); 75 | _stage.addEventListener(MouseEvent.MOUSE_UP, onMouseMove); 76 | _timer.addEventListener(TimerEvent.TIMER, onTimer); 77 | 78 | _timer.start(); 79 | } 80 | 81 | /** 82 | * Stops the MouseIdleMonitor from checking for mouse inactivity. 83 | * 84 | * @return void 85 | */ 86 | public function stop():void 87 | { 88 | _idleTime = 0; 89 | _timer.reset(); 90 | 91 | _stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); 92 | _stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseMove); 93 | _stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseMove); 94 | _timer.removeEventListener(TimerEvent.TIMER, onTimer); 95 | } 96 | 97 | //- EVENT HANDLERS ---------------------------------------------------------------------------------------- 98 | 99 | /** 100 | * Reset the timer if the mouse moves, user is active. 101 | */ 102 | private function onMouseMove($evt:MouseEvent):void 103 | { 104 | _isMouseActive = true; 105 | _idleTime = 0; 106 | _timer.reset(); 107 | _timer.start(); 108 | 109 | dispatchEvent(new MouseIdleMonitorEvent(MouseIdleMonitorEvent.MOUSE_ACTIVE)); 110 | } 111 | 112 | /** 113 | * Runs if the user is inactive, sets the idle time. 114 | */ 115 | private function onTimer($evt:TimerEvent):void 116 | { 117 | _isMouseActive = false; 118 | _idleTime += _inactiveTime; 119 | 120 | dispatchEvent(new MouseIdleMonitorEvent(MouseIdleMonitorEvent.MOUSE_IDLE, _idleTime)); 121 | } 122 | 123 | //- GETTERS & SETTERS ------------------------------------------------------------------------------------- 124 | 125 | /** 126 | * Returns a boolean value that specifies if the mouse is active or not. 127 | * 128 | * @return Boolean 129 | */ 130 | public function get isMouseActive():Boolean 131 | { 132 | return _isMouseActive; 133 | } 134 | 135 | /** 136 | * Returns an integer representing the amount of time the user's mouse has been inactive, in milliseconds 137 | * 138 | * @return int 139 | */ 140 | public function get idleTime():int 141 | { 142 | return _idleTime; 143 | } 144 | 145 | //- HELPERS ----------------------------------------------------------------------------------------------- 146 | 147 | /** 148 | * @private 149 | */ 150 | override public function toString():String 151 | { 152 | return getQualifiedClassName(this); 153 | } 154 | 155 | //- END CLASS --------------------------------------------------------------------------------------------- 156 | } 157 | } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/FlashVarsManager.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import com.reintroducing.data.flashvars.FlashVar; import com.reintroducing.data.flashvars.FlashVars; import flash.display.LoaderInfo; import flash.external.ExternalInterface; import flash.utils.getQualifiedClassName; /** * A manager for FlashVars and QueryStrings. You can create default values for use while in production * and it will automatically parse any FlashVars and QueryStrings passed into it when deployed. * *
	 * 		var fvm:FlashVarsManager = FlashVarsManager.getInstance(loaderInfo);
	 * 		fvm.addDefault("testPath", "../test/folder/here");
	 * 		fvm.addDefault("servicePath", "../service/here");
	 * 		fvm.addDefault("imagePath", "../img/folder/here");
	 * 		fvm.initialize();
	 * 		
	 * 		fvm.flashVars.output();
	 * 		
	 * 		trace(fvm.getByName("servicePath").value);
	 * 		trace(fvm.getValueByName("imagePath"));
	 * 
* * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class FlashVarsManager { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- // singleton instance private static var _instance:FlashVarsManager; private static var _allowInstance:Boolean; private var _loaderInfo:LoaderInfo; private var _flashVars:FlashVars; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- // singleton instance of FlashVarsManager public static function getInstance($loaderInfo:LoaderInfo = null):FlashVarsManager { if (_instance == null) { _allowInstance = true; _instance = new FlashVarsManager($loaderInfo); _allowInstance = false; } return _instance; } public function FlashVarsManager($loaderInfo:LoaderInfo) { if (!_allowInstance) { throw new Error("Error: Use FlashVarsManager.getInstance() instead of the new keyword."); } else { _loaderInfo = $loaderInfo; _flashVars = new FlashVars("FlashVars"); } } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- // creates a new FlashVar private function createFlashVar($name:String, $value:String):FlashVar { var flashVar:FlashVar = new FlashVar(); flashVar.name = $name; flashVar.value = $value; return flashVar; } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Initializes the FlashVars and parses any QueryString params that were passed into the SWF for usage within the FlashVarsManager. * * @return void */ public function initialize():void { var params:Object = _loaderInfo.parameters; if (ExternalInterface.available) { // get query string var queryString:String = ExternalInterface.call("document.location.search.toString"); if (queryString != null && queryString != "") { var querySplit:Array = String(queryString.split("?")[1]).split("&"); var queryVarName:String; var queryVarValue:String; // add query string params for (var i:int = 0; i < querySplit.length; i++) { queryVarName = String(querySplit[i]).split("=")[0]; queryVarValue = String(querySplit[i]).split("=")[1]; if (_flashVars.getItemByName(queryVarName) != null) { _flashVars.getItemByName(queryVarName).value = queryVarValue; } else { _flashVars.addItem(this.createFlashVar(queryVarName, queryVarValue)); } } } // add flashvars for (var varName:String in params) { if (_flashVars.getItemByName(varName) != null) { _flashVars.getItemByName(varName).value = params[varName]; } else { _flashVars.addItem(this.createFlashVar(varName, params[varName])); } } } else { trace("WARNING: FlashVars could not be retrieved!"); } } /** * Returns a FlashVar by its specified name. * * @param $name The name of the FlashVar to retrieve * * @return FlashVar */ public function getByName($name:String):FlashVar { return (_flashVars.getItemByName($name) as FlashVar); } /** * Returns a FlashVar's value by its specified name. * * @param $name The name of the FlashVar to retrieve * * @return String */ public function getValueByName($name:String):String { return (_flashVars.getItemByName($name) as FlashVar).value; } /** * Adds a default value to a FlashVar. * * @param $name The name of the FlashVar to set the value on * @param $value The value to set it to * * @return void */ public function addDefault($name:String, $value:String):void { if (_flashVars.getItemByName($name) != null) { _flashVars.getItemByName($name).value = $value; } else { _flashVars.addItem(createFlashVar($name, $value)); } } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- /** * Returns a collection of strongly typed FlashVars. * * @return FlashVars */ public function get flashVars():FlashVars { return _flashVars; } //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/data/base/Collection.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.data.base { import flash.utils.getQualifiedClassName; /** * Helper class used to manage a collection of objects. This class is similar to the Java * Collection interface. Developers can extend this class to create new Collection types * that provide additional functionality such as ordering and sorting. * * @author Adobe [http://www.adobe.com] * @author Ported to AS3 by Matt Przybylski [http://www.reintroducing.com] * @version 1.1 */ public class Collection implements ICollection { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- protected var _name:String; protected var _items:Array; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- /** * Constructor * * @param $name the name of the Collection. */ public function Collection($name:String) { super(); _name = $name; _items = new Array(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- // Finds an item within the Collection and returns it's index. private function internalGetItem($item:Object):int { var result:int = -1; for (var i:int = 0; i < _items.length; i++) { if (_items[i] == $item) { result = i; break; } } return result; } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Gets the name of the Collection. * * @return String the name of the Collection. */ public function getName():String { return _name; } /** * Adds a new item to the end of the Collection. * * @param $item * to be added to the Collection. If item is null it will not be added to the Collection. * * @return Boolean true if the Collection was changed as a result of the operation. */ public function addItem($item:*):Boolean { var result:Boolean = false; if ($item != null) { _items.push($item); result = true; } return result; } /** * Adds an array of items to the Collection. * * @param items An array of items to be added * * @return void */ public function addItems(...$items):void { for each (var item:* in $items) { addItem(item); } } /** * Adds a new item at the specified index in the Collection. * * @param $index position to add the specified item in * @param $item * to be added to the Collection. * * @return void */ public function addItemAt($index:int, $item:*):void { _items.splice($index, 0, $item); } /** * Removes a single item from the Collection. Returns false if item is not found. * * @param $item reference to Collection item to be removed from Collection. * * @return Boolean true if item is found and successfully removed. False if item is not found. */ public function removeItem($item:*):Boolean { var result:Boolean = false; var itemIndex:int = internalGetItem($item); if (itemIndex > -1) { _items.splice(itemIndex, 1); result = true; } return result; } /** * Removes all items from the Collection. * * @return void */ public function clear():void { _items.length = 0; } /** * Reverses the Collection. * * @return void */ public function reverse():void { _items.reverse(); } /** * Returns true if this Collection contains the specified item. * * @param $item * whose presence in this collection is to be tested. * * @return Boolean true if this collection contains the specified item. */ public function contains($item:*):Boolean { return (internalGetItem($item) > -1); } /** * Returns an item within the Collection using it's index. * * @param $index location of item within the Collection. * * @return * reference to item. */ public function getItemAt($index:int):* { return _items[$index]; } /** * Returns an iterator over the elements in this collection. There are no guarantees concerning * the order in which the elements are returned (unless this collection is an instance of some * class that provides a guarantee). * * @return Iterator object that is used to iterate through the collection. */ public function getIterator():Iterator { return (new Iterator(this)); } /** * Returns the current length * * @return int value reflecting the number of items in this Collection. */ public function getLength():int { return _items.length; } /** * Returns true if the Collection is empty. * * @return Boolean true if Collection is empty. */ public function isEmpty():Boolean { return (_items.length == 0); } /** * Traces the Value Objects of the Collection to the Output panel. * * @return void */ public function output():void { trace("Start " + getName() + " Contents:"); trace("---------------------------------------------\n"); for (var i:int = 0; i < getLength(); i++) { var vo:IValueObject = getItemAt(i); vo.output(); } trace("End " + getName() + " Contents"); trace("---------------------------------------------\n"); } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/sound/SoundItem.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.sound 2 | { 3 | import com.greensock.TweenLite; 4 | import com.greensock.plugins.TweenPlugin; 5 | import com.greensock.plugins.VolumePlugin; 6 | import com.reintroducing.events.SoundManagerEvent; 7 | 8 | import flash.events.Event; 9 | import flash.events.EventDispatcher; 10 | import flash.media.Sound; 11 | import flash.media.SoundChannel; 12 | import flash.media.SoundTransform; 13 | import flash.utils.getQualifiedClassName; 14 | 15 | /** 16 | * A class that acts as a holder for a sound to be used in the SoundManager. 17 | * 18 | * @author Matt Przybylski [http://www.reintroducing.com] 19 | * @version 1.4.2 20 | */ 21 | public class SoundItem extends EventDispatcher 22 | { 23 | //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- 24 | 25 | private var _fadeTween:TweenLite; 26 | private var _volume:Number; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var name:String; 27 | public var sound:Sound; public var channel:SoundChannel; public var position:int; public var paused:Boolean; public var savedVolume:Number; public var startTime:Number; public var loops:int; public var pausedByAll:Boolean; public var muted:Boolean; 28 | 29 | //- CONSTRUCTOR ------------------------------------------------------------------------------------------- 30 | 31 | public function SoundItem():void { super(); 32 | 33 | TweenPlugin.activate([VolumePlugin]); 34 | 35 | init(); } 36 | 37 | //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- 38 | 39 | /** 40 | * 41 | */ 42 | private function init():void 43 | { 44 | channel = new SoundChannel(); 45 | } 46 | 47 | /** 48 | * 49 | */ 50 | private function fadeComplete($stopOnComplete:Boolean):void 51 | { 52 | if ($stopOnComplete) stop(); 53 | 54 | dispatchEvent(new SoundManagerEvent(SoundManagerEvent.SOUND_ITEM_FADE_COMPLETE, this)); 55 | } 56 | 57 | //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- 58 | 59 | /** 60 | * Plays the SoundItem. 61 | * 62 | * @param $startTime The time, in milliseconds, to start the sound at (default: 0) 63 | * @param $loops The number of times to loop (default: 0) 64 | * @param $volume The volume to play the sound at (default: 1) 65 | * @param $resumeTween If the fade tween should be resumed if it's currently running (default: true) 66 | * 67 | * @return void 68 | */ 69 | public function play($startTime:Number = 0, $loops:int = 0, $volume:Number = 1, $resumeTween:Boolean = true):void { if (!paused) return; 70 | 71 | volume = $volume; 72 | startTime = $startTime; 73 | loops = $loops; 74 | paused = ($startTime == 0) ? true : false; 75 | 76 | if (!paused) position = startTime; 77 | 78 | channel = sound.play(position, loops, new SoundTransform(volume)); 79 | channel.addEventListener(Event.SOUND_COMPLETE, handleSoundComplete); 80 | paused = false; 81 | 82 | if ($resumeTween && (fadeTween != null)) fadeTween.resume(); } 83 | 84 | /** 85 | * Pauses the SoundItem. 86 | * 87 | * @param $pauseTween If the fade tween should be paused if it's currently running (default: true) 88 | * 89 | * @return void 90 | */ 91 | public function pause($pauseTween:Boolean = true):void 92 | { 93 | paused = true; 94 | position = channel.position; 95 | channel.stop(); 96 | channel.removeEventListener(Event.SOUND_COMPLETE, handleSoundComplete); 97 | 98 | if ($pauseTween && (fadeTween != null)) fadeTween.pause(); 99 | } 100 | 101 | /** 102 | * Stops the SoundItem. 103 | * 104 | * @return void 105 | */ 106 | public function stop():void 107 | { 108 | paused = true; 109 | channel.stop(); 110 | channel.removeEventListener(Event.SOUND_COMPLETE, handleSoundComplete); 111 | position = channel.position; 112 | fadeTween = null; 113 | } 114 | 115 | /** 116 | * Fades the SoundItem. 117 | * 118 | * @param $volume The volume to fade to (default: 0) 119 | * @param $fadeLength The time, in seconds, to fade over (default: 1) 120 | * @param $stopOnComplete If the sound should be stopped after fading is complete (default: false) 121 | */ 122 | public function fade($volume:Number = 0, $fadeLength:Number = 1, $stopOnComplete:Boolean = false):void 123 | { 124 | fadeTween = TweenLite.to(channel, $fadeLength, {volume: $volume, onComplete: fadeComplete, onCompleteParams: [$stopOnComplete]}); 125 | } 126 | 127 | /** 128 | * Sets the volume of the SoundItem. 129 | * 130 | * @param $volume The volume to set on the sound 131 | * 132 | * @return void 133 | */ 134 | public function setVolume($volume:Number):void 135 | { 136 | var curTransform:SoundTransform = channel.soundTransform; 137 | curTransform.volume = $volume; 138 | channel.soundTransform = curTransform; 139 | 140 | _volume = $volume; 141 | } 142 | 143 | /** 144 | * Clears and makes the SoundItem available for garbage collection. 145 | * 146 | * @return void 147 | */ 148 | public function destroy():void 149 | { 150 | channel.removeEventListener(Event.SOUND_COMPLETE, handleSoundComplete); 151 | channel = null; 152 | fadeTween = null; 153 | } 154 | 155 | //- EVENT HANDLERS ---------------------------------------------------------------------------------------- 156 | 157 | /** 158 | * 159 | */ 160 | private function handleSoundComplete($evt:Event):void 161 | { 162 | stop(); 163 | 164 | dispatchEvent(new SoundManagerEvent(SoundManagerEvent.SOUND_ITEM_PLAY_COMPLETE, this)); 165 | } 166 | 167 | //- GETTERS & SETTERS ------------------------------------------------------------------------------------- 168 | 169 | /** 170 | * Returns the volume of the Sounditem. 171 | * 172 | * @return Number 173 | */ 174 | public function get volume():Number 175 | { 176 | return channel.soundTransform.volume; 177 | } 178 | 179 | /** 180 | * Sets the volume of the SoundItem. 181 | * 182 | * @param $val The volume to set 183 | * 184 | * @return void 185 | */ 186 | public function set volume($val:Number):void 187 | { 188 | setVolume($val); 189 | } 190 | 191 | /** * Returns the instance of the fading tween. 192 | * 193 | * @return TweenLite */ public function get fadeTween():TweenLite { return _fadeTween; } /** * Sets the instance of the fading tween. 194 | * 195 | * @param $val The TweenLite instance to create 196 | * 197 | * @return void */ public function set fadeTween($val:TweenLite):void { if ($val == null) TweenLite.killTweensOf(this); _fadeTween = $val; } 198 | 199 | //- HELPERS ----------------------------------------------------------------------------------------------- 200 | 201 | /** 202 | * @private 203 | */ 204 | override public function toString():String 205 | { 206 | return getQualifiedClassName(this); 207 | } 208 | 209 | //- END CLASS --------------------------------------------------------------------------------------------- 210 | } 211 | } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/ui/pulloutmenu/PullOutMenu.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.ui.pulloutmenu { import com.greensock.TweenMax; import com.reintroducing.data.pulloutmenu.PullOutMenuData; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.utils.getQualifiedClassName; /** * Creates a menu like the classic dropdown menu with the options to direct it up, down, left, or right depending on values set. * * CHANGE LOG: * v 1.3 - Made the class extend Sprite so it can be added to the stage. * * Changed the constructor to accept PullOutMenuData object. * * Changed interval check into an enter frame check. * * Changed TweenLite to TweenMax. * * v 1.2 - Added events OPEN/CLOSE that dispatch correspondingly. * * Changed out Adobe's Tween class in favor of TweenLite. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.3 */ public class PullOutMenu extends Sprite { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private var _startHeight:Number; private var _endHeight:Number; private var _openSpeed:Number; private var _closeSpeed:Number; private var _axis:String; private var _easeFunc:Function; private var _eventType:String; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- public var container:Sprite; public var masker:Sprite; public var hitButton:Sprite; public var itemHolder:Sprite; //- CONSTRUCTOR ------------------------------------------------------------------------------------------- /** * Creates a new instance of the PullOutMenu class. * * @param $pullOutMenuData The PullOutMenuData to use with the PullOutMenu. * *

* The $pullOutMenuData object takes the following values: *

    *
  • hitButton: The Sprite used as the button you initially roll over or press to see the menu
  • *
  • itemHolder: The Sprite which holds the menu items
  • *
  • startPosition: A Number that represents the initial position of the menu (its resting state)
  • *
  • endPosition: A Number that represents the final position of the menu (after you have opened it)
  • *
  • openSpeed: An integer representing the speed you want your menu to open, in seconds (default: .25)
  • *
  • closeSpeed: An integer representing the speed you want your menu to close, in seconds (default: .25)
  • *
  • axis: A string representing the axis that the menu opens on, PullOutMenuData.AXIS_X or PullOutMenuData.AXIS_Y (default: PullOutMenuData.AXIS_Y)
  • *
  • tweenEase: A function representing the ease type you'd like to use, as per the TweenMax easing functions (default: Linear.easeOut)
  • *
  • eventType: A string representing when to trigger the showing of the menu, PullOutMenuData.TYPE_ROLL_OVER, PullOutMenuData.TYPE_PRESS, or PullOutMenuData.TYPE_RELEASE (default: PullOutMenuData.TYPE_ROLL_OVER)
  • *
*

*/ public function PullOutMenu($pullOutMenuData:PullOutMenuData) { _startHeight = $pullOutMenuData.startPosition; _endHeight = $pullOutMenuData.endPosition; _openSpeed = $pullOutMenuData.openSpeed; _closeSpeed = $pullOutMenuData.closeSpeed; _axis = $pullOutMenuData.axis; _easeFunc = $pullOutMenuData.tweenEase; _eventType = $pullOutMenuData.eventType; hitButton = $pullOutMenuData.hitButton; itemHolder = $pullOutMenuData.itemHolder; addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Closes the menu and puts it in the initial position. Used also when a button inside the menu is pressed and the need to close the menu right then arises. * * @return void */ public function closeMenu():void { removeEventListener(Event.ENTER_FRAME, checkOpen); dispatchEvent(new Event(Event.CLOSE)); var xPos:Number = (_axis == PullOutMenuData.AXIS_X) ? _startHeight : itemHolder.x; var yPos:Number = (_axis == PullOutMenuData.AXIS_Y) ? _startHeight : itemHolder.y; TweenMax.to(itemHolder, _closeSpeed, {x: xPos, y: yPos, ease: _easeFunc}); } /** * Enables operation of the menu. * * @return void */ public function setEnabled():void { switch (_eventType) { case PullOutMenuData.TYPE_ROLL_OVER: hitButton.addEventListener(MouseEvent.MOUSE_OVER, openMenu); break; case PullOutMenuData.TYPE_PRESS: hitButton.addEventListener(MouseEvent.MOUSE_DOWN, openMenu); break; case PullOutMenuData.TYPE_RELEASE: hitButton.addEventListener(MouseEvent.MOUSE_UP, openMenu); break; } } /** * Disables the menu from operation. * * @return void */ public function setDisabled():void { switch (_eventType) { case PullOutMenuData.TYPE_ROLL_OVER: hitButton.removeEventListener(MouseEvent.MOUSE_OVER, openMenu); break; case PullOutMenuData.TYPE_PRESS: hitButton.removeEventListener(MouseEvent.MOUSE_DOWN, openMenu); break; case PullOutMenuData.TYPE_RELEASE: hitButton.removeEventListener(MouseEvent.MOUSE_UP, openMenu); break; } } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- /** * */ private function init($evt:Event):void { removeEventListener(Event.ADDED_TO_STAGE, init); masker = new Sprite(); masker.graphics.beginFill(0xFF0000, 0); masker.graphics.drawRect(0, 0, itemHolder.width, itemHolder.height); masker.graphics.endFill(); masker.y = hitButton.height; hitButton.x = 0; hitButton.y = 0; itemHolder.x = (_axis == PullOutMenuData.AXIS_Y) ? 0 : _startHeight; itemHolder.y = (_axis == PullOutMenuData.AXIS_Y) ? _startHeight : 0; masker.x = (_axis == PullOutMenuData.AXIS_Y) ? itemHolder.x : hitButton.width; masker.y = (_axis == PullOutMenuData.AXIS_Y) ? hitButton.height : hitButton.y; container = new Sprite(); container.addChild(itemHolder); container.addChild(masker); container.addChild(hitButton); addChild(container); itemHolder.mask = masker; setEnabled(); } /** * */ private function openMenu($evt:MouseEvent):void { dispatchEvent(new Event(Event.OPEN)); var xPos:Number = (_axis == PullOutMenuData.AXIS_X) ? _endHeight : itemHolder.x; var yPos:Number = (_axis == PullOutMenuData.AXIS_Y) ? _endHeight : itemHolder.y; TweenMax.to(itemHolder, _openSpeed, {x: xPos, y: yPos, ease: _easeFunc}); addEventListener(Event.ENTER_FRAME, checkOpen); } /** * */ private function checkOpen($evt:Event):void { var mx:Number = stage.mouseX; var my:Number = stage.mouseY; var isHitting:Boolean = container.hitTestPoint(mx, my); if (!isHitting) closeMenu(); } //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/Validator.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.utils.getQualifiedClassName; /** * Static utility methods for validating data. * * @author Matt Przybylski [http://www.reintroducing.com] (AS3 version) * @version 1.0 */ public class Validator { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private static const STATES:String = " AL AK AS AZ AR CA CO CT DE DC FM FL GA GU HI ID IL IN IA KS KY LA ME MH MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND MP OH OK OR PW PA PR RI SC SD TN TX UT VT VI VA WA WV WI WY "; private static const PHONE_REG_EXP:RegExp = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/i; private static const ZIP_REG_EXP:RegExp = /^\d{5}([\-]\d{4})?$/; private static const PO_BOX_REG_EXP:RegExp = /^\s*((P(OST)?.?\s*O(FF(ICE)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i; private static var _illegalWords:Array; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function Validator() { _illegalWords = [ "FUCK", "F-U-C-K", "F U C K", "F*U*C*K", "F_U_C_K", "SHIT", "S H I T", "S-H-I-T", "SHITTY", "BULLSHIT", "COCK", "C O C K", "C-O-C-K", "CUNT", "C U N T", "C-U-N-T", "BITCH", "COCKSUCKER", "PENIS", "PUSSY", "WHORE", "TITS", "LAID", "PISS", "ASSHOLE", "ASS HOLE", "BEANER", "CHINK", "COON", "DAGO", "DARKIE", "GOOK", "HEEB", "JIGABOO", "JUNGLE BUNNY", "KYKE", "NIGGER", "NIP", "POLACK", "SAMBO", "SAND-NIGGER", "SPIC", "TOWEL-HEAD", "WET BACK", "WOP", "YID", "JEW", "DYKE", "NAZI", "HITLER", "BOMB", "KILL", "TERRORIST", "FAG", "FAGGOT", "AL QAEDA", "AL-QAEDA", "PISTOL", "RIFLE", "SHOTGUN", "GUN", "MURDER"]; } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- private static function prepareForComparison($s:String):String { var a:Array = $s.split("\r"); $s = " " + a.join(" ").toUpperCase() + " "; var punct:Array = [".", ",", "!", "?", "-", "(", ")", "_", "'", '"']; for (var i:int = 0; i < punct.length; i++) { $s = $s.split(punct[i]).join(" "); } return $s; } private static function parseYear($n:Number):Number { if ($n > 100) { return $n; } else { var today:Date = new Date(); var localYear:Number = (today.getFullYear() - 2000); if ($n < localYear) { return ($n + 2000); } else { return ($n + 1900); } } } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Tests the provided email address to see if it is valid. * * @param $email The email address to test * * @return Boolean */ public static function isValidEmail($email:String):Boolean { var emailExpression:RegExp = /^[a-z][\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$/i; if (isNotEmpty($email) && $email.length > 6 && $email.indexOf("@") != -1 && $email.indexOf("@") > 0) { return emailExpression.test($email); } else { return false; } } /** * Tests a list of email addresses for validation. * * @param $emailList The list of emails to test * @param $separator The character that separates the emails in the list * * @return Boolean */ public static function isValidEmailList($emailList:String, $separator:String = ","):Boolean { var emails:Array = $emailList.split($separator); for each (var email:String in emails) { if (!isValidEmail(email.replace(/\s/, ""))) return false; } return true; } /** * Tests if the specified value is a valid US stage. * * @param $value The string to test * * @return Boolean */ public static function isState($value:String):Boolean { return Boolean(STATES.indexOf(" " + $value.toUpperCase() + " ") != -1); } /** * Tests if the specified value is a valid zip code. * * @param $value The string to test * * @return Boolean */ public static function isZipCode($value:String):Boolean { return ZIP_REG_EXP.test($value); } /** * Tests if the specified value is a valid phone number. * * @param $value The string to test * * @return Boolean */ public static function isPhone($value:String):Boolean { $value = $value.split("-").join(""); $value = $value.split("(").join(""); $value = $value.split(")").join(""); $value = $value.split(".").join(""); $value = $value.split(" ").join(""); if (($value.substr(0, 1) == "1" && $value.length != 11) || ($value.substr(0, 1) != "1" && $value.length != 10)) { return false; } return PHONE_REG_EXP.test($value); } /** * Tests if the specified value is a valid PO Box. * * @param $value The string to test * * @return Boolean */ public static function isPOBox($value:String):Boolean { return PO_BOX_REG_EXP.test($value); } /** * Tests if the specified string is empty/blank. * * @param $s The string to test * * @return Boolean */ public static function isNotEmpty($s:String):Boolean { if ($s == null || $s == " " || $s == "") { return false; } else { return true; } } /** * Tests if the specified string is a valid URL. * Validate as "http://" or "https://". * * @param $str The string to test * * @return Boolean */ public function isURL($str:String):Boolean { return ($str.substring(0, 7) == "http://" || $str.substring(0, 8) == "https://"); } /** * Tests the specified string versus the list of clean words. If an array of words to test against is not specified, * the default list of words (as defined in this class) is used. * * @param $s The word to test * @param $wordList An array of words to test against * * @return Boolean */ public static function isCleanFromList($s:String, $wordList:Array = null):Boolean { $s = prepareForComparison($s); var wordList:Array = ($wordList != null) ? $wordList : _illegalWords; for (var i:int = 0; i < wordList.length; i++) { if ($s.indexOf((" " + wordList[i].toUpperCase() + " ")) != -1) { return false; } } return true; } /** * Tests if the specified age passes the specified minimum. * * @param $age The age to test * @param $month The month of the minimum age * @param $day The day of the minimum age * @param $year The year of the minimum age * * @return Boolean */ public static function isMinimumAge($age:Number, $month:Number, $day:Number, $year:Number):Boolean { var today:Date = new Date(); var year:Number = parseYear($year); var yearDiff:Number = (today.getFullYear() - year); if (yearDiff == $age) { var monthDiff:Number = ((today.getMonth() + 1) - $month); if (monthDiff == 0) { var dayDiff:Number = (today.getDate() - $day); if (dayDiff >= 0) { return true; } else { return false; } } else if (monthDiff < 0) { return false; } else { return true; } } else if (yearDiff < $age) { return false; } else { return true; } } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /source/libs/com/reintroducing/utils/MathUtils.as: -------------------------------------------------------------------------------- 1 | package com.reintroducing.utils { import flash.geom.Point; import flash.utils.getQualifiedClassName; /** * Static utility methods for working with mathematical equations and numbers. * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.0 */ public class MathUtils { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- public function MathUtils() { } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Returns a random number in the specified range. * * @param $low The lower end of the range * @param $high The higher end of the range * * @return int */ public static function getRandomBetween($low:int = 0, $high:int = 1):int { return (Math.round(Math.random() * ($high - $low)) + $low); } /** * Determines if a number is prime (divisible by only 1 and itself). * * @param $value The number to test * *
		 * 		trace(MathUtils.isPrime(13)); // traces true
		 * 		trace(MathUtils.isPrime(4)); // traces false
		 * 
* * @return Boolean */ public static function isPrime($value:Number):Boolean { if ($value == 1 || $value == 2) return true; if (isEven($value)) return false; var s:Number = Math.sqrt($value); for (var i:Number = 3; i <= s; i++) { if ($value % i == 0) return false; } return true; } /** * Determines if the number is an integer (containts no decimal values). * * @param $value The number to test * *
		 * 		trace(MathUtils.isInteger(13)); // traces true
		 * 		trace(MathUtils.isInteger(1.2345)); // traces false
		 * 
* * @return Boolean */ public static function isInteger($value:Number):Boolean { return ($value % 1) == 0; } /** * Determines if the number is even. * * @param $num The number to test * * @return Boolean */ public static function isEven($num:Number):Boolean { return ($num & 1) == 0; } /** * Determines if the number is positive. * * @param $num The number to test * * @return Boolean */ public static function isPositive($num:Number):Boolean { return ($num >= 0) == true; } /** * Returns the absolute value of an integer. * * @param $num The integer to use in the calculation * * @return int */ public static function absInteger($num:int):int { return ($num ^ ($num >> 31)) - ($num >> 31); } /** * Determines if the specified value is included within a range. * The range values do no need to be specified in order. * * @param $value The number to check * @param $firstValue Starting value of the range * @param $secondValue Ending value of the range * *
		 * 		trace(MathUtils.isBetween(3, 0, 5)); // traces true
		 * 		trace(MathUtils.isBetween(7, 0, 5)); // traces false
		 * 
* * @return Boolean */ public static function isBetween($value:Number, $firstValue:Number, $secondValue:Number):Boolean { return !($value < Math.min($firstValue, $secondValue) || $value > Math.max($firstValue, $secondValue)); } /** * Inserts commas every three digits in the integer of value. * * @param value The number to insert commas into * * @return String The value formatted with commas */ public static function insertCommas($value:Number):String { var valueString:String = String($value); var commaIndex:int = valueString.indexOf("."); if (commaIndex == -1) commaIndex = valueString.length; do { commaIndex -= 3; if (commaIndex <= 0) break; valueString = valueString.substring(0, commaIndex) + "," + valueString.substr(commaIndex); } while (true); if (valueString.substr(0, 2) == "0.") valueString = valueString.substr(1); return valueString; } /** * Rounds to a decimal specified by the number of points. * * @param $value The number to round * @param $points The number of points to round to * * @return Number */ public static function roundToDecimal($value:Number, $points:int):Number { if ($points < 1) { return $value >> 0; } var delta:Number = Math.pow(10, $points); return ($value * delta >> 0) / delta; } /** * Converts the number of degrees to radians. * * @param $degrees The degrees to convert * * @return Number */ public static function degreesToRadians($degrees:Number):Number { return ($degrees * (Math.PI / 180)); } /** * Converts the number of radians into degrees. * * @param $radians The radians to convert * * @return Number */ public static function radiansToDegrees($radians:Number):Number { return ($radians * (180 / Math.PI)); } /** * Gets the difference between two angles. * * @param $angle1 The first angle * @param $angle2 the second angle * * @return Number */ public static function getAngleDifference($angle1:Number, $angle2:Number):Number { return Math.abs(($angle1 + 180 - $angle2) % 360 - 180); } /** * Rounds a number to the nearest value. * * @param $roundTo The number to round to * @param $value The value to round * * @return Number */ public static function roundToNearest($roundTo:Number, $value:Number):Number { return (Math.round($value / $roundTo) * $roundTo); } /** * Returns the angle between two points. * * @param $x1 The X value of the first point * @param $y1 The Y value of the first point * @param $x2 The X value of the second point * @param $y2 The Y value of the second point * * @return Number */ public static function getAngle($x1:Number, $y1:Number, $x2:Number, $y2:Number):Number { var newX:Number = ($x2 - $x1); var newY:Number = ($y2 - $y1); return Math.round((-180 * Math.atan2(newX, newY)) / Math.PI); } /** * Returns the distance between two points. * * @param $x1 The X value of the first point * @param $y1 The Y value of the first point * @param $x2 The X value of the second point * @param $y2 The Y value of the second point * * @return Number */ public static function getDistance($x1:Number, $y1:Number, $x2:Number, $y2:Number):Number { var dx:Number = ($x2 - $x1); var dy:Number = ($y2 - $y1); return Math.sqrt((dx * dx) + (dy * dy)); } /** * Generates and returns a truly unique (not random) integer. * Casting the return value as an int will result in an incorrect value because its such a large number. * *
		 * 		var _n:Number = MathUtils.generateUniqueInt(); // correct value, 1230707045775
		 * 		var _i:int = _n; // incorrect value, -1948568177 
		 * 
* * @return Number */ public static function generateUniqueNumber():Number { return new Date().time; } /** * Simplifies the supplied angle to its simplest representation. * * @param $angle The angle to simplify * *
		 * 		var _simpAngle:Number = MathUtils.simplifyAngle(725); // returns 5
		 * 		var _simpAngle2:Number = MathUtils.simplifyAngle(-725); // returns -5
		 * 
* * @return int */ public static function simplifyAngle($angle:Number):int { var rotations:int = int($angle / 360); return ($angle >= 0) ? ($angle - (360 * rotations)) : ($angle + (360 * rotations)); } /** * Rotates a Point around another Point by the specified angle. * * @param $point The Point to rotate * @param $centerPoint The Point to rotate this Point around * @param $angle The angle (in degrees) to rotate this point * * @return void */ public function rotatePoint($point:Point, $centerPoint:Point, $angle:Number):void { var radians:Number = degreesToRadians($angle); var baseX:Number = ($point.x - $centerPoint.x); var baseY:Number = ($point.y - $centerPoint.y); $point.x = ((Math.cos(radians) * baseX) - (Math.sin(radians) * baseY) + $centerPoint.x); $point.y = ((Math.sin(radians) * baseX) + (Math.cos(radians) * baseY) + $centerPoint.y); } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- //- GETTERS & SETTERS ------------------------------------------------------------------------------------- //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ public function toString():String { return getQualifiedClassName(this); } //- END CLASS --------------------------------------------------------------------------------------------- } } -------------------------------------------------------------------------------- /deploy/js/swfobject.js: -------------------------------------------------------------------------------- 1 | /* SWFObject v2.2 2 | is released under the MIT License 3 | */ 4 | var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab *
  • SliderEvent.ON_PRESS - Dispatched when the slider is pressed
  • *
  • SliderEvent.ON_RELEASE - Dispatched when the slider is released
  • *
  • SliderEvent.ON_UPDATE - Dispatched while the slider is dragged or when the track is clicked
  • *
  • SliderEvent.ON_ENABLED - Dispatched when the slider is enabled
  • *
  • SliderEvent.ON_DISABLED - Dispatched when the slider is disabled
  • * * Please note that if you are using the Slider on the "y" axis your track's registration point needs to be on the * bottom (NOT the top) and the slider will go up to raise the value and down to lower it. If you do not pay attention * to this your slider will be "broken". * * @author Matt Przybylski [http://www.reintroducing.com] * @version 1.8 */ public class Slider extends EventDispatcher { //- PRIVATE & PROTECTED VARIABLES ------------------------------------------------------------------------- private var _stage:Stage; private var _track:Sprite; private var _slider:Sprite; private var _timer:Timer; private var _percent:Number; private var _lowVal:Number; private var _highVal:Number; private var _startVal:Number; private var _currentVal:Number; private var _range:Number; private var _axis:String; private var _changeProp:String; private var _precision:int; private var _direction:int = 1; //- PUBLIC & INTERNAL VARIABLES --------------------------------------------------------------------------- //- CONSTRUCTOR ------------------------------------------------------------------------------------------- /** * Creates an instance of the Slider with the given data parameters. If the SliderData.startValue parameter is set to something * higher than the SliderData.highValue or lower than the SliderData.lowValue parameter, the SliderData.startValue parameter is reset to one of those two values. * If you need the slider to decrease in value, simply set the SliderData.lowValue to be something higher than the SliderData.highValue * (i.e. SliderData.lowValue = 100, SliderData.highValue = 0, pulling the slider will go from 100 to 0 rather than 0 to 100, thanks to John * Quintal for this addition). If you do not set the SliderData.precision parameter, your current value will be rounded to the nearest * whole number and the slider will snap into place at the appropriate position on the track. * * @param $sliderData The SliderData to use with the Slider * *

    * The $sliderData object takes the following values: *

      *
    • stage: The stage that the track and slider are sitting on
    • *
    • axis: The axis that the slider will be used on (SliderData.AXIS_X or SliderData.AXIS_Y)
    • *
    • track: The track to be used for the slider
    • *
    • slider: The sprite that will function as the slider
    • *
    • lowValue: A number representing the low value of the slider
    • *
    • highValue: A number representing the high value of the slider
    • *
    • startValue: A number representing the value the slider should start at (default: 0)
    • *
    • precision: An integer representing the number of decimal places to round the current value to (default: 0)
    • *
    *

    */ public function Slider($sliderData:SliderData) { _stage = $sliderData.stage; _axis = $sliderData.axis; _track = $sliderData.track; _slider = $sliderData.slider; _lowVal = $sliderData.lowValue; _highVal = $sliderData.highValue; _startVal = $sliderData.startValue; _precision = $sliderData.precision; if (_lowVal > _highVal) _direction = -1; _changeProp = (_axis == SliderData.AXIS_X) ? "width" : "height"; _range = (_lowVal <= 0) ? (Math.abs(_lowVal) + _highVal) : (_highVal - _lowVal); _timer = new Timer(10); if ((_startVal * _direction) < (_lowVal * _direction)) _startVal = _lowVal; if ((_startVal * _direction) > (_highVal * _direction)) _startVal = _highVal; manageRestingPosition(_startVal); initEvents(); } //- PRIVATE & PROTECTED METHODS --------------------------------------------------------------------------- // Initializes the slider and timer events. private function initEvents():void { _slider.buttonMode = true; _slider.tabEnabled = false; _slider.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown); _slider.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp); _track.buttonMode = true; _track.tabEnabled = false; _track.addEventListener(MouseEvent.MOUSE_DOWN, handleTrackMouseDown); _timer.addEventListener(TimerEvent.TIMER, updateInfo); } // manages the resting position depending on what value is passed in private function manageRestingPosition($val:Number):void { if ($val < 0) { _percent = ((Math.abs(_lowVal + Math.abs($val)) * _direction) / _range); } else { _percent = ((Math.abs(_lowVal - $val) * _direction) / _range); } _currentVal = roundToPrecision((_lowVal + (_range * _percent)), _precision); if (_axis == SliderData.AXIS_X) { _slider[_axis] = (_track[_axis] + (_percent * _track[_changeProp])); } else { _slider[_axis] = (_track[_axis] - (_percent * _track[_changeProp])); } } //- PUBLIC & INTERNAL METHODS ----------------------------------------------------------------------------- /** * Enables the controls of the Slider. * * @return void */ public function enable():void { initEvents(); dispatchEvent(new SliderEvent(SliderEvent.ON_ENABLED, _percent, _currentVal, _slider, _track)); } /** * Disables the controls of the Slider. * * @return void */ public function disable():void { _slider.buttonMode = false; _track.buttonMode = false; _slider.removeEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown); _slider.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp); _track.removeEventListener(MouseEvent.MOUSE_DOWN, handleTrackMouseDown); _timer.removeEventListener(TimerEvent.TIMER, updateInfo); dispatchEvent(new SliderEvent(SliderEvent.ON_DISABLED, _percent, _currentVal, _slider, _track)); } /** * Cleans up the Slider for garbage collection. * * @return void */ public function destroy():void { disable(); _timer = null; } //- EVENT HANDLERS ---------------------------------------------------------------------------------------- // Starts the dragging of the slider and starts the timer to dispatch percentage. private function handleMouseDown($evt:MouseEvent):void { dispatchEvent(new SliderEvent(SliderEvent.ON_PRESS, _percent, _currentVal, _slider, _track)); if (_axis == SliderData.AXIS_X) { _slider.startDrag(false, new Rectangle(_track.x, _slider.y, _track.width, 0)); } else { _slider.startDrag(false, new Rectangle(_slider.x, _track.y, 0, -_track.height)); } _timer.start(); _stage.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp); } // Stops the slider dragging and timer. private function handleMouseUp($evt:MouseEvent):void { dispatchEvent(new SliderEvent(SliderEvent.ON_RELEASE, _percent, _currentVal, _slider, _track)); _slider.stopDrag(); _timer.reset(); manageRestingPosition(_currentVal); _stage.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp); } // calculates percentage of track clicked and moves slider over to appropriate position private function handleTrackMouseDown($evt:MouseEvent):void { var m:Number = (_axis == SliderData.AXIS_X) ? _stage.mouseX : _stage.mouseY; var globalPoint:Point = _track.localToGlobal(new Point(0, 0)); var diff:Number = (_track[_changeProp] - ((globalPoint[_axis] + _track[_changeProp]) - m)); _percent = (diff / _track[_changeProp]); currentValue = roundToPrecision((_lowVal + (_range * _percent)), _precision); dispatchEvent(new SliderEvent(SliderEvent.ON_UPDATE, _percent, _currentVal, _slider, _track)); } // Updates the info of the slider's position. private function updateInfo($evt:TimerEvent):void { _percent = Math.abs((_slider[_axis] - _track[_axis]) / _track[_changeProp]); _currentVal = roundToPrecision((_lowVal + (_range * _percent)), _precision); dispatchEvent(new SliderEvent(SliderEvent.ON_UPDATE, _percent, _currentVal, _slider, _track)); } //- GETTERS & SETTERS ------------------------------------------------------------------------------------- /** * Returns the percentage of the slider's position on the track, between 0 and 1. * * @return Number */ public function get percent():Number { return _percent; } /** * Sets the slider's percentage according to the one provided and physically moves it to the corresponding position on the track. * * @param $val The value to set the percentage to. * * @return void */ public function set percent($val:Number):void { _percent = $val; manageRestingPosition(_percent); } /** * Returns the current value of the slider's position on the track. * * @return Number */ public function get currentValue():Number { return _currentVal; } /** * Sets the slider's current value according to the one provided and physically moves it to the corresponding position on the track. * * @param $val The value to set the currentValue to. * * @return void */ public function set currentValue($val:Number):void { _currentVal = $val; manageRestingPosition(_currentVal); } //- HELPERS ----------------------------------------------------------------------------------------------- /** * @private */ override public function toString():String { return getQualifiedClassName(this); } // rounds a number off to the specified precision point private function roundToPrecision($num:Number, $precision:int = 0):Number { var decimalPlaces:Number = Math.pow(10, $precision); return (Math.round(decimalPlaces * $num) / decimalPlaces); } //- END CLASS --------------------------------------------------------------------------------------------- } } --------------------------------------------------------------------------------