/** * SWFAddress 2.4: Deep linking for Flash and Ajax * * SWFAddress is (c) 2006-2009 Rostislav Hristov and contributors * This software is released under the MIT License * */ /** * @author Rostislav Hristov * @author Matthew J Tretter * @author Piotr Zema */ package { import flash.events.Event; import SWFAddress; /** * Event class for SWFAddress. */ public class SWFAddressEvent extends Event { /** * Defines the value of the type property of a init event object. */ public static const INIT:String = 'init'; /** * Defines the value of the type property of a change event object. */ public static const CHANGE:String = 'change'; /** * Defines the value of the type property of a internalChange event object. */ public static const INTERNAL_CHANGE:String = 'internalChange'; /** * Defines the value of the type property of a externalChange event object. */ public static const EXTERNAL_CHANGE:String = 'externalChange'; private var _value:String; private var _path:String; private var _pathNames:Array; private var _parameterNames:Array; private var _parameters:Object; /** * Creates a new SWFAddress event. * @param type Type of the event. */ public function SWFAddressEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) { super(type, bubbles, cancelable); } /** * The current target of this event. */ public override function get currentTarget():Object { return SWFAddress; } /** * The type of this event. */ public override function get type():String { return super.type; } /** * The target of this event. */ public override function get target():Object { return SWFAddress; } /** * The value of this event. */ public function get value():String { if (_value == null) { _value = SWFAddress.getValue(); } return _value; } /** * The path of this event. */ public function get path():String { if (_path == null) { _path = SWFAddress.getPath(); } return _path; } /** * The folders in the deep linking path of this event. */ public function get pathNames():Array { if (_pathNames == null) { _pathNames = SWFAddress.getPathNames(); } return _pathNames; } /** * The parameters of this event. */ public function get parameters():Object { if (_parameters == null) { _parameters = new Object(); for (var i:int = 0; i < parameterNames.length; i++) { _parameters[parameterNames[i]] = SWFAddress.getParameter(parameterNames[i]); } } return _parameters; } /** * The parameters names of this event. */ public function get parameterNames():Array { if (_parameterNames == null) { _parameterNames = SWFAddress.getParameterNames(); } return _parameterNames; } /** * Creates a copy of the SWFAddressEvent object and sets the value of each parameter to match the original. */ public override function clone():Event { return new SWFAddressEvent(type, bubbles, cancelable); } /** * Returns a string that contains all the properties of the SWFAddressEvent object. * The string has the following format: * *

[SWFAddressEvent type=value bubbles=value * cancelable=value eventPhase= value=value path=value * paths=value parameters=value]

* * @return A string representation of the SWFAddressEvent object. */ public override function toString():String { return formatToString('SWFAddressEvent', 'type', 'bubbles', 'cancelable', 'eventPhase', 'value', 'path', 'pathNames', 'parameterNames', 'parameters'); } } }