CombinedText
stringlengths
4
3.42M
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.controls.listClasses { /* import flash.display.DisplayObject; import flash.display.Graphics; import flash.display.Shape; import flash.display.Sprite; import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.geom.Point; import flash.ui.Keyboard; import flash.utils.Dictionary; import flash.utils.clearInterval; import flash.utils.setInterval; import mx.collections.ArrayCollection; import mx.collections.CursorBookmark; import mx.collections.IList; import mx.collections.IViewCursor; import mx.collections.ItemResponder; import mx.collections.ItemWrapper; import mx.collections.ListCollectionView; import mx.collections.ModifiedCollectionView; import mx.collections.XMLListCollection; import mx.collections.errors.CursorError; import mx.collections.errors.ItemPendingError; import mx.controls.dataGridClasses.DataGridListData; import mx.core.DragSource; import mx.core.EdgeMetrics; import mx.core.EventPriority; import mx.core.FlexShape; import mx.core.FlexSprite; import mx.core.IDataRenderer; import mx.core.IFlexDisplayObject; import mx.core.IInvalidating; import mx.core.ILayoutDirectionElement; import mx.core.IUIComponent; import mx.core.IUID; import mx.core.IUITextField; import mx.core.ScrollPolicy; import mx.core.SpriteAsset; import mx.effects.Effect; import mx.effects.IEffectTargetHost; import mx.effects.Tween; import mx.events.CollectionEvent; import mx.events.CollectionEventKind; import mx.events.DragEvent; import mx.events.EffectEvent; import mx.events.FlexEvent; import mx.events.MoveEvent; import mx.events.SandboxMouseEvent; import mx.events.ScrollEvent; import mx.events.ScrollEventDetail; import mx.events.ScrollEventDirection; import mx.events.TweenEvent; import mx.managers.DragManager; import mx.managers.IFocusManagerComponent; import mx.managers.ISystemManager; import mx.skins.halo.ListDropIndicator; import mx.utils.ObjectUtil; import mx.utils.UIDUtil; */ import org.apache.royale.events.MouseEvent; import mx.events.ListEvent; import mx.collections.ICollectionView; import mx.core.IFactory; import mx.core.UIComponent; import mx.core.ScrollControlBase; import mx.core.mx_internal; use namespace mx_internal; //-------------------------------------- // Events //-------------------------------------- /** * Dispatched when the <code>selectedIndex</code> or <code>selectedItem</code> property * changes as a result of user interaction. * * @eventType mx.events.ListEvent.CHANGE * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ [Event(name="change", type="mx.events.ListEvent")] /** * Dispatched when the <code>data</code> property changes. * * <p>When you use a component as an item renderer, * the <code>data</code> property contains the data to display. * You can listen for this event and update the component * when the <code>data</code> property changes.</p> * * @eventType mx.events.FlexEvent.DATA_CHANGE * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ [Event(name="dataChange", type="mx.events.FlexEvent")] /** * Dispatched when the user rolls the mouse pointer over an item in the control. * * @eventType mx.events.ListEvent.ITEM_ROLL_OVER * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Event(name="itemRollOver", type="mx.events.ListEvent")] /** * Dispatched when the user rolls the mouse pointer out of an item in the control. * * @eventType mx.events.ListEvent.ITEM_ROLL_OUT * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Event(name="itemRollOut", type="mx.events.ListEvent")] /** * Dispatched when the user clicks on an item in the control. * * @eventType mx.events.ListEvent.ITEM_CLICK * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ [Event(name="itemClick", type="mx.events.ListEvent")] /** * Dispatched when the user double-clicks on an item in the control. * * @eventType mx.events.ListEvent.ITEM_DOUBLE_CLICK * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ [Event(name="itemDoubleClick", type="mx.events.ListEvent")] //-------------------------------------- // Styles //-------------------------------------- /* include "../../styles/metadata/FocusStyles.as" include "../../styles/metadata/PaddingStyles.as" */ /** * The colors to use for the backgrounds of the items in the list. * The value is an array of two or more colors. * The backgrounds of the list items alternate among the colors in the array. * * <p>For DataGrid controls, all items in a row have the same background color, * and each row's background color is determined from the array of colors.</p> * * <p>For the TileList control, which uses a single list to populate a * two-dimensional display, the style can result in a checkerboard appearance, * stripes, or other patterns based on the number of columns and rows and * the number of colors specified. TileList cycles through the colors, placing * the individual item background colors according to the * layout direction. If you have an even number of colors and an even number of * columns for a TileList layed out horizontally, you will get striping. If * the number of columns is an odd number, you will get a checkerboard pattern. * </p> * * <p>Only takes effect if no <code>backgroundColor</code> is specified.</p> * * @default undefined * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="alternatingItemColors", type="Array", arrayType="uint", format="Color", inherit="yes")] /** * The skin to use to indicate where a dragged item can be dropped. * When an AdvancedListBase-derived component is a potential drop target in a * drag-and-drop operation, a call to the <code>showDropFeedback()</code> * method makes an instance of this class and positions it one pixel above * the item renderer for the item where, if the drop occurs, is the item after * the dropped item. * * @default mx.controls.listClasses.ListDropIndicator * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="dropIndicatorSkin", type="Class", inherit="no")] /** * The number of pixels between the bottom of the row * and the bottom of the renderer in the row. * * @default 2 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="paddingBottom", type="Number", format="Length", inherit="no")] /** * The number of pixels between the top of the row * and the top of the renderer in the row. * * @default 2 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="paddingTop", type="Number", format="Length", inherit="no")] /** * The color of the background of a renderer when the user rolls over it. * * @default 0xEEFEE6 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="rollOverColor", type="uint", format="Color", inherit="yes")] /** * The color of the background of a renderer when the user selects it. * * @default 0x7FCEFF * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="selectionColor", type="uint", format="Color", inherit="yes")] /** * The color of the background of a renderer when the component is disabled. * * @default 0xDDDDDD * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="selectionDisabledColor", type="uint", format="Color", inherit="yes")] /** * The duration of the selection effect. * When an item is selected an effect plays as the background is colored. * Set to 0 to disable the effect. * * @default 250 * * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="selectionDuration", type="Number", format="Time", inherit="no")] /** * The easingFunction for the selection effect. * When an item is selected an effect plays as the background is colored. * The default is a linear fade in of the color. An easingFunction can be used * for controlling the selection effect. * * @default undefined * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="selectionEasingFunction", type="Function", inherit="no")] /** * The color of the text of a renderer when the user rolls over a it. * * @default 0x2B333C * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="textRollOverColor", type="uint", format="Color", inherit="yes")] /** * The color of the text of a renderer when the user selects it. * * @default 0x2B333C * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="textSelectedColor", type="uint", format="Color", inherit="yes")] /** * A flag that controls whether items are highlighted as the mouse rolls * over them. * If <code>true</code>, rows are highlighted as the mouse rolls over them. * If <code>false</code>, rows are highlighted only when selected. * * @default true * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="useRollOver", type="Boolean", inherit="no")] /** * The vertical alignment of a renderer in a row. * Possible values are <code>"top"</code>, <code>"middle"</code>, * and <code>"bottom"</code>. * The DataGrid positions the renderers in a row based on this style * and the <code>paddingTop</code> and <code>paddingBottom</code> styles. * if the item in the columns for a row have different heights * Other list classes do not use <code>verticalAlign</code> but * the item renderers can examine this style property * and adjust their layout based on it. * * @default "top" * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="verticalAlign", type="String", enumeration="bottom,middle,top", inherit="no")] /** * The effect used when changes occur in the control's data provider. * * This can be a class reference (to a subclass of effect) or an * Effect object instance. The former is appropriate for CSS, the * latter for inline definition within a component. * * @default undefined * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //[Style(name="dataChangeEffect", type="Object", inherit="no")] //-------------------------------------- // Other metadata //-------------------------------------- //[AccessibilityClass(implementation="mx.accessibility.ListBaseAccImpl")] /** * The AdvancedListBase class is the base class for controls, * such as the AdvancedDataGrid and OLAPDataGrid controls, that represent lists * of items that can have one or more selected items and can scroll through the * items. Items are supplied using the <code>dataProvider</code> property * and displayed via item renderers. * * <p>In a model/view architecture, the AdvancedListBase subclass represent * the view, and the data provider represents the model.</p> * * @mxml * * <p>The AdvancedListBase class inherits all of the tag properties of its superclasses, * and adds the following tag properties:</p> * * <pre> * &lt;mx:<i>tagname</i> * <b>Properties</b> * allowDragSelection="false|true" * allowMultipleSelection="false|true" * columnCount="4" * columnWidth="NaN" * dataProvider="null" * dataTipField="label" * dataTipFunction="null" * dragEnabled="false|true" * dragMoveEnabled="false|true" * dropEnabled="false|true" * iconField="null" * iconFunction="null" * itemRenderer="null" * labelField="label" * labelFunction="null" * lockedColumnCount=0 * lockedRowCount=0 * menuSelectionMode="false|true" * rowCount="-1" * rowHeight="NaN" * selectable="true|false" * selectedIndex="-1" * selectedIndices="null" * selectedItem="null" * selectedItems="null" * showDataTips="false|true" * variableRowHeight="false|true" * wordWrap="false|true" * * <b>Styles</b> * alternatingItemColors="undefined" * dataChangeEffect="undefined" * dropIndicatorSkin="ListDropIndicator" * focusAlpha="0.5" * focusRoundedCorners="tl tr bl br" * paddingBottom="2" * paddingLeft="2" * paddingRight="0" * paddingTop="2" * rollOverColor="0xEEFEE6" * selectionColor="0x7FCEFF" * selectionDisabledColor="0xDDDDDD" * selectionDuration="250" * selectionEasingFunction="undefined" * textRollOverColor="0x2B333C" * textSelectedColor="0x2B333C" * useRollOver="true|false" * verticalAlign="top|middle|bottom" * * <b>Events</b> * change="<i>No default</i>" * dataChange="<i>No default</i>" * itemClick="<i>No default</i>" * itemDoubleClick="<i>No default</i>" * itemRollOut="<i>No default</i>" * itemRollOver="<i>No default</i>" * itemClick="<i>No default</i>" * /&gt; * </pre> * * @see mx.collections.ICollectionView * @see mx.controls.AdvancedDataGrid * @see mx.controls.OLAPDataGrid * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 * @royalesuppresspublicvarwarning */ public class AdvancedListBase extends ScrollControlBase /* extends UIComponent implements IDataRenderer, IFocusManagerComponent, IListItemRenderer, IDropInListItemRenderer, IEffectTargetHost */ { /* include "../../core/Version.as"; */ //-------------------------------------------------------------------------- // // Class constants // //-------------------------------------------------------------------------- /** * @private * Anything in this list of styles will trigger a full repaint. */ /* private var IS_ITEM_STYLE:Object = { alternatingItemColors: true, backgroundColor: true, backgroundDisabledColor: true, color: true, rollOverColor: true, selectionColor: true, selectionDisabledColor: true, styleName: true, textColor:true, textRollOverColor: true, textSelectedColor: true }; */ /** * @private * Mouse movement threshold for determining when to start a drag. */ // mx_internal static const DRAG_THRESHOLD:int = 4; //-------------------------------------------------------------------------- // // Class mixins // //-------------------------------------------------------------------------- /** * @private * Placeholder for mixin by ListBaseAccImpl. */ // mx_internal static var createAccessibilityImplementation:Function; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function AdvancedListBase() { super(); // tabEnabled = true; // addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler); // addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); // addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); // addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); // addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); // addEventListener(MouseEvent.CLICK, mouseClickHandler); // addEventListener(MouseEvent.DOUBLE_CLICK, mouseDoubleClickHandler); // invalidateProperties(); } //-------------------------------------------------------------------------- // // Variables // //-------------------------------------------------------------------------- /** * An ICollectionView that represents the data provider. * When you set the <code>dataProvider</code> property, * Flex wraps the data provider as necessary to * support the ICollectionView interface and * sets this property to the result. * The AdvancedListBase class then uses this property to access * data in the provider. * When you get the <code>dataProvider</code> property, * Flex returns this value. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ protected var collection:ICollectionView; /** * The main IViewCursor instance used to fetch items from the * data provider and pass the items to the renderers. * At the end of any sequence of code, it must always * be positioned at the topmost visible item being displayed. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var iterator:IViewCursor; /** * A flag that indicates that a page fault as occurred and that * the iterator's position is not valid (not positioned at the topmost * item being displayed). * If the component gets a page fault (an ItemPending error), * it sets <code>iteratorValid</code> to <code>false</code>. Code that * normally handles the rendering of items checks this flag and does not * run until the page of data comes in from the server. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var iteratorValid:Boolean = true; /** * The most recent seek that caused a page fault. * If there are multiple page faults, only the most recent one * is of interest, as that is where to position the iterator * and start rendering rows again. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var lastSeekPending:ListBaseSeekPending; /** * A hash table of data provider item renderers currently in view. * The table is indexed by the data provider item's UID and is used * to quickly get the renderer used to display a particular item. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var visibleData:Object = {}; /** * An internal display object that parents all of the item renderers, * selection and highlighting indicators and other supporting graphics. * This is roughly equivalent to the <code>contentPane</code> in the * Container class, and is used for managing scrolling. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var listContent:AdvancedListBaseContentHolder; /** * The layer in <code>listContent</code> where all selection * and highlight indicators are drawn. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var selectionLayer:Sprite; /** * An Array of Arrays that contains * the item renderer instances that render each data provider item. * This is a two-dimensional row major Array * (Array of rows that are Arrays of columns). * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var listItems:Array = []; /** * An array of ListRowInfo objects that cache row heights and * other tracking information for the rows in the <code>listItems</code> property. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var rowInfo:Array = []; /** * A hash map of item renderers to their respective ListRowInfo object. * The ListRowInfo object is indexed by the DisplayObject name of the * item renderer. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var rowMap:Object = {}; /** * A stack of unused item renderers. * Most list classes recycle renderers they've already created * as they scroll out of the displayable area; doing so * saves time during scrolling. * The recycled renderers are stored here. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var freeItemRenderers:Array = []; /** * A hash map of currently unused item renderers that may be * used again in the near future. Used when running data effects. * The map is indexed by the data provider item's UID. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var reservedItemRenderers:Object = {}; /** * A hash map of item renderers that are not subject * to the layout algorithms of the list * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var unconstrainedRenderers:Object = {}; /** * A dictionary mapping item renderers to the ItemWrappers * used to supply their data. Only applicable if a data * effect is running. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var dataItemWrappersByRenderer:Dictionary = new Dictionary(true); /** * A flag that indicates if a data effect should be initiated * the next time the display is updated. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var runDataEffectNextUpdate:Boolean = false; /** * A flag indicating if a data change effect is currently running * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var runningDataEffect:Boolean = false; /** * The effect that plays when changes occur in the data * provider for the control. * Set the effect by setting the <code>dataChangeEffect</code> * style. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var cachedDataChangeEffect:Effect = null; /** * The collection view that temporarily preserves previous * data provider state to facilitate running data change effects. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var modifiedCollectionView:ModifiedCollectionView; /** * A copy of the value normally stored in the <code>collection</code> * property used while running data changes effects. This value should be * null when a data change effect is not running. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var actualCollection:ICollectionView; /** * The number of extra item renderers the layout algorithm can use when * constructing animations for data effects. Changes that take place in * the data provider corresponding to the items visible onscreen or this * many items before or after the items onscreen will be subject to * full effects processing. Items outside this range may not be * animated perfectly by the effects. * * <p>A reasonable value for this property is approximately the number * of rows visible onscreen. Setting it to a very large value may * cause performance problems when used with a dataProvider with many * items.</p> * * @default 0 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // public var offscreenExtraRows:int = 0; // TODO May have to reconsider for Tilelists (do we want to consider // rows? Do we do this separately for vertical/horizontal? // TODO this should be a property, and changing it should trigger // update // // TODO Would rather not make this protected /** * The number of offscreen items currently above the topmost visible * renderer. This number will be &lt;= offscreenExtraRows / 2. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var offscreenExtraRowsTop:int = 0; /** * The number of offscreen items currently below the bottommost visible * item renderer * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var offscreenExtraRowsBottom:int = 0; /** * The number of columns that are currently not visible. * * @default 0 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // public var offscreenExtraColumns:int = 0; /** * The number of columns on the left side of the control * that are currently not visible. * * @default 0 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var offscreenExtraColumnsLeft:int = 0; /** * The number of columns on the right side of the control * that are currently not visible. * * @default 0 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var offscreenExtraColumnsRight:int = 0; /** * A copy of the value normally stored in the <code>iterator</code> * property used while running data changes effects. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var actualIterator:IViewCursor; /** * The UID of the item that is current rolled over or under the caret. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var highlightUID:String; /** * The renderer that is currently rolled over or under the caret. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var highlightItemRenderer:IListItemRenderer; /** * The DisplayObject that contains the graphics that indicates * which renderer is highlighted. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var highlightIndicator:Sprite; /** * The UID of the item under the caret. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var caretUID:String; /** * The renderer for the item under the caret. In the selection * model, there is an anchor, a caret and a highlighted item. When * the mouse is being used for selection, the item under the mouse is * highlighted as the mouse rolls over the item. * When the mouse is clicked with no modifier keys (Shift or Control), the * set of selected items is cleared and the item under the highlight is * selected and becomes the anchor. The caret is unused in mouse * selection. * * <p>If there is an anchor and another item is selected while * using the Shift key, the old set of selected items is cleared, and * all items between the item and the anchor are selected. Clicking * items while using the Control key toggles the selection of individual * items and does not move the anchor.</p> * * <p>When selecting items using the keyboard, if the arrow keys are used * with no modifier keys, the old selection is cleared and the new item * is selected and becomes the anchor and the caret, and a caret indicator * is shown around the selection highlight. </p> * * <p>If the user uses arrow keys * with the Shift key, the old selection is cleared and the items between * the anchor and the new item are selected. The caret moves to the new * item. </p> * * <p>If arrow keys are used with the Control key, just the caret moves. * The user can use the Space key to toggle selection of the item under * the caret.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var caretItemRenderer:IListItemRenderer; /** * The DisplayObject that contains the graphics that indicate * which renderer is the caret. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var caretIndicator:Sprite; /** * A hash table of ListBaseSelectionData objects that track which * items are currently selected. The table is indexed by the UID * of the items. * * @see mx.controls.listClasses.ListBaseSelectionData * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var selectedData:Object = {}; /** * A hash table of selection indicators. This table allows the component * to quickly find and remove the indicators when the set of selected * items is cleared. The table is indexed by the item's UID. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var selectionIndicators:Object = {}; /** * A hash table of selection tweens. This allows the component to * quickly find and clean up any tweens in progress if the set * of selected items is cleared. The table is indexed by the item's UID. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var selectionTweens:Object = {}; /** * A bookmark to the item under the caret. A bookmark allows the * component to quickly seek to a position in the collection of items. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var caretBookmark:CursorBookmark; /** * A bookmark to the item that is the anchor. A bookmark allows the * component to quickly seek to a position in the collection of items. * This property is used when selecting a set of items between the anchor * and the caret or highlighted item, and when finding the selected item * after a Sort or Filter is applied. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var anchorBookmark:CursorBookmark; /** * A flag that indicates whether to show caret. * This property is usually set * to <code>false</code> when mouse activity is detected and set back to * <code>true</code> when the keyboard is used for selection. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var showCaret:Boolean; /** * The most recently calculated index where the drag item * should be added to the drop target. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var lastDropIndex:int; /** * A flag that indicates whether the <code>columnWidth</code> * and <code>rowHeight</code> properties need to be calculated. * This property is set to <code>true</code> if a style changes that can affect the * measurements of the renderer, or if the data provider is changed. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var itemsNeedMeasurement:Boolean = true; /** * A flag that indicates that the size of the renderers may have changed. * The component usually responds by re-applying the data items to all of * the renderers on the next <code>updateDisplayList()</code> call. * There is an assumption that re-applying the items will invalidate the * item renderers and cause them to re-measure. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var itemsSizeChanged:Boolean = false; /** * A flag that indicates that the renderer changed. * The component usually responds by destroying all existing renderers * and redrawing all of the renderers on the next * <code>updateDisplayList()</code> call. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var rendererChanged:Boolean = false; /** * A flag that indicates that the a data change effect has * just completed. * The component usually responds by cleaning up various * internal data structures on the next * <code>updateDisplayList()</code> call. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var dataEffectCompleted:Boolean = false; /** * A flag that indicates whether the value of the <code>wordWrap</code> * property has changed since the last time the display list was updated. * This property is set when you change the <code>wordWrap</code> * property value, and is reset * to <code>false</code> by the <code>updateDisplayList()</code> method. * The component usually responds by re-applying the data items to all of * the renderers on the next <code>updateDisplayList()</code> call. * This is different from itemsSizeChanged because it further indicates * that re-applying the data items to the renderers may not invalidate them * since the only thing that changed was whether or not the renderer should * factor in wordWrap into its size calculations * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var wordWrapChanged:Boolean = false; /** * A flag that indicates if keyboard selection was interrupted by * a page fault. The component responds by suspending the rendering * of items until the page of data arrives. * The <code>finishKeySelection()</code> method will be called * when the paged data arrives * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var keySelectionPending:Boolean = false; /** * The offset of the item in the data provider that is the selection * anchor point. * * @see mx.controls.listClasses.ListBase#caretItemRenderer * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //protected var anchorIndex:int = -1; /** * The offset of the item in the data provider that is at the selection * caret point. * * @see mx.controls.listClasses.ListBase#caretItemRenderer * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var caretIndex:int = -1; /** * @private */ //private var columnCountChanged:Boolean = true; /** * @private */ //private var columnWidthChanged:Boolean = false; /** * The default number of columns to display. This value * is used if the calculation for the number of * columns results in a value less than 1 when * trying to calculate the column count based on size or * content. * * @default 4 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var defaultColumnCount:int = 4; /** * The default number of rows to display. This value * is used if the calculation for the number of * columns results in a value less than 1 when * trying to calculate the row count based on size or * content. * * @default 4 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var defaultRowCount:int = 4; /** * The column count requested by explicitly setting the * <code>columnCount</code> property. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var explicitColumnCount:int = -1; /** * The column width requested by explicitly setting the * <code>columnWidth</code>. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var explicitColumnWidth:Number; /** * The row count requested by explicitly setting * <code>rowCount</code>. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var explicitRowCount:int = -1; /** * The row height requested by explicitly setting * <code>rowHeight</code>. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected var explicitRowHeight:Number; /** * @private */ // private var rowCountChanged:Boolean = true; /** * @private * Cached style value. */ // mx_internal var cachedPaddingTop:Number; /** * @private * Cached style value. */ // mx_internal var cachedPaddingBottom:Number; /** * @private * Cached style value. */ // mx_internal var cachedVerticalAlign:String; /** * @private */ // private var oldUnscaledWidth:Number; /** * @private */ // private var oldUnscaledHeight:Number; /** * @private */ //private var horizontalScrollPositionPending:Number; /** * @private */ // private var verticalScrollPositionPending:Number; /** * @private */ // private var mouseDownPoint:Point; /** * @private */ // private var bSortItemPending:Boolean = false; // these three keep track of the key selection that caused // the page fault /* private var bShiftKey:Boolean = false; private var bCtrlKey:Boolean = false; private var lastKey:uint = 0; private var bSelectItem:Boolean = false; */ /** * @private * true if we don't know for sure what index we're on in the database */ // private var approximate:Boolean = false; // if false, pixel scrolling only in horizontal direction // mx_internal var bColumnScrolling:Boolean = true; // either "horizontal", "vertical", "grid" Used to determine how // to measure the list. // mx_internal var listType:String = "grid"; // mx_internal for automation delegate access //mx_internal var bSelectOnRelease:Boolean; /* private var mouseDownItem:IListItemRenderer; private var mouseDownIndex:int; // For drag and drop mx_internal var bSelectionChanged:Boolean = false; mx_internal var bSelectedIndexChanged:Boolean = false; private var bSelectedItemChanged:Boolean = false; private var bSelectedItemsChanged:Boolean = false; private var bSelectedIndicesChanged:Boolean = false; */ /** * @private * Dirty flag for the cache style value cachedPaddingTop. */ //private var cachedPaddingTopInvalid:Boolean = true; /** * @private * Dirty flag for the cache style value cachedPaddingBottom. */ // private var cachedPaddingBottomInvalid:Boolean = true; /** * @private * Dirty flag for the cache style value cachedVerticalAlign. */ // private var cachedVerticalAlignInvalid:Boolean = true; /** * @private * The first ListBaseSelectionData in a link list of ListBaseSelectionData. * This represents the item that was most recently selected. * ListBaseSelectionData instances are linked together and keep track of the * order the user selects an item. This order is reflected in selectedIndices * and selectedItems. */ // private var firstSelectionData:ListBaseSelectionData; /** * The renderer that is or was rolled over or under the caret. * In DG, this is always column 0 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // mx_internal var lastHighlightItemRenderer:IListItemRenderer; /** * The renderer that is or was rolled over or under the caret. * In DG, this is the actual item * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // mx_internal var lastHighlightItemRendererAtIndices:IListItemRenderer; /** * The last coordinate send in ITEM_ROLL_OVER * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // private var lastHighlightItemIndices:Point; // private var dragScrollingInterval:int = 0; /** * @private * An Array of Shapes that are used as clip masks for the list items */ // private var itemMaskFreeList:Array; /** * @private * An array of item renderers being tracked for MoveEvents while * data change effects are running. */ // private var trackedRenderers:Array = []; /** * @private * Whether the mouse button is pressed */ // mx_internal var isPressed:Boolean = false; /** * A separate IViewCursor used to find indices of items and * other things. The collectionIterator can be at any * place within the set of items. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* mx_internal var collectionIterator:IViewCursor; mx_internal var dropIndicator:IFlexDisplayObject; */ //-------------------------------------------------------------------------- // // Overridden properties: UIComponent // //-------------------------------------------------------------------------- //---------------------------------- // enabled //---------------------------------- // [Inspectable(category="General")] /** * @private */ /* override public function set enabled(value:Boolean):void { super.enabled = value; var ui:IFlexDisplayObject = border as IFlexDisplayObject; if (ui) { if (ui is IUIComponent) IUIComponent(ui).enabled = value; if (ui is IInvalidating) IInvalidating(ui).invalidateDisplayList(); } itemsSizeChanged = true; invalidateDisplayList(); } */ //---------------------------------- // showInAutomationHierarchy //---------------------------------- /** * @private */ /* override public function set showInAutomationHierarchy(value:Boolean):void { //do not allow value changes } */ //-------------------------------------------------------------------------- // // Overridden properties: ScrollControlBase // //-------------------------------------------------------------------------- //---------------------------------- // horizontalScrollPolicy //---------------------------------- /** * @private */ /* override public function set horizontalScrollPolicy(value:String):void { super.horizontalScrollPolicy = value; itemsSizeChanged = true; invalidateDisplayList(); } */ //---------------------------------- // horizontalScrollPosition //---------------------------------- /** * @private */ /* override public function get horizontalScrollPosition():Number { if (!isNaN(horizontalScrollPositionPending)) return horizontalScrollPositionPending; return super.horizontalScrollPosition; } */ /** * @private */ /* override public function set horizontalScrollPosition(value:Number):void { // if not init or no data; if (listItems.length == 0 || !dataProvider || !isNaN(horizontalScrollPositionPending)) { horizontalScrollPositionPending = value; if (dataProvider) invalidateDisplayList(); return; } horizontalScrollPositionPending = NaN; // trace("set horizontalScrollPosition " + value + " " + super.horizontalScrollPosition); var oldValue:int = super.horizontalScrollPosition; super.horizontalScrollPosition = value; removeClipMask(); if (oldValue != value) { // we're going to get a full repaint soon so don't bother here. if (itemsSizeChanged) return; var deltaPos:int = value - oldValue; var direction:Boolean = (deltaPos > 0); deltaPos = Math.abs(deltaPos); if (bColumnScrolling && deltaPos >= columnCount - lockedColumnCount) { clearIndicators(); visibleData = {}; makeRowsAndColumnsWithExtraColumns(oldUnscaledWidth, oldUnscaledHeight); drawRowBackgrounds(); } else { scrollHorizontally(value, deltaPos, direction); } } addClipMask(false); } */ /* //---------------------------------- // borderVisible //---------------------------------- public function get borderVisible():Boolean { return true; } public function set borderVisible(value:Boolean):void { } */ //---------------------------------- // verticalScrollPolicy //---------------------------------- /** * @private */ /* override public function set verticalScrollPolicy(value:String):void { super.verticalScrollPolicy = value; itemsSizeChanged = true; invalidateDisplayList(); } */ //---------------------------------- // verticalScrollPosition //---------------------------------- /* [Bindable("scroll")] [Bindable("viewChanged")] */ /** * @private */ /* override public function get verticalScrollPosition():Number { if (!isNaN(verticalScrollPositionPending)) return verticalScrollPositionPending; return super.verticalScrollPosition; } */ /** * @private */ /* override public function set verticalScrollPosition(value:Number):void { if (listItems.length == 0 || !dataProvider || !isNaN(verticalScrollPositionPending)) { verticalScrollPositionPending = value; if (dataProvider) invalidateDisplayList(); return; } verticalScrollPositionPending = NaN; var oldValue:int = super.verticalScrollPosition; super.verticalScrollPosition = value; removeClipMask(); var oldoffscreenExtraRowsTop:int = offscreenExtraRowsTop; var oldoffscreenExtraRowsBottom:int = offscreenExtraRowsBottom; // trace("set verticalScrollPosition", oldValue, value); if (oldValue != value) { var deltaPos:int = value - oldValue; var direction:Boolean = (deltaPos > 0); deltaPos = Math.abs(deltaPos); if (deltaPos >= rowInfo.length - lockedRowCount || !iteratorValid) { clearIndicators(); visibleData = {}; makeRowsAndColumnsWithExtraRows(oldUnscaledWidth, oldUnscaledHeight); } else { scrollVertically(value, deltaPos, direction); adjustListContent(oldUnscaledWidth,oldUnscaledHeight); } // if variable rowheight, we have to recalibrate the scrollbars thumb size // on each scroll, otherwise you can't scroll down to a bunch of fat rows // at the bottom of a list. if (variableRowHeight) configureScrollBars(); drawRowBackgrounds(); } // if needed, add a clip mask to the items in the last row of the list addClipMask((offscreenExtraRowsTop != oldoffscreenExtraRowsTop) || (offscreenExtraRowsBottom != oldoffscreenExtraRowsBottom)); } */ //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- public function get headerStyleName():String { return ""; } /** * @private */ public function set headerStyleName(value:String):void { } //---------------------------------- // allowDragSelection //---------------------------------- /** * A flag that indicates whether drag-selection is enabled. * Drag-selection is the ability to select an item by dragging * into it as opposed to normal selection where you can't have * the mouse button down when you mouse over the item you want * to select. This feature is used in ComboBox dropdowns * to support pressing the mouse button when the mouse is over the * dropdown button, and then dragging the mouse into the dropdown to select * an item. * * @default false * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 * @royalesuppresspublicvarwarning */ //---------------------------------- // editable //---------------------------------- public function get editable():String { return ""; } public function set editable(value:String):void { } public var allowDragSelection:Boolean = false; //---------------------------------- // allowMultipleSelection //---------------------------------- /** * @private * Storage for the allowMultipleSelection property. */ private var _allowMultipleSelection:Boolean = false; [Inspectable(category="General", enumeration="false,true", defaultValue="false")] /** * A flag that indicates whether you can allow more than one item to be * selected at the same time. * If <code>true</code>, users can select multiple items. * There is no option to disallow discontiguous selection. * Standard complex selection options are always in effect * (shift-click, control-click). * * @default false * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get allowMultipleSelection():Boolean { return _allowMultipleSelection; } /** * @private */ public function set allowMultipleSelection(value:Boolean):void { _allowMultipleSelection = value; } //---------------------------------- // styleFunction //---------------------------------- private var _styleFunction:Function; public function get styleFunction():Function { return _styleFunction; } public function set styleFunction(value:Function):void { _styleFunction = value; } //---------------------------------- // columnCount //---------------------------------- /** * @private * Storage for the columnCount property. */ private var _columnCount:int = -1; /** * The number of columns to be displayed in a TileList control or items * in a HorizontalList control. * For the data grids, specifies the number of visible columns. * * <p><b>Note</b>: Setting this property has no effect on a DataGrid control, * which bases the number of columns on the control width and the * individual column widths.</p> * * @default 4 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get columnCount():int { return _columnCount; } /** * @private */ public function set columnCount(value:int):void { /* explicitColumnCount = value; if (_columnCount != value) { setColumnCount(value); columnCountChanged = true; invalidateProperties(); invalidateSize(); itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("columnCountChanged")); } */ } /** * Internal version for setting columnCount * without invalidation or notification. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* mx_internal function setColumnCount(value:int):void { _columnCount = value; } */ //---------------------------------- // columnWidth //---------------------------------- /** * @private * Storage for the columnWidth property. */ private var _columnWidth:Number; /** * The width of the control's columns. * This property is used by TileList and HorizontalList controls; * It has no effect on data grid controls, where you set the individual * column widths. * * @default 50 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get columnWidth():Number { return _columnWidth; } /** * @private */ public function set columnWidth(value:Number):void { /* explicitColumnWidth = value; if (_columnWidth != value) { setColumnWidth(value); invalidateSize(); itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("columnWidthChanged")); } */ } //---------------------------------- // data //---------------------------------- /** * @private * Storage for the data property. */ /* private var _data:Object; [Bindable("dataChange")] [Inspectable(environment="none")] */ /** * The item in the data provider this component should render when * this component is used as an item renderer or item editor. * The list class sets this property on each renderer or editor * and the component displays the data. ListBase-derived classes * support this property for complex situations like having a * List of DataGrids or a DataGrid where one column is a List. * * <p>The list classes use the <code>listData</code> property * in addition to the <code>data</code> property to determine what * to display. * If the list class is in a DataGrid it expects the <code>dataField</code> * property of the column to map to a property in the data * and sets <code>selectedItem</code> value to that property. * If it is in a List or TileList control, it expects the * <code>labelField</code> property of the list to map to a property * in the data, and sets <code>selectedItem</code> value to that property. * Otherwise it sets the <code>selectedItem</code> to the data itself.</p> * * <p>This property uses the data provider but does not set it. * In all cases, you must set the data provider in some other way.</p> * * <p>You do not set this property in MXML.</p> * * @see mx.core.IDataRenderer * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get data():Object { return _data; } */ /** * @private */ /* public function set data(value:Object):void { _data = value; if (_listData && _listData is DataGridListData) selectedItem = _data[DataGridListData(_listData).dataField]; else if (_listData is ListData && ListData(_listData).labelField in _data) selectedItem = _data[ListData(_listData).labelField]; else selectedItem = _data; dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); } */ //---------------------------------- // dataProvider //---------------------------------- [Bindable("collectionChange")] [Inspectable(category="Data", defaultValue="undefined")] /** * Set of data to be viewed. * This property lets you use most types of objects as data providers. * If you set the <code>dataProvider</code> property to an Array, * it will be converted to an ArrayCollection. If you set the property to * an XML object, it will be converted into an XMLListCollection with * only one item. If you set the property to an XMLList, it will be * converted to an XMLListCollection. * If you set the property to an object that implements the * IList or ICollectionView interface, the object will be used directly. * * <p>As a consequence of the conversions, when you get the * <code>dataProvider</code> property, it will always be * an ICollectionView, and therefore not necessarily be the type of object * you used to you set the property. * This behavior is important to understand if you want to modify the data * in the data provider: changes to the original data may not be detected, * but changes to the ICollectionView object that you get back from the * <code>dataProvider</code> property will be detected.</p> * * @default null * @see mx.collections.ICollectionView * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get dataProvider():Object { // if we are running a data change effect, return the true // data provider, rather than the ModifiedCollectionView wrapper. /* if (actualCollection) return actualCollection; */ return collection; } /** * @private */ public function set dataProvider(value:Object):void { /* if (collection) { collection.removeEventListener(CollectionEvent.COLLECTION_CHANGE, collectionChangeHandler); } if (value is Array) { collection = new ArrayCollection(value as Array); } else if (value is ICollectionView) { collection = ICollectionView(value); } else if (value is IList) { collection = new ListCollectionView(IList(value)); } else if (value is XMLList) { collection = new XMLListCollection(value as XMLList); } else if (value is XML) { var xl:XMLList = new XMLList(); xl += value; collection = new XMLListCollection(xl); } else { // convert it to an array containing this one item var tmp:Array = []; if (value != null) tmp.push(value); collection = new ArrayCollection(tmp); } // get an iterator for the displaying rows. The CollectionView's // main iterator is left unchanged so folks can use old DataSelector // methods if they want to iterator = collection.createCursor(); collectionIterator = collection.createCursor(); //IViewCursor(collection); // trace("ListBase added change listener"); collection.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionChangeHandler, false, 0, true); clearSelectionData(); var event:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE); event.kind = CollectionEventKind.RESET; collectionChangeHandler(event); dispatchEvent(event); itemsNeedMeasurement = true; invalidateProperties(); invalidateSize(); invalidateDisplayList(); */ } //---------------------------------- // dataTipField //---------------------------------- /** * @private * Storage for the dataTipField property. */ /* private var _dataTipField:String = "label"; [Bindable("dataTipFieldChanged")] [Inspectable(category="Data", defaultValue="label")] */ /** * Name of the field in the data provider items to display as the * data tip. By default, the list looks for a property named * <code>label</code> on each item and displays it. * However, if the data objects do not contain a <code>label</code> * property, you can set the <code>dataTipField</code> property to * use a different property in the data object. An example would be * "FullName" when viewing a * set of people's names retrieved from a database. * * @default null * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get dataTipField():String { return _dataTipField; } */ /** * @private */ /* public function set dataTipField(value:String):void { _dataTipField = value; itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("dataTipFieldChanged")); } */ //---------------------------------- // dataTipFunction //---------------------------------- /** * @private * Storage for the dataTipFunction property. */ private var _dataTipFunction:Function; [Bindable("dataTipFunctionChanged")] [Inspectable(category="Data")] /** * User-supplied function to run on each item to determine its dataTip. * By default, the list looks for a property named <code>label</code> * on each data provider item and displays it. * However, some items do not have a <code>label</code> property * nor do they have another property that can be used for displaying * in the rows. An example is a data set that has lastName and firstName * fields, but you want to display full names. You can supply a * <code>dataTipFunction</code> that finds the appropriate * fields and return a displayable string. The * <code>dataTipFunction</code> is also good for handling formatting * and localization. * * <p>The dataTipFunction takes a single argument which is the item * in the data provider and returns a String:</p> * * <blockquote> * <code>myDataTipFunction(item:Object):String</code> * </blockquote> * * @default null * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get dataTipFunction():Function { return _dataTipFunction; } /** * @private */ public function set dataTipFunction(value:Function):void { _dataTipFunction = value; /* itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("dataTipFunctionChanged")); */ } //---------------------------------- // dragEnabled //---------------------------------- /** * @private * Storage for the dragEnabled property. */ private var _dragEnabled:Boolean = false; /** * A flag that indicates whether you can drag items out of * this control and drop them on other controls. * If <code>true</code>, dragging is enabled for the control. * If the <code>dropEnabled</code> property is also <code>true</code>, * you can drag items and drop them within this control * to reorder the items. * * @default false * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get dragEnabled():Boolean { return _dragEnabled; } /** * @private */ public function set dragEnabled(value:Boolean):void { /* if (_dragEnabled && !value) { removeEventListener(DragEvent.DRAG_START, dragStartHandler, false); removeEventListener(DragEvent.DRAG_COMPLETE, dragCompleteHandler, false); } */ _dragEnabled = value; /* if (value) { addEventListener(DragEvent.DRAG_START, dragStartHandler, false, EventPriority.DEFAULT_HANDLER); addEventListener(DragEvent.DRAG_COMPLETE, dragCompleteHandler, false, EventPriority.DEFAULT_HANDLER); } */ } //---------------------------------- // dragImage //---------------------------------- /** * An instance of a class that displays the visuals * during a drag and drop operation. * * @default mx.controls.listClasses.ListItemDragProxy * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function get dragImage():IUIComponent { var image:ListItemDragProxy = new ListItemDragProxy(); image.owner = this; image.moduleFactory = moduleFactory; return image; } */ //---------------------------------- // dragImageOffsets //---------------------------------- /** * The offset of the drag image for drag and drop. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function get dragImageOffsets():Point { var pt:Point = new Point; var n:int = listItems.length; for (var i:int = lockedRowCount; i < n; i++) { if (selectedData[rowInfo[i].uid]) { pt.x = listItems[i][0].x; pt.y = listItems[i][0].y; } } return pt; } */ //---------------------------------- // dragMoveEnabled //---------------------------------- /** * @private * Storage for the dragMoveEnabled property. */ /* private var _dragMoveEnabled:Boolean = false; [Inspectable(defaultValue="false")] */ /** * A flag that indicates whether items can be moved instead * of just copied from the control as part of a drag-and-drop * operation. * If <code>true</code>, and the <code>dragEnabled</code> property * is <code>true</code>, items can be moved. * Often the data provider cannot or should not have items removed * from it, so a MOVE operation should not be allowed during * drag-and-drop. * * @default false * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get dragMoveEnabled():Boolean { return _dragMoveEnabled; } */ /** * @private */ /* public function set dragMoveEnabled(value:Boolean):void { _dragMoveEnabled = value; } */ //---------------------------------- // dropEnabled //---------------------------------- /** * @private * Storage for the <code>dropEnabled</code> property. */ /* private var _dropEnabled:Boolean = false; [Inspectable(defaultValue="false")] */ /** * A flag that indicates whether dragged items can be dropped onto the * control. * * <p>If you set this property to <code>true</code>, * the control accepts all data formats, and assumes that * the dragged data matches the format of the data in the data provider. * If you want to explicitly check the data format of the data * being dragged, you must handle one or more of the drag events, * such as <code>dragOver</code>, and call the DragEvent's * <code>preventDefault()</code> method to customize * the way the list class accepts dropped data.</p> * * <p>When you set <code>dropEnabled</code> to <code>true</code>, * Flex automatically calls the <code>showDropFeedback()</code> * and <code>hideDropFeedback()</code> methods to display the drop indicator.</p> * * @default false * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get dropEnabled():Boolean { return _dropEnabled; } */ /** * @private */ /* public function set dropEnabled(value:Boolean):void { if (_dropEnabled && !value) { removeEventListener(DragEvent.DRAG_ENTER, dragEnterHandler, false); removeEventListener(DragEvent.DRAG_EXIT, dragExitHandler, false); removeEventListener(DragEvent.DRAG_OVER, dragOverHandler, false); removeEventListener(DragEvent.DRAG_DROP, dragDropHandler, false); } _dropEnabled = value; if (value) { addEventListener(DragEvent.DRAG_ENTER, dragEnterHandler, false, EventPriority.DEFAULT_HANDLER); addEventListener(DragEvent.DRAG_EXIT, dragExitHandler, false, EventPriority.DEFAULT_HANDLER); addEventListener(DragEvent.DRAG_OVER, dragOverHandler, false, EventPriority.DEFAULT_HANDLER); addEventListener(DragEvent.DRAG_DROP, dragDropHandler, false, EventPriority.DEFAULT_HANDLER); } } */ //---------------------------------- // iconField //---------------------------------- /** * @private * Storage for iconField property. */ /* private var _iconField:String = "icon"; [Bindable("iconFieldChanged")] [Inspectable(category="Data", defaultValue="")] */ /** * The name of the field in the data provider object that determines what to * display as the icon. By default, the list class does not try to display * icons with the text in the rows. However, by specifying an icon * field, you can specify a graphic that is created and displayed as an * icon in the row. This property is ignored by DataGrid. * * <p>The renderers will look in the data provider object for a property of * the name supplied as the iconField. If the value of the property is a * Class, it will instantiate that class and expect it to be an instance * of an IFlexDisplayObject. If the value of the property is a String, * it will look to see if a Class exists with that name in the application, * and if it can't find one, it will also look for a property on the * document with that name and expect that property to map to a Class.</p> * * @default null * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get iconField():String { return _iconField; } */ /** * @private */ /* public function set iconField(value:String):void { _iconField = value; itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("iconFieldChanged")); } */ //---------------------------------- // iconFunction //---------------------------------- /** * @private * Storage for iconFunction property. */ /* private var _iconFunction:Function; [Bindable("iconFunctionChanged")] [Inspectable(category="Data")] */ /** * A user-supplied function to run on each item to determine its icon. * By default the list does not try to display icons with the text * in the rows. However, by specifying an icon function, you can specify * a Class for a graphic that will be created and displayed as an icon * in the row. * * <p>The <code>iconFunction</code> takes a single argument which is the item * in the data provider and returns a Class. * Shown below is the signature of the function:</p> * * <pre>iconFunction(item:Object):Class</pre> * * @default null * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get iconFunction():Function { return _iconFunction; } */ /** * @private */ /* public function set iconFunction(value:Function):void { _iconFunction = value; itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("iconFunctionChanged")); } */ //---------------------------------- // itemRenderer //---------------------------------- /** * @private * Storage for the itemRenderer property. */ private var _itemRenderer:IFactory; [Inspectable(category="Data")] /** * The custom item renderer for the control. * You can specify a drop-in, inline, or custom item renderer. * * <p>The default item renderer depends on the component class. * For example, the AdvancedDataGrid class uses * AdvancedDataGridItemRenderer.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get itemRenderer():IFactory { return _itemRenderer; } /** * @private */ public function set itemRenderer(value:IFactory):void { _itemRenderer = value; /* invalidateSize(); invalidateDisplayList(); itemsSizeChanged = true; rendererChanged = true; dispatchEvent(new Event("itemRendererChanged")); */ } //---------------------------------- // labelField //---------------------------------- /** * @private * Storage for labelField property. */ /* private var _labelField:String = "label"; [Bindable("labelFieldChanged")] [Inspectable(category="Data", defaultValue="label")] */ /** * The name of the field in the data provider items to display as the label. * By default the list looks for a property named <code>label</code> * on each item and displays it. * However, if the data objects do not contain a <code>label</code> * property, you can set the <code>labelField</code> property to * use a different property in the data object. An example would be * "FullName" when viewing a set of people names fetched from a database. * * @default "label" * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get labelField():String { return _labelField; } */ /** * @private */ /* public function set labelField(value:String):void { _labelField = value; itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("labelFieldChanged")); } */ public function get verticalAlign():String { return "middle"; } public function set verticalAlign(value:String):void { } //---------------------------------- // labelFunction //---------------------------------- /** * @private * Storage for labelFunction property. */ /* private var _labelFunction:Function; [Bindable("labelFunctionChanged")] [Inspectable(category="Data")] */ /** * A user-supplied function to run on each item to determine its label. * By default, the list looks for a property named <code>label</code> * on each data provider item and displays it. * However, some data sets do not have a <code>label</code> property * nor do they have another property that can be used for displaying. * An example is a data set that has lastName and firstName fields * but you want to display full names. * * <p>You can supply a <code>labelFunction</code> that finds the * appropriate fields and returns a displayable string. The * <code>labelFunction</code> is also good for handling formatting and * localization. </p> * * <p>For most components, the label function takes a single argument * which is the item in the data provider and returns a String.</p> * <pre> * myLabelFunction(item:Object):String</pre> * * <p>The method signature for the data grid classes is:</p> * <pre> * myLabelFunction(item:Object, column:DataGridColumn):String</pre> * * <p>where <code>item</code> contains the DataGrid item object, and * <code>column</code> specifies the DataGrid column.</p> * * @default null * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get labelFunction():Function { return _labelFunction; } */ /** * @private */ /* public function set labelFunction(value:Function):void { _labelFunction = value; itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("labelFunctionChanged")); } */ //---------------------------------- // listData //---------------------------------- /** * @private * Storage for the listData property. */ /* private var _listData:BaseListData; [Bindable("dataChange")] [Inspectable(environment="none")] */ /** * * When a component is used as a drop-in item renderer or drop-in * item editor, Flex initializes the <code>listData</code> property * of the component with the additional data from the list control. * The component can then use the <code>listData</code> property * and the <code>data</code> property to display the appropriate * information as a drop-in item renderer or drop-in item editor. * * <p>You do not set this property in MXML or ActionScript; * Flex sets it when the component is used as a drop-in item renderer * or drop-in item editor.</p> * * @see mx.controls.listClasses.IDropInListItemRenderer * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get listData():BaseListData { return _listData; } */ /** * @private */ /* public function set listData(value:BaseListData):void { _listData = value; } */ //---------------------------------- // lockedColumnCount //---------------------------------- /** * @private * Storage for the lockedColumnCount property. */ /* mx_internal var _lockedColumnCount:int = 0; [Inspectable(defaultValue="0")] */ /** * The index of the first column in the control that scrolls, * where the first column is at an index of 0. * Columns with indexes that are lower than this value remain fixed * in view. This property is not supported by all list classes. * * @default 0 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get lockedColumnCount():int { return _lockedColumnCount; } */ /** * @private */ /* public function set lockedColumnCount(value:int):void { _lockedColumnCount = value; invalidateDisplayList(); } */ //---------------------------------- // lockedRowCount //---------------------------------- /** * @private * Storage for the lockedRowCount property. */ /* mx_internal var _lockedRowCount:int = 0; [Inspectable(defaultValue="0")] */ /** * The index of the first row in the control that scrolls, * where the first row is at an index of 0. * Rows above this one remain fixed in view. * * @default 0 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get lockedRowCount():int { return _lockedRowCount; } */ /** * @private */ /* public function set lockedRowCount(value:int):void { _lockedRowCount = value; invalidateDisplayList(); } */ //---------------------------------- // menuSelectionMode //---------------------------------- /** * A flag that indicates whether menu-style selection * should be used. * In a Menu, dragging from * one renderer into another selects the new one * and un-selects the old. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ //public var menuSelectionMode:Boolean = false; //---------------------------------- // rowCount //---------------------------------- /** * @private * Storage for the rowCount property. */ private var _rowCount:int = -1; /** * Number of rows to be displayed. * If the height of the component has been explicitly set, * this property might not have any effect. * * <p>For a data grid controls, the <code>rowCount</code> property includes the * header row. * So, for a data grid control with 3 body rows and a header row, * the <code>rowCount</code> property is 4.</p> * * @default 4 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get rowCount():int { return _rowCount; } /** * @private */ public function set rowCount(value:int):void { /* explicitRowCount = value; if (_rowCount != value) { setRowCount(value); rowCountChanged = true; invalidateProperties(); invalidateSize(); itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("rowCountChanged")); } */ } //---------------------------------- // rowHeight //---------------------------------- /** * @private * Storage for the rowHeight property. */ private var _rowHeight:Number; /** * @private */ /* private var rowHeightChanged:Boolean = false; [Inspectable(category="General")] */ /** * The height of the rows in pixels. * Unless the <code>variableRowHeight</code> property is * <code>true</code>, all rows are the same height. * If not specified, the row height is based on * the font size and other properties of the renderer. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get rowHeight():Number { return _rowHeight; } /** * @private */ public function set rowHeight(value:Number):void { /* explicitRowHeight = value; if (_rowHeight != value) { setRowHeight(value); invalidateSize(); itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("rowHeightChanged")); }*/ } //---------------------------------- // selectable //---------------------------------- /** * @private * Storage for the selectable property. */ /* private var _selectable:Boolean = true; [Inspectable(defaultValue="true")] */ /** * A flag that indicates whether the list shows selected items * as selected. * If <code>true</code>, the control supports selection. * * @default true * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get selectable():Boolean { return _selectable; } */ /** * @private */ /* public function set selectable(value:Boolean):void { _selectable = value; } */ //---------------------------------- // selectedIndex //---------------------------------- /** * @private * Storage for the selectedIndex property. */ mx_internal var _selectedIndex:int = -1; [Bindable("change")] [Bindable("valueCommit")] [Inspectable(category="General", defaultValue="-1")] /** * The index in the data provider of the selected item. * * <p>The default value is -1 (no selected item).</p> * * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get selectedIndex():int { return _selectedIndex; } /** * @private */ public function set selectedIndex(value:int):void { /* if (!collection || collection.length == 0) { */ _selectedIndex = value; //bSelectionChanged = true; //bSelectedIndexChanged = true; //invalidateDisplayList(); return; /* } */ // commitSelectedIndex(value); } //---------------------------------- // selectedIndices //---------------------------------- private var _selectedIndices:Array; [Bindable("change")] [Bindable("valueCommit")] [Inspectable(category="General")] /** * An array of indices in the data provider of the selected items. The * items are in the reverse order that the user selected the items. * * @default [ ] * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get selectedIndices():Array { //if (bSelectedIndicesChanged) return _selectedIndices; // return copySelectedItems(false); } /** * @private */ public function set selectedIndices(indices:Array):void { // trace("queueing indices"); /* if (!collection || collection.length == 0) { _selectedIndices = indices; bSelectedIndicesChanged = true; bSelectionChanged = true; invalidateDisplayList(); return; } commitSelectedIndices(indices); */ } //---------------------------------- // selectedItem //---------------------------------- /** * @private * Storage for the selectedItem property. */ mx_internal var _selectedItem:Object; [Bindable("change")] [Bindable("valueCommit")] [Inspectable(category="General", defaultValue="null")] /** * A reference to the selected item in the data provider. * * @default null * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get selectedItem():Object { return _selectedItem; } /** * @private */ public function set selectedItem(data:Object):void { /* if (!collection || collection.length == 0) { */ _selectedItem = data; //bSelectedItemsChanged = true; // bSelectedItemChanged = true; //bSelectionChanged = true; //invalidateDisplayList(); return; /* } */ //commitSelectedItem(data); } //---------------------------------- // selectedItems //---------------------------------- private var _selectedItems:Array; [Bindable("change")] [Bindable("valueCommit")] [Inspectable(category="General")] /** * An Array of references to the selected items in the data provider. The * items are in the reverse order that the user selected the items. * @default [ ] * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get selectedItems():Array { return _selectedItems; //return bSelectedItemsChanged && _selectedItems ? _selectedItems : copySelectedItems(); } /** * @private */ public function set selectedItems(items:Array):void { /* if (!collection || collection.length == 0) { */ _selectedItems = items; // bSelectedItemsChanged = true; // bSelectionChanged = true; // invalidateDisplayList(); return; /* } */ //commitSelectedItems(items); } //---------------------------------- // showDataTips //---------------------------------- /** * @private * Storage for the showDataTips property. */ /* private var _showDataTips:Boolean = false; [Bindable("showDataTipsChanged")] [Inspectable(category="Data", defaultValue="false")] */ /** * A flag that indicates whether dataTips are displayed for text in the rows. * If <code>true</code>, dataTips are displayed. DataTips * are tooltips designed to show the text that is too long for the row. * If you set a dataTipFunction, dataTips are shown regardless of whether the * text is too long for the row. * * @default false * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get showDataTips():Boolean { return _showDataTips; } */ /** * @private */ /* public function set showDataTips(value:Boolean):void { _showDataTips = value; itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("showDataTipsChanged")); } */ //---------------------------------- // value //---------------------------------- /* [Bindable("change")] [Bindable("valueCommit")] */ /** * The selected item, or the data or label field of the selected item. * If the selected item is a Number or String * the value is the item. If the item is an object, the value is * the data property if it exists, or the label property if it exists. * * <p>Note: Using <code>selectedItem</code> is often preferable. This * property exists for backward compatibility with older applications</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function get value():Object { var item:Object = selectedItem; if (!item) return null; if (typeof(item) != "object") return item; return item.data != null ? item.data : item.label; } */ //---------------------------------- // variableRowHeight //---------------------------------- /** * @private * Storage for the variableRowHeight property. */ private var _variableRowHeight:Boolean = false; [Inspectable(category="General")] /** * A flag that indicates whether the individual rows can have different * height. This property is ignored by TileList and HorizontalList. * If <code>true</code>, individual rows can have different height values. * * @default false * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get variableRowHeight():Boolean { return _variableRowHeight; } /** * @private */ public function set variableRowHeight(value:Boolean):void { _variableRowHeight = value; /* itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("variableRowHeightChanged")); */ } //---------------------------------- // wordWrap //---------------------------------- /** * @private * Storage for the wordWrap property. */ private var _wordWrap:Boolean = false; [Inspectable(category="General")] /** * A flag that indicates whether text in the row should be word wrapped. * If <code>true</code>, enables word wrapping for text in the rows. * Only takes effect if <code>variableRowHeight</code> is also * <code>true</code> * * @default false * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function get wordWrap():Boolean { return _wordWrap; } /** * @private */ public function set wordWrap(value:Boolean):void { /* if (value == _wordWrap) return; */ _wordWrap = value; /* wordWrapChanged = true; itemsSizeChanged = true; invalidateDisplayList(); dispatchEvent(new Event("wordWrapChanged")); */ } //-------------------------------------------------------------------------- // // Overridden methods: UIComponent // //-------------------------------------------------------------------------- /** * @private */ /* override protected function initializeAccessibility():void { //if (AdvancedListBase.createAccessibilityImplementation != null) //AdvancedListBase.createAccessibilityImplementation(this); } */ /** * Create objects that are children of this ListBase, in this case * the <code>listContent</code> object that will hold all the item * renderers. * Note that the item renderers are not created immediately, but later * when Flex calls the <code>updateDisplayList()</code> method. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* override protected function createChildren():void { super.createChildren(); if (!listContent) { listContent = new AdvancedListBaseContentHolder(this); listContent.styleName = this; addChild(listContent); } // This invisible layer, which is a child of listContent // catches mouse events for all items // and is where we put selection highlighting by default. if (!selectionLayer) { selectionLayer = new FlexSprite(); selectionLayer.name = "selectionLayer"; selectionLayer.mouseEnabled = false; listContent.addChild(selectionLayer); // trace("selectionLayer parent set to " + selectionLayer.parent); var g:Graphics = selectionLayer.graphics; g.beginFill(0, 0); // 0 alpha means transparent g.drawRect(0, 0, 10, 10); g.endFill(); } } */ /** * Calculates the column width and row height and number of rows and * columns based on whether properties like <code>columnCount</code> * <code>columnWidth</code>, <code>rowHeight</code> and * <code>rowCount</code> were explicitly set. * * @see mx.core.ScrollControlBase * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* override protected function commitProperties():void { super.commitProperties(); if (cachedPaddingTopInvalid) { cachedPaddingTopInvalid = false; cachedPaddingTop = getStyle("paddingTop"); itemsSizeChanged = true; invalidateDisplayList(); } if (cachedPaddingBottomInvalid) { cachedPaddingBottomInvalid = false; cachedPaddingBottom = getStyle("paddingBottom"); itemsSizeChanged = true; invalidateDisplayList(); } if (cachedVerticalAlignInvalid) { cachedVerticalAlignInvalid = false; cachedVerticalAlign = getStyle("verticalAlign"); itemsSizeChanged = true; invalidateDisplayList(); } if (columnCountChanged) { if (_columnCount < 1) _columnCount = defaultColumnCount; if (!isNaN(explicitWidth) && isNaN(explicitColumnWidth) && explicitColumnCount > 0) setColumnWidth((explicitWidth - viewMetrics.left - viewMetrics.right) / columnCount); columnCountChanged = false; } if (rowCountChanged) { if (_rowCount < 1) _rowCount = defaultRowCount; if (!isNaN(explicitHeight) && isNaN(explicitRowHeight) && explicitRowCount > 0) setRowHeight((explicitHeight - viewMetrics.top - viewMetrics.bottom) / rowCount); rowCountChanged = false; } } */ /** * Calculates the measured width and height of the component based * on the <code>rowCount</code>, * <code>columnCount</code>, <code>rowHeight</code> and * <code>columnWidth</code> properties. * * @see mx.core.ScrollControlBase * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* override protected function measure():void { super.measure(); var o:EdgeMetrics = viewMetrics; var cc:int = explicitColumnCount < 1 ? defaultColumnCount : explicitColumnCount; var rc:int = explicitRowCount < 1 ? defaultRowCount : explicitRowCount; if (!isNaN(explicitRowHeight)) { measuredHeight = explicitRowHeight * rc + o.top + o.bottom; measuredMinHeight = explicitRowHeight * Math.min(rc, 2) + o.top + o.bottom; } else { measuredHeight = rowHeight * rc + o.top + o.bottom; measuredMinHeight = rowHeight * Math.min(rc, 2) + o.top + o.bottom; } if (!isNaN(explicitColumnWidth)) { measuredWidth = explicitColumnWidth * cc + o.left + o.right; measuredMinWidth = explicitColumnWidth * Math.min(cc, 1) + o.left + o.right; } else { measuredWidth = columnWidth * cc + o.left + o.right; measuredMinWidth = columnWidth * Math.min(cc, 1) + o.left + o.right; } // Factor out scrollbars if policy == AUTO. See Container.viewMetrics. if (verticalScrollPolicy == ScrollPolicy.AUTO && verticalScrollBar && verticalScrollBar.visible) { measuredWidth -= verticalScrollBar.minWidth; measuredMinWidth -= verticalScrollBar.minWidth; } if (horizontalScrollPolicy == ScrollPolicy.AUTO && horizontalScrollBar && horizontalScrollBar.visible) { measuredHeight -= horizontalScrollBar.minHeight; measuredMinHeight -= horizontalScrollBar.minHeight; } } */ /** * @private * This is a copy of the code in UIComponent, modified to * start a data change effect if appropriate. */ /* override public function validateDisplayList():void { // this code is nearly duplicating UIComponent.validateDisplayList(); oldLayoutDirection = layoutDirection; if (invalidateDisplayListFlag) { // Check if our parent is the top level system manager var sm:ISystemManager = parent as ISystemManager; if (sm) { if (sm == systemManager.topLevelSystemManager && sm.document != this) { // Size ourself to the new measured width/height setActualSize(getExplicitOrMeasuredWidth(), getExplicitOrMeasuredHeight()); } } // Don't validate transform.matrix until after setting actual size validateMatrix(); if (runDataEffectNextUpdate) { runDataEffectNextUpdate = false; runningDataEffect = true; initiateDataChangeEffect(unscaledWidth, unscaledHeight); } else { updateDisplayList(unscaledWidth, unscaledHeight); } invalidateDisplayListFlag = false; } else { validateMatrix(); } } */ /** * Adds or removes item renderers if the number of displayable items * changed. * Refreshes the item renderers if they might have changed. * Applies the selection if it was changed programmatically. * * @param unscaledWidth Specifies the width of the component, in pixels, * in the component's coordinates, regardless of the value of the * <code>scaleX</code> property of the component. * * @param unscaledHeight Specifies the height of the component, in pixels, * in the component's coordinates, regardless of the value of the * <code>scaleY</code> property of the component. * * @see mx.core.ScrollControlBase * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { if (oldUnscaledWidth == unscaledWidth && oldUnscaledHeight == unscaledHeight && !itemsSizeChanged && !bSelectionChanged && !scrollAreaChanged) { return; } if (oldUnscaledWidth != unscaledWidth) itemsSizeChanged = true; super.updateDisplayList(unscaledWidth, unscaledHeight); var cursorPos:CursorBookmark; adjustListContent(unscaledWidth,unscaledHeight); var collectionHasItems:Boolean = (collection && collection.length > 0); if (collectionHasItems) adjustScrollPosition(); // Remove the clip mask that was applied to items in the last row. removeClipMask(); // have to resize selection layer without scaling so refill it var g:Graphics = selectionLayer.graphics; g.clear(); if (listContent.width > 0 && listContent.height > 0) { g.beginFill(0x808080, 0); g.drawRect(0, 0, listContent.width, listContent.height); g.endFill(); } if (rendererChanged) purgeItemRenderers(); else if (dataEffectCompleted) partialPurgeItemRenderers(); // optimize layout if only height is changing if (oldUnscaledWidth == unscaledWidth && !scrollAreaChanged && !itemsSizeChanged && listItems.length > 0 && iterator && columnCount == 1) { var rowIndex:int = listItems.length - 1; if (oldUnscaledHeight > unscaledHeight) // shrinking, so just toss extra rows reduceRows(rowIndex); else makeAdditionalRows(rowIndex); } else // redo all layout { if (iterator) cursorPos = iterator.bookmark; clearIndicators(); // visibleData = {}; if (iterator) { if (offscreenExtraColumns) makeRowsAndColumnsWithExtraColumns(unscaledWidth, unscaledHeight); else makeRowsAndColumnsWithExtraRows(unscaledWidth, unscaledHeight); } else { makeRowsAndColumns(0, 0, listContent.width, listContent.height, 0, 0); } // restore iterator to original position seekPositionIgnoreError(iterator,cursorPos); } oldUnscaledWidth = unscaledWidth; oldUnscaledHeight = unscaledHeight; configureScrollBars(); // if needed, add a clip mask to the items in the last row addClipMask(true); itemsSizeChanged = false; wordWrapChanged = false; adjustSelectionSettings(collectionHasItems); if (keySelectionPending && iteratorValid) { keySelectionPending = false; finishKeySelection(); } } */ /** * @private */ /* override public function styleChanged(styleProp:String):void { if (IS_ITEM_STYLE[styleProp]) { itemsSizeChanged = true; invalidateDisplayList(); } else if (styleProp == "paddingTop") { cachedPaddingTopInvalid = true; invalidateProperties(); } else if (styleProp == "paddingBottom") { cachedPaddingBottomInvalid = true; invalidateProperties(); } else if (styleProp == "verticalAlign") { cachedVerticalAlignInvalid = true; invalidateProperties(); } else if (styleProp == "dataChangeEffect") { cachedDataChangeEffect = null; } else if (listItems) { var n:int = listItems.length; for (var i:int = 0; i < n; i++) { var m:int = listItems[i].length; for (var j:int = 0; j < m; j++) { if (listItems[i][j]) listItems[i][j].styleChanged(styleProp); } } } super.styleChanged(styleProp); if (invalidateSizeFlag) { itemsNeedMeasurement = true; invalidateProperties(); } if (styleManager.isSizeInvalidatingStyle(styleProp)) scrollAreaChanged = true; } */ //-------------------------------------------------------------------------- // // Methods: Measuring // //-------------------------------------------------------------------------- /** * Measures a set of items from the data provider using * the current item renderer and returns the * maximum width found. This method is used to calculate the * width of the component. The various ListBase-derived classes * have slightly different implementations. DataGrid measures * its columns instead of data provider items, and TileList * just measures the first item and assumes all items are the * same size. * * <p>This method is not implemented in the AdvancedListBase class * and must be implemented in the child class.</p> * * <p>A negative <code>index</code> value can be used to specify * that the width calculation includes any headers.</p> * * @param index The data provider item at which to start measuring * the width. * * @param count The number of items to measure in calculating the width. * * @return The widest of the measured items. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function measureWidthOfItems(index:int = -1, count:int = 0):Number { return NaN; } */ /** * Measures a set of items from the data provider using the * current item renderer and returns the sum of the heights * of those items. * * <p>This method is not implemented in the AdvancedListBase class * and must be implemented in the child class.</p> * * <p>A negative <code>index</code> value can be used to specify * that the height calculation includes any headers.</p> * * @param index The data provider item at which to start calculating * the height. * * @param count The number of items to use in calculating the height. * * @return The sum of the height of the measured items. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function measureHeightOfItems(index:int = -1, count:int = 0):Number { return NaN; } */ //-------------------------------------------------------------------------- // // Methods: Item fields // //-------------------------------------------------------------------------- /** * Returns the string the renderer would display for the given data object * based on the labelField and labelFunction properties. * If the method cannot convert the parameter to a string, it returns a * single space. * * @param data Object to be rendered. * * @return The string to be displayed based on the data. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function itemToLabel(data:Object):String { if (data == null) return " "; if (labelFunction != null) return labelFunction(data); if (data is XML) { try { if (data[labelField].length() != 0) data = data[labelField]; //by popular demand, this is a default XML labelField //else if (data.@label.length() != 0) // data = data.@label; } catch (e:Error) { } } else if (data is Object) { try { if (data[labelField] != null) data = data[labelField]; } catch(e:Error) { } } if (data is String) return String(data); try { return data.toString(); } catch(e:Error) { } return " "; } */ /** * Returns the dataTip string the renderer would display for the given * data object based on the dataTipField and dataTipFunction properties. * If the method cannot convert the parameter to a string, it returns a * single space. * <p>For use by developers creating subclasses of ListBase or its children. * Not used by application developers.</p> * * @param data Object to be rendered. * * @return String displayable string based on the data. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function itemToDataTip(data:Object):String { if (dataTipFunction != null) return dataTipFunction(data); if (typeof(data) == "object") { try { if (data[dataTipField] != null) data = data[dataTipField]; else if (data.label != null) data = data.label; } catch(e:Error) { } } if (typeof(data) == "string") return String(data); try { return data.toString(); } catch(e:Error) { } return " "; } */ /** * Returns the class for an icon, if any, for a data item, * based on the iconField and iconFunction properties. * The field in the item can return a string as long as that * string represents the name of a class in the application. * The field in the item can also be a string that is the name * of a variable in the document that holds the class for * the icon. * * @param data The item from which to extract the icon class. * * @return The icon for the item, as a class reference or * <code>null</code> if none. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function itemToIcon(data:Object):Class { if (data == null) return null; if (iconFunction != null) return iconFunction(data); var iconClass:Class; var icon:*; if (data is XML) { try { if (data[iconField].length() != 0) { icon = String(data[iconField]); if (icon != null) { iconClass = Class(systemManager.getDefinitionByName(icon)); if (iconClass) return iconClass; return document[icon]; } } } catch(e:Error) { } } else if (data is Object) { try { if (data[iconField] != null) { if (data[iconField] is Class) return data[iconField]; if (data[iconField] is String) { iconClass = Class(systemManager.getDefinitionByName( data[iconField])); if (iconClass) return iconClass; return document[data[iconField]]; } } } catch(e:Error) { } } return null; } */ //-------------------------------------------------------------------------- // // Methods: Renderer management // //-------------------------------------------------------------------------- /** * @private * Make enough rows and columns to fill the area * described by left, top, right, bottom. * Renderers are created and inserted into the <code>listItems</code> * array starting at <code>(firstColumn, firstRow)(</code> * and moving downwards. * * <p>If <code>byCount</code> and <code>rowsNeeded</code> are specified, * then just make that many rows and ignore the <code>bottom</code> * and <code>right</code> parameters.</p> * * @param left Horizontal pixel offset of area to fill. * * @param top Vertical pixel offset of area to fill. * * @param right Horizontal pixel offset of area to fill * (from left side of component). * * @param bottom Vertical pixel offset of area to fill * (from top of component). * * @param firstColumn Offset into <code>listItems</code> to store * the first renderer to be created. * * @param firstRow Offset into <code>listItems</code> to store * the first renderer to be created. * * @param byCount If true, make <code>rowsNeeded</code> number of rows * and ignore <code>bottom</code> parameter * * @param rowsNeeded Number of rows to create if <code>byCount</code> * is true; * * @return A Point containing the number of rows and columns created. */ /* protected function makeRowsAndColumns(left:Number, top:Number, right:Number, bottom:Number, firstColumn:int, firstRow:int, byCount:Boolean = false, rowsNeeded:uint = 0):Point { return new Point(0,0); } private function makeRowsAndColumnsWithExtraRows(unscaledWidth:Number,unscaledHeight:Number):void { var pt:Point; var desiredExtraRowsTop:int = offscreenExtraRows / 2; var desiredExtraRowsBottom:int = offscreenExtraRows / 2; offscreenExtraRowsTop = Math.min(desiredExtraRowsTop, verticalScrollPosition); var index:int = scrollPositionToIndex(horizontalScrollPosition, verticalScrollPosition - offscreenExtraRowsTop); seekPositionSafely(index); var cursorPos:CursorBookmark = iterator.bookmark; // if necessary, make the rows that will eventually be offscreen, above visible rows if (offscreenExtraRowsTop > 0) makeRowsAndColumns(0, 0, listContent.width, listContent.height, 0, 0,true,offscreenExtraRowsTop); var curY:Number = offscreenExtraRowsTop > 0 ? rowInfo[offscreenExtraRowsTop-1].y + rowHeight : 0; // make onscreen items pt = makeRowsAndColumns(0, curY, listContent.width, curY + listContent.heightExcludingOffsets, 0, offscreenExtraRowsTop); // if necessary, and possible, make offscreen rows below visible rows. if (desiredExtraRowsBottom > 0 && !iterator.afterLast) { // watch out for boundary condition if (offscreenExtraRowsTop + pt.y - 1 < 0) curY = 0; else curY = rowInfo[offscreenExtraRowsTop + pt.y - 1].y + rowInfo[offscreenExtraRowsTop + pt.y - 1].height; var currentRows:int = listItems.length; // pt = makeRowsAndColumns(0,curY,listContent.width,curY,0,offscreenExtraRowsTop + pt.y,true,desiredExtraRowsBottom); if (pt.y < desiredExtraRowsBottom) { var extraEmptyRows:int = listItems.length - (currentRows + pt.y); if (extraEmptyRows) for (var i:int = 0; i < extraEmptyRows; i++) { listItems.pop(); rowInfo.pop(); } } offscreenExtraRowsBottom = pt.y; } // adjust the ListContent offsets so that the first visible row is exactly at the top of the screen, etc. var oldContentHeight:Number = listContent.heightExcludingOffsets; listContent.topOffset = -offscreenExtraRowsTop * rowHeight; listContent.bottomOffset = (offscreenExtraRowsBottom > 0) ? listItems[listItems.length-1][0].y + rowHeight - oldContentHeight + listContent.topOffset : 0; if (iteratorValid) iterator.seek(cursorPos, 0); // make sure list content is moved to the appropriate place. // might be able to optimize and not do this every time adjustListContent(unscaledWidth,unscaledHeight); } private function makeRowsAndColumnsWithExtraColumns(unscaledWidth:Number,unscaledHeight:Number):void { // NOTE: this function only works correctly for fixed column width //if we scrolled more than the number of scrollable rows var desiredOffscreenColumnsLeft:int = offscreenExtraColumns / 2; var desiredOffscreenColumnsRight:int = offscreenExtraColumns / 2; offscreenExtraColumnsLeft = Math.min(desiredOffscreenColumnsLeft,horizontalScrollPosition); var index:int = scrollPositionToIndex(horizontalScrollPosition - offscreenExtraColumnsLeft, verticalScrollPosition); seekPositionSafely(index); var cursorPos:CursorBookmark = iterator.bookmark; // if we are maintaining an extra column buffer, make extra columns if (offscreenExtraColumnsLeft > 0) makeRowsAndColumns(0,0,0,listContent.height,0,0,true,offscreenExtraColumnsLeft); var curX:Number = offscreenExtraColumnsLeft ? listItems[0][offscreenExtraColumnsLeft-1].x + columnWidth : 0; var pt:Point = makeRowsAndColumns(curX, 0, curX + listContent.widthExcludingOffsets, listContent.height, offscreenExtraColumnsLeft, 0); if (desiredOffscreenColumnsRight > 0 && !iterator.afterLast) { if (offscreenExtraColumnsLeft + pt.x - 1 < 0) curX = 0; else curX = listItems[0][offscreenExtraColumnsLeft + pt.x - 1].x + columnWidth; var currentColumns:int = listItems[0].length; pt = makeRowsAndColumns(curX,0,curX,listContent.height,offscreenExtraColumnsLeft+pt.x,0,true,desiredOffscreenColumnsRight); if (pt.x < desiredOffscreenColumnsRight) { var extraEmptyColumns:int = listItems[0].length - (currentColumns + pt.x); if (extraEmptyColumns) { for (var i:int = 0; i < listItems.length; i++) for (var j:int = 0; j < extraEmptyColumns; j++) listItems[i].pop(); } } offscreenExtraColumnsRight = pt.x; // I *think* this is always true } var oldContentWidth:Number = listContent.widthExcludingOffsets; listContent.leftOffset = -offscreenExtraColumnsLeft * columnWidth; listContent.rightOffset = (offscreenExtraColumnsRight > 0) ? listItems[0][listItems[0].length-1].x + columnWidth - oldContentWidth + listContent.leftOffset : 0; iterator.seek(cursorPos, 0); adjustListContent(unscaledWidth, unscaledHeight); } */ /** * Computes the offset into the data provider of the item * at colIndex, rowIndex. * The 9th row 3rd column in a TileList could be different items * in the data provider based on the direction the tiles are laid * out and the number of rows and columns in the TileList. * * @param rowIndex The 0-based index of the row, including rows * scrolled off the top. Thus, if <code>verticalScrollPosition</code> * is 2 then the first visible row has a rowIndex of 2. * * @param colIndex The 0-based index of the column, including * columns scrolled off the left. If * <code>horizontalScrollPosition</code> is 2 then the first column * on the left has a columnIndex of 2. * * @return The offset into the data provider. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function indicesToIndex(rowIndex:int, colIndex:int):int { return rowIndex * columnCount + colIndex; } */ /** * The row for the data provider item at the given index. * * @param index The offset into the data provider. * * @return The row the item would be displayed at in the component. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function indexToRow(index:int):int { return index; } */ /** * The column for the data provider item at the given index. * * @param index The offset into the data provider. * * @return The column the item would be displayed at in the component. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function indexToColumn(index:int):int { return 0; } */ /** * @private * Used by accessibility. */ /* mx_internal function indicesToItemRenderer(row:int, col:int):IListItemRenderer { return listItems[row][col]; } */ /** * Returns a Point instance containing the column index and row index of an * item renderer. Since item renderers are only created for items * within the set of viewable rows * you cannot use this method to get the indices for items * that are not visible. Also note that item renderers * are recycled so the indices you get for an item may change * if that item renderer is reused to display a different item. * Usually, this method is called during mouse and keyboard handling * when the set of data displayed by the item renderers hasn't yet * changed. * * @param item An item renderer. * * @return A Point instance. The <code>x</code> property contains the column index * and the <code>y</code> property contains the row index. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function itemRendererToIndices(item:IListItemRenderer):Point { if (!item || !(item.name in rowMap)) return null; var index:int = rowMap[item.name].rowIndex; var len:int = listItems[index].length; for (var i:int = 0; i < len; i++) { if (listItems[index][i] == item) break; } return new Point(i < lockedColumnCount ? i : i + horizontalScrollPosition, index < lockedRowCount ? index : index + verticalScrollPosition + offscreenExtraRowsTop); } */ /** * Get an item renderer for the index of an item in the data provider, * if one exists. Since item renderers only exist for items * within the set of viewable rows * items, you cannot use this method for items that are not visible. * * @param index The offset into the data provider for an item. * * @return The item renderer that is displaying the item, or * <code>null</code> if the item is not currently displayed. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function indexToItemRenderer(index:int):IListItemRenderer { var firstItemIndex:int = verticalScrollPosition - offscreenExtraRowsTop; if (index < firstItemIndex || index >= firstItemIndex + listItems.length) { return null; } return listItems[index - firstItemIndex][0]; } */ /** * Returns the index of the item in the data provider of the item * being rendered by this item renderer. Since item renderers * only exist for items that are within the set of viewable * rows, you cannot * use this method for items that are not visible. * * @param itemRenderer The item renderer that is displaying the * item for which you want to know the data provider index. * * @return The index of the item in the data provider. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function itemRendererToIndex(itemRenderer:IListItemRenderer):int { if (itemRenderer.name in rowMap) { var index:int = rowMap[itemRenderer.name].rowIndex; return index < lockedRowCount ? index : // not clear why the commented out logic isn't correct... // maybe rowIndex isn't being set correctly? // index + verticalScrollPosition + offscreenExtraRowsTop; index + verticalScrollPosition; } else { return int.MIN_VALUE; } } */ /** * Determines the UID for a data provider item. All items * in a data provider must either have a unique ID (UID) * or one will be generated and associated with it. This * means that you cannot have an object or scalar value * appear twice in a data provider. * * <p>For example, the following * data provider is not supported because the value "foo" * appears twice and the UID for a string is the string itself:</p> * * <pre> * var sampleDP:Array = ["foo", "bar", "foo"] * </pre> * * <p>Simple dynamic objects can appear twice if they are two * separate instances. The following is supported because * each of the instances will be given a different UID because * they are different objects:</p> * * <pre> * var sampleDP:Array = [{label: "foo"}, {label: "foo"}] * </pre> * * <p>Note that the following is not supported because the same instance * appears twice:</p> * * <pre> * var foo:Object = {label: "foo"}; * sampleDP:Array = [foo, foo]; * </pre> * * @param data The data provider item. * * @return The UID as a string. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function itemToUID(data:Object):String { if (data == null) return "null"; return UIDUtil.getUID(data); } */ /** * Returns the item renderer for a given item in the data provider, * if there is one. Since item renderers only exist for items * that are within the set of viewable rows, this method * returns <code>null</code> if the item is not visible. * For a data grid, this returns the first column's renderer. * * @param item The data provider item. * * @return The item renderer or <code>null</code> if the item is not * currently displayed. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function itemToItemRenderer(item:Object):IListItemRenderer { return visibleData[itemToUID(item)]; } */ /** * Determines if an item is being displayed by a renderer. * * @param item A data provider item. * @return <code>true</code> if the item is being displayed. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function isItemVisible(item:Object):Boolean { return itemToItemRenderer(item) != null; } */ /** * Determines which item renderer is under the mouse. Item * renderers can be made of multiple mouse targets, or have * visible areas that are not mouse targets. This method * checks both targets and position to determine which * item renderer the mouse is over from the user's perspective, * which can differ from the information provided by the * mouse event. * * @param event A MouseEvent that contains the position of * the mouse and the object it is over. * * @return The item renderer the mouse is over or * <code>null</code> if none. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function mouseEventToItemRenderer( event:MouseEvent):IListItemRenderer { return mouseEventToItemRendererOrEditor(event); } */ /** * @private */ /* mx_internal function mouseEventToItemRendererOrEditor( event:MouseEvent):IListItemRenderer { var target:DisplayObject = DisplayObject(event.target); if (target == listContent) { var pt:Point = new Point(event.stageX, event.stageY); pt = listContent.globalToLocal(pt); var yy:Number = 0; var n:int = listItems.length; for (var i:int = 0; i < n; i++) { if (listItems[i].length) { if (pt.y < yy + rowInfo[i].height) { var m:int = listItems[i].length; if (m == 1) return listItems[i][0]; var j:int = Math.floor(pt.x / columnWidth); return listItems[i][j]; } } yy += rowInfo[i].height; } } else if (target == highlightIndicator) { return lastHighlightItemRenderer; } while (target && target != this) { if (target is IListItemRenderer && target.parent == listContent) { if (target.visible) return IListItemRenderer(target); break; } if (target is IUIComponent) target = IUIComponent(target).owner; else target = target.parent; } return null; } */ /** * @private * Helper function for addClipMask(). * Returns true if all of the IListItemRenderers are UITextFields. */ /* private function hasOnlyTextRenderers():Boolean { if (listItems.length == 0) return true; var rowItems:Array = listItems[listItems.length - 1]; var n:int = rowItems.length; for (var i:int = 0; i < n; i++) { if (!(rowItems[i] is IUITextField)) return false; } return true; } */ /** * Determines whether a renderer contains (or owns) a display object. * Ownership means that the display object isn't actually parented * by the renderer but is associated with it in some way. Popups * should be owned by the renderers so that activity in the popup * is associated with the renderer and not seen as activity in another * component. * * @param renderer The renderer that might contain or own the * display object. * * @param object The display object that might be associated with the * renderer. * * @return <code>true</code> if the display object is contained * or owned by the renderer. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function itemRendererContains(renderer:IListItemRenderer, object:DisplayObject):Boolean { if (!object) return false; if (!renderer) return false; return renderer.owns(object); } */ /** * Adds a renderer to the recycled renderer list, * making it invisible and cleaning up references to it. * If a data effect is running, the renderer is reserved for * future use for that data. Otherwise it is added to the * general freeItemRenderers stack. * * @param item The IListItemRenderer to add. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function addToFreeItemRenderers(item:IListItemRenderer):void { // trace("addToFreeItemRenderers ", item); DisplayObject(item).visible = false; var oldWrapper:ItemWrapper = dataItemWrappersByRenderer[item]; // Before deleting from visibleData, make sure it is referring to this // renderer. (If not, we rendered the data elsewhere). var UID:String = oldWrapper ? itemToUID(oldWrapper) : itemToUID(item.data); if (visibleData[UID] == item) delete visibleData[UID]; // If a data effect is running, reserve any renderer that isn't // being used, since it may be used again momentarily. if (oldWrapper) reservedItemRenderers[itemToUID(oldWrapper)] = item; else freeItemRenderers.push(item); delete rowMap[item.name]; } */ /** * Retrieves an already-created item renderer not currently in use. * If a data effect is running, it first tries to retrieve from the * reservedItemRenderers map. Otherwise (or if no reserved renderer * is found) it retrieves from the freeItemRenderers stack. * * @param data The data to be presented by the item renderer. * * @return An already-created item renderer not currently in use. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function getReservedOrFreeItemRenderer(data:Object):IListItemRenderer { var item:IListItemRenderer; var uid:String; if (runningDataEffect) item = IListItemRenderer(reservedItemRenderers[uid = itemToUID(data)]); if (item) delete reservedItemRenderers[uid]; else if (freeItemRenderers.length) item = freeItemRenderers.pop(); return item; } */ /** * diagnostics * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* mx_internal function get rendererArray():Array { return listItems; } mx_internal var lastDragEvent:DragEvent; */ //-------------------------------------------------------------------------- // // Methods: Drawing // //-------------------------------------------------------------------------- /** * Draws any alternating row colors, borders and backgrounds for the rows. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function drawRowBackgrounds():void { } */ /** * Draws the renderer with indicators * that it is highlighted, selected, or the caret. * * @param item The renderer. * @param selected <code>true</code> if the renderer should be drawn in * its selected state. * @param highlighted <code>true</code> if the renderer should be drawn in * its highlighted state. * @param caret <code>true</code> if the renderer should be drawn as if * it is the selection caret. * @param transition <code>true</code> if the selection state should fade in * via an effect. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ // protected function drawItem(item:IListItemRenderer, // selected:Boolean = false, // highlighted:Boolean = false, // caret:Boolean = false, // transition:Boolean = false):void // { // var o:Sprite; // var g:Graphics; // if (!item) // return; // var rowData:BaseListData = rowMap[item.name]; //this can happen due to race conditions when using data effects // if (!rowData) // return; //trace("drawitem " + rowData.uid + " " + selected + " " + highlighted + " " + caret); // if (highlighted && // (!highlightItemRenderer || highlightUID != rowData.uid)) // { // if (!highlightIndicator) // { // o = new SpriteAsset(); // selectionLayer.addChild(DisplayObject(o)); // highlightIndicator = o; // } // else // { // selectionLayer.setChildIndex(DisplayObject(highlightIndicator), // selectionLayer.numChildren - 1); // } // o = highlightIndicator; //Let the highlightIndicator inherit the layoutDirection // if (o is ILayoutDirectionElement) // ILayoutDirectionElement(o).layoutDirection = null; // drawHighlightIndicator( // o, item.x, rowInfo[rowData.rowIndex].y, // item.width, rowInfo[rowData.rowIndex].height, // getStyle("rollOverColor"), item); // lastHighlightItemRenderer = highlightItemRenderer = item; // highlightUID = rowData.uid; // } // else if (!highlighted && highlightItemRenderer && (rowData && highlightUID == rowData.uid) ) // { // if (highlightIndicator) // Sprite(highlightIndicator).graphics.clear(); // highlightItemRenderer = null; // highlightUID = ""; // } // if (selected) // { // var effectiveRowY:Number = runningDataEffect ? // item.y - mx_internal::cachedPaddingTop : // rowInfo[rowData.rowIndex].y; // if (!selectionIndicators[rowData.uid]) // { // o = new SpriteAsset(); // o.mouseEnabled = false; //Let the selectionIndicator inherit the layoutDirection // ILayoutDirectionElement(o).layoutDirection = null; // selectionLayer.addChild(DisplayObject(o)); // selectionIndicators[rowData.uid] = o; // drawSelectionIndicator( // o, item.x, effectiveRowY /* rowInfo[rowData.rowIndex].y */, // item.width, rowInfo[rowData.rowIndex].height, // enabled ? // getStyle("selectionColor") : // getStyle("selectionDisabledColor"), // item); // if (transition) // applySelectionEffect(o, rowData.uid, item); // } // else // { // o = selectionIndicators[rowData.uid]; //Let the selectionIndicator inherit the layoutDirection // if (o is ILayoutDirectionElement) // ILayoutDirectionElement(o).layoutDirection = null; // drawSelectionIndicator( // o, item.x, effectiveRowY /* rowInfo[rowData.rowIndex].y */, // item.width, rowInfo[rowData.rowIndex].height, // enabled ? // getStyle("selectionColor") : // getStyle("selectionDisabledColor"), // item); // } // } // else if (!selected) // { // if (rowData && selectionIndicators[rowData.uid]) // { // if (selectionTweens[rowData.uid]) // { // selectionTweens[rowData.uid].removeEventListener( // TweenEvent.TWEEN_UPDATE, selectionTween_updateHandler); // selectionTweens[rowData.uid].removeEventListener( // TweenEvent.TWEEN_END, selectionTween_endHandler); // if (selectionIndicators[rowData.uid].alpha < 1) // Tween.removeTween(selectionTweens[rowData.uid]); // delete selectionTweens[rowData.uid]; // } // selectionLayer.removeChild(selectionIndicators[rowData.uid]); // delete selectionIndicators[rowData.uid] // } // } // if (caret) // && (!caretItemRenderer || caretUID != rowData.uid)) // { // Only draw the caret if there has been keyboard navigation. // if (showCaret) // { // if (!caretIndicator) // { // o = new SpriteAsset(); // o.mouseEnabled = false; // selectionLayer.addChild(DisplayObject(o)); // caretIndicator = o; // } // else // { // selectionLayer.setChildIndex(DisplayObject(caretIndicator), // selectionLayer.numChildren - 1); // } // o = caretIndicator; //Let the caretIndicator inherit the layoutDirection // if (o is ILayoutDirectionElement) // ILayoutDirectionElement(o).layoutDirection = null; // drawCaretIndicator( // o, item.x, rowInfo[rowData.rowIndex].y, // item.width, rowInfo[rowData.rowIndex].height, // getStyle("selectionColor"), item); // var oldCaretItemRenderer:IListItemRenderer = caretItemRenderer; // caretItemRenderer = item; // caretUID = rowData.uid; // if (oldCaretItemRenderer) // { // if (oldCaretItemRenderer is IFlexDisplayObject) // { // if (oldCaretItemRenderer is IInvalidating) // { // IInvalidating(oldCaretItemRenderer).invalidateDisplayList(); // IInvalidating(oldCaretItemRenderer).validateNow(); // } // } // else if (oldCaretItemRenderer is IUITextField) // { // IUITextField(oldCaretItemRenderer).validateNow(); // } // } // } // } // else if (!caret && caretItemRenderer && caretUID == rowData.uid) // { // if (caretIndicator) // Sprite(caretIndicator).graphics.clear(); // caretItemRenderer = null; // caretUID = ""; // } // if (item is IFlexDisplayObject) // { // if (item is IInvalidating) // { // IInvalidating(item).invalidateDisplayList(); // IInvalidating(item).validateNow(); // } // } // else if (item is IUITextField) // { // IUITextField(item).validateNow(); // } // } /** * Draws the highlight indicator into the given Sprite * at the position, width and height specified using the * color specified. * * @param indicator A Sprite that should contain the graphics * for that make a renderer look highlighted. * @param x The suggested x position for the indicator. * @param y The suggested y position for the indicator. * @param width The suggested width for the indicator. * @param height The suggested height for the indicator. * @param color The suggested color for the indicator. * @param itemRenderer The item renderer that is being highlighted. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function drawHighlightIndicator( indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void { var g:Graphics = Sprite(indicator).graphics; g.clear(); g.beginFill(color); g.drawRect(0, 0, width, height); g.endFill(); indicator.x = x; indicator.y = y; } */ /** * Draws the selection indicator into the given Sprite * at the position, width and height specified using the * color specified. * * @param indicator A Sprite that should contain the graphics * for that make a renderer look highlighted. * @param x The suggested x position for the indicator. * @param y The suggested y position for the indicator. * @param width The suggested width for the indicator. * @param height The suggested height for the indicator. * @param color The suggested color for the indicator. * @param itemRenderer The item renderer that is being highlighted. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function drawSelectionIndicator( indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void { var g:Graphics = Sprite(indicator).graphics; g.clear(); g.beginFill(color); g.drawRect(0, 0, width, height); g.endFill(); indicator.x = x; indicator.y = y; } */ /** * Draws the caret indicator into the given Sprite * at the position, width and height specified using the * color specified. * * @param indicator A Sprite that should contain the graphics * for that make a renderer look highlighted. * @param x The suggested x position for the indicator. * @param y The suggested y position for the indicator. * @param width The suggested width for the indicator. * @param height The suggested height for the indicator. * @param color The suggested color for the indicator. * @param itemRenderer The item renderer that is being highlighted. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function drawCaretIndicator( indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void { var g:Graphics = Sprite(indicator).graphics; g.clear(); g.lineStyle(1, color, 1); g.drawRect(0, 0, width - 1, height - 1); indicator.x = x; indicator.y = y; } */ /** * Removes all selection and highlight and caret indicators. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function clearIndicators():void { for (var uniqueID:String in selectionTweens) { removeIndicators(uniqueID); } if (selectionLayer) { while (selectionLayer.numChildren > 0) { selectionLayer.removeChildAt(0); } } selectionTweens = {}; selectionIndicators = {}; highlightIndicator = null; highlightUID = null; caretIndicator = null; caretUID = null; } */ /** * Cleans up selection highlights and other associated graphics * for a given item in the data provider. * * @param uid The UID of the data provider item. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function removeIndicators(uid:String):void { if (selectionTweens[uid]) { selectionTweens[uid].removeEventListener( TweenEvent.TWEEN_UPDATE, selectionTween_updateHandler); selectionTweens[uid].removeEventListener( TweenEvent.TWEEN_END, selectionTween_endHandler); if (selectionIndicators[uid].alpha < 1) Tween.removeTween(selectionTweens[uid]); delete selectionTweens[uid]; } // toss associated graphics if needed if (selectionIndicators[uid]) { selectionLayer.removeChild(selectionIndicators[uid]); selectionIndicators[uid] = null; } if (uid == highlightUID) { highlightItemRenderer = null; highlightUID = null; if (highlightIndicator) Sprite(highlightIndicator).graphics.clear(); } if (uid == caretUID) { caretItemRenderer = null; caretUID = null; if (caretIndicator) Sprite(caretIndicator).graphics.clear(); } } */ /** * @private */ /* mx_internal function clearHighlight(item:IListItemRenderer):void { var uid:String = itemToUID(item.data); drawItem(visibleData[uid], isItemSelected(item.data), false, uid == caretUID); var pt:Point = itemRendererToIndices(item); if (pt && lastHighlightItemIndices) { var listEvent:ListEvent = new ListEvent(ListEvent.ITEM_ROLL_OUT); listEvent.columnIndex = lastHighlightItemIndices.x; listEvent.rowIndex = lastHighlightItemIndices.y; listEvent.itemRenderer = lastHighlightItemRendererAtIndices; dispatchEvent(listEvent); lastHighlightItemIndices = null; } } */ /** * Refresh all rows on next update. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function invalidateList():void { // itemsSizeChanged = true; // invalidateDisplayList(); } /** * Refreshes all rows now. Calling this method can require substantial * processing, because can be expensive at it completely redraws all renderers * in the list and won't return until complete. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function updateList():void { // trace("updateList " + verticalScrollPosition); removeClipMask(); var cursorPos:CursorBookmark = (iterator) ? iterator.bookmark : null; clearIndicators(); visibleData = {}; makeRowsAndColumns(0, 0, listContent.width, listContent.height, 0, 0); if (iterator) iterator.seek(cursorPos, 0); drawRowBackgrounds(); configureScrollBars(); addClipMask(true); } */ //-------------------------------------------------------------------------- // // Methods: Clipping // //-------------------------------------------------------------------------- /** * @private * By default, there's a single large clip mask applied to the entire * listContent area of the List. When the List contains a mixture of * device text and vector graphics (e.g.: there are custom item renderers), * that clip mask imposes a rendering overhead. * * When graphical (non-text) item renderers are used, we optimize by only * applying a clip mask to the list items in the last row ... and then * only when it's needed. * * This optimization breaks down when there's a horizontal scrollbar. * Rather than attempting to apply clip masks to every item along the left * and right edges, we give up and use the default clip mask that covers * the entire List. * * For Lists and DataGrids containing custom item renderers, this * optimization yields a 25% improvement in scrolling speed. */ /* mx_internal function addClipMask(layoutChanged:Boolean):void { // If something about the List has changed, check to see if we need // to clip items in the last row. if (layoutChanged) { if ((horizontalScrollBar && horizontalScrollBar.visible) || hasOnlyTextRenderers() || runningDataEffect || listContent.bottomOffset != 0 || listContent.topOffset != 0 || listContent.leftOffset != 0 || listContent.rightOffset != 0) { // As described above, we just use the default clip mask // when there's a horizontal scrollbar or the item renders // are all UITextFields. listContent.mask = maskShape; selectionLayer.mask = null; } else { // When we're not applying the default clip mask to the whole // listContent, we still want to apply it to the selectionLayer // (so that the selection rectangle and the mouseOver rectangle // are properly clipped) listContent.mask = null; selectionLayer.mask = maskShape; } } // If we've decided to clip the entire listContent, then stop here. // There's no need to clip individual items if (listContent.mask) return; // If the last row fits inside listContent, then stop here. There's // no need to do any clipping. var lastRowIndex:int = listItems.length - 1; var lastRowInfo:ListRowInfo = rowInfo[lastRowIndex]; var lastRowItems:Array = listItems[lastRowIndex]; if (lastRowInfo.y + lastRowInfo.height <= listContent.height) return; // For each list item in the last row, either apply a clip mask or // set the row's height to not exceed the height of listContent var numColumns:int = lastRowItems.length; var rowY:Number = lastRowInfo.y; var rowWidth:Number = listContent.width; var rowHeight:Number = listContent.height - lastRowInfo.y; for (var i:int = 0; i < numColumns; i++) { var item:DisplayObject = lastRowItems[i]; var yOffset:Number = item.y - rowY; if (item is IUITextField) item.height = rowHeight - yOffset; else item.mask = createItemMask(0, rowY + yOffset, rowWidth, rowHeight - yOffset); } } */ /** * @private * Helper function for addClipMask(). * Creates a clip mask with the specified dimensions. */ /* private function createItemMask(x:Number, y:Number, width:Number, height:Number):DisplayObject { var mask:Shape; // To avoid constantly creating and destroying clip masks, we'll // maintain a "free list" of masks that are not currently being // used. Items are added to the free list in removeClipMask, below. if (!itemMaskFreeList) itemMaskFreeList = []; if (itemMaskFreeList.length > 0) { mask = itemMaskFreeList.pop(); if (mask.width != width) mask.width = width; if (mask.height != height) mask.height = height; } else { mask = new FlexShape(); mask.name = "mask"; var g:Graphics = mask.graphics; g.beginFill(0xFFFFFF); g.drawRect(0, 0, width, height); g.endFill(); mask.visible = false; listContent.addChild(mask); } if (mask.x != x) mask.x = x; if (mask.y != y) mask.y = y; return mask; } */ /** * @private * * Undo the effects of the addClipMask function (above) */ /* mx_internal function removeClipMask():void { // If we're currently using the default clip mask to clip the entire // listContent, then there's no need to undo clipping on individual // list items. if (listContent && listContent.mask) return; // If there are no rows, do nothing. var lastRowIndex:int = listItems.length - 1; if (lastRowIndex < 0) return; // Undo the effects of the last "for" loop in addClipMask var rowHeight:Number = rowInfo[lastRowIndex].height; var lastRowInfo:ListRowInfo = rowInfo[lastRowIndex]; var lastRowItems:Array = listItems[lastRowIndex]; var numColumns:int = lastRowItems.length; for (var i:int = 0; i < numColumns; i++) { var item:DisplayObject = lastRowItems[i]; if (item is IUITextField) { if (item.height != rowHeight - (item.y - lastRowInfo.y)) item.height = rowHeight - (item.y - lastRowInfo.y); } else if (item && item.mask) { if(itemMaskFreeList) { itemMaskFreeList.push(item.mask); } item.mask = null; } } } */ //-------------------------------------------------------------------------- // // Methods: Highlighting and selection // //-------------------------------------------------------------------------- /** * Determines if the item renderer for a data provider item * is the item under the caret due to keyboard navigation. * * @param data The data provider item. * @return <code>true</code> if the item under the caret * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function isItemShowingCaret(data:Object):Boolean { if (data == null) return false; if (data is String) return (data == caretUID); return itemToUID(data) == caretUID; } */ /** * Determines if the item renderer for a data provider item * is highlighted (is rolled over via the mouse or * or under the caret via keyboard navigation). * * @param data The data provider item. * * @return <code>true</code> if the item is highlighted. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function isItemHighlighted(data:Object):Boolean { if (data == null) return false; // When something is selected, the selection indicator // overlays the highlighted indicator so we want // to draw as selected and not highlighted. var isSelected:Boolean = highlightUID && selectedData[highlightUID]; if (data is String) return (data == highlightUID && !isSelected); return itemToUID(data) == highlightUID && !isSelected; } */ /** * Determines if the item renderer for a data provider item * is selected. * * @param data The data provider item. * * @return <code>true</code> if the item is highlighted. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function isItemSelected(data:Object):Boolean { if (data == null) return false; if (data is String) return (selectedData[data] != undefined) return selectedData[itemToUID(data)] != undefined; } */ /** * Determines if the item renderer for a data provider item * is selectable. * * @param data The data provider item * @return <code>true</code> if the item is selectable * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function isItemSelectable(data:Object):Boolean { if (!selectable) return false; if (data == null) return false; return true; } */ /** * @private */ /* private function calculateSelectedIndexAndItem():void { var num:int = 0; for (var p:String in selectedData) { num = 1; break; } if (!num) { _selectedIndex = -1; _selectedItem = null; return; } _selectedIndex = selectedData[p].index; _selectedItem = selectedData[p].data; } */ /** * Updates the set of selected items given that the item renderer provided * was clicked by the mouse and the keyboard modifiers are in the given * state. This method also updates the display of the item renderers based * on their updated selected state. * * @param item The item renderer that was clicked. * @param shiftKey <code>true</code> if the shift key was held down when * the mouse was clicked. * @param ctrlKey <code>true</code> if the ctrl key was held down when * the mouse was clicked. * @param transition <code>true</code> if the graphics for the selected * state should be faded in using an effect. * * @return <code>true</code> if the set of selected items changed. * Clicking on an already-selected item doesn't always change the set * of selected items. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function selectItem(item:IListItemRenderer, shiftKey:Boolean, ctrlKey:Boolean, transition:Boolean = true):Boolean { if (!item || !isItemSelectable(item.data)) return false; // Begin multiple selection cases. // We'll start by assuming the selection has changed. var selectionChange:Boolean = false; var placeHolder:CursorBookmark = iterator.bookmark; var index:int = itemRendererToIndex(item); var uid:String = itemToUID(item.data); if (!allowMultipleSelection || (!shiftKey && !ctrlKey)) { // we want to know if 0, 1 or more items are selected var numSelected:int = 0; if (allowMultipleSelection) { var curSelectionData:ListBaseSelectionData = firstSelectionData; if (curSelectionData != null) { numSelected++; if (curSelectionData.nextSelectionData) numSelected++; } } // allow unselecting via ctrl-click if (ctrlKey && selectedData[uid]) { selectionChange = true; var oldCaretIndex:int = caretIndex; clearSelected(transition); caretIndex = oldCaretIndex; } // plain old click, ignore if same item is selected unless number of selected items // is going to change else if (_selectedIndex != index || bSelectedIndexChanged || (allowMultipleSelection && numSelected != 1)) { selectionChange = true; //Clear all other selections, this is a single click clearSelected(transition); addSelectionData(uid, new ListBaseSelectionData(item.data, index, approximate)); drawItem(visibleData[uid], true, uid == highlightUID, true, transition); _selectedIndex = index; _selectedItem = item.data; iterator.seek(CursorBookmark.CURRENT, _selectedIndex - indicesToIndex(verticalScrollPosition - offscreenExtraRowsTop, horizontalScrollPosition - offscreenExtraColumnsLeft)); caretIndex = _selectedIndex; caretBookmark = iterator.bookmark; anchorIndex = _selectedIndex; anchorBookmark = iterator.bookmark; iterator.seek(placeHolder, 0); } } else if (shiftKey && allowMultipleSelection) { // trace("begin shiftsel"); if (anchorBookmark) { var oldAnchorBookmark:CursorBookmark = anchorBookmark; var oldAnchorIndex:int = anchorIndex; var incr:Boolean = (anchorIndex < index); clearSelected(false); caretIndex = index; caretBookmark = iterator.bookmark; anchorIndex = oldAnchorIndex; anchorBookmark = oldAnchorBookmark; try { iterator.seek(anchorBookmark, 0); } catch (e:ItemPendingError) { e.addResponder(new ItemResponder(selectionPendingResultHandler, selectionPendingFailureHandler, new ListBaseSelectionPending(incr, index, item.data, transition, placeHolder, CursorBookmark.CURRENT, 0))); iteratorValid = false; } shiftSelectionLoop(incr, anchorIndex, item.data, transition, placeHolder); } // selection may or may not change for this case. // but requires complicated testing. // so just assume that selection changed. selectionChange = true; // trace("end shiftsel"); } else if (ctrlKey && allowMultipleSelection) { if (selectedData[uid]) { removeSelectionData(uid); drawItem(visibleData[uid], false, uid == highlightUID, true, transition); if (item.data == selectedItem) calculateSelectedIndexAndItem(); } else { addSelectionData(uid, new ListBaseSelectionData(item.data, index, approximate)); drawItem(visibleData[uid], true, uid == highlightUID, true, transition); _selectedIndex = index; _selectedItem = item.data; } iterator.seek(CursorBookmark.CURRENT, index - indicesToIndex(verticalScrollPosition, horizontalScrollPosition)); caretIndex = index; caretBookmark = iterator.bookmark; anchorIndex = index; anchorBookmark = iterator.bookmark; iterator.seek(placeHolder, 0); // if user is clicking with ctl key then // selection gets changed always. selectionChange = true; } return selectionChange; } */ /** * @private */ /* private function shiftSelectionLoop(incr:Boolean, index:int, stopData:Object, transition:Boolean, placeHolder:CursorBookmark):void { var data:Object; var uid:String; // Correct the iterator position which, for some strange reason, doesn't // point to the correct place. iterator.seek(CursorBookmark.FIRST, anchorIndex); try { do { data = iterator.current; uid = itemToUID(data); // trace(uid); addSelectionData(uid, new ListBaseSelectionData(data, index, approximate)); if (visibleData[uid]) drawItem(visibleData[uid], true, uid == highlightUID, false, transition); if (data === stopData) { if (visibleData[uid]) drawItem(visibleData[uid], true, uid == highlightUID, true, transition); break; } if (incr) index++; else index--; } while (incr ? iterator.moveNext() : iterator.movePrevious()); } catch (e:ItemPendingError) { e.addResponder(new ItemResponder( selectionPendingResultHandler, selectionPendingFailureHandler, new ListBaseSelectionPending(incr, index, stopData, transition, placeHolder, CursorBookmark.CURRENT, 0))); iteratorValid = false; } try { iterator.seek(placeHolder, 0); iteratorValid = true; } catch (e2:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(placeHolder, 0); e2.addResponder(new ItemResponder( seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); } } */ /** * Clears the set of selected items and removes all graphics * depicting the selected state of those items. * * @param transition <code>true</code> if the graphics should * have a fadeout effect. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function clearSelected(transition:Boolean = false):void { for (var p:String in selectedData) { var data:Object = selectedData[p].data; removeSelectionData(p); var item:IListItemRenderer = visibleData[itemToUID(data)]; if (item) drawItem(item, false, p == highlightUID, false, transition); } clearSelectionData(); _selectedIndex = -1; _selectedItem = null; _selectedItems = null; caretIndex = -1; anchorIndex = -1; caretBookmark = null; anchorBookmark = null; } */ /** * Moves the selection in a horizontal direction in response * to the user selecting items using the left-arrow or right-arrow * keys and modifiers such as the Shift and Ctrl keys. This method * might change the <code>horizontalScrollPosition</code>, * <code>verticalScrollPosition</code>, and <code>caretIndex</code> * properties, and call the <code>finishKeySelection()</code>method * to update the selection. * * <p>Not implemented in AdvancedListBase because the default list * is single column and therefore doesn't scroll horizontally.</p> * * @param code The key that was pressed (e.g. Keyboard.LEFT) * @param shiftKey <code>true</code> if the shift key was held down when * the keyboard key was pressed. * @param ctrlKey <code>true</code> if the ctrl key was held down when * the keyboard key was pressed * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function moveSelectionHorizontally(code:uint, shiftKey:Boolean, ctrlKey:Boolean):void { // For Keyboard.LEFT and Keyboard.RIGHT and maybe Keyboard.UP and Keyboard.DOWN, // need to account for layoutDirection="rtl". return; } */ /** * Moves the selection in a vertical direction in response * to the user selecting items using the up-arrow or down-arrow * Keys and modifiers such as the Shift and Ctrl keys. This method * might change the <code>horizontalScrollPosition</code>, * <code>verticalScrollPosition</code>, and <code>caretIndex</code> * properties, and call the <code>finishKeySelection()</code>method * to update the selection * * @param code The key that was pressed (e.g. Keyboard.DOWN) * @param shiftKey <code>true</code> if the shift key was held down when * the keyboard key was pressed. * @param ctrlKey <code>true</code> if the ctrl key was held down when * the keyboard key was pressed * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function moveSelectionVertically(code:uint, shiftKey:Boolean, ctrlKey:Boolean):void { var newVerticalScrollPosition:Number; var listItem:IListItemRenderer; var uid:String; var len:int; var bSelChanged:Boolean = false; showCaret = true; var rowCount:int = listItems.length; var partialRow:int = (rowInfo[rowCount-1].y + rowInfo[rowCount-1].height > listContent.height) ? 1 : 0; var bUpdateVerticalScrollPosition:Boolean = false; bSelectItem = false; switch (code) { case Keyboard.UP: { if (caretIndex > 0) { caretIndex--; bUpdateVerticalScrollPosition = true; bSelectItem = true; } break; } case Keyboard.DOWN: { if (caretIndex < collection.length - 1) { caretIndex++; bUpdateVerticalScrollPosition = true; bSelectItem = true; } else if ((caretIndex == collection.length - 1) && partialRow) { if (verticalScrollPosition < maxVerticalScrollPosition) newVerticalScrollPosition = verticalScrollPosition + 1; } break; } case Keyboard.PAGE_UP: { if (caretIndex < lockedRowCount) { newVerticalScrollPosition = 0; caretIndex = 0; } // if the caret is on-screen, but not at the top row // just move the caret to the top row else if (caretIndex > verticalScrollPosition + lockedRowCount && caretIndex < verticalScrollPosition + rowCount) { caretIndex = verticalScrollPosition + lockedRowCount; } else { // paging up is really hard because we don't know how many // rows to move because of variable row height. We would have // to double-buffer a previous screen in order to get this exact // so we just guess for now based on current rowCount caretIndex = Math.max(caretIndex - rowCount + lockedRowCount, 0); newVerticalScrollPosition = Math.max(caretIndex - lockedRowCount,0) } bSelectItem = true; break; } case Keyboard.PAGE_DOWN: { if (caretIndex < lockedRowCount) { newVerticalScrollPosition = 0; } // if the caret is on-screen, but not at the bottom row // just move the caret to the bottom row (not partial row) else if (caretIndex >= verticalScrollPosition + lockedRowCount && caretIndex < verticalScrollPosition + rowCount - partialRow - 1) { } else { newVerticalScrollPosition = Math.min(caretIndex - lockedRowCount, maxVerticalScrollPosition); } bSelectItem = true; break; } case Keyboard.HOME: { if (caretIndex > 0) { caretIndex = 0; bSelectItem = true; newVerticalScrollPosition = 0; } break; } case Keyboard.END: { if (caretIndex < collection.length - 1) { caretIndex = collection.length - 1; bSelectItem = true; newVerticalScrollPosition = maxVerticalScrollPosition; } break; } } if (bUpdateVerticalScrollPosition) { if (caretIndex < lockedRowCount) newVerticalScrollPosition = 0; else if (caretIndex < verticalScrollPosition + lockedRowCount) newVerticalScrollPosition = caretIndex - lockedRowCount; else if (caretIndex >= verticalScrollPosition + rowCount - partialRow) newVerticalScrollPosition = Math.min(maxVerticalScrollPosition, caretIndex - rowCount + partialRow + 1); } if (!isNaN(newVerticalScrollPosition)) { if (verticalScrollPosition != newVerticalScrollPosition) { var se:ScrollEvent = new ScrollEvent(ScrollEvent.SCROLL); se.detail = ScrollEventDetail.THUMB_POSITION; se.direction = ScrollEventDirection.VERTICAL; se.delta = newVerticalScrollPosition - verticalScrollPosition; se.position = newVerticalScrollPosition; verticalScrollPosition = newVerticalScrollPosition; dispatchEvent(se); } // bail if we page faulted if (!iteratorValid) { keySelectionPending = true; return; } } bShiftKey = shiftKey; bCtrlKey = ctrlKey; lastKey = code; finishKeySelection(); } */ /** * Sets selected items based on the <code>caretIndex</code> and * <code>anchorIndex</code> properties. * Called by the keyboard selection handlers * and by the <code>updateDisplayList()</code> method in case the * keyboard selection handler * got a page fault while scrolling to get more items. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function finishKeySelection():void { var uid:String; var rowCount:int = listItems.length; var partialRow:int = (rowInfo[rowCount-1].y + rowInfo[rowCount-1].height > listContent.height) ? 1 : 0; if (lastKey == Keyboard.PAGE_DOWN) { // set caret to last full row of new screen caretIndex = Math.min(verticalScrollPosition + rowCount - partialRow - 1, collection.length - 1); } var listItem:IListItemRenderer; var bSelChanged:Boolean = false; if (bSelectItem && caretIndex - verticalScrollPosition >= 0) { if (caretIndex - verticalScrollPosition > listItems.length - 1) caretIndex = listItems.length - 1 + verticalScrollPosition; listItem = listItems[caretIndex - verticalScrollPosition][0]; if (listItem) { uid = itemToUID(listItem.data); listItem = visibleData[uid]; if (!bCtrlKey) { selectItem(listItem, bShiftKey, bCtrlKey); bSelChanged = true; } if (bCtrlKey) { drawItem(listItem, selectedData[uid] != null, uid == highlightUID, true); } } } if (bSelChanged) { var pt:Point = itemRendererToIndices(listItem); var evt:ListEvent = new ListEvent(ListEvent.CHANGE); if (pt) { evt.columnIndex = pt.x; evt.rowIndex = pt.y; } evt.itemRenderer = listItem; dispatchEvent(evt); } } */ /** * @private */ /* mx_internal function commitSelectedIndex(value:int):void { if (value != -1) { value = Math.min(value, collection.length - 1); var bookmark:CursorBookmark = iterator.bookmark; var len:int = value - scrollPositionToIndex(horizontalScrollPosition, verticalScrollPosition); try { iterator.seek(CursorBookmark.CURRENT, len); } catch (e:ItemPendingError) { iterator.seek(bookmark, 0); // if we can't seek to that spot, try again later. bSelectedIndexChanged = true; _selectedIndex = value; return; } var data:Object = iterator.current; var selectedBookmark:CursorBookmark = iterator.bookmark; var uid:String = itemToUID(data); iterator.seek(bookmark, 0); selectData(uid, data, value, selectedBookmark); } else { clearSelected(); } dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); } */ /** * Implementation detail on selecting a data, used by commitSelectedIndex. * @private */ /* protected function selectData(uid:String, data:Object, index:int, selectedBookmark:CursorBookmark):void { if (!selectedData[uid]) { if (visibleData[uid]) selectItem(visibleData[uid], false, false); else { clearSelected(); addSelectionData(uid, new ListBaseSelectionData(data, index, approximate)); _selectedIndex = index; caretIndex = index; caretBookmark = selectedBookmark; anchorIndex = index; anchorBookmark = selectedBookmark; _selectedItem = data; } } } */ /** * @private */ /* mx_internal function commitSelectedIndices(indices:Array):void { // trace("setting indices"); clearSelected(); try { collectionIterator.seek(CursorBookmark.FIRST, 0); } catch (e:ItemPendingError) { e.addResponder(new ItemResponder(selectionIndicesPendingResultHandler, selectionIndicesPendingFailureHandler, new ListBaseSelectionDataPending(true, 0, indices, CursorBookmark.FIRST, 0))); return; } setSelectionIndicesLoop(0, indices, true); } */ /** * @private */ /* private function setSelectionIndicesLoop(index:int, indices:Array, firstTime:Boolean = false):void { while (indices.length) { if (index != indices[0]) { try { collectionIterator.seek(CursorBookmark.CURRENT, indices[0] - index); } catch (e:ItemPendingError) { e.addResponder(new ItemResponder(selectionIndicesPendingResultHandler, selectionIndicesPendingFailureHandler, new ListBaseSelectionDataPending(firstTime, index, indices, CursorBookmark.CURRENT, indices[0] - index))); return; } } index = indices[0]; indices.shift(); var data:Object = collectionIterator.current; if (firstTime) { _selectedIndex = index; _selectedItem = data; caretIndex = index; caretBookmark = collectionIterator.bookmark; anchorIndex = index; anchorBookmark = collectionIterator.bookmark; firstTime = false; } addSelectionData(itemToUID(data), new ListBaseSelectionData(data, index, false)); // trace("uid = " + itemToUID(data)); } if (initialized) updateList(); dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); } */ /** * @private */ /* private function commitSelectedItem(data:Object, clearFirst:Boolean = true):void { if (clearFirst) clearSelected(); if (data != null) commitSelectedItems([data]); } */ /** * @private */ /* private function commitSelectedItems(items:Array):void { clearSelected(); var useFind:Boolean = collection.sort != null; try { collectionIterator.seek(CursorBookmark.FIRST, 0); } catch (e:ItemPendingError) { e.addResponder(new ItemResponder(selectionDataPendingResultHandler, selectionDataPendingFailureHandler, new ListBaseSelectionDataPending(useFind, 0, items, null, 0))); return; } setSelectionDataLoop(items, 0, useFind); } */ /** * @private */ /* private function setSelectionDataLoop(items:Array, index:int, useFind:Boolean = true):void { var uid:String; if (useFind) { while (items && items.length) { var item:Object = items.pop(); uid = itemToUID(item); try { collectionIterator.findAny(item); } catch (e1:ItemPendingError) { items.push(item); e1.addResponder(new ItemResponder(selectionDataPendingResultHandler, selectionDataPendingFailureHandler, new ListBaseSelectionDataPending(useFind, 0, items, null, 0))); return; } var bookmark:CursorBookmark = collectionIterator.bookmark; var viewIndex:int = bookmark.getViewIndex(); if (viewIndex >= 0) { addSelectionData(uid, new ListBaseSelectionData(item, viewIndex, true)); } else { try { collectionIterator.seek(CursorBookmark.FIRST, 0); } catch (e2:ItemPendingError) { e2.addResponder(new ItemResponder(selectionDataPendingResultHandler, selectionDataPendingFailureHandler, new ListBaseSelectionDataPending(false, 0, items, CursorBookmark.FIRST, 0))); return; } // collection doesn't support indexes from bookmarks so // try again w/o using bookmarks items.push(item); setSelectionDataLoop(items, 0, false); return; } if (items.length == 0) { _selectedIndex = viewIndex; _selectedItem = item; caretIndex = viewIndex; caretBookmark = collectionIterator.bookmark; anchorIndex = viewIndex; anchorBookmark = collectionIterator.bookmark; } } } else { while (items && items.length && !collectionIterator.afterLast) { var n:int = items.length; var data:Object = collectionIterator.current; for (var i:int = 0; i < n; i++) { if (data == items[i]) { uid = itemToUID(data); addSelectionData(uid, new ListBaseSelectionData(data, index, false)); items.splice(i, 1); if (items.length == 0) { _selectedIndex = index; _selectedItem = data; caretIndex = index; caretBookmark = collectionIterator.bookmark; anchorIndex = index; anchorBookmark = collectionIterator.bookmark; } break; } } try { collectionIterator.moveNext(); index++; } catch (e2:ItemPendingError) { e2.addResponder(new ItemResponder(selectionDataPendingResultHandler, selectionDataPendingFailureHandler, new ListBaseSelectionDataPending(false, index, items, CursorBookmark.CURRENT, 1))); return; } } } if (initialized) updateList(); dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); } */ /** * @private */ /* private function clearSelectionData():void { selectedData = {}; firstSelectionData = null; } */ /** * @private */ /* mx_internal function addSelectionData(uid:String, selectionData:ListBaseSelectionData):void { if (firstSelectionData != null) firstSelectionData.prevSelectionData = selectionData; selectionData.nextSelectionData = firstSelectionData; firstSelectionData = selectionData; selectedData[uid] = selectionData; } */ /** * @private */ /* private function removeSelectionData(uid:String):void { var curSelectionData:ListBaseSelectionData = selectedData[uid]; if (firstSelectionData == curSelectionData) firstSelectionData = curSelectionData.nextSelectionData; if (curSelectionData.prevSelectionData != null) curSelectionData.prevSelectionData.nextSelectionData = curSelectionData.nextSelectionData; if (curSelectionData.nextSelectionData != null) curSelectionData.nextSelectionData.prevSelectionData = curSelectionData.prevSelectionData; delete selectedData[uid]; } */ /** * Sets up the effect for applying the selection indicator. * The default is a basic alpha tween. * * @param indicator A Sprite that contains the graphics depicting selection. * @param uid The UID of the item being selected which can be used to index * into a table and track more than one selection effect. * @param itemRenderer The item renderer that is being shown as selected. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function applySelectionEffect(indicator:Sprite, uid:String, itemRenderer:IListItemRenderer):void { var selectionDuration:Number = getStyle("selectionDuration"); if (selectionDuration != 0) { indicator.alpha = 0; selectionTweens[uid] = new Tween(indicator, 0, 1, selectionDuration, 5); selectionTweens[uid].addEventListener(TweenEvent.TWEEN_UPDATE, selectionTween_updateHandler); selectionTweens[uid].addEventListener(TweenEvent.TWEEN_END, selectionTween_endHandler); selectionTweens[uid].setTweenHandlers(onSelectionTweenUpdate, onSelectionTweenUpdate); var selectionEasingFunction:Function = getStyle("selectionEasingFunction") as Function; if (selectionEasingFunction != null) selectionTweens[uid].easingFunction = selectionEasingFunction; } } */ /** * @private */ /* private function onSelectionTweenUpdate(value:Number):void { } */ /** * Makes a copy of the selected items in the order they were * selected. * * @param useDataField <code>true</code> if the array should * be filled with the actual items or <code>false</code> * if the array should be filled with the indexes of the items. * * @return Array of selected items. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function copySelectedItems(useDataField:Boolean = true):Array { var tmp:Array = []; var curSelectionData:ListBaseSelectionData = firstSelectionData; while (curSelectionData != null) { if (useDataField) tmp.push(curSelectionData.data); else tmp.push(curSelectionData.index); curSelectionData = curSelectionData.nextSelectionData; } return tmp; } */ //-------------------------------------------------------------------------- // // Methods: Scrolling // //-------------------------------------------------------------------------- /** * Returns the data provider index for the item at the first visible * row and column for the given scroll positions. * * @param horizontalScrollPosition The <code>horizontalScrollPosition</code> * property value corresponding to the scroll position. * @param verticalScrollPosition The <code>verticalScrollPosition</code> * property value corresponding to the scroll position. * * @return The data provider index. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function scrollPositionToIndex(horizontalScrollPosition:int, verticalScrollPosition:int):int { return iterator ? verticalScrollPosition : -1; } */ /** * Ensures that the data provider item at the given index is visible. * If the item is visible, the <code>verticalScrollPosition</code> * property is left unchanged even if the item is not the first visible * item. If the item is not currently visible, the * <code>verticalScrollPosition</code> * property is changed make the item the first visible item, unless there * aren't enough rows to do so because the * <code>verticalScrollPosition</code> value is limited by the * <code>maxVerticalScrollPosition</code> property. * * @param index The index of the item in the data provider. * * @return <code>true</code> if <code>verticalScrollPosition</code> changed. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ public function scrollToIndex(index:int):Boolean { /* var newVPos:int; if (index >= verticalScrollPosition + listItems.length - lockedRowCount - offscreenExtraRowsBottom || index < verticalScrollPosition) { newVPos = Math.min(index, maxVerticalScrollPosition); verticalScrollPosition = newVPos; return true; }*/ return false; } /** * Adjusts the renderers in response to a change * in scroll position. * * <p>The list classes attempt to optimize scrolling * when the scroll position has changed by less than * the number of visible rows. In that situation, * some rows are unchanged and just need to be moved, * other rows are removed and then new rows are added. * If the scroll position changes too much, all old rows are removed * and new rows are added by calling the <code>makeRowsAndColumns()</code> * method for the entire viewable area.</p> * * @param pos The new scroll position. * * @param deltaPos The change in position. It is always * a positive number. * * @param scrollUp <code>true</code> if scroll position * is getting smaller. * * @see mx.controls.listClasses.ListBase#makeRowsAndColumns() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function scrollVertically(pos:int, deltaPos:int, scrollUp:Boolean):void { // trace("scrollVertically " + pos); var i:int; var j:int; var r:IListItemRenderer; var item:IListItemRenderer; var numRows:int; var numCols:int; var uid:String; var visibleY:Number; var curY:Number; var rowCount:int = rowInfo.length; if(rowCount > listItems.length) { rowCount = listItems.length; } var columnCount:int = listItems[0].length; var cursorPos:CursorBookmark; var moveBlockDistance:Number = 0; visibleY = (lockedRowCount > 0) ? rowInfo[lockedRowCount - 1].y + rowInfo[lockedRowCount - 1].height : rowInfo[0].y; if (scrollUp) { // find first fully visible row not spanning onto the screen; // trace("visibleY = " + visibleY); for (i = lockedRowCount; i < rowCount; i++) { if (rowInfo[i].y >= visibleY) break; } var startRow:int = i; // measure how far we have to move by measuring each row for (i; i < deltaPos + startRow; i++) { // after we shift the items, see if any are still visible moveBlockDistance += rowInfo[i].height; try { iterator.moveNext(); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, pos) e.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; // trace("itemPending in ScrollVertically"); return; } } // trace("moveBlockDistance = " + moveBlockDistance); // shift rows upward and toss invisible ones. for (i = lockedRowCount; i < rowCount; i++) { numCols = Math.min(columnCount,listItems[i].length); // if row is not visible, toss it if (i < deltaPos + lockedRowCount) { destroyRow(i, numCols); } else if (deltaPos > 0) { // after we shift the items, see if any are still visible for (j = 0; j < numCols; j++) { r = listItems[i][j]; r.move(r.x, r.y - moveBlockDistance); if (r.data && r is IDropInListItemRenderer) IDropInListItemRenderer(r).listData.rowIndex = i; rowMap[r.name].rowIndex = i; } rowInfo[i].y -= moveBlockDistance; uid = rowInfo[i].uid; if (uid) { // This assumes all the selection indicators in this row are at // the same 'y' position moveIndicators(uid, -moveBlockDistance, false); } } } // trace("tossed " + deltaPos + " " + rowCount); // deltaPos is now the number of rows we tossed if (deltaPos) { for (i = lockedRowCount + deltaPos; i < rowCount; i++) { numCols = listItems[i].length; for (j = 0; j < numCols; j++) { // trace("compacting " + i + " " + j); // compact the array r = listItems[i][j]; if (r.data && r is IDropInListItemRenderer) IDropInListItemRenderer(r).listData.rowIndex = i - deltaPos; rowMap[r.name].rowIndex = i - deltaPos; listItems[i - deltaPos][j] = r; } if (listItems[i - deltaPos].length > numCols) listItems[i-deltaPos].splice(numCols); // if no columns, make destination row empty. Normally this is filled in by // makeRowsAndColumns, but if it page faults it won't fill it in // but the item in [i - deltapos] is already on the free list if (!numCols) listItems[i - deltaPos].splice(0); rowInfo[i - deltaPos] = rowInfo[i]; } listItems.splice(rowCount - deltaPos); rowInfo.splice(rowCount - deltaPos); // trace("listItems.length = " + listItems.length); } if(rowInfo && rowInfo.length > 0) curY = rowInfo[rowCount - deltaPos - 1].y + rowInfo[rowCount - deltaPos - 1].height; else curY = 0; cursorPos = iterator.bookmark; try { iterator.seek(CursorBookmark.CURRENT, rowCount - lockedRowCount - deltaPos); } catch (e1:ItemPendingError) { // trace("IPE in scrollVertically"); lastSeekPending = new ListBaseSeekPending(cursorPos, 0) e1.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; // we don't do anything here and will repaint when the rows arrive } // fill it in makeRowsAndColumns(0, curY, listContent.width, listContent.height, 0, rowCount - deltaPos); iterator.seek(cursorPos, 0); } else { // scrolling down is different because rows are locked to top. // instead of measuring how much space we lost, we make the rows requested // and then toss as many (including 0) rows as needed to make room for the // new rows // copy the old rows curY = 0; if (lockedRowCount > 0) curY = rowInfo[lockedRowCount - 1].y + rowInfo[lockedRowCount - 1].height; else curY = rowInfo[0].y // insert slots to be filled by new rows for (i = 0; i < deltaPos; i++) { listItems.splice(lockedRowCount, 0, null); rowInfo.splice(lockedRowCount, 0, null); } try { iterator.seek(CursorBookmark.CURRENT, -deltaPos); } catch (e2:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(CursorBookmark.CURRENT, -deltaPos) e2.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; } cursorPos = iterator.bookmark; var actual:Point = makeRowsAndColumns(0, curY, listContent.width, listContent.height, 0, lockedRowCount, true, deltaPos); // trace("made " + actual.y); iterator.seek(cursorPos, 0); if (actual.y == 0) { // no more rows, set verticalScrollPosition to 0, restore the rows and leave verticalScrollPosition = 0; rowInfo.splice(lockedRowCount, deltaPos); listItems.splice(lockedRowCount, deltaPos); } // measure how far we have to move by measuring each new row for (i = 0; i < actual.y; i++) { moveBlockDistance += rowInfo[lockedRowCount + i].height; } // trace("moveBlockDistance = " + moveBlockDistance); var row:Array; var rowData:Object; // trace("curY = " + curY); var deltaY:Number; curY += moveBlockDistance; // trace("curY = " + curY); // fix up positions of old rows and delete any that fell off bottom for (i = lockedRowCount + actual.y; i < listItems.length; i++) { row = listItems[i]; rowData = rowInfo[i]; var deleteRow:Boolean = false; deltaY = curY - rowData.y; // trace("deltaY = " + deltaY + " curY = " + curY + " newRowIndex = " + newRowIndex); rowData.y = curY; if (row.length) { for (j = 0; j < row.length; j++) { item = row[j]; item.move(item.x, item.y + deltaY); if (item.y >= listContent.height) { deleteRow = true; } if (!deleteRow) { rowMap[item.name].rowIndex += deltaPos; } } } else { if (rowData.y >= listContent.height) deleteRow = true; } uid = rowInfo[i].uid; if (deleteRow) { var oldRow:Array = listItems[i]; if (oldRow.length && oldRow[0].data) { removeIndicators(uid); } for (j = 0; j < oldRow.length; j++) { if (oldRow[j] && oldRow[j].data) { delete visibleData[uid]; addToFreeItemRenderers(oldRow[j]); } } listItems.splice(i, 1); rowInfo.splice(i, 1); i--; // backup one cuz we deleted one } if (uid) { // This assumes all the selection indicators in this row are at // the same 'y' position moveIndicators(uid, curY, true); if (selectionIndicators[uid]) selectionIndicators[uid].y = curY; if (highlightUID == uid) highlightIndicator.y = curY; if (caretUID == uid) caretIndicator.y = curY; } curY += rowData.height; } rowCount = listItems.length; } } private function destroyRow(i:int, numCols:int):void { var r:IListItemRenderer; var uid:String = rowInfo[i].uid; removeIndicators(uid); for (var j:int = 0; j < numCols; j++) { r = listItems[i][j]; if (r.data) delete visibleData[uid]; addToFreeItemRenderers(r); // we don't seem to be doing this consistently throughout the code? // listContent.removeChild(DisplayObject(r)); } } private function moveRowVertically(i:int, numCols:int, moveBlockDistance:Number):void { var r:IListItemRenderer; for (var j:int = 0; j < numCols; j++) { r = listItems[i][j]; r.move(r.x, r.y + moveBlockDistance); } rowInfo[i].y += moveBlockDistance; } private function shiftRow(oldIndex:int, newIndex:int, numCols:int, shiftItems:Boolean):void { var r:IListItemRenderer; for (var j:int = 0; j < numCols; j++) { r = listItems[oldIndex][j]; if (shiftItems) { listItems[newIndex][j] = r; rowMap[r.name].rowIndex = newIndex; } // this is sort of a hack to accomodate the fact that // scrolling down does a splice which throws off these values. // probably better to call shiftRow with different parameters? else { rowMap[r.name].rowIndex = oldIndex; } } } */ /** * @copy mx.controls.listClasses.ListBase#moveIndicatorsVertically() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function moveIndicatorsVertically(uid:String, moveBlockDistance:Number):void { if (uid) { if (selectionIndicators[uid]) selectionIndicators[uid].y += moveBlockDistance; if (highlightUID == uid) highlightIndicator.y += moveBlockDistance; if (caretUID == uid) caretIndicator.y += moveBlockDistance; } } */ /** * @copy mx.controls.listClasses.ListBase#moveIndicatorsHorizontally() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function moveIndicatorsHorizontally(uid:String, moveBlockDistance:Number):void { if (uid) { if (selectionIndicators[uid]) selectionIndicators[uid].x += moveBlockDistance; if (highlightUID == uid) highlightIndicator.x += moveBlockDistance; if (caretUID == uid) caretIndicator.x += moveBlockDistance; } } private function sumRowHeights(startRowIdx:int, endRowIdx:int):Number { var sum:Number = 0; for (var i:int = startRowIdx ; i <= endRowIdx; i++) sum += rowInfo[i].height; return sum; } */ /** * Adjusts the renderers in response to a change * in scroll position. * * <p>The list classes attempt to optimize scrolling * when the scroll position has changed by less than * the number of visible rows. In that situation * some rows are unchanged and just need to be moved, * other rows are removed and then new rows are added. * If the scroll position changes too much, all old rows are removed * and new rows are added by calling the <code>makeRowsAndColumns()</code> * method for the entire viewable area.</p> * * <p>Not implemented in AdvancedListBase because the default list * is single column and therefore doesn't scroll horizontally.</p> * * @param pos The new scroll position. * @param deltaPos The change in position. It is always * a positive number. * @param scrollUp <code>true</code> if scroll position * is getting smaller. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function scrollHorizontally(pos:int, deltaPos:int, scrollUp:Boolean):void { // update visible columns // translate vertical logic here } */ /** * Configures the ScrollBars based on the number of rows and columns and * viewable rows and columns. * This method is called from the <code>updateDisplayList()</code> method * after the rows and columns have been updated. * The method should figures out what parameters to pass into the * <code>setScrollBarProperties()</code> to properly set the ScrollBars up. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function configureScrollBars():void { } */ /** * Interval function that scrolls the list up or down * if the mouse goes above or below the list. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function dragScroll():void { var slop:Number = 0; var scrollInterval:Number; var oldPosition:Number; var d:Number; var scrollEvent:ScrollEvent; // sometimes, we'll get called even if interval has been cleared if (dragScrollingInterval == 0) return; const minScrollInterval:Number = 30; if (DragManager.isDragging) { slop = viewMetrics.top + (variableRowHeight ? getStyle("fontSize") / 4 : rowHeight); } clearInterval(dragScrollingInterval); if (mouseY < slop) { oldPosition = verticalScrollPosition; verticalScrollPosition = Math.max(0, oldPosition - 1); if (DragManager.isDragging) { scrollInterval = 100; } else { d = Math.min(0 - mouseY - 30, 0); // quadratic relation between distance and scroll speed scrollInterval = 0.593 * d * d + 1 + minScrollInterval; } dragScrollingInterval = setInterval(dragScroll, scrollInterval); if (oldPosition != verticalScrollPosition) { scrollEvent = new ScrollEvent(ScrollEvent.SCROLL); scrollEvent.detail = ScrollEventDetail.THUMB_POSITION; scrollEvent.direction = ScrollEventDirection.VERTICAL; scrollEvent.position = verticalScrollPosition; scrollEvent.delta = verticalScrollPosition - oldPosition; dispatchEvent(scrollEvent); } } else if (mouseY > (unscaledHeight - slop)) { oldPosition = verticalScrollPosition; verticalScrollPosition = Math.min(maxVerticalScrollPosition, verticalScrollPosition + 1); if (DragManager.isDragging) { scrollInterval = 100; } else { d = Math.min(mouseY - unscaledHeight - 30, 0); scrollInterval = 0.593 * d * d + 1 + minScrollInterval; } dragScrollingInterval = setInterval(dragScroll, scrollInterval); if (oldPosition != verticalScrollPosition) { scrollEvent = new ScrollEvent(ScrollEvent.SCROLL); scrollEvent.detail = ScrollEventDetail.THUMB_POSITION; scrollEvent.direction = ScrollEventDirection.VERTICAL; scrollEvent.position = verticalScrollPosition; scrollEvent.delta = verticalScrollPosition - oldPosition; dispatchEvent(scrollEvent); } } else { dragScrollingInterval = setInterval(dragScroll, 15); } if (DragManager.isDragging && lastDragEvent && oldPosition != verticalScrollPosition) { dragOverHandler(lastDragEvent); } } */ /** * @private * Stop the drag scrolling callback. */ /* mx_internal function resetDragScrolling():void { if (dragScrollingInterval != 0) { clearInterval(dragScrollingInterval); dragScrollingInterval = 0; } } */ //-------------------------------------------------------------------------- // // Methods: Drag and drop // //-------------------------------------------------------------------------- /** * Adds the selected items to the DragSource object as part of a * drag-and-drop operation. * Override this method to add other data to the drag source. * * @param dragSource The DragSource object to which to add the data. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function addDragData(dragSource:Object):void // actually a DragSource { // The Halo drag drop data format dragSource.addHandler(copySelectedItems, "items"); // The Spark drag drop data format dragSource.addHandler(copySelectedItemsForDragDrop, "itemsByIndex"); // Calculate the index of the focus item within the vector // of ordered items returned for the "itemsByIndex" format. var caretIndex:int = 0; var draggedIndices:Array = selectedIndices; var count:int = draggedIndices.length; for (var i:int = 0; i < count; i++) { if (mouseDownIndex > draggedIndices[i]) caretIndex++; } dragSource.addData(caretIndex, "caretIndex"); } */ /** * Returns the index where the dropped items should be added * to the drop target. * * @param event A DragEvent that contains information about * the position of the mouse. If <code>null</code> the * method should return the <code>dropIndex</code> value from the * last valid event. * * @return Index where the dropped items should be added. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function calculateDropIndex(event:DragEvent = null):int { if (event) { var item:IListItemRenderer; var pt:Point = new Point(event.localX, event.localY); pt = DisplayObject(event.target).localToGlobal(pt); pt = listContent.globalToLocal(pt); var n:int = listItems.length; for (var i:int = 0; i < n; i++) { if (rowInfo[i].y <= pt.y && pt.y <= rowInfo[i].y + rowInfo[i].height) { item = listItems[i][0]; break; } } if (item) { lastDropIndex = itemRendererToIndex(item); } else lastDropIndex = collection ? collection.length : 0; } return lastDropIndex; } */ /** * Calculates the y position of the drop indicator * when performing a drag-and-drop operation. * * @param rowCount The number of visible rows in the control. * * @param rowNum The row number in the control where the drop indicator should appear. * * @return The y axis coordinate of the drop indicator. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function calculateDropIndicatorY(rowCount:Number, rowNum:int):Number { var i:int; var yy:Number = 0; if (rowCount && listItems[rowNum].length && listItems[rowNum][0]) { return listItems[rowNum][0].y - 1 } for (i = 0; i < rowCount; i++) { if (listItems[i].length) yy += rowInfo[i].height; else break; } return yy; } */ /** * Displays a drop indicator under the mouse pointer to indicate that a * drag and drop operation is allowed and where the items will * be dropped. * * @param event A DragEvent object that contains information as to where * the mouse is. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function showDropFeedback(event:DragEvent):void { if (!dropIndicator) { var dropIndicatorClass:Class = getStyle("dropIndicatorSkin"); if (!dropIndicatorClass) dropIndicatorClass = ListDropIndicator; dropIndicator = IFlexDisplayObject(new dropIndicatorClass()); var vm:EdgeMetrics = viewMetrics; drawFocus(true); dropIndicator.x = 2; dropIndicator.setActualSize(listContent.width - 4, 4); dropIndicator.visible = true; listContent.addChild(DisplayObject(dropIndicator)); if (collection) dragScroll(); } var rowNum:Number = calculateDropIndex(event); if (rowNum >= lockedRowCount) rowNum -= verticalScrollPosition; var rc:Number = listItems.length; if (rowNum >= rc) rowNum = rc - 1; if (rowNum < 0) rowNum = 0; dropIndicator.y = calculateDropIndicatorY(rc, rowNum); } */ /** * Hides the drop indicator under the mouse pointer that indicates that a * drag and drop operation is allowed. * * @param event A DragEvent object that contains information about the * mouse location. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function hideDropFeedback(event:DragEvent):void { if (dropIndicator) { listContent.removeChild(DisplayObject(dropIndicator)); dropIndicator = null; drawFocus(false); if (dragScrollingInterval != 0) { clearInterval(dragScrollingInterval); dragScrollingInterval = 0; } } } */ /** * Makes a deep copy of the object by calling the * <code>ObjectUtil.copy()</code> method, and replaces * the copy's <code>uid</code> property (if present) with a * new value by calling the <code>UIDUtil.createUID()</code> method. * * <p>This method is used for a drag and drop copy.</p> * * @param item The item to copy. * * @return The copy of the object. * * @see mx.utils.ObjectUtil * @see mx.utils.UIDUtil * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function copyItemWithUID(item:Object):Object { var copyObj:Object = ObjectUtil.copy(item); if (copyObj is IUID) { IUID(copyObj).uid = UIDUtil.createUID(); } else if (copyObj is Object && "mx_internal_uid" in copyObj) { copyObj.mx_internal_uid = UIDUtil.createUID(); } return copyObj; } */ /** * @private */ /* private function copySelectedItemsForDragDrop():Vector.<Object> { // Copy the vector so that we don't modify the original // since selectedIndices returns a reference. var draggedIndices:Array = selectedIndices.slice(0, selectedIndices.length); var result:Vector.<Object> = new Vector.<Object>(draggedIndices.length); // Sort in the order of the data source draggedIndices.sort(); // Copy the items var count:int = draggedIndices.length; for (var i:int = 0; i < count; i++) result[i] = dataProvider.getItemAt(draggedIndices[i]); return result; } */ /** * @private * Insert for drag and drop, handles the Spark "itemsByIndex" data format. */ /* private function insertItemsByIndex(dropIndex:int, dragSource:DragSource, event:DragEvent):void { var items:Vector.<Object> = dragSource.dataForFormat("itemsByIndex") as Vector.<Object>; // Copy or move the items. No need to check whether the operation is // reorder within this list, as ListBase never creates the // "itemsByIndex" data format. This is a new data format from Spark List only. collectionIterator.seek(CursorBookmark.FIRST, dropIndex); var count:int = items.length; for (var i:int = 0; i < count; i++) { if (event.action == DragManager.COPY) { collectionIterator.insert(copyItemWithUID(items[i])); } else if (event.action == DragManager.MOVE) { collectionIterator.insert(items[i]); } } } */ /** * @private * Insert for drag and drop, handles the Halo "items" data format. */ /* private function insertItems(dropIndex:int, dragSource:DragSource, event:DragEvent):void { var items:Array = dragSource.dataForFormat("items") as Array; if (event.action == DragManager.MOVE && dragMoveEnabled && event.dragInitiator == this) { var indices:Array = selectedIndices; indices.sort(Array.NUMERIC); for (var i:int = indices.length - 1; i >= 0; i--) { collectionIterator.seek(CursorBookmark.FIRST, indices[i]); if (indices[i] < dropIndex) dropIndex--; collectionIterator.remove(); } clearSelected(false); } collectionIterator.seek(CursorBookmark.FIRST, dropIndex); for (i = items.length - 1; i >= 0; i--) { if (event.action == DragManager.COPY) { collectionIterator.insert(copyItemWithUID(items[i])); } else if (event.action == DragManager.MOVE) { collectionIterator.insert(items[i]); } } } */ //-------------------------------------------------------------------------- // // Methods: Support for pending data // //-------------------------------------------------------------------------- /** * The default failure handler when a seek fails due to a page fault. * * @param data The data that caused the error. * * @param info Data about a seek operation * that was interrupted by an ItemPendingError error. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function seekPendingFailureHandler(data:Object, info:ListBaseSeekPending):void { } */ /** * The default result handler when a seek fails due to a page fault. * This method checks to see if it has the most recent page fault result: * if not it simply exits; if it does, it sets the iterator to * the correct position. * * @param data The data that caused the error. * * @param info Data about a seek operation * that was interrupted by an ItemPendingError error. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function seekPendingResultHandler(data:Object, info:ListBaseSeekPending):void { // trace("seekPendingResultHandler", this); if (info != lastSeekPending) { return; } lastSeekPending = null; iteratorValid = true; try { iterator.seek(info.bookmark, info.offset); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(info.bookmark, info.offset) e.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; } if (bSortItemPending) { bSortItemPending = false; adjustAfterSort(); } itemsSizeChanged = true; invalidateDisplayList(); } */ /** * @private */ /* private function findPendingFailureHandler(data:Object, info:ListBaseFindPending):void { } */ /** * @private */ /* private function findPendingResultHandler(data:Object, info:ListBaseFindPending):void { // trace("findPendingResultHandler", this); iterator.seek(info.bookmark, info.offset); findStringLoop(info.searchString, info.startingBookmark, info.currentIndex, info.stopIndex); } */ /** * @private */ /* private function selectionPendingFailureHandler( data:Object, info:ListBaseSelectionPending):void { } */ /** * @private */ /* private function selectionPendingResultHandler( data:Object, info:ListBaseSelectionPending):void { // trace("selectionPendingResultHandler", this); iterator.seek(info.bookmark, info.offset); shiftSelectionLoop(info.incrementing, info.index, info.stopData, info.transition, info.placeHolder); } */ /** * @private */ /* private function selectionDataPendingFailureHandler( data:Object, info:ListBaseSelectionDataPending):void { } */ /** * @private */ /* private function selectionDataPendingResultHandler( data:Object, info:ListBaseSelectionDataPending):void { // trace("selectionDataPendingResultHandler", this); if (info.bookmark) iterator.seek(info.bookmark, info.offset); setSelectionDataLoop(info.items, info.index, info.useFind); } */ /** * @private */ /* private function selectionIndicesPendingFailureHandler( data:Object, info:ListBaseSelectionDataPending):void { } */ /** * @private */ /* private function selectionIndicesPendingResultHandler( data:Object, info:ListBaseSelectionDataPending):void { // trace("selectionIndicesPendingResultHandler", this); if (info.bookmark) iterator.seek(info.bookmark, info.offset); setSelectionIndicesLoop(info.index, info.items, info.useFind); } */ //-------------------------------------------------------------------------- // // Methods: Keyboard lookup // //-------------------------------------------------------------------------- /** * Tries to find the next item in the data provider that * starts with the character in the <code>eventCode</code> parameter. * You can override this to do fancier typeahead lookups. The search * starts at the <code>selectedIndex</code> location; if it reaches * the end of the data provider it starts over from the beginning. * * @param eventCode The key that was pressed on the keyboard. * @return <code>true</code> if a match was found. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function findKey(eventCode:int):Boolean { var tmpCode:int = eventCode; return tmpCode >= 33 && tmpCode <= 126 && findString(String.fromCharCode(tmpCode)); } */ /** * Finds an item in the list based on a string * and moves the selection to it. The search * starts at the <code>selectedIndex</code> location; if it reaches * the end of the data provider it starts over from the beginning. * * @param str The string to match. * @return <code>true</code> if a match was found. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function findString(str:String):Boolean { if (!collection || collection.length == 0) return false; var cursorPos:CursorBookmark; cursorPos = iterator.bookmark; var stopIndex:int = selectedIndex; var i:int = stopIndex + 1; // start at next if (selectedIndex == -1) { try { iterator.seek(CursorBookmark.FIRST, 0); } catch (e1:ItemPendingError) { e1.addResponder(new ItemResponder( findPendingResultHandler, findPendingFailureHandler, new ListBaseFindPending(str, cursorPos, CursorBookmark.FIRST, 0, 0, collection.length))); iteratorValid = false; return false; } stopIndex = collection.length; i = 0; } else { try { iterator.seek(CursorBookmark.FIRST, stopIndex); } catch (e2:ItemPendingError) { if (anchorIndex == collection.length - 1) { e2.addResponder(new ItemResponder( findPendingResultHandler, findPendingFailureHandler, new ListBaseFindPending(str, cursorPos, CursorBookmark.FIRST, 0, 0, collection.length))); } else { e2.addResponder(new ItemResponder( findPendingResultHandler, findPendingFailureHandler, new ListBaseFindPending(str, cursorPos, anchorBookmark, 1, anchorIndex + 1, anchorIndex))); } iteratorValid = false; return false; } var bMovedNext:Boolean = false; // If we ran off the end, go back to beginning. try { bMovedNext = iterator.moveNext(); } catch (e3:ItemPendingError) { // Assume we don't fault unless there is more data. e3.addResponder(new ItemResponder( findPendingResultHandler, findPendingFailureHandler, new ListBaseFindPending(str, cursorPos, anchorBookmark, 1, anchorIndex + 1, anchorIndex))); iteratorValid = false; return false; } if (!bMovedNext) { try { iterator.seek(CursorBookmark.FIRST, 0); } catch (e4:ItemPendingError) { e4.addResponder(new ItemResponder( findPendingResultHandler, findPendingFailureHandler, new ListBaseFindPending(str, cursorPos, CursorBookmark.FIRST, 0, 0, collection.length))); iteratorValid = false; return false; } stopIndex = collection.length; i = 0; } } return findStringLoop(str, cursorPos, i, stopIndex); } */ /** * @private */ /* private function findStringLoop(str:String, cursorPos:CursorBookmark, i:int, stopIndex:int):Boolean { // Search from the current index. // Jump back to beginning if we hit the end. for (i; i != stopIndex; i++) { var itmStr:String = itemToLabel(iterator.current); if (itmStr) { itmStr = itmStr.substring(0, str.length); if (str == itmStr || str.toUpperCase() == itmStr.toUpperCase()) { iterator.seek(cursorPos, 0); scrollToIndex(i); commitSelectedIndex(i); var item:IListItemRenderer = indexToItemRenderer(i); var pt:Point = itemRendererToIndices(item); var evt:ListEvent = new ListEvent(ListEvent.CHANGE); evt.itemRenderer = item; if (pt) { evt.columnIndex = pt.x; evt.rowIndex = pt.y; } dispatchEvent(evt); return true; } } try { var more:Boolean = iterator.moveNext(); } catch (e1:ItemPendingError) { e1.addResponder(new ItemResponder( findPendingResultHandler, findPendingFailureHandler, new ListBaseFindPending(str, cursorPos, CursorBookmark.CURRENT, 1, i + 1, stopIndex))); iteratorValid = false; return false; } // Start from beginning if we hit the end if (!more && stopIndex != collection.length) { i = -1; try { iterator.seek(CursorBookmark.FIRST, 0); } catch (e2:ItemPendingError) { e2.addResponder(new ItemResponder( findPendingResultHandler, findPendingFailureHandler, new ListBaseFindPending(str, cursorPos, CursorBookmark.FIRST, 0, 0, stopIndex))); iteratorValid = false; return false; } } } iterator.seek(cursorPos, 0); iteratorValid = true; return false; } */ //-------------------------------------------------------------------------- // // Methods: Sorting // //-------------------------------------------------------------------------- /** * @private */ /* private function adjustAfterSort():void { var i:int = 0; for (var p:String in selectedData) { i++; } var index:int = anchorBookmark ? anchorBookmark.getViewIndex() : -1; if (index >= 0) { // If only one thing selected, then we're done. if (i == 1) { _selectedIndex = anchorIndex = caretIndex = index; var data:ListBaseSelectionData = selectedData[p]; data.index = index; } var newVerticalScrollPosition:int = indexToRow(index); newVerticalScrollPosition = Math.min(maxVerticalScrollPosition, newVerticalScrollPosition); var newHorizontalScrollPosition:int = indexToColumn(index); newHorizontalScrollPosition = Math.min(maxHorizontalScrollPosition, newHorizontalScrollPosition); // Prepare to refresh from there. var pos:int = scrollPositionToIndex(newHorizontalScrollPosition, newVerticalScrollPosition); try { iterator.seek(CursorBookmark.CURRENT, pos - index); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending( CursorBookmark.CURRENT, pos - index) e.addResponder(new ItemResponder( seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; return; } super.verticalScrollPosition = newVerticalScrollPosition; if (listType != "vertical") super.horizontalScrollPosition = newHorizontalScrollPosition; } else { try { iterator.seek(CursorBookmark.FIRST, verticalScrollPosition); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending( CursorBookmark.FIRST, verticalScrollPosition); e.addResponder(new ItemResponder( seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; return; } } // If there's more than one selection, find their new indices. if (i > 1) commitSelectedItems(selectedItems); } */ //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * Initiates a data change effect when there have been changes * in the data provider. * * @param unscaledWidth Specifies the width of the component, in pixels, * in the component's coordinates, regardless of the value of the * <code>scaleX</code> property of the component. * * @param unscaledHeight Specifies the height of the component, in pixels, * in the component's coordinates, regardless of the value of the * <code>scaleY</code> property of the component. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function initiateDataChangeEffect(unscaledWidth:Number, unscaledHeight:Number):void { // as optimization, we might get targets from visibleData // if we know that nothing else has changed. // otherwise, rerender using our preserved collection view // store original collection and iterator so we can // return to using it after the effect has finished actualCollection = collection; actualIterator = iterator; // switch to a view of the collection before the data change // and call updateDisplayList() collection = modifiedCollectionView; modifiedCollectionView.showPreservedState = true; iterator = collection.createCursor(); var index:int = scrollPositionToIndex(horizontalScrollPosition - offscreenExtraColumnsLeft, verticalScrollPosition - offscreenExtraRowsTop); iterator.seek(CursorBookmark.FIRST,index); updateDisplayList(unscaledWidth,unscaledHeight); var targets:Array = []; var targetHash:Dictionary = new Dictionary(true); // record the initial set of targets for the // data change effect var n:int = listItems.length; var m:int = 0; for (var i:int = 0; i < n; i++) { var rowItems:Array = listItems[i]; if (rowItems && (rowItems.length > 0)) { m = rowItems.length; for (var j:int = 0; j < m; j++) { var target:Object = rowItems[j]; if (target) { targets.push(target); targetHash[target] = true; } } } } cachedDataChangeEffect.targets = targets; if (cachedDataChangeEffect.effectTargetHost != this) cachedDataChangeEffect.effectTargetHost = this; cachedDataChangeEffect.captureStartValues(); // Now get additional targets that are only in endstate modifiedCollectionView.showPreservedState = false; // This is not great from a usability point of view if all the items have // been added offscreen...we're scrolling the view as well. // Also, ideally we wouldn't have to do this seek; the iterator // would notice via events that the modifiedCollectionView had changed iterator.seek(CursorBookmark.FIRST,index); itemsSizeChanged = true; updateDisplayList(unscaledWidth,unscaledHeight); // Acquire additional targets var newTargets:Array = []; var oldTargets:Array = cachedDataChangeEffect.targets; n = listItems.length; for (i = 0; i < n; i++) { rowItems = listItems[i]; if (rowItems && (rowItems.length > 0)) { m = rowItems.length; for (j = 0; j < m; j++) { target = rowItems[j]; if (target && !targetHash[target]) { oldTargets.push(target); newTargets.push(target); } } } } // Get start values for additional targets, // and end values for all targets if (newTargets.length > 0) { cachedDataChangeEffect.targets = oldTargets; cachedDataChangeEffect.captureMoreStartValues(newTargets); } cachedDataChangeEffect.captureEndValues(); // Do the layout for the control one more time, to ensure // that only the items visible before the data change // occurred are visible modifiedCollectionView.showPreservedState = true; iterator.seek(CursorBookmark.FIRST,index); itemsSizeChanged = true; updateDisplayList(unscaledWidth,unscaledHeight); initiateSelectionTracking(oldTargets); // Start the data effect, which will rewind to start state cachedDataChangeEffect.addEventListener(EffectEvent.EFFECT_END,finishDataChangeEffect); cachedDataChangeEffect.play(); } */ /** * @private * Sets up listeners for MoveEvents for a set of renderers. Listeners are only * created for renderers representing selected items. * * This functionality is used by data change effects, to update selections * when the item renderers move. */ /* private function initiateSelectionTracking(renderers:Array):void { var n:int = renderers.length; for (var i:int = 0; i < n; i++) { var renderer:IListItemRenderer = renderers[i] as IListItemRenderer; if (selectedData[itemToUID(renderer.data)]) { renderer.addEventListener(mx.events.MoveEvent.MOVE,rendererMoveHandler); trackedRenderers.push(renderer); } } } */ /** * @private * Removes event listeners for MoveEvents set up by initiateSelectionTracking(). * */ /* private function terminateSelectionTracking():void { var n:int = trackedRenderers.length; for (var i:int = 0; i < n; i++) { var renderer:IListItemRenderer = trackedRenderers[i] as IListItemRenderer; renderer.removeEventListener(mx.events.MoveEvent.MOVE,rendererMoveHandler); } trackedRenderers = []; } */ /** * Removes an item renderer if a data change effect is running. * The item renderer must correspond to data that has already * been removed from the data provider collection. * * This function will be called by a <code>RemoveItemAction</code> * effect as part of a data change effect to specify the point * at which a data item ceases to displayed by the control using * an item renderer. * * @param item The item renderer to remove from the control's layout. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function removeDataEffectItem(item:Object):void { // Shouldn't need to check this, but there // currently appears to be a race condition // (perhaps a bug in when effectEnd occurs) if (modifiedCollectionView) modifiedCollectionView.removeItem(dataItemWrappersByRenderer[item]); // again, this should not really be necessary iterator.seek(CursorBookmark.CURRENT); // force validation, otherwise it can be delayed until the // end of a data effect if (mx_internal::invalidateDisplayListFlag) { itemsSizeChanged = true; validateDisplayList(); } else invalidateList(); } */ /** * Adds an item renderer if a data change effect is running. * The item renderer should correspond to a recently added * data item in the data provider's collection that isn't * yet being displayed. * * This function will be called by an <code>AddItemAction</code> * effect as part of a data change effect to specify the point * at which a data item added to a collection begins to be displayed * by the control using an item renderer. * * @param item The item renderer to add to the control's layout. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function addDataEffectItem(item:Object):void { if (modifiedCollectionView) modifiedCollectionView.addItem(dataItemWrappersByRenderer[item]); // if it was previously empty, set cursor to first item // We shouldn't really have to do this here. if (iterator.afterLast) iterator.seek(CursorBookmark.FIRST) else iterator.seek(CursorBookmark.CURRENT); // force validation, otherwise it can be delayed until the // end of a data effect if (mx_internal::invalidateDisplayListFlag) { itemsSizeChanged = true; validateDisplayList(); } else { invalidateList(); } } */ /** * Temporarily stops an item renderer from being positioned * by the control's layout algorithm. * * This function will be called * as part of a data change effect if the item renderers corresponding * to certain data items need to move outside the normal positions * of item renderers in the control. * * @param item The data for the item renderer. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function unconstrainRenderer(item:Object):void { unconstrainedRenderers[item] = true; } */ /** * Returns the value for a particular semantic property of * an item renderer, or null if that property is not defined, * while a data effect is running. * * This function is used by filters in data change effects * to restrict effects to renderers corresponding to removed * or added data items. * * @param target An item renderer. * * @param semanticProperty The semantic property of the renderer * whose value will be returned. * * @return The value for a particular semantic property of * an item renderer, or null if that property is not defined, * while a data effect is running. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* public function getRendererSemanticValue(target:Object,semanticProperty:String):Object { // this is really only a temporary solution, assuming single boolean semantics // e.g. "removed" or "added" return (modifiedCollectionView.getSemantics(dataItemWrappersByRenderer[target]) == semanticProperty); } */ /** * Returns <code>true</code> if an item renderer is no longer being positioned * by the list's layout algorithm while a data change effect is * running as a result of a call to the <code>unconstrainRenderer()</code> method. * * @param item An item renderer. * * @return <code>true</code> if an item renderer is no longer being positioned * by the list's layout algorithm. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function isRendererUnconstrained(item:Object):Boolean { return (unconstrainedRenderers[item] != null); } */ /** * Cleans up after a data change effect has finished running * by restoring the original collection and iterator and removing * any cached values used by the effect. This method is called by * the Flex framework; you do not need to call it from your code. * * @param event The effect that has finished running. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function finishDataChangeEffect(event:EffectEvent):void { // We are doing a bunch of stuff here, possibly more // than necessary, with the goal of guaranteeing that we leave // the control in an acceptable state. collection = actualCollection; actualCollection = null; modifiedCollectionView = null; iterator = actualIterator; runningDataEffect = false; unconstrainedRenderers = {}; // rendererChanged = true; terminateSelectionTracking(); // at the end of a data effect, in order to make sure we // can re-use the renderers intelligently, we have to // re-key the item renderers in visibleData var newVisibleData:Object = {}; for each (var item:Object in visibleData) if (item.data) newVisibleData[itemToUID(item.data)] = item; visibleData = newVisibleData; // TODO This code seems redundant with the code in cleanupAfterDataChangeEffect(); // need to investigate what's actually needed & where. var index:int = scrollPositionToIndex(horizontalScrollPosition - offscreenExtraColumnsLeft, verticalScrollPosition - offscreenExtraRowsTop); iterator.seek(CursorBookmark.FIRST,index); callLater(cleanupAfterDataChangeEffect); } */ /** * @private * * Initiates a somewhat expensive relayout of the control after finishing up * a data change effect. */ /* private function cleanupAfterDataChangeEffect():void { if (runningDataEffect || runDataEffectNextUpdate) return; var index:int = scrollPositionToIndex(horizontalScrollPosition - offscreenExtraColumnsLeft, verticalScrollPosition - offscreenExtraRowsTop); iterator.seek(CursorBookmark.FIRST,index); dataEffectCompleted = true; itemsSizeChanged = true; //rendererChanged = true; invalidateList(); dataItemWrappersByRenderer = new Dictionary(); } */ /** * Called from the <code>updateDisplayList()</code> method to * adjust the size and position of list content. * * @param unscaledWidth Specifies the width of the component, in pixels, * in the component's coordinates. * * @param unscaledHeight Specifies the height of the component, in pixels, * in the component's coordinates. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function adjustListContent(unscaledWidth:Number = -1, unscaledHeight:Number = -1):void { if (unscaledHeight < 0) { unscaledHeight = oldUnscaledHeight; unscaledWidth = oldUnscaledWidth } var lcx:Number = viewMetrics.left + listContent.leftOffset; var lcy:Number = viewMetrics.top + listContent.topOffset; listContent.move(lcx, lcy); var ww:Number = Math.max(0, listContent.rightOffset) - lcx - viewMetrics.right; var hh:Number = Math.max(0, listContent.bottomOffset) - lcy - viewMetrics.bottom; listContent.setActualSize(unscaledWidth + ww, unscaledHeight + hh); } */ /** * @private * * Called by updateDisplayList() to make adjustments to vertical and * horizontal scroll position. */ /* private function adjustScrollPosition():void { if (!isNaN(horizontalScrollPositionPending)) { var hPos:Number = Math.min(horizontalScrollPositionPending, maxHorizontalScrollPosition); horizontalScrollPositionPending = NaN; super.horizontalScrollPosition = hPos; } if (!isNaN(verticalScrollPositionPending)) { var vPos:Number = Math.min(verticalScrollPositionPending, maxVerticalScrollPosition); verticalScrollPositionPending = NaN; super.verticalScrollPosition = vPos; } } */ /** * @private * * Called by updateDisplayList() to remove existing item renderers * and clean up various caching structures when renderer changes. */ /* protected function purgeItemRenderers():void { rendererChanged = false; while (listItems.length) { var row:Array = listItems.pop(); while (row.length) { var item:IListItemRenderer = IListItemRenderer(row.pop()); if (item) { listContent.removeChild(DisplayObject(item)); if (dataItemWrappersByRenderer[item]) delete visibleData[itemToUID(dataItemWrappersByRenderer[item])]; else delete visibleData[itemToUID(item.data)]; // addToFreeItemRenderers(item); } } } while (freeItemRenderers.length) { var freeRenderer:DisplayObject = DisplayObject(freeItemRenderers.pop()); if (freeRenderer.parent) listContent.removeChild(freeRenderer); } rowMap = {}; rowInfo = []; } */ /** * @private * * Called by updateDisplayList() to remove existing item renderers * and clean up various internal structures at the end of running * a data change effect. */ /* private function partialPurgeItemRenderers():void { dataEffectCompleted = false; // We make sure all free and reserved itemRenderers are de-parented // after a data change effect finishes, and also blow away visibleData // and rowMap. Ideally, this would not be necessary, but it seems // safest at the moment. // Note that the makeRowsAndColumns pass after this function is // called should not make any changes to listItems. while (freeItemRenderers.length) { var freeRenderer:DisplayObject = DisplayObject(freeItemRenderers.pop()); if (freeRenderer.parent) listContent.removeChild(freeRenderer); } for (var p:String in reservedItemRenderers) { freeRenderer = DisplayObject(reservedItemRenderers[p]); if (freeRenderer.parent) listContent.removeChild(freeRenderer); } reservedItemRenderers = {} rowMap = {}; visibleData = {}; } */ /** * @private * * Called by updateDisplayList() */ /* private function reduceRows(rowIndex:int):void { while (rowIndex >= 0) { if (rowInfo[rowIndex].y >= listContent.height) { var colLen:int = listItems[rowIndex].length; for (var j:int = 0; j < colLen; j++) addToFreeItemRenderers(listItems[rowIndex][j]); var uid:String = rowInfo[rowIndex].uid; delete visibleData[uid]; removeIndicators(uid); listItems.pop(); // remove the row rowInfo.pop(); rowIndex--; } else break; } } */ /** * @private * * Called from updateDisplayList() */ /* private function makeAdditionalRows(rowIndex:int):void { var cursorPos:CursorBookmark; // do layout for additional rows if (iterator) { cursorPos = iterator.bookmark; try { iterator.seek(CursorBookmark.CURRENT, listItems.length - lockedRowCount); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(CursorBookmark.CURRENT, listItems.length - lockedRowCount) e.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); // trace("IPE in UpdateDisplayList"); iteratorValid = false; // don't do anything, we'll repaint when the data arrives } } var curY:Number = rowInfo[rowIndex].y + rowInfo[rowIndex].height; // fill it in makeRowsAndColumns(0, curY, listContent.width, listContent.height, 0, rowIndex + 1); // restore iterator to original position seekPositionIgnoreError(iterator,cursorPos); } */ /** * @private * * Called from updateDisplayList() to make adjustments to internal * properties representing selections. */ /* private function adjustSelectionSettings(collectionHasItems:Boolean):void { if (bSelectionChanged) { bSelectionChanged = false; // bSelectedIndexChanged can be true if the dp was reset. // if selectedItem or cousins are also set, we will resolve // selectedIndex in there and therefore don't need to process // it //in each of these cases allow the "unsetting" of a value regardless //of whether the collection has items if (bSelectedIndicesChanged && (collectionHasItems || (_selectedIndices == null))) { bSelectedIndicesChanged = false; bSelectedIndexChanged = false; commitSelectedIndices(_selectedIndices); } if (bSelectedItemChanged && (collectionHasItems || (_selectedItem == null))) { bSelectedItemChanged = false; bSelectedIndexChanged = false; commitSelectedItem(_selectedItem); } if (bSelectedItemsChanged && (collectionHasItems || (_selectedItems == null))) { bSelectedItemsChanged = false; bSelectedIndexChanged = false; commitSelectedItems(_selectedItems); } if (bSelectedIndexChanged && (collectionHasItems || (_selectedIndex == -1))) { commitSelectedIndex(_selectedIndex); bSelectedIndexChanged = false; } } } */ /** * @private * * Called from updateDisplayList() to seek to a cursorPosition while ignoring any errors */ /* private function seekPositionIgnoreError(iterator:IViewCursor, cursorPos:CursorBookmark):void { if (iterator) { try { iterator.seek(cursorPos, 0); } catch (e:ItemPendingError) { // we don't recover here since we'd only get here if the first seek failed. } } } */ /** * @private * * A convenience function to move the iterator to the next position and handle * errors if necessary. */ /* private function seekNextSafely(iterator:IViewCursor, pos:int):Boolean { try { iterator.moveNext(); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, pos) e.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; } // assumption is that iteratorValid was true when we were called. return iteratorValid; } */ /* private function seekPreviousSafely(iterator:IViewCursor, pos:int):Boolean { try { iterator.movePrevious(); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, pos) e.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; } // assumption is that iteratorValid was true when we were called. return iteratorValid; } */ // TODO make this mx_internal? /** * @private */ /* protected function seekPositionSafely(index:int):Boolean { try { iterator.seek(CursorBookmark.FIRST, index); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, index); e.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; } return iteratorValid; } */ /** * @private * for automation delegate access */ /* mx_internal function getListVisibleData():Object { return visibleData; } */ /** * @private * for automation delegate access */ /* mx_internal function getItemUID(data:Object):String { return itemToUID(data); } */ /** * @private * for automation delegate access */ /* mx_internal function getItemRendererForMouseEvent(event:MouseEvent):IListItemRenderer { return mouseEventToItemRenderer(event); } */ /** * @private * for automation delegate access */ /* mx_internal function getListContentHolder():AdvancedListBaseContentHolder { return listContent; } */ /** * @private * for automation delegate access */ /* mx_internal function getRowInfo():Array { return rowInfo; } */ /** * @private * for automation delegate access */ /* mx_internal function convertIndexToRow(index:int):int { return indexToRow(index); } */ /** * @private * for automation delegate access */ /* mx_internal function convertIndexToColumn(index:int):int { return indexToColumn(index); } */ /** * @private * for automation delegate access */ /* mx_internal function getCaretIndex():int { return caretIndex; } */ /** * @private * for automation delegate access */ /* mx_internal function getIterator():IViewCursor { return iterator; } */ /** * @private * Move the indicators up or down by the given offset. * This method assumes that all the selection indicators in * this row are at the same 'y' position. */ /* protected function moveIndicators(uid:String, offset:int, absolute:Boolean):void { if (selectionIndicators[uid]) { if (absolute) selectionIndicators[uid].y = offset; else selectionIndicators[uid].y += offset; } if (highlightUID == uid) { if (absolute) highlightIndicator.y = offset; else highlightIndicator.y += offset; } if (caretUID == uid) { if (absolute) caretIndicator.y = offset; else caretIndicator.y += offset; } } */ /** * Internal version of setting columnWidth * without invalidation or notification. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* mx_internal function setColumnWidth(value:Number):void { _columnWidth = value; } */ /** * Sets the <code>rowCount</code> property without causing * invalidation or setting the <code>explicitRowCount</code> * property, which permanently locks in the number of rows. * * @param v The row count. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function setRowCount(v:int):void { //trace("setRowCount " + v); _rowCount = v; } */ /** * Sets the <code>rowHeight</code> property without causing invalidation or * setting of <code>explicitRowHeight</code> which * permanently locks in the height of the rows. * * @param v The row height, in pixels. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function setRowHeight(v:Number):void { _rowHeight = v; } */ //-------------------------------------------------------------------------- // // Overridden event handlers: UIComponent // //-------------------------------------------------------------------------- /** * @private */ /* override protected function keyDownHandler(event:KeyboardEvent):void { if (!selectable) return; if (!iteratorValid) return; if (!collection) return; switch (event.keyCode) { case Keyboard.UP: case Keyboard.DOWN: { moveSelectionVertically( event.keyCode, event.shiftKey, event.ctrlKey); event.stopPropagation(); break; } case Keyboard.LEFT: case Keyboard.RIGHT: { moveSelectionHorizontally( event.keyCode, event.shiftKey, event.ctrlKey); event.stopPropagation(); break; } case Keyboard.END: case Keyboard.HOME: case Keyboard.PAGE_UP: case Keyboard.PAGE_DOWN: { moveSelectionVertically( event.keyCode, event.shiftKey, event.ctrlKey); event.stopPropagation(); break; } case Keyboard.SPACE: { if (caretIndex != -1 && ((caretIndex - verticalScrollPosition + lockedRowCount) >= 0) && ((caretIndex - verticalScrollPosition + lockedRowCount) < listItems.length)) { var li:IListItemRenderer = listItems[caretIndex - verticalScrollPosition + lockedRowCount][0]; if (selectItem(li, event.shiftKey, event.ctrlKey)) { var pt:Point = itemRendererToIndices(li); var evt:ListEvent = new ListEvent(ListEvent.CHANGE); if (pt) { evt.columnIndex = pt.x; evt.rowIndex = pt.y; } evt.itemRenderer = li; dispatchEvent(evt); } } break; } default: { if (findKey(event.charCode)) event.stopPropagation(); } } } */ /** * Handles <code>mouseWheel</code> events by changing scroll positions. * This is a copy of the version in the ScrollControlBase class, * modified to change the <code>horizontalScrollPosition</code> property * if the target is run horizontally. * * @param event The MouseEvent object. * * @see mx.core.ScrollControlBase#mouseWheelHandler() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* override protected function mouseWheelHandler(event:MouseEvent):void { if (verticalScrollBar && verticalScrollBar.visible) { event.stopPropagation(); var oldPosition:Number = verticalScrollPosition; var newPos:int = verticalScrollPosition; newPos -= event.delta * verticalScrollBar.lineScrollSize; newPos = Math.max(0, Math.min(newPos, verticalScrollBar.maxScrollPosition)); verticalScrollPosition = newPos; if (oldPosition != verticalScrollPosition) { var scrollEvent:ScrollEvent = new ScrollEvent(ScrollEvent.SCROLL); scrollEvent.direction = ScrollEventDirection.VERTICAL; scrollEvent.position = verticalScrollPosition; scrollEvent.delta = verticalScrollPosition - oldPosition; dispatchEvent(scrollEvent); } } } */ //-------------------------------------------------------------------------- // // Event handlers // //-------------------------------------------------------------------------- /** * Handles CollectionEvents dispatched from the data provider * as the data changes. * Updates the renderers, selected indices and scrollbars as needed. * * @param event The CollectionEvent. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function collectionChangeHandler(event:Event):void { var len:int; var i:int; var n:int; var data:ListBaseSelectionData; var p:String; var selectedUID:String; if (event is CollectionEvent) { var ce:CollectionEvent = CollectionEvent(event); // trace("ListBase collectionEvent", ce.kind); if (ce.kind == CollectionEventKind.ADD) { prepareDataEffect(ce); // trace("ListBase collectionEvent ADD", ce.location, verticalScrollPosition); // special case when we have less than a screen full of stuff if (ce.location == 0 && verticalScrollPosition == 0) { try { // trace("ListBase collectionEvent ADD adjust"); iterator.seek(CursorBookmark.FIRST); } catch (e:ItemPendingError) { // trace("IPE in ADD event"); lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, 0) e.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; // do nothing, we'll repaint when the data arrives } } else if (listType == "vertical" && verticalScrollPosition >= ce.location) { super.verticalScrollPosition = super.verticalScrollPosition + ce.items.length; } len = ce.items.length; for (p in selectedData) { data = selectedData[p]; if (data.index > ce.location) data.index += len; } if (_selectedIndex >= ce.location) { _selectedIndex += len; dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); } } else if (ce.kind == CollectionEventKind.REPLACE) { // trace("ListBase collectionEvent REPLACE"); selectedUID = selectedItem ? itemToUID(selectedItem) : null; n = ce.items.length; for (i = 0; i < n; i++) { var oldUID:String = itemToUID(ce.items[i].oldValue); var sd:ListBaseSelectionData = selectedData[oldUID]; if (sd) { sd.data = ce.items[i].newValue; delete selectedData[oldUID]; selectedData[itemToUID(sd.data)] = sd; if (selectedUID == oldUID) { _selectedItem = sd.data; dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); } } } prepareDataEffect(ce); } else if (ce.kind == CollectionEventKind.REMOVE) { prepareDataEffect(ce); var requiresValueCommit:Boolean = false; // trace("ListBase collectionEvent REMOVE", ce.location, verticalScrollPosition); // make sure we've generated rows for the actual data // at startup time we might just have blank rows if (listItems.length && listItems[lockedRowCount].length) { // special case when we have less than a screen full of stuff var firstUID:String = rowMap[listItems[lockedRowCount][0].name].uid; selectedUID = selectedItem ? itemToUID(selectedItem) : null; n = ce.items.length; for (i = 0; i < n; i++) { var uid:String = itemToUID(ce.items[i]); if (uid == firstUID && verticalScrollPosition == 0) { try { iterator.seek(CursorBookmark.FIRST); } catch (e1:ItemPendingError) { // trace("IPE in REMOVE event"); lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, 0) e1.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; // do nothing, we'll repaint when the data arrives } } if (selectedData[uid]) removeSelectionData(uid); if (selectedUID == uid) { _selectedItem = null; _selectedIndex = -1; requiresValueCommit = true; } removeIndicators(uid); } // Decrement verticalScrollPosition by the number of items that have // been removed from the top. if (listType == "vertical" && verticalScrollPosition >= ce.location) { if (verticalScrollPosition > ce.location) { super.verticalScrollPosition = verticalScrollPosition - Math.min(ce.items.length, verticalScrollPosition - ce.location); } else { // else the underlying collection goes to invalid cuz we removed the current // so we force a re-seek next, but we want to keep everything in range if (verticalScrollPosition >= collection.length) super.verticalScrollPosition = Math.max(collection.length - 1, 0); } try { offscreenExtraRowsTop = Math.min(offscreenExtraRowsTop, verticalScrollPosition); iterator.seek(CursorBookmark.FIRST, verticalScrollPosition - offscreenExtraRowsTop); } catch (e2:ItemPendingError) { // trace("IPE in Remove 2"); lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, verticalScrollPosition - offscreenExtraRowsTop) e2.addResponder(new ItemResponder(seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; // do nothing, we'll repaint when the data arrives } } var emitEvent:Boolean = adjustAfterRemove(ce.items, ce.location, requiresValueCommit); if (emitEvent) dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); } } else if (ce.kind == CollectionEventKind.MOVE) { if (ce.oldLocation < ce.location) { for (p in selectedData) { data = selectedData[p]; if (data.index > ce.oldLocation && data.index < ce.location) data.index --; else if (data.index == ce.oldLocation) data.index = ce.location; } if (_selectedIndex > ce.oldLocation && _selectedIndex < ce.location) _selectedIndex --; else if (_selectedIndex == ce.oldLocation) _selectedIndex = ce.location; } else if (ce.location < ce.oldLocation) { for (p in selectedData) { data = selectedData[p]; if (data.index > ce.location && data.index < ce.oldLocation) data.index ++; else if (data.index == ce.oldLocation) data.index = ce.location; } if (_selectedIndex > ce.location && _selectedIndex < ce.oldLocation) _selectedIndex ++; else if (_selectedIndex == ce.oldLocation) _selectedIndex = ce.location; } // if the current item got moved if (ce.oldLocation == verticalScrollPosition) { // iterator is at new position, jump to it, // but make sure we don't max out first if (ce.location > maxVerticalScrollPosition) { iterator.seek(CursorBookmark.CURRENT, maxVerticalScrollPosition - ce.location); } super.verticalScrollPosition = Math.min(ce.location, maxVerticalScrollPosition); } // if the old location and new location are on // different sides of the scrollposition else if ((ce.location >= verticalScrollPosition) && (ce.oldLocation < verticalScrollPosition)) seekNextSafely(iterator,verticalScrollPosition); else if ((ce.location <= verticalScrollPosition) && (ce.oldLocation > verticalScrollPosition)) seekPreviousSafely(iterator,verticalScrollPosition); } else if (ce.kind == CollectionEventKind.REFRESH) { if (anchorBookmark) { try { iterator.seek(anchorBookmark, 0); } catch (e:ItemPendingError) { bSortItemPending = true; lastSeekPending = new ListBaseSeekPending(anchorBookmark, 0); e.addResponder(new ItemResponder( seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); // trace("IPE in UpdateDisplayList"); iteratorValid = false; } catch (cursorError:CursorError) { // might have been filtered out so // clear selections clearSelected(); } adjustAfterSort(); } else { try { iterator.seek(CursorBookmark.FIRST, verticalScrollPosition); } catch (e:ItemPendingError) { bSortItemPending = true; lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, verticalScrollPosition) e.addResponder(new ItemResponder( seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); // trace("IPE in UpdateDisplayList"); iteratorValid = false; } } } else if (ce.kind == CollectionEventKind.RESET) { // RemoveAll() on ArrayCollection currently triggers a reset // Special handling for this case. if ((collection.length == 0) || (runningDataEffect && actualCollection.length == 0)) { // All the data is already gone, so in order to run a data // effect, we reconstruct it from the renderers var deletedItems:Array = reconstructDataFromListItems(); if (deletedItems.length) { var fakeRemove:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE); fakeRemove.kind = CollectionEventKind.REMOVE; fakeRemove.items = deletedItems; fakeRemove.location = 0; prepareDataEffect(fakeRemove); } } try { iterator.seek(CursorBookmark.FIRST); collectionIterator.seek(CursorBookmark.FIRST); } catch (e:ItemPendingError) { lastSeekPending = new ListBaseSeekPending(CursorBookmark.FIRST, 0); e.addResponder(new ItemResponder( seekPendingResultHandler, seekPendingFailureHandler, lastSeekPending)); iteratorValid = false; } if (bSelectedIndexChanged || bSelectedItemChanged || bSelectedIndicesChanged || bSelectedItemsChanged) { bSelectionChanged = true; } else { commitSelectedIndex(-1); } if (isNaN(verticalScrollPositionPending)) { verticalScrollPositionPending = 0; super.verticalScrollPosition = 0; } if (isNaN(horizontalScrollPositionPending)) { horizontalScrollPositionPending = 0; super.horizontalScrollPosition = 0; } invalidateSize(); } } itemsSizeChanged = true; invalidateDisplayList(); } */ /** * @private * Reconstructs an array of items for a pseudo-data provider. Used to * leverage the data effects infrastructure after removeAll() has been * called on the data provider. * * Subclasses may need to override this function, e.g. for TileLists * with vertical layout. */ /* mx_internal function reconstructDataFromListItems():Array { if (!listItems) return []; var items:Array = []; // might make sense to ignore offscreen rows here var n:int = listItems.length; for (var i:int = 0; i < n; i++) { if (listItems[i]) { var renderer:IListItemRenderer = listItems[i][0] as IListItemRenderer; var data:Object; var data2:Object; if (renderer) { data = renderer.data; items.push(data); var m:int = listItems[i].length; for (var j:int = 0; j < m; j++) { renderer = listItems[i][j] as IListItemRenderer; if (renderer) { data2 = renderer.data; if (data2 != data) items.push(data2); } } } } } return items; } */ /** * @private */ /* protected function prepareDataEffect(ce:CollectionEvent):void { if (!cachedDataChangeEffect) { // Style can set dataChangeEffect to an Effect object // or a Class which is a subclass of Effect var dce:Object = getStyle("dataChangeEffect"); var dceClass:Class = dce as Class; if (dceClass) dce = new dceClass(); cachedDataChangeEffect = dce as Effect; } if (runningDataEffect) { collection = actualCollection; iterator = actualIterator; cachedDataChangeEffect.end(); modifiedCollectionView = null; } // For now, if iterator is not valid, don't run the data effect. if (cachedDataChangeEffect && iteratorValid) { var firstItemIndex:int = iterator.bookmark.getViewIndex(); var lastItemIndex:int = firstItemIndex + (rowCount * columnCount) - 1; if (!modifiedCollectionView && (collection is IList)) modifiedCollectionView = new ModifiedCollectionView(ICollectionView(collection)); if (modifiedCollectionView) { modifiedCollectionView.processCollectionEvent(ce, firstItemIndex, lastItemIndex); runDataEffectNextUpdate = true; if (mx_internal::invalidateDisplayListFlag) callLater(invalidateList); else invalidateList(); } } } */ /** * @private */ /* protected function adjustAfterRemove(items:Array, location:int, emitEvent:Boolean):Boolean { var data:ListBaseSelectionData; var requiresValueCommit:Boolean = emitEvent; var i:int = 0; var length:int = items.length; for (var p:String in selectedData) { i++; data = selectedData[p]; if (data.index > location) data.index -= length; } if (_selectedIndex > location) { _selectedIndex -= length; requiresValueCommit = true; } // selected the last thing if the selected item // got removed. if (i > 0 && _selectedIndex == -1) { _selectedIndex = data.index; _selectedItem = data.data; requiresValueCommit = true; } if (i == 0) { _selectedIndex = -1; bSelectionChanged = true; bSelectedIndexChanged = true; invalidateDisplayList(); } return requiresValueCommit; } */ /** * Handles <code>MouseEvent.MOUSE_OVER</code> events from any mouse * targets contained in the list, including the renderers. * This method finds out which renderer the mouse is over * and shows it as highlighted. * * <p>The list classes also call this from a * <code>MouseEvent.MOUSE_MOVE</code> event. * This event is used to detect movement in non-target areas of the * renderers and in padded areas around the renderers.</p> * * @param event The MouseEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function mouseOverHandler(event:MouseEvent):void { var evt:ListEvent; if (!enabled || !selectable) return; if (dragScrollingInterval != 0 && !event.buttonDown) { // trace("mouseOver found mouse not pressed but dragInterval"); mouseIsUp(); } isPressed = event.buttonDown; var item:IListItemRenderer = mouseEventToItemRenderer(event); var pt:Point = itemRendererToIndices(item); if (!item) return; var uid:String = itemToUID(item.data); if (!isPressed || allowDragSelection) { // we're rolling onto different subpieces of ourself or our highlight indicator if (event.relatedObject) { var lastUID:String; if (lastHighlightItemRenderer && highlightUID) { var rowData:BaseListData = rowMap[item.name]; lastUID = rowData.uid; } if (itemRendererContains(item, event.relatedObject) || uid == lastUID || event.relatedObject == highlightIndicator) return; } if (getStyle("useRollOver") && (item.data != null)) { if (allowDragSelection) bSelectOnRelease = true; drawItem(visibleData[uid], isItemSelected(item.data), true, uid == caretUID); if (pt) // during tweens, we may get null { evt = new ListEvent(ListEvent.ITEM_ROLL_OVER); evt.columnIndex = pt.x; evt.rowIndex = pt.y; evt.itemRenderer = item; dispatchEvent(evt); lastHighlightItemIndices = pt; lastHighlightItemRendererAtIndices = item; } } } else { if (DragManager.isDragging) return; if ((dragScrollingInterval != 0 && allowDragSelection) || menuSelectionMode) { if (selectItem(item, event.shiftKey, event.ctrlKey)) { evt = new ListEvent(ListEvent.CHANGE); evt.itemRenderer = item; if (pt) { evt.columnIndex = pt.x; evt.rowIndex = pt.y; } dispatchEvent(evt); } } } } */ /** * Handles <code>MouseEvent.MOUSE_OUT</code> events from any mouse targets * contained in the list including the renderers. This method * finds out which renderer the mouse has left * and removes the highlights. * * @param event The MouseEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function mouseOutHandler(event:MouseEvent):void { if (!enabled || !selectable) return; isPressed = event.buttonDown; var item:IListItemRenderer = mouseEventToItemRenderer(event); if (!item) return; if (!isPressed) { // either we're rolling onto different subpieces of ourself or our // highlight indicator, or the clearing of the highlighted item has // already happened care of the mouseMove handler if (itemRendererContains(item, event.relatedObject) || event.relatedObject == listContent || event.relatedObject == highlightIndicator || !highlightItemRenderer) return; if (getStyle("useRollOver") && item.data != null) clearHighlight(item); } } */ /** * Handles <code>MouseEvent.MOUSE_MOVE</code> events from any mouse * targets contained in the list including the renderers. This method * watches for a gesture that constitutes the beginning of a * drag drop and send a <code>DragEvent.DRAG_START</code> event. * It also checks to see if the mouse is over a non-target area of a * renderer so that Flex can try to make it look like that renderer was * the target. * * @param event The MouseEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function mouseMoveHandler(event:MouseEvent):void { if (!enabled || !selectable) return; var pt:Point = new Point(event.localX, event.localY); pt = DisplayObject(event.target).localToGlobal(pt); pt = globalToLocal(pt); if (isPressed && mouseDownPoint && (Math.abs(mouseDownPoint.x - pt.x) > DRAG_THRESHOLD || Math.abs(mouseDownPoint.y - pt.y) > DRAG_THRESHOLD)) { if (dragEnabled && !DragManager.isDragging && mouseDownPoint) { var dragEvent:DragEvent = new DragEvent(DragEvent.DRAG_START); dragEvent.dragInitiator = this; dragEvent.localX = mouseDownPoint.x; dragEvent.localY = mouseDownPoint.y; dragEvent.buttonDown = true; dispatchEvent(dragEvent); } } // we used to put shields into each of the renderers so leftover space was hittable // but that's makes too many shields at startup and scrolling. The gamble is that we // can run the code even on a large grid very quickly compared to mouse move intervals. var item:IListItemRenderer = mouseEventToItemRenderer(event); if (item && highlightItemRenderer) { var rowData:BaseListData = rowMap[item.name]; if (highlightItemRenderer && highlightUID && rowData.uid != highlightUID) { if (!isPressed) { if (getStyle("useRollOver") && highlightItemRenderer.data != null) { clearHighlight(highlightItemRenderer) } } } } else if (!item && highlightItemRenderer) { if (!isPressed) { if (getStyle("useRollOver") && highlightItemRenderer.data) { clearHighlight(highlightItemRenderer) } } } if (item && !highlightItemRenderer) { mouseOverHandler(event); } } */ /** * Handles <code>MouseEvent.MOUSE_DOWN</code> events from any mouse * targets contained in the list including the renderers. This method * finds the renderer that was pressed and prepares to receive * a <code>MouseEvent.MOUSE_UP</code> event. * * @param event The MouseEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function mouseDownHandler(event:MouseEvent):void { if (!enabled || !selectable) return; // trace("mouseDown"); isPressed = true; var item:IListItemRenderer = mouseEventToItemRenderer(event); if (!item) return; bSelectOnRelease = false; var pt:Point = new Point(event.localX, event.localY); pt = DisplayObject(event.target).localToGlobal(pt); mouseDownPoint = globalToLocal(pt); systemManager.getSandboxRoot().addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true, 0, true); systemManager.getSandboxRoot().addEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE, mouseLeaveHandler, false, 0, true); if (!dragEnabled) { dragScrollingInterval = setInterval(dragScroll, 15); } if (dragEnabled) mouseDownIndex = itemRendererToIndex(item); // If dragEnabled is true, clicks on selected contents should cause // a selection change on mouse up instead of mouse down. Otherwise, // clicking in a selection to drag will deselect any multiple selection // before the drag occurs. if (dragEnabled && selectedData[rowMap[item.name].uid]) { bSelectOnRelease = true; } else { if (selectItem(item, event.shiftKey, event.ctrlKey)) mouseDownItem = item; } } */ /* private function mouseIsUp():void { systemManager.getSandboxRoot().removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true); systemManager.getSandboxRoot().removeEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE, mouseLeaveHandler); if (!dragEnabled && dragScrollingInterval != 0) { clearInterval(dragScrollingInterval); dragScrollingInterval = 0; } } */ /* private function mouseLeaveHandler(event:Event):void { mouseDownPoint = null; mouseDownIndex = -1; mouseIsUp(); if (!enabled || !selectable) return; if (mouseDownItem) { var evt:ListEvent = new ListEvent(ListEvent.CHANGE); evt.itemRenderer = mouseDownItem; var pt:Point = itemRendererToIndices(mouseDownItem); if (pt) { evt.columnIndex = pt.x; evt.rowIndex = pt.y; } dispatchEvent(evt); mouseDownItem = null; } isPressed = false; } */ /** * Handles <code>MouseEvent.MOUSE_DOWN</code> events from any mouse * targets contained in the list including the renderers. This method * finds the renderer that was pressed and prepares to receive * a <code>MouseEvent.MOUSE_UP</code> event. * * @param event The MouseEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function mouseUpHandler(event:MouseEvent):void { mouseDownPoint = null; mouseDownIndex = -1; //trace("mouseUp"); var item:IListItemRenderer = mouseEventToItemRenderer(event); var pt:Point = itemRendererToIndices(item); var evt:ListEvent; mouseIsUp(); if (!enabled || !selectable) return; if (mouseDownItem) { evt = new ListEvent(ListEvent.CHANGE); evt.itemRenderer = mouseDownItem; pt = itemRendererToIndices(mouseDownItem); if (pt) { evt.columnIndex = pt.x; evt.rowIndex = pt.y; } dispatchEvent(evt); mouseDownItem = null; } if (!item || !hitTestPoint(event.stageX, event.stageY)) { isPressed = false; return; } if (bSelectOnRelease) { bSelectOnRelease = false; if (selectItem(item, event.shiftKey, event.ctrlKey)) { evt = new ListEvent(ListEvent.CHANGE); evt.itemRenderer = item; if (pt) { evt.columnIndex = pt.x; evt.rowIndex = pt.y; } dispatchEvent(evt); } } isPressed = false; } */ /** * Handles <code>MouseEvent.MOUSE_CLICK</code> events from any mouse * targets contained in the list including the renderers. This method * determines which renderer was clicked * and dispatches a <code>ListEvent.ITEM_CLICK</code> event. * * @param event The MouseEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function mouseClickHandler(event:MouseEvent):void { var item:IListItemRenderer = mouseEventToItemRenderer(event); if (!item) return; var pt:Point = itemRendererToIndices(item); if (pt) // during tweens, we may get null { var listEvent:ListEvent = new ListEvent(ListEvent.ITEM_CLICK); listEvent.columnIndex = pt.x; listEvent.rowIndex = pt.y; listEvent.itemRenderer = item; dispatchEvent(listEvent); } } */ /** * Handles <code>MouseEvent.MOUSE_DOUBLE_CLICK</code> events from any * mouse targets contained in the list including the renderers. * This method determines which renderer was clicked * and dispatches a <code>ListEvent.ITEM_DOUBLE_CLICK</code> event. * * @param event The MouseEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function mouseDoubleClickHandler(event:MouseEvent):void { var item:IListItemRenderer = mouseEventToItemRenderer(event); if (!item) return; var pt:Point = itemRendererToIndices(item); if (pt) // during tweens, we may get null { var listEvent:ListEvent = new ListEvent(ListEvent.ITEM_DOUBLE_CLICK); listEvent.columnIndex = pt.x; listEvent.rowIndex = pt.y; listEvent.itemRenderer = item; dispatchEvent(listEvent); } } */ /** * The default handler for the <code>dragStart</code> event. * * @param event The DragEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function dragStartHandler(event:DragEvent):void { if (event.isDefaultPrevented()) return; var dragSource:DragSource = new DragSource(); addDragData(dragSource); DragManager.doDrag(this, dragSource, event, dragImage, 0, 0, 0.5, dragMoveEnabled); } */ /** * Handles <code>DragEvent.DRAG_ENTER</code> events. This method * determines if the DragSource object contains valid elements and uses * the <code>showDropFeedback()</code> method to set up the UI feedback. * * @param event The DragEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function dragEnterHandler(event:DragEvent):void { if (event.isDefaultPrevented()) return; lastDragEvent = event; if (enabled && iteratorValid && (event.dragSource.hasFormat("items") || event.dragSource.hasFormat("itemsByIndex"))) { DragManager.acceptDragDrop(this); DragManager.showFeedback(event.ctrlKey ? DragManager.COPY : DragManager.MOVE); showDropFeedback(event); return; } hideDropFeedback(event); DragManager.showFeedback(DragManager.NONE); } */ /** * Handles <code>DragEvent.DRAG_OVER</code> events. This method * determines if the DragSource object contains valid elements and uses * the <code>showDropFeedback()</code> method to set up the UI feeback. * * @param event The DragEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function dragOverHandler(event:DragEvent):void { if (event.isDefaultPrevented()) return; lastDragEvent = event; if (enabled && iteratorValid && (event.dragSource.hasFormat("items") || event.dragSource.hasFormat("itemsByIndex"))) { DragManager.showFeedback(event.ctrlKey ? DragManager.COPY : DragManager.MOVE); showDropFeedback(event); return; } hideDropFeedback(event); DragManager.showFeedback(DragManager.NONE); } */ /** * Handles <code>DragEvent.DRAG_EXIT</code> events. This method hides * the UI feeback by calling the <code>hideDropFeedback()</code> method. * * @param event The DragEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function dragExitHandler(event:DragEvent):void { if (event.isDefaultPrevented()) return; lastDragEvent = null; hideDropFeedback(event); resetDragScrolling(); DragManager.showFeedback(DragManager.NONE); } */ /** * Handles <code>DragEvent.DRAG_DROP events</code>. This method hides * the UI feeback by calling the <code>hideDropFeedback()</code> method. * * @param event The DragEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function dragDropHandler(event:DragEvent):void { if (event.isDefaultPrevented()) return; hideDropFeedback(event); lastDragEvent = null; resetDragScrolling(); if (!enabled) return; var dragSource:DragSource = event.dragSource; if (!dragSource.hasFormat("items") && !dragSource.hasFormat("itemsByIndex")) return; if (!dataProvider) // Create an empty collection to drop items into. dataProvider = []; var dropIndex:int = calculateDropIndex(event); if (dragSource.hasFormat("items")) insertItems(dropIndex, dragSource, event); else insertItemsByIndex(dropIndex, dragSource, event); lastDragEvent = null; } */ /** * Handles <code>DragEvent.DRAG_COMPLETE</code> events. This method * removes the item from the data provider. * * @param event The DragEvent object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ /* protected function dragCompleteHandler(event:DragEvent):void { isPressed = false; if (event.isDefaultPrevented()) return; if (event.action == DragManager.MOVE && dragMoveEnabled) { if (event.relatedObject != this) { var indices:Array = selectedIndices; // clear the selection, otherwise we'll be adjusting it on every element being removed clearSelected(false); indices.sort(Array.NUMERIC); var n:int = indices.length; for (var i:int = n - 1; i >= 0; i--) { collectionIterator.seek(CursorBookmark.FIRST, indices[i]); collectionIterator.remove(); } clearSelected(false); } } // this can probably be removed b/c it's in dragExit and dragDrop, but leaving these two // lines for now lastDragEvent = null; resetDragScrolling(); } */ /** * @private */ /* private function selectionTween_updateHandler(event:TweenEvent):void { Sprite(event.target.listener).alpha = Number(event.value); } */ /** * @private */ /* private function selectionTween_endHandler(event:TweenEvent):void { selectionTween_updateHandler(event); } */ /** * @private * Handles item renderers moving after initiateSelectionTracking() has been * called. This is used during data effects to redraw selections after * item renderers move. * */ /* private function rendererMoveHandler(event:MoveEvent):void { var renderer:IListItemRenderer = event.currentTarget as IListItemRenderer; // currently, the assumption is that this is only called for renderers that // are representing selected items. drawItem(renderer,true); } */ } }
package com.utilities { import flash.display.Bitmap; import flash.display.Sprite; import flash.events. *; import flash.utils.Timer; /** * ... * @author Ian Stokes www.unit2design.com 2010 */ public class Clock extends Sprite { public var Bitz : Bitmap = new Bitmap (); public var capsule : Sprite = new Sprite (); private var maxFrame : Number = 0; private var seqAr : Array = new Array (); private var _externalArt : Object; private var storedLength : Number = 0; private var _accel : Number = 0; private var _myTm : Timer; private var _numzArray : Array = new Array (); private var _targetScore : Number = 0; private var _minutes : Number = 0; private var _seconds : Number = 0; private var _milliseconds : Number = 0; private var _tm : Timer; private var secondsKill : Boolean = false; private var _flashCounter : Boolean = false; private var _ten : Number = 0; public static const LEVELEND_EVENT:String = "level end"; public function Clock ( incomingTime : String, externalArt : Object, parent : Sprite, loc : Object) : void { _ten = 0; this.name = "clock"; _externalArt = externalArt; prepareFrames (externalArt); parent.addChild (capsule); for (var cnt : Number = 0; cnt < incomingTime.length; cnt ++) { if (String (incomingTime.substr (cnt, 1)) == ":") { var tempBit : Bitmap = new Bitmap (_externalArt [11]) }else { tempBit = new Bitmap (_externalArt [10]); } tempBit.x += cnt * ((tempBit.width / 2) + 5); _numzArray.push (tempBit); capsule.addChild (tempBit); capsule.x = loc.x; capsule.y = loc.y; storedLength = cnt; } _tm = new Timer (10); _tm.addEventListener (TimerEvent.TIMER, counter); trace("clock setup"); } public function startClock (str : String) : void { _milliseconds = Number (str.substr (str.length - 2, 2)); _seconds = Number (str.substr (str.length - 5, 2)); _minutes = Number (str.substr (0, 2)); if (_minutes < 1) { secondsKill = true; }else { secondsKill = false; } _tm.start (); } public function condimentBoost():void{ _seconds += ((Math.random() * 4) + 1); } public function dockTime():void { if(_seconds>5){ _seconds-=5} } public function reset(event:Event=null):void{ _tm.stop (); _tm.reset(); _milliseconds = 0; _seconds = 0; _minutes = 0 counter (event); } public function stopClock () : void { _tm.stop (); //dispatchEvent(new Event(LEVELEND_EVENT, true)); } public function get tm () : Timer { return _tm } public function pause (bol : Boolean) : void { if (bol) { _tm.stop (); }else { _tm.start (); } } public function resetClock (str : String) : void { _tm.stop (); /// _tm.start (); } private function test () : void { } public function counter (event :Event=null) : void { _milliseconds -= 1; if (_milliseconds > 0) { }else { _seconds -= 1; if(_seconds<6){ //Main.frameSounds["tick"].play() } _ten += 1; if (_ten > 9) { flashIt (); _ten = 0; } _milliseconds = 59; } if (_milliseconds < 10) { var millTemp : String = "0" + _milliseconds }else { millTemp = String (_milliseconds) } ///// if (_seconds > 0) { }else { _minutes -= 1 if ( ! secondsKill) { _seconds = 59; } } if (_seconds < 10) { var secTemp : String = "0" + _seconds; }else { secTemp = String (_seconds); } if (_minutes > 0) { }else { secondsKill = true; _minutes = 0; } if (_minutes < 10) { var minTemp : String = "0" + _minutes; }else { minTemp = String (_minutes) } if (_minutes < 1 && _seconds < 1) { stopClock (); _minutes = 0; minTemp = String (_minutes); _seconds = 0; secTemp = String (_seconds); _milliseconds = 0; millTemp = String (_milliseconds); } _numzArray [0].bitmapData = _externalArt [Number (minTemp.substr (0, 1))]; _numzArray [1].bitmapData = _externalArt [Number (minTemp.substr (1, 1))]; _numzArray [3].bitmapData = _externalArt [Number (secTemp.substr (0, 1))]; _numzArray [4].bitmapData = _externalArt [Number (secTemp.substr (1, 1))]; //_numzArray [6].bitmapData = _externalArt [Number (millTemp.substr (0, 1))]; //_numzArray [7].bitmapData = _externalArt [Number (millTemp.substr (1, 1))]; } public function prepareFrames (dataWrap : Object) : void { for (var bit : String in dataWrap) { maxFrame ++; seqAr.push (dataWrap ["bit" + maxFrame]); } Bitz.smoothing = false; } public function kill () : void { if (_myTm) { _myTm.stop (); } capsule.parent.removeChild (capsule); } public function get minutes():Number { return _minutes; } public function get seconds():Number { return _seconds; } private function flasher (event : Event) : void { if ( ! _flashCounter) { //ColorBox.tint (capsule, 0xFF0000, 150) _flashCounter = true }else { //ColorBox.colorReset (capsule) _flashCounter = false } } private function flashIt () : void { //_game.SFX ("clockflash") var flashz : Timer = new Timer (20, 6) flashz.addEventListener (TimerEvent.TIMER, flasher) flashz.start () } public function displayTime(str:String):void { _tm.stop (); _tm.reset(); _milliseconds = Number (str.substr (str.length - 2, 2)); _seconds = Number (str.substr (str.length - 5, 2)); _minutes = Number (str.substr (0, 2)); if (_minutes < 1) { secondsKill = true; }else { secondsKill = false; } //_tm.start () counter (); } public function start():void { _tm.start (); } } }
package cmodule.lua_wrapper { public const _fscanf:int = regFunc(FSM_fscanf.start); }
package com.company.assembleegameclient.objects { import flash.display.BitmapData; import flash.geom.ColorTransform; import kabam.rotmg.stage3D.GraphicsFillExtra; public class StatusFlashDescription { public function StatusFlashDescription(param1:int, param2:uint, param3:int) { super(); this.startTime_ = param1; this.color_ = param2; this.duration_ = param3 * 1000; this.targetR = param2 >> 16 & 255; this.targetG = param2 >> 8 & 255; this.targetB = param2 & 255; this.curTime = 0; } public var startTime_:int; public var color_:uint; public var periodMS_:int; public var repeats_:int; public var duration_:int; public var percentDone:Number; public var curTime:Number; public var targetR:int; public var targetG:int; public var targetB:int; public function apply(param1:BitmapData, param2:int):BitmapData { var _loc3_:BitmapData = param1.clone(); var _loc4_:int = (param2 - this.startTime_) % this.duration_; var _loc5_:Number = Math.abs(Math.sin(_loc4_ / this.duration_ * 3.14159265358979 * (this.percentDone * 10))); var _loc6_:Number = _loc5_ * 0.5; var _loc7_:ColorTransform = new ColorTransform(1 - _loc6_, 1 - _loc6_, 1 - _loc6_, 1, _loc6_ * this.targetR, _loc6_ * this.targetG, _loc6_ * this.targetB, 0); _loc3_.colorTransform(_loc3_.rect, _loc7_); return _loc3_; } public function applyGPUTextureColorTransform(param1:BitmapData, param2:int):void { var _loc3_:int = (param2 - this.startTime_) % this.duration_; var _loc6_:Number = Math.abs(Math.sin(_loc3_ / this.duration_ * 3.14159265358979 * (this.percentDone * 10))); var _loc4_:Number = _loc6_ * 0.5; var _loc5_:ColorTransform = new ColorTransform(1 - _loc4_, 1 - _loc4_, 1 - _loc4_, 1, _loc4_ * this.targetR, _loc4_ * this.targetG, _loc4_ * this.targetB, 0); GraphicsFillExtra.setColorTransform(param1, _loc5_); } public function doneAt(param1:int):Boolean { this.percentDone = this.curTime / this.duration_; this.curTime = param1 - this.startTime_; return this.percentDone > 1; } } }
package sunag.sea3d.config { import away3d.lights.DirectionalLight; import away3d.lights.LightBase; import away3d.lights.shadowmaps.CascadeShadowMapper; import away3d.lights.shadowmaps.NearDirectionalShadowMapper; import away3d.lights.shadowmaps.ShadowMapperBase; import away3d.materials.ITextureMaterial; import away3d.materials.TextureMaterial; import away3d.materials.lightpickers.StaticLightPicker; import away3d.materials.methods.CascadeShadowMapMethod; import away3d.materials.methods.FilteredShadowMapMethod; import away3d.materials.methods.NearShadowMapMethod; import away3d.materials.methods.ShadowMapMethodBase; import away3d.materials.methods.SimpleShadowMapMethodBase; import away3d.materials.methods.SoftShadowMapMethod; import sunag.sunag; import sunag.animation.AnimationBlendMethod; import sunag.animation.IAnimationPlayer; use namespace sunag; public class DefaultConfig extends ConfigBase implements IConfig { private var _normalDisplacement:Number = 100; private var _updateGlobalPose:Boolean = true; private var _smoothShadow:Boolean = true; private var _shadowMethod:String = ShadowMethod.NEAR; private var _shadowMapper:ShadowMapperBase; private var _shadowMapMethod:ShadowMapMethodBase; private var _lightPicker:StaticLightPicker = new StaticLightPicker([]); private var _forceCompactGeometry:Boolean = false; private var _forceCPU:Boolean = false; private var _forceMorphCPU:Boolean = false; private var _forceSkeletonCPU:Boolean = false; private var _autoUpdate:Boolean = true; private var _enabledShadow:Boolean = true; private var _enabledFog:Boolean = true; private var _mipmap:Boolean = true; private var _autoWriteDepth:Boolean = false; private var _timeLimit:int = 16; private var _cameraNear:Number = 1; private var _cameraFar:Number = 6000; private var _animationBlendMethod:uint = AnimationBlendMethod.LINEAR; private var _container:*; private var _player:IAnimationPlayer; public function DefaultConfig() { } public function get addLightInPicker():Boolean { return true; } public function get lightPicker():StaticLightPicker { return _lightPicker; } public function set lightPicker(val:StaticLightPicker):void { _lightPicker = val; } public function set animationBlendMethod(value:uint):void { _animationBlendMethod = value; } public function get animationBlendMethod():uint { return _animationBlendMethod; } public function set normalDisplacement(value:Number):void { _normalDisplacement = value; } public function get normalDisplacement():Number { return _normalDisplacement; } public function set autoWriteDepth(value:Boolean):void { _autoWriteDepth = value; } public function get autoWriteDepth():Boolean { return _autoWriteDepth; } public function set cameraNear(value:Number):void { _cameraNear = value; } public function get cameraNear():Number { return _cameraNear; } public function set cameraFar(value:Number):void { _cameraFar = value; } public function get cameraFar():Number { return _cameraFar; } public function set updateGlobalPose(value:Boolean):void { _updateGlobalPose = value; } public function get updateGlobalPose():Boolean { return _updateGlobalPose; } public function set autoUpdate(value:Boolean):void { _autoUpdate = value; } public function get autoUpdate():Boolean { return _autoUpdate; } public function set forceCompactGeometry(value:Boolean):void { _forceCompactGeometry = value; } public function get forceCompactGeometry():Boolean { return _forceCompactGeometry; } public function set forceCPU(value:Boolean):void { _forceCPU = value; } public function get forceCPU():Boolean { return _forceCPU; } public function set forceMorphCPU(value:Boolean):void { _forceMorphCPU = value; } public function get forceMorphCPU():Boolean { return _forceMorphCPU; } public function set forceSkeletonCPU(value:Boolean):void { _forceSkeletonCPU = value; } public function get forceSkeletonCPU():Boolean { return _forceSkeletonCPU; } public function get containsShadow():Boolean { return _shadowMapMethod != null; } public function set shadowMethod(value:String):void { _shadowMethod = value; } public function get shadowMethod():String { return _shadowMethod; } public function set enabledShadow(value:Boolean):void { _enabledShadow = value; } public function get enabledShadow():Boolean { return _enabledShadow; } public function set enabledFog(value:Boolean):void { _enabledFog = value; } public function get enabledFog():Boolean { return _enabledFog; } public function set mipmap(value:Boolean):void { _mipmap = value; } public function get mipmap():Boolean { return _mipmap; } public function createMaterial():ITextureMaterial { return new TextureMaterial(); } public function set smoothShadow(value:Boolean):void { _smoothShadow = value; } public function get smoothShadow():Boolean { return _smoothShadow; } // // Internal // public function getCubeMapSize(quality:uint):int { switch(quality) { case ConfigBase.HIGH: return 512; case ConfigBase.NORMAL: return 256; case ConfigBase.LOW: return 128; default: return 64; // ConfigBase.VERY_LOW } } public function getTextureSize(quality:uint):int { switch(quality) { case ConfigBase.HIGH: return 1024; case ConfigBase.NORMAL: return 512; case ConfigBase.LOW: return 256; default: return 128; // ConfigBase.VERY_LOW } } public function getShadowMapper():ShadowMapperBase { if (_enabledShadow && !_shadowMapper) { if (_shadowMethod === ShadowMethod.NEAR) _shadowMapper = new NearDirectionalShadowMapper(.3); else if (_shadowMethod === ShadowMethod.CASCADE) _shadowMapper = new CascadeShadowMapper(3); } return _shadowMapper; } public function getShadowMapMethod(light:LightBase=null):ShadowMapMethodBase { if (_enabledShadow && !_shadowMapMethod) { var filter:SimpleShadowMapMethodBase; if (_smoothShadow) filter = new SoftShadowMapMethod(light as DirectionalLight, 6); else filter = new FilteredShadowMapMethod(light as DirectionalLight); if (_shadowMethod === ShadowMethod.NEAR) _shadowMapMethod = new NearShadowMapMethod(filter); else if (_shadowMethod === ShadowMethod.CASCADE) _shadowMapMethod = new CascadeShadowMapMethod(filter); } return _shadowMapMethod; } /** * Global animation player */ public function set player(val:IAnimationPlayer):void { _player = val; } public function get player():IAnimationPlayer { return _player; } /** * Root of all children of the scene. */ public function set container(value:*):void { _container = value; } public function get container():* { return _container; } public function dispose():void { if (_shadowMapper) { _shadowMapper.dispose(); _shadowMapper = null; } if (_shadowMapMethod) { _shadowMapMethod.dispose(); _shadowMapMethod = null; } } } }
package { import flash.display.BitmapData; public dynamic class D12Bmp extends BitmapData { public function D12Bmp(param1:int = 90, param2:int = 126) { super(param1,param2); } } }
package com.leapmotion.leap { /** * The KeyTapGesture class represents a tapping gesture by a finger or tool. * * <p>A key tap gesture is recognized when the tip of a finger rotates down * toward the palm and then springs back to approximately the original * postion, as if tapping. The tapping finger must pause briefly before * beginning the tap.</p> * * <p><strong>Important: To use key tap gestures in your application, you must enable * recognition of the key tap gesture.</strong><br/>You can enable recognition with:</p> * * <code>leap.controller.enableGesture(Gesture.TYPE_KEY_TAP);</code> * * <p>Key tap gestures are discrete. The KeyTapGesture object representing a * tap always has the state, <code>STATE_STOP</code>. Only one KeyTapGesture object * is created for each key tap gesture recognized.</p> * * <p>You can set the minimum finger movement and velocity required for a movement * to be recognized as a key tap as well as adjust the detection window for evaluating * the movement using the config attribute of a connected Controller object. * Use the following configuration keys to configure key tap recognition:</p> * * <table class="innertable"> * <tr> * <th>Key string</th> * <th>Value type</th> * <th>Default value</th> * <th>Units</th> * </tr> * <tr> * <td>Gesture.KeyTap.MinDownVelocity</td> * <td>float</td> * <td>50</td> * <td>mm/s</td> * </tr> * <tr> * <td>Gesture.KeyTap.HistorySeconds</td> * <td>float</td> * <td>0.1</td> * <td>s</td> * </tr> * <tr> * <td>Gesture.KeyTap.MinDistance</td> * <td>float</td> * <td>5.0</td> * <td>mm</td> * </tr> * </table> * * <p>The following example demonstrates how to set the screen tap configuration parameters:</p> * * <code>if(controller.config().setFloat(&quot;Gesture.KeyTap.MinDownVelocity&quot;, 40.0) &amp;&amp; * controller.config().setFloat(&quot;Gesture.KeyTap.HistorySeconds&quot;, .2) &amp;&amp; * controller.config().setFloat(&quot;Gesture.KeyTap.MinDistance&quot;, 8.0)) * controller.config().save();</code> * * @author logotype * */ public class KeyTapGesture extends Gesture { /** * The type value designating a key tap gesture. */ static public var classType:int = Gesture.TYPE_KEY_TAP; /** * The current direction of finger tip motion. * * <p>At the start of the key tap gesture, the direction points in the * direction of the tap. At the end of the key tap gesture, the direction * will either point toward the original finger tip position or it will * be a zero-vector, which indicates that finger movement stopped before * returning to the starting point.</p> */ public var direction:Vector3; /** * The finger performing the key tap gesture. */ public var pointable:Pointable; /** * The position where the key tap is registered. */ public var position:Vector3; /** * The progess value is always 1.0 for a key tap gesture. */ public var progress:Number = 1; /** * Constructs a new KeyTapGesture object. * * <p>An uninitialized KeyTapGesture object is considered invalid. * Get valid instances of the KeyTapGesture class from a Frame object.</p> * */ public function KeyTapGesture() { } } }
package com.neopets.games.inhouse.shootergame.assets.targets { import com.neopets.games.inhouse.shootergame.SharedListener; import com.neopets.games.inhouse.shootergame.abstract.AbstractTarget; import caurina.transitions.Tweener; import flash.geom.Point; /** * Falling Targets Class * * @langversion ActionScript 3.0 * @playerversion Flash 10.0 * * * @author Viviana Baldarelli * @since 05.29.2009 */ public class FallingTarget extends AbstractTarget { /** * * Constructor * */ public function FallingTarget() { super(); _active = true; } //-------------------------------------- // PUBLIC METHODS //-------------------------------------- override public function hitReaction (hitPoint:Point=null):void { if (_active && !_destroyed){ _sl.sendCustomEvent(SharedListener.PLAY_SOUND, {name:"HitHard", loop:false}, false, true); if (rotation >-89){ rotation -= 45; _sl.sendCustomEvent(SharedListener.ADD_SCORE, {value:2}, false, true); } else { fallAndDestroy(); _sl.sendCustomEvent(SharedListener.ADD_SCORE, {value:_pointsValue}, false, true); } } } public function fall():void { Tweener.addTween (this, {y:500, time:1, transition:"easyInQuint", onComplete:removeFromParent}); } //-------------------------------------------------------------------- // PRIVATE / PROTECTED METHODS //-------------------------------------------------------------------- protected function fallAndDestroy():void { Tweener.addTween (this, {y:600, time:1, transition:"easyInCubic", onComplete:destroy}); } } }
/* Adobe Systems Incorporated(r) Source Code License Agreement Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved. Please read this Source Code License Agreement carefully before using the source code. Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license, to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute this source code and such derivative works in source or object code form without any attribution requirements. The name "Adobe Systems Incorporated" must not be used to endorse or promote products derived from the source code without prior written permission. You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and against any loss, damage, claims or lawsuits, including attorney's fees that arise or result from your use or distribution of the source code. THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package mx.collaboration.xmpp.protocol.events { import flash.events.*; import mx.collaboration.xmpp.protocol.packets.Packet; /** * For information on these events, see xmpp.PacketCollector */ public class PacketCollectorEvent extends Event { public static var PACKET:String = "packet"; private var _packet:Packet; public function PacketCollectorEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false, packetArg:Packet=null) { super (type, bubbles, cancelable); _packet = packetArg; } /** * The packet that has been filtered and sent to the collector. */ public function set packet(packetArg:Packet):void { _packet = packetArg; } public function get packet():Packet { return _packet; } } }
package { import flash.display.*; import flash.events.*; public class DownloadError extends MovieClip { public function DownloadError(_message:String, no_listeners:Boolean = false) { set_size(); if (!no_listeners) { addEventListener(MouseEvent.CLICK, close_alert); addEventListener(KeyboardEvent.KEY_DOWN, close_alert); } } public function resize():void { set_size(); } private function set_size():void { bg.width = Data.width; bg.height = Data.height; win.x = int(Data.width / 2 - win.width / 2); win.y = int(Data.height / 2 - win.height / 2); win.scaleX = Data.scaleX; win.scaleY = Data.scaleY; } private function close_alert(e:Event):void { this.parent.removeChild(this); } } }
/* * Copyright 2008-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.spicefactory.parsley.lifecycle.tag { import org.spicefactory.parsley.core.builder.ObjectDefinitionBuilder; import org.spicefactory.parsley.core.builder.ObjectDefinitionDecorator; import org.spicefactory.parsley.core.processor.DestroyPhase; import org.spicefactory.parsley.lifecycle.processor.DestroyMethodProcessor; [Metadata(name="Destroy", types="method")] [XmlMapping(elementName="destroy")] /** * Represents a Metadata, MXML or XML tag that can be used on methods that should be invoked when the Context * that the object belongs to gets destroyed or when the object is removed from the Context. * * @author Jens Halm */ public class DestroyMethodDecorator implements ObjectDefinitionDecorator { [Target] /** * The name of the method. */ public var method:String; /** * @inheritDoc */ public function decorate (builder:ObjectDefinitionBuilder) : void { builder .method(method) .process(new DestroyMethodProcessor()) .destroyIn(DestroyPhase.destroy()) .maxParams(0); } } }
package com.playata.application.data.character { public class CharacterMessage { public static const NOTIFY_LEVEL_UP:String = "CharacterMessage.notifyLevelUp"; public static const NOTIFY_STAGE_UP:String = "CharacterMessage.notifyStageUp"; public static const NOTIFY_INITIAL_STAT_POINTS_SPEND:String = "CharacterMessage.notifyInitialStatPointsSpend"; public static const NOTIFY_INVENTORY_BAG_2_UNLOCK:String = "CharacterMessage.notifyInventoryBag2Unlock"; public static const NOTIFY_INVENTORY_BAG_3_UNLOCK:String = "CharacterMessage.notifyInventoryBag3Unlock"; public static const NOTIFY_GOAL_COLLECTABLE:String = "CharacterMessage.notifyGoalCollectable"; public function CharacterMessage() { super(); } } }
package cmodule.decry { const __2E_str118276:int = gstaticInitter.alloc(4,1); }
/****************************************************************************** * Spine Runtimes License Agreement * Last updated January 1, 2020. Replaces all prior versions. * * Copyright (c) 2013-2020, Esoteric Software LLC * * Integration of the Spine Runtimes into software or otherwise creating * derivative works of the Spine Runtimes is permitted under the terms and * conditions of Section 2 of the Spine Editor License Agreement: * http://esotericsoftware.com/spine-editor-license * * Otherwise, it is permitted to integrate the Spine Runtimes into software * or otherwise create derivative works of the Spine Runtimes (collectively, * "Products"), provided that each user of the Products must obtain their own * Spine Editor license and redistribution of the Products in any form must * include this license and copyright notice. * * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ package spine { /** * @author badlogic */ public class Vertex { public var x : Number; public var y : Number; public var u : Number; public var v : Number; public var light : Color = new spine.Color(0, 0, 0); public var dark : Color = new spine.Color(0, 0, 0); function Vertex() { } } }
package zen.enums { public class TextureOption { public static const CENTROID:int = 1; public static const SINGLE:int = 2; public static const DEPTH:int = 4 } }
/* * =BEGIN CLOSED LICENSE * * Copyright (c) 2013 Andras Csizmadia * http://www.vpmedia.eu * * For information about the licensing and copyright please * contact Andras Csizmadia at andras@vpmedia.eu * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * =END CLOSED LICENSE */ package hu.vpmedia.entity.core { public class MockComponentB extends BaseEntityComponent { public var m:String; } }
/* * Copyright 2007 (c) Tim Knip, suite75.com. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ package org.ascollada.fx { import org.ascollada.ASCollada; import org.ascollada.core.DaeEntity; import org.ascollada.types.DaeColorOrTexture; import org.ascollada.utils.Logger; /** * */ public class DaeBlinn extends DaeLambert { public var specular:DaeColorOrTexture; public var shininess:Number = 0; /** * * @param node * @return */ public function DaeBlinn( node:XML = null ):void { super( node ); } /** * * @param node */ override public function read( node:XML ):void { super.read( node ); var children:XMLList = node.children(); var numChildren:int = children.length(); for( var i:int = 0; i < numChildren; i++ ) { var child:XML = children[i]; switch( child.localName() ) { case ASCollada.DAE_SPECULAR_MATERIAL_PARAMETER: this.specular = new DaeColorOrTexture( child ); break; case ASCollada.DAE_SHININESS_MATERIAL_PARAMETER: this.shininess = parseFloat( getNodeContent( getNode(child, "float") ) ); Logger.log( " => shininess: " + this.shininess ); break; default: break; } } } } }
package walk_fla { import flash.display.*; dynamic public class MainTimeline extends MovieClip { public var theChar:MovieClip; public function MainTimeline() { return; }// end function } }
// // $Id$ package com.threerings.msoy.applets.image { import flash.geom.Point; public class SizeRestriction { /** The forced size, or null if none. */ public var forced :Point; /** Maximum width, or NaN if none. */ public var maxWidth :Number; /** Maximum height, or NaN if none. */ public var maxHeight :Number; public function SizeRestriction ( forcedWidth :Number = NaN, forcedHeight :Number = NaN, maxWidth :Number = NaN, maxHeight :Number = NaN) { if (!isNaN(forcedWidth) && !isNaN(forcedHeight)) { forced = new Point(forcedWidth, forcedHeight); this.maxWidth = forcedWidth; this.maxHeight = forcedHeight; } else { this.maxWidth = maxWidth; this.maxHeight = maxHeight; } } public function isValid (width :Number, height :Number) :Boolean { if (forced != null) { return (forced.x == width) && (forced.y == height); } else { return (isNaN(maxWidth) || (width < maxWidth)) && (isNaN(maxHeight) || (height < maxHeight)); } } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package { internal class SparkClasses { /** * @private * This class is used to link additional classes into spark.swc * beyond those that are found by dependecy analysis starting * from the classes specified in manifest.xml. * For example, Button does not have a reference to ButtonSkin, * but ButtonSkin needs to be in framework.swc along with Button. */ import mx.controls.dataGridClasses.FTEDataGridItemRenderer; FTEDataGridItemRenderer; import mx.controls.MXFTETextInput; MXFTETextInput; import mx.core.UIFTETextField; UIFTETextField; import spark.core.ContentCache; ContentCache; import spark.core.IDisplayText; IDisplayText; import spark.core.IEditableText; IEditableText; import spark.core.SpriteVisualElement; SpriteVisualElement; import spark.collections.OnDemandDataProvider; OnDemandDataProvider; import spark.components.BusyIndicator; BusyIndicator; import spark.components.IconPlacement; IconPlacement; import spark.components.calendarClasses.DateSelectorDisplayMode; DateSelectorDisplayMode; import spark.components.gridClasses.CellPosition; CellPosition; import spark.components.gridClasses.CellRegion; CellRegion; import spark.components.gridClasses.DataGridDragProxy; DataGridDragProxy; import spark.components.supportClasses.ListItemDragProxy; ListItemDragProxy; import spark.components.supportClasses.InteractionStateDetector; InteractionStateDetector; import spark.globalization.supportClasses.CalendarDate; CalendarDate; import spark.globalization.supportClasses.DateTimeFormatterEx; DateTimeFormatterEx; import spark.skins.spark.ApplicationSkin; ApplicationSkin; import spark.skins.spark.BorderContainerSkin; BorderContainerSkin; import spark.skins.spark.ButtonSkin; ButtonSkin; import spark.skins.spark.DefaultButtonSkin; DefaultButtonSkin; import spark.skins.spark.ButtonBarSkin; ButtonBarSkin; import spark.skins.spark.ButtonBarFirstButtonSkin; ButtonBarFirstButtonSkin; import spark.skins.spark.ButtonBarMiddleButtonSkin; ButtonBarMiddleButtonSkin; import spark.skins.spark.ButtonBarLastButtonSkin; ButtonBarLastButtonSkin; import spark.skins.spark.CheckBoxSkin; CheckBoxSkin; import spark.skins.spark.ComboBoxButtonSkin; ComboBoxButtonSkin; import spark.skins.spark.ComboBoxSkin; ComboBoxSkin; import spark.skins.spark.ComboBoxTextInputSkin; ComboBoxTextInputSkin; import spark.skins.spark.DataGridSkin; DataGridSkin; import spark.skins.spark.DefaultButtonSkin; DefaultButtonSkin; import spark.skins.spark.DefaultComplexItemRenderer; DefaultComplexItemRenderer; import spark.skins.spark.DefaultGridHeaderRenderer; DefaultGridHeaderRenderer; import spark.skins.spark.DefaultGridItemRenderer; DefaultGridItemRenderer; import spark.skins.spark.DefaultItemRenderer; DefaultItemRenderer; import spark.skins.spark.DropDownListButtonSkin; DropDownListButtonSkin; import spark.skins.spark.DropDownListSkin; DropDownListSkin; import spark.skins.spark.ErrorSkin; ErrorSkin; import spark.skins.spark.FormHeadingSkin; FormHeadingSkin; import spark.skins.spark.FormItemSkin; FormItemSkin; import spark.skins.spark.FormSkin; FormSkin; import spark.skins.spark.FocusSkin; FocusSkin; import spark.skins.spark.HScrollBarSkin; HScrollBarSkin; import spark.skins.spark.HScrollBarThumbSkin; HScrollBarThumbSkin; import spark.skins.spark.HSliderSkin; HSliderSkin; import spark.skins.spark.HSliderThumbSkin; HSliderThumbSkin; import spark.skins.spark.HSliderTrackSkin; HSliderTrackSkin; import spark.skins.spark.ImageSkin; ImageSkin; import spark.skins.spark.ImageLoadingSkin; ImageLoadingSkin; import spark.skins.spark.ListDropIndicator; ListDropIndicator; import spark.skins.spark.ListSkin; ListSkin; import spark.skins.spark.mediaClasses.normal.MuteButtonSkin; MuteButtonSkin; import spark.skins.spark.mediaClasses.normal.ScrubBarSkin; ScrubBarSkin; import spark.skins.spark.mediaClasses.normal.VolumeBarSkin; VolumeBarSkin; import spark.skins.spark.NumericStepperSkin; NumericStepperSkin; import spark.skins.spark.PanelSkin; PanelSkin; import spark.skins.spark.RadioButtonSkin; RadioButtonSkin; import spark.skins.spark.ScrollBarUpButtonSkin; ScrollBarUpButtonSkin; import spark.skins.spark.ScrollBarDownButtonSkin; ScrollBarDownButtonSkin; import spark.skins.spark.ScrollBarLeftButtonSkin; ScrollBarLeftButtonSkin; import spark.skins.spark.ScrollBarRightButtonSkin; ScrollBarRightButtonSkin; import spark.skins.spark.ScrollerSkin; ScrollerSkin; import spark.skins.spark.SkinnableContainerSkin; SkinnableContainerSkin; import spark.skins.spark.SkinnableDataContainerSkin; SkinnableDataContainerSkin; import spark.skins.spark.SkinnablePopUpContainerSkin; SkinnablePopUpContainerSkin; import spark.skins.spark.SpinnerDecrementButtonSkin; SpinnerDecrementButtonSkin; import spark.skins.spark.SpinnerIncrementButtonSkin; SpinnerIncrementButtonSkin; import spark.skins.spark.SpinnerSkin; SpinnerSkin; import spark.skins.spark.StackedFormHeadingSkin; StackedFormHeadingSkin; import spark.skins.spark.StackedFormItemSkin; StackedFormItemSkin; import spark.skins.spark.StackedFormSkin; StackedFormSkin; import spark.skins.spark.TabBarSkin; TabBarSkin; import spark.skins.spark.TabBarButtonSkin; TabBarButtonSkin; import spark.skins.spark.TextAreaSkin; TextAreaSkin; import spark.skins.spark.TextInputSkin; TextInputSkin; import spark.skins.spark.TitleWindowSkin; TitleWindowSkin; import spark.skins.spark.TitleWindowCloseButtonSkin; TitleWindowCloseButtonSkin; import spark.skins.spark.ToggleButtonSkin; ToggleButtonSkin; import spark.skins.spark.UITextFieldGridItemRenderer; UITextFieldGridItemRenderer; import spark.skins.spark.VideoPlayerSkin; VideoPlayerSkin; import spark.skins.spark.VScrollBarSkin; VScrollBarSkin; import spark.skins.spark.VScrollBarThumbSkin; VScrollBarThumbSkin; import spark.skins.spark.VScrollBarTrackSkin; VScrollBarTrackSkin; import spark.skins.spark.VSliderSkin; VSliderSkin; import spark.skins.spark.VSliderThumbSkin; VSliderThumbSkin; import spark.skins.spark.VSliderTrackSkin; VSliderTrackSkin; import spark.utils.TextFlowUtil; TextFlowUtil; import spark.components.ContentBackgroundAppearance;ContentBackgroundAppearance; import spark.skins.ActionScriptSkinBase; ActionScriptSkinBase ; import spark.skins.spark.CalloutSkin; CalloutSkin; } }
package modules.game.majiangGame.view.card.outputCard { public class BottomOutputCard extends BaseOutputCard { public function BottomOutputCard(skin:*) { super(skin); } override public function down():void { if(state == CARCSTATE_DOWN) { return; } _skin.downImg.visible = true; _skin.valueImg.visible = true; _skin.backImg.visible = false; super.down(); } override public function back():void { if(state == CARCSTATE_BACK) { return; } _skin.downImg.visible = false; _skin.valueImg.visible = false; _skin.backImg.visible = true; super.back(); } override public function show():void { _skin.visible = true; } override public function hide():void { _skin.visible = false; } override public function setCardImg(cardIdx:int):void { if(this.cardIdx == cardIdx) { return; } _skin.valueImg.skin = PREPATH + CARD_REFERENCE[cardIdx.toString()]; super.setCardImg(cardIdx); } } }
/* * Copyright (c) 2006-2011 the original author or authors * * Permission is hereby granted to use, modify, and distribute this file * in accordance with the terms of the license agreement accompanying it. */ package reprise.commands { import flash.display.Shape; import flash.events.Event; import reprise.data.collection.HashMap; public class FrameCommandExecutor { /*************************************************************************** * protected properties * ***************************************************************************/ protected static var g_instance : FrameCommandExecutor; private var m_commands : HashMap; protected var m_nextKeyIndex : int; private var m_enterFrameDispatcher : Shape; /*************************************************************************** * public methods * ***************************************************************************/ public static function instance() : FrameCommandExecutor { if (!g_instance) { g_instance = new FrameCommandExecutor(); } return g_instance; } public function addCommand(cmd : ICommand) : void { addCommandWithName(cmd, getNextKey()); } public function addCommandWithName(cmd : ICommand, key : String) : void { if (containsCommand(cmd)) { return; } if (!m_commands.size()) { m_enterFrameDispatcher.addEventListener(Event.ENTER_FRAME, enterFrame); } var wrapper : Object = { command : cmd }; m_commands.setObjectForKey(wrapper, key); } public function removeCommand(cmd : ICommand) : void { m_commands.removeObject(wrapperForCommand(cmd)); if (!m_commands.size()) { m_enterFrameDispatcher.removeEventListener(Event.ENTER_FRAME, enterFrame); } } public function removeCommandWithName(key : String) : void { m_commands.removeObject(wrapperForName(key)); if (!m_commands.size()) { m_enterFrameDispatcher.removeEventListener(Event.ENTER_FRAME, enterFrame); } } public function delayCommand(cmd : ICommand) : void { if (containsCommand(cmd)) { return; } if (!m_commands.size()) { m_enterFrameDispatcher.addEventListener(Event.ENTER_FRAME, enterFrame); } var wrapper : Object = { command : cmd, oneOff : true }; m_commands.setObjectForKey(wrapper, getNextKey()); } // defined by IFrameEventListener public function enterFrame(e:Event) : void { var commands : Object = m_commands.toObject(); var wrapper : Object; for (var key : String in commands) { wrapper = commands[key]; wrapper.command.execute(); if (wrapper.oneOff) { removeCommandWithName(key); } } } /*************************************************************************** * protected methods * ***************************************************************************/ public function FrameCommandExecutor() { m_commands = new HashMap(); m_nextKeyIndex = 0; m_enterFrameDispatcher = new Shape(); } protected function containsCommand(cmd : ICommand) : Boolean { return wrapperForCommand(cmd) != null; } protected function wrapperForCommand(cmd : ICommand) : Object { var commands : Object = m_commands.toObject(); var wrapper : Object; for (var key : String in commands) { wrapper = commands[key]; if (wrapper.command == cmd) { return wrapper; } } return null; } protected function wrapperForName(name : String) : Object { return m_commands.objectForKey(name); } protected function getNextKey() : String { return 'key' + m_nextKeyIndex++; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.skins.halo { import mx.display.Graphics; import mx.skins.ProgrammaticSkin; /** * The skin for the separator between column headers in a DataGrid. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class DataGridHeaderSeparator extends ProgrammaticSkin { //include "../../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function DataGridHeaderSeparator() { super(); } //-------------------------------------------------------------------------- // // Overridden properties // //-------------------------------------------------------------------------- //---------------------------------- // measuredWidth //---------------------------------- /** * @private */ override public function get measuredWidth():Number { return 2; } //---------------------------------- // measuredHeight //---------------------------------- /** * @private */ override public function get measuredHeight():Number { return 10; } //-------------------------------------------------------------------------- // // Overridden methods // //-------------------------------------------------------------------------- /** * @private */ override protected function updateDisplayList(w:Number, h:Number):void { super.updateDisplayList(w, h); var g:Graphics = graphics; g.clear(); // Highlight g.lineStyle(1, 0xFFFFFF, 0.5); g.moveTo(0, 0); g.lineTo(0, h); g.lineStyle(1, getStyle("borderColor")); g.moveTo(1, 0); g.lineTo(1, h); } } }
class tm.freshComponents.forms.validators.DateValidator implements tm.freshComponents.forms.validators.IFormValidator { var minDateAllowed, maxDateAllowed, _validationErrorMessage; function DateValidator () { } function updateProperties(data) { if (data.mask.value && (String(data.mask.value).length > 0)) { var _local3 = String(data.mask.value); if (((_local3.indexOf("dd") != -1) && (_local3.indexOf("mm") != -1)) && (_local3.indexOf("yyyy") != -1)) { mask = _local3; daysIndex = _local3.indexOf("dd"); monthsIndex = _local3.indexOf("mm"); yearsIndex = _local3.indexOf("yyyy"); } } if (data.minDateAllowed.value && (String(data.minDateAllowed.value).length > 0)) { var _local4 = String(data.minDateAllowed.value); if (checkDateByMask(_local4)) { minDateAllowed = _local4; } } if (data.maxDateAllowed.value && (String(data.maxDateAllowed.value).length > 0)) { var _local5 = String(data.maxDateAllowed.value); if (checkDateByMask(_local5)) { maxDateAllowed = _local5; } } } function checkDateByMask(dateString) { var _local8 = Number(dateString.substr(daysIndex, 2)); var _local5 = Number(dateString.substr(monthsIndex, 2)); var _local9 = Number(dateString.substr(yearsIndex, 4)); var _local11 = 1; var _local15 = 31; var _local13 = 1; var _local16 = 12; var _local12 = 1950; var _local14 = 2100; if (minDateAllowed && (minDateAllowed.length > 0)) { var _local7 = Number(minDateAllowed.substr(daysIndex, 2)); var _local6 = Number(minDateAllowed.substr(monthsIndex, 2)); var _local10 = Number(minDateAllowed.substr(yearsIndex, 4)); if ((_local7 && (_local7 > 1)) && (_local7 < 31)) { _local11 = _local7; } if ((_local6 && (_local6 > 1)) && (_local6 < 31)) { _local13 = _local6; } if ((_local10 && (_local10 > 1950)) && (_local10 < 2100)) { _local12 = _local10; } } if (maxDateAllowed && (maxDateAllowed.length > 0)) { var _local4 = Number(maxDateAllowed.substr(daysIndex, 2)); var _local2 = Number(maxDateAllowed.substr(monthsIndex, 2)); var _local3 = Number(maxDateAllowed.substr(yearsIndex, 4)); if (((_local4 && (_local4 > 1)) && (_local4 < 31)) && (_local4 > _local11)) { _local15 = _local4; } if (((_local2 && (_local2 > 1)) && (_local2 < 31)) && (_local2 > _local13)) { _local16 = _local2; } if (((_local3 && (_local3 > 1950)) && (_local3 < 2100)) && (_local3 > _local12)) { _local14 = _local3; } } if ((((!_local8) || (isNaN(_local8))) || (_local8 < _local11)) || (_local8 > _local15)) { _validationErrorMessage = dateIsNotValidError; return(false); } if ((((!_local5) || (isNaN(_local5))) || (_local5 < _local13)) || (_local5 > _local16)) { _validationErrorMessage = dateIsNotValidError; return(false); } if ((((!_local9) || (isNaN(_local9))) || (_local9 < _local12)) || (_local9 > _local14)) { _validationErrorMessage = dateIsNotValidError; return(false); } return(true); } function validate(value) { var _local2 = String(value); return(checkDateByMask(_local2)); } function error() { return(_validationErrorMessage); } var mask = "mm/dd/yyyy"; var daysIndex = 3; var monthsIndex = 0; var yearsIndex = 6; var dateIsNotValidError = "dateIsNotValidError"; }
/* * LogMeister for ActionScript 3.0 * Copyright © 2011 Base42.nl * All rights reserved. * * http://github.com/base42/LogMeister * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Logmeister version 1.8.2 * */ package { import logmeister.LogMeister; import logmeister.NSLogMeister; public function warn(...args) : void { use namespace NSLogMeister; LogMeister.warn.apply(this, args); } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.utils { import flash.utils.ByteArray; [ExcludeClass] /** * Documentation is not currently available. * Ported to ActionScript from flex/messaging/util/Hex.java * @private */ public class HexEncoder { /** * @private * Set encodingStyle to this value to encode using upper case 'A'-'F'. */ public static const UPPER_CASE:String = "upper"; /** * @private * Set encodingStyle to this value to encode using lower case 'a'-'f'. */ public static const LOWER_CASE:String = "lower"; /** * @private * The default encoding style for all HexEncoders. */ public static var encodingStyle:String = UPPER_CASE; /** * @private * Constructor. */ public function HexEncoder() { super(); _buffers = []; _buffers.push([]); } /** * @private * The encoding style for this HexEncoder instance. * If not set, the default static encodingStyle is used. */ public var encodingStyle:String; /** * @private */ public function encode(data:ByteArray, offset:uint = 0, length:uint = 0):void { if (length == 0) length = data.length; if (offset < length) { data.position = offset; } var style:String = (this.encodingStyle != null) ? this.encodingStyle : HexEncoder.encodingStyle; // Validate style; coerce invalid values to UPPER. if (style != UPPER_CASE && style != LOWER_CASE) style = UPPER_CASE; var digits:Array = (style == UPPER_CASE) ? UPPER_CHAR_CODES : LOWER_CHAR_CODES; while (data.bytesAvailable > 0) { encodeBlock(data.readByte(), digits); } // while } /** * @private */ public function drain():String { var result:String = ""; for (var i:uint = 0; i < _buffers.length; i++) { var buffer:Array = _buffers[i] as Array; result += String.fromCharCode.apply(null, buffer); } _buffers = []; _buffers.push([]); return result; } /** * @private */ public function flush():String { return drain(); } /** * @private */ private function encodeBlock(_work:int, digits:Array):void { var currentBuffer:Array = _buffers[_buffers.length - 1] as Array; if (currentBuffer.length >= MAX_BUFFER_SIZE) { currentBuffer = []; _buffers.push(currentBuffer); } currentBuffer.push(digits[(_work & 0xF0) >>> 4]); currentBuffer.push(digits[(_work & 0x0F)]); } /** * An Array of buffer Arrays. * @private */ private var _buffers:Array; /** * @private */ private var _work:int = 0; /** * This value represents a safe number of characters (i.e. arguments) that * can be passed to String.fromCharCode.apply() without exceeding the AVM+ * stack limit. * * @private */ public static const MAX_BUFFER_SIZE:uint = 32767; /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', */ private static const UPPER_CHAR_CODES:Array = [ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, ]; /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' */ private static const LOWER_CHAR_CODES:Array = [ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 ]; } }
package com.events { import flash.events.Event; public class FileInputEvent extends Event { public static const SELECT:String = 'fileinputselect'; public static const CANCEL:String = 'fileinputcancel'; public var data:*; public function FileInputEvent(type:String, data:* = false) { this.data = data; super(type, false, false); } } }
 var item_inited:Boolean; var item_ran:Boolean; var house_mc:MovieClip; var base:MovieClip; var door:MovieClip; var entrance:MovieClip; var ground:MovieClip; var roof:MovieClip; var siding:MovieClip; var config_options:Object; var config_option_names:Object; itemInit(); function itemInit():void { if (item_inited) return; animatee = this; animated_mcs = []; animations = ['1']; loopers = []; myAnim = '1'; config_option_names = { base: 'Base', door: 'Door', entrance: 'Portico', ground: 'Ground', roof: 'Roof', siding: 'Siding' } config_options = { base: [ 'base_grey', 'base_mud', 'base_mud_black', 'base_rocks', 'base_stone', 'base_empty' ], door: [ 'door_RedStone', 'door_BrownStone', 'door_PurpleStone', 'door_Blue', 'door_pink', 'door_PurpleRound', 'door_RedGreen', 'door_white' ], entrance: [ 'entrance_Blue', 'entrance_GreyPurple', 'entrance_log', 'entrance_Moss', 'entrance_moss_black', 'entrance_PinkFlowers', 'entrance_Purple', 'entrance_PurpleMushrooms', 'entrance_vines', 'entrance_white' ], ground: [ 'groundstep_footstone', 'groundstep_rocks', 'groundstep_rocks_black', 'groundstep_welcome', 'groundstep_welcome_white' ], roof: [ 'roof_GrassGreenMushroom', 'roof_GrassPink', 'roof_GrassYellow', 'roof_HutHay', 'roof_HutMint', 'roof_HutPurple', 'roof_hut_white', 'roof_TuffBlue', 'roof_TuffCyan', 'roof_tuff_black' ], siding: [ 'siding_BlueStone', 'siding_GrayStone', 'siding_Stone', 'siding_StonePinkMoss', 'siding_StoneYellowMoss', 'siding_white', 'siding_mud_black', 'siding_PurpleMud' ] } house_mc = maincontainer_mc.house_mc; base = house_mc.baseContainer_mc.getChildAt(0) as MovieClip; door = house_mc.doorContainer_mc.getChildAt(0) as MovieClip; entrance = house_mc.entranceContainer_mc.getChildAt(0) as MovieClip; ground = house_mc.groundContainer_mc.getChildAt(0) as MovieClip; roof = house_mc.roofContainer_mc.getChildAt(0) as MovieClip; siding = house_mc.sidingContainer_mc.getChildAt(0) as MovieClip; if (true) { var temp_ob4:Object = {}; var index:int = 1; for (var k:String in config_options) { var which:int = index if (which >= config_options[k].length) which = config_options[k].length-1 trace(k+' '+which+' '+config_options[k][which]); temp_ob4[k] = config_options[k][which] } initializehead(temp_ob4); } item_inited = true; } //itemRun() function itemRun():void { if (item_ran) return; //do_trace = true // DEFAULT! //stopAll(); //trackFrames(); //playAnimation('warriorPose'); //playAnimationSeq(['idle']); item_ran = true; //LogCoords(animatee, 20) } function initializehead(ob:Object) { log(112, 'initializehead '+ob) if (!ob) return; base = addArticleToContainer(ob.base, house_mc, 'baseContainer_mc') || base; door = addArticleToContainer(ob.door, house_mc, 'doorContainer_mc') || door; entrance = addArticleToContainer(ob.entrance, house_mc, 'entranceContainer_mc') || entrance; ground = addArticleToContainer(ob.ground, house_mc, 'groundContainer_mc') || ground; roof = addArticleToContainer(ob.roof, house_mc, 'roofContainer_mc') || roof; siding = addArticleToContainer(ob.siding, house_mc, 'sidingContainer_mc') || siding; }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package { import flash.sampler.*; import avmplus.*; import com.adobe.test.Assert; // var SECTION = "Sampling"; // var VERSION = "AS3"; // var TITLE = "Iterate and investigate the sample data"; var isdebugger=System.isDebugger(); var objs:Array=new Array(); class simpleobject { var str:String; function simpleobject(s:String) { this.str=s; } } function simpleLoop() { for (var i:int=0;i<10;i++) { objs.push(new simpleobject(""+i)); } } sampleInternalAllocs(true); startSampling(); simpleLoop(); pauseSampling(); var nallocs:uint=0; var ndeallocs:uint=0; var allocs:uint=0; var deallocs:uint=0; var alloctable:Array=new Array(); var badalloc:String=""; for each (var sample in getSamples()) { var nos : NewObjectSample; var dos : DeleteObjectSample; if ( (nos=sample as NewObjectSample) != null) { nallocs++; allocs+=nos.size; alloctable[nos.id]=nos.size; } else if ( (dos=sample as DeleteObjectSample) !=null) { ndeallocs++; deallocs+=dos.size; if (alloctable[dos.id]!=dos.size) { badalloc+="dealloc id:"+dos.id+" "+dos.size+" does not match alloc size: "+alloctable[dos.id]+"\n"; } } } print("nallocs ="+nallocs+" allocs ="+allocs); print("ndeallocs="+ndeallocs+" deallocs="+deallocs); Assert.expectEq( "ProcessSamples: deallocs match allocs", "", badalloc ); var sizeAllocs:uint=0; var sizeDeallocs:uint=0; for each (var sample1 in getSamples()) { var nos1 : NewObjectSample; var dos1 : DeleteObjectSample; if ( (nos1=sample as NewObjectSample) != null) { sizeAllocs+=getSize(nos1.object); } } print("sizeAllocs="+sizeAllocs); print("sizeDeAllocs="+sizeDeallocs); if (isdebugger) { Assert.expectEq( "GetSizeSamples: test getSize on NewObjectSamples returns a positive value", true, sizeAllocs>0 ); } else { Assert.expectEq( "GetSizeSamples: test getSize on NewObjectSamples returns a positive value", false, sizeAllocs>0 ); } var objs1:Object=new Object(); for each (var sample2 in getSamples()) { var nos2 : NewObjectSample; var dos2 : DeleteObjectSample; if ( (nos2=sample2 as NewObjectSample) != null) { if (objs1.hasOwnProperty(nos2.stack[0].name)==false) objs1[nos2.stack[0].name]=0; objs1[nos2.stack[0].name]+=nos2.size; } } for (var item in objs1) { print(item+" "+objs1[item]); } if (isdebugger) { Assert.expectEq( "InternalsInStack: assert the [verify] internal is shown in the samples and has > 0 size", true, objs1['[verify]']>0 ); } for (var sample3 in getSamples()) { print("getsample:"+sample3); } }
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import com.adobe.test.Assert; var gTestfile = 'regress-311515.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 311515; var summary = 'Array.sort should skip holes and undefined during sort'; var actual = ''; var expect = ''; //printBugNumber(BUGNUMBER); //printStatus (summary); var a = [, 1, , 2, undefined]; actual = a.sort().toString(); expect = '1,2,,,'; Assert.expectEq(summary, expect, actual);
/* Copyright aswing.org, see the LICENCE.txt. */ package org.aswing.plaf { import org.aswing.ASFont; /** * Font UI Resource. * @author iiley */ public class ASFontUIResource extends ASFont implements UIResource { public function ASFontUIResource(name:String="Tahoma", size:Number=11, bold:Boolean=false, italic:Boolean=false, underline:Boolean=false, embedFontsOrAdvancedPros:*=null) { super(name, size, bold, italic, underline, embedFontsOrAdvancedPros); } /** * Create a font ui resource with a font. */ public static function createResourceFont(font:ASFont):ASFontUIResource{ return new ASFontUIResource(font.getName(), font.getSize(), font.isBold(), font.isItalic(), font.isUnderline(), font.getAdvancedProperties()); } } }
package com.ankamagames.dofus.network.messages.game.guild.tax { import com.ankamagames.jerakine.network.CustomDataWrapper; import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkMessage; import com.ankamagames.jerakine.network.NetworkMessage; import com.ankamagames.jerakine.network.utils.FuncTree; import flash.utils.ByteArray; public class GuildFightPlayersHelpersLeaveMessage extends NetworkMessage implements INetworkMessage { public static const protocolId:uint = 5882; private var _isInitialized:Boolean = false; public var fightId:Number = 0; public var playerId:Number = 0; public function GuildFightPlayersHelpersLeaveMessage() { super(); } override public function get isInitialized() : Boolean { return this._isInitialized; } override public function getMessageId() : uint { return 5882; } public function initGuildFightPlayersHelpersLeaveMessage(fightId:Number = 0, playerId:Number = 0) : GuildFightPlayersHelpersLeaveMessage { this.fightId = fightId; this.playerId = playerId; this._isInitialized = true; return this; } override public function reset() : void { this.fightId = 0; this.playerId = 0; this._isInitialized = false; } override public function pack(output:ICustomDataOutput) : void { var data:ByteArray = new ByteArray(); this.serialize(new CustomDataWrapper(data)); writePacket(output,this.getMessageId(),data); } override public function unpack(input:ICustomDataInput, length:uint) : void { this.deserialize(input); } override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree { var tree:FuncTree = new FuncTree(); tree.setRoot(input); this.deserializeAsync(tree); return tree; } public function serialize(output:ICustomDataOutput) : void { this.serializeAs_GuildFightPlayersHelpersLeaveMessage(output); } public function serializeAs_GuildFightPlayersHelpersLeaveMessage(output:ICustomDataOutput) : void { if(this.fightId < 0 || this.fightId > 9007199254740992) { throw new Error("Forbidden value (" + this.fightId + ") on element fightId."); } output.writeDouble(this.fightId); if(this.playerId < 0 || this.playerId > 9007199254740992) { throw new Error("Forbidden value (" + this.playerId + ") on element playerId."); } output.writeVarLong(this.playerId); } public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_GuildFightPlayersHelpersLeaveMessage(input); } public function deserializeAs_GuildFightPlayersHelpersLeaveMessage(input:ICustomDataInput) : void { this._fightIdFunc(input); this._playerIdFunc(input); } public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_GuildFightPlayersHelpersLeaveMessage(tree); } public function deserializeAsyncAs_GuildFightPlayersHelpersLeaveMessage(tree:FuncTree) : void { tree.addChild(this._fightIdFunc); tree.addChild(this._playerIdFunc); } private function _fightIdFunc(input:ICustomDataInput) : void { this.fightId = input.readDouble(); if(this.fightId < 0 || this.fightId > 9007199254740992) { throw new Error("Forbidden value (" + this.fightId + ") on element of GuildFightPlayersHelpersLeaveMessage.fightId."); } } private function _playerIdFunc(input:ICustomDataInput) : void { this.playerId = input.readVarUhLong(); if(this.playerId < 0 || this.playerId > 9007199254740992) { throw new Error("Forbidden value (" + this.playerId + ") on element of GuildFightPlayersHelpersLeaveMessage.playerId."); } } } }
/* * ND2D - A Flash Molehill GPU accelerated 2D engine * * Author: Lars Gerckens * Copyright (c) nulldesign 2011 * Repository URL: http://github.com/nulldesign/nd2d * Getting started: https://github.com/nulldesign/nd2d/wiki * * * Licence Agreement * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package de.nulldesign.nd2d.utils { public class NumberUtil { /** * generates a random number between 0 and 1 * @return */ public static function rnd0_1():Number { return Math.random(); } /** * generates a random number between -1 and 1 * @return */ public static function rndMinus1_1():Number { return Math.random() - Math.random(); } /** * generates a random number between min and max * @param min * @param max * @return the random number */ public static function rndMinMax(min:Number, max:Number):Number { return min + Math.random() * (max - min); } public static function rndMinMaxInt(min:int, max:int):int { return Math.round(rndMinMax(min, max)); } public static function sin0_1(t:Number):Number { return 0.5 + Math.sin(t) * 0.5; } } }
/* Tween effect */ package bitfade.effects { import flash.display.* import bitfade.effects.* import bitfade.utils.* import bitfade.easing.* import flash.geom.* import flash.filters.* public class Blocks extends bitfade.effects.Tween { protected var bData:BitmapData; protected var bMask:BitmapData; protected var bMap:Bitmap; protected var bAdd:Bitmap; protected var w:uint = 0; protected var h:uint = 0; protected var xB:uint = 10; protected var yB:uint = 8; protected var pixelMatrix:BitmapData protected var speeds:Array; // constructor public function Blocks(t:DisplayObject = null) { super(t) } public static function create(...args):Effect { return Effect.factory(bitfade.effects.Blocks,args) } // set destination values public function show(...args):Effect { target.alpha = 0 worker = worker_block w = target.width h = target.height yB = 8 xB = yB*w/h pixelMatrix = new BitmapData(xB+1,yB+1,true,0) buildBitmaps() speeds = new Array((xB+1)*(yB+1)) var pM:BitmapData = pixelMatrix var bw:uint = w/xB; var bh:uint = h/yB; var idx:uint = 0; var s:Number = 0; for (var xp:uint=0;xp<=xB; xp++) { for (var yp:uint=0;yp<yB; yp++) { if (Math.random() > 0.8) pM.setPixel32(xp,yp,0xFF << 24) } } pM.applyFilter(pM,pM.rect,Geom.origin,new BlurFilter(4,4,1)) return this } protected function buildBitmaps() { bData = Bdata.create(w,h) bMask = Bdata.create(w,h) bMap = new Bitmap(bData) bAdd = new Bitmap(bMask) bAdd.blendMode = "add" addChild(bMap) addChild(bAdd) } // compute tween values protected function worker_block(time:Number):void { var bw:uint = w/xB; var bh:uint = h/yB; bAdd.alpha = 2*time < 1 ? time : 2-2*time bAdd.alpha = 1-alpha //trace(bAdd.alpha) //bAdd.alpha = 1; bAdd.alpha = 0; var pM:BitmapData = pixelMatrix var idx:uint = 0; var bAlpha:uint = 0; var bAlpha2:uint = 0; var s:uint = 0; var c:uint = 0; var ix:uint = 0; var iy:uint = 0; /* for (var xp:uint=0;xp<=xB; xp++) { for (var yp:uint=0;yp<yB; yp++) { pM.setPixel32(xp,yp,time*0xFF*Math.random() << 24) } } */ //pM.applyFilter(pM,pM.rect,Geom.origin,new BlurFilter(4,4,1)) pM.applyFilter(pM,pM.rect,Geom.origin,new ConvolutionFilter(3,3, [ 1,1,1, 1,1,1, 1,1,1 ],8.5,0,false)) //pM.colorTransform(pM.rect,new ColorTransform(1,1,1,1,0,0,0,5)) for (var xp:uint=0;xp<w; xp+=bw,ix++) { iy = 0; for (var yp:uint=0;yp<h; yp+=bh,iy++) { s = pM.getPixel32(ix,iy) bAlpha = Math.min(0xFF,((s >>> 24) + (time*0xFF))) << 24 c = s >>> 24 bAlpha2 = Math.min(0xFF,1.1*c) bMask.fillRect(Geom.rectangle(xp,yp,bw,bh),bAlpha | 0) //bMask.fillRect(Geom.rectangle(xp,yp,bw,1),bAlpha2 << 24 | 0xFFFFFF) //bMask.fillRect(Geom.rectangle(xp,yp,1,bh),bAlpha2 << 24 | 0xFFFFFF) idx++ } } bData.copyPixels(Bitmap(target).bitmapData,bData.rect,Geom.origin,bMask,Geom.origin) } // destruct effect override public function destroy():void { //Gc.destroy(bMaskData) bMask.dispose(); target.alpha = 1 var idx:uint = parent.getChildIndex(this) parent.addChildAt(target,idx) super.destroy() } } } /* commentsOK */
package kabam.rotmg.pets.view.dialogs { import flash.display.DisplayObject; import flash.display.Sprite; import kabam.lib.ui.api.Size; import kabam.rotmg.util.components.VerticalScrollingList; public class GridList extends Sprite { public var list:VerticalScrollingList; private var size:Size; private var row:Sprite; private var rows:Vector.<DisplayObject>; private var items:Array; private var lastItemRight:int; private var padding:int; private var grid:Array; private var maxItemsPerRow:int; public function GridList() { this.list = new VerticalScrollingList(); super(); } public function setSize(_arg_1:Size):void { this.size = _arg_1; this.list.setSize(_arg_1); addChild(this.list); } public function setPadding(_arg_1:int):void { this.padding = _arg_1; this.list.setPadding(_arg_1); } public function setItems(_arg_1:Vector.<PetItem>):void { var _local_2:DisplayObject; this.makeNewList(); for each (_local_2 in _arg_1) { this.addItem(_local_2); } this.list.setItems(this.rows); if (!_arg_1.length) { return; } var _local_3:DisplayObject = _arg_1[0]; this.maxItemsPerRow = (this.maxRowWidth() / _local_3.width); } public function getSize():Size { return (this.size); } public function getItems():Array { return (this.items); } public function getItem(_arg_1:int):DisplayObject { return (this.items[_arg_1]); } private function makeNewList():void { this.grid = []; this.items = []; this.rows = new Vector.<DisplayObject>(); this.lastItemRight = 0; this.addRow(); } private function addItem(_arg_1:DisplayObject):void { this.position(_arg_1); this.row.addChild(_arg_1); this.items.push(_arg_1); this.grid[(this.grid.length - 1)].push(_arg_1); } private function position(_arg_1:DisplayObject):void { if (this.exceedsWidthFor(_arg_1)) { _arg_1.x = 0; this.addRow(); } else { this.positionRightOfPrevious(_arg_1); } this.lastItemRight = (_arg_1.x + _arg_1.width); this.lastItemRight = (this.lastItemRight + this.padding); } private function addRow():void { this.row = new Sprite(); this.rows.push(this.row); this.grid.push([]); } private function positionRightOfPrevious(_arg_1:DisplayObject):void { _arg_1.x = this.lastItemRight; } private function exceedsWidthFor(_arg_1:DisplayObject):Boolean { return (((this.lastItemRight + _arg_1.width) > this.maxRowWidth())); } private function maxRowWidth():int { return ((this.size.width - VerticalScrollingList.SCROLLBAR_GUTTER)); } public function getTopLeft():DisplayObject { if (this.items.length) { return (this.items[0]); } return (null); } public function getTopRight():DisplayObject { var _local_1:Array; if (this.grid.length) { _local_1 = this.grid[0]; return (_local_1[(this.maxItemsPerRow - 1)]); } return (null); } public function getBottomLeft():DisplayObject { var _local_1:Array; if (this.grid.length >= 2) { _local_1 = this.grid[(this.grid.length - 1)]; return (_local_1[0]); } return (null); } public function getBottomRight():DisplayObject { var _local_1:Array; if (this.grid.length >= 2) { _local_1 = this.grid[(this.grid.length - 1)]; return (_local_1[(this.maxItemsPerRow - 1)]); } return (null); } } }//package kabam.rotmg.pets.view.dialogs
package plugins.mxml.spark { import core.base.CoreBaseClassFactory; import core.base.CoreCallback; import core.context.CoreContext; import core.service.CoreServiceContainer; import spark.components.TabBar; /** * @author varadig */ public class GuiTabBar extends TabBar { public function GuiTabBar() { CoreBaseClassFactory.construct(this); } public var sc:CoreServiceContainer; public var context:CoreContext; public var callbacks:Array=[]; public function serviceAddCallback(params:Array):void { CoreBaseClassFactory.serviceAddCallback(this, params); } public function serviceAddCallbacks(params:Array):void { CoreBaseClassFactory.serviceAddCallbacks(this, params); } public function serviceRemoveCallback(params:Array):void { CoreBaseClassFactory.serviceRemoveCallback(this, params); } public function serviceRemoveCallbacks(params:Array):void { CoreBaseClassFactory.serviceRemoveCallbacks(this, params); } protected function createCallBack(group:String):CoreCallback { return CoreBaseClassFactory.createCallBack(this, group); } protected function log(message:Object):void { CoreBaseClassFactory.log(this, message); } } }
package away3d.loaders.misc { import away3d.arcane; import away3d.library.assets.IAsset; import away3d.loaders.parsers.ParserBase; import flash.net.URLRequest; use namespace arcane; /** * ResourceDependency represents the data required to load, parse and resolve additional files ("dependencies") * required by a parser, used by ResourceLoadSession. * */ public class ResourceDependency { private var _id:String; private var _req:URLRequest; private var _assets:Vector.<IAsset>; private var _parentParser:ParserBase; private var _data:*; private var _retrieveAsRawData:Boolean; private var _suppressAssetEvents:Boolean; private var _dependencies:Vector.<ResourceDependency>; arcane var loader:SingleFileLoader; arcane var success:Boolean; public function ResourceDependency(id:String, req:URLRequest, data:*, parentParser:ParserBase, retrieveAsRawData:Boolean = false, suppressAssetEvents:Boolean = false) { _id = id; _req = req; _parentParser = parentParser; _data = data; _retrieveAsRawData = retrieveAsRawData; _suppressAssetEvents = suppressAssetEvents; _assets = new Vector.<IAsset>(); _dependencies = new Vector.<ResourceDependency>(); } public function get id():String { return _id; } public function get assets():Vector.<IAsset> { return _assets; } public function get dependencies():Vector.<ResourceDependency> { return _dependencies; } public function get request():URLRequest { return _req; } public function get retrieveAsRawData():Boolean { return _retrieveAsRawData; } public function get suppresAssetEvents():Boolean { return _suppressAssetEvents; } /** * The data containing the dependency to be parsed, if the resource was already loaded. */ public function get data():* { return _data; } /** * @private * Method to set data after having already created the dependency object, e.g. after load. */ arcane function setData(data:*):void { _data = data; } /** * The parser which is dependent on this ResourceDependency object. */ public function get parentParser():ParserBase { return _parentParser; } /** * Resolve the dependency when it's loaded with the parent parser. For example, a dependency containing an * ImageResource would be assigned to a Mesh instance as a BitmapMaterial, a scene graph object would be added * to its intended parent. The dependency should be a member of the dependencies property. */ public function resolve():void { if (_parentParser) _parentParser.resolveDependency(this); } /** * Resolve a dependency failure. For example, map loading failure from a 3d file */ public function resolveFailure():void { if (_parentParser) _parentParser.resolveDependencyFailure(this); } /** * Resolve the dependencies name */ public function resolveName(asset:IAsset):String { if (_parentParser) return _parentParser.resolveDependencyName(this, asset); return asset.name; } } }
package Shared { import flash.external.ExternalInterface; public class BGSExternalInterface { public function BGSExternalInterface() { super(); } public static function call(param1:Object, ... rest) : void { var _loc3_:String = null; var _loc4_:Function = null; if(AS3.COMPANIONAPP.CompanionAppMode.isOn) { if(ExternalInterface.available) { ExternalInterface.call.apply(null,rest); } else { trace("BGSExternalInterface::call -- ExternalInterface is not available!"); } return; } if(param1 != null) { _loc3_ = rest.shift(); _loc4_ = param1[_loc3_]; if(_loc4_ != null) { _loc4_.apply(null,rest); } else { trace("BGSExternalInterface::call -- Can\'t call function \'" + _loc3_ + "\' on BGSCodeObj. This function doesn\'t exist!"); } } else { trace("BGSExternalInterface::call -- Can\'t call function \'" + _loc3_ + "\' on BGSCodeObj. BGSCodeObj is null!"); } } } }
package LS_Classes { import flash.display.MovieClip; import flash.events.FocusEvent; import flash.events.MouseEvent; import flash.external.ExternalInterface; import flash.text.TextField; import flash.text.TextFormat; public class LSButton extends MovieClip { private var pressedFunc:Function = null; public var onOverFunc:Function = null; public var onOutFunc:Function = null; public var onUpFunc:Function = null; public var onDownFunc:Function = null; public var onOverParams:Object = null; public var onOutParams:Object = null; public var onDownParams:Object = null; private var pressedParams:Object = null; private var textY:Number; private var iconY:Number; public var tooltip:String; public var alignTooltip:String; public var hoverSound:String; public var clickSound:String; public var textNormalAlpha:Number = 1; public var textClickAlpha:Number = 1; public var textDisabledAlpha:Number = 0.5; public var hitArea_mc:MovieClip; public var text_txt:TextField = null; public var bg_mc_close:MovieClip; public var icon_mc:MovieClip; public var disabled_mc:MovieClip; public var m_Disabled:Boolean = false; public var SND_Press:String = ""; public var SND_Over:String = "UI_Generic_Over"; public var SND_Click:String = "UI_Gen_XButton_Click"; public function LSButton() { super(); if(this.text_txt) { this.text_txt.mouseEnabled = false; this.text_txt.alpha = this.textNormalAlpha; } if(this.icon_mc) { this.icon_mc.mouseEnabled = false; this.icon_mc.alpha = this.textNormalAlpha; } if(this.hitArea_mc) { this.hitArea_mc.addEventListener(MouseEvent.MOUSE_DOWN,this.onDown); this.hitArea_mc.addEventListener(MouseEvent.ROLL_OUT,this.onMouseOut); this.hitArea_mc.addEventListener(MouseEvent.ROLL_OVER,this.onMouseOver); } else { addEventListener(MouseEvent.MOUSE_DOWN,this.onDown); addEventListener(MouseEvent.ROLL_OUT,this.onMouseOut); addEventListener(MouseEvent.ROLL_OVER,this.onMouseOver); } addEventListener(FocusEvent.FOCUS_OUT,this.onFocusLost); } public function init(param1:Function, param2:Object = null, param3:Boolean = false) : * { this.pressedFunc = param1; if(param2) { this.pressedParams = param2; } this.setEnabled(!param3); if(this.text_txt) { this.textY = this.text_txt.y; } if(this.icon_mc) { this.iconY = this.icon_mc.y; } } public function initialize(param1:String, param2:Function, param3:Object = null, param4:Number = -1, param5:Boolean = false) : * { this.pressedFunc = param2; if(param3) { this.pressedParams = param3; } this.setEnabled(!param5); if(this.text_txt) { this.textY = this.text_txt.y; } if(this.icon_mc) { this.iconY = this.icon_mc.y; } this.setText(param1,param4); } public function setText(param1:String, param2:Number = -1) : * { var _loc3_:TextFormat = null; if(this.text_txt) { this.text_txt.y = this.textY; if(param2 != -1) { _loc3_ = this.text_txt.defaultTextFormat; _loc3_.size = param2; this.text_txt.defaultTextFormat = _loc3_; } this.text_txt.htmlText = param1; this.textY = this.text_txt.y; this.text_txt.filters = textEffect.createStrokeFilter(0,1.5,0.75,1,3); } } public function setEnabled(param1:Boolean) : * { if(this.disabled_mc) { this.disabled_mc.visible = !param1; } if(this.text_txt) { this.text_txt.alpha = !!param1?Number(this.textNormalAlpha):Number(this.textDisabledAlpha); } if(this.icon_mc) { this.icon_mc.alpha = !!param1?Number(this.textNormalAlpha):Number(this.textDisabledAlpha); } this.m_Disabled = !param1; } private function onFocusLost(param1:FocusEvent) : void { if(this.text_txt) { this.text_txt.y = this.textY; } if(this.icon_mc) { this.icon_mc.y = this.iconY; } } public function onMouseOver(param1:MouseEvent) : * { tooltipHelper.ShowTooltipForMC(this as MovieClip,this.root,this.alignTooltip != null?this.alignTooltip:"right"); if(!this.m_Disabled) { if(this.SND_Over != null) { ExternalInterface.call("PlaySound",this.SND_Over); } if(this.text_txt) { this.text_txt.alpha = this.textClickAlpha; } if(this.icon_mc) { this.icon_mc.alpha = this.textClickAlpha; } this.bg_mc_close.gotoAndStop(2); if(this.onOverFunc != null) { if(this.onOverParams == null) { this.onOverFunc(); } else { this.onOverFunc(this.onOverParams); } } } } public function onMouseOut(param1:MouseEvent) : * { if(this.hitArea_mc) { this.hitArea_mc.removeEventListener(MouseEvent.MOUSE_UP,this.onUp); } else { removeEventListener(MouseEvent.MOUSE_UP,this.onUp); } if(this.tooltip != null) { ExternalInterface.call("hideTooltip"); } this.bg_mc_close.gotoAndStop(1); if(this.onOutFunc != null) { if(this.onOutParams == null) { this.onOutFunc(); } else { this.onOutFunc(this.onOutParams); } } if(this.text_txt && !this.m_Disabled) { this.text_txt.alpha = this.textNormalAlpha; this.text_txt.y = this.textY; } if(this.icon_mc && !this.m_Disabled) { this.icon_mc.alpha = this.textNormalAlpha; this.icon_mc.y = this.iconY; } } public function onDown(param1:MouseEvent) : * { if(this.text_txt) { this.text_txt.y = this.textY; } if(!this.m_Disabled) { if(this.hitArea_mc) { this.hitArea_mc.addEventListener(MouseEvent.MOUSE_UP,this.onUp); } else { addEventListener(MouseEvent.MOUSE_UP,this.onUp); } this.bg_mc_close.gotoAndStop(3); if(this.SND_Press != null) { ExternalInterface.call("PlaySound",this.SND_Press); } if(this.onDownFunc != null) { if(this.onDownParams == null) { this.onDownFunc(); } else { this.onDownFunc(this.onDownParams); } } if(this.text_txt) { this.text_txt.y = this.textY + 2; } if(this.icon_mc) { this.icon_mc.y = this.iconY + 2; } } } public function onUp(param1:MouseEvent) : * { if(this.hitArea_mc) { this.hitArea_mc.removeEventListener(MouseEvent.MOUSE_UP,this.onUp); } else { removeEventListener(MouseEvent.MOUSE_UP,this.onUp); } this.bg_mc_close.gotoAndStop(2); if(this.SND_Click != null) { ExternalInterface.call("PlaySound",this.SND_Click); } if(this.onUpFunc != null) { this.onUpFunc(); } if(this.text_txt) { this.text_txt.y = this.textY; } if(this.icon_mc) { this.icon_mc.y = this.iconY; } if(this.pressedFunc != null && !this.m_Disabled) { if(this.pressedParams != null) { this.pressedFunc(this.pressedParams); } else { this.pressedFunc(); } } } } }
/* InterruptDemo for GTween by Grant Skinner, gskinner.com/blog/ This example demonstrates three concepts: 1) Dynamically creating tweens. 2) Reusing tweens. 3) Interrupting tweens. Test movie, then click around the stage quickly. Note that you can interrupt the tween while it is running, and it will attempt to recover appropriately. */ package { import com.gskinner.motion.GTween; import com.gskinner.motion.easing.*; import flash.events.MouseEvent; import flash.display.MovieClip; import flash.display.Shape; public class GTweenInterrupt extends MovieClip { // Constants: // Public Properties: // Protected Properties: protected var tweens:Array = []; // Initialization: public function GTweenInterrupt() { // draw a bunch of circles, and set up tweens for them: for (var i:int=0; i<25; i++) { // draw the circle, and put it on stage: var circle:Shape = new Shape(); circle.graphics.lineStyle(15,0x113355,1-i*0.02); circle.graphics.drawCircle(0,0,(i+1)*4); circle.x = Math.random()*550; circle.y = Math.random()*400; circle.blendMode = "add"; addChild(circle); // set up a tween for each circle (initially tweening to the center): var circleTween:GTween = new GTween(circle,0.5+i*0.04,{x:275,y:200},{ease:Bounce.easeOut}); tweens.push(circleTween); } stage.addEventListener(MouseEvent.CLICK,handleClick); } // Public getter / setters: // Public Methods: // Protected Methods: protected function handleClick(evt:MouseEvent):void { // update each tween with the new end property values. // note that I didn't create a new tween object, but reused the existing one instead. for (var i:int=0; i<tweens.length; i++) { tweens[i].setValues({x:mouseX,y:mouseY}); } } } }
/* Copyright (c) 2010, Adobe Systems Incorporated All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Adobe Systems Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.facebook.graph.utils { /** * Util to parse the data returned in fql.multiquery into object of name-value pairs * */ public class FQLMultiQueryParser implements IResultParser { /** * Creates a new FQLMultiQueryParser. * */ public function FQLMultiQueryParser() { } /** * Parses the resulting data object * * @param data The data object to parse * @return Object The parsed data object * */ public function parse(data:Object):Object { var o:Object = {}; for (var n:String in data) { o[data[n].name] = data[n].fql_result_set; } return o; } } }
package nid.image.tools { import flash.display.BitmapData; /** * ... * @author Nidin Vinayak */ public class BitmapMergeUtils { /** * Merge two bitmapdata with transparency * @param BitmapData 1 * @param BitmapData 2 * @return BitmapData */ public static function merge(bmp1:BitmapData, bmp2:BitmapData):BitmapData { var width:int = Math.max(bmp1.width, bmp2.width); var height:int = Math.max(bmp1.height, bmp2.height); var sourceARGB:uint, sourceA:uint, sourceR:uint, sourceG:uint, sourceB:uint; var targetARGB:uint, targetA:uint, targetR:uint, targetG:uint, targetB:uint; var mergedARGB:uint, mergedA:uint, mergedR:uint, mergedG:uint, mergedB:uint; var mergedBmp:BitmapData = new BitmapData(width, height); for (var y:int = 0; y < height; y++) { for (var x:int = 0; x < width; x++) { sourceARGB = bmp1.getPixel32(x, y); targetARGB = bmp2.getPixel32(x, y); targetA = targetARGB >> 24 & 0xff if (targetA == 0) { mergedBmp.setPixel32(x, y, sourceARGB); } else if (targetA < 0xff) { sourceA = sourceARGB >> 24 & 0xff sourceR = sourceARGB >> 16 & 0xff sourceG = sourceARGB >> 8 & 0xff sourceB = sourceARGB & 0xff; targetR = targetARGB >> 16 & 0xff; targetG = targetARGB >> 8 & 0xff; targetB = targetARGB & 0xff; var src:Number = sourceA / 0xff; var tgt:Number = targetA / 0xff; mergedR = (src * sourceR + tgt * targetR * (1 - src)); mergedG = (src * sourceG + tgt * targetG * (1 - src)); mergedB = (src * sourceB + tgt * targetB * (1 - src)); mergedA = ((src + tgt * (1 - src)) * 0xff); mergedARGB = (mergedA << 24) | (mergedR << 16) | (mergedG << 8) | mergedB; mergedBmp.setPixel32(x, y, mergedARGB); } else { mergedBmp.setPixel32(x, y, targetARGB); } } } return mergedBmp; } } }
package box2dstarling { import box2dstarling.ALevel; import box2dstarling.MyGameData; import citrus.core.IState; import citrus.core.starling.StarlingCitrusEngine; import citrus.utils.LevelManager; [SWF(frameRate="60")] /** * @author Aymeric */ public class Main extends StarlingCitrusEngine { public function Main() { setUpStarling(true); gameData = new MyGameData(); levelManager = new LevelManager(ALevel); levelManager.onLevelChanged.add(_onLevelChanged); levelManager.levels = gameData.levels; levelManager.gotoLevel(); } private function _onLevelChanged(lvl:ALevel):void { state = lvl; lvl.lvlEnded.add(_nextLevel); lvl.restartLevel.add(_restartLevel); } private function _nextLevel():void { levelManager.nextLevel(); } private function _restartLevel():void { state = levelManager.currentLevel as IState; } } }
package away3d.tools.helpers { import away3d.arcane; import away3d.core.base.ISubGeometry; import away3d.core.base.SubGeometry; import away3d.core.base.CompactSubGeometry; import away3d.core.base.data.UV; import away3d.core.base.data.Vertex; import away3d.entities.Mesh; use namespace arcane; /** * Helper Class for face manipulation<code>FaceHelper</code> */ public class FaceHelper { private static const LIMIT:uint = 196605; private static const SPLIT:uint = 2; private static const TRI:uint = 3; private static const QUARTER:uint = 4; private static var _n:Vertex = new Vertex(); private static var _t:Vertex = new Vertex(); /*Adding a face*/ public static function addFace(mesh:Mesh, v0:Vertex, v1:Vertex, v2:Vertex, uv0:UV, uv1:UV, uv2:UV, subGeomIndice:uint):void { var subGeom:SubGeometry; if (mesh.geometry.subGeometries.length == 0) { subGeom = new SubGeometry(); mesh.geometry.addSubGeometry(subGeom); } else { if (mesh.geometry.subGeometries[0] is CompactSubGeometry) mesh.geometry.convertToSeparateBuffers(); } if (mesh.geometry.subGeometries.length - 1 < subGeomIndice) throw new Error("no subGeometry at index provided:" + subGeomIndice); subGeom = SubGeometry(mesh.geometry.subGeometries[subGeomIndice]); var vertices:Vector.<Number> = subGeom.vertexData || new Vector.<Number>(); var normals:Vector.<Number> = subGeom.vertexNormalData || new Vector.<Number>(); var tangents:Vector.<Number> = subGeom.vertexTangentData || new Vector.<Number>(); var indices:Vector.<uint>; var uvs:Vector.<Number>; var lengthVertices:uint = vertices.length; _n = getFaceNormal(v0, v1, v2, _n); _t = getFaceTangent(v0, v1, v2, uv0.v, uv1.v, uv2.v, 1, _t); if (lengthVertices + 9 > LIMIT) { indices = Vector.<uint>([0, 1, 2]); vertices = Vector.<Number>([v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, v2.x, v2.y, v2.z]); uvs = Vector.<Number>([uv0.u, uv0.v, uv1.u, uv1.v, uv2.u, uv2.v]); normals = Vector.<Number>([_n.x, _n.y, _n.z, _n.x, _n.y, _n.z, _n.x, _n.y, _n.z]); tangents = Vector.<Number>([_t.x, _t.y, _t.z, _t.x, _t.y, _t.z, _t.x, _t.y, _t.z]); subGeom = new SubGeometry(); mesh.geometry.addSubGeometry(subGeom); } else { indices = subGeom.indexData || new Vector.<uint>(); uvs = subGeom.UVData || new Vector.<Number>(); vertices.fixed = indices.fixed = uvs.fixed = false; var ind:uint = lengthVertices/3; var nind:uint = indices.length; indices[nind++] = ind++; indices[nind++] = ind++; indices[nind++] = ind++; vertices.push(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, v2.x, v2.y, v2.z); uvs.push(uv0.u, uv0.v, uv1.u, uv1.v, uv2.u, uv2.v); normals.push(_n.x, _n.y, _n.z, _n.x, _n.y, _n.z, _n.x, _n.y, _n.z); tangents.push(_t.x, _t.y, _t.z, _t.x, _t.y, _t.z, _t.x, _t.y, _t.z); } updateSubGeometryData(subGeom, vertices, indices, uvs, normals, tangents); } /** * Remove a face from a mesh * @param mesh Mesh. The mesh to remove a face from * @param index uint. Index of the face in vertices. The value represents the position in indices vector divided by 3. * For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 3 in vertice vector is then extracted from vertices[indices[indice]] * @param subGeomIndice uint. Index of vertex 1 of the face */ public static function removeFace(mesh:Mesh, index:uint, subGeomIndice:uint):void { var pointer:uint = index*3; var subGeom:SubGeometry = getSubGeometry(mesh, subGeomIndice); var indices:Vector.<uint> = subGeom.indexData.concat(); if (pointer > indices.length - 3) throw new Error("ERROR >> face index out of range! Use the location in indice vector /3. For example, pass 1 if you want edit face 1, not 3!"); var vertices:Vector.<Number> = subGeom.vertexData.concat(); var normals:Vector.<Number> = subGeom.vertexNormalData.concat(); var tangents:Vector.<Number> = subGeom.vertexTangentData.concat(); var uvs:Vector.<Number> = subGeom.UVData.concat(); var pointerEnd:uint = pointer + 2; var oInd:uint; var oVInd:uint; var oUVInd:uint; var indInd:uint; var uvInd:uint; var vInd:uint; var i:uint; var nvertices:Vector.<Number> = new Vector.<Number>(); var nnormals:Vector.<Number> = new Vector.<Number>(); var ntangents:Vector.<Number> = new Vector.<Number>(); var nindices:Vector.<uint> = new Vector.<uint>(); var nuvs:Vector.<Number> = new Vector.<Number>(); //Check for shared vectors if (vertices.length/3 != indices.length) { var sharedIndice:int; for (i = 0; i < indices.length; ++i) { if (i >= pointer && i <= pointerEnd) continue; oInd = indices[i]; oVInd = oInd*3; oUVInd = oInd*2; sharedIndice = getUsedIndice(nvertices, vertices[oVInd], vertices[oVInd + 1], vertices[oVInd + 2]); if (sharedIndice != -1) { nindices[indInd++] = sharedIndice; continue; } nindices[indInd++] = nvertices.length/3; nvertices[vInd] = vertices[oVInd]; nnormals[vInd] = normals[oVInd]; ntangents[vInd] = tangents[oVInd]; vInd++; oVInd++; nvertices[vInd] = vertices[oVInd]; nnormals[vInd] = normals[oVInd]; ntangents[vInd] = tangents[oVInd]; vInd++; oVInd++; nvertices[vInd] = vertices[oVInd]; nnormals[vInd] = normals[oVInd]; ntangents[vInd] = tangents[oVInd]; vInd++; nuvs[uvInd++] = uvs[oUVInd]; nuvs[uvInd++] = uvs[oUVInd + 1]; } } else { for (i = 0; i < indices.length; ++i) { if (i < pointer || i > pointerEnd) { oInd = indices[i]; oVInd = oInd*3; oUVInd = oInd*2; nindices[indInd++] = vInd/3; nvertices[vInd] = vertices[oVInd]; nnormals[vInd] = normals[oVInd]; ntangents[vInd] = tangents[oVInd]; vInd++; oVInd++; nvertices[vInd] = vertices[oVInd]; nnormals[vInd] = normals[oVInd]; ntangents[vInd] = tangents[oVInd]; vInd++; oVInd++; nvertices[vInd] = vertices[oVInd]; nnormals[vInd] = normals[oVInd]; ntangents[vInd] = tangents[oVInd]; vInd++; nuvs[uvInd++] = uvs[oUVInd]; nuvs[uvInd++] = uvs[oUVInd + 1]; } } } updateSubGeometryData(subGeom, nvertices, nindices, nuvs, nnormals, ntangents); } /** * Remove a series of faces from a mesh. Indices and geomIndices must have the same length. * Meshes with less that 20k faces and single material, will generally only have one single subgeometry. * The geomIndices vector will then contain only zeros. * IMPORTANT: the code considers the indices as location in the mesh subgemeometry indices vector, not the value at the pointer location. * * @param mesh Mesh. The mesh to remove a face from * @param indices A vector with a series of uints indices: the indices of the faces to be removed. * @param subGeomIndices A vector with a series of uints indices representing the subgeometries of the faces to be removed. */ public static function removeFaces(mesh:Mesh, indices:Vector.<uint>, subGeomIndices:Vector.<uint>):void { for (var i:uint = 0; i < indices.length; ++i) removeFace(mesh, indices[i], subGeomIndices[i]); } /** * Adds a series of faces from a mesh. All vectors must have the same length. * @param mesh Mesh. The mesh to remove a face from * @param v0s A vector with a series of Vertex Objects representing the v0 of a face. * @param v1s A vector with a series of Vertex Objects representing the v1 of a face. * @param v2s A vector with a series of Vertex Objects representing the v2 of a face. * @param uv0s A vector with a series of UV Objects representing the uv0 of a face. * @param uv1s A vector with a series of UV Objects representing the uv1 of a face. * @param uv2s A vector with a series of UV Objects representing the uv2 of a face. */ public static function addFaces(mesh:Mesh, v0s:Vector.<Vertex>, v1s:Vector.<Vertex>, v2s:Vector.<Vertex>, uv0s:Vector.<UV>, uv1s:Vector.<UV>, uv2s:Vector.<UV>, subGeomIndices:Vector.<uint>):void { for (var i:uint = 0; i < v0s.length; ++i) addFace(mesh, v0s[i], v1s[i], v2s[i], uv0s[i], uv1s[i], uv2s[i], subGeomIndices[i]); } /** * Divides a face into 2 faces. * @param mesh The mesh holding the face to split in 2 * @param indice The face index. The value represents the position in indices vector divided by 3. * For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 9 in vertices vector is then extracted from vertices[indices[indice*3]] * @param subGeomIndice The index of the subgeometry holder this face. * @param side [optional] The side of the face to split in two. 0 , 1 or 2. (clockwize). */ public static function splitFace(mesh:Mesh, indice:uint, subGeomIndice:uint, side:uint = 0):void { var pointer:uint = indice*3; var subGeom:SubGeometry = getSubGeometry(mesh, subGeomIndice); var indices:Vector.<uint> = subGeom.indexData.concat(); if (pointer > indices.length - 3) throw new Error("ERROR >> face index out of range! Use the location in indice vector /3. For example, pass 1 if you want edit face 1, not 3!"); var vertices:Vector.<Number> = subGeom.vertexData.concat(); if (indices.length + 3 > LIMIT || vertices.length + 9 > LIMIT) { trace("splitFace cannot take place, not enough room in target subGeometry"); return; } var uvs:Vector.<Number> = subGeom.UVData.concat(); var normals:Vector.<Number> = subGeom.vertexNormalData.concat(); var tangents:Vector.<Number> = subGeom.vertexTangentData.concat(); var pointerverts:uint = indices[pointer]*3; var v0:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n0:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t0:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); pointerverts = indices[pointer + 1]*3; var v1:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n1:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t1:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); pointerverts = indices[pointer + 2]*3; var v2:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n2:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t2:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); var pointeruv:uint = indices[pointer]*2; var uv0:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); pointeruv = indices[pointer + 1]*2; var uv1:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); pointeruv = indices[pointer + 2]*2; var uv2:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); var vlength:uint = indices.length; indices[vlength] = vlength/3; var targetIndice:uint; switch (side) { case 0: vertices.push((v0.x + v1.x)*.5, (v0.y + v1.y)*.5, (v0.z + v1.z)*.5); normals.push((n0.x + n1.x)*.5, (n0.y + n1.y)*.5, (n0.z + n1.z)*.5); tangents.push((t0.x + t1.x)*.5, (t0.y + t1.y)*.5, (t0.z + t1.z)*.5); uvs.push((uv0.u + uv1.u)*.5, (uv0.v + uv1.v)*.5); targetIndice = indices[(indice*3) + 1]; indices[(indice*3) + 1] = (vertices.length - 1)/3; indices[vlength++] = indices[pointer + 1]; indices[vlength++] = targetIndice; indices[vlength++] = indices[pointer + 2]; break; case 1: vertices.push((v1.x + v2.x)*.5, (v1.y + v2.y)*.5, (v1.z + v2.z)*.5); normals.push((n1.x + n2.x)*.5, (n1.y + n2.y)*.5, (n1.z + n2.z)*.5); tangents.push((t1.x + t2.x)*.5, (t1.y + t2.y)*.5, (t1.z + t2.z)*.5); uvs.push((uv1.u + uv2.u)*.5, (uv1.v + uv2.v)*.5); targetIndice = indices[(indice*3) + 2]; indices[(indice*3) + 2] = targetIndice; indices[vlength++] = (vertices.length - 1)/3; indices[vlength++] = indices[pointer + 2]; indices[vlength++] = indices[pointer]; break; default: vertices.push((v2.x + v0.x)*.5, (v2.y + v0.y)*.5, (v2.z + v0.z)*.5); normals.push((n2.x + n0.x)*.5, (n2.y + n0.y)*.5, (n2.z + n0.z)*.5); tangents.push((t2.x + t0.x)*.5, (t2.y + t0.y)*.5, (t2.z + t0.z)*.5); uvs.push((uv2.u + uv0.u)*.5, (uv2.v + uv0.v)*.5); targetIndice = indices[indice*3]; indices[indice*3] = targetIndice; indices[vlength++] = (vertices.length - 1)/3; indices[vlength++] = indices[pointer]; indices[vlength++] = indices[pointer + 1]; } v0 = v1 = v2 = n0 = n1 = n2 = t0 = t1 = t2 = null; uv0 = uv1 = uv2 = null; updateSubGeometryData(subGeom, vertices, indices, uvs, normals, tangents); } /** * Divides a face into 3 faces. * @param mesh The mesh holding the face to split in 3. * @param indice The face index. The value represents the position in indices vector divided by 3. * For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 9 in vertices vector is then extracted from vertices[indices[indice*3]] * @param subGeomIndice The index of the subgeometry holder this face. */ public static function triFace(mesh:Mesh, indice:uint, subGeomIndice:uint):void { var pointer:uint = indice*3; var subGeom:SubGeometry = getSubGeometry(mesh, subGeomIndice); var indices:Vector.<uint> = subGeom.indexData.concat(); if (pointer > indices.length - 3) throw new Error("ERROR >> face index out of range! Use the location in indice vector /3. For example, pass 1 if you want edit face 1, not 3!"); var vertices:Vector.<Number> = subGeom.vertexData.concat(); if (indices.length + 6 > LIMIT || vertices.length + 18 > LIMIT) { trace("triFace cannot take place, not enough room in target subGeometry"); return; } var uvs:Vector.<Number> = subGeom.UVData.concat(); var normals:Vector.<Number> = subGeom.vertexNormalData.concat(); var tangents:Vector.<Number> = subGeom.vertexTangentData.concat(); var pointerverts:uint = indices[pointer]*3; var v0:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n0:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t0:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); pointerverts = indices[pointer + 1]*3; var v1:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n1:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t1:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); pointerverts = indices[pointer + 2]*3; var v2:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n2:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t2:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); var pointeruv:uint = indices[pointer]*2; var uv0:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); pointeruv = indices[pointer + 1]*2; var uv1:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); pointeruv = indices[pointer + 2]*2; var uv2:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); vertices.push((v0.x + v1.x + v2.x)/3, (v0.y + v1.y + v2.y)/3, (v0.z + v1.z + v2.z)/3); normals.push((n0.x + n1.x + n2.x)/3, (n0.y + n1.y + n2.y)/3, (n0.z + n1.z + n2.z)/3); tangents.push((t0.x + t1.x + t2.x)/3, (t0.y + t1.y + t2.y)/3, (t0.z + t1.z + t2.z)/3); uvs.push((uv0.u + uv1.u + uv2.u)/3, (uv0.v + uv1.v + uv2.v)/3); var vlength:uint = indices.length; var ind:uint = vlength/3; indices[(indice*3) + 2] = (vertices.length - 1)/3; indices[vlength++] = ind; indices[vlength++] = indices[pointer]; indices[vlength++] = indices[pointer + 2]; indices[vlength++] = indices[pointer + 1]; indices[vlength++] = ind; indices[vlength++] = indices[pointer + 2]; v0 = v1 = v2 = n0 = n1 = n2 = t0 = t1 = t2 = null; uv0 = uv1 = uv2 = null; updateSubGeometryData(subGeom, vertices, indices, uvs, normals, tangents); } /** * Divides a face into 4 faces. * @param mesh The mesh holding the face to split in 4. * @param indice The face index. The value represents the position in indices vector divided by 3. * For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 9 in vertices vector is then extracted from vertices[indices[indice*3]] * @param subGeomIndice The index of the subgeometry holder this face. */ public static function quarterFace(mesh:Mesh, indice:uint, subGeomIndice:uint):void { var pointer:uint = indice*3; var subGeom:SubGeometry = getSubGeometry(mesh, subGeomIndice); var indices:Vector.<uint> = subGeom.indexData.concat(); if (pointer > indices.length - 3) throw new Error("ERROR >> face index out of range! Use the location in indice vector /3. For example, pass 1 if you want edit face 1, not 3!"); var vertices:Vector.<Number> = subGeom.vertexData.concat(); if (indices.length + 9 > LIMIT || vertices.length + 27 > LIMIT) { trace("quarterFace cannot take place, not enough room in target subGeometry"); return; } var uvs:Vector.<Number> = subGeom.UVData.concat(); var normals:Vector.<Number> = subGeom.vertexNormalData.concat(); var tangents:Vector.<Number> = subGeom.vertexTangentData.concat(); var pointerverts:uint = indices[pointer]*3; var v0:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n0:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t0:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); pointerverts = indices[pointer + 1]*3; var v1:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n1:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t1:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); pointerverts = indices[pointer + 2]*3; var v2:Vertex = new Vertex(vertices[pointerverts], vertices[pointerverts + 1], vertices[pointerverts + 2]); var n2:Vertex = new Vertex(normals[pointerverts], normals[pointerverts + 1], normals[pointerverts + 2]); var t2:Vertex = new Vertex(tangents[pointerverts], tangents[pointerverts + 1], tangents[pointerverts + 2]); var pointeruv:uint = indices[pointer]*2; var uv0:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); pointeruv = indices[pointer + 1]*2; var uv1:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); pointeruv = indices[pointer + 2]*2; var uv2:UV = new UV(uvs[pointeruv], uvs[pointeruv + 1]); var vind1:uint = vertices.length/3; vertices.push((v0.x + v1.x)*.5, (v0.y + v1.y)*.5, (v0.z + v1.z)*.5); normals.push((n0.x + n1.x)*.5, (n0.y + n1.y)*.5, (n0.z + n1.z)*.5); tangents.push((t0.x + t1.x)*.5, (t0.y + t1.y)*.5, (t0.z + t1.z)*.5); uvs.push((uv0.u + uv1.u)*.5, (uv0.v + uv1.v)*.5); var vind2:uint = vertices.length/3; vertices.push((v1.x + v2.x)*.5, (v1.y + v2.y)*.5, (v1.z + v2.z)*.5); normals.push((n1.x + n2.x)*.5, (n1.y + n2.y)*.5, (n1.z + n2.z)*.5); tangents.push((t1.x + t2.x)*.5, (t1.y + t2.y)*.5, (t1.z + t2.z)*.5); uvs.push((uv1.u + uv2.u)*.5, (uv1.v + uv2.v)*.5); var vind3:uint = vertices.length/3; vertices.push((v2.x + v0.x)*.5, (v2.y + v0.y)*.5, (v2.z + v0.z)*.5); normals.push((n2.x + n0.x)*.5, (n2.y + n0.y)*.5, (n2.z + n0.z)*.5); tangents.push((t2.x + t0.x)*.5, (t2.y + t0.y)*.5, (t2.z + t0.z)*.5); uvs.push((uv2.u + uv0.u)*.5, (uv2.v + uv0.v)*.5); var vlength:uint = indices.length; indices[vlength++] = vind2; indices[vlength++] = indices[pointer + 2]; indices[vlength++] = vind3; indices[vlength++] = vind2; indices[vlength++] = vind3; indices[vlength++] = vind1; indices[vlength++] = vind2; indices[vlength++] = vind1; indices[vlength++] = indices[pointer + 1]; indices[(indice*3) + 1] = vind1; indices[(indice*3) + 2] = vind3; v0 = v1 = v2 = n0 = n1 = n2 = t0 = t1 = t2 = null; uv0 = uv1 = uv2 = null; updateSubGeometryData(subGeom, vertices, indices, uvs, normals, tangents); } /** * Divides all the faces of a mesh in 2 faces. * @param mesh The mesh holding the faces to split in 2 * @param face The face index. The value represents the position in indices vector divided by 3. * @param side The side of the face to split in two. 0 , 1 or 2. (clockwize). * At this time of dev, splitFaces method will abort if a subgeometry reaches max buffer limit of 65k */ public static function splitFaces(mesh:Mesh):void { applyMethod(SPLIT, mesh); } /** * Divides all the faces of a mesh in 3 faces. * @param mesh The mesh holding the faces to split in 3 * At this time of dev, triFaces method will abort if a subgeometry reaches max buffer limit of 65k */ public static function triFaces(mesh:Mesh):void { applyMethod(TRI, mesh); } /** * Divides all the faces of a mesh in 4 faces. * @param mesh The mesh holding the faces to split in 4 * At this time of dev, quarterFaces method will abort if a subgeometry reaches max buffer limit of 65k */ public static function quarterFaces(mesh:Mesh):void { applyMethod(QUARTER, mesh); } public static function getFaceNormal(v0:Vertex, v1:Vertex, v2:Vertex, out:Vertex = null):Vertex { var dx1:Number = v2.x - v0.x; var dy1:Number = v2.y - v0.y; var dz1:Number = v2.z - v0.z; var dx2:Number = v1.x - v0.x; var dy2:Number = v1.y - v0.y; var dz2:Number = v1.z - v0.z; var cx:Number = dz1*dy2 - dy1*dz2; var cy:Number = dx1*dz2 - dz1*dx2; var cz:Number = dy1*dx2 - dx1*dy2; var d:Number = 1/Math.sqrt(cx*cx + cy*cy + cz*cz); var normal:Vertex = out || new Vertex(0.0, 0.0, 0.0); normal.x = cx*d; normal.y = cy*d; normal.z = cz*d; return normal; } public static function getFaceTangent(v0:Vertex, v1:Vertex, v2:Vertex, uv0V:Number, uv1V:Number, uv2V:Number, uvScaleV:Number = 1, out:Vertex = null):Vertex { var invScale:Number = 1/uvScaleV; var dv0:Number = uv0V; var dv1:Number = (uv1V - dv0)*invScale; var dv2:Number = (uv2V - dv0)*invScale; var x0:Number = v0.x; var y0:Number = v0.y; var z0:Number = v0.z; var dx1:Number = v1.x - x0; var dy1:Number = v1.y - y0; var dz1:Number = v1.z - z0; var dx2:Number = v2.x - x0; var dy2:Number = v2.y - y0; var dz2:Number = v2.z - z0; var tangent:Vertex = out || new Vertex(0.0, 0.0, 0.0); var cx:Number = dv2*dx1 - dv1*dx2; var cy:Number = dv2*dy1 - dv1*dy2; var cz:Number = dv2*dz1 - dv1*dz2; var denom:Number = 1/Math.sqrt(cx*cx + cy*cy + cz*cz); tangent.x = denom*cx; tangent.y = denom*cy; tangent.z = denom*cz; return tangent; } private static function applyMethod(methodID:uint, mesh:Mesh, value:Number = 0):void { var subGeoms:Vector.<ISubGeometry> = mesh.geometry.subGeometries; if (subGeoms[0] is CompactSubGeometry) throw new Error("Convert to CompactSubGeometry using mesh.geometry.convertToSeparateBuffers() "); var indices:Vector.<uint>; var faceIndex:uint; var j:uint; for (var i:uint = 0; i < subGeoms.length; ++i) { indices = subGeoms[i].indexData; faceIndex = 0; for (j = 0; j < indices.length; j += 3) { faceIndex = j/3; switch (methodID) { case 2: splitFace(mesh, faceIndex, i, 0); break; case 3: triFace(mesh, faceIndex, i); break; case 4: quarterFace(mesh, faceIndex, i); break; default: throw new Error("unknown method reference"); } } } } private static function updateSubGeometryData(subGeometry:SubGeometry, vertices:Vector.<Number>, indices:Vector.<uint>, uvs:Vector.<Number>, normals:Vector.<Number> = null, tangents:Vector.<Number> = null):void { subGeometry.updateVertexData(vertices); subGeometry.updateIndexData(indices); if (normals) subGeometry.updateVertexNormalData(normals); if (tangents) subGeometry.updateVertexTangentData(tangents); subGeometry.updateUVData(uvs); } private static function getSubGeometry(mesh:Mesh, subGeomIndice:uint):SubGeometry { var subGeoms:Vector.<ISubGeometry> = mesh.geometry.subGeometries; if (subGeoms[0] is CompactSubGeometry) throw new Error("Convert to CompactSubGeometry using mesh.geometry.convertToSeparateBuffers() "); if (subGeomIndice > subGeoms.length - 1) throw new Error("ERROR >> subGeomIndice is out of range!"); return SubGeometry(subGeoms[subGeomIndice]); } private static function getUsedIndice(vertices:Vector.<Number>, x:Number, y:Number, z:Number):int { for (var i:uint = 0; i < vertices.length; i += 3) { if (vertices[i] == x && vertices[i + 1] == y && vertices[i + 1] == z) return i/3; } return -1; } } }
package im.siver.logger.models { public interface LoggerClient { function send(id:String, data:Object):void; function get fileLocation():String; function get fileTitle():String; function get isFlex():Boolean; function get isDebugger():Boolean; function get onData():Function; function get onDisconnect():Function; function set onData(value:Function):void; function set onDisconnect(value:Function):void; function get onStart():Function; function set onStart(value: Function):void; } }
/* * Copyright 2017 FreshPlanet * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.freshplanet.ane.AirAlert { import flash.events.EventDispatcher; import flash.events.StatusEvent; import flash.external.ExtensionContext; import flash.system.Capabilities; public class AirAlert extends EventDispatcher { // --------------------------------------------------------------------------------------// // // // PUBLIC API // // // // --------------------------------------------------------------------------------------// /** AirAlert is supported on iOS and Android devices. */ public static function get isSupported() : Boolean { return isAndroid || isIOS; } /** * AirAlert instance * @return AirAlert instance */ public static function get instance() : AirAlert { return _instance ? _instance : new AirAlert(); } /** * Show alert * @param title Alert title * @param message Alert message * @param button1 First button title * @param callback1 First button callback * @param button2 Second button title (optional) * @param callback2 Second button callback (optional) */ public function showAlert( title : String, message : String, button1 : String = "OK", callback1 : Function = null, button2 : String = null, callback2 : Function = null ) : void { if (!isSupported) return; _callback1 = callback1; _callback2 = callback2; if (button2 == null) _context.call("showAlert", title, message, button1); else _context.call("showAlert", title, message, button1, button2); } // --------------------------------------------------------------------------------------// // // // PRIVATE API // // // // --------------------------------------------------------------------------------------// private static const EXTENSION_ID : String = "com.freshplanet.ane.AirAlert"; private static var _instance : AirAlert = null; private var _context : ExtensionContext = null; private var _callback1 : Function = null; private var _callback2 : Function = null; /** * "private" singleton constructor */ public function AirAlert() { if (!_instance) { _context = ExtensionContext.createExtensionContext(EXTENSION_ID, null); if (!_context) { throw Error("ERROR - Extension context is null. Please check if extension.xml is setup correctly."); return; } _context.addEventListener(StatusEvent.STATUS, onStatus); _instance = this; } else { throw Error("This is a singleton, use getInstance(), do not call the constructor directly."); } } private function onStatus( event : StatusEvent ) : void { if (event.code == "CLICK") { var callback:Function = null; if (event.level == "0") callback = _callback1; else if (event.level == "1") callback = _callback2; _callback1 = null; _callback2 = null; if (callback != null) callback(); } } private static function get isIOS():Boolean { return Capabilities.manufacturer.indexOf("iOS") > -1 && Capabilities.os.indexOf("x86_64") < 0 && Capabilities.os.indexOf("i386") < 0; } private static function get isAndroid():Boolean { return Capabilities.manufacturer.indexOf("Android") > -1; } } }
/* Feathers Copyright 2012-2016 Bowler Hat LLC. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.controls { import feathers.core.FeathersControl; import feathers.core.IValidating; import feathers.layout.Direction; import feathers.layout.HorizontalAlign; import feathers.layout.HorizontalLayout; import feathers.layout.ILayout; import feathers.layout.IVirtualLayout; import feathers.layout.LayoutBoundsResult; import feathers.layout.VerticalAlign; import feathers.layout.VerticalLayout; import feathers.layout.ViewPortBounds; import feathers.skins.IStyleProvider; import flash.geom.Point; import starling.display.DisplayObject; import starling.display.Quad; import starling.events.Event; import starling.events.Touch; import starling.events.TouchEvent; import starling.events.TouchPhase; import starling.utils.Pool; /** * The symbols may be positioned vertically or horizontally. * * <p>In the following example, the direction is changed to vertical:</p> * * <listing version="3.0"> * pages.direction = Direction.VERTICAL;</listing> * * @default feathers.layout.Direction.HORIZONTAL * * @see feathers.layout.Direction#HORIZONTAL * @see feathers.layout.Direction#VERTICAL */ [Style(name="direction",type="String")] /** * The spacing, in pixels, between symbols. * * <p>In the following example, the gap between symbols is set to 20 pixels:</p> * * <listing version="3.0"> * pages.gap = 20;</listing> * * @default 0 */ [Style(name="gap",type="Number")] /** * The alignment of the symbols on the horizontal axis. * * <p>In the following example, the symbols are horizontally aligned to * the right:</p> * * <listing version="3.0"> * pages.horizontalAlign = HorizontalAlign.RIGHT;</listing> * * @default feathers.layout.HorizontalAlign.CENTER * * @see feathers.layout.HorizontalAlign#LEFT * @see feathers.layout.HorizontalAlign#CENTER * @see feathers.layout.HorizontalAlign#RIGHT */ [Style(name="horizontalAlign",type="String")] /** * Determines how the selected index changes on touch. * * <p>In the following example, the interaction mode is changed to precise:</p> * * <listing version="3.0"> * pages.direction = PageIndicatorInteractionMode.PRECISE;</listing> * * @default feathers.controls.PageIndicatorInteractionMode.PREVIOUS_NEXT * * @see feathers.controls.PageIndicatorInteractionMode#PREVIOUS_NEXT * @see feathers.controls.PageIndicatorInteractionMode#PRECISE */ [Style(name="interactionMode",type="String")] /** * A function used to create a normal symbol. May be any Starling * display object. * * <p>This function should have the following signature:</p> * <pre>function():DisplayObject</pre> * * <p>In the following example, a custom normal symbol factory is provided * to the page indicator:</p> * * <listing version="3.0"> * pages.normalSymbolFactory = function():DisplayObject * { * return new Image( texture ); * };</listing> * * @see http://doc.starling-framework.org/core/starling/display/DisplayObject.html starling.display.DisplayObject * @see #style:selectedSymbolFactory */ [Style(name="normalSymbolFactory",type="Function")] /** * Quickly sets all padding properties to the same value. The * <code>padding</code> getter always returns the value of * <code>paddingTop</code>, but the other padding values may be * different. * * <p>In the following example, the padding is set to 20 pixels:</p> * * <listing version="3.0"> * pages.padding = 20;</listing> * * @default 0 * * @see #style:paddingTop * @see #style:paddingRight * @see #style:paddingBottom * @see #style:paddingLeft */ [Style(name="padding",type="Number")] /** * The minimum space, in pixels, between the top edge of the component * and the top edge of the content. * * <p>In the following example, the top padding is set to 20 pixels:</p> * * <listing version="3.0"> * pages.paddingTop = 20;</listing> * * @default 0 * * @see #style:padding */ [Style(name="paddingTop",type="Number")] /** * The minimum space, in pixels, between the right edge of the component * and the right edge of the content. * * <p>In the following example, the right padding is set to 20 pixels:</p> * * <listing version="3.0"> * pages.paddingRight = 20;</listing> * * @default 0 * * @see #style:padding */ [Style(name="paddingRight",type="Number")] /** * The minimum space, in pixels, between the bottom edge of the component * and the bottom edge of the content. * * <p>In the following example, the bottom padding is set to 20 pixels:</p> * * <listing version="3.0"> * pages.paddingBottom = 20;</listing> * * @default 0 * * @see #style:padding */ [Style(name="paddingBottom",type="Number")] /** * The minimum space, in pixels, between the left edge of the component * and the left edge of the content. * * <p>In the following example, the left padding is set to 20 pixels:</p> * * <listing version="3.0"> * pages.paddingLeft = 20;</listing> * * @default 0 * * @see #style:padding */ [Style(name="paddingLeft",type="Number")] /** * A function used to create a selected symbol. May be any Starling * display object. * * <p>This function should have the following signature:</p> * <pre>function():DisplayObject</pre> * * <p>In the following example, a custom selected symbol factory is provided * to the page indicator:</p> * * <listing version="3.0"> * pages.selectedSymbolFactory = function():DisplayObject * { * return new Image( texture ); * };</listing> * * @see http://doc.starling-framework.org/core/starling/display/DisplayObject.html starling.display.DisplayObject * @see #style:normalSymbolFactory */ [Style(name="selectedSymbolFactory",type="Function")] /** * The alignment of the symbols on the vertical axis. * * <p>In the following example, the symbols are vertically aligned to * the bottom:</p> * * <listing version="3.0"> * pages.verticalAlign = VerticalAlign.BOTTOM;</listing> * * @default feathers.layout.VerticalAlign.MIDDLE * * @see feathers.layout.VerticalAlign#TOP * @see feathers.layout.VerticalAlign#MIDDLE * @see feathers.layout.VerticalAlign#BOTTOM */ [Style(name="verticalAlign",type="String")] /** * Dispatched when the selected item changes. * * <p>The properties of the event object have the following values:</p> * <table class="innertable"> * <tr><th>Property</th><th>Value</th></tr> * <tr><td><code>bubbles</code></td><td>false</td></tr> * <tr><td><code>currentTarget</code></td><td>The Object that defines the * event listener that handles the event. For example, if you use * <code>myButton.addEventListener()</code> to register an event listener, * myButton is the value of the <code>currentTarget</code>.</td></tr> * <tr><td><code>data</code></td><td>null</td></tr> * <tr><td><code>target</code></td><td>The Object that dispatched the event; * it is not always the Object listening for the event. Use the * <code>currentTarget</code> property to always access the Object * listening for the event.</td></tr> * </table> * * @eventType starling.events.Event.CHANGE */ [Event(name="change",type="starling.events.Event")] /** * Displays a selected index, usually corresponding to a page index in * another UI control, using a highlighted symbol. * * @see ../../../help/page-indicator.html How to use the Feathers PageIndicator component */ public class PageIndicator extends FeathersControl { /** * @private */ private static const LAYOUT_RESULT:LayoutBoundsResult = new LayoutBoundsResult(); /** * @private */ private static const SUGGESTED_BOUNDS:ViewPortBounds = new ViewPortBounds(); /** * @private * DEPRECATED: Replaced by <code>feathers.layout.Direction.HORIZONTAL</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const DIRECTION_VERTICAL:String = "vertical"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.Direction.VERTICAL</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const DIRECTION_HORIZONTAL:String = "horizontal"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.VerticalAlign.TOP</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const VERTICAL_ALIGN_TOP:String = "top"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.VerticalAlign.MIDDLE</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const VERTICAL_ALIGN_MIDDLE:String = "middle"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.VerticalAlign.BOTTOM</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const VERTICAL_ALIGN_BOTTOM:String = "bottom"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.HorizontalAlign.LEFT</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const HORIZONTAL_ALIGN_LEFT:String = "left"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.HorizontalAlign.CENTER</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const HORIZONTAL_ALIGN_CENTER:String = "center"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.HorizontalAlign.RIGHT</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const HORIZONTAL_ALIGN_RIGHT:String = "right"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.PageIndicatorInteractionMode.PREVIOUS_NEXT</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const INTERACTION_MODE_PREVIOUS_NEXT:String = "previousNext"; /** * @private * DEPRECATED: Replaced by <code>feathers.layout.PageIndicatorInteractionMode.PRECISE</code>. * * <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p> */ public static const INTERACTION_MODE_PRECISE:String = "precise"; /** * The default <code>IStyleProvider</code> for all <code>PageIndicator</code> * components. * * @default null * @see feathers.core.FeathersControl#styleProvider */ public static var globalStyleProvider:IStyleProvider; /** * @private */ protected static function defaultSelectedSymbolFactory():Quad { return new Quad(25, 25, 0xffffff); } /** * @private */ protected static function defaultNormalSymbolFactory():Quad { return new Quad(25, 25, 0xcccccc); } /** * Constructor. */ public function PageIndicator() { super(); this.isQuickHitAreaEnabled = true; this.addEventListener(TouchEvent.TOUCH, touchHandler); } /** * @private */ protected var selectedSymbol:DisplayObject; /** * @private */ protected var cache:Vector.<DisplayObject> = new <DisplayObject>[]; /** * @private */ protected var unselectedSymbols:Vector.<DisplayObject> = new <DisplayObject>[]; /** * @private */ protected var symbols:Vector.<DisplayObject> = new <DisplayObject>[]; /** * @private */ protected var touchPointID:int = -1; /** * @private */ override protected function get defaultStyleProvider():IStyleProvider { return PageIndicator.globalStyleProvider; } /** * @private */ protected var _pageCount:int = 1; /** * The number of available pages. * * <p>In the following example, the page count is changed:</p> * * <listing version="3.0"> * pages.pageCount = 5;</listing> * * @default 1 */ public function get pageCount():int { return this._pageCount; } /** * @private */ public function set pageCount(value:int):void { if(this._pageCount == value) { return; } this._pageCount = value; this.invalidate(INVALIDATION_FLAG_DATA); } /** * @private */ protected var _selectedIndex:int = 0; /** * The currently selected index. * * <p>In the following example, the page indicator's selected index is * changed:</p> * * <listing version="3.0"> * pages.selectedIndex = 2;</listing> * * <p>The following example listens for when selection changes and * requests the selected index:</p> * * <listing version="3.0"> * function pages_changeHandler( event:Event ):void * { * var pages:PageIndicator = PageIndicator( event.currentTarget ); * var index:int = pages.selectedIndex; * * } * pages.addEventListener( Event.CHANGE, pages_changeHandler );</listing> * * @default 0 */ public function get selectedIndex():int { return this._selectedIndex; } /** * @private */ public function set selectedIndex(value:int):void { value = Math.max(0, Math.min(value, this._pageCount - 1)); if(this._selectedIndex == value) { return; } this._selectedIndex = value; this.invalidate(INVALIDATION_FLAG_SELECTED); this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _interactionMode:String = PageIndicatorInteractionMode.PREVIOUS_NEXT; [Inspectable(type="String",enumeration="previousNext,precise")] /** * @private */ public function get interactionMode():String { return this._interactionMode; } /** * @private */ public function set interactionMode(value:String):void { if(this.processStyleRestriction(arguments.callee)) { return; } this._interactionMode = value; } /** * @private */ protected var _layout:ILayout; /** * @private */ protected var _direction:String = Direction.HORIZONTAL; [Inspectable(type="String",enumeration="horizontal,vertical")] /** * @private */ public function get direction():String { return this._direction; } /** * @private */ public function set direction(value:String):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._direction === value) { return; } this._direction = value; this.invalidate(INVALIDATION_FLAG_LAYOUT); } /** * @private */ protected var _horizontalAlign:String = HorizontalAlign.CENTER; [Inspectable(type="String",enumeration="left,center,right")] /** * @private */ public function get horizontalAlign():String { return this._horizontalAlign; } /** * @private */ public function set horizontalAlign(value:String):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._horizontalAlign === value) { return; } this._horizontalAlign = value; this.invalidate(INVALIDATION_FLAG_LAYOUT); } /** * @private */ protected var _verticalAlign:String = VerticalAlign.MIDDLE; [Inspectable(type="String",enumeration="top,middle,bottom")] /** * @private */ public function get verticalAlign():String { return this._verticalAlign; } /** * @private */ public function set verticalAlign(value:String):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._verticalAlign === value) { return; } this._verticalAlign = value; this.invalidate(INVALIDATION_FLAG_LAYOUT); } /** * @private */ protected var _gap:Number = 0; /** * @private */ public function get gap():Number { return this._gap; } /** * @private */ public function set gap(value:Number):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._gap === value) { return; } this._gap = value; this.invalidate(INVALIDATION_FLAG_LAYOUT); } /** * @private */ public function get padding():Number { return this._paddingTop; } /** * @private */ public function set padding(value:Number):void { this.paddingTop = value; this.paddingRight = value; this.paddingBottom = value; this.paddingLeft = value; } /** * @private */ protected var _paddingTop:Number = 0; /** * @private */ public function get paddingTop():Number { return this._paddingTop; } /** * @private */ public function set paddingTop(value:Number):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._paddingTop === value) { return; } this._paddingTop = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _paddingRight:Number = 0; /** * @private */ public function get paddingRight():Number { return this._paddingRight; } /** * @private */ public function set paddingRight(value:Number):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._paddingRight === value) { return; } this._paddingRight = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _paddingBottom:Number = 0; /** * @private */ public function get paddingBottom():Number { return this._paddingBottom; } /** * @private */ public function set paddingBottom(value:Number):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._paddingBottom === value) { return; } this._paddingBottom = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _paddingLeft:Number = 0; /** * @private */ public function get paddingLeft():Number { return this._paddingLeft; } /** * @private */ public function set paddingLeft(value:Number):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._paddingLeft === value) { return; } this._paddingLeft = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _normalSymbolFactory:Function = defaultNormalSymbolFactory; /** * @private */ public function get normalSymbolFactory():Function { return this._normalSymbolFactory; } /** * @private */ public function set normalSymbolFactory(value:Function):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._normalSymbolFactory === value) { return; } this._normalSymbolFactory = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _selectedSymbolFactory:Function = defaultSelectedSymbolFactory; /** * @private */ public function get selectedSymbolFactory():Function { return this._selectedSymbolFactory; } /** * @private */ public function set selectedSymbolFactory(value:Function):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._selectedSymbolFactory === value) { return; } this._selectedSymbolFactory = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ override protected function draw():void { var dataInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_DATA); var selectionInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_SELECTED); var stylesInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_STYLES); var layoutInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_LAYOUT); if(dataInvalid || selectionInvalid || stylesInvalid) { this.refreshSymbols(stylesInvalid); } this.layoutSymbols(layoutInvalid); } /** * @private */ protected function refreshSymbols(symbolsInvalid:Boolean):void { this.symbols.length = 0; var temp:Vector.<DisplayObject> = this.cache; if(symbolsInvalid) { var symbolCount:int = this.unselectedSymbols.length; for(var i:int = 0; i < symbolCount; i++) { var symbol:DisplayObject = this.unselectedSymbols.shift(); this.removeChild(symbol, true); } if(this.selectedSymbol) { this.removeChild(this.selectedSymbol, true); this.selectedSymbol = null; } } this.cache = this.unselectedSymbols; this.unselectedSymbols = temp; for(i = 0; i < this._pageCount; i++) { if(i == this._selectedIndex) { if(!this.selectedSymbol) { this.selectedSymbol = this._selectedSymbolFactory(); this.addChild(this.selectedSymbol); } this.symbols.push(this.selectedSymbol); if(this.selectedSymbol is IValidating) { IValidating(this.selectedSymbol).validate(); } } else { if(this.cache.length > 0) { symbol = this.cache.shift(); } else { symbol = this._normalSymbolFactory(); this.addChild(symbol); } this.unselectedSymbols.push(symbol); this.symbols.push(symbol); if(symbol is IValidating) { IValidating(symbol).validate(); } } } symbolCount = this.cache.length; for(i = 0; i < symbolCount; i++) { symbol = this.cache.shift(); this.removeChild(symbol, true); } } /** * @private */ protected function layoutSymbols(layoutInvalid:Boolean):void { if(layoutInvalid) { if(this._direction == Direction.VERTICAL && !(this._layout is VerticalLayout)) { this._layout = new VerticalLayout(); IVirtualLayout(this._layout).useVirtualLayout = false; } else if(this._direction != Direction.VERTICAL && !(this._layout is HorizontalLayout)) { this._layout = new HorizontalLayout(); IVirtualLayout(this._layout).useVirtualLayout = false; } if(this._layout is VerticalLayout) { var verticalLayout:VerticalLayout = VerticalLayout(this._layout); verticalLayout.paddingTop = this._paddingTop; verticalLayout.paddingRight = this._paddingRight; verticalLayout.paddingBottom = this._paddingBottom; verticalLayout.paddingLeft = this._paddingLeft; verticalLayout.gap = this._gap; verticalLayout.horizontalAlign = this._horizontalAlign; verticalLayout.verticalAlign = this._verticalAlign; } if(this._layout is HorizontalLayout) { var horizontalLayout:HorizontalLayout = HorizontalLayout(this._layout); horizontalLayout.paddingTop = this._paddingTop; horizontalLayout.paddingRight = this._paddingRight; horizontalLayout.paddingBottom = this._paddingBottom; horizontalLayout.paddingLeft = this._paddingLeft; horizontalLayout.gap = this._gap; horizontalLayout.horizontalAlign = this._horizontalAlign; horizontalLayout.verticalAlign = this._verticalAlign; } } SUGGESTED_BOUNDS.x = SUGGESTED_BOUNDS.y = 0; SUGGESTED_BOUNDS.scrollX = SUGGESTED_BOUNDS.scrollY = 0; SUGGESTED_BOUNDS.explicitWidth = this._explicitWidth; SUGGESTED_BOUNDS.explicitHeight = this._explicitHeight; SUGGESTED_BOUNDS.maxWidth = this._explicitMaxWidth; SUGGESTED_BOUNDS.maxHeight = this._explicitMaxHeight; SUGGESTED_BOUNDS.minWidth = this._explicitMinWidth; SUGGESTED_BOUNDS.minHeight = this._explicitMinHeight; this._layout.layout(this.symbols, SUGGESTED_BOUNDS, LAYOUT_RESULT); this.saveMeasurements(LAYOUT_RESULT.contentWidth, LAYOUT_RESULT.contentHeight, LAYOUT_RESULT.contentWidth, LAYOUT_RESULT.contentHeight); } /** * @private */ protected function touchHandler(event:TouchEvent):void { if(!this._isEnabled || this._pageCount < 2) { this.touchPointID = -1; return; } if(this.touchPointID >= 0) { var touch:Touch = event.getTouch(this, TouchPhase.ENDED, this.touchPointID); if(!touch) { return; } this.touchPointID = -1; var point:Point = Pool.getPoint(); touch.getLocation(this.stage, point); var isInBounds:Boolean = this.contains(this.stage.hitTest(point)); if(isInBounds) { var lastPageIndex:int = this._pageCount - 1; this.globalToLocal(point, point); if(this._direction == Direction.VERTICAL) { if(this._interactionMode === PageIndicatorInteractionMode.PRECISE) { var symbolHeight:Number = this.selectedSymbol.height + (this.unselectedSymbols[0].height + this._gap) * lastPageIndex; var newIndex:int = Math.round(lastPageIndex * (point.y - this.symbols[0].y) / symbolHeight); if(newIndex < 0) { newIndex = 0; } else if(newIndex > lastPageIndex) { newIndex = lastPageIndex; } this.selectedIndex = newIndex; } else //previous/next { if(point.y < this.selectedSymbol.y) { this.selectedIndex = Math.max(0, this._selectedIndex - 1); } if(point.y > (this.selectedSymbol.y + this.selectedSymbol.height)) { this.selectedIndex = Math.min(lastPageIndex, this._selectedIndex + 1); } } } else { if(this._interactionMode === PageIndicatorInteractionMode.PRECISE) { var symbolWidth:Number = this.selectedSymbol.width + (this.unselectedSymbols[0].width + this._gap) * lastPageIndex; newIndex = Math.round(lastPageIndex * (point.x - this.symbols[0].x) / symbolWidth); if(newIndex < 0) { newIndex = 0; } else if(newIndex >= this._pageCount) { newIndex = lastPageIndex; } this.selectedIndex = newIndex; } else // previous/next { if(point.x < this.selectedSymbol.x) { this.selectedIndex = Math.max(0, this._selectedIndex - 1); } if(point.x > (this.selectedSymbol.x + this.selectedSymbol.width)) { this.selectedIndex = Math.min(lastPageIndex, this._selectedIndex + 1); } } } } Pool.putPoint(point); } else //if we get here, we don't have a saved touch ID yet { touch = event.getTouch(this, TouchPhase.BEGAN); if(!touch) { return; } this.touchPointID = touch.id; } } } }
@throws_type function type hashmap.keys 0 @throws_arity function arity0 hashmap.keys @throws_arity function arity2 hashmap.keys self 0 function normal namespace map set (map "0") set (map "11") set (map "33") local a = {hashmap.keys map} assertEqual 3 {length a} assert {array.find a "0"} >= 0 assert {array.find a "11"} >= 0 assert {array.find a "33"} >= 0
package com.hp.asi.hpic4vc.ui.model { import com.hp.asi.hpic4vc.ui.model.TableModel; import com.hp.asi.hpic4vc.ui.model.network.VCM; import com.hp.asi.hpic4vc.ui.utils.Helper; import mx.collections.ArrayCollection; public class NetworkDetailViewModel { [Bindable] public var nics:DataGridWrapper; [Bindable] public var virtualSwitches:ArrayCollection; [Bindable] public var distributedVirtualSwitches:ArrayCollection; [Bindable] public var vcms:ArrayCollection; [Bindable] public var externalSwitches:DataGridWrapper; [Bindable] public var externalStorage:DataGridWrapper; [Bindable] [ArrayElementType("com.hp.asi.hpic4vc.ui.model.network.DataStore")] public var ds:ArrayCollection; [Bindable] public var vcm:VCM; [Bindable] public var errorMessage:String; public function NetworkDetailViewModel() { } public static function makeNetworkDetailViewModel(value:NetworkDetailModel):NetworkDetailViewModel { var newItem:NetworkDetailViewModel = new NetworkDetailViewModel() newItem.nics = Helper.createDataGrid( value.nics ); newItem.externalSwitches = Helper.createDataGrid( value.externalSwitches ); newItem.externalStorage = Helper.createDataGrid( value.externalStorage ); newItem.virtualSwitches = value.virtualSwitches; newItem.distributedVirtualSwitches = value.distributedVirtualSwitches; newItem.vcms = value.vcms; newItem.errorMessage = new String(value.errorMessage); newItem.ds = value.ds; newItem.vcm = value.vcm; return newItem; } } }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import com.adobe.test.Assert; class DefaultClass { public static function baseClass() { // print("base is invoked"); } } // var SECTION = "RTE"; // var VERSION = "AS3"; // var TITLE = "accessing public static method outside of the class"; var BUGNUMBER = ""; var out = new DefaultClass(); var error = "no error thrown"; try { out.baseClass(); } catch (e) { error = e.toString(); } Assert.expectEq("accessing public static method outside of the class, RTE #1069", "ReferenceError: Error #1069", error.substr(0,27)); // print( "FAILED, should give run time error : accessing public static method outside of the class" );
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.html.beads { import org.apache.royale.collections.ArrayList; import org.apache.royale.core.IBead; import org.apache.royale.core.IChild; import org.apache.royale.core.IDataProviderModel; import org.apache.royale.core.IDocument; import org.apache.royale.core.IDragInitiator; import org.apache.royale.core.IItemRenderer; import org.apache.royale.core.IItemRendererParent; import org.apache.royale.core.IParent; import org.apache.royale.core.ISelectionModel; import org.apache.royale.core.IStrand; import org.apache.royale.core.IUIBase; import org.apache.royale.core.UIBase; import org.apache.royale.events.DragEvent; import org.apache.royale.events.Event; import org.apache.royale.events.EventDispatcher; import org.apache.royale.events.IEventDispatcher; import org.apache.royale.geom.Point; import org.apache.royale.geom.Rectangle; import org.apache.royale.html.Group; import org.apache.royale.html.Label; import org.apache.royale.html.beads.controllers.DragMouseController; import org.apache.royale.html.supportClasses.DataItemRenderer; import org.apache.royale.utils.PointUtils; import org.apache.royale.utils.UIUtils; import org.apache.royale.utils.getParentOrSelfByType; /** * The start event is dispatched when a DragStart event happens. The DragEvent.dragSource * is set before this event is dispatched. A listener for this event can then decide if * if the drag-drop action should continue or not. If not, the event should be cancelled. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9 */ [Event(name="start", type="org.apache.royale.events.Event")] /** * The accept event is dispatched when the drop happens but just before the data being * dragged as been incorporated into the drop target's data source. Cancelling this event * prevents that from happening. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9 */ [Event(name="accept", type="org.apache.royale.events.Event")] /** * The complete event is dispatched when the entire drag-and-drop operation has completed * from the drag source's perspective. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9 */ [Event(name="complete", type="org.apache.royale.events.Event")] /** * The SingleSelectionDragSourceBead brings drag capability to single-selection List components. * By adding this bead, a user can drag a row of the List to a new location within the list. This bead * should be used in conjunction with SingleSelectionDropTargetBead. * * This bead adds a new event to the strand, "dragImageNeeded", which is dispatched on the strand * just prior to the dragImage's appearance. An event listener can create its own dragImage if the * default, taken from the data item, is not suitable. * * @see org.apache.royale.html.beads.SingleSelectionDropTargetBead. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public class SingleSelectionDragSourceBead extends EventDispatcher implements IBead, IDragInitiator { /** * Constructor * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function SingleSelectionDragSourceBead() { super(); } private var _strand:IStrand; private var _dragController:DragMouseController; private var continueDragOperation:Boolean = true; private var _dragType:String = "move"; /** * The type of drag and drop operation: move or copy. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function get dragType():String { return _dragType; } public function set dragType(value:String):void { _dragType = value; } /** * @private */ public function set strand(value:IStrand):void { _strand = value; _dragController = new DragMouseController(); _strand.addBead(_dragController); IEventDispatcher(_strand).addEventListener(DragEvent.DRAG_START, handleDragStart); IEventDispatcher(_strand).addEventListener(DragEvent.DRAG_MOVE, handleDragMove); IEventDispatcher(_strand).addEventListener(DragEvent.DRAG_END, handleDragEnd); } private var _dragSourceIndex:int = -1; /** * The index into the dataProvider of the strand's model where the dragSource * can be found. If -1, the dragSource is not in the dataProvider. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9 */ public function get dragSourceIndex():int { return _dragSourceIndex; } /** * @private */ private function handleDragStart(event:DragEvent):void { //trace("SingleSelectionDragSourceBead received the DragStart"); DragEvent.dragInitiator = this; DragMouseController.dragImageOffsetX = 0; DragMouseController.dragImageOffsetY = -30; var relatedObject:Object = event.relatedObject; var itemRenderer:IItemRenderer = getParentOrSelfByType(relatedObject as IChild, IItemRenderer) as IItemRenderer; if (itemRenderer) { var p:UIBase = itemRenderer.itemRendererParent as UIBase; _dragSourceIndex = p.getElementIndex(itemRenderer as IChild); DragEvent.dragSource = (itemRenderer as IItemRenderer).data; } var newEvent:Event = new Event("start", false, true); dispatchEvent(newEvent); if (newEvent.defaultPrevented) { continueDragOperation = false; } } /** * @private */ protected function handleDragMove(event:DragEvent):void { // ignored for now } /** * @private */ protected function handleDragEnd(event:DragEvent):void { // ignored for now } /* IDragInitiator */ /** * Handles pre-drop actions. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function acceptingDrop(dropTarget:Object, type:String):void { if (!continueDragOperation) return; //trace("SingleSelectionDragSourceBead accepting drop of type "+type); var newEvent:Event = new Event("accept", false, true); dispatchEvent(newEvent); if (newEvent.defaultPrevented) return; var dataProviderModel:IDataProviderModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel; if (dataProviderModel is ISelectionModel) { (dataProviderModel as ISelectionModel).selectedIndex = -1; } if (dragType == "copy") return; if (dataProviderModel.dataProvider is Array) { var dataArray:Array = dataProviderModel.dataProvider as Array; // remove the item being selected DragEvent.dragSource = dataArray.splice(_dragSourceIndex,1)[0]; // refresh the dataProvider model var newArray:Array = dataArray.slice() dataProviderModel.dataProvider = newArray; } else if (dataProviderModel.dataProvider is ArrayList) { var dataList:ArrayList = dataProviderModel.dataProvider as ArrayList; // remove the item being selected DragEvent.dragSource = dataList.removeItemAt(_dragSourceIndex); } } /** * Handles post-drop actions. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function acceptedDrop(dropTarget:Object, type:String):void { //trace("SingleSelectionDragSourceBead accepted drop of type "+type); var value:Object = DragEvent.dragSource; _dragSourceIndex = -1; dispatchEvent(new Event("complete")); } } }
package com.yahoo.infographics.axes { import flash.geom.Point; /** * Base class used for vertically aligned axis layout classes. * @see com.yahoo.com.infographics.axes.LeftAxisLayout * @see com.yahoo.com.infographics.axes.RightAxisLayout */ public class VerticalAxisLayout extends BaseAxisLayout { /** * @copy com.yahoo.infographics.axes.IAxisLayout#length */ public function get length():Number { return this._specifiedHeight - (this._topPadding + this._bottomPadding); } /** * @private * Storage for sizeMode */ protected var _sizeMode:String = "hbox"; /** * @copy com.yahoo.infographics.axes.IAxisLayout#sizeMode */ public function get sizeMode():String { return this._sizeMode; } /** * @copy com.yahoo.infographics.axes.IAxisLayout#lineEnd */ public function get lineEnd():Point { return new Point(0, this._specifiedHeight); } /** * @copy com.yahoo.infographics.axes.IAxisLayout#getFirstPoint() */ public function getFirstPoint():Point { return new Point(this._leftPadding, this._specifiedHeight - this._bottomPadding); } /** * @copy com.yahoo.infographics.axes.IAxisLayout#getNextPoint() */ public function getNextPoint(point:Point, majorUnitDistance:Number):Point { point.y = point.y - majorUnitDistance; return point; } /** * @copy com.yahoo.infographics.axes.IAxisLayout#getLastPoint() */ public function getLastPoint():Point { return new Point(this._leftPadding, this._topPadding); } /** * @copy com.yahoo.infographics.axes.IAxisLayout#getPosition() */ public function getPosition(point:Point):Number { var position:Number = (this._specifiedHeight - (this._topPadding + this._bottomPadding)) - (point.y - this._topPadding); return position; } } }
// Decompiled by AS3 Sorcerer 6.08 // www.as3sorcerer.com //kabam.rotmg.messaging.impl.GameServerConnection package kabam.rotmg.messaging.impl { import org.osflash.signals.Signal; import com.company.assembleegameclient.game.AGameSprite; import kabam.rotmg.servers.api.Server; import flash.utils.ByteArray; import kabam.lib.net.impl.SocketServer; import com.company.assembleegameclient.objects.GameObject; import com.company.assembleegameclient.objects.Projectile; import com.company.assembleegameclient.objects.Player; import kabam.rotmg.messaging.impl.data.SlotObjectData; public class GameServerConnection { public static const FAILURE:int = 0; public static const CREATE_SUCCESS:int = 101; public static const CREATE:int = 61; public static const PLAYERSHOOT:int = 30; public static const MOVE:int = 42; public static const PLAYERTEXT:int = 10; public static const TEXT:int = 44; public static const SERVERPLAYERSHOOT:int = 12; public static const DAMAGE:int = 75; public static const UPDATE:int = 62; public static const UPDATEACK:int = 81; public static const NOTIFICATION:int = 67; public static const NEWTICK:int = 9; public static const INVSWAP:int = 19; public static const USEITEM:int = 11; public static const SHOWEFFECT:int = 13; public static const HELLO:int = 1; public static const GOTO:int = 18; public static const INVDROP:int = 55; public static const INVRESULT:int = 95; public static const RECONNECT:int = 45; public static const PING:int = 8; public static const PONG:int = 31; public static const MAPINFO:int = 92; public static const LOAD:int = 57; public static const PIC:int = 83; public static const SETCONDITION:int = 60; public static const TELEPORT:int = 74; public static const USEPORTAL:int = 47; public static const DEATH:int = 46; public static const BUY:int = 85; public static const BUYRESULT:int = 22; public static const AOE:int = 64; public static const GROUNDDAMAGE:int = 103; public static const PLAYERHIT:int = 90; public static const ENEMYHIT:int = 25; public static const AOEACK:int = 89; public static const SHOOTACK:int = 100; public static const OTHERHIT:int = 20; public static const SQUAREHIT:int = 40; public static const GOTOACK:int = 65; public static const EDITACCOUNTLIST:int = 27; public static const ACCOUNTLIST:int = 99; public static const QUESTOBJID:int = 82; public static const CHOOSENAME:int = 97; public static const NAMERESULT:int = 21; public static const CREATEGUILD:int = 59; public static const GUILDRESULT:int = 26; public static const GUILDREMOVE:int = 15; public static const GUILDINVITE:int = 104; public static const ALLYSHOOT:int = 49; public static const ENEMYSHOOT:int = 35; public static const REQUESTTRADE:int = 5; public static const TRADEREQUESTED:int = 88; public static const TRADESTART:int = 86; public static const CHANGETRADE:int = 56; public static const TRADECHANGED:int = 28; public static const ACCEPTTRADE:int = 36; public static const CANCELTRADE:int = 91; public static const TRADEDONE:int = 34; public static const TRADEACCEPTED:int = 14; public static const CLIENTSTAT:int = 69; public static const CHECKCREDITS:int = 102; public static const ESCAPE:int = 105; public static const FILE:int = 106; public static const INVITEDTOGUILD:int = 77; public static const JOINGUILD:int = 7; public static const CHANGEGUILDRANK:int = 37; public static const PLAYSOUND:int = 38; public static const GLOBAL_NOTIFICATION:int = 66; public static const RESKIN:int = 51; public static const PETUPGRADEREQUEST:int = 16; public static const ACTIVE_PET_UPDATE_REQUEST:int = 24; public static const ACTIVEPETUPDATE:int = 76; public static const NEW_ABILITY:int = 41; public static const PETYARDUPDATE:int = 78; public static const EVOLVE_PET:int = 87; public static const DELETE_PET:int = 4; public static const HATCH_PET:int = 23; public static const ENTER_ARENA:int = 17; public static const IMMINENT_ARENA_WAVE:int = 50; public static const ARENA_DEATH:int = 68; public static const ACCEPT_ARENA_DEATH:int = 80; public static const VERIFY_EMAIL:int = 39; public static const RESKIN_UNLOCK:int = 107; public static const PASSWORD_PROMPT:int = 79; public static const QUEST_FETCH_ASK:int = 98; public static const QUEST_REDEEM:int = 58; public static const QUEST_FETCH_RESPONSE:int = 6; public static const QUEST_REDEEM_RESPONSE:int = 96; public static const PET_CHANGE_FORM_MSG:int = 53; public static const KEY_INFO_REQUEST:int = 94; public static const KEY_INFO_RESPONSE:int = 63; public static const CLAIM_LOGIN_REWARD_MSG:int = 3; public static const LOGIN_REWARD_MSG:int = 93; public static const QUEST_ROOM_MSG:int = 48; public static const PET_CHANGE_SKIN_MSG:int = 33; public static const REALM_HERO_LEFT_MSG:int = 84; public static const RESET_DAILY_QUESTS:int = 52; public static var instance:GameServerConnection; public var changeMapSignal:Signal; public var gs_:AGameSprite; public var server_:Server; public var gameId_:int; public var createCharacter_:Boolean; public var charId_:int; public var keyTime_:int; public var key_:ByteArray; public var mapJSON_:String; public var isFromArena_:Boolean = false; public var lastTickId_:int = -1; public var lastServerRealTimeMS_:uint = 0; public var jitterWatcher_:JitterWatcher; public var serverConnection:SocketServer; public var outstandingBuy_:OutstandingBuy = null; public function chooseName(_arg_1:String):void { } public function createGuild(_arg_1:String):void { } public function connect():void { } public function disconnect():void { } public function checkCredits():void { } public function escape():void { } public function useItem(_arg_1:int, _arg_2:int, _arg_3:int, _arg_4:int, _arg_5:Number, _arg_6:Number, _arg_7:int):void { } public function useItem_new(_arg_1:GameObject, _arg_2:int):Boolean { return (false); } public function enableJitterWatcher():void { } public function disableJitterWatcher():void { } public function editAccountList(_arg_1:int, _arg_2:Boolean, _arg_3:int):void { } public function guildRemove(_arg_1:String):void { } public function guildInvite(_arg_1:String):void { } public function requestTrade(_arg_1:String):void { } public function changeTrade(_arg_1:Vector.<Boolean>):void { } public function acceptTrade(_arg_1:Vector.<Boolean>, _arg_2:Vector.<Boolean>):void { } public function cancelTrade():void { } public function joinGuild(_arg_1:String):void { } public function changeGuildRank(_arg_1:String, _arg_2:int):void { } public function isConnected():Boolean { return (false); } public function teleport(_arg_1:int):void { } public function usePortal(_arg_1:int):void { } public function getNextDamage(_arg_1:uint, _arg_2:uint):uint { return (0); } public function groundDamage(_arg_1:int, _arg_2:Number, _arg_3:Number):void { } public function playerShoot(_arg_1:int, _arg_2:Projectile):void { } public function playerHit(_arg_1:int, _arg_2:int):void { } public function enemyHit(_arg_1:int, _arg_2:int, _arg_3:int, _arg_4:Boolean):void { } public function otherHit(_arg_1:int, _arg_2:int, _arg_3:int, _arg_4:int):void { } public function squareHit(_arg_1:int, _arg_2:int, _arg_3:int):void { } public function playerText(_arg_1:String):void { } public function invSwap(_arg_1:Player, _arg_2:GameObject, _arg_3:int, _arg_4:int, _arg_5:GameObject, _arg_6:int, _arg_7:int):Boolean { return (false); } public function invSwapPotion(_arg_1:Player, _arg_2:GameObject, _arg_3:int, _arg_4:int, _arg_5:GameObject, _arg_6:int, _arg_7:int):Boolean { return (false); } public function invDrop(_arg_1:GameObject, _arg_2:int, _arg_3:int):void { } public function setCondition(_arg_1:uint, _arg_2:Number):void { } public function buy(_arg_1:int, _arg_2:int):void { } public function questFetch():void { } public function questRedeem(_arg_1:String, _arg_2:Vector.<SlotObjectData>, _arg_3:int=-1):void { } public function keyInfoRequest(_arg_1:int):void { } public function gotoQuestRoom():void { } public function changePetSkin(_arg_1:int, _arg_2:int, _arg_3:int):void { } public function resetDailyQuests():void { } } }//package kabam.rotmg.messaging.impl
package com.playata.application.data.leaderboard { public class LeaderboardType { public static const Unknown:int = 0; public static const Character:int = 1; public static const Guild:int = 2; public static const Tournament:int = 3; public static const Movies:int = 4; public static const GuildCompetition:int = 5; public function LeaderboardType() { super(); } } }
package kabam.rotmg.classes.view { import flash.display.Bitmap; import flash.display.Sprite; import flash.filters.DropShadowFilter; import kabam.rotmg.assets.model.Animation; import kabam.rotmg.assets.services.IconFactory; import kabam.rotmg.text.model.TextKey; import kabam.rotmg.text.view.TextFieldDisplayConcrete; import kabam.rotmg.text.view.stringBuilder.LineBuilder; import kabam.rotmg.text.view.stringBuilder.StaticStringBuilder; import kabam.rotmg.ui.view.SignalWaiter; import kabam.rotmg.util.components.StarsView; public class ClassDetailView extends Sprite { private static const RIGHT_JUSTIFICATION_STATS:int = 205; private static const WIDTH:int = 344; private static const TEXT_WIDTH:int = 188; private const waiter:SignalWaiter = new SignalWaiter(); private var classNameText:TextFieldDisplayConcrete; private var classDescriptionText:TextFieldDisplayConcrete; private var questCompletionText:TextFieldDisplayConcrete; private var levelTitleText:TextFieldDisplayConcrete; private var levelText:TextFieldDisplayConcrete; private var fameTitleText:TextFieldDisplayConcrete; private var fameText:TextFieldDisplayConcrete; private var fameIcon:Bitmap; private var nextGoalText:TextFieldDisplayConcrete; private var nextGoalDetailText:TextFieldDisplayConcrete; private var questCompletedStars:StarsView; private var showNextGoal:Boolean; private var animContainer:Sprite; private var animation:Animation; public function ClassDetailView() { var _local1:DropShadowFilter; super(); this.waiter.complete.add(this.layout); _local1 = new DropShadowFilter(0, 0, 0, 1, 8, 8); this.animContainer = new Sprite(); this.animContainer.x = ((WIDTH - 104) * 0.5); addChild(this.animContainer); this.classNameText = new TextFieldDisplayConcrete().setSize(20).setColor(0xFFFFFF).setBold(true).setTextWidth(TEXT_WIDTH); this.classNameText.filters = [_local1]; this.waiter.push(this.classNameText.textChanged); addChild(this.classNameText); this.classDescriptionText = new TextFieldDisplayConcrete().setSize(14).setColor(0xFFFFFF).setTextWidth(TEXT_WIDTH).setWordWrap(true); this.classDescriptionText.filters = [_local1]; this.waiter.push(this.classDescriptionText.textChanged); addChild(this.classDescriptionText); this.questCompletionText = new TextFieldDisplayConcrete().setSize(14).setColor(0xFFFFFF).setBold(true); this.questCompletionText.filters = [_local1]; this.questCompletionText.setStringBuilder(new LineBuilder().setParams(TextKey.CLASS_QUEST_COMPLETED)); this.waiter.push(this.questCompletionText.textChanged); addChild(this.questCompletionText); this.levelTitleText = new TextFieldDisplayConcrete().setSize(14).setColor(0xFFFFFF).setBold(true); this.levelTitleText.filters = [_local1]; this.levelTitleText.setStringBuilder(new LineBuilder().setParams(TextKey.CLASS_HIGHEST_LEVEL)); this.waiter.push(this.levelTitleText.textChanged); addChild(this.levelTitleText); this.levelText = new TextFieldDisplayConcrete().setSize(16).setColor(0xFFFFFF).setBold(true); this.levelText.filters = [_local1]; this.waiter.push(this.levelText.textChanged); addChild(this.levelText); this.fameTitleText = new TextFieldDisplayConcrete().setSize(14).setColor(0xFFFFFF).setBold(true); this.fameTitleText.filters = [_local1]; this.fameTitleText.setStringBuilder(new LineBuilder().setParams(TextKey.CLASS_MOST_FAME)); this.waiter.push(this.fameTitleText.textChanged); addChild(this.fameTitleText); this.fameText = new TextFieldDisplayConcrete().setSize(16).setColor(15387756).setBold(true); this.fameText.filters = [_local1]; this.waiter.push(this.fameText.textChanged); addChild(this.fameText); this.fameIcon = new Bitmap(IconFactory.makeFame()); this.fameIcon.filters = [_local1]; addChild(this.fameIcon); this.nextGoalText = new TextFieldDisplayConcrete().setSize(14).setColor(0xFFFFFF).setBold(true); this.nextGoalText.filters = [_local1]; this.nextGoalText.setStringBuilder(new LineBuilder().setParams(TextKey.CLASS_NEXT_GOAL)); this.nextGoalText.visible = false; addChild(this.nextGoalText); this.nextGoalDetailText = new TextFieldDisplayConcrete().setSize(14).setColor(0xFFFFFF); this.nextGoalDetailText.filters = [_local1]; this.nextGoalDetailText.visible = false; addChild(this.nextGoalDetailText); this.questCompletedStars = new StarsView(); addChild(this.questCompletedStars); } public function setData(_arg1:String, _arg2:String, _arg3:int, _arg4:int, _arg5:int):void { this.classNameText.setStringBuilder(new LineBuilder().setParams(_arg1)); this.classDescriptionText.setStringBuilder(new LineBuilder().setParams(_arg2)); this.levelText.setStringBuilder(new StaticStringBuilder(String(_arg4))); this.fameText.setStringBuilder(new StaticStringBuilder(String(_arg5))); } public function setNextGoal(_arg1:String, _arg2:int):void { this.showNextGoal = !((_arg2 == -1)); if (this.showNextGoal) { this.nextGoalDetailText.setStringBuilder(new LineBuilder().setParams(TextKey.CLASS_NEXT_GOAL_DETAIL, { "goal": String(_arg2), "quest": _arg1 })); this.nextGoalDetailText.y = (this.nextGoalText.y + this.nextGoalText.height); this.nextGoalDetailText.x = ((WIDTH / 2) - (this.nextGoalDetailText.width / 2)); this.waiter.push(this.nextGoalDetailText.textChanged); this.waiter.push(this.nextGoalText.textChanged); } } public function setWalkingAnimation(_arg1:Animation):void { ((this.animation) && (this.removeAnimation(this.animation))); this.animation = _arg1; ((this.animation) && (this.addAnimation(this.animation))); this.layout(); } private function removeAnimation(_arg1:Animation):void { _arg1.stop(); this.animContainer.removeChild(_arg1); } private function addAnimation(_arg1:Animation):void { this.animContainer.addChild(_arg1); _arg1.start(); } private function layout():void { this.classNameText.x = ((WIDTH / 2) - (this.classNameText.width / 2)); this.classNameText.y = 110; this.classDescriptionText.y = ((this.classNameText.y + this.classNameText.height) + 5); this.classDescriptionText.x = ((WIDTH / 2) - (this.classDescriptionText.width / 2)); this.questCompletionText.y = ((this.classDescriptionText.y + this.classDescriptionText.height) + 20); this.questCompletionText.x = (RIGHT_JUSTIFICATION_STATS - this.questCompletionText.width); this.questCompletedStars.y = (this.questCompletionText.y - 2); this.questCompletedStars.x = (RIGHT_JUSTIFICATION_STATS + 18); this.levelTitleText.y = ((this.questCompletionText.y + this.questCompletionText.height) + 5); this.levelTitleText.x = (RIGHT_JUSTIFICATION_STATS - this.levelTitleText.width); this.levelText.y = this.levelTitleText.y; this.levelText.x = (RIGHT_JUSTIFICATION_STATS + 18); this.fameTitleText.y = ((this.levelTitleText.y + this.levelTitleText.height) + 5); this.fameTitleText.x = (RIGHT_JUSTIFICATION_STATS - this.fameTitleText.width); this.fameText.y = this.fameTitleText.y; this.fameText.x = (RIGHT_JUSTIFICATION_STATS + 18); this.fameIcon.y = (this.fameTitleText.y - 2); this.fameIcon.x = ((this.fameText.x + this.fameText.width) + 3); this.nextGoalText.y = ((this.fameTitleText.y + this.fameTitleText.height) + 17); this.nextGoalText.x = ((WIDTH / 2) - (this.nextGoalText.width / 2)); this.nextGoalText.visible = this.showNextGoal; this.nextGoalDetailText.y = (this.nextGoalText.y + this.nextGoalText.height); this.nextGoalDetailText.x = ((WIDTH / 2) - (this.nextGoalDetailText.width / 2)); this.nextGoalDetailText.visible = this.showNextGoal; } } }
package org.motivateclock.view.projects { import flash.display.Bitmap; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.MouseEvent; import flash.geom.Rectangle; import flash.text.TextField; import flash.text.TextFieldAutoSize; import org.motivateclock.resource.ResourceLib; import org.motivateclock.utils.RegularUtils; /** * @author: Valeriy Bashtovoy * */ public class ProjectQuestionButton extends Sprite { private var _label:TextField; private var _line:MovieClip; private var _lineBitmap:Bitmap; private var _gfx:MovieClip; public function ProjectQuestionButton() { _gfx = RegularUtils.getInstanceFromLib(ResourceLib.GFX_PROJECT_QUESTION_BUTTON) as MovieClip; addChild(_gfx); _label = _gfx["label"]; _line = _gfx["line"]; _label.autoSize = TextFieldAutoSize.LEFT; this.buttonMode = true; this.mouseChildren = false; _line.visible = false; out(); this.addEventListener(MouseEvent.MOUSE_OVER, overHandler); this.addEventListener(MouseEvent.MOUSE_OUT, outHandler); } public function setLabel(value:String):void { _label.text = value; if (_lineBitmap) { removeChild(_lineBitmap); _lineBitmap = null; } _lineBitmap = RegularUtils.getRasterize(_line, new Rectangle(0, 0, _label.width - 3, 2)); _lineBitmap.x = int(_line.x); _lineBitmap.y = int(_line.y); addChild(_lineBitmap); } public function over():void { RegularUtils.setColor(this, 0xc76900); } public function out():void { RegularUtils.setColor(this, 0x252628); } private function overHandler(event:MouseEvent):void { over(); } private function outHandler(event:MouseEvent):void { out(); } } }
import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.core.UIComponent; import mx.events.CloseEvent; import mx.events.ColorPickerEvent; import mx.managers.history.History; import spark.events.IndexChangeEvent; import org.un.cava.birdeye.ravis.components.renderers.edgeLabels.IEdgeLabelRenderer; import org.un.cava.birdeye.ravis.graphLayout.visual.IVisualEdge; import org.un.cava.birdeye.ravis.graphLayout.visual.VisualDefaults; import org.un.cava.birdeye.ravis.graphLayout.visual.edgeRenderers.ArrowStyle; import org.un.cava.birdeye.ravis.history.ChangeEdgeProperties; import org.un.cava.birdeye.ravis.assets.Assets; import ui.utils.ErrorUtils; /** * Связь св-ва которой необходимо редактировать */ public var edge : IVisualEdge; private function onCreationComplete() : void { initializeDialog(); } private function initializeDialog() : void { //Имя edgeName.text = edge.data.label; //Описание edgeDesc.text = edge.data.desc; //Тип связи initializeTypes(); //Цвет var color : uint = edge.data.color ? edge.data.color : VisualDefaults.edgeStyle.color; edgeColor.selectedColor = color; edgeColorValue.text = formatColor( color ); //Толщина initializeWeights( edge.data.arrow, color ); edgeWeight.selectedIndex = edge.data.flow - 1; } private function initializeWeights( arrowStyle : String, color : uint ) : void { var weights : Array = new Array(); var maxWeight : Number = 8.0; var weightStep : Number = 1.0; for ( var i : Number = weightStep; i <= maxWeight; i += weightStep ) { weights.push( { weight : i, arrow : arrowStyle, color : color, label : i.toString() + ' пикс.' } ); } edgeWeight.dataProvider = new ArrayCollection( weights ); } private function refreshWeights( arrowStyle : String, color : uint ) : void { var index : int = edgeWeight.selectedIndex; initializeWeights( arrowStyle, color ); edgeWeight.selectedIndex = index; } private function initializeTypes() : void { var edgeTypes : Array = [ { label : 'Простая', type : ArrowStyle.NONE }, { label : 'Направленная', type : ArrowStyle.SINGLE }, { label : 'Направленная (инвертированная)', type : ArrowStyle.SINGLE_INVERTED }, { label : 'Двухсторонняя', type : ArrowStyle.DOUBLE } ]; edgeArrow.dataProvider = new ArrayCollection( edgeTypes ); for ( var i : int = 0; i < edgeTypes.length; i ++ ) { if ( edgeTypes[ i ].type == edge.data.arrow ) { edgeArrow.selectedIndex = i; break; } } } private function onEdgeArrowChanged( e : IndexChangeEvent ) : void { refreshWeights( edgeArrow.selectedItem.type, edgeColor.selectedColor ); } private function onEdgeColorChanged( e : ColorPickerEvent ) : void { edgeColorValue.text = formatColor( e.color ); refreshWeights( edgeArrow.selectedItem.type, e.color ); } private function formatColor( color : uint ) : String { return '#' + color.toString( 16 ); } /* private function checkObjectNameField() : Boolean { if ( edgeName.text.length == 0 ) { edgeName.errorString = 'Введите название связи'; return false; } else { edgeName.errorString = null; } return true; } private function checkFields() : UIComponent { if ( ! checkObjectNameField() ) { return edgeName; } return null; } */ private function apply() : void { var changed : Boolean; var operation : ChangeEdgeProperties = new ChangeEdgeProperties( edge.vgraph, edge ); operation.dumpBefore(); //Название if ( edge.data.label != edgeName.text ) { edge.data.label = edgeName.text; changed = true; } //Описание if ( edge.data.desc != edgeDesc.text ) { edge.data.desc = edgeDesc.text; changed = true; } //Тип if ( edgeArrow.selectedItem && ( edge.data.arrow != edgeArrow.selectedItem.type ) ) { edge.data.arrow = edgeArrow.selectedItem.type; changed = true; } //Толщина if ( edgeWeight.selectedItem && ( edge.data.flow != edgeWeight.selectedItem.weight ) ) { edge.data.flow = edgeWeight.selectedItem.weight; changed = true; } //Цвет if ( edge.data.color != edgeColor.selectedColor ) { edge.lineStyle.color = edge.data.color = edgeColor.selectedColor; changed = true; } if ( changed ) { operation.dumpAfter(); History.add( operation ); IEdgeLabelRenderer( edge.labelView ).refresh(); edge.edge.node1.vnode.updateReleatedEdges(); edge.edge.node2.vnode.updateReleatedEdges(); } operation = null; } private function closeButtonClick() : void { dispatchEvent( new CloseEvent( CloseEvent.CLOSE, false, false, Alert.CANCEL ) ); } private function applyButtonClick() : void { /*var errorField : UIComponent = checkFields(); if ( errorField ) { ErrorUtils.justShow( errorField ); return; }*/ apply(); dispatchEvent( new CloseEvent( CloseEvent.CLOSE, false, false, Alert.OK ) ); }
/* | | _) | | _) __ \ | | __| __| | __ \ _` | | | | | | | | | | ( | _.__/ _| _| \__| \__| _| _| _| \__, | |___/ Blitting, http://blitting.com Copyright (c) 2015 Jason Sturges, http://jasonsturges.com */ package blitting.lifecycle { /** * Implements <code>dispose()</code> interface as class * destructor. * * @author Jason Sturges * */ public interface IDisposable { function dispose():void; } }
/** * An Array-based DataProvider. The DataProvider can be extended, or existing Arrays can be made into a DataProvider using the static {@link DataProvider.initialize}. {@code DataProvider.initialize()} adds the required interface for data components in the Scaleform component framework, including a model for handling asynchronous responses, although that is not necessary in this particular implementation. */ import gfx.events.EventDispatcher; class gfx.data.DataProvider extends Array { /* PUBLIC VARIABLES */ /** Determine if an Object is a DataProvider, either by extension, or using {@link DataProvider.initialize()} */ public var isDataProvider: Boolean = true; /** Mixed in from {@link EventDispatcher#addEventListener EventDispatcher} */ public var addEventListener: Function; /** Mixed in from {@link EventDispatcher#removeEventListener EventDispatcher} */ public var removeEventListener: Function; /** Mixed in from {@link EventDispatcher#hasEventListener EventDispatcher} */ public var hasEventListener: Function; /** Mixed in from {@link EventDispatcher#removeAllEventListeners EventDispatcher} */ public var removeAllEventListeners: Function; /* PRIVATE VARIABLES */ private static var instance: DataProvider; /** Mixed in from {@link EventDispatcher#cleanUpEvents EventDispatcher} */ private var cleanUpEvents: Function; /** Mixed in from {@link EventDispatcher#dispatchEvent EventDispatcher} */ private var dispatchEvent: Function; /* INITIALIZATION */ /** * Create a new DataProvider. Typically, instead of instantiating a DataProvider, an Array can simply be passed into a component that uses a DataProvider, and it will be converted using the {@code DataProvider.initialize()} static method. The DataProvider can be used in place of an Array though. Note that you can not pass arguments to the DataProvider constructor. */ public function DataProvider(total: Number) { super(); EventDispatcher.initialize(this); } /* PUBLIC FUNCTIONS */ /** * Mix-in the DataProvider functionality to an Array. */ public static function initialize(data: Object): Void { if (instance == undefined) { instance = new DataProvider(); } var members: Array = ["indexOf", "requestItemAt", "requestItemRange", "invalidate", "toString", "cleanUp", "isDataProvider"]; for (var i: Number = 0; i < members.length; i++) { data[members[i]] = instance[members[i]]; } EventDispatcher.initialize(data); // Hide the DataProvider methods from introspection, but also hide the EventDispatcher methods, which doesn't happen by default. _global.ASSetPropFlags(data, members, 1); _global.ASSetPropFlags(data, "addEventListener,removeEventListener,hasEventListener,removeAllEventListeners,dispatchEvent,dispatchQueue,cleanUpEvents", 1); } /** * Get the index of an item in the DataProvider. * @param value The item in the DataProvider. * @returns The index of the item in the DataProvider, or -1 if not found. */ public function indexOf(value: Object, scope: Object, callBack:String): Number { var i: Number = 0; for (i = 0; i < length; i++) { if (this[i] == value) { break; } } var index: Number = i == length ? -1 : i; if (callBack) { scope[callBack].call(scope, index); } return index; } /** * Request an item at a specified index. Items will be passed back into the requesting object using a callBack. * @param index The index of the requested item in the DataProvider. * @param scope The scope of the requesting object. * @param callBack The function name of the callBack. * @returns The requested item, if it is immediately available. Note that components will not use the return value. */ public function requestItemAt(index: Number, scope: Object, callBack: String): Object { var item: Object = this[index]; if (callBack) { scope[callBack].call(scope, item); } return item; } /** * Get a range of items between two specified indexes inclusive of the items at {@code beginIndex} and {@code endIndex}. * @param startIndex The start index of the range of requested items in the DataProvider. * @param endIndex The end index of the range of requested items in the DataProvider. * @param scope The scope of the requesting object. * @param callBack The function name of the callBack. * @returns The items in the range, if they are immediately available. Note that components will not use the return value. */ public function requestItemRange(startIndex: Number, endIndex: Number, scope: Object, callBack: String): Array { var items: Array = slice(startIndex, endIndex+1); if (callBack) { scope[callBack].call(scope, items); } return items; } /** * The data or length of the DataProvider has changed. This method dispatches a {@code change} event, which notifies the component(s) displaying the data that they may need to update. This method <i>expects</i> a {@code length} parameter to be passed in when using an asynchronous approach where only requested data is loaded into the DataProvider. * @param length The current length of the data set, which needs to be kept up to date. */ public function invalidate(length: Number): Void { // The length parameter is in the Array DataProvider for compatibility purposes, and is not used. dispatchEvent( {type: "change"} ); } /** * Clean up callBacks and other data references in the DataProvider. No clean up is required in this simple implementation beyond cleaning up event queues. */ public function cleanUp(): Void { splice(0,length); cleanUpEvents(); } /** @exclude */ public function toString(): String { return "[DataProvider (" + length + ")]"; } }
/* * Copyright (c) 2014-2019 Object Builder <https://github.com/ottools/ObjectBuilder> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package otlib.events { import flash.events.Event; public class SpriteListEvent extends Event { //-------------------------------------------------------------------------- // CONSTRUCTOR //-------------------------------------------------------------------------- public function SpriteListEvent(type:String) { super(type); } //-------------------------------------------------------------------------- // METHODS //-------------------------------------------------------------------------- //-------------------------------------- // Override Public //-------------------------------------- override public function clone():Event { return new SpriteListEvent(this.type); } //-------------------------------------------------------------------------- // STATIC //-------------------------------------------------------------------------- public static const FILL:String = "fill"; public static const REPLACE:String = "replace"; public static const EXPORT:String = "export"; public static const REMOVE:String = "remove"; public static const DISPLAYING_CONTEXT_MENU:String = "displayingContextMenu"; } }
package org.openapitools.client.model { import org.openapitools.common.ListWrapper; import org.openapitools.client.model.PipelinelatestRunartifacts; public class PipelinelatestRunList implements ListWrapper { // This declaration below of _PipelinelatestRun_obj_class is to force flash compiler to include this class private var _pipelinelatestRun_obj_class: org.openapitools.client.model.PipelinelatestRun = null; [XmlElements(name="pipelinelatestRun", type="org.openapitools.client.model.PipelinelatestRun")] public var pipelinelatestRun: Array = new Array(); public function getList(): Array{ return pipelinelatestRun; } } }
package io.decagames.rotmg.seasonalEvent.SeasonalLeaderBoard { import flash.display.Sprite; import io.decagames.rotmg.shop.mysteryBox.rollModal.elements.Spinner; import io.decagames.rotmg.ui.defaults.DefaultLabelFormat; import io.decagames.rotmg.ui.gird.UIGrid; import io.decagames.rotmg.ui.gird.UIGridElement; import io.decagames.rotmg.ui.labels.UILabel; import io.decagames.rotmg.ui.popups.UIPopup; import io.decagames.rotmg.ui.scroll.UIScrollbar; import io.decagames.rotmg.ui.sliceScaling.SliceScalingBitmap; import io.decagames.rotmg.ui.tabs.UITab; import io.decagames.rotmg.ui.tabs.UITabs; import io.decagames.rotmg.ui.texture.TextureParser; public class SeasonalLeaderBoard extends UIPopup { public static const TOP_20_TAB_LABEL:String = "Top 20"; public static const PLAYER_TAB_LABEL:String = "Your Position"; public static const SCROLL_Y_OFFSET:int = 155; public static const SCROLL_HEIGHT:int = 410; public static const WIDTH:int = 600; public function SeasonalLeaderBoard() { super(10 * 60, 10 * 60); this.init(); } private var _tabContent:Sprite; private var _spinnersContainer:Sprite; private var _contentInset:SliceScalingBitmap; private var _contentTabs:SliceScalingBitmap; private var _top20Grid:UIGrid; private var _yourPositionGrid:UIGrid; private var _error:UILabel; private var _tabs:UITabs; public function get tabs():UITabs { return this._tabs; } private var _spinner:Spinner; public function get spinner():Spinner { return this._spinner; } private var _refreshTime:UILabel; public function get refreshTime():UILabel { return this._refreshTime; } private var _lastUpdatedTime:UILabel; public function get lastUpdatedTime():UILabel { return this._lastUpdatedTime; } public function addTop20Item(_arg_1:SeasonalLeaderBoardItemData):void { var _local2:SeasonalLeaderBoardItem = new SeasonalLeaderBoardItem(_arg_1); var _local3:UIGridElement = new UIGridElement(); _local3.addChild(_local2); this._top20Grid.addGridElement(_local3); } public function addPlayerListItem(_arg_1:SeasonalLeaderBoardItemData):void { var _local2:SeasonalLeaderBoardItem = new SeasonalLeaderBoardItem(_arg_1); var _local3:UIGridElement = new UIGridElement(); _local3.addChild(_local2); this._yourPositionGrid.addGridElement(_local3); } public function clearLeaderBoard():void { this._error.visible = false; if (this._top20Grid) { this._top20Grid.clearGrid(); } if (this._yourPositionGrid) { this._yourPositionGrid.clearGrid(); } } public function setErrorMessage(_arg_1:String):void { this._error.text = _arg_1; this._error.y = (this.height - this._error.height) / 2; this._error.visible = true; } private function init():void { this.createGrids(); this.createContentInset(); this.createContentTabs(); this.addTabs(); this.createRefreshTime(); this.createLastUpdatedTime(); this.createSpinner(); this.createError(); } private function createError():void { this._error = new UILabel(); DefaultLabelFormat.createLabelFormat(this._error, 14, 0xff0000, "center", true); this._error.autoSize = "none"; this._error.width = 10 * 60; this._error.multiline = true; this._error.wordWrap = true; this._error.visible = false; addChild(this._error); } private function createRefreshTime():void { this._refreshTime = new UILabel(); DefaultLabelFormat.createLabelFormat(this._refreshTime, 12, 0xffffff, "center", true); this._refreshTime.autoSize = "none"; this._refreshTime.width = 5 * 60; this._refreshTime.x = 5 * 60; this._refreshTime.y = this.height - 18; } private function createLastUpdatedTime():void { this._lastUpdatedTime = new UILabel(); DefaultLabelFormat.createLabelFormat(this._lastUpdatedTime, 12, 0xffffff, "center", true); this._lastUpdatedTime.autoSize = "none"; this._lastUpdatedTime.width = 10 * 60; this._lastUpdatedTime.y = this.height - 18; addChild(this._lastUpdatedTime); } private function createSpinner():void { this._spinnersContainer = new Sprite(); addChild(this._spinnersContainer); this._spinner = new Spinner(3 * 60); this._spinner.scaleY = 0.1; this._spinner.scaleX = 0.1; this._spinner.pause(); this._spinner.x = this._contentInset.x + this._contentInset.width / 2; this._spinner.y = this._contentInset.y + this._contentInset.height / 2; this._spinnersContainer.addChild(this._spinner); } private function createGrids():void { this._top20Grid = new UIGrid(580, 1, 3); this._yourPositionGrid = new UIGrid(580, 1, 3); } private function createContentTabs():void { this._contentTabs = TextureParser.instance.getSliceScalingBitmap("UI", "tab_inset_content_background", 568); this._contentTabs.height = 45; this._contentTabs.x = 16; this._contentTabs.y = 155 - this._contentTabs.height + 6; addChild(this._contentTabs); } private function createContentInset():void { this._contentInset = TextureParser.instance.getSliceScalingBitmap("UI", "popup_content_inset", 580); this._contentInset.height = 410; this._contentInset.x = 10; this._contentInset.y = 155; addChild(this._contentInset); } private function addTabs():void { this._tabs = new UITabs(570, true); this._tabs.addTab(this.createTab("Top 20", new Sprite(), this._top20Grid), true); this._tabs.addTab(this.createTab("Your Position", new Sprite(), this._yourPositionGrid), false); this._tabs.x = 16; this._tabs.y = this._contentTabs.y; addChild(this._tabs); } private function createTab(_arg_1:String, _arg_2:Sprite, _arg_3:UIGrid):UITab { var _local4:* = null; _local4 = new UITab(_arg_1, true); this._tabContent = new Sprite(); _arg_2.x = this._contentInset.x; this._tabContent.addChild(_arg_2); _arg_2.y = 16; _arg_2.addChild(_arg_3); var _local6:UIScrollbar = new UIScrollbar(384); _local6.mouseRollSpeedFactor = 1; _local6.scrollObject = _local4; _local6.content = _arg_2; _local6.x = 554; _local6.y = 16; this._tabContent.addChild(_local6); var _local5:Sprite = new Sprite(); _local5.graphics.beginFill(0); _local5.graphics.drawRect(0, 0, 10 * 60, 384); _local5.x = _arg_2.x; _local5.y = _arg_2.y; _arg_2.mask = _local5; this._tabContent.addChild(_local5); _local4.addContent(this._tabContent); return _local4; } } }
// アバターパーツセットを持っているオブジェ用のインターフェイス package model { import org.libspark.thread.*; // import flash.display.DisplayObjectContainer; // import org.libspark.thread.*; public interface IAvatarParts { // 装備済みのアイテムを返す function getEquipedParts():Array; function getWaitEquipedPartsDataThread():Thread; } }
package { public class EquationAnswer { private const answer:Object = new Object(); private const tags:Vector.<TagWithOrder> = new <TagWithOrder> []; public function EquationAnswer(howManyXsWillBe:int) { // constructor code var parameterRow:TagWithOrder = new TagWithOrder("?", -1); for(var orderOfX:int = 0; orderOfX < howManyXsWillBe; orderOfX++) { var tag:TagWithOrder = parameterRow.nextTag("x" + String(orderOfX)); tags.push(tag); answer[tag] = 0; } } public function getParameter(index:int):Number { return answer["x" + String(index)]; } public function setParameter(index:int, value:Number):void { answer["x" + String(index)] = value; } public function toString():String { var result:String = ""; for each(var tag:TagWithOrder in tags) { result += String(answer[tag]) + ","; } return result.slice(0, -1); } } }
package com.unhurdle.spectrum { COMPILE::JS{ import org.apache.royale.core.WrappedHTMLElement; } public class ShowOnOverTooltip extends SpectrumBase { public function ShowOnOverTooltip() { super(); typeNames = "u-tooltip-showOnHover"; } private var textNode:TextNode; private var toolTip:Tooltip; override protected function getTag():String{ return "span"; } COMPILE::JS override protected function createElement():WrappedHTMLElement{ super.createElement(); textNode = new TextNode(""); toolTip = new Tooltip(); style="margin: 15px 50px; cursor: default;"; addElement(toolTip); textNode.element = element; return element; } public function get visibleText():String { return textNode.text; } public function set visibleText(value:String):void { textNode.text = value; } public function get text():String { return toolTip.text; } public function set text(value:String):void { toolTip.text = value; } public function get flavor():String { return toolTip.flavor; } public function set flavor(value:String):void { toolTip.flavor = value; } public function get icon():String { return toolTip.icon; } public function set icon(value:String):void { toolTip.icon = value; } public function get direction():String { return toolTip.direction; } public function set direction(value:String):void { toolTip.direction = value; } public function get isOpen():Boolean { return toolTip.isOpen; } public function set isOpen(value:Boolean):void { toolTip.isOpen = value; } } }
package com.sticksports.nativeExtensions.gameCenter { public class GCScore { public var category : String; public var value : int; public var formattedValue : String; public var date : Date; public var player : GCPlayer; public var rank : int; } }
// Action script... // [Initial MovieClip Action of sprite 20756] #initclip 21 if (!dofus.datacenter.Conquest) { if (!dofus) { _global.dofus = new Object(); } // end if if (!dofus.datacenter) { _global.dofus.datacenter = new Object(); } // end if var _loc1 = (_global.dofus.datacenter.Conquest = function () { super(); this.clear(); mx.events.EventDispatcher.initialize(this); }).prototype; _loc1.clear = function () { this._eaPlayers = new ank.utils.ExtendedArray(); this._eaAttackers = new ank.utils.ExtendedArray(); }; _loc1.__get__alignBonus = function () { return (this._cbdAlignBonus); }; _loc1.__set__alignBonus = function (cbd) { this._cbdAlignBonus = cbd; this.dispatchEvent({type: "bonusChanged"}); //return (this.alignBonus()); }; _loc1.__get__alignMalus = function () { return (this._cbdAlignMalus); }; _loc1.__set__alignMalus = function (cbd) { this._cbdAlignMalus = cbd; this.dispatchEvent({type: "bonusChanged"}); //return (this.alignMalus()); }; _loc1.__get__rankMultiplicator = function () { return (this._cbdRankMultiplicator); }; _loc1.__set__rankMultiplicator = function (cbd) { this._cbdRankMultiplicator = cbd; this.dispatchEvent({type: "bonusChanged"}); //return (this.rankMultiplicator()); }; _loc1.__get__players = function () { return (this._eaPlayers); }; _loc1.__set__players = function (value) { this._eaPlayers = value; //return (this.players()); }; _loc1.__get__attackers = function () { return (this._eaAttackers); }; _loc1.__set__attackers = function (value) { this._eaAttackers = value; //return (this.attackers()); }; _loc1.__get__worldDatas = function () { return (this._cwdDatas); }; _loc1.__set__worldDatas = function (value) { this._cwdDatas = value; this.dispatchEvent({type: "worldDataChanged", value: value}); //return (this.worldDatas()); }; _loc1.addProperty("attackers", _loc1.__get__attackers, _loc1.__set__attackers); _loc1.addProperty("alignMalus", _loc1.__get__alignMalus, _loc1.__set__alignMalus); _loc1.addProperty("players", _loc1.__get__players, _loc1.__set__players); _loc1.addProperty("alignBonus", _loc1.__get__alignBonus, _loc1.__set__alignBonus); _loc1.addProperty("worldDatas", _loc1.__get__worldDatas, _loc1.__set__worldDatas); _loc1.addProperty("rankMultiplicator", _loc1.__get__rankMultiplicator, _loc1.__set__rankMultiplicator); ASSetPropFlags(_loc1, null, 1); } // end if #endinitclip
package com.company.assembleegameclient.ui.tooltip { import com.company.assembleegameclient.appengine.CharacterStats; import com.company.assembleegameclient.appengine.SavedCharactersList; import com.company.assembleegameclient.objects.ObjectLibrary; import com.company.assembleegameclient.ui.LineBreakDesign; import com.company.assembleegameclient.util.AnimatedChar; import com.company.assembleegameclient.util.AnimatedChars; import com.company.assembleegameclient.util.FameUtil; import com.company.assembleegameclient.util.MaskedImage; import com.company.assembleegameclient.util.TextureRedrawer; import com.company.ui.SimpleText; import com.company.util.AssetLibrary; import com.company.util.CachingColorTransformer; import flash.display.Bitmap; import flash.display.BitmapData; import flash.filters.DropShadowFilter; import flash.geom.ColorTransform; import kabam.rotmg.core.model.PlayerModel; public class ClassToolTip extends ToolTip { public function ClassToolTip(playerXML:XML, model:PlayerModel, charStats:CharacterStats) { var showUnlockRequirements:Boolean = false; var unlockLevelXML:XML = null; var coinBD:BitmapData = null; var unlockType:int = 0; var unlockLevel:int = 0; var numStars:int = 0; var nextStarFame:int = 0; super(3552822, 1, 16777215, 1); var animatedChar:AnimatedChar = AnimatedChars.getAnimatedChar(String(playerXML.AnimatedTexture.File), int(playerXML.AnimatedTexture.Index)); var image:MaskedImage = animatedChar.imageFromDir(AnimatedChar.RIGHT, AnimatedChar.STAND, 0); var size:int = 4 / image.width() * 100; var bd:BitmapData = TextureRedrawer.redraw(image.image_, size, true, 0); showUnlockRequirements = this.shouldShowUnlockRequirements(model, playerXML); if (showUnlockRequirements) { bd = CachingColorTransformer.transformBitmapData(bd, new ColorTransform(0, 0, 0, 0.5, 0, 0, 0, 0)); } this.portrait_ = new Bitmap(); this.portrait_.bitmapData = bd; this.portrait_.x = -4; this.portrait_.y = -4; addChild(this.portrait_); this.nameText_ = new SimpleText(13, 11776947, false, 0, 0); this.nameText_.setBold(true); this.nameText_.text = playerXML.@id; this.nameText_.updateMetrics(); this.nameText_.filters = [new DropShadowFilter(0, 0, 0)]; this.nameText_.x = 32; this.nameText_.y = 6; addChild(this.nameText_); this.descriptionText_ = new SimpleText(13, 11776947, false, 174, 0); this.descriptionText_.wordWrap = true; this.descriptionText_.multiline = true; this.descriptionText_.text = playerXML.Description; this.descriptionText_.updateMetrics(); this.descriptionText_.filters = [new DropShadowFilter(0, 0, 0)]; this.descriptionText_.x = 8; this.descriptionText_.y = 40; addChild(this.descriptionText_); this.lineBreak_ = new LineBreakDesign(100, 1842204); this.lineBreak_.x = 6; this.lineBreak_.y = height; addChild(this.lineBreak_); if (showUnlockRequirements) { this.unlockText_ = new SimpleText(13, 11776947, false, 174, 0); this.unlockText_.setBold(true); this.unlockText_.text = "To Unlock:"; this.unlockText_.updateMetrics(); this.unlockText_.filters = [new DropShadowFilter(0, 0, 0)]; this.unlockText_.x = 8; this.unlockText_.y = height - 2; addChild(this.unlockText_); this.unlockText_ = new SimpleText(13, 16549442, false, 174, 0); this.unlockText_.wordWrap = false; this.unlockText_.multiline = true; for each(unlockLevelXML in playerXML.UnlockLevel) { unlockType = ObjectLibrary.idToType_[unlockLevelXML.toString()]; unlockLevel = int(unlockLevelXML.@level); if (model.getBestLevel(unlockType) < int(unlockLevelXML.@level)) { if (this.unlockText_.text != "") { this.unlockText_.text = this.unlockText_.text + "\n"; } this.unlockText_.text = this.unlockText_.text + ("Reach Level " + unlockLevel + " with " + ObjectLibrary.typeToDisplayId_[unlockType]); } } this.unlockText_.border = false; this.unlockText_.updateMetrics(); this.unlockText_.filters = [new DropShadowFilter(0, 0, 0)]; this.unlockText_.x = 12; this.unlockText_.y = height - 4; addChild(this.unlockText_); this.costText_ = new SimpleText(13, 65280, false, 174, 0); this.costText_.wordWrap = true; this.costText_.multiline = true; this.costText_.text = "or buy now for " + playerXML.UnlockCost; this.costText_.updateMetrics(); this.costText_.filters = [new DropShadowFilter(0, 0, 0)]; addChild(this.costText_); this.costText_.x = 12; this.costText_.y = height - 4; coinBD = AssetLibrary.getImageFromSet("lofiObj3", 225); coinBD = TextureRedrawer.redraw(coinBD, 30, true, 0); this.coinBitmap_ = new Bitmap(coinBD); this.coinBitmap_.y = this.costText_.y - 8; this.coinBitmap_.x = this.costText_.x + this.costText_.textWidth; addChild(this.coinBitmap_); } else { numStars = charStats == null ? int(int(0)) : int(int(charStats.numStars())); this.bestLevel_ = new SimpleText(14, 6206769, false, 0, 0); this.bestLevel_.text = numStars + " of 5 Class Quests Completed\n" + "Best Level Achieved: " + (charStats != null ? charStats.bestLevel() : 0) + "\n" + "Best Fame Achieved: " + (charStats != null ? charStats.bestFame() : 0); this.bestLevel_.updateMetrics(); this.bestLevel_.filters = [new DropShadowFilter(0, 0, 0)]; this.bestLevel_.x = 8; this.bestLevel_.y = height - 2; addChild(this.bestLevel_); nextStarFame = FameUtil.nextStarFame(charStats == null ? int(int(0)) : int(int(charStats.bestFame())), 0); if (nextStarFame > 0) { this.nextClassQuest_ = new SimpleText(13, 16549442, false, 174, 0); this.nextClassQuest_.text = "Next Goal: Earn " + nextStarFame + " Fame\n" + " with a " + playerXML.@id; this.nextClassQuest_.updateMetrics(); this.nextClassQuest_.filters = [new DropShadowFilter(0, 0, 0)]; this.nextClassQuest_.x = 8; this.nextClassQuest_.y = height - 2; addChild(this.nextClassQuest_); } } } private var portrait_:Bitmap; private var nameText_:SimpleText; private var descriptionText_:SimpleText; private var lineBreak_:LineBreakDesign; private var bestLevel_:SimpleText; private var toUnlock_:SimpleText; private var unlockText_:SimpleText; private var nextClassQuest_:SimpleText; private var costText_:SimpleText; private var coinBitmap_:Bitmap; override public function draw():void { this.lineBreak_.setWidthColor(width - 10, 1842204); super.draw(); } private function shouldShowUnlockRequirements(model:PlayerModel, playerXML:XML):Boolean { var purchased:Boolean = model.isClassAvailability(String(playerXML.@id), SavedCharactersList.UNRESTRICTED); var levelRequirementMet:Boolean = model.isLevelRequirementsMet(int(playerXML.@type)); return !purchased && !levelRequirementMet; } } }
class mx.video.UIManager { var _vc, _skin, _skinAutoHide, _skinReady, __visible, _bufferingBarHides, _controlsEnabled, _lastScrubPos, _lastVolumePos, cachedSoundLevel, _isMuted, controls, customClips, skin_mc, skinLoader, layout_mc, border_mc, _seekBarIntervalID, _seekBarInterval, _seekBarScrubTolerance, _volumeBarIntervalID, _volumeBarInterval, _volumeBarScrubTolerance, _bufferingDelayIntervalID, _bufferingDelayInterval, _bufferingOn, _skinAutoHideIntervalID, _progressPercent, __get__bufferingBarHidesAndDisablesOthers, __get__controlsEnabled, __get__skin, __get__skinAutoHide, __get__seekBarInterval, __get__volumeBarInterval, __get__bufferingDelayInterval, __get__volumeBarScrubTolerance, __get__seekBarScrubTolerance, __get__visible, uiMgr, state, _focusrect, controlIndex, placeholderLeft, placeholderRight, placeholderTop, placeholderBottom, videoLeft, videoRight, videoTop, videoBottom, _playAfterScrub, __set__bufferingBarHidesAndDisablesOthers, __set__bufferingDelayInterval, __set__controlsEnabled, __set__seekBarInterval, __set__seekBarScrubTolerance, __set__skin, __set__skinAutoHide, __get__skinReady, __set__visible, __set__volumeBarInterval, __set__volumeBarScrubTolerance; function UIManager(vc) { _vc = vc; _skin = undefined; _skinAutoHide = false; _skinReady = true; __visible = true; _bufferingBarHides = false; _controlsEnabled = true; _lastScrubPos = 0; _lastVolumePos = 0; cachedSoundLevel = _vc.volume; _isMuted = false; controls = new Array(); customClips = undefined; skin_mc = undefined; skinLoader = undefined; layout_mc = undefined; border_mc = undefined; _seekBarIntervalID = 0; _seekBarInterval = mx.video.UIManager.SEEK_BAR_INTERVAL_DEFAULT; _seekBarScrubTolerance = mx.video.UIManager.SEEK_BAR_SCRUB_TOLERANCE_DEFAULT; _volumeBarIntervalID = 0; _volumeBarInterval = mx.video.UIManager.VOLUME_BAR_INTERVAL_DEFAULT; _volumeBarScrubTolerance = mx.video.UIManager.VOLUME_BAR_SCRUB_TOLERANCE_DEFAULT; _bufferingDelayIntervalID = 0; _bufferingDelayInterval = mx.video.UIManager.BUFFERING_DELAY_INTERVAL_DEFAULT; _bufferingOn = false; _skinAutoHideIntervalID = 0; _vc.addEventListener("metadataReceived", this); _vc.addEventListener("playheadUpdate", this); _vc.addEventListener("progress", this); _vc.addEventListener("stateChange", this); _vc.addEventListener("ready", this); _vc.addEventListener("resize", this); _vc.addEventListener("volumeUpdate", this); } // End of the function function handleEvent(e) { if (e.vp != undefined && e.vp != _vc.__get__visibleVideoPlayerIndex()) { return; } // end if var _loc9 = _vc.__get__activeVideoPlayerIndex(); _vc.__set__activeVideoPlayerIndex(_vc.visibleVideoPlayerIndex); if (e.type == "stateChange") { if (e.state == mx.video.FLVPlayback.BUFFERING) { if (!_bufferingOn) { clearInterval(_bufferingDelayIntervalID); _bufferingDelayIntervalID = setInterval(this, "doBufferingDelay", _bufferingDelayInterval); } // end if } else { clearInterval(_bufferingDelayIntervalID); _bufferingDelayIntervalID = 0; _bufferingOn = false; } // end else if if (e.state == mx.video.FLVPlayback.LOADING) { _progressPercent = _vc.getVideoPlayer(e.vp).__get__isRTMP() ? (100) : (0); for (var _loc2 = mx.video.UIManager.SEEK_BAR; _loc2 <= mx.video.UIManager.VOLUME_BAR; ++_loc2) { var _loc4 = controls[_loc2]; if (_loc4.progress_mc != undefined) { this.positionBar(_loc4, "progress", _progressPercent); } // end if } // end of for } // end if for (var _loc2 = 0; _loc2 < mx.video.UIManager.NUM_CONTROLS; ++_loc2) { if (controls[_loc2] == undefined) { continue; } // end if this.setEnabledAndVisibleForState(_loc2, e.state); if (_loc2 < mx.video.UIManager.NUM_BUTTONS) { this.skinButtonControl(controls[_loc2]); } // end if } // end of for } else if (e.type == "ready" || e.type == "metadataReceived") { for (var _loc2 = 0; _loc2 < mx.video.UIManager.NUM_CONTROLS; ++_loc2) { if (controls[_loc2] == undefined) { continue; } // end if this.setEnabledAndVisibleForState(_loc2, _vc.__get__state()); if (_loc2 < mx.video.UIManager.NUM_BUTTONS) { this.skinButtonControl(controls[_loc2]); } // end if } // end of for if (_vc.getVideoPlayer(e.vp).__get__isRTMP()) { _progressPercent = 100; for (var _loc2 = mx.video.UIManager.SEEK_BAR; _loc2 <= mx.video.UIManager.VOLUME_BAR; ++_loc2) { _loc4 = controls[_loc2]; if (_loc4.progress_mc != undefined) { this.positionBar(_loc4, "progress", _progressPercent); } // end if } // end of for } // end if } else if (e.type == "resize") { this.layoutSkin(); this.setupSkinAutoHide(); } else if (e.type == "volumeUpdate") { if (_isMuted && e.volume > 0) { _isMuted = false; this.setEnabledAndVisibleForState(mx.video.UIManager.MUTE_OFF_BUTTON, mx.video.FLVPlayback.PLAYING); this.skinButtonControl(controls[mx.video.UIManager.MUTE_OFF_BUTTON]); this.setEnabledAndVisibleForState(mx.video.UIManager.MUTE_ON_BUTTON, mx.video.FLVPlayback.PLAYING); this.skinButtonControl(controls[mx.video.UIManager.MUTE_ON_BUTTON]); } // end if var _loc5 = controls[mx.video.UIManager.VOLUME_BAR]; _loc5.percentage = _isMuted ? (cachedSoundLevel) : (e.volume); if (_loc5.percentage < 0) { _loc5.percentage = 0; } else if (_loc5.percentage > 100) { _loc5.percentage = 100; } // end else if this.positionHandle(mx.video.UIManager.VOLUME_BAR); } else if (e.type == "playheadUpdate" && controls[mx.video.UIManager.SEEK_BAR] != undefined) { if (!_vc.__get__isLive() && _vc.__get__totalTime() > 0) { var _loc6 = e.playheadTime / _vc.__get__totalTime() * 100; if (_loc6 < 0) { _loc6 = 0; } else if (_loc6 > 100) { _loc6 = 100; } // end else if var _loc10 = controls[mx.video.UIManager.SEEK_BAR]; _loc10.percentage = _loc6; this.positionHandle(mx.video.UIManager.SEEK_BAR); } // end if } else if (e.type == "progress") { _progressPercent = e.bytesTotal <= 0 ? (100) : (e.bytesLoaded / e.bytesTotal * 100); var _loc7 = _vc._vpState[e.vp].minProgressPercent; if (!isNaN(_loc7) && _loc7 > _progressPercent) { _progressPercent = _loc7; } // end if if (_vc.__get__totalTime() > 0) { var _loc8 = _vc.__get__playheadTime() / _vc.__get__totalTime() * 100; if (_loc8 > _progressPercent) { _progressPercent = _loc8; _vc._vpState[e.vp].minProgressPercent = _progressPercent; } // end if } // end if for (var _loc2 = mx.video.UIManager.SEEK_BAR; _loc2 <= mx.video.UIManager.VOLUME_BAR; ++_loc2) { _loc4 = controls[_loc2]; if (_loc4.progress_mc != undefined) { this.positionBar(_loc4, "progress", _progressPercent); } // end if } // end of for } // end else if _vc.__set__activeVideoPlayerIndex(_loc9); } // End of the function function get bufferingBarHidesAndDisablesOthers() { return (_bufferingBarHides); } // End of the function function set bufferingBarHidesAndDisablesOthers(b) { _bufferingBarHides = b; //return (this.bufferingBarHidesAndDisablesOthers()); null; } // End of the function function get controlsEnabled() { return (_controlsEnabled); } // End of the function function set controlsEnabled(flag) { if (_controlsEnabled == flag) { return; } // end if _controlsEnabled = flag; for (var _loc2 = 0; _loc2 < mx.video.UIManager.NUM_BUTTONS; ++_loc2) { if (controls[_loc2] == undefined) { continue; } // end if controls[_loc2].releaseCapture(); controls[_loc2].enabled = _controlsEnabled && controls[_loc2].myEnabled; this.skinButtonControl(controls[_loc2]); } // end of for //return (this.controlsEnabled()); null; } // End of the function function get skin() { return (_skin); } // End of the function function set skin(s) { if (s == _skin) { return; } // end if if (_skin != undefined) { this.removeSkin(); } // end if _skin = s; _skinReady = _skin == undefined || _skin == null || _skin == ""; if (!_skinReady) { this.downloadSkin(); } // end if //return (this.skin()); null; } // End of the function function get skinAutoHide() { return (_skinAutoHide); } // End of the function function set skinAutoHide(b) { if (b == _skinAutoHide) { return; } // end if _skinAutoHide = b; this.setupSkinAutoHide(); //return (this.skinAutoHide()); null; } // End of the function function get skinReady() { return (_skinReady); } // End of the function function get seekBarInterval() { return (_seekBarInterval); } // End of the function function set seekBarInterval(s) { if (_seekBarInterval == s) { return; } // end if _seekBarInterval = s; if (_seekBarIntervalID > 0) { clearInterval(_seekBarIntervalID); _seekBarIntervalID = setInterval(this, "seekBarListener", _seekBarInterval, false); } // end if //return (this.seekBarInterval()); null; } // End of the function function get volumeBarInterval() { return (_volumeBarInterval); } // End of the function function set volumeBarInterval(s) { if (_volumeBarInterval == s) { return; } // end if _volumeBarInterval = s; if (_volumeBarIntervalID > 0) { clearInterval(_volumeBarIntervalID); _volumeBarIntervalID = setInterval(this, "volumeBarListener", _volumeBarInterval, false); } // end if //return (this.volumeBarInterval()); null; } // End of the function function get bufferingDelayInterval() { return (_bufferingDelayInterval); } // End of the function function set bufferingDelayInterval(s) { if (_bufferingDelayInterval == s) { return; } // end if _bufferingDelayInterval = s; if (_bufferingDelayIntervalID > 0) { clearInterval(_bufferingDelayIntervalID); _bufferingDelayIntervalID = setInterval(this, "doBufferingDelay", _bufferingDelayIntervalID); } // end if //return (this.bufferingDelayInterval()); null; } // End of the function function get volumeBarScrubTolerance() { return (_volumeBarScrubTolerance); } // End of the function function set volumeBarScrubTolerance(s) { _volumeBarScrubTolerance = s; //return (this.volumeBarScrubTolerance()); null; } // End of the function function get seekBarScrubTolerance() { return (_seekBarScrubTolerance); } // End of the function function set seekBarScrubTolerance(s) { _seekBarScrubTolerance = s; //return (this.seekBarScrubTolerance()); null; } // End of the function function get visible() { return (__visible); } // End of the function function set visible(v) { if (__visible == v) { return; } // end if __visible = v; if (!__visible) { skin_mc._visible = false; } else { this.setupSkinAutoHide(); } // end else if //return (this.visible()); null; } // End of the function function getControl(index) { return (controls[index]); } // End of the function function setControl(index, s) { if (s == null) { s = undefined; } // end if if (s == controls[index]) { return; } // end if switch (index) { case mx.video.UIManager.PAUSE_BUTTON: case mx.video.UIManager.PLAY_BUTTON: { this.resetPlayPause(); break; } case mx.video.UIManager.PLAY_PAUSE_BUTTON: { if (s._parent != layout_mc) { this.resetPlayPause(); this.setControl(mx.video.UIManager.PAUSE_BUTTON, s.pause_mc); this.setControl(mx.video.UIManager.PLAY_BUTTON, s.play_mc); } // end if break; } case mx.video.UIManager.MUTE_BUTTON: { if (s._parent != layout_mc) { this.setControl(mx.video.UIManager.MUTE_ON_BUTTON, s.on_mc); this.setControl(mx.video.UIManager.MUTE_OFF_BUTTON, s.off_mc); } // end if break; } } // End of switch if (index >= mx.video.UIManager.NUM_BUTTONS) { controls[index] = s; switch (index) { case mx.video.UIManager.SEEK_BAR: { this.addBarControl(mx.video.UIManager.SEEK_BAR); break; } case mx.video.UIManager.VOLUME_BAR: { this.addBarControl(mx.video.UIManager.VOLUME_BAR); controls[mx.video.UIManager.VOLUME_BAR].percentage = _vc.volume; break; } case mx.video.UIManager.BUFFERING_BAR: { controls[mx.video.UIManager.BUFFERING_BAR].uiMgr = this; controls[mx.video.UIManager.BUFFERING_BAR].controlIndex = mx.video.UIManager.BUFFERING_BAR; if (controls[mx.video.UIManager.BUFFERING_BAR]._parent == skin_mc) { this.finishAddBufferingBar(); } else { controls[mx.video.UIManager.BUFFERING_BAR].onEnterFrame = function () { uiMgr.finishAddBufferingBar(); }; } // end else if break; } } // End of switch this.setEnabledAndVisibleForState(index, _vc.__get__state()); } else { this.removeButtonControl(index); controls[index] = s; this.addButtonControl(index); } // end else if } // End of the function function resetPlayPause() { if (controls[mx.video.UIManager.PLAY_PAUSE_BUTTON] == undefined) { return; } // end if for (var _loc2 = mx.video.UIManager.PAUSE_BUTTON; _loc2 <= mx.video.UIManager.PLAY_BUTTON; ++_loc2) { this.removeButtonControl(_loc2); } // end of for controls[mx.video.UIManager.PLAY_PAUSE_BUTTON] = undefined; } // End of the function function addButtonControl(index) { var _loc3 = controls[index]; if (_loc3 == undefined) { return; } // end if var _loc5 = _vc.__get__activeVideoPlayerIndex(); _vc.__set__activeVideoPlayerIndex(_vc.visibleVideoPlayerIndex); _loc3.id = index; _loc3.state = mx.video.UIManager.UP_STATE; _loc3.uiMgr = this; this.setEnabledAndVisibleForState(index, _vc.__get__state()); _loc3.onRollOver = function () { state = mx.video.UIManager.OVER_STATE; uiMgr.skinButtonControl(this); }; _loc3.onRollOut = function () { state = mx.video.UIManager.UP_STATE; uiMgr.skinButtonControl(this); }; if (index == mx.video.UIManager.SEEK_BAR_HANDLE || index == mx.video.UIManager.VOLUME_BAR_HANDLE) { _loc3.onPress = function () { if (_root.focusManager) { _focusrect = false; Selection.setFocus(this); } // end if state = mx.video.UIManager.DOWN_STATE; uiMgr.dispatchMessage(this); uiMgr.skinButtonControl(this); }; _loc3.onRelease = function () { state = mx.video.UIManager.OVER_STATE; uiMgr.handleRelease(controlIndex); uiMgr.skinButtonControl(this); }; _loc3.onReleaseOutside = function () { state = mx.video.UIManager.UP_STATE; uiMgr.handleRelease(controlIndex); uiMgr.skinButtonControl(this); }; } else { _loc3.onPress = function () { if (_root.focusManager) { _focusrect = false; Selection.setFocus(this); } // end if state = mx.video.UIManager.DOWN_STATE; uiMgr.skinButtonControl(this); }; _loc3.onRelease = function () { state = mx.video.UIManager.OVER_STATE; uiMgr.dispatchMessage(this); uiMgr.skinButtonControl(this); }; _loc3.onReleaseOutside = function () { state = mx.video.UIManager.UP_STATE; uiMgr.skinButtonControl(this); }; } // end else if if (_loc3._parent == skin_mc) { this.skinButtonControl(_loc3); } else { _loc3.onEnterFrame = function () { uiMgr.skinButtonControl(this); }; } // end else if _vc.__set__activeVideoPlayerIndex(_loc5); } // End of the function function removeButtonControl(index) { if (controls[index] == undefined) { return; } // end if controls[index].uiMgr = undefined; controls[index].onRollOver = undefined; controls[index].onRollOut = undefined; controls[index].onPress = undefined; controls[index].onRelease = undefined; controls[index].onReleaseOutside = undefined; controls[index] = undefined; } // End of the function function downloadSkin() { if (skinLoader == undefined) { skinLoader = new MovieClipLoader(); skinLoader.addListener(this); } // end if if (skin_mc == undefined) { skin_mc = _vc.createEmptyMovieClip("skin_mc", _vc.getNextHighestDepth()); } // end if skin_mc._visible = false; skin_mc._x = Stage.width + 100; skin_mc._y = Stage.height + 100; skinLoader.loadClip(_skin, skin_mc); } // End of the function function onLoadError(target_mc, errorCode) { _skinReady = true; _vc.skinError("Unable to load skin swf"); } // End of the function null[] = (Error)() == null ? (null, throw , function () { try { skin_mc._visible = false; skin_mc._x = 0; skin_mc._y = 0; layout_mc = skin_mc.layout_mc; if (layout_mc == undefined) { throw new Error("No layout_mc"); } // end if layout_mc._visible = false; customClips = new Array(); this.setCustomClips("bg"); if (layout_mc.playpause_mc != undefined) { this.setSkin(mx.video.UIManager.PLAY_PAUSE_BUTTON, layout_mc.playpause_mc); } else { this.setSkin(mx.video.UIManager.PAUSE_BUTTON, layout_mc.pause_mc); this.setSkin(mx.video.UIManager.PLAY_BUTTON, layout_mc.play_mc); } // end else if this.setSkin(mx.video.UIManager.STOP_BUTTON, layout_mc.stop_mc); this.setSkin(mx.video.UIManager.BACK_BUTTON, layout_mc.back_mc); this.setSkin(mx.video.UIManager.FORWARD_BUTTON, layout_mc.forward_mc); this.setSkin(mx.video.UIManager.MUTE_BUTTON, layout_mc.volumeMute_mc); this.setSkin(mx.video.UIManager.SEEK_BAR, layout_mc.seekBar_mc); this.setSkin(mx.video.UIManager.VOLUME_BAR, layout_mc.volumeBar_mc); this.setSkin(mx.video.UIManager.BUFFERING_BAR, layout_mc.bufferingBar_mc); this.setCustomClips("fg"); this.layoutSkin(); this.setupSkinAutoHide(); skin_mc._visible = __visible; _skinReady = true; _vc.skinLoaded(); var _loc4 = _vc.__get__activeVideoPlayerIndex(); _vc.__set__activeVideoPlayerIndex(_vc.visibleVideoPlayerIndex); var _loc3 = _vc.__get__state(); for (var _loc2 = 0; _loc2 < mx.video.UIManager.NUM_CONTROLS; ++_loc2) { if (controls[_loc2] == undefined) { continue; } // end if this.setEnabledAndVisibleForState(_loc2, _loc3); if (_loc2 < mx.video.UIManager.NUM_BUTTONS) { this.skinButtonControl(controls[_loc2]); } // end if } // end of for _vc.__set__activeVideoPlayerIndex(_loc4); } // End of try catch () { } // End of catch }) : (var err = (Error)(), _vc.skinError(err.message), this.removeSkin(), "onLoadInit"); function layoutSkin() { if (layout_mc == undefined) { return; } // end if var _loc3 = layout_mc.video_mc; if (_loc3 == undefined) { throw new Error("No layout_mc.video_mc"); } // end if placeholderLeft = _loc3._x; placeholderRight = _loc3._x + _loc3._width; placeholderTop = _loc3._y; placeholderBottom = _loc3._y + _loc3._height; videoLeft = 0; videoRight = _vc.width; videoTop = 0; videoBottom = _vc.height; if (!isNaN(layout_mc.minWidth) && layout_mc.minWidth > 0 && layout_mc.minWidth > videoRight) { videoLeft = videoLeft - (layout_mc.minWidth - videoRight) / 2; videoRight = layout_mc.minWidth + videoLeft; } // end if if (!isNaN(layout_mc.minHeight) && layout_mc.minHeight > 0 && layout_mc.minHeight > videoBottom) { videoTop = videoTop - (layout_mc.minHeight - videoBottom) / 2; videoBottom = layout_mc.minHeight + videoTop; } // end if var _loc2; for (var _loc2 = 0; _loc2 < customClips.length; ++_loc2) { this.layoutControl(customClips[_loc2]); } // end of for for (var _loc2 = 0; _loc2 < mx.video.UIManager.NUM_CONTROLS; ++_loc2) { this.layoutControl(controls[_loc2]); } // end of for } // End of the function function layoutControl(ctrl) { if (ctrl == undefined) { return; } // end if if (ctrl.skin.anchorRight) { if (ctrl.skin.anchorLeft) { ctrl._x = ctrl.skin._x - placeholderLeft + videoLeft; ctrl._width = ctrl.skin._x + ctrl.skin._width - placeholderRight + videoRight - ctrl._x; if (ctrl.origWidth != undefined) { ctrl.origWidth = undefined; } // end if } else { ctrl._x = ctrl.skin._x - placeholderRight + videoRight; } // end else if } else { ctrl._x = ctrl.skin._x - placeholderLeft + videoLeft; } // end else if if (ctrl.skin.anchorTop) { if (ctrl.skin.anchorBottom) { ctrl._y = ctrl.skin._y - placeholderTop + videoTop; ctrl._height = ctrl.skin._y + ctrl.skin._height - placeholderBottom + videoBottom - ctrl._y; if (ctrl.origHeight != undefined) { ctrl.origHeight = undefined; } // end if } else { ctrl._y = ctrl.skin._y - placeholderTop + videoTop; } // end else if } else { ctrl._y = ctrl.skin._y - placeholderBottom + videoBottom; } // end else if switch (ctrl.controlIndex) { case mx.video.UIManager.SEEK_BAR: case mx.video.UIManager.VOLUME_BAR: { if (ctrl.progress_mc != undefined) { if (_progressPercent == undefined) { _progressPercent = _vc.__get__isRTMP() ? (100) : (0); } // end if this.positionBar(ctrl, "progress", _progressPercent); } // end if this.positionHandle(ctrl.controlIndex); break; } case mx.video.UIManager.BUFFERING_BAR: { if (ctrl.fill_mc != undefined) { this.positionMaskedFill(ctrl, ctrl.fill_mc, 100); } // end if break; } } // End of switch if (ctrl.layoutSelf != undefined) { ctrl.layoutSelf(); } // end if } // End of the function function removeSkin() { if (skin_mc != undefined) { for (var _loc2 = 0; _loc2 < mx.video.UIManager.NUM_BUTTONS; ++_loc2) { this.removeButtonControl(_loc2); } // end of for for (var _loc2 = mx.video.UIManager.NUM_BUTTONS; _loc2 < mx.video.UIManager.NUM_CONTROLS; ++_loc2) { controls[_loc2] = undefined; } // end of for skin_mc.unloadMovie(); layout_mc = undefined; border_mc = undefined; } // end if } // End of the function function setCustomClips(prefix) { var _loc4 = 1; while (true) { var _loc2 = layout_mc[prefix + _loc4++ + "_mc"]; if (_loc2 == undefined) { break; } // end if var _loc3 = _loc2.mc; if (_loc3 == undefined) { _loc3 = _loc2._parent._parent[_loc2._name]; } // end if if (_loc3 == undefined) { throw new Error("Bad clip in skin: " + _loc2); } // end if _loc3.skin = _loc2; customClips.push(_loc3); if (prefix == "bg" && _loc4 == 2) { border_mc = _loc3; } // end if } // end while } // End of the function function setSkin(index, s) { if (s == undefined) { return; } // end if var _loc2 = s.mc; if (_loc2 == undefined) { _loc2 = s._parent._parent[s._name]; } // end if if (_loc2 == undefined) { throw new Error("Bad clip in skin: " + s); } // end if _loc2.skin = s; if (index < mx.video.UIManager.NUM_BUTTONS) { this.setupSkinStates(_loc2); } else { switch (index) { case mx.video.UIManager.PLAY_PAUSE_BUTTON: { this.setupSkinStates(_loc2.play_mc); this.setupSkinStates(_loc2.pause_mc); break; } case mx.video.UIManager.MUTE_BUTTON: { this.setupSkinStates(_loc2.on_mc); this.setupSkinStates(_loc2.off_mc); break; } case mx.video.UIManager.SEEK_BAR: case mx.video.UIManager.VOLUME_BAR: { var _loc4 = index == mx.video.UIManager.SEEK_BAR ? ("seekBar") : ("volumeBar"); if (_loc2.handle_mc == undefined) { _loc2.handle_mc = _loc2.skin.seekBarHandle_mc; if (_loc2.handle_mc == undefined) { _loc2.handle_mc = _loc2.skin._parent._parent[_loc4 + "Handle_mc"]; } // end if } // end if if (_loc2.progress_mc == undefined) { _loc2.progress_mc = _loc2.skin.progress_mc; if (_loc2.progress_mc == undefined) { _loc2.progress_mc = _loc2.skin._parent._parent[_loc4 + "Progress_mc"]; } // end if } // end if if (_loc2.fullness_mc == undefined) { _loc2.fullness_mc = _loc2.skin.fullness_mc; if (_loc2.fullness_mc == undefined) { _loc2.fullness_mc = _loc2.skin._parent._parent[_loc4 + "Fullness_mc"]; } // end if } // end if break; } case mx.video.UIManager.BUFFERING_BAR: { if (_loc2.fill_mc == undefined) { _loc2.fill_mc = _loc2.skin.fill_mc; if (_loc2.fill_mc == undefined) { _loc2.fill_mc = _loc2.skin._parent._parent.bufferingBarFill_mc; } // end if } // end if break; } } // End of switch } // end else if this.setControl(index, _loc2); } // End of the function function setupSkinStates(ctrl) { if (ctrl.up_mc == undefined) { ctrl.up_mc = ctrl; ctrl.over_mc = ctrl; ctrl.down_mc = ctrl; ctrl.disabled_mc = ctrl; } else { ctrl._x = 0; ctrl._y = 0; ctrl.up_mc._x = 0; ctrl.up_mc._y = 0; ctrl.up_mc._visible = true; if (ctrl.over_mc == undefined) { ctrl.over_mc = ctrl.up_mc; } else { ctrl.over_mc._x = 0; ctrl.over_mc._y = 0; ctrl.over_mc._visible = false; } // end else if if (ctrl.down_mc == undefined) { ctrl.down_mc = ctrl.up_mc; } else { ctrl.down_mc._x = 0; ctrl.down_mc._y = 0; ctrl.down_mc._visible = false; } // end else if if (ctrl.disabled_mc == undefined) { ctrl.disabled_mc_mc = ctrl.up_mc; } else { ctrl.disabled_mc._x = 0; ctrl.disabled_mc._y = 0; ctrl.disabled_mc._visible = false; } // end else if } // end else if } // End of the function function skinButtonControl(ctrl) { if (ctrl.onEnterFrame != undefined) { delete ctrl.onEnterFrame; ctrl.onEnterFrame = undefined; } // end if if (ctrl.enabled) { switch (ctrl.state) { case mx.video.UIManager.UP_STATE: { if (ctrl.up_mc == undefined) { ctrl.up_mc = ctrl.attachMovie(ctrl.upLinkageID, "up_mc", ctrl.getNextHighestDepth()); } // end if this.applySkinState(ctrl, ctrl.up_mc); break; } case mx.video.UIManager.OVER_STATE: { if (ctrl.over_mc == undefined) { if (ctrl.overLinkageID == undefined) { ctrl.over_mc = ctrl.up_mc; } else { ctrl.over_mc = ctrl.attachMovie(ctrl.overLinkageID, "over_mc", ctrl.getNextHighestDepth()); } // end if } // end else if this.applySkinState(ctrl, ctrl.over_mc); break; } case mx.video.UIManager.DOWN_STATE: { if (ctrl.down_mc == undefined) { if (ctrl.downLinkageID == undefined) { ctrl.down_mc = ctrl.up_mc; } else { ctrl.down_mc = ctrl.attachMovie(ctrl.downLinkageID, "down_mc", ctrl.getNextHighestDepth()); } // end if } // end else if this.applySkinState(ctrl, ctrl.down_mc); break; } } // End of switch } else { ctrl.state = mx.video.UIManager.UP_STATE; if (ctrl.disabled_mc == undefined) { if (ctrl.disabledLinkageID == undefined) { ctrl.disabled_mc = ctrl.up_mc; } else { ctrl.disabled_mc = ctrl.attachMovie(ctrl.disabledLinkageID, "disabled_mc", ctrl.getNextHighestDepth()); } // end if } // end else if this.applySkinState(ctrl, ctrl.disabled_mc); } // end else if if (ctrl.placeholder_mc != undefined) { ctrl.placeholder_mc.unloadMovie(); delete ctrl.placeholder_mc; ctrl.placeholder_mc = undefined; } // end if } // End of the function function applySkinState(ctrl, state) { if (state != ctrl.currentState_mc) { if (state != undefined) { state._visible = true; } // end if if (ctrl.currentState_mc != undefined) { ctrl.currentState_mc._visible = false; } // end if ctrl.currentState_mc = state; } // end if } // End of the function function addBarControl(controlIndex) { var _loc2 = controls[controlIndex]; _loc2.isDragging = false; _loc2.percentage = 0; _loc2.uiMgr = this; _loc2.controlIndex = controlIndex; if (_loc2._parent == skin_mc) { this.finishAddBarControl(controlIndex); } else { _loc2.onEnterFrame = function () { uiMgr.finishAddBarControl(this.controlIndex); }; } // end else if } // End of the function function finishAddBarControl(controlIndex) { var _loc2 = controls[controlIndex]; delete _loc2.onEnterFrame; _loc2.onEnterFrame = undefined; if (_loc2.addBarControl != undefined) { _loc2.addBarControl(); } // end if this.calcBarMargins(_loc2, "handle", true); this.calcBarMargins(_loc2, "progress", false); this.calcBarMargins(_loc2.progress_mc, "fill", false); this.calcBarMargins(_loc2.progress_mc, "mask", false); this.calcBarMargins(_loc2, "fullness", false); this.calcBarMargins(_loc2.fullness_mc, "fill", false); this.calcBarMargins(_loc2.fullness_mc, "mask", false); _loc2.origWidth = _loc2._width; _loc2.origHeight = _loc2._height; this.fixUpBar(_loc2, "progress"); if (_loc2.progress_mc != undefined) { this.fixUpBar(_loc2, "progressBarFill"); if (_progressPercent == undefined) { _progressPercent = _vc.__get__isRTMP() ? (100) : (0); } // end if this.positionBar(_loc2, "progress", _progressPercent); } // end if this.fixUpBar(_loc2, "fullness"); if (_loc2.fullness_mc != undefined) { this.fixUpBar(_loc2, "fullnessBarFill"); } // end if this.fixUpBar(_loc2, "handle"); _loc2.handle_mc.controlIndex = controlIndex; switch (controlIndex) { case mx.video.UIManager.SEEK_BAR: { this.setControl(mx.video.UIManager.SEEK_BAR_HANDLE, _loc2.handle_mc); break; } case mx.video.UIManager.VOLUME_BAR: { this.setControl(mx.video.UIManager.VOLUME_BAR_HANDLE, _loc2.handle_mc); break; } } // End of switch this.positionHandle(controlIndex); } // End of the function function fixUpBar(ctrl, type) { if (ctrl[type + "LinkageID"] != undefined && ctrl[type + "LinkageID"].length > 0) { var _loc1; if (ctrl[type + "Below"]) { for (var _loc1 = -1; ctrl._parent.getInstanceAtDepth(_loc1) != undefined; --_loc1) { } // end of for } else { ctrl[type + "Below"] = false; _loc1 = ctrl._parent.getNextHighestDepth(); } // end else if var _loc5 = ctrl.controlIndex == mx.video.UIManager.SEEK_BAR ? ("seekBar") : ("volumeBar"); var _loc4 = _loc5 + type.substring(0, 1).toUpperCase() + type.substring(1) + "_mc"; ctrl[type + "_mc"] = ctrl._parent.attachMovie(ctrl[type + "LinkageID"], _loc4, _loc1); } // end if } // End of the function function calcBarMargins(ctrl, type, symmetricMargins) { var _loc2 = ctrl[type + "_mc"]; if (_loc2 == undefined) { return; } // end if if (ctrl[type + "LeftMargin"] == undefined && _loc2._parent == ctrl._parent) { ctrl[type + "LeftMargin"] = _loc2._x - ctrl._x; } // end if if (ctrl[type + "RightMargin"] == undefined) { if (symmetricMargins) { ctrl[type + "RightMargin"] = ctrl[type + "LeftMargin"]; } else if (_loc2._parent == ctrl._parent) { ctrl[type + "RightMargin"] = ctrl._width - _loc2._width - _loc2._x + ctrl._x; } // end if } // end else if if (ctrl[type + "TopMargin"] == undefined && _loc2._parent == ctrl._parent) { ctrl[type + "TopMargin"] = _loc2._y - ctrl._y; } // end if if (ctrl[type + "BottomMargin"] == undefined) { if (symmetricMargins) { ctrl[type + "BottomMargin"] = ctrl[type + "TopMargin"]; } else if (_loc2._parent == ctrl._parent) { ctrl[type + "BottomMargin"] = ctrl._height - _loc2._height - _loc2._y + ctrl._y; } // end if } // end else if if (ctrl[type + "X"] == undefined) { if (_loc2._parent == ctrl._parent) { ctrl[type + "X"] = _loc2._x - ctrl._x; } else if (_loc2._parent == ctrl) { ctrl[type + "X"] = _loc2._x; } // end if } // end else if if (ctrl[type + "Y"] == undefined) { if (_loc2._parent == ctrl._parent) { ctrl[type + "Y"] = _loc2._y - ctrl._y; } else if (_loc2._parent == ctrl) { ctrl[type + "Y"] = _loc2._y; } // end if } // end else if ctrl[type + "XScale"] = _loc2._xscale; ctrl[type + "YScale"] = _loc2._yscale; ctrl[type + "Width"] = _loc2._width; ctrl[type + "Height"] = _loc2._height; } // End of the function function finishAddBufferingBar() { var _loc2 = controls[mx.video.UIManager.BUFFERING_BAR]; delete _loc2.onEnterFrame; _loc2.onEnterFrame = undefined; this.calcBarMargins(_loc2, "fill", true); this.fixUpBar(_loc2, "fill"); if (_loc2.fill_mc != undefined) { this.positionMaskedFill(_loc2, _loc2.fill_mc, 100); } // end if } // End of the function function positionMaskedFill(ctrl, fill, percent) { var _loc5 = fill._parent; var _loc3 = ctrl.mask_mc; if (_loc3 == undefined) { _loc3 = _loc5.createEmptyMovieClip(ctrl._name + "Mask_mc", _loc5.getNextHighestDepth()); ctrl.mask_mc = _loc3; _loc3.beginFill(16777215); _loc3.lineTo(0, 0); _loc3.lineTo(1, 0); _loc3.lineTo(1, 1); _loc3.lineTo(0, 1); _loc3.lineTo(0, 0); _loc3.endFill(); fill.setMask(_loc3); _loc3._x = ctrl.fillX; _loc3._y = ctrl.fillY; _loc3._width = ctrl.fillWidth; _loc3._height = ctrl.fillHeight; _loc3._visible = false; this.calcBarMargins(ctrl, "mask", true); } // end if if (_loc5 == ctrl) { if (fill.slideReveal) { fill._x = ctrl.maskX - ctrl.fillWidth + ctrl.fillWidth * percent / 100; } else { _loc3._width = ctrl.fillWidth * percent / 100; } // end else if } else if (_loc5 == ctrl._parent) { if (fill.slideReveal) { _loc3._x = ctrl._x + ctrl.maskLeftMargin; _loc3._y = ctrl._y + ctrl.maskTopMargin; _loc3._width = ctrl._width - ctrl.maskRightMargin - ctrl.maskLeftMargin; _loc3._height = ctrl._height - ctrl.maskTopMargin - ctrl.maskBottomMargin; fill._x = _loc3._x - ctrl.fillWidth + ctrl.maskWidth * percent / 100; fill._y = ctrl._y + ctrl.fillTopMargin; } else { fill._x = ctrl._x + ctrl.fillLeftMargin; fill._y = ctrl._y + ctrl.fillTopMargin; _loc3._x = fill._x; _loc3._y = fill._y; _loc3._width = (ctrl._width - ctrl.fillRightMargin - ctrl.fillLeftMargin) * percent / 100; _loc3._height = ctrl._height - ctrl.fillTopMargin - ctrl.fillBottomMargin; } // end else if } // end else if } // End of the function function startHandleDrag(controlIndex) { var _loc2 = controls[controlIndex]; var _loc5 = _loc2.handle_mc; if (_loc2.startHandleDrag == undefined || !_loc2.startHandleDrag()) { var _loc3 = _loc2._y + _loc2.handleY; var _loc4 = _loc2.origWidth == undefined ? (_loc2._width) : (_loc2.origWidth); _loc5.startDrag(false, _loc2._x + _loc2.handleLeftMargin, _loc3, _loc2._x + _loc4 - _loc2.handleRightMargin, _loc3); } // end if _loc2.isDragging = true; } // End of the function function stopHandleDrag(controlIndex) { var _loc2 = controls[controlIndex]; var _loc3 = _loc2.handle_mc; if (_loc2.stopHandleDrag == undefined || !_loc2.stopHandleDrag()) { _loc3.stopDrag(); } // end if _loc2.isDragging = false; } // End of the function function positionHandle(controlIndex) { var _loc2 = controls[controlIndex]; var _loc3 = _loc2.handle_mc; if (_loc3 == undefined) { return; } // end if if (_loc2.positionHandle != undefined && _loc2.positionHandle()) { return; } // end if var _loc4 = _loc2.origWidth == undefined ? (_loc2._width) : (_loc2.origWidth); var _loc5 = _loc4 - _loc2.handleRightMargin - _loc2.handleLeftMargin; _loc3._x = _loc2._x + _loc2.handleLeftMargin + _loc5 * _loc2.percentage / 100; _loc3._y = _loc2._y + _loc2.handleY; if (_loc2.fullness_mc != undefined) { this.positionBar(_loc2, "fullness", _loc2.percentage); } // end if } // End of the function function positionBar(ctrl, type, percent) { if (ctrl.positionBar != undefined && ctrl.positionBar(type, percent)) { return; } // end if var _loc2 = ctrl[type + "_mc"]; if (_loc2._parent == ctrl) { if (_loc2.fill_mc == undefined) { _loc2._xscale = ctrl[type + "XScale"] * percent / 100; } else { this.positionMaskedFill(_loc2, _loc2.fill_mc, percent); } // end else if } else { _loc2._x = ctrl._x + ctrl[type + "LeftMargin"]; _loc2._y = ctrl._y + ctrl[type + "Y"]; if (_loc2.fill_mc == undefined) { _loc2._width = (ctrl._width - ctrl[type + "LeftMargin"] - ctrl[type + "RightMargin"]) * percent / 100; } else { this.positionMaskedFill(_loc2, _loc2.fill_mc, percent); } // end else if } // end else if } // End of the function function calcPercentageFromHandle(controlIndex) { var _loc2 = controls[controlIndex]; var _loc5 = _loc2.handle_mc; if (_loc2.calcPercentageFromHandle == undefined || !_loc2.calcPercentageFromHandle()) { var _loc3 = _loc2.origWidth == undefined ? (_loc2._width) : (_loc2.origWidth); var _loc6 = _loc3 - _loc2.handleRightMargin - _loc2.handleLeftMargin; var _loc4 = _loc5._x - (_loc2._x + _loc2.handleLeftMargin); _loc2.percentage = _loc4 / _loc6 * 100; if (_loc2.fullness_mc != undefined) { this.positionBar(_loc2, "fullness", _loc2.percentage); } // end if } // end if if (_loc2.percentage < 0) { _loc2.percentage = 0; } // end if if (_loc2.percentage > 100) { _loc2.percentage = 100; } // end if } // End of the function function handleRelease(controlIndex) { var _loc3 = _vc.__get__activeVideoPlayerIndex(); _vc.__set__activeVideoPlayerIndex(_vc.visibleVideoPlayerIndex); if (controlIndex == mx.video.UIManager.SEEK_BAR) { this.seekBarListener(true); } else if (controlIndex == mx.video.UIManager.VOLUME_BAR) { this.volumeBarListener(true); } // end else if this.stopHandleDrag(controlIndex); _vc.__set__activeVideoPlayerIndex(_loc3); if (controlIndex == mx.video.UIManager.SEEK_BAR) { _vc._scrubFinish(); } // end if } // End of the function function seekBarListener(finish) { var _loc3 = _vc.__get__activeVideoPlayerIndex(); _vc.__set__activeVideoPlayerIndex(_vc.visibleVideoPlayerIndex); var _loc4 = controls[mx.video.UIManager.SEEK_BAR]; this.calcPercentageFromHandle(mx.video.UIManager.SEEK_BAR); var _loc2 = _loc4.percentage; if (finish) { clearInterval(_seekBarIntervalID); _seekBarIntervalID = 0; if (_loc2 != _lastScrubPos) { _vc.seekPercent(_loc2); } // end if _vc.addEventListener("playheadUpdate", this); if (_playAfterScrub) { _vc.play(); } // end if } else if (_vc.getVideoPlayer(_vc.__get__visibleVideoPlayerIndex()).__get__state() == mx.video.VideoPlayer.SEEKING) { } else if (_seekBarScrubTolerance <= 0 || Math.abs(_loc2 - _lastScrubPos) > _seekBarScrubTolerance || _loc2 < _seekBarScrubTolerance || _loc2 > 100 - _seekBarScrubTolerance) { if (_loc2 != _lastScrubPos) { _lastScrubPos = _loc2; _vc.seekPercent(_loc2); } // end else if } // end else if _vc.__set__activeVideoPlayerIndex(_loc3); } // End of the function function volumeBarListener(finish) { var _loc3 = controls[mx.video.UIManager.VOLUME_BAR]; this.calcPercentageFromHandle(mx.video.UIManager.VOLUME_BAR); var _loc2 = _loc3.percentage; if (finish) { clearInterval(_volumeBarIntervalID); _volumeBarIntervalID = 0; _vc.addEventListener("volumeUpdate", this); } // end if if (finish || _volumeBarScrubTolerance <= 0 || Math.abs(_loc2 - _lastVolumePos) > _volumeBarScrubTolerance || _loc2 < _volumeBarScrubTolerance || _loc2 > 100 - _volumeBarScrubTolerance) { if (_loc2 != _lastVolumePos) { if (_isMuted) { cachedSoundLevel = _loc2; } else { _vc.__set__volume(_loc2); } // end if } // end if } // end else if } // End of the function function doBufferingDelay() { clearInterval(_bufferingDelayIntervalID); _bufferingDelayIntervalID = 0; var _loc2 = _vc.__get__activeVideoPlayerIndex(); _vc.__set__activeVideoPlayerIndex(_vc.visibleVideoPlayerIndex); if (_vc.__get__state() == mx.video.FLVPlayback.BUFFERING) { _bufferingOn = true; this.handleEvent({type: "stateChange", state: mx.video.FLVPlayback.BUFFERING, vp: _vc.__get__visibleVideoPlayerIndex()}); } // end if _vc.__set__activeVideoPlayerIndex(_loc2); } // End of the function function dispatchMessage(ctrl) { if (ctrl.id == mx.video.UIManager.SEEK_BAR_HANDLE) { _vc._scrubStart(); } // end if var _loc2 = _vc.__get__activeVideoPlayerIndex(); _vc.__set__activeVideoPlayerIndex(_vc.visibleVideoPlayerIndex); switch (ctrl.id) { case mx.video.UIManager.PAUSE_BUTTON: { _vc.pause(); break; } case mx.video.UIManager.PLAY_BUTTON: { _vc.play(); break; } case mx.video.UIManager.STOP_BUTTON: { _vc.stop(); break; } case mx.video.UIManager.SEEK_BAR_HANDLE: { this.calcPercentageFromHandle(mx.video.UIManager.SEEK_BAR); _lastScrubPos = controls[mx.video.UIManager.SEEK_BAR].percentage; _vc.removeEventListener("playheadUpdate", this); if (_vc.__get__playing() || _vc.__get__buffering()) { _playAfterScrub = true; } else if (_vc.__get__state() != mx.video.VideoPlayer.SEEKING) { _playAfterScrub = false; } // end else if _seekBarIntervalID = setInterval(this, "seekBarListener", _seekBarInterval, false); this.startHandleDrag(mx.video.UIManager.SEEK_BAR, mx.video.UIManager.SEEK_BAR_HANDLE); _vc.pause(); break; } case mx.video.UIManager.VOLUME_BAR_HANDLE: { this.calcPercentageFromHandle(mx.video.UIManager.VOLUME_BAR); _lastVolumePos = controls[mx.video.UIManager.VOLUME_BAR].percentage; _vc.removeEventListener("volumeUpdate", this); _volumeBarIntervalID = setInterval(this, "volumeBarListener", _volumeBarInterval, false); this.startHandleDrag(mx.video.UIManager.VOLUME_BAR, mx.video.UIManager.VOLUME_BAR_HANDLE); break; } case mx.video.UIManager.BACK_BUTTON: { _vc.seekToPrevNavCuePoint(); break; } case mx.video.UIManager.FORWARD_BUTTON: { _vc.seekToNextNavCuePoint(); break; } case mx.video.UIManager.MUTE_ON_BUTTON: case mx.video.UIManager.MUTE_OFF_BUTTON: { if (!_isMuted) { _isMuted = true; cachedSoundLevel = _vc.volume; _vc.__set__volume(0); } else { _isMuted = false; _vc.__set__volume(cachedSoundLevel); } // end else if this.setEnabledAndVisibleForState(mx.video.UIManager.MUTE_OFF_BUTTON, mx.video.FLVPlayback.PLAYING); this.skinButtonControl(controls[mx.video.UIManager.MUTE_OFF_BUTTON]); this.setEnabledAndVisibleForState(mx.video.UIManager.MUTE_ON_BUTTON, mx.video.FLVPlayback.PLAYING); this.skinButtonControl(controls[mx.video.UIManager.MUTE_ON_BUTTON]); break; } default: { throw new Error("Unknown ButtonControl"); } } // End of switch _vc.__set__activeVideoPlayerIndex(_loc2); } // End of the function function setEnabledAndVisibleForState(index, state) { var _loc5 = _vc.__get__activeVideoPlayerIndex(); _vc.__set__activeVideoPlayerIndex(_vc.visibleVideoPlayerIndex); var _loc3 = state; if (_loc3 == mx.video.FLVPlayback.BUFFERING && !_bufferingOn) { _loc3 = mx.video.FLVPlayback.PLAYING; } // end if switch (index) { case mx.video.UIManager.VOLUME_BAR: case mx.video.UIManager.VOLUME_BAR_HANDLE: { controls[index].myEnabled = true; controls[index].enabled = _controlsEnabled; break; } case mx.video.UIManager.MUTE_ON_BUTTON: { controls[index].myEnabled = !_isMuted; if (controls[mx.video.UIManager.MUTE_BUTTON] != undefined) { controls[index]._visible = controls[index].myEnabled; } // end if break; } case mx.video.UIManager.MUTE_OFF_BUTTON: { controls[index].myEnabled = _isMuted; if (controls[mx.video.UIManager.MUTE_BUTTON] != undefined) { controls[index]._visible = controls[index].myEnabled; } // end if break; } default: { switch (_loc3) { case mx.video.FLVPlayback.LOADING: case mx.video.FLVPlayback.CONNECTION_ERROR: { controls[index].myEnabled = false; break; } case mx.video.FLVPlayback.DISCONNECTED: { controls[index].myEnabled = _vc.__get__contentPath() != undefined; break; } case mx.video.FLVPlayback.SEEKING: { break; } default: { controls[index].myEnabled = true; break; } } // End of switch break; } } // End of switch switch (index) { case mx.video.UIManager.SEEK_BAR: { switch (_loc3) { case mx.video.FLVPlayback.STOPPED: case mx.video.FLVPlayback.PLAYING: case mx.video.FLVPlayback.PAUSED: case mx.video.FLVPlayback.REWINDING: case mx.video.FLVPlayback.SEEKING: { controls[index].myEnabled = true; break; } case mx.video.FLVPlayback.BUFFERING: { controls[index].myEnabled = !_bufferingBarHides || controls[mx.video.UIManager.BUFFERING_BAR] == undefined; break; } default: { controls[index].myEnabled = false; break; } } // End of switch if (controls[index].myEnabled) { controls[index].myEnabled = !isNaN(_vc.__get__totalTime()) && _vc.__get__totalTime() > 0; } // end if controls[index].handle_mc.myEnabled = controls[index].myEnabled; controls[index].handle_mc.enabled = controls[index].handle_mc.myEnabled; controls[index].handle_mc._visible = controls[index].myEnabled; var _loc4 = !_bufferingBarHides || controls[index].myEnabled || controls[mx.video.UIManager.BUFFERING_BAR] == undefined || !controls[mx.video.UIManager.BUFFERING_BAR]._visible; controls[index]._visible = _loc4; controls[index].progress_mc._visible = _loc4; controls[index].progress_mc.fill_mc._visible = _loc4; controls[index].fullness_mc._visible = _loc4; controls[index].progress_mc.fill_mc._visible = _loc4; break; } case mx.video.UIManager.BUFFERING_BAR: { switch (_loc3) { case mx.video.FLVPlayback.STOPPED: case mx.video.FLVPlayback.PLAYING: case mx.video.FLVPlayback.PAUSED: case mx.video.FLVPlayback.REWINDING: case mx.video.FLVPlayback.SEEKING: { controls[index].myEnabled = false; break; } default: { controls[index].myEnabled = true; break; } } // End of switch controls[index]._visible = controls[index].myEnabled; controls[index].fill_mc._visible = controls[index].myEnabled; break; } case mx.video.UIManager.PAUSE_BUTTON: { switch (_loc3) { case mx.video.FLVPlayback.DISCONNECTED: case mx.video.FLVPlayback.STOPPED: case mx.video.FLVPlayback.PAUSED: case mx.video.FLVPlayback.REWINDING: { controls[index].myEnabled = false; break; } case mx.video.FLVPlayback.PLAYING: { controls[index].myEnabled = true; break; } case mx.video.FLVPlayback.BUFFERING: { controls[index].myEnabled = !_bufferingBarHides || controls[mx.video.UIManager.BUFFERING_BAR] == undefined; break; } } // End of switch if (controls[mx.video.UIManager.PLAY_PAUSE_BUTTON] != undefined) { controls[index]._visible = controls[index].myEnabled; } // end if break; } case mx.video.UIManager.PLAY_BUTTON: { switch (_loc3) { case mx.video.FLVPlayback.PLAYING: { controls[index].myEnabled = false; break; } case mx.video.FLVPlayback.STOPPED: case mx.video.FLVPlayback.PAUSED: { controls[index].myEnabled = true; break; } case mx.video.FLVPlayback.BUFFERING: { controls[index].myEnabled = !_bufferingBarHides || controls[mx.video.UIManager.BUFFERING_BAR] == undefined; break; } } // End of switch if (controls[mx.video.UIManager.PLAY_PAUSE_BUTTON] != undefined) { controls[index]._visible = !controls[mx.video.UIManager.PAUSE_BUTTON]._visible; } // end if break; } case mx.video.UIManager.STOP_BUTTON: { switch (_loc3) { case mx.video.FLVPlayback.DISCONNECTED: case mx.video.FLVPlayback.STOPPED: { controls[index].myEnabled = false; break; } case mx.video.FLVPlayback.PAUSED: case mx.video.FLVPlayback.PLAYING: case mx.video.FLVPlayback.BUFFERING: { controls[index].myEnabled = true; break; } } // End of switch break; } case mx.video.UIManager.BACK_BUTTON: case mx.video.UIManager.FORWARD_BUTTON: { if (_loc3 !== mx.video.FLVPlayback.BUFFERING) { break; } // end if controls[index].myEnabled = !_bufferingBarHides || controls[mx.video.UIManager.BUFFERING_BAR] == undefined; break; } } // End of switch controls[index].enabled = _controlsEnabled && controls[index].myEnabled; _vc.__set__activeVideoPlayerIndex(_loc5); } // End of the function function setupSkinAutoHide() { var _loc2 = _vc.getVideoPlayer(_vc.__get__visibleVideoPlayerIndex()); if (_skinAutoHide && skin_mc != undefined) { this.skinAutoHideHitTest(); if (_skinAutoHideIntervalID == 0) { _skinAutoHideIntervalID = setInterval(this, "skinAutoHideHitTest", mx.video.UIManager.SKIN_AUTO_HIDE_INTERVAL); } // end if } else { skin_mc._visible = __visible; clearInterval(_skinAutoHideIntervalID); _skinAutoHideIntervalID = 0; } // end else if } // End of the function function skinAutoHideHitTest() { if (!__visible) { skin_mc._visible = false; } else { var _loc4 = _vc.getVideoPlayer(_vc.__get__visibleVideoPlayerIndex()); var _loc3 = _loc4.hitTest(_root._xmouse, _root._ymouse, true); if (!_loc3 && border_mc != undefined) { _loc3 = border_mc.hitTest(_root._xmouse, _root._ymouse, true); } // end if skin_mc._visible = _loc3; } // end else if } // End of the function static var version = "1.0.1.10"; static var shortVersion = "1.0.1"; static var PAUSE_BUTTON = 0; static var PLAY_BUTTON = 1; static var STOP_BUTTON = 2; static var SEEK_BAR_HANDLE = 3; static var BACK_BUTTON = 4; static var FORWARD_BUTTON = 5; static var MUTE_ON_BUTTON = 6; static var MUTE_OFF_BUTTON = 7; static var VOLUME_BAR_HANDLE = 8; static var NUM_BUTTONS = 9; static var PLAY_PAUSE_BUTTON = 9; static var MUTE_BUTTON = 10; static var BUFFERING_BAR = 11; static var SEEK_BAR = 12; static var VOLUME_BAR = 13; static var NUM_CONTROLS = 14; static var UP_STATE = 0; static var OVER_STATE = 1; static var DOWN_STATE = 2; static var SKIN_AUTO_HIDE_INTERVAL = 200; static var VOLUME_BAR_INTERVAL_DEFAULT = 250; static var VOLUME_BAR_SCRUB_TOLERANCE_DEFAULT = 0; static var SEEK_BAR_INTERVAL_DEFAULT = 250; static var SEEK_BAR_SCRUB_TOLERANCE_DEFAULT = 5; static var BUFFERING_DELAY_INTERVAL_DEFAULT = 1000; } // End of Class
package com.base.events { import utils.Singleton; import utils.struct.MYHashMap; /** * 事件分发总类 * @author movinliao * */ internal class EventCenter extends Singleton { private static var _moduleMap: MYHashMap = new MYHashMap(); private static var _switched: Boolean = true; public function EventCenter() { super(null); } /** * 加入事件 * @param key 模块标志 * @param subKey 事件标志 * @param listener 事件属主 * @param handler 事件执行体 * @param priority 事件处理优先级 * */ public static function addListener(key:String, subKey: String, listener: *, handler:Function, priority:int = EventConst.PRIORITY_NORMAL):void { if(!_moduleMap.containsKey(key)) _moduleMap.put(key, new ModuleBody(!_switched)); var module: ModuleBody = _moduleMap.getValue(key); module.add(subKey, listener, handler, priority); EventConst.log("Listener add: key=" + key + ", subKey=" + subKey + ", listener=" + listener + ", handler=" + handler + ", priority=" + priority); } /** * 移除事件 * @param key 模块标志 * @param subKey 事件标志 * @param listener 事件属主 * @param handler 事件执行体 * @param priority 事件处理优先级 * */ public static function removeListener(key:String, subKey: String, listener: *, handler:Function, priority:int = EventConst.PRIORITY_NORMAL):void { if(!_moduleMap.containsKey(key)) return; var module: ModuleBody = _moduleMap.getValue(key); module.remove(subKey, listener, handler, priority); EventConst.log("Listener remove: key=" + key + ", subKey=" + subKey + ", listener=" + listener + ", handler=" + handler + ", priority=" + priority); } /** *分发一个事件 * @param key 模块标志 * @param subKey 事件标志 * @param args 事件分发参数 * */ public static function dispatch(key:String, subKey: String, ...args):void { if(!_switched || !_moduleMap.containsKey(key)) return; var module: ModuleBody = _moduleMap.getValue(key); module.exec(subKey, args); EventConst.log("Event dispatch: key=" + key + ", subKey=" + subKey); } /** * 暂停激活或者暂停某个组 * @param key 模块标志 * @param value true 为暂停 false 为激活 * */ public static function pause(key:String, value: Boolean): void { if(!_moduleMap.containsKey(key)) return; var module: ModuleBody = _moduleMap.getValue(key); module.paused = value; EventConst.log("Event pause: key=" + key + ", value=" + value ); } /** * 停止所有的回调 * */ public static function clearAll(): void { _moduleMap.clear(); EventConst.log("Event clearAll" ); } /** *停止指定的回调 * @param key * @param listener * */ public static function clear(key:String, listener: Object): void { if(!_moduleMap.containsKey(key)) return; var module: ModuleBody = _moduleMap.getValue(key); module.clear(key, listener); EventConst.log("Event clear: key=" + key + ", listener=" + listener ); } /** *事件开关 读 * @return * */ public static function get switched(): Boolean { return _switched; } /** * 事件开关写 * @param value * */ public static function set switched(value: Boolean): void { _switched = value; EventConst.log("Event switched: value=" + value); } } } import com.base.events.EventConst; import utils.struct.MYHashMap; internal final class EventBody { private static var _handers: MYHashMap = new MYHashMap(); public var priority: int = EventConst.PRIORITY_NORMAL; public function EventBody(listener_: *, handler_: Function, priority_: int) { priority = priority_; _handers.put(this, {listener: listener_, handler: handler_}); } public function get body(): Object { return _handers.get(this); } public function destroy(): void { _handers.remove(this); } public function same(listener: *, handler:Function, priority_:int): Boolean { var info: Object = body; return (info && (info.listener == listener) && (info.handler == handler) && (priority == priority_)); } public function exec(args: Array): * { var item: Object = body; if(!item) return; var handler: * = item.handler; var listener: * = item.listener; if(handler && listener) { try { handler.apply(listener, args); } catch(error:Error) { if(EventConst.debug) throw(error); } } } } internal final class ModuleBody { private var _paused: Boolean = false; private var _events: MYHashMap = new MYHashMap(); public function ModuleBody(paused: Boolean) { _paused = paused; } public function exec(key: String, args: Array): void { if(_paused || !_events.containsKey(key)) return; var list: Array = _events.getValue(key) || []; execItems(list.slice(), args); } public function add(key: String, listener: *, handler:Function, priority:int): void { if(!_events.containsKey(key)) _events.put(key, []); var list: Array = _events.getValue(key); if(indexOf(list, listener, handler, priority) == -1) { list.push(new EventBody(listener, handler, priority)); list.sortOn("priority", Array.DESCENDING | Array.NUMERIC); } } public function remove(key: String, listener: *, handler:Function, priority:int): void { if(!_events.containsKey(key)) return; var list: Array = _events.getValue(key); do { var index: int = indexOf(list, listener, handler, priority); if(index > -1) { var item: EventBody = list[index]; list.splice(index , 1); if(item && item.body) { item.destroy(); item = null; } } }while(index > -1); } public function clear(key: String, listener: *): void { if(!_events.containsKey(key)) return; var list: Array = _events.getValue(key); for each(var item: EventBody in list) { var body: Object = item.body; if(body && (body.listener == listener)) { var index:int = list.indexOf(item); if(index != -1) { var evb: EventBody = list[index]; list.splice(index , 1); if(evb && evb.body) { evb.destroy(); evb = null; } } } } } public function set paused(value: Boolean): void { _paused = value; } private function execItems(list: Array, args: Array): void { for each(var item: EventBody in list) { item.exec(args); } } private function indexOf(list: Array, listener: *, handler:Function, priority:int): int { var index: int = -1; for(var i:int = 0; i < list.length; ++i) { var item: EventBody = list[i]; if(item && item.same(listener, handler, priority)) { index = i; break; } } return index; } }
/* Feathers Copyright 2012-2015 Joshua Tynjala. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.core { /** * A display object that supports validation. Display objects of this type * will delay updating after property changes until just before Starling * renders the display list to avoid running redundant code. */ public interface IValidating extends IFeathersDisplayObject { /** * The component's depth in the display list, relative to the stage. If * the component isn't on the stage, its depth will be <code>-1</code>. * * <p>Used by the validation system to validate components from the * top down</p>. */ function get depth():int; /** * Immediately validates the display object, if it is invalid. The * validation system exists to postpone updating a display object after * properties are changed until until the last possible moment the * display object is rendered. This allows multiple properties to be * changed at a time without requiring a full update every time. */ function validate():void; } }
package kabam.rotmg.arena { import kabam.rotmg.arena.control.ArenaDeathCommand; import kabam.rotmg.arena.control.ArenaDeathSignal; import kabam.rotmg.arena.control.ClearCurrentRunCommand; import kabam.rotmg.arena.control.ImminentArenaWaveCommand; import kabam.rotmg.arena.control.ImminentArenaWaveSignal; import kabam.rotmg.arena.control.ReloadLeaderboard; import kabam.rotmg.arena.model.ArenaLeaderboardModel; import kabam.rotmg.arena.model.BestArenaRunModel; import kabam.rotmg.arena.model.CurrentArenaRunModel; import kabam.rotmg.arena.service.GetArenaLeaderboardTask; import kabam.rotmg.arena.service.GetBestArenaRunTask; import kabam.rotmg.arena.view.ArenaLeaderboard; import kabam.rotmg.arena.view.ArenaLeaderboardListItem; import kabam.rotmg.arena.view.ArenaLeaderboardListItemMediator; import kabam.rotmg.arena.view.ArenaLeaderboardMediator; import kabam.rotmg.arena.view.ArenaQueryPanel; import kabam.rotmg.arena.view.ArenaQueryPanelMediator; import kabam.rotmg.arena.view.ArenaTimer; import kabam.rotmg.arena.view.ArenaTimerMediator; import kabam.rotmg.arena.view.ArenaWaveCounter; import kabam.rotmg.arena.view.ArenaWaveCounterMediator; import kabam.rotmg.arena.view.BattleSummaryDialog; import kabam.rotmg.arena.view.BattleSummaryDialogMediator; import kabam.rotmg.arena.view.ContinueOrQuitDialog; import kabam.rotmg.arena.view.ContinueOrQuitMediator; import kabam.rotmg.arena.view.HostQueryDialog; import kabam.rotmg.arena.view.HostQueryDialogMediator; import kabam.rotmg.arena.view.ImminentWaveCountdownClock; import kabam.rotmg.arena.view.ImminentWaveCountdownClockMediator; import kabam.rotmg.game.signals.GameClosedSignal; import org.swiftsuspenders.Injector; import robotlegs.bender.extensions.commandCenter.api.ICommandCenter; import robotlegs.bender.extensions.mediatorMap.api.IMediatorMap; import robotlegs.bender.extensions.signalCommandMap.api.ISignalCommandMap; import robotlegs.bender.framework.api.IConfig; public class ArenaConfig implements IConfig { [Inject] public var injector:Injector; [Inject] public var mediatorMap:IMediatorMap; [Inject] public var commandMap:ISignalCommandMap; [Inject] public var commandCenter:ICommandCenter; public function configure():void { this.injector.map(GetArenaLeaderboardTask); this.injector.map(GetBestArenaRunTask); this.injector.map(CurrentArenaRunModel).asSingleton(); this.injector.map(BestArenaRunModel).asSingleton(); this.injector.map(ReloadLeaderboard).asSingleton(); this.injector.map(ArenaLeaderboardModel).asSingleton(); this.commandMap.map(ArenaDeathSignal).toCommand(ArenaDeathCommand); this.commandMap.map(ImminentArenaWaveSignal).toCommand(ImminentArenaWaveCommand); this.commandMap.map(GameClosedSignal).toCommand(ClearCurrentRunCommand); this.mediatorMap.map(ContinueOrQuitDialog).toMediator(ContinueOrQuitMediator); this.mediatorMap.map(HostQueryDialog).toMediator(HostQueryDialogMediator); this.mediatorMap.map(ArenaQueryPanel).toMediator(ArenaQueryPanelMediator); this.mediatorMap.map(ArenaLeaderboard).toMediator(ArenaLeaderboardMediator); this.mediatorMap.map(ArenaLeaderboardListItem).toMediator(ArenaLeaderboardListItemMediator); this.mediatorMap.map(ImminentWaveCountdownClock).toMediator(ImminentWaveCountdownClockMediator); this.mediatorMap.map(ArenaTimer).toMediator(ArenaTimerMediator); this.mediatorMap.map(BattleSummaryDialog).toMediator(BattleSummaryDialogMediator); this.mediatorMap.map(ArenaWaveCounter).toMediator(ArenaWaveCounterMediator); } } }
package com.zcup.timer { import com.zcup.utils.FormatUtil; import flash.display.Shape; import flash.events.Event; import flash.events.TimerEvent; import flash.utils.Dictionary; import flash.utils.Timer; import flash.utils.getTimer; /** * 请使用TimerManager类实现时间控制器功能。 * (此类还没研究透彻。以后慢慢研究) * @author: mldongs * @qq: 25772076 * @time:Oct 21, 2011 6:15:10 PM **/ internal class TimerCenter { public static const TIME_RegExp:RegExp = /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/; /**每秒多少帧* */ public static const FRAME_RATE:int = 24; /** 用以监听flash enter_frame**/ private static var _shape:Shape; /** @private Gets updated on every frame.**/ private static var _rootFrame:int; /**flash运行时所经过的毫秒数**/ private static var _passedTime:int; /**毫秒表,timer调用,回调参数为帧耗时(毫秒 int)**/ private static var _timerLib:Dictionary; /**毫秒表,enter_frame调用,回调参数为帧耗时(毫秒int)**/ private static var _tickLib:Dictionary; /**秒表 回调支持自定义参数**/ private static var _entityLib:Dictionary; /**超时表 仅返回是否超时**/ private static var _durationLib:Dictionary; /** 全局timer控制器 **/ private static var _timer:Timer; private static var _localToServer:Number; // local + localToServer = server public function TimerCenter() { } /** *init TimerServer * */ public static function init():void{ if(!_shape) { _timerLib = new Dictionary(); _tickLib = new Dictionary(); _entityLib = new Dictionary(); _durationLib = new Dictionary(); _shape = new Shape(); _passedTime = getTimer(); //testFrameSpeed(); _shape.addEventListener(Event.ENTER_FRAME, updateAllTick); } if(!_timer) { _timer = new Timer(1); _timer.addEventListener(TimerEvent.TIMER,updateAllTimer); } } /** * 延迟函数执行 * @param handler * @param delay 延迟毫秒数 * @param args handler的参数 * @return Timer * */ public static function laterCall(handler:Function,delay:Number,...args):Timer { var t:Timer=new Timer(delay,1); if(args.length>0){ t.addEventListener(TimerEvent.TIMER_COMPLETE,function ():void{handler.apply(null,args);},false,0); }else{ t.addEventListener(TimerEvent.TIMER_COMPLETE,function ():void{handler();},false,0); } t.start(); return t; } /** * 每多少秒执行一次handler, 参数必须是秒数, 回调handler(time:int),time表示上一帧到这一帧所耗费的时间(毫秒) * 不再需要此服务的时候请调用removeSecTick以解除服务 * handler第一次被执行的时间不确定,仅可用于不求精确的计时服务 * @param handler 回调函数 * @param second 秒数 */ public static function addSecTick(handler:Function, second:int):void { addTick(handler, second*FRAME_RATE); } /** *解除秒handler服务 */ public static function removeSecTick(handler:Function, second:int):void{ removeTick(handler, second*FRAME_RATE); } /** * 给函数增加脉博,回调fun(time:int), time表示上一帧到这一帧所耗费的时间(毫秒),可用于累加计时 * @param fun function * @param everyFrames 每多少帧执行一次tick * @return * */ public static function addTick(fun:Function, everyFrames:int=2):void{ var k:int = everyFrames; var funs:Vector.<Function>; funs= _tickLib[k]; if(!funs){ funs = _tickLib[k] = new Vector.<Function>(); } if(funs.indexOf(fun) == -1) funs.push(fun); } /** * 删除函数脉博 * @param fun * @param everyFrames Hash key 必需提供此参数以加快运行效率 * */ public static function removeTick(fun:Function, everyFrames:int):void{ var k:int = everyFrames, funs:Vector.<Function>; funs = _tickLib[k]; if(funs){ var i:int = funs.indexOf(fun); if(i != -1)funs.splice(i, 1); if(!funs.length) delete _tickLib[k]; } } /** *运行定时服务,delay秒后handle会被执行,一经运行无法被修改/撤销/暂停 */ public static function run(delay:int, handle:Function, ...param):void{ var args:Array = param; args.unshift(delay * 1000); // 秒 -> 毫秒 args.unshift(handle); (TimerCenter.setInterval as Function).apply(null, args); } /** * 添加定时服务,delay毫秒后handle会被执行,定时服务自动解除 * 此定时服务可修改(edit) /撤销(remove) /暂停(pause) /恢复(resume) */ public static function add(delay:int, handle:Function, ...param):void{ _entityLib[ handle ] = new Entity(delay, handle, param); } // 修改某个 handle public static function edit(handle:Function, delay:int):void{ var e:Entity = _entityLib[ handle ]; if(e != null)e.delay = delay; } // 删除某个 handle public static function remove(handle:Function):void{ delete _entityLib[ handle ]; } // 判断一个 handle 是否存在 public static function exist(handle:Function):Boolean{ return _entityLib[ handle ] != null; } // 判断一个 handle 是否存在, 并返回剩余的秒数, 但 !=0 时表示存在 public static function exist_remain(handle:Function):int{ var e:Entity = _entityLib[ handle ]; return (e!=null? e.delay: 0); } // 暂停某个 handle public static function pause(handle:Function):void{ var e:Entity = _entityLib[ handle ]; if(e && e.delay>=0) e.delay = -e.delay; } // 恢复某个 handle public static function resume(handle:Function):void{ var e:Entity = _entityLib[ handle ]; if(e && e.delay<0) e.delay = -e.delay; } /** *设置延时调用, 单位毫秒,仅回调1次, 外部无法删除定时器 */ public static function setInterval(closure:Function, delay:Number, ...args):void { var timer:Timer = new Timer(delay, 1); var onTimerComplete:Function = function(event:TimerEvent):void{ timer.removeEventListener(TimerEvent.TIMER, onTimerComplete); closure.apply(null, args); } timer.addEventListener(TimerEvent.TIMER, onTimerComplete); timer.start(); } // 获取 time (毫秒)时刻对应的理论帧 public static function getFrameAtTime(time:int):int{ return _rootFrame + (time - getTimer()) / 1000 * FRAME_RATE; } ////////////////////////////////////////////////// // 服务器时间同步 // 设置服务器当前时间 // 可以多次调用, 维护 服务器-本机 的时间差, 之后可以根据本机时间, 估计当前的服务器时间 public static function set_server_timer(str:String, time_cost:int=0):void{ if (str == null || str.length == 0) return; // 2009-03-27 14:56:04 // if( isNaN(_localToServer) ) { var server:Date = parseTime(str); var local:Date = new Date(); _localToServer = server.time - local.time + time_cost / 2; } } // 获取服务服务器当前时间 public static function get server_timer():Date{ var d:Date = new Date; d.time += (isNaN(_localToServer)? 0: _localToServer); return d; } public static function get server_timer_str():String{ var d:Date = server_timer; var str:String = FormatUtil.printf_d("%4d-%2d-%2d %2d:%2d:%2d", d.fullYear, d.month+1, d.date, d.hours, d.minutes, d.seconds); return str; } // 返回相对的日期 public static function getYourDate(yourDay:int = 0, fullDate:Boolean = true, isChinese:Boolean = false):String { var d:Date = server_timer; var str:String = ""; var format:String = "%4d-%2d-%2d"; if (fullDate) { format = "%4d-%2d-%2d"; if (isChinese) format = "%4d年%2d月%2d日"; str = FormatUtil.printf_d(format, d.fullYear, d.month+1, (d.date - yourDay)); } else { format = "%2d-%2d"; if (isChinese) format = "%2d月%2d日"; str = FormatUtil.printf_d(format, d.month+1, (d.date + yourDay)); } return str; } // 解析服务器时间格式, 如果失败, 则返回默认的 0 值(1977年....) public static function parseTime(str:String):Date{ var obj:Object = TIME_RegExp.exec(str); if(!obj){ var d:Date = new Date; d.time = 0; return d; } d = new Date(obj[1], obj[2] - 1, obj[3], obj[4], obj[5], obj[6]); return d; } // 判断某个服务器时间是否到达, 返回超过的时间 public static function getTimerElapse(serverTime:String):Number{ var d1:Date = parseTime(serverTime); var d2:Date = server_timer; return d1.time - d2.time; } ////////////////////////////////////////////////// // 频率控制 /** * 判断上次调用该函数时, 与当前时间的间隔, 是否超过了 duration 指定的毫秒数 * @param key 将被长久保留引用, 因此 key 最好是静态/全局变量,否则不需要时应该调用removeDuration清除引用; * 如果key不存在,将创建此key,并立即返回flase * @param duration 时间间隔 * @param reset 是否记录此次调用时间 * @return 是否超时 * */ public static function checkDuration(key:Object, duration:int, reset:Boolean=true):Boolean{ var prev_time:int = _durationLib[key]; var now_time:int = rootTime; if(prev_time == 0){ _durationLib[key] = now_time; return true; } if(now_time - prev_time >= duration){ _durationLib[key] = now_time return true; } if(reset)_durationLib[key] = now_time; return false; } public static function removeDuration(key:*):void{ delete _durationLib[key]; } ////////////////////////////////////////////////// // 格式化显示 // 格式化: 秒 -> 时分 // sec=秒数, hunit=小时单位, munit=分钟单位 public static function fmt_sec_to_hm(sec:Number, hunit:String=null, munit:String=null):String{ sec += 59; var h:int = sec / 3600; sec %= 3600; var m:int = sec / 60; var str:String = ""; if(h>0) str += "" + h + (hunit || "小时"); if(m>0) str += "" + m + (munit || "分钟"); if(str == "") str = "0" + (munit || "分钟"); return str; } //格式化时间戳 时、分、秒的格式 public static function fmt_sec_to_hms_xiao(sec:Number, style:String=null):String{ var h:int = sec / 3600; sec %= 3600; var m:int = sec / 60; var s:int = sec % 60; var str:String = ""; if(h>0){ h>9?str += "" + h:str += "0" + h; }else{ str +="00"; } str +=(style || "小时"); if(m>0){ m>9?str += "" + m:str += "0" + m; }else{ str +="00"; } str +=(style || "分钟"); if(s>0){ s>9?str += "" + s:str += "0" + s; }else{ str +="00"; } style?null:str +="秒"; return str; } public static function getsimple_dhms(sec:Number, hunit:String=null, munit:String=null, sunit:String=null):String{ var d:int = sec / (3600 * 24); sec %= (3600 * 24); var h:int = sec / 3600; sec %= 3600; var m:int = sec / 60; var s:int = sec % 60; var str:String = ""; if(d>0) return (str = "" + d + (hunit || "天")); if(h>0) return (str = "" + h + (hunit || "小时")); if(m>0) return (str = "" + m + (munit || "分钟")); //if(s>0) return (str = "" + s + (munit || "秒")); return "" } public static function fmt_sec_to_hms(sec:Number, hunit:String=null, munit:String=null, sunit:String=null):String { var h:int = sec / 3600; sec %= 3600; var m:int = sec / 60; var s:int = sec % 60; var str:String = ""; if(h>0) str += "" + h + (hunit || "小时"); if(m>0) str += "" + m + (munit || "分钟"); if(s>0) str += "" + s + (munit || "秒"); if(str == "") str = "0秒"; return str; } public static function fmt_sec_to_dhms(sec:Number, hunit:String=null, munit:String=null, sunit:String=null):String { var d:int = sec / (3600 * 24); sec %= (3600 * 24); var h:int = sec / 3600; sec %= 3600; var m:int = sec / 60; var s:int = sec % 60; var str:String = ""; if(d>0) str += "" + d + (hunit || "天"); if(h>0) str += "" + h + (hunit || "小时"); if(m>0) str += "" + m + (munit || "分钟"); if(d <= 0){ if(s>0) str += "" + s + (munit || "秒"); if(str == "") str = "0秒"; } return str; } // 格式化显示 天/小时/分钟/秒 中的一种单位 public static function fmt_oneof_d_h_m_s(time:Number, def:String=null):String{ time /= 1000; // 毫秒 -> 秒 if(time >= 7*24*3600) return Math.floor( time/(7*24*3600) + 0.5) + "天"; // 超过1星期才显示为天 if(time >= 3600) return Math.floor( time/3600 + 0.5) + "小时"; if(time >= 60) return Math.floor( time/60 + 0.5) + "分钟"; if(time >= 1) return Math.floor(time/1 + 0.5) + "秒"; return def || "0"; } /** * 格式化日期(Y/M/D H:M) * @param date * @return * */ public static function getDateString(date:Object,isContainTime:Boolean=true, s1:String="/", s2:String=":"):String { if(date is Number){ var d:Date = new Date(); d.setTime(date); date = d; } var dYear:String = String(date.getFullYear()); var dMouth:String = ((date.getMonth() + 1 < 10) ? "0" : "") + (date.getMonth() + 1); var dDate:String = ((date.getDate() < 10) ? "0" : "") + date.getDate(); var ret:String = ""; ret += dYear + s1 + dMouth + s1 + dDate + " "; if(!isContainTime) return ret; ret += ((date.getHours() < 10) ? "0" : "") + date.getHours(); ret += s2 + ((date.getMinutes() < 10) ? "0" : "") + date.getMinutes(); // 想要获取秒的话,date.getSeconds() ,语句同小时、分 return ret; } // 比较两个日期大小 2009-4-29 BY ANDY public static function cmp_date(first:Date, second:Date) : Boolean { return (first.time > second.time) ? true : false; } // 获取当前时间 public static function getDate(secondAdd:int=0):Date{ var date:Date = new Date; date.time += (secondAdd * 1000); return date; } private static var _lastTestFrame:int; private static function printFrameSpeed(time:int):void{ trace("<---经过, 共播放帧数: ", _rootFrame-_lastTestFrame); _lastTestFrame = _rootFrame; } public static function testFrameSpeed():void{ addSecTick(printFrameSpeed, 1); } ////////////////////////////////////////////////// // private /** * @private * Updates All Ticks * * @param e ENTER_FRAME Event */ private static function updateAllTick(event:Event = null):void{ _rootFrame++; // 上一帧到这一帧所耗费的时间(毫秒) var pass:int = getTimer() - _passedTime; _passedTime = getTimer(); updateTickLib(pass); updateEntityLib(pass); } private static function updateAllTimer(event:Event=null):void { } public static function get rootTime():int{ return _passedTime; } private static function updateTimerLib(pass:int):void { var d:Dictionary = _timerLib, k:String; for(k in d){ if(_rootFrame%int(k) == 0 ){ for each(var f:Function in d[k]){ if(f != null)f(pass); } } } } private static function updateTickLib(pass:int):void{ var d:Dictionary = _tickLib, k:String; for(k in d){ if(_rootFrame%int(k) == 0 ){ for each(var f:Function in d[k]){ if(f != null)f(pass); } } } } private static function updateEntityLib(pass:int):void{ var d:Dictionary = _entityLib, f:*, e:Entity; for (f in d) { e = d[ f ]; if(e.delay >= 0){ e.delay -= pass; // 倒计时 if(e.delay <= 0){ e.invoke(); delete d[ f ]; } } } } } } class Entity{ public var delay:int; public var handle:Function; public var param:Array; public function Entity(delay:int, handle:Function, param:Array):void{ this.delay = delay; this.handle = handle; this.param = param; } public function invoke():void{ handle.apply(null, param); } }
package com.ankamagames.berilia.components.messages { import flash.display.InteractiveObject; public class SelectEmptyItemMessage extends ComponentMessage { private var _method:uint; public function SelectEmptyItemMessage(target:InteractiveObject, selectMethod:uint = 7) { super(target); this._method = selectMethod; } public function get selectMethod() : uint { return this._method; } } }
package com.ankamagames.dofus.network.messages.game.inventory.exchanges { import com.ankamagames.dofus.network.types.game.data.items.ObjectItemGenericQuantity; import com.ankamagames.jerakine.network.CustomDataWrapper; import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkMessage; import com.ankamagames.jerakine.network.NetworkMessage; import com.ankamagames.jerakine.network.utils.FuncTree; import flash.utils.ByteArray; public class ExchangeBidHouseUnsoldItemsMessage extends NetworkMessage implements INetworkMessage { public static const protocolId:uint = 5576; private var _isInitialized:Boolean = false; public var items:Vector.<ObjectItemGenericQuantity>; private var _itemstree:FuncTree; public function ExchangeBidHouseUnsoldItemsMessage() { this.items = new Vector.<ObjectItemGenericQuantity>(); super(); } override public function get isInitialized() : Boolean { return this._isInitialized; } override public function getMessageId() : uint { return 5576; } public function initExchangeBidHouseUnsoldItemsMessage(items:Vector.<ObjectItemGenericQuantity> = null) : ExchangeBidHouseUnsoldItemsMessage { this.items = items; this._isInitialized = true; return this; } override public function reset() : void { this.items = new Vector.<ObjectItemGenericQuantity>(); this._isInitialized = false; } override public function pack(output:ICustomDataOutput) : void { var data:ByteArray = new ByteArray(); this.serialize(new CustomDataWrapper(data)); writePacket(output,this.getMessageId(),data); } override public function unpack(input:ICustomDataInput, length:uint) : void { this.deserialize(input); } override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree { var tree:FuncTree = new FuncTree(); tree.setRoot(input); this.deserializeAsync(tree); return tree; } public function serialize(output:ICustomDataOutput) : void { this.serializeAs_ExchangeBidHouseUnsoldItemsMessage(output); } public function serializeAs_ExchangeBidHouseUnsoldItemsMessage(output:ICustomDataOutput) : void { output.writeShort(this.items.length); for(var _i1:uint = 0; _i1 < this.items.length; _i1++) { (this.items[_i1] as ObjectItemGenericQuantity).serializeAs_ObjectItemGenericQuantity(output); } } public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_ExchangeBidHouseUnsoldItemsMessage(input); } public function deserializeAs_ExchangeBidHouseUnsoldItemsMessage(input:ICustomDataInput) : void { var _item1:ObjectItemGenericQuantity = null; var _itemsLen:uint = input.readUnsignedShort(); for(var _i1:uint = 0; _i1 < _itemsLen; _i1++) { _item1 = new ObjectItemGenericQuantity(); _item1.deserialize(input); this.items.push(_item1); } } public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_ExchangeBidHouseUnsoldItemsMessage(tree); } public function deserializeAsyncAs_ExchangeBidHouseUnsoldItemsMessage(tree:FuncTree) : void { this._itemstree = tree.addChild(this._itemstreeFunc); } private function _itemstreeFunc(input:ICustomDataInput) : void { var length:uint = input.readUnsignedShort(); for(var i:uint = 0; i < length; i++) { this._itemstree.addChild(this._itemsFunc); } } private function _itemsFunc(input:ICustomDataInput) : void { var _item:ObjectItemGenericQuantity = new ObjectItemGenericQuantity(); _item.deserialize(input); this.items.push(_item); } } }
/* AS3 Copyright 2009 */ package com.neopets.projects.comicEngine.gui { import com.neopets.util.events.CustomEvent; import com.neopets.util.events.MultitonEventDispatcher; import flash.display.DisplayObject; import flash.display.FrameLabel; import flash.display.MovieClip; /** * This is for the MultiFrame Artwork with a Keyframe for each language Used * * @langversion ActionScript 3.0 * @playerversion Flash 9.0 * @Pattern StoryEngine * * @author Clive Henrick * @since 9.27.2009 */ public class StoryBookNavigationArtwork extends MovieClip { //-------------------------------------- // CLASS CONSTANTS //-------------------------------------- public static const TRANSLATE_ARTWORK:String = "TranslateThisArtwork"; //-------------------------------------- // PRIVATE VARIABLES //-------------------------------------- protected var mSingletonED:MultitonEventDispatcher; //-------------------------------------- // CONSTRUCTOR //-------------------------------------- /** * @Constructor */ public function StoryBookNavigationArtwork():void { mSingletonED = MultitonEventDispatcher.getInstance(StoryBookNavigation.KEY); mSingletonED.addEventListener(StoryBookNavigationArtwork.TRANSLATE_ARTWORK, changeArtworkEvent, false, 0 , true); } //-------------------------------------- // GETTER/SETTERS //-------------------------------------- //-------------------------------------- // PUBLIC METHODS //-------------------------------------- //-------------------------------------- // EVENT HANDLERS //-------------------------------------- /** * @Note: This listens for a translation Request * @Param evt.oData.lang String The Language to be Translated to * */ protected function changeArtworkEvent(evt:CustomEvent):void { var tCount:int = this.numChildren; var tLang:String = String(evt.oData.lang).toUpperCase(); var tLabelArray:Array = this.currentLabels; var tCount2:int = tLabelArray.length; for (var t:int = 0; t < tCount2; t++) { if (FrameLabel(tLabelArray[t]).name == tLang) { gotoAndStop(tLang); break; } } //mSingletonED.removeEventListener(TRANSLATE_ARTWORK, changeArtworkEvent); } //-------------------------------------- // PRIVATE & PROTECTED INSTANCE METHODS //-------------------------------------- } }
package kabam.rotmg.assets { import mx.core.BitmapAsset; [Embed(source="EmbeddedAssets_innerWorkingsChars8x8Embed.png")] public class EmbeddedAssets_innerWorkingsChars8x8Embed extends BitmapAsset { public function EmbeddedAssets_innerWorkingsChars8x8Embed() { super(); } } }
class CustomClass { var source = "from class definition"; function CustomClass() { trace("// this.source"); trace(this.source); } }
package { import flash.events.Event; import flash.geom.Matrix; import org.purepdf.colors.GrayColor; import org.purepdf.colors.RGBColor; import org.purepdf.pdf.PageSize; import org.purepdf.pdf.PdfContentByte; import org.purepdf.pdf.PdfDictionary; import org.purepdf.pdf.PdfGState; import org.purepdf.pdf.PdfName; import org.purepdf.pdf.PdfShading; import org.purepdf.pdf.PdfShadingPattern; import org.purepdf.pdf.PdfTemplate; import org.purepdf.pdf.PdfTransparencyGroup; import org.purepdf.pdf.PdfViewPreferences; import org.purepdf.utils.ShadingUtils; public class Kalligraphy extends DefaultBasicExample { public function Kalligraphy( d_list: Array = null ) { super( [ "Remember school notebook?" ] ); } override protected function execute( event: Event = null ): void { super.execute(); createDocument(); document.setViewerPreferences( PdfViewPreferences.PrintScalingNone ); document.open(); var cb: PdfContentByte = document.getDirectContent(); var lines: Vector.<Number> = Vector.<Number>( [ mm2pt( 7 ), mm2pt( 3 ), mm2pt( 7 ) ] ); var width: Number = PageSize.A4.width; var bottom: Number = mm2pt( 30 ); var y: Number = PageSize.A4.height - mm2pt( 21 ); cb.setRGBStrokeColor( 0xD0, 0xD0, 0xD0 ); cb.moveTo( 0, y ); cb.lineTo( width, y ); while ( y > bottom ) { for ( var i: int = 0; i < lines.length; i++ ) { y -= lines[i]; cb.moveTo( 0, y ); cb.lineTo( width, y ); } } cb.stroke(); cb.setRGBStrokeColor( 0xFF, 0x00, 0x00 ); cb.moveTo( mm2pt( 30 ), 0 ); cb.lineTo( mm2pt( 30 ), PageSize.A4.height ); cb.stroke(); var colors: Vector.<RGBColor> = Vector.<RGBColor>( [ RGBColor.BLACK, RGBColor.BLACK, RGBColor.BLACK, RGBColor.BLACK ] ); var ratios: Vector.<Number> = Vector.<Number>( [ 0, 0.2, 0.5, 1 ] ); var alphas: Vector.<Number> = Vector.<Number>( [ 1, 0.5, 0.2, 0 ] ); var matrix: Matrix; drawRectangleGradient( cb, 0, 0, 40, PageSize.A4.height, colors, ratios, alphas, matrix ); document.close(); save(); } public static function drawRectangleGradient( cb: PdfContentByte, x: Number, y: Number, width: Number, height: Number, colors: Vector.<RGBColor>, ratios: Vector.<Number>, alpha: Vector.<Number>, matrix: Matrix = null, extendStart: Boolean = true, extendEnd: Boolean = true ): void { var shading: PdfShading; var template: PdfTemplate; var gState: PdfGState; cb.rectangle( x, y, width, height ); template = cb.createTemplate( x + width, y + height ); var transGroup: PdfTransparencyGroup = new PdfTransparencyGroup(); transGroup.put( PdfName.CS, PdfName.DEVICERGB ); transGroup.isolated = true; transGroup.knockout = false; template.group = transGroup; gState = new PdfGState(); var maskDict: PdfDictionary = new PdfDictionary(); maskDict.put( PdfName.TYPE, PdfName.MASK ); maskDict.put( PdfName.S, new PdfName( "Luminosity" ) ); maskDict.put( new PdfName( "G" ), template.indirectReference ); gState.put( PdfName.SMASK, maskDict ); cb.setGState( gState ); var alphas: Vector.<GrayColor> = new Vector.<GrayColor>( alpha.length, true ); for ( var k: int = 0; k < alpha.length; ++k ) alphas[k] = new GrayColor( alpha[k] ); shading = PdfShading.complexAxial( cb.writer, 0, 0, width, 0, Vector.<RGBColor>( alphas ), ratios ); template.paintShading( shading ); shading = PdfShading.complexAxial( cb.writer, 0, 0, width, 0, colors, ratios ); var axialPattern: PdfShadingPattern = new PdfShadingPattern( shading ); if ( matrix ) { axialPattern.matrix = matrix; cb.setTransform( matrix ); } cb.setShadingFill( axialPattern ); cb.fill(); } public static function radians( degree: Number ): Number { return degree * ( Math.PI / 180 ); } private static function mm2pt( f: Number ): Number { return f * 72 / 25.4; } } }
//////////////////////////////////////////////////////////////////////////////// // // ADOBE SYSTEMS INCORPORATED // Copyright 2009 Adobe Systems Incorporated // All Rights Reserved. // // NOTICE: Adobe permits you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// package spark.components.supportClasses { import flash.display.DisplayObject; import flash.events.EventDispatcher; import mx.resources.ResourceManager; import spark.events.DisplayLayerObjectExistenceEvent; /** * A DisplayLayer class maintains an ordered list of DisplayObjects sorted on * depth. * You do not instantiate this class, but use the <code>overlay</code> * property of <code>Group</code> and <code>DataGroup</code>. * * @see spark.components.Group#overlay * @see spark.components.DataGroup#overlay * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public class DisplayLayer extends EventDispatcher { /** * Constructor. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function DisplayLayer() { super(); } //-------------------------------------------------------------------------- // // Variables // //-------------------------------------------------------------------------- private var _depth:Vector.<Number>; private var _objects:Vector.<DisplayObject>; //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- /** * Number of objects in the DisplayLayer. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function get numDisplayObjects():int { return _objects ? _objects.length : 0; } //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * Returns the DisplayObject with the specified index. * * @param index The index of the object. * * @return The object. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function getDisplayObjectAt(index:int):DisplayObject { if (!_objects || index < 0 || index >= _objects.length) throw new RangeError(ResourceManager.getInstance().getString("components", "indexOutOfRange", [index])); return _objects[index]; } /** * Returns the depth for the specified DisplayObject. * * @param displayObject The object. * * @return The depth of the object. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function getDisplayObjectDepth(displayObject:DisplayObject):Number { var index:int = _objects.indexOf(displayObject); if (index == -1) throw new RangeError(ResourceManager.getInstance().getString("components", "objectNotFoundInDisplayLayer", [displayObject])); return _depth[index]; } /** * Adds a <code>displayObject</code> with the specified depth to the ordered list. * The position of the <code>displayObject</code> in the sorted lists is based on * its depth. * The object is inserted after all objects with less than or equal * <code>depth</code> value. * * @param displayObject The object to add. * * @param depth The depth of the object. * * @return The index of the object. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function addDisplayObject(displayObject:DisplayObject, depth:Number = OverlayDepth.TOP):DisplayObject { // Find index to insert var index:int = 0; if (!_depth) { _depth = new Vector.<Number>; _objects = new Vector.<DisplayObject>; } else { // Simple linear search var count:int = _depth.length; for (; index < count; index++) if (depth < _depth[index]) break; } // Insert at index: _depth.splice(index, 0, depth); _objects.splice(index, 0, displayObject); // Notify that the object has been added dispatchEvent(new DisplayLayerObjectExistenceEvent(DisplayLayerObjectExistenceEvent.OBJECT_ADD, false /*bubbles*/, false /*cancelable*/, displayObject, index)); return displayObject; } /** * Removes the specified <code>displayObject</code> from the sorted list. * * @param displayObject The object. * * @return The removed object. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function removeDisplayObject(displayObject:DisplayObject):DisplayObject { var index:int = _objects.indexOf(displayObject); if (index == -1) throw new RangeError(ResourceManager.getInstance().getString("components", "objectNotFoundInDisplayLayer", [displayObject])); // Notify that the object is to be deleted dispatchEvent(new DisplayLayerObjectExistenceEvent(DisplayLayerObjectExistenceEvent.OBJECT_REMOVE, false /*bubbles*/, false /*cancelable*/, displayObject, index)); _depth.splice(index, 1); _objects.splice(index, 1); return displayObject; } } }
package widgets.Buscador.busqueda { import com.esri.ags.FeatureSet; import com.esri.ags.Graphic; import com.esri.ags.components.IdentityManager; import com.esri.ags.events.IdentityManagerEvent; import com.esri.ags.geometry.Extent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.layers.GraphicsLayer; import com.esri.ags.symbols.SimpleMarkerSymbol; import com.esri.ags.tasks.QueryTask; import com.esri.ags.tasks.supportClasses.Query; import flash.events.MouseEvent; import mx.collections.ArrayCollection; import mx.collections.ArrayList; import mx.controls.Alert; import mx.events.FlexEvent; import mx.rpc.AsyncResponder; import spark.components.CheckBox; import spark.components.RadioButton; import spark.components.TextInput; import spark.events.IndexChangeEvent; import spark.formatters.DateTimeFormatter; import comun.util.ZExportarTablaXLSUtil; import comun.util.zalerta.ZAlerta; import widgets.Interrupciones.global.Global; import widgets.Interrupciones.urls.Urls; public class BuscarInterrupcion { public var radioCliente:RadioButton; public var radioSED:RadioButton; public var textoBusqueda:TextInput; public var listaBusqueda:ArrayCollection; public var dateFormatter:DateTimeFormatter; public function BuscarInterrupcion(radioCliente:RadioButton,radioSED:RadioButton,textoBusqueda:TextInput, listaBusqueda:ArrayCollection,dateFormatter:DateTimeFormatter) { this.radioCliente = radioCliente; this.radioSED = radioSED; this.textoBusqueda = textoBusqueda; this.listaBusqueda = listaBusqueda; this.dateFormatter = dateFormatter; } public function buscar():void { if((radioCliente.selected == false && radioSED.selected == false) || textoBusqueda.text == "") { Alert.show("Atención:\nEl campo búsqueda no puede estar vacío y \ndebe seleccionar Cliente o SED."); } else { Global.capaSeleccionado.clear(); listaBusqueda.removeAll(); if(radioCliente.selected == true){ //BUSQUEDA DE CLIENTE SEGUN NIS.... var clienteTask:QueryTask = new QueryTask(); clienteTask.url = Urls.URL_INTERRUPCIONES_CLIENTES; clienteTask.useAMF = false; clienteTask.showBusyCursor = true; var cliente:Query = new Query(); cliente.outFields = ["*"]; cliente.returnGeometry = false; cliente.where = "nis = " + textoBusqueda.text; clienteTask.execute(cliente, new AsyncResponder(clienteResult, errorCliente)); //DIBUJAR CLIENTE SEGUN NIS.... var clientePuntoTask:QueryTask = new QueryTask(); clientePuntoTask.url = Urls.URL_CLIENTES_MAPA; clientePuntoTask.useAMF = false; var clientePunto:Query = new Query(); clientePunto.outFields = ["*"]; clientePunto.returnGeometry = true; clientePunto.where = "CLIENTES_DATA_DATOS_006.nis = " + textoBusqueda.text; clientePuntoTask.execute(clientePunto, new AsyncResponder(clientePuntoResult, clientePuntoFault)); function clientePuntoResult(clientePuntoSet:FeatureSet, token:Object = null):void { if (clientePuntoSet.features==null){ return; } if (clientePuntoSet.features.length==0){ return; } var extent:Extent=null; var puntoSelecc:Graphic = clientePuntoSet.features[0]; var colorClick:Number=0x0000ff; var colorSelecc:SimpleMarkerSymbol = new SimpleMarkerSymbol("circle", 15, colorClick); puntoSelecc = new Graphic(puntoSelecc.geometry, colorSelecc); puntoSelecc.addEventListener(MouseEvent.MOUSE_OVER,mouseOverNIS); puntoSelecc.addEventListener(MouseEvent.MOUSE_OUT,eliminarMensaje); var mapPoint:MapPoint=puntoSelecc.geometry as MapPoint; Global.map.centerAt(mapPoint); Global.capaSeleccionado.add(puntoSelecc); Global.log("fin puntos"); Global.map.extent=extent; } function clientePuntoFault(info:Object, token:Object = null):void { Alert.show("No se pudo cargar Cliente en el Mapa:\n"+ info.toString()); } } else { //BUSQUEDA DE SED SEGUN SED.... var sedTask:QueryTask = new QueryTask(); sedTask.url = Urls.URL_INTERRUPCIONES_SED; sedTask.useAMF = false; sedTask.showBusyCursor = true; var sed:Query = new Query(); sed.outFields = ["*"]; sed.returnGeometry = false; sed.where = "sed = " + textoBusqueda.text; sedTask.execute(sed, new AsyncResponder(sedResult, errorSed)); //DIBUJAR SED SEGUN SED.... var sedPuntoTask:QueryTask = new QueryTask(); sedPuntoTask.url = Urls.URL_SED; sedPuntoTask.useAMF = false; var sedPunto:Query = new Query(); sedPunto.outFields = ["SHAPE"]; sedPunto.returnGeometry = false; sedPunto.where = "codigo = " + textoBusqueda.text; sedPuntoTask.execute(sedPunto, new AsyncResponder(sedPuntoResult, sedPuntoFault)); function sedPuntoResult(sedPuntoSet:FeatureSet, token:Object = null):void { var extent:Extent=null; var puntoSelecc:Graphic = sedPuntoSet.features[0]; if (puntoSelecc==null){ return; } var colorClick:Number=0x0000ff; var colorSelecc:SimpleMarkerSymbol = new SimpleMarkerSymbol("triangle", 20, colorClick); puntoSelecc = new Graphic(puntoSelecc.geometry, colorSelecc); puntoSelecc.addEventListener(MouseEvent.MOUSE_OVER,mouseOverSED); puntoSelecc.addEventListener(MouseEvent.MOUSE_OUT,eliminarMensaje); var mapPoint:MapPoint=puntoSelecc.geometry as MapPoint; Global.map.centerAt(mapPoint); Global.capaSeleccionado.add(puntoSelecc); Global.log("fin puntos"); Global.map.extent=extent; } function sedPuntoFault(info:Object, token:Object = null):void { Alert.show("No se pudo cargar SED en el Mapa:\n"+ info.toString()); } } } } public function mouseOverNIS(e:MouseEvent):void { Global.map.infoWindow.label= "NIS:" + textoBusqueda.text; Global.map.infoWindow.closeButtonVisible = false; Global.map.infoWindow.show(Global.map.toMapFromStage(e.stageX, e.stageY)); } public function mouseOverSED(e:MouseEvent):void { Global.map.infoWindow.label= "SED:" + textoBusqueda.text; Global.map.infoWindow.closeButtonVisible = false; Global.map.infoWindow.show(Global.map.toMapFromStage(e.stageX +10, e.stageY)); } private function clienteResult(busquedaSet:FeatureSet, token:Object = null):void // NIS { trace("busquedaSet.features.length " + busquedaSet.features.length); for (var i:Number=0; i < busquedaSet.features.length; i++){ busquedaSet.features[i].attributes["fecha_inicio"] = dateFormatter.format(new Date(busquedaSet.features[i].attributes["fecha_inicio"])); busquedaSet.features[i].attributes["fecha_fin"] = dateFormatter.format(new Date(busquedaSet.features[i].attributes["fecha_fin"])); busquedaSet.features[i].attributes["duracion"] = convertToHHMMSS(busquedaSet.features[i].attributes["duracion"]); busquedaSet.features[i].attributes["anio"] = busquedaSet.features[i].attributes["fecha_inicio"].substr(6,4) as String; listaBusqueda.addItem(busquedaSet.features[i].attributes); } realizarConsultaColumnaTipo(); } private function errorCliente(info:Object, token:Object = null):void { Alert.show("No se encontraron resultados","errorCliente"); } private function sedResult(busquedaSet:FeatureSet, token:Object = null):void // SEED { trace("busquedaSet.features.length " + busquedaSet.features.length); for (var i:Number=0; i < busquedaSet.features.length; i++){ busquedaSet.features[i].attributes["fecha_inicio"] = dateFormatter.format(new Date(busquedaSet.features[i].attributes["fecha_inicio"])); busquedaSet.features[i].attributes["fecha_fin"] = dateFormatter.format(new Date(busquedaSet.features[i].attributes["fecha_fin"])); busquedaSet.features[i].attributes["duracion"] = convertToHHMMSS(busquedaSet.features[i].attributes["duracion"]); busquedaSet.features[i].attributes["anio"] = busquedaSet.features[i].attributes["fecha_inicio"].substr(6,4) as String; listaBusqueda.addItem(busquedaSet.features[i].attributes); } realizarConsultaColumnaTipo(); } private function realizarConsultaColumnaTipo():void { if(listaBusqueda.length == 0) { Alert.show("No se encontraron resultados"); return; } var idsInterrupcion:String = "("; for each(var objeto:Object in listaBusqueda) { idsInterrupcion += objeto["id_interrupcion"] +","; } idsInterrupcion = idsInterrupcion.substr(0,idsInterrupcion.length -1); idsInterrupcion += ")"; var clienteTask:QueryTask = new QueryTask(); clienteTask.url = Urls.URL_INTERRUPCIONES_TIPO; clienteTask.useAMF = false; clienteTask.showBusyCursor = true; var cliente:Query = new Query(); cliente.outFields = ["interrupcion_id,vl_trafo_interrumpidos"]; cliente.returnGeometry = false; cliente.where = "interrupcion_id in " + idsInterrupcion+""; clienteTask.execute(cliente, new AsyncResponder(traerConsultaTipoExito, errorTipoInterrupcion)); } public function traerConsultaTipoExito(set:FeatureSet, token:Object = null):void { var elementos:ArrayCollection = listaBusqueda; for each(var objeto:Object in elementos) { var idInterrupcion:String = objeto["id_interrupcion"]+""; for each(var objeto2:Object in set.attributes) { if(objeto2["interrupcion_id"] == idInterrupcion) { var cantidad:Number = new Number(objeto2["vl_trafo_interrumpidos"]); objeto["tipoFalla"] = cantidad > 1 ? "Transformador" : cantidad == 1 ? "Cliente" : "-"; } } } } public function eliminarMensaje(e:MouseEvent):void { Global.map.infoWindow.hide(); } private function errorSed(info:Object, token:Object = null):void { Alert.show("No se encontraron resultados","errorSed"); } private function errorTipoInterrupcion(info:Object, token:Object = null):void { Alert.show("No se pudo cargar tipo interrupción:\n"+ info.toString()); } private function convertToHHMMSS($seconds:Number):String { var s:Number = $seconds % 60; var m:Number = Math.floor(($seconds % 3600 ) / 60); var h:Number = Math.floor($seconds / (60 * 60)); var hourStr:String = (h == 0) ? "" : h + " hr "; var minuteStr:String = m + " min "; return hourStr + minuteStr } } }
/* Copyright 2018 Tua Rua Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.tuarua { import com.tuarua.fre.ANEError; import com.tuarua.spotlight.IndexError; import flash.events.StatusEvent; import flash.external.ExtensionContext; import flash.utils.Dictionary; /** @private */ public class SpotlightANEContext { internal static const NAME:String = "SpotlightANE"; internal static const TRACE:String = "TRACE"; private static var _context:ExtensionContext; private static var argsAsJSON:Object; public static var callbacks:Dictionary = new Dictionary(); private static const INDEX:String = "SpotlightEvent.Index"; private static const DELETE:String = "SpotlightEvent.Delete"; private static const DELETE_ALL:String = "SpotlightEvent.DeleteAll"; private static const QUERY_COMPLETE:String = "SpotlightEvent.QueryComplete"; public function SpotlightANEContext() { } public static function get context():ExtensionContext { if (_context == null) { try { _context = ExtensionContext.createExtensionContext("com.tuarua." + NAME, null); if (_context != null) { _context.addEventListener(StatusEvent.STATUS, gotEvent); } } catch (e:Error) { trace(e.getStackTrace()); trace("[" + NAME + "] ANE not loaded properly. Future calls will fail."); } } return _context; } public static function createCallback(listener:Function):String { var id:String; if (listener != null) { id = context.call("createGUID") as String; callbacks[id] = listener; } return id; } private static function gotEvent(event:StatusEvent):void { var err:IndexError; var callback:Function; switch (event.level) { case TRACE: trace("[" + NAME + "]", event.code); break; case INDEX: case DELETE: case DELETE_ALL: try { argsAsJSON = JSON.parse(event.code); callback = callbacks[argsAsJSON.callbackId]; if (callback == null) return; if (argsAsJSON.hasOwnProperty("error") && argsAsJSON.error) { err = new IndexError(argsAsJSON.error.text, argsAsJSON.error.id); } callback.call(null, err); delete callbacks[argsAsJSON.callbackId]; } catch (e:Error) { trace("parsing error", event.code, e.message); } break; case QUERY_COMPLETE: try { argsAsJSON = JSON.parse(event.code); callback = callbacks[argsAsJSON.callbackId]; if (callback == null) return; if (argsAsJSON.hasOwnProperty("error") && argsAsJSON.error) { err = new IndexError(argsAsJSON.error.text, argsAsJSON.error.id); callback.call(null, null, err); } else { var results:* = SpotlightANEContext.context.call("getQueryResults", argsAsJSON.id); if (results is ANEError) throwError(results as ANEError); callback.call(null, results, err); } delete callbacks[argsAsJSON.callbackId]; } catch (e:Error) { trace("parsing error", event.code, e.message); } break; } } public static function dispose():void { if (!_context) return; trace("[" + NAME + "] Unloading ANE..."); _context.removeEventListener(StatusEvent.STATUS, gotEvent); _context.dispose(); _context = null; } private static function throwError(error:ANEError):void { throw error; } } }
package cmodule.lua_wrapper { const __2E_str18225:int = gstaticInitter.alloc(25,1); }
package ninja.executer { import def.PluginDef; public class NinjaProtoTool { private static var toolInstance:ninja.executer.NinjaProtoExecuter; public function NinjaProtoTool() { super(); } public static function get tool() : ninja.executer.NinjaProtoExecuter { if(!toolInstance) { toolInstance = new ninja.executer.NinjaProtoExecuter(PluginDef.NINJA); } return toolInstance; } } }
package com.playfab.ProfilesModels { import com.playfab.PlayFabUtil; public class EntityProfileBody { public var AvatarUrl:String; public var Created:Date; public var DisplayName:String; public var Entity:EntityKey; public var EntityChain:String; public var ExperimentVariants:Vector.<String>; public var Files:Object; public var Language:String; public var LeaderboardMetadata:String; public var Lineage:EntityLineage; public var Objects:Object; public var Permissions:Vector.<EntityPermissionStatement>; public var Statistics:Object; public var VersionNumber:int; public function EntityProfileBody(data:Object=null) { if(data == null) return; AvatarUrl = data.AvatarUrl; Created = PlayFabUtil.parseDate(data.Created); DisplayName = data.DisplayName; Entity = new EntityKey(data.Entity); EntityChain = data.EntityChain; ExperimentVariants = data.ExperimentVariants ? Vector.<String>(data.ExperimentVariants) : null; if(data.Files) { Files = {}; for(var Files_iter:String in data.Files) { Files[Files_iter] = new EntityProfileFileMetadata(data.Files[Files_iter]); }} Language = data.Language; LeaderboardMetadata = data.LeaderboardMetadata; Lineage = new EntityLineage(data.Lineage); if(data.Objects) { Objects = {}; for(var Objects_iter:String in data.Objects) { Objects[Objects_iter] = new EntityDataObject(data.Objects[Objects_iter]); }} if(data.Permissions) { Permissions = new Vector.<EntityPermissionStatement>(); for(var Permissions_iter:int = 0; Permissions_iter < data.Permissions.length; Permissions_iter++) { Permissions[Permissions_iter] = new EntityPermissionStatement(data.Permissions[Permissions_iter]); }} if(data.Statistics) { Statistics = {}; for(var Statistics_iter:String in data.Statistics) { Statistics[Statistics_iter] = new EntityStatisticValue(data.Statistics[Statistics_iter]); }} VersionNumber = data.VersionNumber; } } }
package nest.control.event { import flash.events.Event; /** * MatrixEvent */ public class MatrixEvent extends Event { public static const TRANSFORM_CHANGE:String = "transform_change"; public function MatrixEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) { super(type, bubbles, cancelable); } override public function clone():Event { var copy:MatrixEvent = new MatrixEvent(type, bubbles, cancelable); return copy; } } }
package com.google.zxing.qrcode.encoder { // todo : check array datastructures public class MaskUtil { import com.google.zxing.common.ByteMatrix; import com.google.zxing.common.flexdatatypes.IllegalArgumentException; // Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and // give penalty to them. Example: 00000 or 11111. public static function applyMaskPenaltyRule1(matrix:ByteMatrix):int { return applyMaskPenaltyRule1Internal(matrix, true) + applyMaskPenaltyRule1Internal(matrix, false); } // Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give // penalty to them. public static function applyMaskPenaltyRule2(matrix:ByteMatrix):int { var penalty:int = 0; var array:Array = matrix.getArray(); //sbyte[][] var width:int = matrix.width(); var height:int = matrix.height(); for (var y:int = 0; y < height - 1; ++y) { for (var x:int = 0; x < width - 1; ++x) { var value:int = array[y][x]; if (value == array[y][x + 1] && value == array[y + 1][x] && value == array[y + 1][x + 1]) { penalty += 3; } } } return penalty; } // Apply mask penalty rule 3 and return the penalty. Find consecutive cells of 00001011101 or // 10111010000, and give penalty to them. If we find patterns like 000010111010000, we give // penalties twice (i.e. 40 * 2). public static function applyMaskPenaltyRule3(matrix:ByteMatrix):int { var penalty:int = 0; var array:Array = matrix.getArray(); var width:int = matrix.width(); var height:int = matrix.height(); for (var y:int = 0; y < height; ++y) { for (var x:int = 0; x < width; ++x) { // Tried to simplify following conditions but failed. if (x + 6 < width && array[y][x] == 1 && array[y][x + 1] == 0 && array[y][x + 2] == 1 && array[y][x + 3] == 1 && array[y][x + 4] == 1 && array[y][x + 5] == 0 && array[y][x + 6] == 1 && ((x + 10 < width && array[y][x + 7] == 0 && array[y][x + 8] == 0 && array[y][x + 9] == 0 && array[y][x + 10] == 0) || (x - 4 >= 0 && array[y][x - 1] == 0 && array[y][x - 2] == 0 && array[y][x - 3] == 0 && array[y][x - 4] == 0))) { penalty += 40; } if (y + 6 < height && array[y][x] == 1 && array[y + 1][x] == 0 && array[y + 2][x] == 1 && array[y + 3][x] == 1 && array[y + 4][x] == 1 && array[y + 5][x] == 0 && array[y + 6][x] == 1 && ((y + 10 < height && array[y + 7][x] == 0 && array[y + 8][x] == 0 && array[y + 9][x] == 0 && array[y + 10][x] == 0) || (y - 4 >= 0 && array[y - 1][x] == 0 && array[y - 2][x] == 0 && array[y - 3][x] == 0 && array[y - 4][x] == 0))) { penalty += 40; } } } return penalty; } // Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give // penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance. Examples: // - 0% => 100 // - 40% => 20 // - 45% => 10 // - 50% => 0 // - 55% => 10 // - 55% => 20 // - 100% => 100 public static function applyMaskPenaltyRule4(matrix:ByteMatrix):int { var numDarkCells:int = 0; var array:Array = matrix.getArray(); var width:int = matrix.width(); var height:int = matrix.height(); for (var y:int = 0; y < height; ++y) { for (var x:int = 0; x < width; ++x) { if (array[y][x] == 1) { numDarkCells += 1; } } } var numTotalCells:int = matrix.height() * matrix.width(); var darkRatio:Number = numDarkCells / numTotalCells; return int(Math.abs(int(darkRatio * 100 - 50)) / 5) * 10; } // Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask // pattern conditions. public static function getDataMaskBit(maskPattern:int,x:int,y:int):int { if (!QRCode.isValidMaskPattern(maskPattern)) { throw new IllegalArgumentException("Invalid mask pattern"); } switch (maskPattern) { case 0: return ((y + x) % 2 == 0) ? 1 : 0; case 1: return (y % 2 == 0) ? 1 : 0; case 2: return (x % 3 == 0) ? 1 : 0; case 3: return ((y + x) % 3 == 0) ? 1 : 0; case 4: return ((int(y / 2) + int(x / 3)) % 2 == 0) ? 1 : 0; // bas : fixed here case 5: return (((y * x) % 2) + ((y * x) % 3) == 0) ? 1 : 0; case 6: return ((((y * x) % 2) + ((y * x) % 3)) % 2 == 0) ? 1 : 0; case 7: return ((((y * x) % 3) + ((y + x) % 2)) % 2 == 0) ? 1 : 0; } throw new IllegalArgumentException("invalid mask pattern: " + maskPattern); } // Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both // vertical and horizontal orders respectively. private static function applyMaskPenaltyRule1Internal(matrix:ByteMatrix,isHorizontal:Boolean):int { var penalty:int = 0; var numSameBitCells:int = 0; var prevBit:int = -1; // Horizontal mode: // for (int i = 0; i < matrix.height(); ++i) { // for (int j = 0; j < matrix.width(); ++j) { // int bit = matrix._get(i, j); // Vertical mode: // for (int i = 0; i < matrix.width(); ++i) { // for (int j = 0; j < matrix.height(); ++j) { // int bit = matrix._get(j, i); var iLimit:int = isHorizontal ? matrix.height() : matrix.width(); var jLimit:int = isHorizontal ? matrix.width() : matrix.height(); var array:Array = matrix.getArray(); // sbyte[][] for (var i:int = 0; i < iLimit; ++i) { for (var j:int = 0; j < jLimit; ++j) { var bit:int = isHorizontal ? array[i][j] : array[j][i]; if (bit == prevBit) { numSameBitCells += 1; // Found five repetitive cells with the same color (bit). // We'll give penalty of 3. if (numSameBitCells == 5) { penalty += 3; } else if (numSameBitCells > 5) { // After five repetitive cells, we'll add the penalty one // by one. penalty += 1; } } else { numSameBitCells = 1; // Include the cell itself. prevBit = bit; } } numSameBitCells = 0; // Clear at each row/column. } return penalty; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.charts.beads.layouts { import org.apache.royale.charts.core.ICartesianChartLayout; import org.apache.royale.charts.core.IChartItemRenderer; import org.apache.royale.charts.core.IChartSeries; import org.apache.royale.charts.supportClasses.ILineSegmentItemRenderer; import org.apache.royale.charts.supportClasses.LineSeries; import org.apache.royale.core.IBeadLayout; import org.apache.royale.core.ISelectionModel; import org.apache.royale.core.ILayoutHost; import org.apache.royale.core.IParentIUIBase; import org.apache.royale.core.UIBase; import org.apache.royale.events.Event; import org.apache.royale.events.IEventDispatcher; /** * The LineChartLinearVsLinearLayout displays a line graph of plot points * where both axes are numeric values. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 */ public class LineChartLinearVsLinearLayout extends ChartBaseLayout implements IBeadLayout, ICartesianChartLayout { public function LineChartLinearVsLinearLayout() { } /** * @private */ override public function layout():Boolean { var selectionModel:ISelectionModel = strand.getBeadByType(ISelectionModel) as ISelectionModel; var dp:Array = selectionModel.dataProvider as Array; if (!dp) return false; var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost; var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase; var n:int = dp.length; var xpos:Number = 0; var ypos:Number = 0; var useWidth:Number = contentView.width; var useHeight:Number = contentView.height; var itemWidth:Number = useWidth/dp.length; var maxXValue:Number = 0; var minXValue:Number = 0; var maxYValue:Number = 0; var minYValue:Number = 0; var scaleXFactor:Number = 1; var scaleYFactor:Number = 1; var determineYScale:Boolean = true; var determineXScale:Boolean = true; if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.maximum)) { maxXValue = horizontalAxisBead.maximum; determineXScale = false; } if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.minimum)) { minXValue = horizontalAxisBead.minimum; } if (verticalAxisBead != null && !isNaN(verticalAxisBead.maximum)) { maxYValue = verticalAxisBead.maximum; determineYScale = false; } if (verticalAxisBead != null && !isNaN(verticalAxisBead.minimum)) { minYValue = verticalAxisBead.minimum; } var seriesPoints:Array = []; for (var s:int = 0; s < chart.series.length; s++) { var aseries:IChartSeries = chart.series[s] as IChartSeries; seriesPoints.push({points:[]}); for (var i:int = 0; i < n; i++) { var data:Object = dp[i]; var xfield:String = aseries.xField; var yfield:String = aseries.yField; var xValue:Number = Number(data[xfield]); if (determineXScale) maxXValue = Math.max(maxXValue, xValue); var yValue:Number = Number(data[yfield]); if (determineYScale) maxYValue = Math.max(maxYValue, yValue); } } scaleXFactor = useWidth / (maxXValue - minXValue); scaleYFactor = useHeight / (maxYValue - minYValue); // draw the itemRenderers at each vertex and build the points array for the // line segment. for (s=0; s < chart.series.length; s++) { aseries = chart.series[s] as IChartSeries; for (i=0; i < n; i++) { data = dp[i]; xValue = Number(data[aseries.xField]) - minXValue; yValue = Number(data[aseries.yField]) - minYValue; var childX:Number = (xValue*scaleXFactor); var childY:Number = useHeight - (yValue*scaleYFactor); seriesPoints[s].points.push( {x:childX, y:childY} ); var child:IChartItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(aseries,i); if (child) { child.x = childX - 5; child.y = childY - 5; child.width = 10; child.height = 10; COMPILE::JS { child.element.style.position = "absolute"; } } } } // draw the line segment for (s=0; s < chart.series.length; s++) { var lcs:LineSeries = chart.series[s] as LineSeries; if (lcs.lineSegmentRenderer) { var renderer:ILineSegmentItemRenderer = lcs.lineSegmentRenderer.newInstance() as ILineSegmentItemRenderer; chartDataGroup.addItemRenderer(renderer, true); renderer.itemRendererParent = chartDataGroup; renderer.data = lcs; renderer.points = seriesPoints[s].points; } } return true; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package spark.effects.easing { /** * The Sine class defines easing functionality using a Sine function. * Easing consists of two phases: the acceleration, or ease in phase, * followed by the deceleration, or ease out phase. * Use the <code>easeInFraction</code> property to specify * the percentage of an animation accelerating. * * @mxml * * <p>The <code>&lt;s:Sine&gt;</code> tag * inherits all of the tag attributes of its of its superclass, * and adds the following tag attributes:</p> * * <pre> * &lt;s:Sine * id="ID" * /&gt; * </pre> * * @includeExample examples/SinePowerEffectExample.mxml * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public class Sine extends EaseInOutBase { /** * Constructor. * * @param easeInFraction Sets the value of * the <code>easeInFraction</code> property. The default value is * <code>EasingFraction.IN_OUT</code>, which eases in for the first half * of the time and eases out for the remainder. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function Sine(easeInFraction:Number = 0.5) { super(easeInFraction); } /** * @private * Returns a value that represents the eased fraction during the * ease in phase of the animation. * The easing calculation for Sine is equal to * <code>1 - cos(fraction*PI/2)</code>. * * @param fraction The fraction elapsed of the easing in phase * of the animation, between 0.0 and 1.0. * * @return A value that represents the eased value for this * phase of the animation. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ override protected function easeIn(fraction:Number):Number { return 1 - Math.cos(fraction * Math.PI/2); } /** * @private * Returns a value that represents the eased fraction during the * ease out phase of the animation. * The easing calculation for Sine is equal to * <code>sin(fraction*PI/2)</code>. * * @param fraction The fraction elapsed of the easing out phase * of the animation, between 0.0 and 1.0. * * @return A value that represents the eased value for this * phase of the animation. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ override protected function easeOut(fraction:Number):Number { return Math.sin(fraction * Math.PI/2); } } }
package visuals.ui.dialogs { import com.playata.framework.display.Sprite; import com.playata.framework.display.lib.flash.FlashDisplayObjectContainer; import com.playata.framework.display.lib.flash.FlashLabel; import com.playata.framework.display.lib.flash.FlashLabelArea; import com.playata.framework.display.lib.flash.FlashSprite; import com.playata.framework.display.ui.controls.ILabel; import com.playata.framework.display.ui.controls.ILabelArea; import flash.display.MovieClip; import visuals.ui.base.SymbolIconButtonCharacterGeneric; import visuals.ui.base.SymbolUiButtonDefaultGeneric; import visuals.ui.elements.backgrounds.SymbolSlice9BackgroundDialogGeneric; import visuals.ui.elements.backgrounds.SymbolSlice9BackgroundDialogSeperatorGeneric; import visuals.ui.elements.buttons.SymbolButtonArrowDownGeneric; import visuals.ui.elements.buttons.SymbolButtonArrowUpGeneric; import visuals.ui.elements.buttons.SymbolButtonCloseGeneric; import visuals.ui.elements.buttons.SymbolButtonGoalFilterGeneric; import visuals.ui.elements.buttons.SymbolButtonHelpGeneric; import visuals.ui.elements.buttons.SymbolButtonOptionsGeneric; import visuals.ui.elements.buttons.SymbolButtonTabGeneric; import visuals.ui.elements.user_story.SymbolActiveUserStoryLineGeneric; import visuals.ui.elements.user_story.SymbolUserStoryFilterGeneric; import visuals.ui.elements.user_story.SymbolUserStoryHallOfFameListContentGeneric; import visuals.ui.elements.user_story.SymbolUserStoryVotingListContentGeneric; public class SymbolDialogUserStoryGeneric extends Sprite { private var _nativeObject:SymbolDialogUserStory = null; public var background:SymbolSlice9BackgroundDialogGeneric = null; public var backgroundSeperator:SymbolSlice9BackgroundDialogSeperatorGeneric = null; public var votingContent:SymbolUserStoryVotingListContentGeneric = null; public var hallOfFameContent:SymbolUserStoryHallOfFameListContentGeneric = null; public var btnRead:SymbolUiButtonDefaultGeneric = null; public var btnViewCharacter:SymbolIconButtonCharacterGeneric = null; public var textTitle:ILabel = null; public var txtUserStoryInfo:ILabelArea = null; public var txtWriteInfo:ILabelArea = null; public var editLine:SymbolActiveUserStoryLineGeneric = null; public var btnWrite:SymbolUiButtonDefaultGeneric = null; public var btnTabVoting:SymbolButtonTabGeneric = null; public var btnTabHallOfFame:SymbolButtonTabGeneric = null; public var btnScrollUp:SymbolButtonArrowUpGeneric = null; public var btnScrollDown:SymbolButtonArrowDownGeneric = null; public var btnSettings:SymbolButtonOptionsGeneric = null; public var btnHelp:SymbolButtonHelpGeneric = null; public var btnFilter:SymbolButtonGoalFilterGeneric = null; public var filter:SymbolUserStoryFilterGeneric = null; public var btnClose:SymbolButtonCloseGeneric = null; public function SymbolDialogUserStoryGeneric(param1:MovieClip = null) { if(param1) { _nativeObject = param1 as SymbolDialogUserStory; } else { _nativeObject = new SymbolDialogUserStory(); } super(null,FlashSprite.fromNative(_nativeObject)); var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer; background = new SymbolSlice9BackgroundDialogGeneric(_nativeObject.background); backgroundSeperator = new SymbolSlice9BackgroundDialogSeperatorGeneric(_nativeObject.backgroundSeperator); votingContent = new SymbolUserStoryVotingListContentGeneric(_nativeObject.votingContent); hallOfFameContent = new SymbolUserStoryHallOfFameListContentGeneric(_nativeObject.hallOfFameContent); btnRead = new SymbolUiButtonDefaultGeneric(_nativeObject.btnRead); btnViewCharacter = new SymbolIconButtonCharacterGeneric(_nativeObject.btnViewCharacter); textTitle = FlashLabel.fromNative(_nativeObject.textTitle); txtUserStoryInfo = FlashLabelArea.fromNative(_nativeObject.txtUserStoryInfo); txtWriteInfo = FlashLabelArea.fromNative(_nativeObject.txtWriteInfo); editLine = new SymbolActiveUserStoryLineGeneric(_nativeObject.editLine); btnWrite = new SymbolUiButtonDefaultGeneric(_nativeObject.btnWrite); btnTabVoting = new SymbolButtonTabGeneric(_nativeObject.btnTabVoting); btnTabHallOfFame = new SymbolButtonTabGeneric(_nativeObject.btnTabHallOfFame); btnScrollUp = new SymbolButtonArrowUpGeneric(_nativeObject.btnScrollUp); btnScrollDown = new SymbolButtonArrowDownGeneric(_nativeObject.btnScrollDown); btnSettings = new SymbolButtonOptionsGeneric(_nativeObject.btnSettings); btnHelp = new SymbolButtonHelpGeneric(_nativeObject.btnHelp); btnFilter = new SymbolButtonGoalFilterGeneric(_nativeObject.btnFilter); filter = new SymbolUserStoryFilterGeneric(_nativeObject.filter); btnClose = new SymbolButtonCloseGeneric(_nativeObject.btnClose); } public function setNativeInstance(param1:SymbolDialogUserStory) : void { FlashSprite.setNativeInstance(_sprite,param1); _nativeObject = param1; syncInstances(); } public function syncInstances() : void { if(_nativeObject.background) { background.setNativeInstance(_nativeObject.background); } if(_nativeObject.backgroundSeperator) { backgroundSeperator.setNativeInstance(_nativeObject.backgroundSeperator); } if(_nativeObject.votingContent) { votingContent.setNativeInstance(_nativeObject.votingContent); } if(_nativeObject.hallOfFameContent) { hallOfFameContent.setNativeInstance(_nativeObject.hallOfFameContent); } if(_nativeObject.btnRead) { btnRead.setNativeInstance(_nativeObject.btnRead); } if(_nativeObject.btnViewCharacter) { btnViewCharacter.setNativeInstance(_nativeObject.btnViewCharacter); } FlashLabel.setNativeInstance(textTitle,_nativeObject.textTitle); FlashLabelArea.setNativeInstance(txtUserStoryInfo,_nativeObject.txtUserStoryInfo); FlashLabelArea.setNativeInstance(txtWriteInfo,_nativeObject.txtWriteInfo); if(_nativeObject.editLine) { editLine.setNativeInstance(_nativeObject.editLine); } if(_nativeObject.btnWrite) { btnWrite.setNativeInstance(_nativeObject.btnWrite); } if(_nativeObject.btnTabVoting) { btnTabVoting.setNativeInstance(_nativeObject.btnTabVoting); } if(_nativeObject.btnTabHallOfFame) { btnTabHallOfFame.setNativeInstance(_nativeObject.btnTabHallOfFame); } if(_nativeObject.btnScrollUp) { btnScrollUp.setNativeInstance(_nativeObject.btnScrollUp); } if(_nativeObject.btnScrollDown) { btnScrollDown.setNativeInstance(_nativeObject.btnScrollDown); } if(_nativeObject.btnSettings) { btnSettings.setNativeInstance(_nativeObject.btnSettings); } if(_nativeObject.btnHelp) { btnHelp.setNativeInstance(_nativeObject.btnHelp); } if(_nativeObject.btnFilter) { btnFilter.setNativeInstance(_nativeObject.btnFilter); } if(_nativeObject.filter) { filter.setNativeInstance(_nativeObject.filter); } if(_nativeObject.btnClose) { btnClose.setNativeInstance(_nativeObject.btnClose); } } } }
package cmodule.lua_wrapper { const __2E_str1778132:int = gstaticInitter.alloc(12,1); }
package kabam.rotmg.assets.EmbeddedAssets { import mx.core.*; [Embed(source="spritesheets/EmbeddedAssets_d1Chars16x16rEmbed_.png")] public class EmbeddedAssets_d1Chars16x16rEmbed_ extends BitmapAsset { public function EmbeddedAssets_d1Chars16x16rEmbed_() { super(); return; } } }
package laya.debug.tools { import laya.debug.DebugTool; import laya.debug.view.nodeInfo.DebugInfoLayer; import laya.debug.view.nodeInfo.NodeUtils; import laya.display.Graphics; import laya.display.Sprite; import laya.maths.Rectangle; import laya.utils.Browser; import laya.debug.uicomps.ContextMenuItem; import laya.utils.Handler; /** * ... * @author ww */ public class ClickSelectTool { private static var _I:ClickSelectTool; public static function get I():ClickSelectTool { if (!_I) _I = new ClickSelectTool(); return _I; } public function ClickSelectTool() { _selectTip.setBounds(new Rectangle(0, 0, 0, 0 )); Notice.listen(DisplayHook.ITEM_CLICKED, this, itemClicked); } public static var isClickSelectState:Boolean = false; private var completeHandler:Handler; public function beginClickSelect(complete:Handler = null):void { this.completeHandler = complete; isClickSelectState = true; clickSelectChange(); } private function clickSelectChange():void { if (!Browser.onPC) return; tSelectTar = null; clearSelectTip(); if (isClickSelectState) { Laya.timer.loop(200, this, updateSelectTar, null, true); }else { Laya.timer.clear(this, updateSelectTar); } } private function clearSelectTip():void { _selectTip.removeSelf(); } private var _selectTip:Sprite=new Sprite(); private var tSelectTar:Sprite; private function updateSelectTar():void { clearSelectTip(); tSelectTar = DisplayHook.instance.getDisUnderMouse(); if (!tSelectTar) { return; } if (DebugInfoLayer.I.isDebugItem(tSelectTar)) return; var g:Graphics; g = _selectTip.graphics; g.clear(); var rec:Rectangle; rec = NodeUtils.getGRec(tSelectTar); DebugInfoLayer.I.popLayer.addChild(_selectTip); //_selectTip.alpha = 0.2; g.drawRect(0, 0, rec.width, rec.height, null,DebugConsts.CLICK_SELECT_COLOR,2); _selectTip.pos(rec.x, rec.y); } public static var ignoreDebugTool:Boolean = false; private function itemClicked(tar:Sprite):void { if (!isClickSelectState) return; if (ignoreDebugTool) { if (DebugInfoLayer.I.isDebugItem(tar)) return; } if (tar is ContextMenuItem || tar.parent is ContextMenuItem) { return ; } DebugTool.showDisBound(tar); if (completeHandler) { completeHandler.runWith(tar); } isClickSelectState = false; clickSelectChange(); } } }
// Copyright (c) 2014 www.9miao.com All rights reserved. package dGame3D { import flash.geom.*; import flash.display.Bitmap; import flash.display.BitmapData; import flash.utils.ByteArray; /** * ... * @author dym */ public class PNGEncoder { public static function encode(img:BitmapData):ByteArray { // Create output byte array var png:ByteArray = new ByteArray(); // Write PNG signature png.writeUnsignedInt(0x89504e47); png.writeUnsignedInt(0x0D0A1A0A); // Build IHDR chunk var IHDR:ByteArray = new ByteArray(); IHDR.writeInt(img.width); IHDR.writeInt(img.height); IHDR.writeUnsignedInt(0x08060000); // 32bit RGBA IHDR.writeByte(0); writeChunk(png,0x49484452,IHDR); // Build IDAT chunk var IDAT:ByteArray= new ByteArray(); for(var i:int=0;i < img.height;i++) { // no filter IDAT.writeByte(0); var p:uint; var j:int; if ( !img.transparent ) { for(j=0;j < img.width;j++) { p = img.getPixel(j,i); IDAT.writeUnsignedInt( uint(((p&0xFFFFFF) << 8)|0xFF)); } } else { for(j=0;j < img.width;j++) { p = img.getPixel32(j,i); IDAT.writeUnsignedInt( uint(((p&0xFFFFFF) << 8)| (p>>>24))); } } } IDAT.compress(); writeChunk(png,0x49444154,IDAT); // Build IEND chunk writeChunk(png,0x49454E44,null); // return PNG png.position = 0; return png; } public static function MakeChunk( a:String , b:String , c:String , d:String ):int { return a.charCodeAt( 0 ) << 24 | b.charCodeAt( 0 ) << 16 | c.charCodeAt( 0 ) << 8 | d.charCodeAt( 0 ); } public static function MakeChunkLittle( a:String , b:String , c:String , d:String ):int { return d.charCodeAt( 0 ) << 24 | c.charCodeAt( 0 ) << 16 | b.charCodeAt( 0 ) << 8 | a.charCodeAt( 0 ); } private static var crcTable:Array; private static var crcTableComputed:Boolean = false; private static function writeChunk(png:ByteArray, type:uint, data:ByteArray):void { if (!crcTableComputed) { crcTableComputed = true; crcTable = []; var c:uint; for (var n:uint = 0; n < 256; n++) { c = n; for (var k:uint = 0; k < 8; k++) { if (c & 1) { c = uint(uint(0xedb88320) ^ uint(c >>> 1)); } else { c = uint(c >>> 1); } } crcTable[n] = c; } } var len:uint = 0; if (data != null) { len = data.length; } png.writeUnsignedInt(len); var p:uint = png.position; png.writeUnsignedInt(type); if ( data != null ) { png.writeBytes(data); } var e:uint = png.position; png.position = p; c = 0xffffffff; for (var i:int = 0; i < (e-p); i++) { c = uint(crcTable[ (c ^ png.readUnsignedByte()) & uint(0xff)] ^ uint(c >>> 8)); } c = uint(c^uint(0xffffffff)); png.position = e; png.writeUnsignedInt(c); } } }
//////////////////////////////////////////////////////////////////////////////// // // ADOBE SYSTEMS INCORPORATED // Copyright 2010 Adobe Systems Incorporated // All Rights Reserved. // // NOTICE: Adobe permits you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// package spark.skins.mobile.supportClasses { import spark.skins.mobile.ButtonSkin; /** * ButtonBarButton skin base class. Adds optional support for selected state. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 2.5 * @productversion Flex 4.5 */ public class ButtonBarButtonSkinBase extends ButtonSkin { //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 2.5 * @productversion Flex 4.5 */ public function ButtonBarButtonSkinBase() { super(); } //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- /** * Size of corner radii of button borders. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 2.5 * @productversion Flex 4.5 */ protected var cornerRadius:int; /** * Class to use for the border in the selected state. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 2.5 * @productversion Flex 4.5 */ protected var selectedBorderSkin:Class; /** * @private */ override protected function getBorderClassForCurrentState():Class { var isSelected:Boolean = currentState.indexOf("Selected") >= 0; if (isSelected && selectedBorderSkin) return selectedBorderSkin; else if (isSelected || currentState.indexOf("down") >= 0) return downBorderSkin; else return upBorderSkin; } } }
package qihoo.triplecleangame.protos { import com.netease.protobuf.*; import com.netease.protobuf.fieldDescriptors.*; import flash.utils.Endian; import flash.utils.IDataInput; import flash.utils.IDataOutput; import flash.utils.IExternalizable; import flash.errors.IOError; // @@protoc_insertion_point(imports) // @@protoc_insertion_point(class_metadata) public dynamic final class CMsgAcceptAddPlayerRequest extends com.netease.protobuf.Message { public static const USERQID:FieldDescriptor$TYPE_UINT64 = new FieldDescriptor$TYPE_UINT64("qihoo.triplecleangame.protos.CMsgAcceptAddPlayerRequest.userQID", "userQID", (1 << 3) | com.netease.protobuf.WireType.VARINT); private var userQID$field:UInt64; public function clearUserQID():void { userQID$field = null; } public function get hasUserQID():Boolean { return userQID$field != null; } public function set userQID(value:UInt64):void { userQID$field = value; } public function get userQID():UInt64 { return userQID$field; } public static const FRIENDQID:FieldDescriptor$TYPE_UINT64 = new FieldDescriptor$TYPE_UINT64("qihoo.triplecleangame.protos.CMsgAcceptAddPlayerRequest.friendQID", "friendQID", (2 << 3) | com.netease.protobuf.WireType.VARINT); private var friendQID$field:UInt64; public function clearFriendQID():void { friendQID$field = null; } public function get hasFriendQID():Boolean { return friendQID$field != null; } public function set friendQID(value:UInt64):void { friendQID$field = value; } public function get friendQID():UInt64 { return friendQID$field; } public static const ACCEPT:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("qihoo.triplecleangame.protos.CMsgAcceptAddPlayerRequest.accept", "accept", (3 << 3) | com.netease.protobuf.WireType.VARINT); private var accept$field:int; private var hasField$0:uint = 0; public function clearAccept():void { hasField$0 &= 0xfffffffe; accept$field = new int(); } public function get hasAccept():Boolean { return (hasField$0 & 0x1) != 0; } public function set accept(value:int):void { hasField$0 |= 0x1; accept$field = value; } public function get accept():int { return accept$field; } /** * @private */ override public final function writeToBuffer(output:com.netease.protobuf.WritingBuffer):void { if (hasUserQID) { com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 1); com.netease.protobuf.WriteUtils.write$TYPE_UINT64(output, userQID$field); } if (hasFriendQID) { com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 2); com.netease.protobuf.WriteUtils.write$TYPE_UINT64(output, friendQID$field); } if (hasAccept) { com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 3); com.netease.protobuf.WriteUtils.write$TYPE_INT32(output, accept$field); } for (var fieldKey:* in this) { super.writeUnknown(output, fieldKey); } } /** * @private */ override public final function readFromSlice(input:flash.utils.IDataInput, bytesAfterSlice:uint):void { var userQID$count:uint = 0; var friendQID$count:uint = 0; var accept$count:uint = 0; while (input.bytesAvailable > bytesAfterSlice) { var tag:uint = com.netease.protobuf.ReadUtils.read$TYPE_UINT32(input); switch (tag >> 3) { case 1: if (userQID$count != 0) { throw new flash.errors.IOError('Bad data format: CMsgAcceptAddPlayerRequest.userQID cannot be set twice.'); } ++userQID$count; this.userQID = com.netease.protobuf.ReadUtils.read$TYPE_UINT64(input); break; case 2: if (friendQID$count != 0) { throw new flash.errors.IOError('Bad data format: CMsgAcceptAddPlayerRequest.friendQID cannot be set twice.'); } ++friendQID$count; this.friendQID = com.netease.protobuf.ReadUtils.read$TYPE_UINT64(input); break; case 3: if (accept$count != 0) { throw new flash.errors.IOError('Bad data format: CMsgAcceptAddPlayerRequest.accept cannot be set twice.'); } ++accept$count; this.accept = com.netease.protobuf.ReadUtils.read$TYPE_INT32(input); break; default: super.readUnknown(input, tag); break; } } } } }
// Decompiled by AS3 Sorcerer 6.08 // www.as3sorcerer.com //kabam.lib.console.signals.ConsoleWatchSignal package kabam.lib.console.signals { import org.osflash.signals.Signal; import kabam.lib.console.model.Watch; public class ConsoleWatchSignal extends Signal { public function ConsoleWatchSignal() { super(Watch); } } }//package kabam.lib.console.signals
// makeswf -v 7 -r 1 -o point-construct-7.swf point-construct.as // enable flash structure for version < 8 too for this test ASSetPropFlags (_global, "flash", 0, 4096); #include "values.as" trace ("Testing (no params):"); var p = new flash.geom.Point (); trace ("new: " + p); p = new flash.geom.Polar (); trace ("polar: " + p); for (var i = 0; i < values.length; i++) { trace ("Testing " + names[i] + ":"); p = new flash.geom.Point (values[i]); trace ("new: " + p); p = new flash.geom.Polar (values[i]); trace ("polar: " + p); for (var j = i; j < values.length; j++) { trace ("Testing " + names[i] + ", " + names[j] + ":"); p = new flash.geom.Point (values[i], values[j]); trace ("new: " + p); p = new flash.geom.Polar (values[i], values[j]); trace ("polar: " + p); } } loadMovie ("FSCommand:quit", "");
package { import feathers.controls.ImageLoader; import feathers.controls.renderers.LayoutGroupListItemRenderer; import feathers.layout.AnchorLayout; import feathers.layout.AnchorLayoutData; import feathers.utils.touch.TapToSelect; import starling.display.Quad; public class PhotoItemRenderer extends LayoutGroupListItemRenderer { private var _image:ImageLoader; private var _select:TapToSelect; public function PhotoItemRenderer() { super(); this._select = new TapToSelect(this); } override protected function initialize():void { super.initialize(); this.isQuickHitAreaEnabled = true; this.layout = new AnchorLayout(); this.backgroundSkin = new Quad(70, 70, 0xFFFFFF); _image = new ImageLoader(); _image.layoutData = new AnchorLayoutData(0, 0, 0, 0, NaN, NaN); _image.width = 70; _image.height = 70; this.addChild(_image); } override protected function commitData():void { if(this._data && this._owner) { _image.source = 'https://farm'+_data.@farm+'.staticflickr.com/'+_data.@server+'/'+_data.@id+'_'+_data.@secret+'_s.jpg'; } else { _image.source = null; } } } }
/* Disclaimer for Robert Penner's Easing Equations license: TERMS OF USE - EASING EQUATIONS Open source under the BSD License. Copyright � 2001 Robert Penner All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package jp.raohmaru.toolkit.motion.easing { /** * Ecuaciones de movimiento de Robert Penner utilizadas por la clase Paprika. */ public class Linear { public static function easeNone(t :Number, b :Number, c :Number, d :Number) :Number { return c * t / d + b; } public static function easeIn(t :Number, b :Number, c :Number, d :Number) :Number { return c * t / d + b; } public static function easeOut(t :Number, b :Number, c :Number, d :Number) :Number { return c * t / d + b; } public static function easeInOut(t :Number, b :Number, c :Number, d :Number) :Number { return c * t / d + b; } } }