CombinedText
stringlengths
4
3.42M
package ro.ciacob.utils.constants { public final class FileTypes { // Any file (as in, file type not set) public static const ANY:String = ''; // Only folders public static const FOLDERS_ONLY:String = 'foldersonly'; // SOUND public static const ABC:String = 'abc'; public static const MIDI:String = 'mid'; public static const WAV:String = 'wav'; public static const MP3:String = 'mp3'; public static const AIFF:String = 'aiff'; // Images public static const JPEG:String = 'jpeg'; public static const JPG:String = 'jpg'; public static const PNG:String = 'png'; public static const GIF:String = 'gif'; public static const ALLOWED_IMAGE_TYPES:Array = [FileTypes.JPEG, FileTypes.JPG, FileTypes.PNG]; // Flash/AS3 public static const SWF : String = 'swf'; public static const SWC : String = 'swc'; // Documents public static const PDF : String = 'pdf'; public static const TXT : String = 'txt'; public static const XML : String = 'xml'; // Windows Executables public static const BAT:String = 'bat'; public static const CMD:String = 'cmd'; public static const COM:String = 'com'; public static const CPL:String = 'cpl'; public static const EXE:String = 'exe'; public static const HTA:String = 'hta'; public static const INF:String = 'inf'; public static const JS:String = 'js'; public static const JSE:String = 'jse'; public static const MDB:String = 'mdb'; public static const MSC:String = 'msc'; public static const MSI:String = 'msi'; public static const MSP:String = 'msp'; public static const OCX:String = 'ocx'; public static const PIF:String = 'pif' public static const SCR:String = 'scr'; public static const SCT:String = 'sct'; public static const SHS:String = 'shs'; public static const SYS:String = 'sys'; public static const VB:String = 'vb'; public static const VBE:String = 'vbe'; public static const VBS:String = 'vbs'; public static const WSC:String = 'wsc'; public static const WSF:String = 'wsf'; public static const WSH:String = 'wsh'; // Windows shortcuts public static const LNK:String = 'lnk'; public static const URL:String = 'url'; // Mac Executables public static const SH:String = 'sh'; // Import and export public static const TPL:String = 'tpl'; public static const CCL:String = 'ccl'; } }
import mx.core.UIComponent import mx.controls.CheckBox class CheckCellRenderer extends mx.controls.cells.CheckCellRenderer { function click() { super.click() listOwner.selectedIndex = getCellIndex().itemIndex listOwner.dispatchEvent({ type:"cellPress"}); } }
package { public class Main { public function Main(a : int, b : int, c : int = 100) { params.b = b; } } }
/* Copyright (C) 2012 James Ward 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 components.library { import mx.collections.IList; import mx.collections.errors.ItemPendingError; import mx.events.CollectionEvent; import mx.events.CollectionEventKind; import mx.events.PropertyChangeEvent; import mx.events.PropertyChangeEventKind; import mx.resources.IResourceManager; import mx.resources.ResourceManager; import mx.utils.OnDemandEventDispatcher; import components.library.events.AssyncItemError; [Event(name="collectionChange", type="mx.events.CollectionEvent")] /** * An IList whose items are fetched asynchronously by a user provided function. The * loadItemsFunction initiates an asynchronous request for a pageSize block items, typically * from a web service. When the request sucessfully completes, the storeItemsAt() method * must be called. If the request fails, then failItemsAt(). * * <p>PagedList divides its <code>length</code> items into <code>pageSize</code> blocks or * "pages". It tracks which items exist locally, typically because they've been stored with * storeItemsAt(). When an item that does not exist locally is requested with getItemAt(), * the loadItemsFunction is called and then an IPE is thrown. When the loadItemsFunction * either completes or fails, it must call storeItemsAt() or failItemsAt() which causes * the IPE's responders to run and a "replace" CollectionEvent to be dispatched for the * updated page. The failItemsAt() method resets the corresponding items to undefined, * which means that subsequent calls to getItemAt() will cause an IPE to be thrown.</p> * * <p>Unlike some other IList implementations, the only method here that can thrown an * IPE is getItemAt(). Methods like getItemIndex() and toArray() just report items * that aren't local as null.</p> * * <p>This class is intended to be used as the "list" source for an ASyncListView.</p> */ public class PagedList extends OnDemandEventDispatcher implements IList { /** * @private */ protected static function get resourceManager():IResourceManager { return ResourceManager.getInstance(); } /** * @private */ protected static function checkItemIndex(index:int, listLength:int):void { if (index < 0 || (index >= listLength)) { const message:String = resourceManager.getString("collections", "outOfBounds", [ index ]); throw new RangeError(message); } } /** * @private * The IList's items. */ protected var data:Vector.<Object> = new Vector.<Object>(); /** * Construct a PagedList with the specified length and pageSize. */ public function PagedList(length:int=1000, pageSize:int=10) { this.data.length = length; this.pageSize = pageSize; } //---------------------------------- // loadItemsFunction //---------------------------------- private var _loadItemsFunction:Function = null; /** * The value of this property must be a function that loads a contiguous * block of items and then calls <code>storeItemsAt()</code> or * <code>failItemsAt()</code>. A loadItemsFunction must be defined as follows: * <pre> * myLoadItems(list:PagedList, index:int, count:int):void * </pre> * * <p>Typically the loadItemsFunction will make one or more network requests * to retrieve the items. It must do all of its work asynchronously to avoid * blocking the application's GUI. * */ public function get loadItemsFunction():Function { return _loadItemsFunction; } /** * @private */ public function set loadItemsFunction(value:Function):void { _loadItemsFunction = value; } //---------------------------------- // length //---------------------------------- [Bindable("collectionChange")] /** * The number of items in the list. * * <p>The length of the list can be changed directly however the "-1" indeterminate * length value is not supported.</p> */ public function get length():int { return data.length; } /** * @private */ public function set length(value:int):void { const oldLength:int = data.length; const newLength:int = value; if (oldLength == newLength) return; var ce:CollectionEvent = null; if (hasEventListener(CollectionEvent.COLLECTION_CHANGE)) ce = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE); if (oldLength < newLength) { if (ce) { ce.location = Math.max(oldLength - 1, 0); ce.kind = CollectionEventKind.ADD; const itemsLength:int = newLength - oldLength; for (var i:int = 0; i < itemsLength; i++) ce.items.push(null); } data.length = newLength; for (var newIndex:int = Math.max(oldLength, 0); newIndex < newLength; newIndex++) { data[newIndex] = null; } } else // oldLength > newLength { if (ce) { ce.location = Math.max(newLength - 1, 0); ce.kind = CollectionEventKind.REMOVE; for (var oldIndex:int = Math.max(newLength - 1, 0); oldIndex < oldLength; oldIndex++) { ce.items.push(data[oldIndex]); } } data.length = newLength; } if (ce) dispatchEvent(ce); } //---------------------------------- // pageSize //---------------------------------- private var _pageSize:int = 10; /** * Items are loaded in contiguous pageSize blocks. The value of this property should be greater than * zero, smaller than the PageList's length, and a reasonable working size for the loadItemsFunction. */ public function get pageSize():int { return _pageSize; } /** * @private */ public function set pageSize(value:int):void { _pageSize = value; } /** * Resets the entire list to its initial state. All local and pending items are * cleared. */ public function clearItems():void { /* var index:int = 0; for each (var item:Object in data) data[index++] = null; */ data.length = 0; if (hasEventListener(CollectionEvent.COLLECTION_CHANGE)) { var ce:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE); ce.kind = CollectionEventKind.RESET; dispatchEvent(ce); } } /** * @private */ protected static function createUpdatePCE(itemIndex:Object, oldValue:Object, newValue:Object):PropertyChangeEvent { const pce:PropertyChangeEvent = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE); pce.kind = PropertyChangeEventKind.UPDATE; pce.property = itemIndex; pce.oldValue = oldValue; pce.newValue = newValue; return pce; } /** * @private */ protected static function createCE(kind:String, location:int, item:Object):CollectionEvent { const ce:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE); ce.kind = kind; ce.location = location; if (item is Array) ce.items = item as Array; else ce.items.push(item); return ce; } /** * This method must be called by the loadItemsFunction after a block of requested * items have been successfully retrieved. It stores the specified items in the * internal data vector and clears the "pending" state associated with the original * request. */ public function storeItemsAt(items:Vector.<Object>, index:int):void { if (index < 0 || (index + items.length) > length) { const message:String = resourceManager.getString("collections", "outOfBounds", [ index ]); throw new RangeError(message); } var item:Object; var itemIndex:int; var pce:PropertyChangeEvent; // copy the new items into the internal items vector and run the IPE responders itemIndex = index; for each (item in items) { /*var ipe:ItemPendingError = data[itemIndex] as ItemPendingError; if (ipe && ipe.responders) { for each (var responder:IResponder in ipe.responders) responder.result(null); }*/ data[itemIndex++] = item; } // dispatch collection and property change events const hasCollectionListener:Boolean = hasEventListener(CollectionEvent.COLLECTION_CHANGE); const hasPropertyListener:Boolean = hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE); var propertyChangeEvents:Array = new Array(); // Array of PropertyChangeEvents; if (hasCollectionListener || hasPropertyListener) { itemIndex = index; for each (item in items) propertyChangeEvents.push(createUpdatePCE(itemIndex++, null, item)); } if (hasCollectionListener) dispatchEvent(createCE(CollectionEventKind.REPLACE, index, propertyChangeEvents)); if (hasPropertyListener) { for each (pce in propertyChangeEvents) dispatchEvent(pce); } } public function failItemsAt(index:int, count:int):void { /* if (index < 0 || (index + count) > length) { const message:String = resourceManager.getString("collections", "outOfBounds", [ index ]); throw new RangeError(message); } var props : Array = new Array(); for (var i:int = 0; i < count; i++) { var itemIndex:int = i + index; var ipe:ItemPendingError = data[itemIndex] as ItemPendingError; if (ipe && ipe.responders) { for each (var responder:IResponder in ipe.responders) responder.result(null); } data[itemIndex] = new Error(); props.push( PropertyChangeEvent.createUpdateEvent( this, null, ipe, data[itemIndex] ) ); } dispatchEvent( createCE( CollectionEventKind.UPDATE, index, props ) ); */ var items : Vector.<Object> = new Vector.<Object>( count ); for ( var i : int = 0; i < count; i ++ ) { items[ i ] = new AssyncItemError(); } storeItemsAt( items, index ); } //-------------------------------------------------------------------------- // // IList Implementation (length appears above) // //-------------------------------------------------------------------------- /** * @inheritDoc */ public function addItem(item:Object):void { addItemAt(item, length); } /** * @inheritDoc */ public function addItemAt(item:Object, index:int):void { checkItemIndex(index, length + 1); data.splice(index, 0, item); if (hasEventListener(CollectionEvent.COLLECTION_CHANGE)) dispatchEvent(createCE(CollectionEventKind.ADD, index, item)); } /** * @inheritDoc */ public function getItemAt(index:int, prefetch:int=0):Object { checkItemIndex(index, length); var item:Object = data[index]; if (item is ItemPendingError) { throw item as ItemPendingError; } else if (item == null) { var ipe:ItemPendingError = new ItemPendingError(String(index)); var pageStartIndex:int = Math.floor(index / pageSize) * pageSize; var count:int = Math.min(pageSize, data.length - pageStartIndex); for (var i:int = 0; i < count; i++) data[pageStartIndex + i] = ipe; if (loadItemsFunction !== null) loadItemsFunction(this, pageStartIndex, count); // Allow for the possibility that loadItemsFunction has synchronously // loaded the requested data item. if (data[index] == ipe) throw ipe; else item = data[index]; } return item; } /** * Return the index of of the specified item, if it currently exists in the list. * This method does not cause additional items to be loaded. */ public function getItemIndex(item:Object):int { return data.indexOf(item); } /** * @inheritDoc */ public function itemUpdated(item:Object, property:Object=null, oldValue:Object=null, newValue:Object=null):void { const hasCollectionListener:Boolean = hasEventListener(CollectionEvent.COLLECTION_CHANGE); const hasPropertyListener:Boolean = hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE); var pce:PropertyChangeEvent = null; if (hasCollectionListener || hasPropertyListener) pce = createUpdatePCE(property, oldValue, newValue); if (hasCollectionListener) dispatchEvent(createCE(CollectionEventKind.UPDATE, -1, pce)); if (hasPropertyListener) dispatchEvent(pce); } /** * @inheritDoc */ public function removeAll():void { length = 0; if (hasEventListener(CollectionEvent.COLLECTION_CHANGE)) { const ce:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE); ce.kind = CollectionEventKind.RESET; dispatchEvent(ce); } } /** * @inheritDoc */ public function removeItemAt(index:int):Object { checkItemIndex(index, length); const item:Object = data[index]; data.splice(index, 1); if (hasEventListener(CollectionEvent.COLLECTION_CHANGE)) dispatchEvent(createCE(CollectionEventKind.REMOVE, index, item)); return item; } /** * @inheritDoc */ public function setItemAt(item:Object, index:int):Object { checkItemIndex(index, length); const oldItem:Object = data[index]; if (item !== oldItem) { const hasCollectionListener:Boolean = hasEventListener(CollectionEvent.COLLECTION_CHANGE); const hasPropertyListener:Boolean = hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE); var pce:PropertyChangeEvent = null; if (hasCollectionListener || hasPropertyListener) pce = createUpdatePCE(index, oldItem, item); if (hasCollectionListener) dispatchEvent(createCE(CollectionEventKind.REPLACE, index, pce)); if (hasPropertyListener) dispatchEvent(pce); } return oldItem; } /** * Returns an array with the same length as this list, that contains all of * the items successfully loaded so far. * * <p>Calling this method does not force additional items to be loaded.</p> */ public function toArray():Array { const rv:Array = new Array(data.length); var index:int = 0; for each (var item:Object in data) rv[index++] = (item is ItemPendingError) ? undefined : item; return rv; } } }
package { public class Main { public function Main() { 1 < 2$(EntryPoint) } } }
package kabam.rotmg.account.ui.components { import com.company.ui.BaseSimpleText; import flash.display.Sprite; import flash.events.Event; import flash.events.FocusEvent; import flash.events.TextEvent; import flash.filters.DropShadowFilter; import kabam.lib.util.DateValidator; import kabam.rotmg.text.view.TextFieldDisplayConcrete; import kabam.rotmg.text.view.stringBuilder.LineBuilder; import org.osflash.signals.Signal; public class DateField extends Sprite { private static const BACKGROUND_COLOR:uint = 3355443; private static const ERROR_BORDER_COLOR:uint = 16549442; private static const NORMAL_BORDER_COLOR:uint = 4539717; private static const TEXT_COLOR:uint = 11776947; private static const INPUT_RESTRICTION:String = "1234567890"; private static const FORMAT_HINT_COLOR:uint = 5592405; public function DateField() { super(); this.validator = new DateValidator(); this.thisYear = new Date().getFullYear(); this.label = new TextFieldDisplayConcrete().setSize(18).setColor(0xb3b3b3); this.label.setBold(true); this.label.setStringBuilder(new LineBuilder().setParams(name)); this.label.filters = [new DropShadowFilter(0, 0, 0)]; addChild(this.label); this.months = new BaseSimpleText(20, 0xb3b3b3, true, 35, 30); this.months.restrict = "1234567890"; this.months.maxChars = 2; this.months.y = 30; this.months.x = 6; this.months.border = false; this.months.updateMetrics(); this.months.addEventListener("textInput", this.onMonthInput); this.months.addEventListener("focusOut", this.onMonthFocusOut); this.months.addEventListener("change", this.onEditMonth); this.monthFormatText = this.createFormatHint(this.months, "DateField.Months"); addChild(this.monthFormatText); addChild(this.months); this.days = new BaseSimpleText(20, 0xb3b3b3, true, 35, 30); this.days.restrict = "1234567890"; this.days.maxChars = 2; this.days.y = 30; this.days.x = 63; this.days.border = false; this.days.updateMetrics(); this.days.addEventListener("textInput", this.onDayInput); this.days.addEventListener("focusOut", this.onDayFocusOut); this.days.addEventListener("change", this.onEditDay); this.dayFormatText = this.createFormatHint(this.days, "DateField.Days"); addChild(this.dayFormatText); addChild(this.days); this.years = new BaseSimpleText(20, 0xb3b3b3, true, 55, 30); this.years.restrict = "1234567890"; this.years.maxChars = 4; this.years.y = 30; this.years.x = 118; this.years.border = false; this.years.updateMetrics(); this.years.restrict = "1234567890"; this.years.addEventListener("textInput", this.onYearInput); this.years.addEventListener("change", this.onEditYear); this.yearFormatText = this.createFormatHint(this.years, "DateField.Years"); addChild(this.yearFormatText); addChild(this.years); this.setErrorHighlight(false); } public var label:TextFieldDisplayConcrete; public var days:BaseSimpleText; public var months:BaseSimpleText; public var years:BaseSimpleText; private var dayFormatText:TextFieldDisplayConcrete; private var monthFormatText:TextFieldDisplayConcrete; private var yearFormatText:TextFieldDisplayConcrete; private var thisYear:int; private var validator:DateValidator; public function setTitle(_arg_1:String):void { this.label.setStringBuilder(new LineBuilder().setParams(_arg_1)); } public function setErrorHighlight(_arg_1:Boolean):void { this.drawSimpleTextBackground(this.months, 0, 0, _arg_1); this.drawSimpleTextBackground(this.days, 0, 0, _arg_1); this.drawSimpleTextBackground(this.years, 0, 0, _arg_1); } public function isValidDate():Boolean { var _local2:int = parseInt(this.months.text); var _local1:int = parseInt(this.days.text); var _local3:int = parseInt(this.years.text); return this.validator.isValidDate(_local2, _local1, _local3, 100); } public function getDate():String { var _local2:String = this.getFixedLengthString(this.months.text, 2); var _local1:String = this.getFixedLengthString(this.days.text, 2); var _local3:String = this.getFixedLengthString(this.years.text, 4); return _local2 + "/" + _local1 + "/" + _local3; } public function getTextChanged():Signal { return this.label.textChanged; } private function drawSimpleTextBackground(_arg_1:BaseSimpleText, _arg_2:int, _arg_3:int, _arg_4:Boolean):void { var _local5:uint = !!_arg_4 ? 16549442 : 0x454545; graphics.lineStyle(2, _local5, 1, false, "normal", "round", "round"); graphics.beginFill(0x333333, 1); graphics.drawRect(_arg_1.x - _arg_2 - 5, _arg_1.y - _arg_3, _arg_1.width + _arg_2 * 2, _arg_1.height + _arg_3 * 2); graphics.endFill(); graphics.lineStyle(); } private function createFormatHint(_arg_1:BaseSimpleText, _arg_2:String):TextFieldDisplayConcrete { var _local3:TextFieldDisplayConcrete = new TextFieldDisplayConcrete().setSize(16).setColor(0x555555); _local3.setTextWidth(_arg_1.width + 4).setTextHeight(_arg_1.height); _local3.x = _arg_1.x - 6; _local3.y = _arg_1.y + 3; _local3.setStringBuilder(new LineBuilder().setParams(_arg_2)); _local3.setAutoSize("center"); return _local3; } private function getEarliestYear(_arg_1:String):int { while (_arg_1.length < 4) { _arg_1 = _arg_1 + "0"; } return int(_arg_1); } private function getFixedLengthString(_arg_1:String, _arg_2:int):String { while (_arg_1.length < _arg_2) { _arg_1 = "0" + _arg_1; } return _arg_1; } private function onMonthInput(_arg_1:TextEvent):void { var _local2:String = this.months.text + _arg_1.text; var _local3:int = parseInt(_local2); if (_local2 != "0" && !this.validator.isValidMonth(_local3)) { _arg_1.preventDefault(); } } private function onMonthFocusOut(_arg_1:FocusEvent):void { var _local2:int = parseInt(this.months.text); if (_local2 < 10 && this.days.text != "") { this.months.text = "0" + _local2.toString(); } } private function onEditMonth(_arg_1:Event):void { this.monthFormatText.visible = !this.months.text; } private function onDayInput(_arg_1:TextEvent):void { var _local2:String = this.days.text + _arg_1.text; var _local3:int = parseInt(_local2); if (_local2 != "0" && !this.validator.isValidDay(_local3)) { _arg_1.preventDefault(); } } private function onDayFocusOut(_arg_1:FocusEvent):void { var _local2:int = parseInt(this.days.text); if (_local2 < 10 && this.days.text != "") { this.days.text = "0" + _local2.toString(); } } private function onEditDay(_arg_1:Event):void { this.dayFormatText.visible = !this.days.text; } private function onYearInput(_arg_1:TextEvent):void { var _local2:String = this.years.text + _arg_1.text; var _local3:int = this.getEarliestYear(_local2); if (_local3 > this.thisYear) { _arg_1.preventDefault(); } } private function onEditYear(_arg_1:Event):void { this.yearFormatText.visible = !this.years.text; } } }
/* * Copyright 2014 Mozilla Foundation * * 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 flash.events { public class StageVideoAvailabilityEvent extends Event { public static const STAGE_VIDEO_AVAILABILITY:String = "stageVideoAvailability"; private var _availability:String; public function StageVideoAvailabilityEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, availability:String = null) { super(type, bubbles, cancelable); _availability = availability; } public function get availability():String { return _availability; } } }
package lipsync.training { import flash.geom.Vector3D; public class TrainingPattern { public var input:Vector.<Number>; public var output:Vector.<Number>; public function TrainingPattern(inputPattern:Vector.<Number> = null, outputPattern:Vector.<Number> = null) { this.input = inputPattern; this.output = outputPattern; } } }
package com.flashdynamix.motion.vectors { import flash.display.Graphics; import flash.geom.Matrix; import flash.geom.Rectangle; /** * Defines a Gradient vector to be drawn by a VectorLayer. */ public class Gradient implements IVector { /** * Defines the type of Gradient - this can be: * <ul> * <li>GradientType.LINEAR</li> * <li>GradientType.RADIAL</li> * </ul> */ public var type : String; /** * An Array of RGB hexadecimal color values to be used in the gradient; * for example, red is 0xFF0000, blue is 0x0000FF, and so on.<BR> * You can specify up to 15 colors. For each color, be sure you specify a corresponding value in the alphas and ratios parameters. */ public var colors : Array; /** * An Array of alpha values for the corresponding colors in the colors Array; valid values are 0 to 1.<BR> * If the value is less than 0, the default is 0. If the value is greater than 1, the default is 1. */ public var alphas : Array; /** * An Array of color distribution ratios; valid values are 0 to 255.<BR> * This value defines the percentage of the width where the color is sampled at 100%.<BR> * The value 0 represents the left-hand position in the gradient box, and 255 represents the right-hand position in the gradient box. */ public var ratios : Array; /** * A value from the SpreadMethod class that specifies which spread method to use: * <ul> * <li>SpreadMethod.PAD</li> * <li>SpreadMethod.REFLECT</li> * <li>SpreadMethod.REPLAY</li> * </ul> */ public var spreadMethod : String; /** * A value from the InterpolationMethod class that specifies which value to use: * <ul> * <li>InterpolationMethod.linearRGB</li> * <li>InterpolationMethod.RGB</li> * </ul> */ public var interpolationMethod : String; /** * A number that controls the location of the focal point of the gradient.<BR> * 0 means that the focal point is in the center.<BR> * 1 means that the focal point is at one border of the gradient circle.<BR> * -1 means that the focal point is at the other border of the gradient circle.<BR> * A value less than -1 or greater than 1 is rounded to -1 or 1.<BR> */ public var focalPointRatio : Number; private var matrix : Matrix; private var _rotation : Number; private var _x : Number; private var _y : Number; private var _width : Number; private var _height : Number; private var degreeRad : Number = Math.PI / 180; private var radDegree : Number = 180 / Math.PI; /** * @param x The current x position in pixels for the Gradient. * @param y The current y position in pixels for the Gradient. * @param width The current width in pixels for the Gradient. * @param height The current height in pixels for the Gradient. * @param rotation The current rotation in degrees for the Gradient. * @param colors An Array of RGB hexadecimal color values to be used in the gradient. * @param alphas An Array of alpha values for the corresponding colors in the colors Array. * @param ratios An Array of color distribution ratios; valid values are 0 to 255. * @param type Defines the type of Gradient - this can be either GradientType.LINEAR or GradientType.RADIAL. * @param spreadMethod A value from the SpreadMethod class that specifies which spread method to use this can be either SpreadMethod.PAD, SpreadMethod.REFLECT, or SpreadMethod.REPLAY. * @param interpolationMethod A value from the InterpolationMethod class that specifies which value to use this can be either InterpolationMethod.linearRGB or InterpolationMethod.RGB. * @param focalPointRatio A number that controls the location of the focal point of the Gradient. */ public function Gradient(x : Number, y : Number, width : Number, height : Number, rotation : Number, colors : Array, alphas : Array, ratios : Array, type : String = "linear", spreadMethod : String = "pad", interpolationMethod : String = "rgb", focalPointRatio : Number = 0) { _x = x; _y = y; _width = width; _height = height; _rotation = rotation * degreeRad; this.colors = colors; this.alphas = alphas; this.ratios = ratios; this.type = type; this.spreadMethod = spreadMethod; this.interpolationMethod = interpolationMethod; this.focalPointRatio = focalPointRatio; matrix = new Matrix(); update(); } /** * Set the rotation of the Gradient in degrees. */ public function set rotation(degrees : Number) : void { _rotation = degrees * degreeRad; update(); } /** * @return The rotation of the Gradient in degrees. */ public function get rotation() : Number { return _rotation * radDegree; } /** * Set the x position of the Gradient in pixels. */ public function set x(num : Number) : void { _x = num; update(); } /** * @return The x position of the Gradient in pixels. */ public function get x() : Number { return _x; } /** * Set the y position of the Gradient in pixels. */ public function set y(num : Number) : void { _y = num; update(); } /** * @return The y position of the Gradient in pixels. */ public function get y() : Number { return _y; } /** * Set the width of the Gradient in pixels. */ public function set width(num : Number) : void { _width = num; update(); } /** * @return Gets the width of the Gradient in pixels. */ public function get width() : Number { return _width; } /** * Set the height of the Gradient in pixels. */ public function set height(num : Number) : void { _height = num; update(); } /** * @return Gets the height of the Gradient in pixels. */ public function get height() : Number { return _height; } /** * Draws the Gradient into the Graphics instance provided. */ public function draw(vector : Graphics, rect : Rectangle) : void { vector.beginGradientFill(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio); vector.drawRect(0, 0, rect.width, rect.height); } private function update() : void { matrix.createGradientBox(_width, _height, _rotation, _x, _y); } } }
/* Copyright (c) 2009, 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.adobe.protocols.dict.util { import flash.events.Event; public class CompleteResponseEvent extends Event { private var _response:String; public static const COMPLETE_RESPONSE:String = "completeResponse"; ; public function CompleteResponseEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) { super(type, bubbles, cancelable); } public function set response(response:String):void { this._response = response; } public function get response():String { return this._response; } public override function clone():Event { var out:CompleteResponseEvent = new CompleteResponseEvent(type, bubbles, cancelable); out.response = _response; return out; } } }
package flare.query { /** * Aggregate operator for computing the maximum of a set of values. */ public class Maximum extends AggregateExpression { private var _value:Object = null; /** * Creates a new Maximum operator * @param input the sub-expression of which to compute the maximum */ public function Maximum(input:*) { super(input); } /** * @inheritDoc */ public override function eval(o:Object=null):* { return _value; } /** * @inheritDoc */ public override function reset():void { _value = null; } /** * @inheritDoc */ public override function aggregate(value:Object):void { value = _expr.eval(value); if (_value == null || value > _value) { _value = value; } } } // end of class Maximum }
//////////////////////////////////////////////////////////////////////////////// // // 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.managers { //import flash.display.DisplayObject; //import mx.core.IFlexModuleFactory; //import mx.core.Singleton; import mx.core.IFlexDisplayObject; /** * The PopUpManager singleton class creates new top-level windows and * places or removes those windows from the layer on top of all other * visible windows. See the SystemManager for a description of the layering. * It is used for popup dialogs, menus, and dropdowns in the ComboBox control * and in similar components. * * <p>The PopUpManager also provides modality, so that windows below the popup * cannot receive mouse events, and also provides an event if the user clicks * the mouse outside the window so the developer can choose to dismiss * the window or warn the user.</p> * * @see PopUpManagerChildList * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class PopUpManager { // include "../core/Version.as"; //-------------------------------------------------------------------------- // // Class variables // //-------------------------------------------------------------------------- /** * @private * Linker dependency on implementation class. */ // private static var implClassDependency:PopUpManagerImpl; /** * @private * Storage for the impl getter. * This gets initialized on first access, * not at static initialization time, in order to ensure * that the Singleton registry has already been initialized. */ // private static var _impl:IPopUpManager; //-------------------------------------------------------------------------- // // Class methods // //-------------------------------------------------------------------------- /** * Creates a top-level window and places it above other windows in the * z-order. * It is good practice to call the <code>removePopUp()</code> method * to remove popups created by using the <code>createPopUp()</code> method. * * If the class implements IFocusManagerContainer, the window will have its * own FocusManager so that, if the user uses the TAB key to navigate between * controls, only the controls in the window will be accessed. * * <p><b>Example</b></p> * * <pre>pop = mx.managers.PopUpManager.createPopUp(pnl, TitleWindow, false); </pre> * * <p>Creates a popup window based on the TitleWindow class, using <code>pnl</code> as the MovieClip * for determining where to place the popup. It is defined to be a non-modal window * meaning that other windows can receive mouse events</p> * * @param parent DisplayObject to be used for determining which SystemManager's layers * to use and optionally the reference point for centering the new * top level window. It may not be the actual parent of the popup as all popups * are parented by the SystemManager. * * @param className Class of object that is to be created for the popup. * The class must implement IFlexDisplayObject. * * @param modal If <code>true</code>, the window is modal which means that * the user will not be able to interact with other popups until the window * is removed. * * @param childList The child list in which to add the popup. * One of <code>PopUpManagerChildList.APPLICATION</code>, * <code>PopUpManagerChildList.POPUP</code>, * or <code>PopUpManagerChildList.PARENT</code> (default). * * @param moduleFactory The moduleFactory where this pop-up should look for * its embedded fonts and style manager. * * @return Reference to new top-level window. * * @see PopUpManagerChildList * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static function createPopUp(parent:Object, //DisplayObject, className:Class, modal:Boolean = false, childList:String = null, moduleFactory:Object = null):Object //IFlexModuleFactory = null):IFlexDisplayObject { return null; //impl.createPopUp(parent, className, modal, childList, moduleFactory); } /** * Pops up a top-level window. * It is good practice to call <code>removePopUp()</code> to remove popups * created by using the <code>addPopUp()</code> method. * If the class implements IFocusManagerContainer, the window will have its * own FocusManager so that, if the user uses the TAB key to navigate between * controls, only the controls in the window will be accessed. * * <p><b>Example</b></p> * * <pre>var tw:TitleWindow = new TitleWindow(); * tw.title = "My Title"; * mx.managers.PopUpManager.addPopUp(tw, pnl, false);</pre> * * <p>Creates a popup window using the <code>tw</code> instance of the * TitleWindow class and <code>pnl</code> as the Sprite for determining * where to place the popup. * It is defined to be a non-modal window.</p> * * @param window The IFlexDisplayObject to be popped up. * * @param parent DisplayObject to be used for determining which SystemManager's layers * to use and optionally the reference point for centering the new * top level window. It may not be the actual parent of the popup as all popups * are parented by the SystemManager. * * @param modal If <code>true</code>, the window is modal which means that * the user will not be able to interact with other popups until the window * is removed. * * @param childList The child list in which to add the pop-up. * One of <code>PopUpManagerChildList.APPLICATION</code>, * <code>PopUpManagerChildList.POPUP</code>, * or <code>PopUpManagerChildList.PARENT</code> (default). * * @param moduleFactory The moduleFactory where this pop-up should look for * its embedded fonts and style manager. * * @see PopUpManagerChildList * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static function addPopUp(window:IFlexDisplayObject, parent:Object, //DisplayObject, modal:Boolean = false, childList:String = null, moduleFactory:Object = null):void //IFlexModuleFactory = null):void { //impl.addPopUp(window, parent, modal, childList, moduleFactory); } /** * Centers a popup window over whatever window was used in the call * to the <code>createPopUp()</code> or <code>addPopUp()</code> method. * * <p>Note that the position of the popup window may not * change immediately after this call since Flex may wait to measure and layout the * popup window before centering it.</p> * * @param The IFlexDisplayObject representing the popup. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static function centerPopUp(popUp:IFlexDisplayObject):void { //impl.centerPopUp(popUp); } /** * Removes a popup window popped up by * the <code>createPopUp()</code> or <code>addPopUp()</code> method. * * @param window The IFlexDisplayObject representing the popup window. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static function removePopUp(popUp:IFlexDisplayObject):void { //impl.removePopUp(popUp); } } // class } // package
package serverProto.user { import com.netease.protobuf.Message; import com.netease.protobuf.fieldDescriptors.FieldDescriptor$TYPE_INT32; import com.netease.protobuf.fieldDescriptors.FieldDescriptor$TYPE_MESSAGE; import com.netease.protobuf.fieldDescriptors.FieldDescriptor$TYPE_SINT32; import com.netease.protobuf.WireType; import com.netease.protobuf.WritingBuffer; import com.netease.protobuf.WriteUtils; import flash.utils.IDataInput; import com.netease.protobuf.ReadUtils; import flash.errors.IOError; public final class ProtoNinjaPropertyInfo extends Message { public static const CURRENT_HP:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("serverProto.user.ProtoNinjaPropertyInfo.current_hp","currentHp",1 << 3 | WireType.VARINT); public static const HP_ULIMIT:FieldDescriptor$TYPE_MESSAGE = new FieldDescriptor$TYPE_MESSAGE("serverProto.user.ProtoNinjaPropertyInfo.hp_ulimit","hpUlimit",2 << 3 | WireType.LENGTH_DELIMITED,ProtoNinjaPropertyComposeInfo); public static const BODY_ATTACK:FieldDescriptor$TYPE_MESSAGE = new FieldDescriptor$TYPE_MESSAGE("serverProto.user.ProtoNinjaPropertyInfo.body_attack","bodyAttack",3 << 3 | WireType.LENGTH_DELIMITED,ProtoNinjaPropertyComposeInfo); public static const BODY_DEFENSE:FieldDescriptor$TYPE_MESSAGE = new FieldDescriptor$TYPE_MESSAGE("serverProto.user.ProtoNinjaPropertyInfo.body_defense","bodyDefense",4 << 3 | WireType.LENGTH_DELIMITED,ProtoNinjaPropertyComposeInfo); public static const NINJA_ATTACK:FieldDescriptor$TYPE_MESSAGE = new FieldDescriptor$TYPE_MESSAGE("serverProto.user.ProtoNinjaPropertyInfo.ninja_attack","ninjaAttack",5 << 3 | WireType.LENGTH_DELIMITED,ProtoNinjaPropertyComposeInfo); public static const NINJA_DEFENSE:FieldDescriptor$TYPE_MESSAGE = new FieldDescriptor$TYPE_MESSAGE("serverProto.user.ProtoNinjaPropertyInfo.ninja_defense","ninjaDefense",6 << 3 | WireType.LENGTH_DELIMITED,ProtoNinjaPropertyComposeInfo); public static const GROWTH_HP:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.growth_hp","growthHp",7 << 3 | WireType.VARINT); public static const GROWTH_BODY_ATTACK:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.growth_body_attack","growthBodyAttack",8 << 3 | WireType.VARINT); public static const GROWTH_BODY_DEFENSE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.growth_body_defense","growthBodyDefense",9 << 3 | WireType.VARINT); public static const GROWTH_NINJA_ATTACK:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.growth_ninja_attack","growthNinjaAttack",10 << 3 | WireType.VARINT); public static const GROWTH_NINJA_DEFENSE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.growth_ninja_defense","growthNinjaDefense",11 << 3 | WireType.VARINT); public static const CRIT_VALUE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.crit_value","critValue",12 << 3 | WireType.VARINT); public static const CRIT_DAMAGE_VALUE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.crit_damage_value","critDamageValue",13 << 3 | WireType.VARINT); public static const SPEED:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.speed","speed",14 << 3 | WireType.VARINT); public static const COMBO_VALUE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.combo_value","comboValue",15 << 3 | WireType.VARINT); public static const CONTROL_VALUE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.control_value","controlValue",16 << 3 | WireType.VARINT); public static const BODY_PENETRATE_VALUE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.body_penetrate_value","bodyPenetrateValue",17 << 3 | WireType.VARINT); public static const NINJA_PENETRATE_VALUE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.ninja_penetrate_value","ninjaPenetrateValue",18 << 3 | WireType.VARINT); public static const DAMAGE_REDUCE_VALUE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.damage_reduce_value","damageReduceValue",19 << 3 | WireType.VARINT); public static const HP_RESTORE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.hp_restore","hpRestore",20 << 3 | WireType.VARINT); public static const FIRE_RESIST:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.fire_resist","fireResist",21 << 3 | WireType.VARINT); public static const WIND_RESIST:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.wind_resist","windResist",22 << 3 | WireType.VARINT); public static const THUNDER_RESIST:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.thunder_resist","thunderResist",23 << 3 | WireType.VARINT); public static const EARTH_RESIST:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.earth_resist","earthResist",24 << 3 | WireType.VARINT); public static const WATER_RESIST:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.user.ProtoNinjaPropertyInfo.water_resist","waterResist",25 << 3 | WireType.VARINT); private var current_hp$field:int; private var hasField$0:uint = 0; private var hp_ulimit$field:serverProto.user.ProtoNinjaPropertyComposeInfo; private var body_attack$field:serverProto.user.ProtoNinjaPropertyComposeInfo; private var body_defense$field:serverProto.user.ProtoNinjaPropertyComposeInfo; private var ninja_attack$field:serverProto.user.ProtoNinjaPropertyComposeInfo; private var ninja_defense$field:serverProto.user.ProtoNinjaPropertyComposeInfo; private var growth_hp$field:int; private var growth_body_attack$field:int; private var growth_body_defense$field:int; private var growth_ninja_attack$field:int; private var growth_ninja_defense$field:int; private var crit_value$field:int; private var crit_damage_value$field:int; private var speed$field:int; private var combo_value$field:int; private var control_value$field:int; private var body_penetrate_value$field:int; private var ninja_penetrate_value$field:int; private var damage_reduce_value$field:int; private var hp_restore$field:int; private var fire_resist$field:int; private var wind_resist$field:int; private var thunder_resist$field:int; private var earth_resist$field:int; private var water_resist$field:int; public function ProtoNinjaPropertyInfo() { super(); } public function clearCurrentHp() : void { this.hasField$0 = this.hasField$0 & 4.294967294E9; this.current_hp$field = new int(); } public function get hasCurrentHp() : Boolean { return (this.hasField$0 & 1) != 0; } public function set currentHp(param1:int) : void { this.hasField$0 = this.hasField$0 | 1; this.current_hp$field = param1; } public function get currentHp() : int { return this.current_hp$field; } public function clearHpUlimit() : void { this.hp_ulimit$field = null; } public function get hasHpUlimit() : Boolean { return this.hp_ulimit$field != null; } public function set hpUlimit(param1:serverProto.user.ProtoNinjaPropertyComposeInfo) : void { this.hp_ulimit$field = param1; } public function get hpUlimit() : serverProto.user.ProtoNinjaPropertyComposeInfo { return this.hp_ulimit$field; } public function clearBodyAttack() : void { this.body_attack$field = null; } public function get hasBodyAttack() : Boolean { return this.body_attack$field != null; } public function set bodyAttack(param1:serverProto.user.ProtoNinjaPropertyComposeInfo) : void { this.body_attack$field = param1; } public function get bodyAttack() : serverProto.user.ProtoNinjaPropertyComposeInfo { return this.body_attack$field; } public function clearBodyDefense() : void { this.body_defense$field = null; } public function get hasBodyDefense() : Boolean { return this.body_defense$field != null; } public function set bodyDefense(param1:serverProto.user.ProtoNinjaPropertyComposeInfo) : void { this.body_defense$field = param1; } public function get bodyDefense() : serverProto.user.ProtoNinjaPropertyComposeInfo { return this.body_defense$field; } public function clearNinjaAttack() : void { this.ninja_attack$field = null; } public function get hasNinjaAttack() : Boolean { return this.ninja_attack$field != null; } public function set ninjaAttack(param1:serverProto.user.ProtoNinjaPropertyComposeInfo) : void { this.ninja_attack$field = param1; } public function get ninjaAttack() : serverProto.user.ProtoNinjaPropertyComposeInfo { return this.ninja_attack$field; } public function clearNinjaDefense() : void { this.ninja_defense$field = null; } public function get hasNinjaDefense() : Boolean { return this.ninja_defense$field != null; } public function set ninjaDefense(param1:serverProto.user.ProtoNinjaPropertyComposeInfo) : void { this.ninja_defense$field = param1; } public function get ninjaDefense() : serverProto.user.ProtoNinjaPropertyComposeInfo { return this.ninja_defense$field; } public function clearGrowthHp() : void { this.hasField$0 = this.hasField$0 & 4.294967293E9; this.growth_hp$field = new int(); } public function get hasGrowthHp() : Boolean { return (this.hasField$0 & 2) != 0; } public function set growthHp(param1:int) : void { this.hasField$0 = this.hasField$0 | 2; this.growth_hp$field = param1; } public function get growthHp() : int { return this.growth_hp$field; } public function clearGrowthBodyAttack() : void { this.hasField$0 = this.hasField$0 & 4.294967291E9; this.growth_body_attack$field = new int(); } public function get hasGrowthBodyAttack() : Boolean { return (this.hasField$0 & 4) != 0; } public function set growthBodyAttack(param1:int) : void { this.hasField$0 = this.hasField$0 | 4; this.growth_body_attack$field = param1; } public function get growthBodyAttack() : int { return this.growth_body_attack$field; } public function clearGrowthBodyDefense() : void { this.hasField$0 = this.hasField$0 & 4.294967287E9; this.growth_body_defense$field = new int(); } public function get hasGrowthBodyDefense() : Boolean { return (this.hasField$0 & 8) != 0; } public function set growthBodyDefense(param1:int) : void { this.hasField$0 = this.hasField$0 | 8; this.growth_body_defense$field = param1; } public function get growthBodyDefense() : int { return this.growth_body_defense$field; } public function clearGrowthNinjaAttack() : void { this.hasField$0 = this.hasField$0 & 4.294967279E9; this.growth_ninja_attack$field = new int(); } public function get hasGrowthNinjaAttack() : Boolean { return (this.hasField$0 & 16) != 0; } public function set growthNinjaAttack(param1:int) : void { this.hasField$0 = this.hasField$0 | 16; this.growth_ninja_attack$field = param1; } public function get growthNinjaAttack() : int { return this.growth_ninja_attack$field; } public function clearGrowthNinjaDefense() : void { this.hasField$0 = this.hasField$0 & 4.294967263E9; this.growth_ninja_defense$field = new int(); } public function get hasGrowthNinjaDefense() : Boolean { return (this.hasField$0 & 32) != 0; } public function set growthNinjaDefense(param1:int) : void { this.hasField$0 = this.hasField$0 | 32; this.growth_ninja_defense$field = param1; } public function get growthNinjaDefense() : int { return this.growth_ninja_defense$field; } public function clearCritValue() : void { this.hasField$0 = this.hasField$0 & 4.294967231E9; this.crit_value$field = new int(); } public function get hasCritValue() : Boolean { return (this.hasField$0 & 64) != 0; } public function set critValue(param1:int) : void { this.hasField$0 = this.hasField$0 | 64; this.crit_value$field = param1; } public function get critValue() : int { return this.crit_value$field; } public function clearCritDamageValue() : void { this.hasField$0 = this.hasField$0 & 4.294967167E9; this.crit_damage_value$field = new int(); } public function get hasCritDamageValue() : Boolean { return (this.hasField$0 & 128) != 0; } public function set critDamageValue(param1:int) : void { this.hasField$0 = this.hasField$0 | 128; this.crit_damage_value$field = param1; } public function get critDamageValue() : int { return this.crit_damage_value$field; } public function clearSpeed() : void { this.hasField$0 = this.hasField$0 & 4.294967039E9; this.speed$field = new int(); } public function get hasSpeed() : Boolean { return (this.hasField$0 & 256) != 0; } public function set speed(param1:int) : void { this.hasField$0 = this.hasField$0 | 256; this.speed$field = param1; } public function get speed() : int { return this.speed$field; } public function clearComboValue() : void { this.hasField$0 = this.hasField$0 & 4.294966783E9; this.combo_value$field = new int(); } public function get hasComboValue() : Boolean { return (this.hasField$0 & 512) != 0; } public function set comboValue(param1:int) : void { this.hasField$0 = this.hasField$0 | 512; this.combo_value$field = param1; } public function get comboValue() : int { return this.combo_value$field; } public function clearControlValue() : void { this.hasField$0 = this.hasField$0 & 4.294966271E9; this.control_value$field = new int(); } public function get hasControlValue() : Boolean { return (this.hasField$0 & 1024) != 0; } public function set controlValue(param1:int) : void { this.hasField$0 = this.hasField$0 | 1024; this.control_value$field = param1; } public function get controlValue() : int { return this.control_value$field; } public function clearBodyPenetrateValue() : void { this.hasField$0 = this.hasField$0 & 4.294965247E9; this.body_penetrate_value$field = new int(); } public function get hasBodyPenetrateValue() : Boolean { return (this.hasField$0 & 2048) != 0; } public function set bodyPenetrateValue(param1:int) : void { this.hasField$0 = this.hasField$0 | 2048; this.body_penetrate_value$field = param1; } public function get bodyPenetrateValue() : int { return this.body_penetrate_value$field; } public function clearNinjaPenetrateValue() : void { this.hasField$0 = this.hasField$0 & 4.294963199E9; this.ninja_penetrate_value$field = new int(); } public function get hasNinjaPenetrateValue() : Boolean { return (this.hasField$0 & 4096) != 0; } public function set ninjaPenetrateValue(param1:int) : void { this.hasField$0 = this.hasField$0 | 4096; this.ninja_penetrate_value$field = param1; } public function get ninjaPenetrateValue() : int { return this.ninja_penetrate_value$field; } public function clearDamageReduceValue() : void { this.hasField$0 = this.hasField$0 & 4.294959103E9; this.damage_reduce_value$field = new int(); } public function get hasDamageReduceValue() : Boolean { return (this.hasField$0 & 8192) != 0; } public function set damageReduceValue(param1:int) : void { this.hasField$0 = this.hasField$0 | 8192; this.damage_reduce_value$field = param1; } public function get damageReduceValue() : int { return this.damage_reduce_value$field; } public function clearHpRestore() : void { this.hasField$0 = this.hasField$0 & 4.294950911E9; this.hp_restore$field = new int(); } public function get hasHpRestore() : Boolean { return (this.hasField$0 & 16384) != 0; } public function set hpRestore(param1:int) : void { this.hasField$0 = this.hasField$0 | 16384; this.hp_restore$field = param1; } public function get hpRestore() : int { return this.hp_restore$field; } public function clearFireResist() : void { this.hasField$0 = this.hasField$0 & 4.294934527E9; this.fire_resist$field = new int(); } public function get hasFireResist() : Boolean { return (this.hasField$0 & 32768) != 0; } public function set fireResist(param1:int) : void { this.hasField$0 = this.hasField$0 | 32768; this.fire_resist$field = param1; } public function get fireResist() : int { return this.fire_resist$field; } public function clearWindResist() : void { this.hasField$0 = this.hasField$0 & 4.294901759E9; this.wind_resist$field = new int(); } public function get hasWindResist() : Boolean { return (this.hasField$0 & 65536) != 0; } public function set windResist(param1:int) : void { this.hasField$0 = this.hasField$0 | 65536; this.wind_resist$field = param1; } public function get windResist() : int { return this.wind_resist$field; } public function clearThunderResist() : void { this.hasField$0 = this.hasField$0 & 4.294836223E9; this.thunder_resist$field = new int(); } public function get hasThunderResist() : Boolean { return (this.hasField$0 & 131072) != 0; } public function set thunderResist(param1:int) : void { this.hasField$0 = this.hasField$0 | 131072; this.thunder_resist$field = param1; } public function get thunderResist() : int { return this.thunder_resist$field; } public function clearEarthResist() : void { this.hasField$0 = this.hasField$0 & 4.294705151E9; this.earth_resist$field = new int(); } public function get hasEarthResist() : Boolean { return (this.hasField$0 & 262144) != 0; } public function set earthResist(param1:int) : void { this.hasField$0 = this.hasField$0 | 262144; this.earth_resist$field = param1; } public function get earthResist() : int { return this.earth_resist$field; } public function clearWaterResist() : void { this.hasField$0 = this.hasField$0 & 4.294443007E9; this.water_resist$field = new int(); } public function get hasWaterResist() : Boolean { return (this.hasField$0 & 524288) != 0; } public function set waterResist(param1:int) : void { this.hasField$0 = this.hasField$0 | 524288; this.water_resist$field = param1; } public function get waterResist() : int { return this.water_resist$field; } override final function writeToBuffer(param1:WritingBuffer) : void { var _loc2_:* = undefined; if(this.hasCurrentHp) { WriteUtils.writeTag(param1,WireType.VARINT,1); WriteUtils.write$TYPE_INT32(param1,this.current_hp$field); } if(this.hasHpUlimit) { WriteUtils.writeTag(param1,WireType.LENGTH_DELIMITED,2); WriteUtils.write$TYPE_MESSAGE(param1,this.hp_ulimit$field); } if(this.hasBodyAttack) { WriteUtils.writeTag(param1,WireType.LENGTH_DELIMITED,3); WriteUtils.write$TYPE_MESSAGE(param1,this.body_attack$field); } if(this.hasBodyDefense) { WriteUtils.writeTag(param1,WireType.LENGTH_DELIMITED,4); WriteUtils.write$TYPE_MESSAGE(param1,this.body_defense$field); } if(this.hasNinjaAttack) { WriteUtils.writeTag(param1,WireType.LENGTH_DELIMITED,5); WriteUtils.write$TYPE_MESSAGE(param1,this.ninja_attack$field); } if(this.hasNinjaDefense) { WriteUtils.writeTag(param1,WireType.LENGTH_DELIMITED,6); WriteUtils.write$TYPE_MESSAGE(param1,this.ninja_defense$field); } if(this.hasGrowthHp) { WriteUtils.writeTag(param1,WireType.VARINT,7); WriteUtils.write$TYPE_SINT32(param1,this.growth_hp$field); } if(this.hasGrowthBodyAttack) { WriteUtils.writeTag(param1,WireType.VARINT,8); WriteUtils.write$TYPE_SINT32(param1,this.growth_body_attack$field); } if(this.hasGrowthBodyDefense) { WriteUtils.writeTag(param1,WireType.VARINT,9); WriteUtils.write$TYPE_SINT32(param1,this.growth_body_defense$field); } if(this.hasGrowthNinjaAttack) { WriteUtils.writeTag(param1,WireType.VARINT,10); WriteUtils.write$TYPE_SINT32(param1,this.growth_ninja_attack$field); } if(this.hasGrowthNinjaDefense) { WriteUtils.writeTag(param1,WireType.VARINT,11); WriteUtils.write$TYPE_SINT32(param1,this.growth_ninja_defense$field); } if(this.hasCritValue) { WriteUtils.writeTag(param1,WireType.VARINT,12); WriteUtils.write$TYPE_SINT32(param1,this.crit_value$field); } if(this.hasCritDamageValue) { WriteUtils.writeTag(param1,WireType.VARINT,13); WriteUtils.write$TYPE_SINT32(param1,this.crit_damage_value$field); } if(this.hasSpeed) { WriteUtils.writeTag(param1,WireType.VARINT,14); WriteUtils.write$TYPE_SINT32(param1,this.speed$field); } if(this.hasComboValue) { WriteUtils.writeTag(param1,WireType.VARINT,15); WriteUtils.write$TYPE_SINT32(param1,this.combo_value$field); } if(this.hasControlValue) { WriteUtils.writeTag(param1,WireType.VARINT,16); WriteUtils.write$TYPE_SINT32(param1,this.control_value$field); } if(this.hasBodyPenetrateValue) { WriteUtils.writeTag(param1,WireType.VARINT,17); WriteUtils.write$TYPE_SINT32(param1,this.body_penetrate_value$field); } if(this.hasNinjaPenetrateValue) { WriteUtils.writeTag(param1,WireType.VARINT,18); WriteUtils.write$TYPE_SINT32(param1,this.ninja_penetrate_value$field); } if(this.hasDamageReduceValue) { WriteUtils.writeTag(param1,WireType.VARINT,19); WriteUtils.write$TYPE_SINT32(param1,this.damage_reduce_value$field); } if(this.hasHpRestore) { WriteUtils.writeTag(param1,WireType.VARINT,20); WriteUtils.write$TYPE_SINT32(param1,this.hp_restore$field); } if(this.hasFireResist) { WriteUtils.writeTag(param1,WireType.VARINT,21); WriteUtils.write$TYPE_SINT32(param1,this.fire_resist$field); } if(this.hasWindResist) { WriteUtils.writeTag(param1,WireType.VARINT,22); WriteUtils.write$TYPE_SINT32(param1,this.wind_resist$field); } if(this.hasThunderResist) { WriteUtils.writeTag(param1,WireType.VARINT,23); WriteUtils.write$TYPE_SINT32(param1,this.thunder_resist$field); } if(this.hasEarthResist) { WriteUtils.writeTag(param1,WireType.VARINT,24); WriteUtils.write$TYPE_SINT32(param1,this.earth_resist$field); } if(this.hasWaterResist) { WriteUtils.writeTag(param1,WireType.VARINT,25); WriteUtils.write$TYPE_SINT32(param1,this.water_resist$field); } for(_loc2_ in this) { super.writeUnknown(param1,_loc2_); } } override final function readFromSlice(param1:IDataInput, param2:uint) : void { /* * Decompilation error * Code may be obfuscated * Tip: You can try enabling "Automatic deobfuscation" in Settings * Error type: IndexOutOfBoundsException (Index: 25, Size: 25) */ throw new flash.errors.IllegalOperationError("Not decompiled due to error"); } } }
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009 Team Axiis // // 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.axiis.layouts.scale { import flash.events.Event; /** * A scale that converts logarithmic data to layout space. */ public class LogScale extends ContinuousScale implements IScale { public function LogScale() { super(); base = 10; } private var logOfBase:Number; [Bindable(event="baseChange")] /** * The base of the logarithm used in the scale */ public function get base():Number { return _base; } public function set base(value:Number):void { if(value != _base) { _base = value; logOfBase = Math.log(_base); invalidate(); dispatchEvent(new Event("baseChange")); } } private var _base:Number; /** * @inheritDoc IScale#valueToLayout */ public function valueToLayout(value:*,invert:Boolean=false,clamp:Boolean = false):* { //Commented out 2 lines below as some of the layouts call this at component initialization when they do not have valid values //Tg 10/1/09 //if(!(value is Number)) // throw new Error("To use valueToLayout the value parameter must be a Number"); if(invalidated) validate(); // We offset the min, max, and value so the new minimum is at 1 and the scale factor remains the same. var logMinValue:Number = Math.log(1) / logOfBase; var logMaxValue:Number = Math.log(maxValue - minValue + 1) / logOfBase; var logValue:Number = Math.log(value - minValue + 1) / logOfBase; var percent:Number = ScaleUtils.inverseLerp(logValue,logMinValue,logMaxValue); if(invert) percent = 1 - percent; if(clamp) percent = Math.max(0,Math.min(1,percent)); var toReturn:Number = ScaleUtils.lerp(percent,minLayout,maxLayout); //trace("base =",base,"logOfBase =",logOfBase,"value =",value,"logValue =",logValue,"% =",percent,"toReturn =",toReturn); return toReturn; } /** * @inheritDoc IScale#layoutToValue */ public function layoutToValue(layout:*,invert:Boolean = false,clamp:Boolean = false):* { if(!(layout is Number)) throw new Error("To use layoutToValue the layout parameter must be a Number"); if (invalidated) validate(); var percent:Number = ScaleUtils.inverseLerp(layout,minLayout,maxLayout); if(invert) percent = 1 - percent; if(clamp) percent = Math.max(0,Math.min(1,percent)); percent = Math.pow(percent,base); var toReturn:Number = ScaleUtils.lerp(percent,minValue,maxValue); return toReturn; } } }
package net.anirudh.as3syntaxhighlight { import mx.managers.ISystemManager; public class CodePrettyPrint { private var PR_TAB_WIDTH:int = 8; private var PR_NOCODE:String = 'nocode'; private function wordSet(words:Object):Object { words = words.split(/ /g); var set:Object = {}; for (var i:int = words.length; --i >= 0;) { var w:Object = words[i]; if (w) { set[w] = null; } } return set; } private var pr_amp:RegExp = new RegExp("/&/g"); private var pr_lt:RegExp = new RegExp("/</g"); private var pr_gt:RegExp = new RegExp("/>/g"); private var pr_quot:RegExp = new RegExp("\\\"", "g"); private function attribToHtml(str:String):String { return str.replace(pr_amp, '&amp;') .replace(pr_lt, '&lt;') .replace(pr_gt, '&gt;') .replace(pr_quot, '&quot;'); } public function textToHtml(str:String):String { return str.replace(pr_amp, '&amp;') .replace(pr_lt, '&lt;') .replace(pr_gt, '&gt;'); } private var pr_ltEnt:RegExp = /&lt;/g; private var pr_gtEnt:RegExp = /&gt;/g; private var pr_aposEnt:RegExp = /&apos;/g; private var pr_quotEnt:RegExp = /&quot;/g; private var pr_ampEnt:RegExp = /&amp;/g; private var pr_nbspEnt:RegExp = /&nbsp;/g; private function htmlToText(html:String):String { var pos:int = html.indexOf('&'); if (pos < 0) { return html; } for (--pos; (pos = html.indexOf('&#', pos + 1)) >= 0;) { var end:int = html.indexOf(';', pos); if (end >= 0) { var num:String = html.substring(pos + 3, end); var radix:int = 10; if (num && num.charAt(0) === 'x') { num = num.substring(1); radix = 16; } var codePoint:Number = parseInt(num, radix); if (!isNaN(codePoint)) { html = (html.substring(0, pos) + String.fromCharCode(codePoint) + html.substring(end + 1)); } } } return html.replace(pr_ltEnt, '<') .replace(pr_gtEnt, '>') .replace(pr_aposEnt, "'") .replace(pr_quotEnt, '"') .replace(pr_ampEnt, '&') .replace(pr_nbspEnt, ' '); } private static var FLOW_CONTROL_KEYWORDS:String = "break continue do else for if return while "; private static var C_KEYWORDS:String = FLOW_CONTROL_KEYWORDS + "auto case char const default " + "double enum extern float goto int long register short signed sizeof " + "static struct switch typedef union unsigned void volatile "; private static var COMMON_KEYWORDS:String = C_KEYWORDS + "catch class delete false import " + "new operator private protected public this throw true try "; private static var CPP_KEYWORDS:String = COMMON_KEYWORDS + "alignof align_union asm axiom bool " + "concept concept_map const_cast constexpr decltype " + "dynamic_cast explicit export friend inline late_check " + "mutable namespace nullptr reinterpret_cast static_assert static_cast " + "template typeid typename typeof using virtual wchar_t where "; private static var JAVA_KEYWORDS:String = COMMON_KEYWORDS + "boolean byte extends final finally implements import instanceof null " + "native package strictfp super synchronized throws transient "; private static var CSHARP_KEYWORDS:String = JAVA_KEYWORDS + "as base by checked decimal delegate descending event " + "fixed foreach from group implicit in interface internal into is lock " + "object out override orderby params readonly ref sbyte sealed " + "stackalloc string select uint ulong unchecked unsafe ushort var "; private static var JSCRIPT_KEYWORDS:String = COMMON_KEYWORDS + "debugger eval export function get null set undefined var with " + "Infinity NaN "; private static var PERL_KEYWORDS:String = "caller delete die do dump elsif eval exit foreach for " + "goto if import last local my next no our print package redo require " + "sub undef unless until use wantarray while BEGIN END "; private static var PYTHON_KEYWORDS:String = FLOW_CONTROL_KEYWORDS + "and as assert class def del " + "elif except exec finally from global import in is lambda " + "nonlocal not or pass print raise try with yield " + "False True None "; private static var RUBY_KEYWORDS:String = FLOW_CONTROL_KEYWORDS + "alias and begin case class def" + " defined elsif end ensure false in module next nil not or redo rescue " + "retry self super then true undef unless until when yield BEGIN END "; private static var SH_KEYWORDS:String = FLOW_CONTROL_KEYWORDS + "case done elif esac eval fi " + "function in local set then until "; private static var ALL_KEYWORDS:String = ( CPP_KEYWORDS + CSHARP_KEYWORDS + JSCRIPT_KEYWORDS + PERL_KEYWORDS + PYTHON_KEYWORDS + RUBY_KEYWORDS + SH_KEYWORDS); private static var PR_STRING:String = 'str'; private static var PR_KEYWORD:String = 'kwd'; private static var PR_COMMENT:String = 'com'; private static var PR_TYPE:String = 'typ'; private static var PR_LITERAL:String = 'lit'; private static var PR_PUNCTUATION:String = 'pun'; private static var PR_PLAIN:String = 'pln'; private static var PR_TAG:String = 'tag'; private static var PR_DECLARATION:String = 'dec'; private static var PR_SOURCE:String = 'src'; private static var PR_ATTRIB_NAME:String = 'atn'; private static var PR_ATTRIB_VALUE:String = 'atv'; private static function isWordChar(ch:String):Boolean { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); } private function spliceArrayInto(inserted:Array, container:Array, containerPosition:Number, countReplaced:Number):void { inserted.unshift(containerPosition, countReplaced || 0); try { container.splice.apply(container, inserted); } finally { inserted.splice(0, 2); } } private static function regexpPrecederPattern():RegExp { var preceders:Array = ["!", "!=", "!==", "#", "%", "%=", "&", "&&", "&&=", "&=", "(", "*", "*=", "+=", ",", "-=", "->", "/", "/=", ":", "::", ";", "<", "<<", "<<=", "<=", "=", "==", "===", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[", "^", "^=", "^^", "^^=", "{", "|", "|=", "||", "||=", "~", "break", "case", "continue", "delete", "do", "else", "finally", "instanceof", "return", "throw", "try", "typeof"]; var pattern:String = '(?:' + '(?:(?:^|[^0-9.])\\.{1,3})|' + '(?:(?:^|[^\\+])\\+)|' + '(?:(?:^|[^\\-])-)'; for (var i:int = 0; i < preceders.length; ++i) { var preceder:String = preceders[i]; if (isWordChar(preceder.charAt(0))) { pattern += '|\\b' + preceder; } else { pattern += '|' + preceder.replace(/([^=<>:&])/g, '\\$1'); } } pattern += '|^)\\s*$'; return new RegExp(pattern); } private static var REGEXP_PRECEDER_PATTERN:Function = regexpPrecederPattern; private static var pr_chunkPattern:RegExp = /(?:[^<]+|<!--[\s\S]*?-->|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g; private static var pr_commentPrefix:RegExp = /^<!--/; private static var pr_cdataPrefix:RegExp = /^<\[CDATA\[/; private static var pr_brPrefix:RegExp = /^<br\b/i; private static var pr_tagNameRe:RegExp = /^<(\/?)([a-zA-Z]+)/; private function makeTabExpander(tabWidth:int):Function { var SPACES:String = ' '; var charInLine:int = 0; return function(plainText:String):String { var out:Array = null; var pos:int = 0; for (var i:int = 0, n:int = plainText.length; i < n; ++i) { var ch:String = plainText.charAt(i); switch (ch) { case '\t': if (!out) { out = []; } out.push(plainText.substring(pos, i)); var nSpaces:int = tabWidth - (charInLine % tabWidth); charInLine += nSpaces; for (; nSpaces >= 0; nSpaces -= SPACES.length) { out.push(SPACES.substring(0, nSpaces)); } pos = i + 1; break; case '\n': charInLine = 0; break; default: ++charInLine; } } if (!out) { return plainText; } out.push(plainText.substring(pos)); return out.join(''); }; } private function extractTags(s:String):Object { var matches:Array = s.match(pr_chunkPattern); var sourceBuf:Array = []; var sourceBufLen:int = 0; var extractedTags:Array = []; if (matches) { for (var i:int = 0, n:int = matches.length; i < n; ++i) { var match:String = matches[i]; if (match.length > 1 && match.charAt(0) === '<') { if (pr_commentPrefix.test(match)) { continue; } if (pr_cdataPrefix.test(match)) { sourceBuf.push(match.substring(9, match.length - 3)); sourceBufLen += match.length - 12; } else if (pr_brPrefix.test(match)) { sourceBuf.push('\n'); ++sourceBufLen; } else { if (match.indexOf(PR_NOCODE) >= 0 && isNoCodeTag(match)) { var name:String = match.match(pr_tagNameRe)[2]; var depth:int = 1; end_tag_loop: for (var j:int = i + 1; j < n; ++j) { var name2:Array = matches[j].match(pr_tagNameRe); if (name2 && name2[2] === name) { if (name2[1] === '/') { if (--depth === 0) { break end_tag_loop; } } else { ++depth; } } } if (j < n) { extractedTags.push(sourceBufLen, matches.slice(i, j + 1).join('')); i = j; } else { extractedTags.push(sourceBufLen, match); } } else { extractedTags.push(sourceBufLen, match); } } } else { var literalText:String = htmlToText(match); sourceBuf.push(literalText); sourceBufLen += literalText.length; } } } return {source:sourceBuf.join(''), tags:extractedTags}; } private function isNoCodeTag(tag:String):Boolean { return !!tag .replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g, ' $1="$2$3$4"') .match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/); } private function createSimpleLexer(shortcutStylePatterns:Array, fallthroughStylePatterns:Array):Function { var shortcuts:Object = {}; (function():void { var allPatterns:Array = shortcutStylePatterns.concat(fallthroughStylePatterns); for (var i:int = allPatterns.length; --i >= 0;) { var patternParts:Object = allPatterns[i]; var shortcutChars:Object = patternParts[3]; if (shortcutChars) { for (var c:int = shortcutChars.length; --c >= 0;) { shortcuts[shortcutChars.charAt(c)] = patternParts; } } } })(); var nPatterns:int = fallthroughStylePatterns.length; var notWs:RegExp = /\S/; return function(sourceCode:String, opt_basePos:int = 0):Array { opt_basePos = opt_basePos || 0; var decorations:Array = [opt_basePos, PR_PLAIN]; var lastToken:String = ''; var pos:int = 0; var tail:String = sourceCode; while (tail.length) { var style:String; var token:String = null; var match:Array; var patternParts:Array = shortcuts[tail.charAt(0)]; if (patternParts) { match = tail.match(patternParts[1]); token = match[0]; style = patternParts[0]; } else { for (var i:int = 0; i < nPatterns; ++i) { patternParts = fallthroughStylePatterns[i]; var contextPattern:RegExp = patternParts[2]; if (contextPattern && contextPattern is RegExp && !contextPattern.test(lastToken)) { continue; } match = tail.match(patternParts[1]); if (match) { token = match[0]; style = patternParts[0]; if ( token == "var" || token == "function" ) { style = "spl"; } break; } } if (!token) { style = PR_PLAIN; token = tail.substring(0, 1); } } decorations.push(opt_basePos + pos, style); pos += token.length; tail = tail.substring(token.length); if (style !== PR_COMMENT && notWs.test(token)) { lastToken = token; } } return decorations; }; } private var PR_MARKUP_LEXER:Function = createSimpleLexer([], [[PR_PLAIN, /^[^<]+/, null], [PR_DECLARATION, /^<!\w[^>]*(?:>|$)/, null], [PR_COMMENT, /^<!--[\s\S]*?(?:-->|$)/, null], [PR_SOURCE, /^<\?[\s\S]*?(?:\?>|$)/, null], [PR_SOURCE, /^<%[\s\S]*?(?:%>|$)/, null], [PR_SOURCE, /^<(script|style|xmp|mx\:Script)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i, null], [PR_TAG, /^<\/?\w[^<>]*>/, null]]); private var PR_SOURCE_CHUNK_PARTS:RegExp = /^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/; private function tokenizeMarkup(source:String):Array { var decorations:Array = PR_MARKUP_LEXER(source); for (var i:int = 0; i < decorations.length; i += 2) { if (decorations[i + 1] === PR_SOURCE) { var start:int, end:int; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var sourceChunk:String = (source as String).substring(start, end); var match:Array = sourceChunk.match(PR_SOURCE_CHUNK_PARTS); if ( match && match.length > 2 ) { decorations.splice(i, 2, start, PR_TAG, start + (match[1] as String).length, PR_SOURCE, start + (match[1] as String).length + ((match[2] as String) || '').length, PR_TAG); } } } return decorations; } private var PR_TAG_LEXER:Function = createSimpleLexer([[PR_ATTRIB_VALUE, /^\'[^\']*(?:\'|$)/, null, "'"], [PR_ATTRIB_VALUE, /^\"[^\"]*(?:\"|$)/, null, '"'], [PR_PUNCTUATION, /^[<>\/=]+/, null, '<>/=']], [[PR_TAG, /^[\w:\-]+/, /^</], [PR_ATTRIB_VALUE, /^[\w\-]+/, /^=/], [PR_ATTRIB_NAME, /^[\w:\-]+/, null], [PR_PLAIN, /^\s+/, null, ' \t\r\n']]); private function splitTagAttributes(source:String, decorations:Array):Array { for (var i:int = 0; i < decorations.length; i += 2) { var style:Object = decorations[i + 1]; if (style === PR_TAG) { var start:int, end:int; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var chunk:String = source.substring(start, end); var subDecorations:Array = PR_TAG_LEXER(chunk, start); spliceArrayInto(subDecorations, decorations, i, 2); i += subDecorations.length - 2; } } return decorations; } private function sourceDecorator(options:Object):Function { var shortcutStylePatterns:Array = [], fallthroughStylePatterns:Array = []; if (options.tripleQuotedStrings) { shortcutStylePatterns.push([PR_STRING, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, null, '\'"']); } else if (options.multiLineStrings) { shortcutStylePatterns.push([PR_STRING, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/, null, '\'"`']); } else { shortcutStylePatterns.push([PR_STRING, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, '"\'']); } fallthroughStylePatterns.push([PR_PLAIN, /^(?:[^\'\"\`\/\#]+)/, null, ' \r\n']); if (options.hashComments) { shortcutStylePatterns.push([PR_COMMENT, /^#[^\r\n]*/, null, '#']); } if (options.cStyleComments) { fallthroughStylePatterns.push([PR_COMMENT, /^\/\/[^\r\n]*/, null]); fallthroughStylePatterns.push([PR_COMMENT, /^\/\*[\s\S]*?(?:\*\/|$)/, null]); } if (options.regexLiterals) { var REGEX_LITERAL:String = ( '^/(?=[^/*])' + '(?:[^/\\x5B\\x5C\\x0A\\x0D]' + '|\\x5C[\\t \\S]' + '|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\t \\S])*(?:\\x5D|$))+' + '(?:/|$)'); fallthroughStylePatterns.push([PR_STRING, new RegExp(REGEX_LITERAL), REGEXP_PRECEDER_PATTERN]); } var keywords:Object = wordSet(options.keywords); options = null; var splitStringAndCommentTokens:Function = createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns); var styleLiteralIdentifierPuncRecognizer:Function = createSimpleLexer([], [[PR_PLAIN, /^\s+/, null, ' \r\n'], [PR_PLAIN, /^[a-z_$@][a-z_$@0-9]*/i, null], [PR_LITERAL, /^0x[a-f0-9]+[a-z]/i, null], [PR_LITERAL, /^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?[a-z]*/i, null, '123456789'], [PR_PUNCTUATION, /^[^\s\w\.$@]+/, null]]); function splitNonStringNonCommentTokens(source:String, decorations:Array):Array { for (var i:int = 0; i < decorations.length; i += 2) { var style:Object = decorations[i + 1]; if (style === PR_PLAIN) { var start:int, end:int, chunk:String, subDecs:Array; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; chunk = source.substring(start, end); subDecs = styleLiteralIdentifierPuncRecognizer(chunk, start); for (var j:int = 0, m:int = subDecs.length; j < m; j += 2) { var subStyle:String = subDecs[j + 1]; if (subStyle === PR_PLAIN) { var subStart:int = subDecs[j]; var subEnd:int = j + 2 < m ? subDecs[j + 2] : chunk.length; var token:String = source.substring(subStart, subEnd); if (token === '.') { subDecs[j + 1] = PR_PUNCTUATION; } else if (token in keywords) { subDecs[j + 1] = PR_KEYWORD; } else if (/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(token)) { subDecs[j + 1] = token.charAt(0) === '@' ? PR_LITERAL : PR_TYPE; } } } spliceArrayInto(subDecs, decorations, i, 2); i += subDecs.length - 2; } } return decorations; } return function(sourceCode:String):Array { var decorations:Array = splitStringAndCommentTokens(sourceCode); decorations = splitNonStringNonCommentTokens(sourceCode, decorations); return decorations; }; } private var decorateSource:Function = sourceDecorator({keywords:ALL_KEYWORDS, hashComments:true, cStyleComments:true, multiLineStrings:true, regexLiterals:true}); private function splitSourceNodes(source:String, decorations:Array):Array { for (var i:int = 0; i < decorations.length; i += 2) { var style:Object = decorations[i + 1]; if (style === PR_SOURCE) { var start:int, end:int; start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var subDecorations:Array = decorateSource(source.substring(start, end)); for (var j:int = 0, m:int = subDecorations.length; j < m; j += 2) { subDecorations[j] += start; } spliceArrayInto(subDecorations, decorations, i, 2); i += subDecorations.length - 2; } } return decorations; } private var quoteReg:RegExp = new RegExp("^[\\\"\\']", ""); private function splitSourceAttributes(source:String, decorations:Array):Array { var nextValueIsSource:Boolean = false; for (var i:int = 0; i < decorations.length; i += 2) { var style:Object = decorations[i + 1]; var start:int, end:int; if (style === PR_ATTRIB_NAME) { start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; nextValueIsSource = /^on|^style$/i.test(source.substring(start, end)); } else if (style === PR_ATTRIB_VALUE) { if (nextValueIsSource) { start = decorations[i]; end = i + 2 < decorations.length ? decorations[i + 2] : source.length; var attribValue:String = source.substring(start, end); var attribLen:int = attribValue.length; var quoted:Boolean = (attribLen >= 2 && quoteReg.test(attribValue) && attribValue.charAt(0) === attribValue.charAt(attribLen - 1)); var attribSource:String; var attribSourceStart:int; var attribSourceEnd:int; if (quoted) { attribSourceStart = start + 1; attribSourceEnd = end - 1; attribSource = attribValue; } else { attribSourceStart = start + 1; attribSourceEnd = end - 1; attribSource = attribValue.substring(1, attribValue.length - 1); } var attribSourceDecorations:Array = decorateSource(attribSource); for (var j:int = 0, m:int = attribSourceDecorations.length; j < m; j += 2) { attribSourceDecorations[j] += attribSourceStart; } if (quoted) { attribSourceDecorations.push(attribSourceEnd, PR_ATTRIB_VALUE); spliceArrayInto(attribSourceDecorations, decorations, i + 2, 0); } else { spliceArrayInto(attribSourceDecorations, decorations, i, 2); } } nextValueIsSource = false; } } return decorations; } private function decorateMarkup(sourceCode:String):Array { var decorations:Array = tokenizeMarkup(sourceCode); decorations = splitTagAttributes(sourceCode, decorations); decorations = splitSourceNodes(sourceCode, decorations); decorations = splitSourceAttributes(sourceCode, decorations); return decorations; } public var mainDecorations:Array; public var mainHtml:String; public var prettyPrintStopAsyc:Boolean; private function recombineTagsAndDecorations(sourceText:String, extractedTags:Array, decorations:Array):String { var html:Array = []; var outputIdx:int = 0; var openDecoration:String = null; var currentDecoration:String = null; var tagPos:int = 0; var decPos:int = 0; var tabExpander:Function = makeTabExpander(PR_TAB_WIDTH); var adjacentSpaceRe:RegExp = /([\r\n ]) /g; var startOrSpaceRe:RegExp = /(^| ) /gm; var newlineRe:RegExp = /\r\n?|\n/g; var trailingSpaceRe:RegExp = /[ \r\n]$/; var lastWasSpace:Boolean = true; function emitTextUpTo(sourceIdx:int):void { if (sourceIdx > outputIdx) { if (openDecoration && openDecoration !== currentDecoration) { html.push('</span>'); openDecoration = null; } if (!openDecoration && currentDecoration) { openDecoration = currentDecoration; html.push('<span class="', openDecoration, '">'); } var htmlChunk:String = textToHtml(tabExpander(sourceText.substring(outputIdx, sourceIdx))) .replace(lastWasSpace ? startOrSpaceRe : adjacentSpaceRe, '$1&nbsp;'); lastWasSpace = trailingSpaceRe.test(htmlChunk); html.push(htmlChunk.replace(newlineRe, '<br />')); outputIdx = sourceIdx; } } while (true) { var outputTag:Object; if (tagPos < extractedTags.length) { if (decPos < decorations.length) { outputTag = extractedTags[tagPos] <= decorations[decPos]; } else { outputTag = true; } } else { outputTag = false; } if (outputTag) { emitTextUpTo(extractedTags[tagPos]); if (openDecoration) { html.push('</span>'); openDecoration = null; } html.push(extractedTags[tagPos + 1]); tagPos += 2; } else if (decPos < decorations.length) { emitTextUpTo(decorations[decPos]); currentDecoration = decorations[decPos + 1]; decPos += 2; } else { break; } } emitTextUpTo(sourceText.length); if (openDecoration) { html.push('</span>'); } return html.join(''); } private var langHandlerRegistry:Object = {}; private function registerLangHandler(handler:Function, fileExtensions:Array):void { for (var i:int = fileExtensions.length; --i >= 0;) { var ext:Object = fileExtensions[i]; if (!langHandlerRegistry.hasOwnProperty(ext)) { langHandlerRegistry[ext] = handler; } } } public function prettyPrintOne(sourceCodeHtml:String, opt_langExtension:String, buildHTML:Boolean = false):String { try { mainDecorations = null; if (!langHandlerRegistry.hasOwnProperty(opt_langExtension)) { var checkmark:RegExp = /^\s*?</; opt_langExtension = checkmark.test(sourceCodeHtml) ? 'default-markup' : 'default-code'; } var decorations:Array = langHandlerRegistry[opt_langExtension].call({}, sourceCodeHtml); mainDecorations = decorations; if ( buildHTML ) { var extractedTags:Array = []; return recombineTagsAndDecorations(sourceCodeHtml, extractedTags, decorations); } return null; } catch (e:Error) { } return null; } public var asyncRunning:Boolean; private var pseudoThread:PseudoThread; private var pprintArgs:Array; private var chunksLen:int; public function prettyPrintAsync(sourceCodeHtml:String, opt_langExtension:String, completeFn:Function, intFn:Function, systemManagerIn:ISystemManager, buildHTML:Boolean = false):void { var sourceChunks:Array = new Array(); var len:int = sourceCodeHtml.length; var i:int = 100; var end:int, start:int = 0, foundIndex:int; do { end = ( i >= len ) ? len : i; foundIndex = sourceCodeHtml.indexOf('\n', end); if ( foundIndex != -1 ) { i = foundIndex; } else { foundIndex = sourceCodeHtml.indexOf('\r', end); if ( foundIndex != -1 ) { i = foundIndex; } } end = ( i >= len ) ? len : i; sourceChunks.push(sourceCodeHtml.substring(start, end)); i += 100; start = end; } while ( i < len ); if ( start < i && start < len ) { sourceChunks[sourceChunks.length - 1] = sourceChunks[sourceChunks.length - 1] + sourceCodeHtml.substring(start); } chunksLen = sourceChunks.length; mainDecorations = new Array(); mainHtml = ""; prettyPrintStopAsyc = false; asyncRunning = true; pprintArgs = [sourceChunks, 0, completeFn, intFn, opt_langExtension, buildHTML]; pseudoThread = new PseudoThread(systemManagerIn, prettyPrintAsyncWorker, this, pprintArgs, 1, 1); } private function prettyPrintAsyncWorker(sourceCodeArr:Array, sourceCodeIdx:int, completeFn:Function, intFn:Function, opt_langExtension:String, buildHTML:Boolean = false):Boolean { if ( prettyPrintStopAsyc ) { mainDecorations = null; mainHtml = ""; asyncRunning = false; return false; } try { mainHtml += sourceCodeArr[sourceCodeIdx]; var sourceAndExtractedTags:Object = {source:"", tags:(mainDecorations == null) ? [] : mainDecorations}; if (!langHandlerRegistry.hasOwnProperty(opt_langExtension)) { var checkmark:RegExp = /^\s*?</; opt_langExtension = checkmark.test(mainHtml) ? 'default-markup' : 'default-code'; } var decorations:Array = langHandlerRegistry[opt_langExtension].call({}, mainHtml); mainDecorations = decorations; if ( sourceCodeIdx + 1 == chunksLen ) { if ( buildHTML ) { var extractedTags:Array = sourceAndExtractedTags.tags; mainHtml = recombineTagsAndDecorations(mainHtml, extractedTags, decorations); } asyncRunning = false; completeFn(); } else { if ( intFn != null ) { intFn(sourceCodeIdx, chunksLen); } return true; } } catch (e:Error) { asyncRunning = false; completeFn(); } return false; } public function CodePrettyPrint() { regexpPrecederPattern(); registerLangHandler(decorateSource, ['default-code']); registerLangHandler(decorateMarkup, ['default-markup', 'html', 'htm', 'xhtml', 'xml', 'xsl']); registerLangHandler(sourceDecorator({keywords:CPP_KEYWORDS, hashComments:true, cStyleComments:true}), ['c', 'cc', 'cpp', 'cs', 'cxx', 'cyc']); registerLangHandler(sourceDecorator({keywords:JAVA_KEYWORDS, cStyleComments:true}), ['java']); registerLangHandler(sourceDecorator({keywords:SH_KEYWORDS, hashComments:true, multiLineStrings:true}), ['bsh', 'csh', 'sh']); registerLangHandler(sourceDecorator({keywords:PYTHON_KEYWORDS, hashComments:true, multiLineStrings:true, tripleQuotedStrings:true}), ['cv', 'py']); registerLangHandler(sourceDecorator({keywords:PERL_KEYWORDS, hashComments:true, multiLineStrings:true, regexLiterals:true}), ['perl', 'pl', 'pm']); registerLangHandler(sourceDecorator({keywords:RUBY_KEYWORDS, hashComments:true, multiLineStrings:true, regexLiterals:true}), ['rb']); registerLangHandler(sourceDecorator({keywords:JSCRIPT_KEYWORDS, cStyleComments:true, regexLiterals:true}), ['js']); } } }
// Copyright 2018-2020 Earthfiredrake // Released under the terms of the MIT License // https://github.com/Earthfiredrake/SWL-FreeHUD // Specifies unique namespace required for cross mod safety class efd.FreeHUD.lib.util.WeakDelegate {
//////////////////////////////////////////////////////////////////////////////// // // Copyright 2012 Ruben Buniatyan. All rights reserved. // // This source is subject to the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// package flame.tests.crypto { import flame.crypto.AsymmetricKeyExchangeDeformatter; import flame.crypto.AsymmetricKeyExchangeFormatter; import flame.crypto.RSA; import flame.crypto.RSAOAEPKeyExchangeDeformatter; import flame.crypto.RSAOAEPKeyExchangeFormatter; import flame.crypto.RSAPKCS1KeyExchangeDeformatter; import flame.crypto.RSAPKCS1KeyExchangeFormatter; import flame.crypto.RandomNumberGenerator; import flame.utils.Convert; import flash.utils.ByteArray; import mx.utils.StringUtil; import org.flexunit.Assert; [TestCase(order=2)] public final class RSAPaddingTest { //-------------------------------------------------------------------------- // // Fields // //-------------------------------------------------------------------------- private var _rsa:RSA = new RSA(); //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- public function RSAPaddingTest() { super(); } //-------------------------------------------------------------------------- // // Public methods // //-------------------------------------------------------------------------- [Test(order=1)] public function testEncryptAndDecryptWithOAEPAndWith384BitKey():void { _rsa.fromXMLString("<RSAKeyValue><Modulus>tvQjwt+yyldn3qIcIfZWf+Hl86tWdi0g0IJ9Mcpa9bgjKIFuBolv4qZ5ZZ5VWB0r</Modulus><Exponent>AQAB</Exponent><P>64wF30vfB9/9P9nAACcdtZ96X4S2OFub</P><Q>xtcFBfqo17ShPIyy6EqQ/rAjKbYqEEWx</Q><DP>tn2ioxDuN/SzCcATwEqN+wQW1GBGqT1X</DP><DQ>VV+/JWkRk8RXsnLK4lgZ13DzOBaiCuiR</DQ><InverseQ>JGUhzgB+yyJTQQG7NHC9JZ3GdkPhicgx</InverseQ><D>KDuQEa631p9aDC+CGEXfx8eZlfg7z0kk6q7np8Pli5zL9D0KtBdtOA+J0fFdMMaB</D></RSAKeyValue>"); encryptDecryptWithOAEPAndTest(); } [Test(order=2)] public function testEncryptAndDecryptWithOAEPAndWith512BitKey():void { _rsa.fromXMLString("<RSAKeyValue><Modulus>moenQ6fxQIsnl2Xev7xxGxTpF/dMWRuvjzKsLBxpdtxajbWh7OMbsp1xwZxCVGU8Vk7yZ5cuHgjj0RRQDT5Otw==</Modulus><Exponent>AQAB</Exponent><P>yEvcMfm6ztLfJvnE5pMskqxwwaZ0cuzmO1y6tQ7XFds=</P><Q>xYFxOnr01L/cWFK76Pmf95viAWnAWl1YhjfNiGUGN1U=</Q><DP>oZbR5l+anhDxhvgqKfrCEvKbZR9tAuqsM2f0GO4IB9E=</DP><DQ>bw5ZD8whrRtxGAz1cowiwgVaMPc43NcONvJb1O0RcL0=</DQ><InverseQ>pqGAcPCtHwpO1jasfOAly1d/WAciOLZ8zG9ogAEI0Ug=</InverseQ><D>RDul5b/gTQmk37sBklQY9UZUblqqAaax7F8JmyiogOy4ADWDdqHzZtCUCJWoJu4LoRU7qjAsZRgZ6fZHuCYXUQ==</D></RSAKeyValue>"); encryptDecryptWithOAEPAndTest(); } [Test(order=3)] public function testEncryptAndDecryptWithOAEPAndWith1024BitKey():void { _rsa.fromXMLString("<RSAKeyValue><Modulus>reFjQNvkKFWCiGzVxUyyjem5lLccTkTOLouHEqxf0h7eppu7QJ+SnjpmhfjvY2WETdpWkp1gn2nsWI7jzEqzwewPu2QFjRkoMeLHS1AR5HJmFTsUZcPjMq/lNCm72xOCJ6sOA1a96pPJJ2L6wld3KOhgHpK0nCbFoWdXCd6r+X8=</Modulus><Exponent>AQAB</Exponent><P>2jCCPAOGUf+phor4q6z5LtJNx4eUsrhMjzpRHL+4sIxAPB2gibJzrl6pd0M7pDCK9pKZeSbiD0fNa5s9Me7UXw==</P><Q>zAM0r5cUPRd1G6YeDvBbJ5aWTIJA0PxfnXxhTZ8zwPVB2X7pLj7lHB7kruMRn6iFyWkFjT7SznIQfVfIRo3u4Q==</Q><DP>XvytRdk2+a22rMcFeR+ln5eYmtvQhXmsgtIdi8l/awSz1jgDss6IhAnb9vrDFTi41p19yPt/gK1+pXEA1CMoOw==</DP><DQ>pnYPLR6WsupK8Y5vhDz2A61JYY/+Fwd1dOih9FXsQotbeX2mAcfr5TAH4/L+1EkLMLXyg7c5Bp3nen5/uaHhwQ==</DQ><InverseQ>mp7xfUD83A4mM2buStPp+66nvTJhgClgD4S2s7lNzTydJ6jVDuAzvtXK+pSxOYD8rxnfv398XjrG/b0J2meqEA==</InverseQ><D>W/l+sM4fj547n8JCCU0anapl+d4p4NTQYxp25k+7l7+wclyp3fMKcRvfIzqcFe2a4Dt/06nfdDNpSya6JFPXZPsO+GZh281gXtipG0N7FsdXVGqcUdVBRvGY5hS9KZUT1oKINZbkCrF5haMBlrQ7yfeDwVwMWJbw3AW9Df6nNoE=</D></RSAKeyValue>"); encryptDecryptWithOAEPAndTest(); } [Test(order=4)] public function testEncryptAndDecryptWithOAEPAndWith2048BitKey():void { _rsa.fromXMLString("<RSAKeyValue><Modulus>11S6eLgLdAz4FhGF7DAiiFty5uM5CNtXNnUWS6o9p5yirJnVXtLDjNT0RdaLhuDxMKAzKCtimrv9OFEQJ23bmFxoVDUWyOqpVyUluj+DopafksuP5IdNFUwXYSL8vXNy3sudwywfolB1di74PqpasHSwg4bOmaDPSVG9xb3AONcM+0sXeleiyNBJoXA23bp6IZRm8w+JlRfKW/KYPQ+D/ZvxWpPLL0kJvdREdPBZ33hr/2Y1I95XrtV4oKakStZyBzE/4yeHaVomuqu+qqKG5vYvukmOpt3szHYGwM3AOjR05KndP27loCm7k3PJ6S5l56vmYDcuaZ/YT6FFIGQNAw==</Modulus><Exponent>AQAB</Exponent><P>/6854REagnug6hJjnUmKvWS7tXw9gQH08aBrIf3HagMavFw+JyCadI3xoWUBzAsTrBGdpKKHRC6ypyJI/0qE22+Xohw06hlk56jTZmbs/xt0f0nzo4fbBwEu5l2oOS6EHLYMb5VudrH+U+8pzmMIf1dTNm7w1Fp8NoLa+wsV6Cc=</P><Q>15jBDz846VtCSVJFs2dMlM2gAd4dZNRuEhVbAH5nKcqCWMIxkW9vaGdQvHIJ8G7P4scP03KakrS294gZkcByla+9xRL+2rW6cK9GD5XSgGtbJDbGpsFzLkJJsTnCa3kSiYJ6oRdduYkTk4vLow4pGpvuh4OKUMQdMy+yuK5FwcU=</Q><DP>hIub35b0PSxFsNIznbggGip8PIrZf2U6S4AzyX07wTM2yuquta3rI/zphBdOpS4g1pSTOmOe57OlnYrieKVy1ia1Xq5sp+beLlGQtYcp2N2suMfna6Dj5G+ylm165Zm9lvyw2a+HgjSneW+EJp+kKg9k7dT5N7xopAGV74pBowU=</DP><DQ>z0v65VQevpGWrLVEe3lpcvI7VVBh5t8yboTGGTVwsAgdSIZ/7py8/B/Ky0bDM8D4dc588wyQf1rvShY8r53hDvgJeYIINfbiKxL8RGQEIKIY4jsgypnay7HE9XjZ7UhegIVKr7Wt0oVwoz+ZL1CgSQuBUB80UPAgO2UzbMt0Gxk=</DQ><InverseQ>+DVnVvE0UezOarM30YFcmxEDpoUJTva1yCcHix4cXEZYjPwqmDOjqdvA6I4OquCG9Ilw4UFcAVF7q7uVmNw7GjXEsBH6jZqiS6IZRwm9Hped2jwNa5oWvLDmI2d7+dI4EaVylBs+zw8o15L7t2WN1Kptzxs2lW4PUpCjGBIn/y4=</InverseQ><D>w6MIVFuqlEKgN7St/1vwVAD6EQoKrKBTyXdxzUccAyfNqJGPiTpmTpLAaJ83X1EJ8Urrj6hzSvBXbQ5BZgFqzS/P3gnp7Js/RZzLfT7tgw/kZUOrNU80WpAqgad/B0VX7VIDwOpax2bggYLFKnIuOTmbkbQuCuhOzGeGypzOgxQ7WPIO0x7HKOBmHsv7Hnc3tiHDcDNWvhKSlTG5vobf0kt0nvOLM8H7FzNv2q51znAEyYR4yGW9gpQ3kIZjEtmygfV9GmnyuZuKHYaYn9uvvMzpA/bFf1fuwXi4wVp5F6lmt4BaazOHKRUQLzzDdihoyWSV3LVFoDN01iOMLJczKQ==</D></RSAKeyValue>"); encryptDecryptWithOAEPAndTest(); } [Test(order=5)] public function testEncryptAndDecryptWithPKCS1AndWith384BitKey():void { _rsa.fromXMLString("<RSAKeyValue><Modulus>p/dMsvOehIKterShE9eKvaJhicRCf/21fRvI2m+YKSkb6drOq/EcPOlw1CC7/wj9</Modulus><Exponent>AQAB</Exponent><P>0r1IsLJbGG9HGnXpnQbeiQ7ItGCdMlmZ</P><Q>zApIIhmEj4crMB5bv/F0s2Gkv7qJ5TEF</Q><DP>rquVBF/QgYA6PwRcjXqUGKXYVSl/IayB</DP><DQ>ZUyhfVR/7KYl+fDIimX9E2Xh3lJlTcVl</DQ><InverseQ>0k5R/pjG3RLHuBLv44VQn7/rycOz3lwA</InverseQ><D>k2ax94VWAkHPzhRAG3KXPe4HnOgP19SkCaNs/D9QRolYU/+JtjUb5/9K1/RuBW1h</D></RSAKeyValue>"); encryptDecryptWithPKCS1AndTest(); } [Test(order=6)] public function testEncryptAndDecryptWithPKCS1AndWith512BitKey():void { _rsa.fromXMLString("<RSAKeyValue><Modulus>6v6Hu8j5Yr4NLBmH4c7rYJ4LtPrWoGF/BiRTV4PbW8NcKXvRpsQ5rufFCoXtCNHjn0QFaxZRPgI8ns+qdZ3SfQ==</Modulus><Exponent>AQAB</Exponent><P>+oF2wR6vzdtZHQnKii1CLXeRvPlX5agkR6dmzF1l5/k=</P><Q>8CX5CNZXO3ej45Ck59E48TrllGD31Sp4X46UkIczh6U=</Q><DP>7SWGoMhGMiGHOUA9p5W04oohQ77hAR6uSc8mOC3q/TE=</DP><DQ>6kcxRzTLjyEtinDu35SV54hctj9PJ+8x1Y8kUkcDt10=</DQ><InverseQ>CjpNLhshwDdea1W7AH9Sfu+LZPFJ37toNfO2mF+Rdn4=</InverseQ><D>hVu9G8yJ+odwYj565qLO4R3P9v0DIDE0LQAga+Hgcsns6Kh7FVsQPpmUsSeQ2+UyDFB/P6XzZy9XAw64ljuvAQ==</D></RSAKeyValue>"); encryptDecryptWithPKCS1AndTest(); } [Test(order=7)] public function testEncryptAndDecryptWithPKCS1AndWith1024BitKey():void { _rsa.fromXMLString("<RSAKeyValue><Modulus>zyBejZDfk+W+TRAKv+Tv+ant0/v6QYfKL4yIOWMzis6aMnY26z/b5ov74oZ3/1MdtYPyeKZX7Hn+miGN16fmG1DJCy7SRXruSFei10KpCcK4d/kk1s+eHZipbmNP+oDRg/f11edbBjZ/p+NX7n7AcCWNOltwUnMRAZme/6yRI+k=</Modulus><Exponent>AQAB</Exponent><P>78zQDMqYRRzXOLR33mhW3tQWVLOO5bvbPuTPH0hSq5jYt+ge/aJsf6+SAR4K5FJ0QhjVamkxzKnal53sUegwlw==</P><Q>3R582KVbbG1eBIy+gXFM6mXR2Ns3KyFKl7wjjrOkkL3JFTxOcGzSzBIigzNJD2TCVQByZU9YvArR4LcGpI9ffw==</Q><DP>LGMqA6QgqXJcOEfXhFil89soQwd1pPqv66Vo3W6Ctva07t3Nlr9Q/BWgngpUk8zbbjywjGDqceri5nu5+bNUAw==</DP><DQ>1zpozTvPDHA8FnOkrzxIYNOw+cMPJQUnpSA1AB7t7RE+XFQyCY5zdL2mKEzQLZKm8bQYpXIhbg+eEHw2lBEWIw==</DQ><InverseQ>E4fi4M05e3Hsrj/YVO1uQE03WVIGA0Y1kr1ntoj9kN4ghmz/PUmGNwRt+64eidABam9xo6BVjFPijL/TDZIPiA==</InverseQ><D>JstmSlevOLFYUnDFwqlrtTR5wjG47tszKHLG9RC6j64gvYDcynU8h9MCS6xp/12e++eJ28U0RKuY31+XhKQC+hZzyvdNvgndf6J6VLsGo4/2f5JfOiWwWPdzxU/yO2ZxKblhXZMSeWBwUYwj3YBbKveeifhXZM9lmeBRUU4uPj0=</D></RSAKeyValue>"); encryptDecryptWithPKCS1AndTest(); } [Test(order=8)] public function testEncryptAndDecryptWithPKCS1AndWith2048BitKey():void { _rsa.fromXMLString("<RSAKeyValue><Modulus>thcMD2NESmOMInPzgNtHLlg9PCFA4P8XOXqIiPxVWoLtsgVcBR9Ti8Ki5wuHUQ4YLws8a3XAQv/UAdmuaQL4+UsQ9bafz9c5GxD8dzzGlRZYtDJOmNlcCidTmfqsi1QcNDBOyGRkep6XFUxS7q25O+YPoBPUd7iERHVkG7LomXBRvns0MyXlyxa5fNmU5hUb5p8fQRjAaZ0Z2K6Fozs280An/medrePSLZsCxHu74E30k1eIEK7M63E9weU0CywMrpM/GenVunqxDJkttz1bgDIeFMXdk5KalYVIBh5/MxS9ZXvJ7mExn/UmLZbuE4bgro6SyLZDWZrqrWthaPRkoQ==</Modulus><Exponent>AQAB</Exponent><P>7iqx+9m1deVhF+u0txrD7MzgfHJ4Lgf6803+G17IX5fC71Y239vZPb79+1/XqC+k7wh46lE2aUmaMqwqakSvCdYxLSuHizbkdcP3CwvuAsOO2ww4xWRvreYO+Bpqzw8aALP7RMLA6Nz4d8DbfSWPGz+V/F6nlL4eLaMa1Lpfs70=</P><Q>w7lxir8r01lokJQteqfQdavdLMOmxZOuNRiaboeFyhZ2VpnsbqfiTetcrtcIXhciceIvQt6tcCJdHdm3H+MhUo6WgKyRWICAegmphMm/Y7ukn2JVZQcK/Emms4BsUu1ChN6KYF0mbF/vtWFnsRsAxuwWmn7JQhvuymD9RtHwkLU=</Q><DP>qL+hmkO4Oc+LiupcAfy543eKe0KT+nF3EpspN3Vh3bFm0jOw784Sz5ga1tgisi0H3MGRAt0GA3W+BrdL2j3OE9cqwsl74VzEZNizmqUaP+UVvAid1OaD5qAB7TKyiQE3OFZN63teOeAPQLJqEfLhwbm86LKcZFyMf2N4qE9hbbU=</DP><DQ>bdSaSmmMhkUd0EPWYYXaDK4spvoDk8uTbmgoAO47vXNtZJtreYzsCR2SHOq9307MHWv3aWbbnJkr95w8jsA96r3o5rvvs+IoNlNFtSYhKC4b6vSbRt305C3QRdpC7yYEtdrLe9fJv/b15KqMLW4huX6yEHAlL9vM2/QhLKSSgiE=</DQ><InverseQ>y+GR4UY1Q8UFrtoRcMReIdiQT5og9Owx4rIuIaJ9mn1qmbxKOMH2C4vI2Wg0v4YrvHfsuZjwnmtU+0Xhcrj/KmDQpMP0Hu3jgOJQvWWNshYBUpzrT887lrHxu+koMsQOzbyXcnIurGmhYvbc7Yk5MZqJujEiv7tbgDiojLY2NtE=</InverseQ><D>Cz/3RcgbQwFNeh9xzuc9SZa4CcwAJyZ7d9ijMNtuJo5qQxJjsglSbxMSX3Xt4UseoWFvVTBMNZd6sLaTOPevDC/gF142F3AzngF5p6BAoJtl1ZQ6GOVs80+ksaG0IVOL/olxhJ33O0ArE2zIvuhKxnGbS4eOG+txeI1MJw3xovEbvTCnkB1nEp/8SbS7Ekl0q14/ncP7LEpDA4pqKCz5Ieef9cOwpGkimh9SmUUifh67ZrOWyMahLqIIzylmyJ40kQqbqdZP7XLdopdXocT0HSCeWbmdPv/joVanUlVxY90TzdvZQEx1GkWF6XY+JrmN1eZCWzHJ10Oc12tGqLAXMQ==</D></RSAKeyValue>"); encryptDecryptWithPKCS1AndTest(); } //-------------------------------------------------------------------------- // // Private methods // //-------------------------------------------------------------------------- private function assertDecipherIsValid(data:String, decipher:String):void { Assert.assertEquals(StringUtil.substitute("Decrypted data was invalid with the specified key length of {0}-bit.", _rsa.keySize), decipher, data); } private function encryptDecryptWithOAEPAndTest():void { var data:ByteArray = RandomNumberGenerator.getBytes(_rsa.keySize >> 6); var deformatter:AsymmetricKeyExchangeDeformatter = new RSAOAEPKeyExchangeDeformatter(_rsa); var formatter:AsymmetricKeyExchangeFormatter = new RSAOAEPKeyExchangeFormatter(_rsa); var cipher:ByteArray = formatter.createKeyExchange(data); var decipher:ByteArray = deformatter.decryptKeyExchange(cipher); assertDecipherIsValid(Convert.toBase64String(decipher), Convert.toBase64String(data)); } private function encryptDecryptWithPKCS1AndTest():void { var data:ByteArray = RandomNumberGenerator.getBytes(_rsa.keySize >> 4); var deformatter:AsymmetricKeyExchangeDeformatter = new RSAPKCS1KeyExchangeDeformatter(_rsa); var formatter:AsymmetricKeyExchangeFormatter = new RSAPKCS1KeyExchangeFormatter(_rsa); var cipher:ByteArray = formatter.createKeyExchange(data); var decipher:ByteArray = deformatter.decryptKeyExchange(cipher); assertDecipherIsValid(Convert.toBase64String(decipher), Convert.toBase64String(data)); } } }
/* * Copyright 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.resources.processor { import flash.events.Event; /** * Event that fires when a ResourceManager has been updated. * * @author Jens Halm */ public class ResourceBindingEvent extends Event { /** * Constant for the event type that fires when a ResourceManager has been updated. * * @eventType update */ public static const UPDATE : String = "update"; /** * Creates a new event instance. * * @param type the type of this event */ public function ResourceBindingEvent (type:String) { super(type); } /** * @private */ public override function clone () : Event { return new ResourceBindingEvent(type); } } }
package kabam.rotmg.assets.EmbeddedData { import kabam.rotmg.assets.*; import mx.core.*; [Embed(source="xmls/EmbeddedData_LowCXML.xml", mimeType="application/octet-stream")] public class EmbeddedData_LowCXML extends ByteArrayAsset { public function EmbeddedData_LowCXML() { super(); return; } } }
/* Feathers Copyright 2012-2013 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.layout { import starling.display.DisplayObject; import starling.events.Event; import starling.events.EventDispatcher; /** * @inheritDoc */ [Event(name="change",type="starling.events.Event")] /** * Extra, optional data used by an <code>AnchorLayout</code> instance to * position and size a display object. * * @see http://wiki.starling-framework.org/feathers/anchor-layout * @see AnchorLayout * @see ILayoutDisplayObject */ public class AnchorLayoutData extends EventDispatcher implements ILayoutData { /** * Constructor. */ public function AnchorLayoutData(top:Number = NaN, right:Number = NaN, bottom:Number = NaN, left:Number = NaN, horizontalCenter:Number = NaN, verticalCenter:Number = NaN) { this.top = top; this.right = right; this.bottom = bottom; this.left = left; this.horizontalCenter = horizontalCenter; this.verticalCenter = verticalCenter; } /** * @private */ protected var _percentWidth:Number = NaN; /** * The width of the layout object, as a percentage of the container's * width. * * @default NaN */ public function get percentWidth():Number { return this._percentWidth; } /** * @private */ public function set percentWidth(value:Number):void { if(this._percentWidth == value) { return; } this._percentWidth = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _percentHeight:Number = NaN; /** * The height of the layout object, as a percentage of the container's * height. * * @default NaN */ public function get percentHeight():Number { return this._percentHeight; } /** * @private */ public function set percentHeight(value:Number):void { if(this._percentHeight == value) { return; } this._percentHeight = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _topAnchorDisplayObject:DisplayObject; /** * The top edge of the layout object will be relative to this anchor. * If there is no anchor, the top edge of the parent container will be * the anchor. * * @default null * * @see #top */ public function get topAnchorDisplayObject():DisplayObject { return this._topAnchorDisplayObject; } /** * @private */ public function set topAnchorDisplayObject(value:DisplayObject):void { if(this._topAnchorDisplayObject == value) { return; } this._topAnchorDisplayObject = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _top:Number = NaN; /** * The position, in pixels, of the top edge relative to the top * anchor, or, if there is no top anchor, then the position is relative * to the top edge of the parent container. If this value is * <code>NaN</code>, the object's top edge will not be anchored. * * @default NaN * * @see #topAnchorDisplayObject */ public function get top():Number { return this._top; } /** * @private */ public function set top(value:Number):void { if(this._top == value) { return; } this._top = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _rightAnchorDisplayObject:DisplayObject; /** * The right edge of the layout object will be relative to this anchor. * If there is no anchor, the right edge of the parent container will be * the anchor. * * @default null * * @see #right */ public function get rightAnchorDisplayObject():DisplayObject { return this._rightAnchorDisplayObject; } /** * @private */ public function set rightAnchorDisplayObject(value:DisplayObject):void { if(this._rightAnchorDisplayObject == value) { return; } this._rightAnchorDisplayObject = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _right:Number = NaN; /** * The position, in pixels, of the right edge relative to the right * anchor, or, if there is no right anchor, then the position is relative * to the right edge of the parent container. If this value is * <code>NaN</code>, the object's right edge will not be anchored. * * @default NaN * * @see #rightAnchorDisplayObject */ public function get right():Number { return this._right; } /** * @private */ public function set right(value:Number):void { if(this._right == value) { return; } this._right = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _bottomAnchorDisplayObject:DisplayObject; /** * The bottom edge of the layout object will be relative to this anchor. * If there is no anchor, the bottom edge of the parent container will be * the anchor. * * @default null * * @see #bottom */ public function get bottomAnchorDisplayObject():DisplayObject { return this._bottomAnchorDisplayObject; } /** * @private */ public function set bottomAnchorDisplayObject(value:DisplayObject):void { if(this._bottomAnchorDisplayObject == value) { return; } this._bottomAnchorDisplayObject = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _bottom:Number = NaN; /** * The position, in pixels, of the bottom edge relative to the bottom * anchor, or, if there is no bottom anchor, then the position is relative * to the bottom edge of the parent container. If this value is * <code>NaN</code>, the object's bottom edge will not be anchored. * * @default NaN * * @see #bottomAnchorDisplayObject */ public function get bottom():Number { return this._bottom; } /** * @private */ public function set bottom(value:Number):void { if(this._bottom == value) { return; } this._bottom = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _leftAnchorDisplayObject:DisplayObject; /** * The left edge of the layout object will be relative to this anchor. * If there is no anchor, the left edge of the parent container will be * the anchor. * * @default null * * @see #left */ public function get leftAnchorDisplayObject():DisplayObject { return this._leftAnchorDisplayObject; } /** * @private */ public function set leftAnchorDisplayObject(value:DisplayObject):void { if(this._leftAnchorDisplayObject == value) { return; } this._leftAnchorDisplayObject = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _left:Number = NaN; /** * The position, in pixels, of the left edge relative to the left * anchor, or, if there is no left anchor, then the position is relative * to the left edge of the parent container. If this value is * <code>NaN</code>, the object's left edge will not be anchored. * * @default NaN * * @see #leftAnchorDisplayObject */ public function get left():Number { return this._left; } /** * @private */ public function set left(value:Number):void { if(this._left == value) { return; } this._left = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _horizontalCenterAnchorDisplayObject:DisplayObject; /** * The horizontal center of the layout object will be relative to this * anchor. If there is no anchor, the horizontal center of the parent * container will be the anchor. * * @default null * * @see #horizontalCenter */ public function get horizontalCenterAnchorDisplayObject():DisplayObject { return this._horizontalCenterAnchorDisplayObject; } /** * @private */ public function set horizontalCenterAnchorDisplayObject(value:DisplayObject):void { if(this._horizontalCenterAnchorDisplayObject == value) { return; } this._horizontalCenterAnchorDisplayObject = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _horizontalCenter:Number = NaN; /** * The position, in pixels, of the horizontal center relative to the * horizontal center anchor, or, if there is no horizontal center * anchor, then the position is relative to the horizontal center of the * parent container. If this value is <code>NaN</code>, the object's * horizontal center will not be anchored. * * @default NaN * * @see #horizontalCenterAnchorDisplayObject */ public function get horizontalCenter():Number { return this._horizontalCenter; } /** * @private */ public function set horizontalCenter(value:Number):void { if(this._horizontalCenter == value) { return; } this._horizontalCenter = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _verticalCenterAnchorDisplayObject:DisplayObject; /** * The vertical center of the layout object will be relative to this * anchor. If there is no anchor, the vertical center of the parent * container will be the anchor. * * @default null * * @see #verticalCenter */ public function get verticalCenterAnchorDisplayObject():DisplayObject { return this._verticalCenterAnchorDisplayObject; } /** * @private */ public function set verticalCenterAnchorDisplayObject(value:DisplayObject):void { if(this._verticalCenterAnchorDisplayObject == value) { return; } this._verticalCenterAnchorDisplayObject = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _verticalCenter:Number = NaN; /** * The position, in pixels, of the vertical center relative to the * vertical center anchor, or, if there is no vertical center anchor, * then the position is relative to the vertical center of the parent * container. If this value is <code>NaN</code>, the object's vertical * center will not be anchored. * * @default NaN * * @see #verticalCenterAnchorDisplayObject */ public function get verticalCenter():Number { return this._verticalCenter; } /** * @private */ public function set verticalCenter(value:Number):void { if(this._verticalCenter == value) { return; } this._verticalCenter = value; this.dispatchEventWith(Event.CHANGE); } } }
package visuals.ui.elements.conventions { import com.playata.framework.display.Sprite; import com.playata.framework.display.lib.flash.FlashDisplayObjectContainer; import com.playata.framework.display.lib.flash.FlashSprite; import flash.display.MovieClip; public class SymbolButtonConventionPlateGeneric extends Sprite { private var _nativeObject:SymbolButtonConventionPlate = null; public function SymbolButtonConventionPlateGeneric(param1:MovieClip = null) { if(param1) { _nativeObject = param1 as SymbolButtonConventionPlate; } else { _nativeObject = new SymbolButtonConventionPlate(); } super(null,FlashSprite.fromNative(_nativeObject)); var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer; } public function setNativeInstance(param1:SymbolButtonConventionPlate) : void { FlashSprite.setNativeInstance(_sprite,param1); _nativeObject = param1; syncInstances(); } public function syncInstances() : void { } } }
// common functions for Challenge maps string g_statsFile; const string stats_tag = "challenge_stats"; bool syncedStats = false; // end global vars // Hook for map loader void LoadMap() // this isn't run on client! { ChallengeCommonLoad(); } // void ChallengeCommonLoad() { CRules@ rules = getRules(); if (rules is null) { error("Something went wrong Rules is null"); } SetConfig(rules); RegisterFileExtensionScript("Scripts/MapLoaders/LoadChallengePNG.as", "png"); LoadMap(getMapInParenthesis()); } void SetConfig(CRules@ rules) { syncedStats = false; rules.set_string("rulesconfig", "test"); rules.set_string("rulesconfig", CFileMatcher("/" + getMapName() + ".cfg").getFirst()); } void AddRulesScript(CRules@ rules) { CFileMatcher@ files = CFileMatcher("Challenge_"); //files.printMatches(); while (files.iterating()) { const string filename = files.getCurrent(); if (rules.RemoveScript(filename)) { printf("Removing rules script " + filename); } } printf("Adding rules script: " + getCurrentScriptName()); rules.AddScript(getCurrentScriptName()); rules.set_bool("no research", true); } // put in onInit( CRules@ this ) or onInit( CMap@ this ) void SetIntroduction(CRules@ this, const string &in shortName) { this.set_string("short name", shortName); this.set_string(stats_tag, ""); this.set_s32("restart_rules_after_game_time", 30 * 7.0f); // no better place? } void DefaultWin(CRules@ this, const string endGameMsg = "You won!") { this.SetTeamWon(0); this.SetCurrentState(GAME_OVER); this.SetGlobalMessage(endGameMsg); sv_mapautocycle = true; } //// STATS STUFF string getMapName() { return getFilenameWithoutExtension(getFilenameWithoutPath(getMapInParenthesis())); } void Stats_MakeFile(CRules@ this, const string &in mode) { CRules@ rules = getRules(); g_statsFile = "Stats_Challenge/stats_" + mode + "_" + getMapName() + ".cfg"; this.set_string("stats file", g_statsFile); printf("STATS FILE -> ../Cache/" + g_statsFile); this.set_string(stats_tag, ""); } void Stats_Draw(CRules@ this) { if (g_videorecording) return; //string shortName = this.get_string("short name" ); // const f32 screenMiddle = getScreenWidth()/2.0f; // GUI::DrawText( " " + shortName + "", Vec2f(screenMiddle-60.0f, 0.0f), Vec2f(screenMiddle+60.0f, 20.0f), color_black, true, true, true ); string text; text = this.get_string(stats_tag); if (text.size() > 0) { GUI::SetFont("menu"); GUI::DrawText(text, Vec2f(20, 20), Vec2f(300, 200), color_black, false, false, true); } } void Stats_Send(CRules@ this, string &in text) { text += "\n\n"; this.set_string(stats_tag, text); this.Sync(stats_tag, true); } string Stats_Begin_Output() { return " High scores\n\n\n"; } u32 Stats_getCurrentTime(CRules@ this) { const u32 gameTicksLeft = this.get_u32("game ticks left"); const u32 gameTicksDuration = this.get_u32("game ticks duration"); return gameTicksDuration - gameTicksLeft; } // stats: individual time void Stats_Add_IndividualTimeMeasures(ConfigFile@ stats) { stats.add_u32("fastest time", 99999999); stats.add_string("fastest time name", "N/A"); } void Stats_Mark_IndividualTime(ConfigFile@ stats, const string &in playerName, const u32 currentTime) { if (!stats.exists("fastest time")) return; const u32 fastestTime = stats.read_u32("fastest time"); if (currentTime < fastestTime) { stats.add_u32("fastest time", currentTime); stats.add_string("fastest time name", playerName); } stats.add_u32(playerName, currentTime); } string Stats_Output_IndividualTimeMeasures(ConfigFile@ stats) { if (!stats.exists("fastest time") || !stats.exists("fastest time name")) return ""; const u32 fastestTime = stats.read_u32("fastest time"); const string fastestTimeName = stats.read_string("fastest time name"); string fastestTimeText = "" + formatFloat(float(fastestTime) / 30.0f, '0', 4, 2); if (fastestTime >= 99999999) fastestTimeText = "N/A"; return " Fastest individual time: $RED$" + fastestTimeText + "s$RED$\n " + fastestTimeName + "\n\n\n"; } // stats: team time void Stats_Add_TeamTimeMeasures(ConfigFile@ stats) { stats.add_u32("fastest team", 99999999); stats.add_string("fastest team names", "N/A"); } void Stats_Mark_TeamTimes(ConfigFile@ stats, const u32 currentTime) { if (!stats.exists("fastest team")) return; const u32 fastestTeamTime = stats.read_u32("fastest team"); if (currentTime < fastestTeamTime) { stats.add_u32("fastest team", currentTime); } } string Stats_Output_TeamTimeMeasures(ConfigFile@ stats, bool showIndividualNames = true) { if (!stats.exists("fastest team") || !stats.exists("fastest team names")) return ""; const u32 fastestTeam = stats.read_u32("fastest team"); const string fastestTimeNames = stats.read_string("fastest team names"); string fastestTimeText = "" + formatFloat(float(fastestTeam) / 30.0f, '0', 4, 2); string stat; //if (fastestTeam < 99999999) { //stat += " Fastest team time: $RED$" + fastestTimeText + "s$RED$\n " + fastestTimeNames + "\n\n"; if (showIndividualNames) { CBlob@[] players; if (getBlobsByTag("player", @players)) { for (uint i = 0; i < players.length; i++) { CBlob@ player = players[i]; if (player.getPlayer() !is null) { const string name = player.getPlayer().getUsername(); const u32 fastestPlayerTime = stats.exists(name) ? stats.read_u32(name) : 99999999; stat += " " + name + ": $RED$" + formatFloat(float(fastestPlayerTime) / 30.0f, '0', 4, 2) + "s$RED$\n"; } } } } } stat += "\n"; return stat; } void Stats_Mark_TeamName(ConfigFile@ stats, const string &in playerName) { //if (!stats.exists("fastest team names")) // return; //if (playerName == "") //{ // stats.add_string("fastest team names", "" ); // return; //} //string names; //names += playerName + ", "; //stats.add_string("fastest team names", names ); } // stats: individual kills void Stats_Add_KillMeasures(ConfigFile@ stats) { stats.add_u32("most kills", 0); stats.add_string("most kills name", "N/A"); } void Stats_Mark_Kill(ConfigFile@ stats, const string &in playerName) { if (!stats.exists("most kills")) return; u32 currentKills = stats.exists(playerName) ? stats.read_u32(playerName) : 0; const u32 mostKills = stats.read_u32("most kills"); currentKills++; if (currentKills > mostKills) { stats.add_u32("most kills", currentKills); stats.add_string("most kills name", playerName); } stats.add_u32(playerName, currentKills); } string Stats_Output_KillMeasures(ConfigFile@ stats) { if (!stats.exists("most kills") || !stats.exists("most kills name")) return ""; const u32 mostKills = stats.read_u32("most kills"); const string mostKillsName = stats.read_string("most kills name"); string text; if (mostKills < 99999999 && mostKillsName != "N/A") { text += " Most kills: $RED$" + mostKills + "$RED$\n " + mostKillsName + "\n\n"; } CBlob@[] players; if (getBlobsByTag("player", @players)) { for (uint i = 0; i < players.length; i++) { CBlob@ player = players[i]; if (player.getPlayer() !is null) { const string name = player.getPlayer().getUsername(); const u32 kills = stats.exists(name) ? stats.read_u32(name) : 99999999; if (kills < 99999999) { text += " " + name + ": $RED$" + kills + "$RED$\n"; } } } } text += "\n"; return text; }
/* Copyright aswing.org, see the LICENCE.txt. */ import GUI.fox.aswing.BorderLayout; import GUI.fox.aswing.JButton; import GUI.fox.aswing.JFrame; import GUI.fox.aswing.JPanel; import GUI.fox.aswing.JTextField; /** * @author iiley */ class test.TextFieldTest extends JFrame { private var tf1:JTextField; private var tf2:JTextField; private var button1:JButton; public function TextFieldTest() { super(_root, "TextFieldTest", false); var pane1:JPanel = new JPanel(); tf1 = new JTextField("tf1", 10); tf2 = new JTextField("tf2"); var tf3:JTextField = new JTextField("tf3d", 10); tf1.setEditable(true); tf2.setEditable(false); tf3.setEnabled(false); tf1.setMaxChars(10); pane1.append(tf1); pane1.append(tf2); pane1.append(tf3); getContentPane().append(pane1, BorderLayout.CENTER); button1 = new JButton("Text1 -> Text2"); button1.setToolTipText("Copy the text from first to second."); getContentPane().append(button1, BorderLayout.SOUTH); var t1:JTextField = tf1; var t2:JTextField = tf2; button1.addActionListener(function(){ t2.setText(t1.getText()); trace("try to set t2 text : " + t1.getText()); trace("t2 text set to : " + t2.getText()); }); } public static function main():Void{ try{ trace("try TextFieldTest"); var p:TextFieldTest = new TextFieldTest(); p.setClosable(false); p.setLocation(50, 50); p.setSize(400, 400); p.show(); trace("done TextFieldTest"); }catch(e){ trace("error : " + e); } } }
package kabam.rotmg.messaging.impl.incoming { import flash.utils.IDataInput; import kabam.rotmg.messaging.impl.data.WorldPosData; public class Aoe extends IncomingMessage { public function Aoe(id:uint, callback:Function) { this.pos_ = new WorldPosData(); super(id, callback); } public var pos_:WorldPosData; public var radius_:Number; public var damage_:int; public var effect_:int; public var duration_:Number; public var origType_:int; override public function parseFromInput(data:IDataInput):void { this.pos_.parseFromInput(data); this.radius_ = data.readFloat(); this.damage_ = data.readUnsignedShort(); this.effect_ = data.readUnsignedByte(); this.duration_ = data.readFloat(); this.origType_ = data.readUnsignedShort(); } override public function toString():String { return formatToString("AOE", "pos_", "radius_", "damage_", "effect_", "duration_", "origType_"); } } }
package laya.d3.graphics { /** * ... * @author ... */ public class VertexElementUsage { public static const POSITION0:int =0; public static const COLOR0:int = 1; public static const TEXTURECOORDINATE0:int = 2; public static const NORMAL0:int = 3; public static const BINORMAL0:int = 4; public static const TANGENT0:int = 5; public static const BLENDINDICES0:int = 6; public static const BLENDWEIGHT0:int = 7; public static const DEPTH0:int = 8; public static const FOG0:int = 9; public static const POINTSIZE0:int = 10; public static const SAMPLE0:int = 11; public static const TESSELLATEFACTOR0:int = 12; public static const COLOR1:int = 13; public static const NEXTTEXTURECOORDINATE0:int = 14; public static const TEXTURECOORDINATE1:int = 15; public static const NEXTTEXTURECOORDINATE1:int = 16; public static const CORNERTEXTURECOORDINATE0:int = 17; public static const VELOCITY0:int = 18; public static const STARTCOLOR0:int = 19; public static const STARTSIZE:int = 20; public static const AGEADDSCALE0:int = 21; public static const STARTROTATION:int = 22; public static const ENDCOLOR0:int = 23; public static const STARTLIFETIME:int = 24; public static const TIME0:int = 33; public static const SHAPEPOSITIONSTARTLIFETIME:int = 30; public static const DIRECTIONTIME:int = 32; public static const SIZEROTATION0:int = 27; public static const RADIUS0:int =28; public static const RADIAN0:int = 29; public static const STARTSPEED:int = 31; public static const RANDOM0:int = 34; public static const RANDOM1:int = 35; public static const SIMULATIONWORLDPOSTION:int = 36; public static const SIMULATIONWORLDROTATION:int = 37; public static const TEXTURECOORDINATE0X:int = 38; public static const TEXTURECOORDINATE0X1:int = 39; public static const TEXTURECOORDINATE0Y:int = 40; public static const OFFSETVECTOR:int = 41; } }
package dagd.caughman { import flash.display.MovieClip; import flash.events.MouseEvent; public class Bag extends MovieClip { private var velocityX:Number = 0; private var velocityY:Number = 0; public var isDead:Boolean = false; public var points:Number = 0; public function Bag() { x= -100; y= Math.random()*500+50; velocityX = Math.random()*2+2; //velocityY = Math.random()*2-1; addEventListener(MouseEvent.MOUSE_DOWN, click); }//End compiler private function click(e:MouseEvent):void{ isDead =true;//reference to the game that it should be removed from the game points=-200; }//End Click public function update():void { x++; //euler integration x+= velocityX; //y+= velocityY; if(x>800) isDead=true;//kills it off screne }//End Update public function dispose():void{ removeEventListener(MouseEvent.MOUSE_DOWN,click); }//End Dispose } }
package { public class Assets { [Embed(source = 'assets/character.png')] public static const GfxCharacter:Class; [Embed(source = 'assets/block.png')] public static const GfxBlock: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.events.utils { /** * This class holds constants for keyboard navigation * See: https://w3c.github.io/uievents-key/#keys-navigation * See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Navigation_keys * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public class NavigationKeys { /** * The down arrow key. */ public static const DOWN:String = "ArrowDown"; /** * The left arrow key. */ public static const LEFT:String = "ArrowLeft"; /** * The right arrow key. */ public static const RIGHT:String = "ArrowRight"; /** * The up arrow key. */ public static const UP:String = "ArrowUp"; /** * The End key. Moves to the end of content. */ public static const END:String = "End"; /** * The Home key. Moves to the start of content. */ public static const HOME:String = "Home"; /** * The Page Down (or PgDn) key. Scrolls down or displays the next page of content. */ public static const PAGE_DOWN:String = "PageDown"; /** * The Page Up (or PgUp) key. Scrolls up or displays the previous page of content. */ public static const PAGE_UP:String = "PageUp"; } }
/** * Created with IntelliJ IDEA. * User: mobitile * Date: 5/17/13 * Time: 3:18 PM * To change this template use File | Settings | File Templates. */ package skein.core { public class StrongReference implements Reference { public function StrongReference(value:Object) { super(); _value = value; } private var _value:Object; public function get value():* { return _value; } } }
//////////////////////////////////////////////////////////////////////////////// // // 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 { import mx.controls.NumericStepper; import mx.core.IFactory; public class MyCustomRenderer_NumericStepper extends NumericStepper implements IFactory { public function MyCustomRenderer_NumericStepper() { super(); } public function newInstance():* { } } }
/* * Copyright 2008 Hidekatsu Izuno * * 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 net.arnx.jsonic { import flash.utils.ByteArray; import mx.collections.ArrayCollection; import mx.resources.IResourceManager; import mx.resources.Locale; import mx.resources.ResourceManager; import mx.utils.ObjectUtil; [ResourceBundle("jsonic")] public class JSON { public static function encode(source:Object, prettyPrint:Boolean = false):String { var json:JSON = new JSON(); json.prettyPrint = prettyPrint; return json.format(source); } public static function decode(source:String):Object { return new JSON().parse(source); } private static var _resourceManager:IResourceManager = ResourceManager.getInstance(); private var _prettyPrint:Boolean = false; private var _maxDepth:int; private var _suppressNull:Boolean = false; public function JSON(maxDepth:int = 32) { this.maxDepth = maxDepth; } public function set prettyPrint(value:Boolean):void { _prettyPrint = value; } public function set maxDepth(value:int):void { _maxDepth = value; } public function set suppressNull(value:Boolean):void { _suppressNull = value; } public function format(o:Object):String { return _format(o, new ByteArray(), 0).toString(); } public function parse(s:String):Object { return _parse(new StringParserSource(s)); } private function _format(o:Object, array:ByteArray, level:int):ByteArray { if (level > _maxDepth) { o = null; } if (o is Date) { o = (o as Date).getTime(); } else if (o is RegExp) { o = RegExp(o).source; } else if (o is Locale) { o = o.toString().replace(/_/g, '-'); } if (level == 0) { var type:String = typeof(o); if (type == "number" || type == "boolean" || type == "string" || o is Date) { throw new ArgumentError(getMessage("json.format.IllegalRootTypeError")); } } var escape:Boolean = true; if (o == null) { array.writeUTFBytes("null"); } else if (o is String) { if (escape) { _formatString(o as String, array); } else { array.writeUTFBytes(o as String); } } else if (o is Number) { if (isNaN(o as Number) || !isFinite(o as Number)) { _formatString(o.toString(), array); } else { array.writeUTFBytes(o.toString()); } } else if (o is Boolean) { array.writeUTFBytes(o.toString()); } else if (o is Array || o is ArrayCollection) { array.writeUTFBytes('['); for (var i:int = 0; i < o.length; i++) { if (o[i] === o) continue; if (i != 0) array.writeUTFBytes(','); if (_prettyPrint) tabs(array, level+1); _format(o[i], array, level+1); } if (_prettyPrint && o.length > 0) tabs(array, level+1); array.writeUTFBytes(']'); } else { var classInfo:Object = ObjectUtil.getClassInfo(o, null, { includeReadOnly: true, includeTransient: false, uris: null }); array.writeUTFBytes('{'); var first:Boolean = true; for each (var key:Object in classInfo.properties) { if (o[key] === o || (_suppressNull && !o[key])) continue; if (first) { first = false; } else { array.writeUTFBytes(','); } if (_prettyPrint) tabs(array, level+1); _formatString(key.toString(), array); array.writeUTFBytes(':'); if (_prettyPrint) array.writeUTFBytes(' '); _format(o[key], array, level+1); } if (_prettyPrint && first) tabs(array, level+1); array.writeUTFBytes('}'); } return array; } private function _formatString(s:String, array:ByteArray):ByteArray { array.writeUTFBytes('"'); for (var i:int = 0; i < s.length; i++) { var c:String = s.charAt(i); switch (c) { case '"': case '\\': array.writeUTFBytes('\\'); array.writeUTFBytes(c); break; case '\b': array.writeUTFBytes('\\b'); break; case '\f': array.writeUTFBytes('\\f'); break; case '\n': array.writeUTFBytes('\\n'); break; case '\r': array.writeUTFBytes('\\r'); break; case '\t': array.writeUTFBytes('\\t'); break; default: array.writeUTFBytes(c); } } array.writeUTFBytes('"'); return array; } private function _parse(s:IParserSource):Object { var o:Object = null; var c:String = null; while ((c = s.next()) != null) { switch(c) { case '\r': case '\n': case ' ': case '\t': case '\uFEFF': // BOM break; case '[': if (o == null) { s.back(); o = _parseArray(s, 1); } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '/': case '#': s.back(); _skipComment(s); break; default: if (o == null) { s.back(); o = _parseObject(s, 1); } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } } } return (!o) ? {} : o; } private function _parseObject(s:IParserSource, level:int):Object { var point:int = 0; // 0 '{' 1 'key' 2 ':' 3 '\n'? 4 'value' 5 '\n'? 6 ',' ... '}' E var map:Object = (level <= _maxDepth) ? {} : null; var key:Object = null; var value:Object = null; var start:String = '\0'; var c:String = null; loop:while ((c = s.next()) != null) { switch(c) { case '\r': case '\n': if (point == 5) { point = 6; } break; case ' ': case '\t': case '\uFEFF': // BOM break; case '{': if (point == 0) { start = '{'; point = 1; } else if (point == 2 || point == 3){ s.back(); value = _parseObject(s, level+1); if (level < _maxDepth) map[key] = value; point = 5; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case ':': if (point == 2) { point = 3; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case ',': if (point == 3) { if (level < _maxDepth && !_suppressNull) map[key] = null; point = 1; } else if (point == 5 || point == 6) { point = 1; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '}': if (start == '{' && (point == 1 || point == 3 || point == 5 || point == 6)) { if (point == 3) { if (level < _maxDepth && !_suppressNull) map[key] = null; } } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break loop; case '\'': case '"': if (point == 0) { s.back(); point = 1; } else if (point == 1 || point == 6) { s.back(); key = _parseString(s); point = 2; } else if (point == 3) { s.back(); value = _parseString(s); if (level < _maxDepth) map[key] = value; point = 5; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '[': if (point == 3) { s.back(); value = _parseArray(s, level+1); if (level < _maxDepth) map[key] = value; point = 5; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '/': case '#': s.back(); _skipComment(s); if (point == 5) { point = 6; } break; default: if (point == 0) { s.back(); point = 1; } else if (point == 1 || point == 6) { s.back(); key = ((c == '-') || (c >= '0' && c <= '9')) ? _parseNumber(s) : _parseLiteral(s); point = 2; } else if (point == 3) { s.back(); value = ((c == '-') || (c >= '0' && c <= '9')) ? _parseNumber(s) : _parseLiteral(s); if (level < _maxDepth && (value != null || !_suppressNull)) map[key] = value; point = 5; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } } } if (c == null) { if (point == 3 || point == 4) { if (level < _maxDepth && !_suppressNull) map[key] = null; } else if (point == 2) { throw createParseException(getMessage("json.parse.ObjectNotClosedError"), s); } } if ((c == null) ? (start != '\0') : (c != '}')) { throw createParseException(getMessage("json.parse.ObjectNotClosedError"), s); } return map; } private function _parseArray(s:IParserSource, level:int):Array { var point:int = 0; // 0 '[' 1 'value' 2 '\n'? 3 ',' ... ']' E var list:Array = []; var value:Object = null; var c:String = null; loop:while ((c = s.next()) != null) { switch(c) { case '\r': case '\n': if (point == 2) { point = 3; } break; case ' ': case '\t': case '\uFEFF': // BOM break; case '[': if (point == 0) { point = 1; } else if (point == 1 || point == 3) { s.back(); value = _parseArray(s, level+1); if (level < _maxDepth) list.push(value); point = 2; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case ',': if (point == 1) { if (level < _maxDepth) list.push(null); } else if (point == 2 || point == 3) { point = 1; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case ']': if (point == 1 || point == 2 || point == 3) { if (point == 1 && list.length != 0 && level < _maxDepth) { list.push(null); } } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break loop; case '{': if (point == 1 || point == 3){ s.back(); value = _parseObject(s, level+1); if (level < _maxDepth) list.push(value); point = 2; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '\'': case '"': if (point == 1 || point == 3) { s.back(); value = _parseString(s); if (level < _maxDepth) list.push(value); point = 2; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '/': case '#': s.back(); _skipComment(s); if (point == 2) { point = 3; } break; default: if (point == 1 || point == 3) { s.back(); value = ((c == '-') || (c >= '0' && c <= '9')) ? _parseNumber(s) : _parseLiteral(s); if (level < _maxDepth) list.push(value); point = 2; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } } } if (c != ']') { throw createParseException(getMessage("json.parse.ArrayNotClosedError"), s); } return list; } private function _parseString(s:IParserSource):String { var point:int = 0; // 0 '"|'' 1 'c' ... '"|'' E var sb:ByteArray = s.getCachedBuilder(); var start:String = '\0'; var c:String = null; loop:while ((c = s.next()) != null) { switch(c) { case '\uFEFF': // BOM break; case '\\': if (point == 1) { if (start == '"') { s.back(); sb.writeUTFBytes(_parseEscape(s)); } else { sb.writeUTFBytes(c); } } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '\'': case '"': if (point == 0) { start = c; point = 1; } else if (point == 1) { if (start == c) { break loop; } else { sb.writeUTFBytes(c); } } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; default: if (point == 1) { sb.writeUTFBytes(c); } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } } } if (c != start) { throw createParseException(getMessage("json.parse.StringNotClosedError"), s); } return sb.toString(); } private function _parseLiteral(s:IParserSource):Object { var point:int = 0; // 0 'IdStart' 1 'IdPart' ... !'IdPart' E var sb:ByteArray = s.getCachedBuilder(); var c:String = null; loop:while ((c = s.next()) != null) { if (c == '\uFEFF') continue; if (c == '\\') { s.back(); c = _parseEscape(s); } if (point == 0 && /[a-zA-Z$_]/.test(c)) { sb.writeUTFBytes(c); point = 1; } else if (point == 1 && /[a-zA-Z0-9$_]/.test(c)){ sb.writeUTFBytes(c); } else { s.back(); break loop; } } var str:String = sb.toString(); if ("null" == str) return null; if ("true" == str) return true; if ("false" == str) return false; return str; } private function _parseNumber(s:IParserSource):Number { var point:int = 0; // 0 '(-)' 1 '0' | ('[1-9]' 2 '[0-9]*') 3 '(.)' 4 '[0-9]' 5 '[0-9]*' 6 'e|E' 7 '[+|-]' 8 '[0-9]' 9 '[0-9]*' E var sb:ByteArray = s.getCachedBuilder(); var c:String = null; loop:while ((c = s.next()) != null) { switch(c) { case '\uFEFF': // BOM break; case '+': if (point == 7) { sb.writeUTFBytes(c); point = 8; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '-': if (point == 0) { sb.writeUTFBytes(c); point = 1; } else if (point == 7) { sb.writeUTFBytes(c); point = 8; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '.': if (point == 2 || point == 3) { sb.writeUTFBytes(c); point = 4; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case 'e': case 'E': if (point == 2 || point == 3 || point == 5 || point == 6) { sb.writeUTFBytes(c); point = 7; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; default: if (c >= '0' && c <= '9') { if (point == 0 || point == 1) { sb.writeUTFBytes(c); point = (c == '0') ? 3 : 2; } else if (point == 2 || point == 5 || point == 9) { sb.writeUTFBytes(c); } else if (point == 4) { sb.writeUTFBytes(c); point = 5; } else if (point == 7 || point == 8) { sb.writeUTFBytes(c); point = 9; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } } else if (point == 2 || point == 3 || point == 5 || point == 6 || point == 9) { s.back(); break loop; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } } } return new Number(sb.toString()); } private function _parseEscape(s:IParserSource):String { var point:int = 0; // 0 '\' 1 'u' 2 'x' 3 'x' 4 'x' 5 'x' E var escape:String = '\0'; var c:String = null; loop:while ((c = s.next()) != null) { if (c == '\uFEFF') continue; // BOM if (point == 0) { if (c == '\\') { point = 1; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } } else if (point == 1) { switch(c) { case '"': case '\\': case '/': escape = c; break loop; case 'b': escape = '\b'; break loop; case 'f': escape = '\f'; break loop; case 'n': escape = '\n'; break loop; case 'r': escape = '\r'; break loop; case 't': escape = '\t'; break loop; case 'u': var n:Number = parseInt(s.next() + s.next() + s.next() + s.next(), 16); if (n && !isNaN(n)) { escape = String.fromCharCode(n); } else { throw createParseException(getMessage("json.parse.IllegalUnicodeEscape", c), s); } break loop; default: escape = c; break loop; } } } return escape; } private function _skipComment(s:IParserSource):void { var point:int = 0; // 0 '/' 1 '*' 2 '*' 3 '/' E or 0 '/' 1 '/' 4 '\r|\n|\r\n' E var c:String = null; loop:while ((c = s.next()) != null) { switch(c) { case '\uFEFF': break; case '/': if (point == 0) { point = 1; } else if (point == 1) { point = 4; } else if (point == 3) { break loop; } else if (!(point == 2 || point == 4)) { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '*': if (point == 1) { point = 2; } else if (point == 2) { point = 3; } else if (!(point == 3 || point == 4)) { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '\n': case '\r': if (point == 2 || point == 3) { point = 2; } else if (point == 4) { break loop; } else { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; case '#': if (point == 0) { point = 4; } else if (point == 3) { point = 2; } else if (!(point == 2 || point == 4)) { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } break; default: if (point == 3) { point = 2; } else if (!(point == 2 || point == 4)) { throw createParseException(getMessage("json.parse.UnexpectedChar", c), s); } } } } private function createParseException(message:String, s:IParserSource):Error { return new JSONParseError("" + s.lineNumber + ": " + message + "\n" + s.toString() + " <- ?", s.lineNumber, s.columnNumber, s.offset); } private function getMessage(id:String, ... args:Array):String { return _resourceManager.getString("jsonic", id, args); } private static function tabs(array:ByteArray, count:int):void { array.writeUTFBytes('\n'); for (var i:int = 0; i < count; i++) { array.writeUTFBytes('\t'); } } } } import flash.utils.ByteArray; interface IParserSource { function next():String; function back():void; function get lineNumber():int; function get columnNumber():int; function get offset():int; function getCachedBuilder():ByteArray; function toString():String; } class StringParserSource implements IParserSource { private var _lines:int = 1; private var _columns:int = 1; private var _offset:int = 0; private var _cs:String; private var _cache:ByteArray = new ByteArray(); public function StringParserSource(cs:String) { if (cs == null) throw ArgumentError("Invalid argument:" + cs); _cs = cs; } public function next():String { if (_offset < _cs.length) { var c:String = _cs.charAt(_offset++); if (c == '\r' || (c == '\n' && _offset > 1 && _cs.charAt(offset-2) != '\r')) { _lines++; _columns = 0; } else { _columns++; } return c; } return null; } public function back():void { _offset--; _columns--; } public function get lineNumber():int { return _lines; } public function get columnNumber():int { return _columns; } public function get offset():int { return _offset; } public function getCachedBuilder():ByteArray { _cache.length = 0; return _cache; } public function toString():String { return _cs.substring(_offset-_columns+1, _offset); } }
package swag.interfaces.core { /** * * SwagDataTools class interface. * * @author Patrick Bay * * The MIT License (MIT) * * Copyright (c) 2014 Patrick Bay * * 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. */ public interface ISwagDataTools { }//IDataTools interface }//swag.interfaces.core package
/** * Copyright (c) Michael Baczynski 2007 * http://lab.polygonal.de/ds/ * * This software is distributed under licence. Use of this software * implies agreement with all terms and conditions of the accompanying * software licence. */ package de.polygonal.ds { import de.polygonal.ds.Collection; import de.polygonal.ds.Iterator; import de.polygonal.ds.SListNode; import de.polygonal.ds.SListIterator; /** * A singly linked list. */ public class SLinkedList implements Collection { private var _count:int; /** * The head node being referenced. */ public var head:SListNode; /** * The tail node being referenced. */ public var tail:SListNode; /** * Initializes an empty list. */ public function SLinkedList() { head = tail = null; _count = 0; } /** * Appends an item to the list. * * @param obj The data. * @return A singly linked list node wrapping the data. */ public function append(obj:*):SListNode { var node:SListNode = new SListNode(obj); if (head) { tail.next = node; tail = node; } else head = tail = node; _count++; return node; } /** * Prepends an item to the list. * * @param obj The data. * @return A singly linked list node wrapping the data. */ public function prepend(obj:*):SListNode { var node:SListNode = new SListNode(obj); if (head) { node.next = head; head = node; } else head = tail = node; _count++; return node; } /** * Inserts data after a given iterator or appends it * if the iterator is invalid. * * @param itr A singly linked list iterator. * @param obj The data. * @return A singly linked list node wrapping the data. */ public function insertAfter(itr:SListIterator, obj:*):SListNode { if (itr.list != this) return null; if (itr.node) { var node:SListNode = new SListNode(obj); itr.node.insertAfter(node); if (itr.node == tail) tail = itr.node.next; _count++; return node; } else return append(obj); } /** * Removes the node the iterator is pointing * to and move the iterator to the next node. * * @return True if the removal succeeded, otherwise false. */ public function remove(itr:SListIterator):Boolean { if (itr.list != this || !itr.node) return false; var node:SListNode = head; if (itr.node == head) { itr.forth(); removeHead(); return true; } while (node.next != itr.node) node = node.next; itr.forth(); if (node.next == tail) tail = node; node.next = itr.node; _count--; return true; } /** * Removes the head of the list. */ public function removeHead():void { if (!head) return; if (head == tail) head = tail = null; else { var node:SListNode = head; head = head.next; node.next = null; if (head == null) tail = null; } _count--; } /** * Removes the tail of the list. */ public function removeTail():void { if (!tail) return; if (head == tail) head = tail = null; else { var node:SListNode = head; while (node.next != tail) node = node.next; tail = node; node.next = null; } _count--; } /** * Removes and appends the head node to the tail. */ public function shiftUp():void { var t:SListNode = head; if (head.next == tail) { head = tail; tail = t; tail.next = null; head.next = tail; } else { head = head.next; tail.next = t; t.next = null; tail = t; } } /** * Removes and prepends the tail node to the head. */ public function popDown():void { var t:SListNode = tail; if (head.next == tail) { tail = head; head = t; tail.next = null; head.next = tail; } else { var node:SListNode = head; while (node.next != tail) node = node.next; tail = node; tail.next = null; t.next = head; head = t; } } /** * Checks if a given item exists. * * @return True if the item is found, otherwise false. */ public function contains(obj:*):Boolean { var node:SListNode = head; while (node) { if (node.data == obj) return true; node = node.next; } return false; } /** * Clears the list by unlinking all nodes * from it. This is important to unlock * the nodes for the garbage collector. */ public function clear():void { var node:SListNode = head; head = null; var next:SListNode; while (node) { next = node.next; node.next = null; node = next; } _count = 0; } /** * Creates an iterator pointing * to the first node in the list. * * @returns An iterator object. */ public function getIterator():Iterator { return new SListIterator(this, head); } /** * Creates a list iterator pointing * to the first node in the list. * * @returns A SListIterator object. */ public function getListIterator():SListIterator { return new SListIterator(this, head); } /** * The total number of nodes in the list. */ public function get size():int { return _count; } /** * Checks if the list is empty. */ public function isEmpty():Boolean { return _count == 0; } /** * Converts the linked list into an array. * * @return An array. */ public function toArray():Array { var a:Array = []; var node:SListNode = head; while (node) { a.push(node.data); node = node.next; } return a; } /** * Returns a string representing the current object. */ public function toString():String { return "[SlinkedList, size=" + size + "]"; } /** * Prints out all elements in the list (for debug/demo purposes). */ public function dump():String { if (!head) return "SLinkedList: (empty)"; var s:String = "SLinkedList: (has " + _count + " node" + (_count == 1 ? ")" : "s") + "\n|< Head\n"; var itr:SListIterator = getListIterator(); for (; itr.valid(); itr.forth()) s += "\t" + itr.data + "\n"; s += "Tail >|"; return s; } } }
package com.hurlant.util.der { public interface IAsn1Type { function getType():uint; function getLength():uint; } }
package states.games { import enums.CustomOptionsRegistryType; import enums.DifficultyType; import enums.GameType; import states.games.BaseGameState; /** * ... * @author Alex */ public class HordeGameState extends BaseGameState { //vars //constructor public function HordeGameState() { } //public override public function create(args:Array = null):void { args = addArg(args, { "gameType": GameType.HORDE }); super.create(args); physicsEngine.addBody(sentry.body); addChild(sentry.graphics); } //private } }
//////////////////////////////////////////////////////////////////////////////// // // 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.core { import org.apache.royale.core.ITextInput; import mx.managers.IFocusManagerComponent; import mx.controls.listClasses.IDropInListItemRenderer; import mx.controls.listClasses.IListItemRenderer; /* import mx.styles.IStyleClient; */ /** * Defines an interface for a single-line text field that is optionally editable. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public interface ITextInput extends IDataRenderer, IUIComponent, IDropInListItemRenderer, IListItemRenderer, IFocusManagerComponent, org.apache.royale.core.ITextInput { //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // selectionActivePosition //---------------------------------- /** * The zero-based index of the position <i>after</i> the last character * in the current selection (equivalent to the one-based index of the last * character). * If the last character in the selection, for example, is the fifth * character, this property has the value 5. * When the control gets the focus, the selection is visible if the * <code>selectionAnchorIndex</code> and <code>selectionActiveIndex</code> * properties are both set. * * @default 0 * * @tiptext The zero-based index value of the last character * in the selection. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function get selectionActivePosition():int; //---------------------------------- // selectionAnchorPosition //---------------------------------- /** * The zero-based character index value of the first character * in the current selection. * For example, the first character is 0, the second character is 1, * and so on. * When the control gets the focus, the selection is visible if the * <code>selectionAnchorIndex</code> and <code>selectionActiveIndex</code> * properties are both set. * * @default 0 * * @tiptext The zero-based index value of the first character * in the selection. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function get selectionAnchorPosition():int; //---------------------------------- // editable //---------------------------------- /** * Indicates whether the user is allowed to edit the text in this control. * If <code>true</code>, the user can edit the text. * * @default true * * @tiptext Specifies whether the component is editable or not * @helpid 3196 * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function get editable():Boolean; /** * @private */ function set editable(value:Boolean):void; //---------------------------------- // horizontalScrollPosition //---------------------------------- /** * Pixel position in the content area of the leftmost pixel * that is currently displayed. * (The content area includes all contents of a control, not just * the portion that is currently displayed.) * This property is always set to 0, and ignores changes, * if <code>wordWrap</code> is set to <code>true</code>. * * @default 0 * @tiptext The pixel position of the left-most character * that is currently displayed * @helpid 3194 * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function get horizontalScrollPosition():Number; /** * @private */ function set horizontalScrollPosition(value:Number):void; //---------------------------------- // maxChars //---------------------------------- /** * Maximum number of characters that users can enter in the text field. * This property does not limit the length of text specified by the * setting the control's <code>text</code> or <code>htmlText</code> property. * * <p>The default value is 0, which is a special case * meaning an unlimited number.</p> * * @tiptext The maximum number of characters * that the TextInput can contain * @helpid 3191 * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function get maxChars():int; /** * @private */ function set maxChars(value:int):void; //---------------------------------- // parentDrawsFocus //---------------------------------- /** * If true, calls to this control's <code>drawFocus()</code> method are forwarded * to its parent's <code>drawFocus()</code> method. * This is used when a TextInput is part of a composite control * like NumericStepper or ComboBox; * * @default false * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function get parentDrawsFocus():Boolean; /** * @private */ function set parentDrawsFocus(value:Boolean):void; //---------------------------------- // restrict //---------------------------------- /** * Indicates the set of characters that a user can enter into the control. * If the value of the <code>restrict</code> property is <code>null</code>, * you can enter any character. If the value of the <code>restrict</code> * property is an empty string, you cannot enter any character. * This property only restricts user interaction; a script * can put any text into the text field. If the value of * the <code>restrict</code> property is a string of characters, * you may enter only characters in that string into the * text field. * * <p>Flex scans the string from left to right. You can specify a range by * using the hyphen (-) character. * If the string begins with a caret (^) character, all characters are * initially accepted and succeeding characters in the string are excluded * from the set of accepted characters. If the string does not begin with a * caret (^) character, no characters are initially accepted and succeeding * characters in the string are included in the set of accepted characters.</p> * * <p>Because some characters have a special meaning when used * in the <code>restrict</code> property, you must use * backslash characters to specify the literal characters -, &#094;, and \. * When you use the <code>restrict</code> property as an attribute * in an MXML tag, use single backslashes, as in the following * example: \&#094;\-\\. * When you set the <code>restrict</code> In and ActionScript expression, * use double backslashes, as in the following example: \\&#094;\\-\\\.</p> * * @default null * @see flash.text.TextField#restrict * @tiptext The set of characters that may be entered * into the TextInput. * @helpid 3193 * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function get restrict():String; /** * @private */ function set restrict(value:String):void; //---------------------------------- // selectable //---------------------------------- /** * A flag indicating whether the text in the TextInput can be selected. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function get selectable():Boolean; /** * @private */ function set selectable(value:Boolean):void; //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * Selects the text in the range specified by the parameters. * * @param anchorPosition The zero-based character index value * of the first character in the current selection. * * @param activePosition The zero-based index of the position * after the last character in the current selection * (equivalent to the one-based index of the last character). * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ function selectRange(anchorPosition:int, activePosition:int):void; } }
package com.company.assembleegameclient.ui { import com.company.assembleegameclient.objects.ObjectLibrary; import com.company.ui.SimpleText; import com.company.util.BitmapUtil; import com.company.util.GraphicsUtil; import com.company.util.MoreColorUtil; import com.company.util.SpriteUtil; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.CapsStyle; import flash.display.GraphicsPath; import flash.display.GraphicsSolidFill; import flash.display.GraphicsStroke; import flash.display.IGraphicsData; import flash.display.JointStyle; import flash.display.LineScaleMode; import flash.display.Shape; import flash.geom.Matrix; import flash.geom.Point; public class TradeSlot extends Slot { private static const DOSE_MATRIX:Matrix = function ():Matrix { var m:* = new Matrix(); m.translate(10, 5); return m; }(); public function TradeSlot(item:int, tradeable:Boolean, included:Boolean, type:int, hotkey:int, cuts:Array, id:uint) { var texture:BitmapData = null; var eqXML:XML = null; var offset:Point = null; var tempText:SimpleText = null; this.overlayFill_ = new GraphicsSolidFill(16711310, 1); this.lineStyle_ = new GraphicsStroke(2, false, LineScaleMode.NORMAL, CapsStyle.NONE, JointStyle.ROUND, 3, this.overlayFill_); this.overlayPath_ = new GraphicsPath(new Vector.<int>(), new Vector.<Number>()); this.graphicsData_ = new <IGraphicsData>[this.lineStyle_, this.overlayPath_, GraphicsUtil.END_STROKE]; super(type, hotkey, cuts); this.id = id; this.item_ = item; this.tradeable_ = tradeable; this.included_ = included; if (this.item_ != -1) { SpriteUtil.safeRemoveChild(this, backgroundImage_); texture = ObjectLibrary.getRedrawnTextureFromType(this.item_, 80, true); eqXML = ObjectLibrary.xmlLibrary_[this.item_]; if (eqXML.hasOwnProperty("Doses")) { texture = texture.clone(); tempText = new SimpleText(12, 16777215, false, 0, 0); tempText.text = String(eqXML.Doses); tempText.updateMetrics(); texture.draw(tempText, DOSE_MATRIX); } else if (eqXML && eqXML.hasOwnProperty("Quantity")) { texture = texture.clone(); tempText = new SimpleText(12, 16777215, false, 0, 0); tempText.text = String(eqXML.Quantity); tempText.updateMetrics(); texture.draw(tempText, DOSE_MATRIX); } offset = offsets(this.item_, type_, false); texture = BitmapUtil.trimAlpha(texture); this.itemBitmap_ = new Bitmap(texture); this.itemBitmap_.x = WIDTH / 2 - this.itemBitmap_.width / 2 + offset.x; this.itemBitmap_.y = HEIGHT / 2 - this.itemBitmap_.height / 2 + offset.y; SpriteUtil.safeAddChild(this, this.itemBitmap_); } if (!this.tradeable_) { transform.colorTransform = MoreColorUtil.veryDarkCT; } this.overlay_ = this.getOverlay(); addChild(this.overlay_); this.setIncluded(included); } public var id:uint; public var item_:int; public var tradeable_:Boolean; public var included_:Boolean; public var itemBitmap_:Bitmap; public var overlay_:Shape; private var overlayFill_:GraphicsSolidFill; private var lineStyle_:GraphicsStroke; private var overlayPath_:GraphicsPath; private var graphicsData_:Vector.<IGraphicsData>; public function setIncluded(included:Boolean):void { this.included_ = included; this.overlay_.visible = this.included_; if (this.included_) { fill_.color = 16764247; } else { fill_.color = 5526612; } drawBackground(); } private function getOverlay():Shape { var shape:Shape = new Shape(); GraphicsUtil.clearPath(this.overlayPath_); GraphicsUtil.drawCutEdgeRect(0, 0, WIDTH, HEIGHT, 4, cuts_, this.overlayPath_); shape.graphics.drawGraphicsData(this.graphicsData_); return shape; } } }
//THIS FILE IS AUTO GENERATED, DO NOT MODIFY!! //THIS FILE IS AUTO GENERATED, DO NOT MODIFY!! //THIS FILE IS AUTO GENERATED, DO NOT MODIFY!! package com.gamesparks.api.messages { import com.gamesparks.api.types.*; import com.gamesparks.*; /** * A message sent from a Cloud Code script to one or more players. * See the Spark.sendMessage function in the Cloud Code - Java Script API documentation. */ public class ScriptMessage extends GSResponse { public static var MESSAGE_TYPE:String = ".ScriptMessage"; public function ScriptMessage(data : Object) { super(data); } /** * JSON data sent from a Cloud Code script. */ public function getData() : Object { if(data.data != null) { return data.data; } return null; } /** * The extension code used when creating this script message */ public function getExtCode() : String { if(data.extCode != null) { return data.extCode; } return null; } /** * A unique identifier for this message. */ public function getMessageId() : String { if(data.messageId != null) { return data.messageId; } return null; } /** * Flag indicating whether this message could be sent as a push notification or not. */ public function getNotification() : Boolean { if(data.notification != null) { return data.notification; } return false; } /** * A textual title for the message. */ public function getSubTitle() : String { if(data.subTitle != null) { return data.subTitle; } return null; } /** * A textual summary describing the message's purpose. */ public function getSummary() : String { if(data.summary != null) { return data.summary; } return null; } /** * A textual title for the message. */ public function getTitle() : String { if(data.title != null) { return data.title; } return null; } } }
package com.profusiongames.notifications { import starling.display.Image; import starling.display.Sprite; import starling.textures.Texture; /** * ... * @author UnknownGuardian */ public class HeightMarker extends Sprite { [Embed(source = "../../../../lib/Graphics/notifications/height_marker.png")]private var _marker:Class; private var _image:Image; public function HeightMarker() { _image = new Image(Texture.fromBitmap(new _marker())); addChild(_image); pivotY = int(height / 2); } } }
/* * Copyright 2009-2010 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.as3commons.lang { import flexunit.framework.TestCase; import org.as3commons.lang.testclasses.PublicClass; /** * @author Christophe Herreman */ public class ObjectUtilsTest extends TestCase { public function ObjectUtilsTest(methodName:String = null) { super(methodName); } public function testIsExplicitInstanceOf():void { assertTrue(ObjectUtils.isExplicitInstanceOf(this, ObjectUtilsTest)); assertFalse(ObjectUtils.isExplicitInstanceOf(this, TestCase)); } public function testIsExplicitInstanceOf_withString():void { assertTrue(ObjectUtils.isExplicitInstanceOf("test", String)); } public function testGetIterator():void { var iterator:IIterator = ObjectUtils.getIterator(new PublicClass()); assertNotNull(iterator); assertNotNull(iterator.next()); } } }
/* * =BEGIN CLOSED LICENSE * * Copyright (c) 2013-2014 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.components.core { /** * TBD */ public final class ComponentState { /** * TBD */ public static const DEFAULT:String = "Default"; /** * TBD */ public static const OVER:String = "Over"; /** * TBD */ public static const DOWN:String = "Down"; /** * TBD */ public static const DISABLED:String = "Disabled"; /** * TBD */ public static const SELECTED:String = "Selected"; //-------------------------------------- // Constructor //-------------------------------------- /** * TBD */ public function ComponentState() { throw new Error("Error! Cannot instantiate 'ComponentStates' class."); } } }
/* A fairly versatile primitive capable of representing circles, fans, hoops, and arcs. Contains a great sin/cos trick learned from Iñigo Quílez's site http://www.iquilezles.org/www/articles/sincos/sincos.htm */ package starling.display.graphics { import flash.geom.Matrix; import flash.geom.Point; import starling.core.RenderSupport; import starling.core.Starling; import starling.display.graphics.util.TriangleUtil; import starling.geom.Polygon; public class NGon extends Graphic { private const DEGREES_TO_RADIANS :Number = Math.PI / 180; private var _radius :Number; private var _innerRadius :Number; private var _startAngle :Number; private var _endAngle :Number; private var _numSides :int; private var _color :uint = 0xFFFFFF; private var _textureAlongPath:Boolean = false; private var _forceTexturedCircle:Boolean = false; private var _forceAntiAliasedCircle:Boolean = false; private static var _uv :Point; public function NGon( radius:Number = 100, numSides:int = 10, innerRadius:Number = 0, startAngle:Number = 0, endAngle:Number = 360, textureAlongPath:Boolean = false ) { this.radius = radius; this.numSides = numSides; this.innerRadius = innerRadius; this.startAngle = startAngle; this.endAngle = endAngle; this._textureAlongPath = textureAlongPath; minBounds.x = minBounds.y = -radius; maxBounds.x = maxBounds.y = radius; if ( !_uv ) { _uv = new Point(); } } public static function createTexturedCircle(radius:Number = 100, numSides:int = 10) : NGon { var retval:NGon = new NGon(radius, numSides, 0, 0, 360, false); retval._forceTexturedCircle = true; return retval; } public static function createAntiAliasedCircle(radius:Number = 100, numSides:int = 10) : NGon { var retval:NGon = new NGon(radius, numSides, 0, 0, 360, false); retval._forceAntiAliasedCircle = true; return retval; } public function get endAngle():Number { return _endAngle; } public function set endAngle(value:Number):void { _endAngle = value; setGeometryInvalid(); } public function get startAngle():Number { return _startAngle; } public function set startAngle(value:Number):void { _startAngle = value; setGeometryInvalid(); } public function get radius():Number { return _radius; } public function set color(value:uint) : void { _color = value; setGeometryInvalid(); } public function set radius(value:Number):void { value = value < 0 ? 0 : value; _radius = value; var maxRadius:Number = Math.max(_radius, _innerRadius); minBounds.x = minBounds.y = -maxRadius; maxBounds.x = maxBounds.y = maxRadius; setGeometryInvalid(); } public function get innerRadius():Number { return _innerRadius; } public function set innerRadius(value:Number):void { value = value < 0 ? 0 : value; _innerRadius = value; var maxRadius:Number = Math.max(_radius, _innerRadius); minBounds.x = minBounds.y = -maxRadius; maxBounds.x = maxBounds.y = maxRadius; setGeometryInvalid(); } public function get numSides():int { return _numSides; } public function set numSides(value:int):void { value = value < 3 ? 3 : value; _numSides = value; setGeometryInvalid(); } override protected function buildGeometry():void { vertices = new Vector.<Number>(); indices = new Vector.<uint>(); // Manipulate the input startAngle and endAngle values // into sa and ea. sa will always end up less than // ea, and ea-sa is the shortest clockwise distance // between them. var sa:Number = _startAngle; var ea:Number = _endAngle; var isEqual:Boolean = sa == ea; var sSign:int = sa < 0 ? -1 : 1; var eSign:int = ea < 0 ? -1 : 1; sa *= sSign; ea *= eSign; ea = ea % 360; ea *= eSign; sa = sa % 360; if ( ea < sa ) { ea += 360; } sa *= sSign * DEGREES_TO_RADIANS; ea *= DEGREES_TO_RADIANS; if ( ea - sa > Math.PI*2 ) { ea -= Math.PI*2; } // Manipulate innerRadius and outRadius in r and ir. // ir will always be less than r. var innerRadius:Number = _innerRadius < _radius ? _innerRadius : _radius; var radius:Number = _radius > _innerRadius ? _radius : _innerRadius; // Based upon the input values, choose from // 4 primitive types. Each more complex than the next. var isSegment:Boolean = (sa != 0 || ea != 0); if ( isSegment == false ) isSegment = isEqual; // if sa and ea are equal, treat that as a segment, not a full lap around a circle. if ( innerRadius == 0 && !isSegment ) { if ( _forceAntiAliasedCircle ) buildAntiAliasedCircle(radius, numSides, vertices, indices, _uvMatrix , _color); else if ( _forceTexturedCircle ) buildTexturedCircle(radius, numSides, vertices, indices, _uvMatrix , _color); else buildSimpleNGon(radius, _numSides, vertices, indices, _uvMatrix , _color); } else if ( innerRadius != 0 && !isSegment ) { buildHoop(innerRadius, radius, _numSides, vertices, indices, _uvMatrix , _color, _textureAlongPath); } else if ( innerRadius == 0 ) { buildFan(radius, sa, ea, _numSides, vertices, indices, _uvMatrix , _color); } else { buildArc( innerRadius, radius, sa, ea, _numSides, vertices, indices, _uvMatrix , _color, _textureAlongPath); } } override protected function shapeHitTestLocalInternal( localX:Number, localY:Number ):Boolean { var numIndices:int = indices.length; if ( numIndices < 2 ) { validateNow(); numIndices = indices.length; if ( numIndices < 2 ) return false; } if ( _innerRadius == 0 && _radius > 0 && _startAngle == 0 && _endAngle == 360 && _numSides > 20 ) { // simple - faster - if ngon is circle shape and numsides more than 20, assume circle is desired. if ( Math.sqrt( localX * localX + localY * localY ) < _radius ) return true; return false; } for ( var i:int = 2; i < numIndices; i+=3 ) { // slower version - should be complete though. For all triangles, check if point is in triangle var i0:int = indices[(i - 2)]; var i1:int = indices[(i - 1)]; var i2:int = indices[(i - 0)]; var v0x:Number = vertices[VERTEX_STRIDE * i0 + 0]; var v0y:Number = vertices[VERTEX_STRIDE * i0 + 1]; var v1x:Number = vertices[VERTEX_STRIDE * i1 + 0]; var v1y:Number = vertices[VERTEX_STRIDE * i1 + 1]; var v2x:Number = vertices[VERTEX_STRIDE * i2 + 0]; var v2y:Number = vertices[VERTEX_STRIDE * i2 + 1]; if ( TriangleUtil.isPointInTriangle(v0x, v0y, v1x, v1y, v2x, v2y, localX, localY) ) return true; } return false; } private static function buildSimpleNGon( radius:Number, numSides:int, vertices:Vector.<Number>, indices:Vector.<uint>, uvMatrix:Matrix, color:uint ):void { var numVertices:int = 0; _uv.x = 0; _uv.y = 0; if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); var r:Number = (color >> 16) / 255; var g:Number = ((color & 0x00FF00) >> 8) / 255; var b:Number = (color & 0x0000FF) / 255; vertices.push( 0, 0, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; var anglePerSide:Number = (Math.PI * 2) / numSides; var cosA:Number = Math.cos(anglePerSide); var sinB:Number = Math.sin(anglePerSide); var s:Number = 0.0; var c:Number = 1.0; for ( var i:int = 0; i < numSides; i++ ) { var x:Number = s * radius; var y:Number = -c * radius; _uv.x = x; _uv.y = y; if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); vertices.push( x, y, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; indices.push( 0, numVertices-1, i == numSides-1 ? 1 : numVertices ); const ns:Number = sinB*c + cosA*s; const nc:Number = cosA*c - sinB*s; c = nc; s = ns; } } private static function buildTexturedCircle( radius:Number, numSides:int, vertices:Vector.<Number>, indices:Vector.<uint>, uvMatrix:Matrix, color:uint ):void { var numVertices:int = 0; _uv.x = 0.5; _uv.y = 0.5; if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); var r:Number = (color >> 16) / 255; var g:Number = ((color & 0x00FF00) >> 8) / 255; var b:Number = (color & 0x0000FF) / 255; vertices.push( 0, 0, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; var anglePerSide:Number = (Math.PI * 2) / numSides; var cosA:Number = Math.cos(anglePerSide); var sinB:Number = Math.sin(anglePerSide); var s:Number = 0.0; var c:Number = 1.0; var halfInvRadius:Number = 0.5 * (1.0 / radius); for ( var i:int = 0; i < numSides; i++ ) { var x:Number = s * radius; var y:Number = -c * radius; _uv.x = 0.5 + x * halfInvRadius; _uv.y = 0.5 + y * halfInvRadius; vertices.push( x, y, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; indices.push( 0, numVertices-1, i == numSides-1 ? 1 : numVertices ); const ns:Number = sinB*c + cosA*s; const nc:Number = cosA*c - sinB*s; c = nc; s = ns; } } private static function buildAntiAliasedCircle( radius:Number, numSides:int, vertices:Vector.<Number>, indices:Vector.<uint>, uvMatrix:Matrix, color:uint ):void { var numVertices:int = 0; _uv.x = 0.5; _uv.y = 1.0; if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); var r:Number = (color >> 16) / 255; var g:Number = ((color & 0x00FF00) >> 8) / 255; var b:Number = (color & 0x0000FF) / 255; vertices.push( 0, 0, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; var anglePerSide:Number = (Math.PI * 2) / numSides; var cosA:Number = Math.cos(anglePerSide); var sinB:Number = Math.sin(anglePerSide); var s:Number = 0.0; var c:Number = 1.0; var halfInvRadius:Number = 0.5 * (1.0 / radius); for ( var i:int = 0; i < numSides; i++ ) { var x:Number = s * radius; var y:Number = -c * radius; _uv.x = 0.5 + x * halfInvRadius; _uv.y = 0; vertices.push( x, y, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; indices.push( 0, numVertices-1, i == numSides-1 ? 1 : numVertices ); const ns:Number = sinB*c + cosA*s; const nc:Number = cosA*c - sinB*s; c = nc; s = ns; } } private static function buildHoop( innerRadius:Number, radius:Number, numSides:int, vertices:Vector.<Number>, indices:Vector.<uint>, uvMatrix:Matrix , color:uint, textureAlongPath:Boolean):void { var numVertices:int = 0; var anglePerSide:Number = (Math.PI * 2) / numSides; var cosA:Number = Math.cos(anglePerSide); var sinB:Number = Math.sin(anglePerSide); var s:Number = 0.0; var c:Number = 1.0; var r:Number = (color >> 16) / 255; var g:Number = ((color & 0x00FF00) >> 8) / 255; var b:Number = (color & 0x0000FF) / 255; for ( var i:int = 0; i < numSides; i++ ) { var x:Number = s * radius; var y:Number = -c * radius; if ( textureAlongPath ) { _uv.x = i / numSides; _uv.y = 0; } else { _uv.x = x; _uv.y = y; } if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); vertices.push( x, y, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; x = s * innerRadius; y = -c * innerRadius; if ( textureAlongPath ) { _uv.x = i / numSides; _uv.y = 1; } else { _uv.x = x; _uv.y = y; } if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); vertices.push( x, y, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; if ( i == numSides-1 ) { indices.push( numVertices-2, numVertices-1, 0, 0, numVertices-1, 1 ); } else { indices.push( numVertices - 2, numVertices , numVertices-1, numVertices, numVertices + 1, numVertices - 1 ); } const ns:Number = sinB*c + cosA*s; const nc:Number = cosA*c - sinB*s; c = nc; s = ns; } } private static function buildFan( radius:Number, startAngle:Number, endAngle:Number, numSides:int, vertices:Vector.<Number>, indices:Vector.<uint>, uvMatrix:Matrix , color:uint):void { var numVertices:int = 0; var r:Number = (color >> 16) / 255; var g:Number = ((color & 0x00FF00) >> 8) / 255; var b:Number = (color & 0x0000FF) / 255; vertices.push( 0, 0, 0, r, g, b, 1, 0.5, 0.5 ); numVertices++; var radiansPerDivision:Number = (Math.PI * 2) / numSides; var startRadians:Number = (startAngle / radiansPerDivision); startRadians = startRadians < 0 ? -Math.ceil(-startRadians) : int(startRadians); startRadians *= radiansPerDivision; for ( var i:int = 0; i <= numSides+1; i++ ) { var radians:Number = startRadians + i*radiansPerDivision; var nextRadians:Number = radians + radiansPerDivision; if ( nextRadians < startAngle ) continue; var x:Number = Math.sin( radians ) * radius; var y:Number = -Math.cos( radians ) * radius; var prevRadians:Number = radians-radiansPerDivision; var t:Number if ( radians < startAngle ) { var nextX:Number = Math.sin(nextRadians) * radius; var nextY:Number = -Math.cos(nextRadians) * radius; t = (startAngle-radians) / radiansPerDivision; x += t * (nextX-x); y += t * (nextY-y); } else if ( radians > endAngle ) { var prevX:Number = Math.sin(prevRadians) * radius; var prevY:Number = -Math.cos(prevRadians) * radius; t = (endAngle-prevRadians) / radiansPerDivision; x = prevX + t * (x-prevX); y = prevY + t * (y-prevY); } _uv.x = x; _uv.y = y; if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); vertices.push( x, y, 0, r, g, b, 1, _uv.x, _uv.y ); numVertices++; if ( vertices.length > 2*9 ) { indices.push( 0, numVertices-2, numVertices-1 ); } if ( radians >= endAngle ) { break; } } } private static function buildArc( innerRadius:Number, radius:Number, startAngle:Number, endAngle:Number, numSides:int, vertices:Vector.<Number>, indices:Vector.<uint>, uvMatrix:Matrix , color:uint, textureAlongPath:Boolean):void { var nv:int = 0; var radiansPerDivision:Number = (Math.PI * 2) / numSides; var startRadians:Number = (startAngle / radiansPerDivision); startRadians = startRadians < 0 ? -Math.ceil(-startRadians) : int(startRadians); startRadians *= radiansPerDivision; var r:Number = (color >> 16) / 255; var g:Number = ((color & 0x00FF00) >> 8) / 255; var b:Number = (color & 0x0000FF) / 255; for ( var i:int = 0; i <= numSides+1; i++ ) { var angle:Number = startRadians + i*radiansPerDivision; var nextAngle:Number = angle + radiansPerDivision; if ( nextAngle < startAngle ) continue; var sin:Number = Math.sin(angle); var cos:Number = Math.cos(angle); var x:Number = sin * radius; var y:Number = -cos * radius; var x2:Number = sin * innerRadius; var y2:Number = -cos * innerRadius; var prevAngle:Number = angle-radiansPerDivision; var t:Number if ( angle < startAngle ) { sin = Math.sin(nextAngle); cos = Math.cos(nextAngle); var nextX:Number = sin * radius; var nextY:Number = -cos * radius; var nextX2:Number = sin * innerRadius; var nextY2:Number = -cos * innerRadius; t = (startAngle-angle) / radiansPerDivision; x += t * (nextX-x); y += t * (nextY-y); x2 += t * (nextX2-x2); y2 += t * (nextY2-y2); } else if ( angle > endAngle ) { sin = Math.sin(prevAngle); cos = Math.cos(prevAngle); var prevX:Number = sin * radius; var prevY:Number = -cos * radius; var prevX2:Number = sin * innerRadius; var prevY2:Number = -cos * innerRadius; t = (endAngle-prevAngle) / radiansPerDivision; x = prevX + t * (x-prevX); y = prevY + t * (y-prevY); x2 = prevX2 + t * (x2-prevX2); y2 = prevY2 + t * (y2-prevY2); } if ( textureAlongPath ) { _uv.x = i / numSides; _uv.y = 0; } else { _uv.x = x; _uv.y = y; } if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); vertices.push( x, y, 0, r, g, b, 1, _uv.x, _uv.y ); nv++; if ( textureAlongPath ) { _uv.x = i / numSides; _uv.y = 1; } else { _uv.x = x2; _uv.y = y2; } if ( uvMatrix ) _uv = uvMatrix.transformPoint(_uv); vertices.push( x2, y2, 0, r, g, b, 1, _uv.x, _uv.y ); nv++; if ( vertices.length > 3*9 ) { //indices.push( nv-1, nv-2, nv-3, nv-3, nv-2, nv-4 ); indices.push( nv-3, nv-2, nv-1, nv-3, nv-4, nv-2 ); } if ( angle >= endAngle ) { break; } } } } }
package com.ankamagames.dofus.console.moduleLogger { import flash.display.DisplayObject; import mx.core.SpriteAsset; [ExcludeClass] public class ConsoleIcon_I_SCRIPT extends SpriteAsset { public var origine:DisplayObject; public function ConsoleIcon_I_SCRIPT() { super(); } } }
/** * TLSSecurityParameters * * This class encapsulates all the security parameters that get negotiated * during the TLS handshake. It also holds all the key derivation methods. * Copyright (c) 2007 Henri Torgemane * * See LICENSE.txt for full license information. */ package com.hurlant.crypto.tls { import flash.utils.ByteArray; import com.hurlant.crypto.prng.TLSPRF; import com.hurlant.crypto.hash.MD5; import com.hurlant.crypto.hash.SHA1; import com.hurlant.util.Hex; import com.hurlant.crypto.Crypto; import flash.utils.Endian; public class TLSSecurityParameters { // COMPRESSION public static const COMPRESSION_NULL:uint = 0; private var entity:uint; // SERVER | CLIENT private var bulkCipher:uint; // BULK_CIPHER_* private var cipherType:uint; // STREAM_CIPHER | BLOCK_CIPHER private var keySize:uint; private var keyMaterialLength:uint; private var IVSize:uint; private var macAlgorithm:uint; // MAC_* private var hashSize:uint; private var compression:uint; // COMPRESSION_NULL private var masterSecret:ByteArray; // 48 bytes private var clientRandom:ByteArray; // 32 bytes private var serverRandom:ByteArray; // 32 bytes // not strictly speaking part of this, but yeah. public var keyExchange:uint; public function TLSSecurityParameters(entity:uint) { this.entity = entity; reset(); } public function reset():void { bulkCipher = BulkCiphers.NULL; cipherType = BulkCiphers.BLOCK_CIPHER; macAlgorithm = MACs.NULL; compression = COMPRESSION_NULL; masterSecret = null; } public function getBulkCipher():uint { return bulkCipher; } public function getCipherType():uint { return cipherType; } public function getMacAlgorithm():uint { return macAlgorithm; } public function setCipher(cipher:uint):void { bulkCipher = CipherSuites.getBulkCipher(cipher); cipherType = BulkCiphers.getType(bulkCipher); keySize = BulkCiphers.getExpandedKeyBytes(bulkCipher); // 8 keyMaterialLength = BulkCiphers.getKeyBytes(bulkCipher); // 5 IVSize = BulkCiphers.getIVSize(bulkCipher); keyExchange = CipherSuites.getKeyExchange(cipher); macAlgorithm = CipherSuites.getMac(cipher); hashSize = MACs.getHashSize(macAlgorithm); } public function setCompression(algo:uint):void { compression = algo; } public function setPreMasterSecret(secret:ByteArray):void { // compute master_secret var seed:ByteArray = new ByteArray; seed.writeBytes(clientRandom, 0, clientRandom.length); seed.writeBytes(serverRandom, 0, serverRandom.length); var prf:TLSPRF = new TLSPRF(secret, "master secret", seed); masterSecret = new ByteArray; prf.nextBytes(masterSecret, 48); } public function setClientRandom(secret:ByteArray):void { clientRandom = secret; } public function setServerRandom(secret:ByteArray):void { serverRandom = secret; } public function get useRSA():Boolean { return KeyExchanges.useRSA(keyExchange); } public function computeVerifyData(side:uint, handshakeMessages:ByteArray):ByteArray { var seed:ByteArray = new ByteArray; var md5:MD5 = new MD5; seed.writeBytes(md5.hash(handshakeMessages),0,md5.getHashSize()); var sha:SHA1 = new SHA1; seed.writeBytes(sha.hash(handshakeMessages),0,sha.getHashSize()); var prf:TLSPRF = new TLSPRF(masterSecret, (side==TLSEngine.CLIENT)?"client finished":"server finished", seed); var out:ByteArray = new ByteArray; prf.nextBytes(out, 12); return out; } public function getConnectionStates():Object { if (masterSecret != null) { var seed:ByteArray = new ByteArray; seed.writeBytes(serverRandom, 0, serverRandom.length); seed.writeBytes(clientRandom, 0, clientRandom.length); var prf:TLSPRF = new TLSPRF(masterSecret, "key expansion", seed); var client_write_MAC:ByteArray = new ByteArray; prf.nextBytes(client_write_MAC, hashSize); var server_write_MAC:ByteArray = new ByteArray; prf.nextBytes(server_write_MAC, hashSize); var client_write_key:ByteArray = new ByteArray; prf.nextBytes(client_write_key, keyMaterialLength); var server_write_key:ByteArray = new ByteArray; prf.nextBytes(server_write_key, keyMaterialLength); var client_write_IV:ByteArray = new ByteArray; prf.nextBytes(client_write_IV, IVSize); var server_write_IV:ByteArray = new ByteArray; prf.nextBytes(server_write_IV, IVSize); var client_write:TLSConnectionState = new TLSConnectionState( bulkCipher, cipherType, macAlgorithm, client_write_MAC, client_write_key, client_write_IV); var server_write:TLSConnectionState = new TLSConnectionState( bulkCipher, cipherType, macAlgorithm, server_write_MAC, server_write_key, server_write_IV); if (entity == TLSEngine.CLIENT) { return {read:server_write, write:client_write}; } else { return {read:client_write, write:server_write}; } } else { return {read:new TLSConnectionState, write:new TLSConnectionState}; } } } }
package away3d.loaders.parsers.particleSubParsers.values.setters.threeD { import away3d.animators.data.ParticleProperties; import away3d.loaders.parsers.particleSubParsers.values.setters.SetterBase; import flash.geom.Vector3D; public class ThreeDSphereSetter extends SetterBase { private var _innerRadius3:Number; private var _outerRadius3:Number; private var _centerX:Number; private var _centerY:Number; private var _centerZ:Number; public function ThreeDSphereSetter(propName:String, innerRadius:Number, outerRadius:Number, centerX:Number, centerY:Number, centerZ:Number) { super(propName); _innerRadius3 = Math.pow(innerRadius, 3); _outerRadius3 = Math.pow(outerRadius, 3); _centerX = centerX; _centerY = centerY; _centerZ = centerZ; } override public function setProps(prop:ParticleProperties):void { prop[_propName] = generateOneValue(prop.index, prop.total); } override public function generateOneValue(index:int = 0, total:int = 1):* { var degree1:Number = Math.random() * Math.PI * 2; var radius:Number = Math.pow(Math.random() * (_outerRadius3 - _innerRadius3) + _innerRadius3, 1 / 3); var direction:Vector3D = new Vector3D(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); if (direction.length == 0) direction.x = 1; direction.normalize(); direction.scaleBy(radius); direction.x += _centerX; direction.y += _centerY; direction.z += _centerZ; return direction; } } }
package com.codeazur.as3swf.data.actions.swf4 { import com.codeazur.as3swf.data.actions.*; public class ActionGetVariable extends Action implements IAction { public function ActionGetVariable(code:uint, length:uint) { super(code, length); } public function toString(indent:uint = 0):String { return "[ActionGetVariable]"; } } }
package view.scene.quest { import flash.display.*; import flash.events.Event; import flash.events.MouseEvent; import flash.events.EventDispatcher; import flash.filters.GlowFilter; import flash.filters.DropShadowFilter; import mx.containers.*; import mx.controls.*; import mx.core.UIComponent; import org.libspark.thread.Thread; import org.libspark.thread.utils.ParallelExecutor; import org.libspark.thread.threads.between.BeTweenAS3Thread; import view.utils.*; import view.image.common.AvatarImage; import view.scene.BaseScene; import view.scene.edit.CharaCardDeckClip; import view.scene.common.CharaCardClip; import model.CharaCard; import model.CharaCardDeck; import model.DeckEditor; import model.events.*; /** * クエストに使用するデッキクラス * */ public class QuestDeck extends BaseScene { // 翻訳データ CONFIG::LOCALE_JP private static const _TRANS_MSG :String = "クエストに使用するデッキです。"; CONFIG::LOCALE_EN private static const _TRANS_MSG :String = "The deck used for quests."; CONFIG::LOCALE_TCN private static const _TRANS_MSG :String = "在任務中使用的牌組。"; CONFIG::LOCALE_SCN private static const _TRANS_MSG :String = "用于任务的卡组。"; CONFIG::LOCALE_KR private static const _TRANS_MSG :String = "퀘스트에서 사용하는 덱입니다."; CONFIG::LOCALE_FR private static const _TRANS_MSG :String = "Pioche utilisée pour cette Quête"; CONFIG::LOCALE_ID private static const _TRANS_MSG :String = "クエストに使用するデッキです。"; CONFIG::LOCALE_TH private static const _TRANS_MSG :String = "สำรับที่ใช้ในเควส"; // エディットインスタンス protected var _deckEditor:DeckEditor; // 表示コンテナ protected var _container:UIComponent = new UIComponent(); // カレントデッキ protected var _deckClip:CharaCardDeckClip; // デッキの名前ラベル protected var _deckName:Label = new Label(); private const _LABEL_WIDTH:int = 200; // ラベルの幅 private const _LABEL_HEIGHT:int = 20; // ラベルの高さ private const _LABEL_X:int = 500; // デッキエリアのX位置 private const _LABEL_Y:int = 10; // デッキエリアのY位置 private const _DECK_X:int = 125; // デッキエリアのX位置 private const _DECK_Y:int = 475; // デッキエリアのY位置 private const _DECK_SIZE:Number = 1.0; // デッキサイズ private const _DECK_NAME_X:int = 65; // デッキネームのX位置 private const _DECK_NAME_Y:int = 635; // デッキネームのY位置 // private const _LABEL_WIDTH:int = 200; // ラベルの幅 // private const _LABEL_HEIGHT:int = 20; // ラベルの高さ // private const _LABEL_X:int = 500; // デッキエリアのX位置 // private const _LABEL_Y:int = 10; // デッキエリアのY位置 // private const _DECK_X:int = 110; // デッキエリアのX位置 // private const _DECK_Y:int = 497; // デッキエリアのY位置 // private const _DECK_SIZE:Number = 1.0; // デッキサイズ // private const _DECK_NAME_X:int = 145; // デッキネームのX位置 // private const _DECK_NAME_Y:int = 478; // デッキネームのY位置 private const _CHANGE_X:int = 964; // private const _CHANGE_Y:int = 693; // private const _CHANGE_OFFSET_X:int = 20; // private const _CHANGE_OFFSET_Y:int = 30; // // 変数 protected var _selectIndex:int = 0; // 選択中のデッキインデックス // チップヘルプの設定(上記HELPステート分必要) private var _helpTextArray:Array = [ // ["クエストに使用するデッキです。",], [_TRANS_MSG,], ]; // チップヘルプを設定される側のUIComponetオブジェクト private var _toolTipOwnerArray:Array = []; // チップヘルプのステート private const _QUEST_HELP:int = 0; /** * コンストラクタ * */ public function QuestDeck() { // mouseEnabled = false; // mouseChildren = false; } // ツールチップが必要なオブジェクトをすべて追加する private function initilizeToolTipOwners():void { _toolTipOwnerArray.push([0,this]); // } // protected override function get helpTextArray():Array /* of String or Null */ { return _helpTextArray; } protected override function get toolTipOwnerArray():Array /* of String or Null */ { return _toolTipOwnerArray; } // 初期化 public override function init():void { _deckEditor = DeckEditor.instance; _selectIndex = _deckEditor.currentIndex; _deckEditor.initialize(); initilizeToolTipOwners(); updateHelp(_QUEST_HELP); initDeckData(); addChild(_container); } // 終了 public override function final():void { _deckEditor.finalize(); RemoveChild.apply(_container); deleteDeckData(); } // デッキを初期化 protected function initDeckData():void { _deckClip = new CharaCardDeckClip(CharaCardDeck.decks[_selectIndex]); _deckClip.x = _DECK_X; _deckClip.y = _DECK_Y; _deckClip.scaleX = _deckClip.scaleY = _DECK_SIZE; _deckClip.getShowThread(_container).start(); if(_deckEditor.currentIndex == CharaCardDeck.decks.indexOf(_deckClip.charaCardDeck)) { _deckName.styleName = "CurrentQuestDeckNameLabel"; } else { _deckName.styleName = "CurrentQuestDeckNameLabel"; // _deckName.styleName = "QuestDeckNameLabel"; } _deckName.x = _DECK_NAME_X; _deckName.y = _DECK_NAME_Y; _deckName.width = 160; _deckName.height = _LABEL_HEIGHT; _deckName.text = CharaCardDeck.decks.indexOf(_deckClip.charaCardDeck) + ". " + _deckClip.charaCardDeck.name; _deckName.filters = [new GlowFilter(0xffffff, 1, 2, 2, 16, 1),] _container.addChild(_deckName); } // デッキを消去 protected function deleteDeckData():void { if (_deckClip != null) { _deckClip.getHideThread().start(); _deckClip = null; } } // 左のデッキをクリック public function leftDeckClick():void { _deckEditor.selectIndex = _selectIndex-1; _selectIndex = _deckEditor.selectIndex; deleteDeckData(); initDeckData(); // カレントデッキを変更 _deckEditor.changeCurrentDeck(_selectIndex); log.writeLog(log.LV_INFO, this, "aaaaa", _deckEditor.selectIndex); } // 右のデッキをクリック public function rightDeckClick():void { _deckEditor.selectIndex = _selectIndex+1; _selectIndex = _deckEditor.selectIndex; deleteDeckData(); initDeckData(); // カレントデッキを変更 _deckEditor.changeCurrentDeck(_selectIndex); log.writeLog(log.LV_INFO, this, "bbbbb", _deckEditor.selectIndex); } // 表示用のスレッドを返す public override function getShowThread(stage:DisplayObjectContainer, at:int = -1, type:String=""):Thread { _depthAt = at; return new ShowThread(this, stage, at); } // 非表示用のスレッドを返す public override function getHideThread(type:String=""):Thread { return new HideThread(this); } } } import flash.display.Sprite; import flash.display.DisplayObjectContainer; import org.libspark.thread.Thread; import view.BaseShowThread; import view.BaseHideThread; import view.scene.quest.QuestDeck; class ShowThread extends BaseShowThread { public function ShowThread(aa:QuestDeck, stage:DisplayObjectContainer, at:int) { super(aa, stage); } protected override function run():void { next(close); } } class HideThread extends BaseHideThread { public function HideThread(aa:QuestDeck) { super(aa); } }
package com { import mx.collections.ArrayCollection; public class ArrayCollectionUtils { public static function touchAll(target:ArrayCollection, aFunc:Function, aSelector:String):void { if (aFunc is Function) { var i:int; var anItem:Object; for (i = 0; i < target.length; i++) { anItem = target.getItemAt(i); try { anItem = aFunc(anItem,aSelector); target.setItemAt(anItem,i); } catch (e:Error) {} } } } public static function iterate(target:ArrayCollection, aFunc:Function, aSelector:String):void { if (aFunc is Function) { var i:int; var anItem:Object; for (i = 0; i < target.length; i++) { anItem = target.getItemAt(i); try { anItem = aFunc(anItem,aSelector); } catch (e:Error) {} } } } public static function iterate_until(target:ArrayCollection, aFunc:Function, aSelector:String):void { if (aFunc is Function) { var i:int; var anItem:Object; var bool:Boolean; for (i = 0; i < target.length; i++) { anItem = target.getItemAt(i); try { bool = aFunc(anItem,aSelector,i); if (bool) { break; } } catch (e:Error) { break; } } } } public static function clone(source:ArrayCollection,aFunc:Function=null):ArrayCollection { var ac:ArrayCollection = new ArrayCollection(); if (source is ArrayCollection) { var item:*; var isOkay:Boolean = true; for (var i:String in source.source) { item = source.source[i]; isOkay = (aFunc is Function) ? aFunc(item): isOkay; if (isOkay) { ac.addItem(item); } } } return ac; } public static function appendAllInto(target:ArrayCollection, source:*, aFunc:Function=null):void { if ( (target != null) && (source != null) ) { var i:int; var item:*; var isAdding:Boolean = true; var ac:ArrayCollection; if (source is ArrayCollection) { ac = source; } else if (source is Array) { ac = new ArrayCollection(source); } else if (source != null) { ac = ArrayCollection(source); } if (ac != null) { for (i = 0; i < ac.length; i++) { item = ac.getItemAt(i); if (aFunc is Function) { isAdding = aFunc(item); } if (isAdding) { target.addItem(item); } } } } } public static function replaceAll(target:ArrayCollection, source:*):void { if ( (target != null) && (source != null) ) { target.removeAll(); appendAllInto(target,source); } } public static function findIndexOfItem(dp:*, selector:String, pattern:*):int { var i:int; var ac:ArrayCollection; if (dp is ArrayCollection) { ac = dp; } else if (dp is Array) { ac = new ArrayCollection(dp); } else if (dp != null) { ac = ArrayCollection(dp); } if (ac != null) { var obj:*; for (i = 0; i < ac.length; i++) { obj = ac.getItemAt(i); if ( ((obj is String) == false) && (selector != null) && (selector is String) ) { if (obj[selector] == pattern) { return i; } } else { if (obj == pattern) { return i; } } } } return -1; } public static function findIndexOfItemCaseless(dp:*, selector:*, pattern_or_func:*):int { var i:int; var ac:ArrayCollection; if (dp is ArrayCollection) { ac = dp; } else if (dp is Array) { ac = new ArrayCollection(dp); } else if (dp != null) { ac = ArrayCollection(dp); } var is_func:Boolean = (pattern_or_func is Function); if ( (ac != null) && (pattern_or_func != null) ) { var obj:*; if (!is_func) { pattern_or_func = pattern_or_func.toLowerCase(); } var matches:Boolean = false; for (i = 0; i < ac.length; i++) { obj = ac.getItemAt(i); if (is_func) { matches = pattern_or_func((selector is String) ? obj[selector] : selector,obj); if (matches) { return i; } } else { if ( ((obj is String) == false) && (selector != null) && (selector is String) ) { if (String(obj[selector]).toLowerCase() == pattern_or_func) { return i; } } else { if (String(obj).toLowerCase() == pattern_or_func) { return i; } } } } } return -1; } } }
package com.rockdot.library.view.component.example.scrolling { import com.rockdot.library.view.component.common.scrollable.Scrollbar; import com.jvm.components.Orientation; import flash.display.Graphics; import flash.display.Sprite; /** * @author Nils Doehring (nilsdoehring@gmail.com) */ public class MyScrollbar extends Scrollbar { public function MyScrollbar(orientation : String, max : Number, size : Number, pageJumpDuration : Number = 0.7) { size -= 20; var g : Graphics; // Draw thumb _thumb = new Sprite(); g = _thumb.graphics; g.beginFill(0x333333); g.drawRect(0, 0, 9, 9); g.endFill(); // Draw background _background = new Sprite(); g = _background.graphics; g.beginFill(0xAAAAAA); if (orientation == Orientation.HORIZONTAL) { g.drawRect(0, 0, size, 5); _background.y = 2; x += 10; } else { g.drawRect(0, 0, 5, size); _background.x = 2; y += 10; } g.endFill(); addChild(_background); addChild(_thumb); super(orientation, max, size, pageJumpDuration); pages = 3; } override public function set enabled(value : Boolean) : void { super.enabled = value; visible = _enabled; } } }
package game.assets { /** * ... * @author eu mesmo */ public class Device { public static var scale:Number = 1; public static var deviceScale:Number = 1; public static var textureScale:Number = 1; public static var aspectRatio:Number = 1; public static var deviveWidth:Number = 1024; public static var deviceHeight:Number = 768; public static var maxWidth:Number = 1024; public static var maxHeight:Number = 768; public static var width:Number = 1024; public static var height:Number = 768; public static var baseAspectRatio:Number = 1.33333333333333333; public static var stageOffset:Number = 0; public static var relativeScale:Number = 1; } }
/***************************************************** * * Copyright 2009 Adobe Systems Incorporated. All Rights Reserved. * ***************************************************** * The contents of this file are subject to the Mozilla Public License * Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * * The Initial Developer of the Original Code is Adobe Systems Incorporated. * Portions created by Adobe Systems Incorporated are Copyright (C) 2009 Adobe Systems * Incorporated. All Rights Reserved. * *****************************************************/ package org.osmf.events { import flash.events.Event; /** * A MediaPlayer dispatches a MediaPlayerCapabilityChangeEvent when its * capabilities change. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public class MediaPlayerCapabilityChangeEvent extends Event { /** * The MediaPlayerCapabilityChangeEvent.CAN_PLAY_CHANGE constant defines * the value of the type property of the event object for a canPlayChange * event. * * @eventType canPlayChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const CAN_PLAY_CHANGE:String = "canPlayChange"; /** * The MediaPlayerCapabilityChangeEvent.CAN_SEEK_CHANGE constant defines * the value of the type property of the event object for a canSeekChange * event. * * @eventType canSeekChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const CAN_SEEK_CHANGE:String = "canSeekChange"; /** * The MediaPlayerCapabilityChangeEvent.TEMPORAL_CHANGE constant defines * the value of the type property of the event object for a temporalChange * event. * * @eventType temporalChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const TEMPORAL_CHANGE:String = "temporalChange"; /** * The MediaPlayerCapabilityChangeEvent.HAS_AUDIO_CHANGE constant defines * the value of the type property of the event object for a hasAudioChange * event. * * @eventType hasAudioChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const HAS_AUDIO_CHANGE:String = "hasAudioChange"; /** * The MediaPlayerCapabilityChangeEvent.IS_DYNAMIC_STREAM_CHANGE constant defines * the value of the type property of the event object for a isDynamicStreamChange * event. * * @eventType isDynamicStreamChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const IS_DYNAMIC_STREAM_CHANGE:String = "isDynamicStreamChange"; /** * The MediaPlayerCapabilityChangeEvent.CAN_LOAD_CHANGE constant defines * the value of the type property of the event object for a canLoadChange * event. * * @eventType canLoadChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const CAN_LOAD_CHANGE:String = "canLoadChange"; /** * The MediaPlayerCapabilityChangeEvent.CAN_BUFFER_CHANGE constant defines * the value of the type property of the event object for a canBufferChange * event. * * @eventType canBufferChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const CAN_BUFFER_CHANGE:String = "canBufferChange"; /** * The MediaPlayerCapabilityChangeEvent.HAS_DRM_CHANGE constant defines * the value of the type property of the event object for a hasDRMChange * event. * * @eventType hasDRMChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const HAS_DRM_CHANGE:String = "hasDRMChange"; /** * The MediaPlayerCapabilityChangeEvent.HAS_DISPLAY_OBJECT_CHANGE constant defines * the value of the type property of the event object for a hasDisplayObjectChange * event. * * @eventType hasDisplayObjectChange * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public static const HAS_DISPLAY_OBJECT_CHANGE:String = "hasDisplayObjectChange"; /** * Constructor. * * @param type Event type. * @param bubbles Specifies whether the event can bubble up the display list hierarchy. * @param cancelable Specifies whether the behavior associated with the event can be prevented. * @param enabled Indicates whether the MediaPlayer has a particular capability * as a result of the change described in the <code>type</code> parameter. * Value of <code>true</code> means the player has the capability as a * result of the change, <code>false</code> means it does not. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public function MediaPlayerCapabilityChangeEvent ( type:String , bubbles:Boolean=false , cancelable:Boolean=false , enabled:Boolean=false ) { super(type, bubbles, cancelable); _enabled = enabled; } /** * Indicates whether the MediaPlayer has the capability * described by the event. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ public function get enabled():Boolean { return _enabled; } /** * @private */ override public function clone():Event { return new MediaPlayerCapabilityChangeEvent(type, bubbles, cancelable, _enabled); } // Internals // private var _enabled:Boolean; } }
// Copyright 2005 The Closure Library Authors. All Rights Reserved. // // 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 goog.events { /** * An interface that describes a single registered listener. * * @see [listenable] */ public interface ListenableKey { /** * Whether the listener works on capture phase. * * @see JSType - [boolean] * @see [listenable] */ function get capture():Boolean; function set capture(value:Boolean):void; /** * The listener function. * * @see JSType - [(function (?): ?|null|{handleEvent: function (?): ?})] * @see [listenable] */ function get listener():Object; function set listener(value:Object):void; /** * The source event target. * * @see JSType - [(Object|goog.events.EventTarget|goog.events.Listenable)] * @see [listenable] */ function get src():Object; function set src(value:Object):void; /** * The event type the listener is listening to. * * @see JSType - [string] * @see [listenable] */ function get type():String; function set type(value:String):void; /** * A globally unique number to identify the key. * * @see JSType - [number] * @see [listenable] */ function get key():Number; function set key(value:Number):void; /** * The 'this' object for the listener function's scope. * * @see JSType - [(Object|null)] * @see [listenable] */ function get handler():Object; function set handler(value:Object):void; /** * Reserves a key to be used for ListenableKey#key field. * * @see [listenable] * @returns {number} A number to be used to fill ListenableKey#key field. */ function reserveKey():Number } }
/** * (c) VARIANTE <http://variante.io> * * This software is released under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ package io.variante.utils { import flash.utils.ByteArray; import flash.utils.Dictionary; import flash.utils.getDefinitionByName; import flash.utils.getQualifiedClassName; import flash.utils.getQualifiedSuperclassName; /** * Set of utility methods for Objects. */ public class VSObjectUtil { /** * Clones an Object instance. * * @param $target * * @return Clone of the Object instance.. */ public static function clone($target:Object):Object { if (getQualifiedClassName($target) != getQualifiedClassName(Object)) { return null; } var buffer:ByteArray = new ByteArray(); buffer.writeObject($target); buffer.position = 0; var result:Object = buffer.readObject(); return result; } /** * Checks to see if an Object instance contains properties that equals to a specified * value, then returns the respective keys. * * @param $target * @param $value * * @return String Vector containing all the keys. */ public static function keysOf($target:Object, $value:Object):Vector.<String> { if (getQualifiedClassName($target) != getQualifiedClassName(Object)) { return null; } var keys:Vector.<String> = null; for (var k:String in $target) { if (isEqual($value, $target[k])) { if (keys == null) { keys = new Vector.<String>(); } keys.push(k); } } return keys; } /** * Checks to see if an Object instance contains the specified key. * * @param $target * @param $key * * @return <code>true</code> if the Object instance contains the specified key, <code>false</code> otherwise. */ public static function hasKey($target:Object, $key:String):Boolean { if (getQualifiedClassName($target) != getQualifiedClassName(Object)) { return false; } for (var k:String in $target) { if (k == $key) { return true; } } return false; } /** * Checks to see if an Object instance contains the specified value in any of its keys. * * @param $target * @param $value * * @return <code>true</code> if the Object instance has keys associated with the specified value, <code>false</code> otherwise. */ public static function hasValue($target:Object, $value:Object):Boolean { if (getQualifiedClassName($target) != getQualifiedClassName(Object)) { return false; } for (var k:String in $target) { if (isEqual($value, $target[k])) { return true; } } return false; } /** * Deletes all the keys of an Object instance. * * @param $object */ public static function deleteKeys($object:Object):void { for (var k:String in $object) { delete $object[k]; } } /** * Checks recursively to see if two Object instances are equal. * * @param $object1 * @param $object2 * * @return <code>true</code> if equal, <code>false</code> otherwise. */ public static function isEqual($object1:Object, $object2:Object):Boolean { if (getQualifiedClassName($object1) != getQualifiedClassName($object2)) { return false; } else if (getQualifiedClassName($object1) == getQualifiedClassName(Object)) { for (var k:String in $object1) { if (!isEqual($object1[k], $object2[k])) { return false; } } return true; } else if (getQualifiedClassName($object1) == getQualifiedClassName(Array)) { return VSArrayUtil.isEqual($object1 as Array, $object2 as Array); } else if (getQualifiedClassName($object1) == getQualifiedClassName(Dictionary)) { return VSDictionaryUtil.isEqual($object1 as Dictionary, $object2 as Dictionary); } else if (getQualifiedClassName($object1).indexOf(VSVectorUtil.VECTOR_CLASS_NAME) >= 0) { return VSVectorUtil.isEqual($object1 as (getDefinitionByName(getQualifiedClassName($object1)) as Class), $object2 as (getDefinitionByName(getQualifiedClassName($object2)) as Class)); } else if (typeof($object1) != typeof(Object)) { return ($object1 == $object2); } else if (getQualifiedClassName($object1) == getQualifiedClassName(null) && getQualifiedClassName($object2) == getQualifiedClassName(null)) { return true; } else { VSAssert.panic('Type ' + getQualifiedClassName($object1) + ' is not supported.'); return false; } } /** * Applies properties from an Object instance to another Object instance for overlapping keys only. * * @param $target * @param $properties */ public static function applyProperties($target:Object, $properties:Object):void { for (var k:String in $properties) { if ($target.hasOwnProperty(k)) { $target[k] = $properties[k]; } } } /** * Gets the name of the class of an Object instance without package details. * * @param $object * * @return Class name of the Object instance without package details. */ public static function getClassName($object:Object):String { var qualifiedClassName:String = getQualifiedClassName($object); var index:int = qualifiedClassName.indexOf('::') + 2; var className:String = qualifiedClassName.substr(index, qualifiedClassName.length - index); return className; } /** * Gets the name of the superclass of an Object instance without package details. * * @param $object * * @return Name of superclass of the Object instance without package details. */ public static function getSuperclassName($object:Object):String { var qualifiedSuperclassName:String = getQualifiedSuperclassName($object); var index:int = qualifiedSuperclassName.indexOf('::') + 2; var superclassName:String = qualifiedSuperclassName.substr(index, qualifiedSuperclassName.length - index); return superclassName; } } }
// Decompiled by AS3 Sorcerer 6.08 // www.as3sorcerer.com //com.company.assembleegameclient.objects.particles.SparkParticle package com.company.assembleegameclient.objects.particles { public class SparkParticle extends Particle { public var lifetime_:int; public var timeLeft_:int; public var initialSize_:int; public var dx_:Number; public var dy_:Number; public function SparkParticle(_arg_1:int, _arg_2:int, _arg_3:int, _arg_4:Number, _arg_5:Number, _arg_6:Number) { super(_arg_2, _arg_4, _arg_1); this.initialSize_ = _arg_1; this.lifetime_ = (this.timeLeft_ = _arg_3); this.dx_ = _arg_5; this.dy_ = _arg_6; } override public function update(_arg_1:int, _arg_2:int):Boolean { this.timeLeft_ = (this.timeLeft_ - _arg_2); if (this.timeLeft_ <= 0) { return (false); } x_ = (x_ + ((this.dx_ * _arg_2) / 1000)); y_ = (y_ + ((this.dy_ * _arg_2) / 1000)); setSize(((this.timeLeft_ / this.lifetime_) * this.initialSize_)); return (true); } } }//package com.company.assembleegameclient.objects.particles
package aerys.minko.render.effect.lightScattering { import aerys.minko.render.RenderTarget; import aerys.minko.render.Effect; import aerys.minko.render.resource.texture.TextureResource; import aerys.minko.scene.data.lightScattering.LightScatteringProvider; import flash.utils.Dictionary; public class LightScatteringPostProcessEffect extends Effect { private static const MAX_SAMPLES : Number = 44.; private var _occlusionMap : TextureResource = null; private var _renderTarget : RenderTarget = null; public function LightScatteringPostProcessEffect(occludedSource : TextureResource, renderTarget : RenderTarget = null, renderQuality : int = LightScatteringProperties.LOW_QUALITY, numSamples : Number = MAX_SAMPLES) { super(getPasses(renderQuality, numSamples)); _occlusionMap = occludedSource; _renderTarget = renderTarget; } private function getPasses(renderQuality : int, numSamples : Number) : Array { if (renderQuality != LightScatteringProperties.MANUAL_QUALITY) numSamples = renderQuality * MAX_SAMPLES; var numPasses : uint = Math.ceil(numSamples / MAX_SAMPLES); var passes : Array = []; for (var i : uint = 0; i < numPasses; ++i) { passes[i] = new LightScatteringPostProcessShader( numSamples, numPasses, i, _occlusionMap ); } return passes; } } }
package flixel.system.debug { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Sprite; import flash.events.MouseEvent; import flash.geom.Point; import flash.geom.Rectangle; import flash.text.TextField; import flash.text.TextFormat; import flash.ui.Mouse; import flixel.FlxG; /** * Container for the new debugger overlay. * Most of the functionality is in the debug folder widgets, * but this class instantiates the widgets and handles their basic formatting and arrangement. */ public class FlxDebugger { /** * Container for the performance monitor widget. */ public var perf:Perf; /** * Container for the trace output widget. */ public var log:Log; /** * Container for the watch window widget. */ public var watch:Watch; /** * Container for the visual debug mode toggle. */ public var vis:Vis; /** * Whether the mouse is currently over one of the debugger windows or not. */ public var hasMouse:Boolean; /** * Internal, tracks what debugger window layout user has currently selected. */ protected var _layout:uint; /** * Internal, stores width and height of the Flash Player window. */ protected var _screen:Point; /** * Internal, used to space out windows from the edges. */ protected var _gutter:uint; /** * Internal, contains all overlays used by the debugger, e.g. console window. */ protected var _overlays:Sprite; /** * Internal, tells if the debugger was already initialized. */ protected var _initialized:Boolean; /** * Internal, tells if the default system mouse cursor should be used instead of custom Flixel mouse cursors. */ protected var _useSystemCursor:Boolean; /** * Instantiates the debugger overlay. * * @param OverlaysContainer The container where the debugger can add its overlays. * @param Width The width of the screen. * @param Height The height of the screen. * @param UseSystemCursor Tells if the default system mouse cursor should be used instead of custom Flixel mouse cursors. * @param Initialize If <code>true</code> (default), the debugger will initialize its interal structures and will be ready to work, otherwise it remain in a "stand-by" mode and will only initialize if <code>show()</code> is invoked. */ public function FlxDebugger(OverlaysContainer:Sprite,Width:Number,Height:Number,UseSystemCursor:Boolean,Initialize:Boolean = true) { super(); hasMouse = false; _screen = new Point(Width,Height); _initialized = false; _useSystemCursor = UseSystemCursor; _overlays = new Sprite(); _overlays.visible = false; OverlaysContainer.addChild(_overlays); if (Initialize) { init(); } } /** * Initializes the debugger, creating all overlays. */ protected function init():void { _initialized = true; _overlays.addChild(new Bitmap(new BitmapData(_screen.x, 15, true, 0x7f000000))); var txt:TextField = new TextField(); txt.x = 2; txt.width = 160; txt.height = 16; txt.selectable = false; txt.multiline = false; txt.defaultTextFormat = new TextFormat("Courier",12,0xffffff); var str:String = FlxG.getLibraryName(); if(FlxG.debug) str += " [debug]"; else str += " [release]"; txt.text = str; _overlays.addChild(txt); _gutter = 8; var screenBounds:Rectangle = new Rectangle(_gutter,15+_gutter/2,_screen.x-_gutter*2,_screen.y-_gutter*1.5-15); log = new Log("log",0,0,true,screenBounds); _overlays.addChild(log); watch = new Watch("watch",0,0,true,screenBounds); _overlays.addChild(watch); perf = new Perf("stats",0,0,false,screenBounds); _overlays.addChild(perf); vis = new Vis(); vis.x = _screen.x-vis.width - 4; vis.y = 2; _overlays.addChild(vis); setLayout(FlxG.DEBUGGER_STANDARD); //Should help with fake mouse focus type behavior _overlays.addEventListener(MouseEvent.MOUSE_OVER,handleMouseOver); _overlays.addEventListener(MouseEvent.MOUSE_OUT, handleMouseOut); } /** * Clean up memory. */ public function destroy():void { _screen = null; if (log != null) { _overlays.removeChild(log); log.destroy(); log = null; } if (watch != null) { _overlays.removeChild(watch); watch.destroy(); watch = null; } if (perf != null) { _overlays.removeChild(perf); perf.destroy(); perf = null; } if (vis != null) { _overlays.removeChild(vis); vis.destroy(); vis = null; } _overlays.removeEventListener(MouseEvent.MOUSE_OVER,handleMouseOver); _overlays.removeEventListener(MouseEvent.MOUSE_OUT,handleMouseOut); } /** * Mouse handler that helps with fake "mouse focus" type behavior. * * @param E Flash mouse event. */ protected function handleMouseOver(E:MouseEvent=null):void { hasMouse = true; } /** * Mouse handler that helps with fake "mouse focus" type behavior. * * @param E Flash mouse event. */ protected function handleMouseOut(E:MouseEvent=null):void { hasMouse = false; } /** * Show/hide the Flash cursor according to the debugger's visilibity. */ protected function adjustFlashCursorVisibility():void { if(visible) flash.ui.Mouse.show(); else if(!_useSystemCursor) flash.ui.Mouse.hide(); } /** * Rearrange the debugger windows using one of the constants specified in FlxG. * * @param Layout The layout style for the debugger windows, e.g. <code>FlxG.DEBUGGER_MICRO</code>. */ public function setLayout(Layout:uint):void { _layout = Layout; resetLayout(); } /** * Forces the debugger windows to reset to the last specified layout. * The default layout is <code>FlxG.DEBUGGER_STANDARD</code>. */ public function resetLayout():void { switch(_layout) { case FlxG.DEBUGGER_MICRO: log.resize(_screen.x/4,68); log.reposition(0,_screen.y); watch.resize(_screen.x/4,68); watch.reposition(_screen.x,_screen.y); perf.reposition(_screen.x,0); break; case FlxG.DEBUGGER_BIG: log.resize((_screen.x-_gutter*3)/2,_screen.y/2); log.reposition(0,_screen.y); watch.resize((_screen.x-_gutter*3)/2,_screen.y/2); watch.reposition(_screen.x,_screen.y); perf.reposition(_screen.x,0); break; case FlxG.DEBUGGER_TOP: log.resize((_screen.x-_gutter*3)/2,_screen.y/4); log.reposition(0,0); watch.resize((_screen.x-_gutter*3)/2,_screen.y/4); watch.reposition(_screen.x,0); perf.reposition(_screen.x,_screen.y); break; case FlxG.DEBUGGER_LEFT: log.resize(_screen.x/3,(_screen.y-15-_gutter*2.5)/2); log.reposition(0,0); watch.resize(_screen.x/3,(_screen.y-15-_gutter*2.5)/2); watch.reposition(0,_screen.y); perf.reposition(_screen.x,0); break; case FlxG.DEBUGGER_RIGHT: log.resize(_screen.x/3,(_screen.y-15-_gutter*2.5)/2); log.reposition(_screen.x,0); watch.resize(_screen.x/3,(_screen.y-15-_gutter*2.5)/2); watch.reposition(_screen.x,_screen.y); perf.reposition(0,0); break; case FlxG.DEBUGGER_STANDARD: default: log.resize((_screen.x-_gutter*3)/2,_screen.y/4); log.reposition(0,_screen.y); watch.resize((_screen.x-_gutter*3)/2,_screen.y/4); watch.reposition(_screen.x,_screen.y); perf.reposition(_screen.x,0); break; } } /** * Read-only property that tells is the debugger is visible or not. You can * use the methods <code>show()</code> and <code>hide()</code> to control the * debugger visility. */ public function get visible():Boolean { return _overlays != null && _overlays.visible; } /** * Hide the debugger. This method essentially sets the <code>visible</code> property to <code>false</code>. */ public function hide():void { _overlays.visible = false; adjustFlashCursorVisibility(); } /** * Toggles the debugger visility. */ public function toggleVisility():void { if (visible) hide(); else show(); } /** * Shows the debugger. This method obeys <code>FlxG.debug</code>, which means that * if <code>FlxG.debug</code> is <code>false</code>, the method will silenty fail * and will not display the debugger. It's possible to ignore <code>FlxG.debug</code> * by using the <code>Force</code> parameter. * * @param Force if <code>true</code> the method will ignore <code>FlxG.debug</code> and will show the debugger. If <code>false</code>(default) the method will only show the debuger if <code>FlxG.debug</code> is <code>true</code>. */ public function show(Force:Boolean = false):void { if (Force || FlxG.debug) { if (!_initialized) { // Debugger was only added to the screen, but not initialized. init(); } _overlays.visible = true; adjustFlashCursorVisibility(); } } /** * Adds an overlay to the debugger. Every windows used by the debugger, such as the console, is * an overlay. The overlay is added at the very top of the list, so it will appear in front * of all previously added overlays. Use <code>addOverlayAt()</code> to add an overlay * to a specific position. * * @param Overlay The overlay to be added to the debugger. */ public function addOverlay(Overlay:Sprite):void { _overlays.addChild(Overlay); } /** * Adds an overlay to the debugger at an specific position (layer) on the screen. * If you specify a currently occupied index position, the overlay object that exists at that * position and all higher positions are moved up one position in the overlays list. * * @param Overlay The overlay to be added to the debugger. * @param Index The index to which the overlay is added. */ public function addOverlayAt(Overlay:Sprite, Index:int):void { _overlays.addChildAt(Overlay, Index); } /** * Removes an overlay from the debugger. * * @param Overlay The overlay to be removed. */ public function removeOverlay(Overlay:Sprite):void { if (Overlay != null) { _overlays.removeChild(Overlay); } } /** * Removes an overlay by its index in the screen. * * @param Index The index from which the overlay is removed. */ public function removeOverlayAt(Index:int):void { _overlays.removeChildAt(Index); } /** * Tells if the debugger is initialized. When Flixel starts, it will create a bare minimum * and uninitialized debugger if <code>FlxG.debug</code> is <code>false</code>. The debugger * will automatically initialize itself if a call to <code>show()</code> is made. */ public function get initialized():Boolean { return _initialized; } /** * The width of the visual debugger area, which is the Flash Player window width. */ public function get width():Number { return _screen.x; } /** * The height of the visual debugger area, which is the Flash Player window height. */ public function get height():Number { return _screen.y; } } }
/** * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ * * Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). * * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 3.0 of the License, or (at your option) any later * version. * * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. * */ package org.bigbluebutton.modules.whiteboard.business.shapes { import flash.display.Sprite; import org.bigbluebutton.modules.whiteboard.models.Annotation; /** * The Pencil class. Extends a DrawObject * @author dzgonjan * */ public class Pencil extends DrawObject { public function Pencil(id:String, type:String, status:String) { super(id, type, status); } override public function draw(a:Annotation, parentWidth:Number, parentHeight:Number, zoom:Number):void { var ao:Object = a.annotation; this.graphics.lineStyle(ao.thickness * zoom, ao.color); var graphicsCommands:Vector.<int> = new Vector.<int>(); graphicsCommands.push(1); var coordinates:Vector.<Number> = new Vector.<Number>(); coordinates.push(denormalize((ao.points as Array)[0], parentWidth), denormalize((ao.points as Array)[1], parentHeight)); for (var i:int = 2; i < (ao.points as Array).length; i += 2){ graphicsCommands.push(2); coordinates.push(denormalize((ao.points as Array)[i], parentWidth), denormalize((ao.points as Array)[i+1], parentHeight)); } this.graphics.drawPath(graphicsCommands, coordinates); this.alpha = 1; } override public function redraw(a:Annotation, parentWidth:Number, parentHeight:Number, zoom:Number):void { draw(a, parentWidth, parentHeight, zoom); } } }
package common.models { import common.util.Util; public class JukeBGMObject { private var _o:Object; public function JukeBGMObject(param1:Object = null) { super(); _o = param1 == null?{}:param1; } public function get id() : int { return Util.getInt(_o,"api_id"); } public function get name() : String { return Util.getString(_o,"api_name"); } public function get description() : String { return Util.getString(_o,"api_description"); } public function get bgmId() : String { return Util.getInt(_o,"api_bgm_id").toString(); } public function get fCoin() : int { return Util.getInt(_o,"api_use_coin"); } public function get bgmFlag() : Boolean { return Util.getInt(_o,"api_bgm_flag") == 1; } public function get loopCount() : int { return Util.getInt(_o,"api_loops"); } } }
package com.codeazur.as3swf.tags { import com.codeazur.as3swf.SWFData; import com.codeazur.as3swf.data.SWFShape; import com.codeazur.as3swf.exporters.core.IShapeExporter; import com.codeazur.utils.StringUtils; public class TagDefineFont implements IDefinitionTag { public static const TYPE:uint = 10; protected var _characterId:uint; protected var _glyphShapeTable:Vector.<SWFShape>; public function TagDefineFont() { _glyphShapeTable = new Vector.<SWFShape>(); } public function get characterId():uint { return _characterId; } public function set characterId(value:uint):void { _characterId = value; } public function get glyphShapeTable():Vector.<SWFShape> { return _glyphShapeTable; } public function parse(data:SWFData, length:uint, version:uint, async:Boolean = false):void { _characterId = data.readUI16(); // Because the glyph shape table immediately follows the offset table, // the number of entries in each table (the number of glyphs in the font) can be inferred by // dividing the first entry in the offset table by two. var numGlyphs:uint = data.readUI16() >> 1; // Skip offsets. We don't need them here. data.skipBytes((numGlyphs - 1) << 1); // Read glyph shape table for (var i:uint = 0; i < numGlyphs; i++) { _glyphShapeTable.push(data.readSHAPE(unitDivisor)); } } public function publish(data:SWFData, version:uint):void { var body:SWFData = new SWFData(); var i:uint var prevPtr:uint = 0; var len:uint = glyphShapeTable.length; var shapeTable:SWFData = new SWFData(); body.writeUI16(characterId); var offsetTableLength:uint = (len << 1); for (i = 0; i < len; i++) { // Write out the offset table for the current glyph body.writeUI16(shapeTable.position + offsetTableLength); // Serialize the glyph's shape to a separate bytearray shapeTable.writeSHAPE(glyphShapeTable[i]); } // Now concatenate the glyph shape table to the end (after // the offset table that we were previously writing inside // the for loop above). body.writeBytes(shapeTable); // Now write the tag with the known body length, and the // actual contents out to the provided SWFData instance. data.writeTagHeader(type, body.length); data.writeBytes(body); } public function clone():IDefinitionTag { var tag:TagDefineFont = new TagDefineFont(); throw(new Error("Not implemented yet.")); return tag; } public function export(handler:IShapeExporter, glyphIndex:uint):void { glyphShapeTable[glyphIndex].export(handler); } public function get type():uint { return TYPE; } public function get name():String { return "DefineFont"; } public function get version():uint { return 1; } public function get level():uint { return 1; } protected function get unitDivisor():Number { return 1; } public function toString(indent:uint = 0):String { var str:String = Tag.toStringCommon(type, name, indent) + "ID: " + characterId + ", " + "Glyphs: " + _glyphShapeTable.length; return str + toStringCommon(indent); } protected function toStringCommon(indent:uint):String { var str:String = ""; for (var i:uint = 0; i < _glyphShapeTable.length; i++) { str += "\n" + StringUtils.repeat(indent + 2) + "[" + i + "] GlyphShapes:"; str += _glyphShapeTable[i].toString(indent + 4); } return str; } } }
package com.playfab.CloudScriptModels { public class PostFunctionResultForEntityTriggeredActionRequest { public var Entity:EntityKey; public var FunctionResult:ExecuteFunctionResult; public function PostFunctionResultForEntityTriggeredActionRequest(data:Object=null) { if(data == null) return; Entity = new EntityKey(data.Entity); FunctionResult = new ExecuteFunctionResult(data.FunctionResult); } } }
package kabam.rotmg.tooltips.view { import com.company.assembleegameclient.ui.tooltip.ToolTip; import kabam.rotmg.core.signals.HideTooltipsSignal; import kabam.rotmg.core.signals.ShowTooltipSignal; import robotlegs.bender.bundles.mvcs.Mediator; public class TooltipsMediator extends Mediator { public function TooltipsMediator() { super(); } [Inject] public var view:TooltipsView; [Inject] public var showTooltip:ShowTooltipSignal; [Inject] public var hideTooltips:HideTooltipsSignal; override public function initialize():void { this.showTooltip.add(this.onShowTooltip); this.hideTooltips.add(this.onHideTooltips); } override public function destroy():void { this.showTooltip.remove(this.onShowTooltip); this.hideTooltips.remove(this.onHideTooltips); } private function onShowTooltip(_arg_1:ToolTip):void { this.view.show(_arg_1); } private function onHideTooltips():void { this.view.hide(); } } }
package Pickups { import net.flashpunk.FP; import net.flashpunk.graphics.Image; import net.flashpunk.graphics.Spritemap; import Scenery.Tile; import net.flashpunk.utils.Draw; /** * ... * @author Time */ public class BossKey extends Pickup { private var keyType:int; private var doActions:Boolean = true; public function BossKey(_x:int, _y:int, _t:int=0) { super(_x + Tile.w/2, _y + Tile.h/2, Game.bossKeys[_t], null, false); setHitbox(8, 8, 4, 4); keyType = _t; special = true; if (keyType == 0) { text = "You got a key!~Keys open locks of their color."; } mySound = Music.sndOKey; } override public function check():void { super.check(); if (Player.hasKey(keyType)) { doActions = false; FP.world.remove(this); } } override public function render():void { (graphic as Spritemap).frame = Game.worldFrame((graphic as Spritemap).frameCount); super.render(); if (keyType == 2 || keyType == 3 || keyType == 4) // Wand/Ice/6th Dungeon key { Draw.setTarget((FP.world as Game).nightBmp, FP.camera); const minsc:Number = 0.1; const sc:Number = 0.25; const alph:Number = 0.25; const phases:int = 5; if(keyType == 2) Draw.circlePlus(x, y, Math.max(width, height) * (1 + minsc + sc * Game.worldFrame(phases) / phases), 0xFFFFCC, alph); super.render(); Draw.resetTarget(); } (graphic as Spritemap).frame = 0; } override public function removed():void { if (doActions) { Player.hasKeySet(keyType, true); } } } }
package com.swfwire.decompiler.data.swf7.tags { import com.swfwire.decompiler.data.swf.SWF; import com.swfwire.decompiler.SWFByteArray; import com.swfwire.decompiler.data.swf.tags.SWFTag; public class SetTabIndexTag extends SWFTag { public var depth:uint; public var tabIndex:uint; public function SetTabIndexTag(depth:uint = 0, tabIndex:uint = 0) { this.depth = depth; this.tabIndex = tabIndex; } /* override public function read(swf:SWF, swfBytes:SWFByteArray):void { super.read(swf, swfBytes); depth = swfcontext.bytes.readUI16(); tabIndex = swfcontext.bytes.readUI16(); } override public function write(swf:SWF, swfBytes:SWFByteArray):void { super.write(swf, swfBytes); swfBytes.writeUI16(depth); swfBytes.writeUI16(tabIndex); } */ } }
/* * Copyright 2019 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.applesignin { /** Authorization state of an Apple ID credential.*/ public final class AppleIDProviderCredentialState { /** The Opaque user ID was revoked by the user.*/ public static const revoked:int = 0; /** The Opaque user ID is in good state.*/ public static const authorized:int = 1; /** The Opaque user ID was not found.*/ public static const notFound:int = 2; } }
package { public dynamic class EvalError extends Error { public function EvalError(message:String = "", id:uint = 0) { } } }
//////////////////////////////////////////////////////////////////////////////// // // This is a modification of ESRIs CheckBoxInderminate that // gives the ability to show a layers scale dependancy // //////////////////////////////////////////////////////////////////////////////// package widgets.TOC.toc.controls { import flash.events.Event; import mx.controls.CheckBox; import mx.core.FlexGlobals; /** * CheckBox that supports a tri-state check. In addition to selected and * unselected, the CheckBox can be in an scale depandant state. */ public class CheckBoxScaleDependant extends CheckBox { /** * Creates a new tri-state CheckBox with custom skin. */ public function CheckBoxScaleDependant() { setStyle("icon", CheckBoxScaleDependantIcon); setStyle("checked", this.selected); setStyle("scaledependant", _scaledependant); setStyle("themeColor", FlexGlobals.topLevelApplication.getStyle("accentColor")); setStyle("iconColor", FlexGlobals.topLevelApplication.getStyle("accentColor")); setStyle("layoutDirection", "ltr"); // fix check mark's direction - https://bugs.adobe.com/jira/browse/SDK-25817 } //-------------------------------------------------------------------------- // Property: scaledependant //-------------------------------------------------------------------------- private var _scaledependant:Boolean = false; [Bindable("scaledependantChanged")] /** * Whether this check box is in the scaledependant state. */ public function get scaledependant():Boolean { return _scaledependant; } /** * @private */ public function set scaledependant( value:Boolean ):void { if (value != _scaledependant) { _scaledependant = value; setStyle("checked", this.selected); setStyle("scaledependant", _scaledependant); dispatchEvent(new Event("scaledependantChanged")); } } } }
//////////////////////////////////////////////////////////////////////////////// // // 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.treeClasses { import flash.events.EventDispatcher; import flash.utils.Dictionary; import mx.collections.CursorBookmark; import mx.collections.ICollectionView; import mx.collections.IList; import mx.collections.IViewCursor; import mx.events.CollectionEvent; import mx.events.CollectionEventKind; import mx.utils.UIDUtil; [ExcludeClass] /** * @private * This class provides a heirarchical view (a tree-like) view of a standard collection. * The collection that this Cursor walks across need not be heirarchical but may be flat. * This class delegates to the ITreeDataDescriptor for information regarding the tree * structure of the data it walks across. * * @see HierarchicalCollectionView */ public class HierarchicalViewCursor extends EventDispatcher implements IViewCursor { include "../../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function HierarchicalViewCursor( collection:HierarchicalCollectionView, model:ICollectionView, dataDescriptor:ITreeDataDescriptor, itemToUID:Function, openNodes:Object) { super(); //fields this.collection = collection; this.model = model; this.dataDescriptor = dataDescriptor; this.itemToUID = itemToUID; this.openNodes = openNodes; //events collection.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionChangeHandler, false, 0, true); //init modelCursor = model.createCursor(); //check to see if the model has more than one top level items if (model.length > 1) more = true; else more = false; } //-------------------------------------------------------------------------- // // Variables // //-------------------------------------------------------------------------- /** * @private */ private var dataDescriptor:ITreeDataDescriptor; /** * @private * Its effective offset into the "array". */ private var currentIndex:int = 0; /** * @private * The current index into the childNodes array */ private var currentChildIndex:int = 0; /** * @private * The depth of the current node. */ private var _currentDepth:int = 1; /** * @private * The current set of childNodes we are walking. */ private var childNodes:Object = []; /** * @private * The current set of parentNodes that we have walked from */ private var parentNodes:Array = []; /** * @private * A stack of the currentChildIndex in all parents of the currentNode. */ private var childIndexStack:Array = []; /** * @private * The collection that stores the user data */ private var model:ICollectionView; /** * @private * The collection wrapper of the model */ private var collection:HierarchicalCollectionView; /** * @private */ private var openNodes:Object; /** * @private * Flag indicating model has more data */ private var more:Boolean; /** * @private * Cursor from the model */ private var modelCursor:IViewCursor; /** * @private */ private var itemToUID:Function; //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // index //---------------------------------- /** * @private */ public function get index():int { return currentIndex; } //---------------------------------- // bookmark //---------------------------------- /** * @private */ public function get bookmark():CursorBookmark { return new CursorBookmark(currentIndex.toString()); } //---------------------------------- // current //---------------------------------- /** * @private */ public function get current():Object { try { if (childIndexStack.length == 0) { return modelCursor.current; } else { return childNodes[currentChildIndex]; } } catch(e:RangeError) { } return null; } //--------------------------------- // currentDepth //--------------------------------- /** * @private */ public function get currentDepth():int { return _currentDepth; } //---------------------------------- // beforeFirst //---------------------------------- public function get beforeFirst():Boolean { return (currentIndex <= collection.length && current == null); } //---------------------------------- // afterLast //---------------------------------- public function get afterLast():Boolean { return (currentIndex >= collection.length && current == null); } //---------------------------------- // view //---------------------------------- public function get view():ICollectionView { return model; } //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * @private * Determines if a node is visible on the screen */ private function isItemVisible(node:Object):Boolean { var parentNode:Object = collection.getParentItem(node); while (parentNode != null) { if (openNodes[itemToUID(parentNode)] == null) return false; parentNode = collection.getParentItem(parentNode); } return true; } /** * @private * Creates a stack of parent nodes by walking upwards */ private function getParentStack(node:Object):Array { var nodeParents:Array = []; // Make a list of parents of the node. var obj:Object = collection.getParentItem(node); while (obj != null) { nodeParents.unshift(obj); obj = collection.getParentItem(obj); } return nodeParents; } /** * @private * When something happens to the tree, find out if it happened * to children that occur before the current child in the tree walk. */ private function isNodeBefore(node:Object, currentNode:Object):Boolean { if (currentNode == null) return false; var n:int; var i:int; var childNodes:ICollectionView; var sameParent:Object; var nodeParents:Array = getParentStack(node); var curParents:Array = getParentStack(currentNode); // Starting from the root, compare parents // (assumes the root must be the same). while (nodeParents.length && curParents.length) { var nodeParent:Object = nodeParents.shift(); var curParent:Object = curParents.shift(); // If not the same parentm then which ever one is first // in the child list is before the other. if (nodeParent != curParent) { // The last parent must be common. sameParent = collection.getParentItem(nodeParent); // Get the child list. if (sameParent != null && dataDescriptor.isBranch(sameParent, model) && dataDescriptor.hasChildren(sameParent, model)) { childNodes = dataDescriptor.getChildren(sameParent, model); } else { childNodes = model; } // Walk it until you hit one or the other. n = childNodes.length; { var child:Object = childNodes[i]; if (child == curParent) return false; if (child == nodeParent) return true; } } } if (nodeParents.length) node = nodeParents.shift(); if (curParents.length) currentNode = curParents.shift(); // If we get here, they have the same parentage or one or both // had a root parent. Who's first? childNodes = model; n = childNodes.length; for (i = 0; i < n; i++) { child = childNodes[i]; if (child == currentNode) return false; if (child == node) return true; } return false; } /** * @private */ public function findAny(values:Object):Boolean { seek(CursorBookmark.FIRST); var done:Boolean = false; while (!done) { var o:Object = dataDescriptor.getData(current); var matches:Boolean = true; for (var p:String in values) { if (o[p] != values[p]) { matches = false; break; } } if (matches) return true; done = moveNext(); } return false; } /** * @private */ public function findFirst(values:Object):Boolean { return findAny(values); } /** * @private */ public function findLast(values:Object):Boolean { seek(CursorBookmark.LAST); var done:Boolean = false; while (!done) { var o:Object = current; var matches:Boolean = true; for (var p:String in values) { if (o[p] != values[p]) { matches = false; break; } } if (matches) return true; done = movePrevious(); } return false; } /** * @private * Move one node forward from current. * This may include moving up or down one or more levels. */ public function moveNext():Boolean { var currentNode:Object = current; //if there is no currentNode then we cant move forward and must be off the ends if (currentNode == null) return false; var uid:String = itemToUID(currentNode); if (!collection.parentMap.hasOwnProperty(uid)) collection.parentMap[uid] = parentNodes[parentNodes.length - 1]; // If current node is a branch and is open, the first child is our next item so return it if (openNodes[uid] && dataDescriptor.isBranch(currentNode, model) && dataDescriptor.hasChildren(currentNode, model)) { var previousChildNodes:Object = childNodes; childNodes = dataDescriptor.getChildren(currentNode, model); if (childNodes.length > 0) { childIndexStack.push(currentChildIndex); parentNodes.push(currentNode); currentChildIndex = 0; currentNode = childNodes[0]; currentIndex++; _currentDepth++; return true; } else childNodes = previousChildNodes; } // Otherwise until we find the next child (could be on any level) while (true) { // If we hit the end of this list, pop up a level. if (childNodes != null && childNodes.length > 0 && currentChildIndex >= Math.max(childNodes.length - 1, 0)) { //check for the end of the tree here. if (childIndexStack.length < 1 && !more) { currentNode = null; currentIndex++; _currentDepth = 1; return false; } else { //pop up to parent currentNode = parentNodes.pop(); //get parents siblings var grandParent:Object = parentNodes[parentNodes.length-1]; //we could probably assume that a non-null grandparent has descendants //but the analogy only goes so far... if (grandParent != null && dataDescriptor.isBranch(grandParent, model) && dataDescriptor.hasChildren(grandParent, model)) { childNodes = dataDescriptor.getChildren(grandParent, model); } else { childNodes = []; } //get new current nodes index currentChildIndex = childIndexStack.pop(); //pop the level up one _currentDepth--; } } else { //if no childnodes then we're probably at the top level if (childIndexStack.length == 0) { //check for more top level siblings //and if we're here the depth should be 1 _currentDepth = 1; more = modelCursor.moveNext(); if (more) { currentNode = modelCursor.current; break; } else { //at the end of the tree _currentDepth = 1; currentIndex++; //this should push us to afterLast currentNode = null; return false; } } else { //get the next child node try { currentNode = childNodes[++currentChildIndex]; break; } catch(e:RangeError) { //lets try to recover return false; } } } } currentIndex++; return true; } /** * @private * Performs a backward tree walk. */ public function movePrevious():Boolean { var currentNode:Object = current; // If there are no items, there's no current node, so return false. if (currentNode == null) return false; //if not at top level if (parentNodes && parentNodes.length > 0) { if (currentChildIndex == 0) { //at the first node in this branch so move to parent currentNode = parentNodes.pop(); currentChildIndex = childIndexStack.pop(); var grandParent:Object = parentNodes[parentNodes.length-1]; //we could probably assume that a non-null grandparent has descendants //but the analogy only goes so far... if (grandParent != null && dataDescriptor.isBranch(grandParent, model) && dataDescriptor.hasChildren(grandParent, model)) { childNodes = dataDescriptor.getChildren(grandParent, model); } else { //null is valid, but error prone so we'll make it empty childNodes = []; } _currentDepth--; currentIndex--; return true; } else { // get previous child sibling try { currentNode = childNodes[--currentChildIndex]; } catch(e:RangeError) { //lets try to recover return false; } } } //handle top level siblings else { more = modelCursor.movePrevious(); if (more) { //move back one node and then loop through children currentNode = modelCursor.current; } //if past the begining of the tree return false else { //currentIndex--; //should be before first currentIndex = -1; currentNode = null; return false; } } while (true) { // If there are children, walk backwards on the children // and consider youself after your children. if (openNodes[itemToUID(currentNode)] && dataDescriptor.isBranch(currentNode, model) && dataDescriptor.hasChildren(currentNode, model)) { var previousChildNodes:Object = childNodes; childNodes = dataDescriptor.getChildren(currentNode, model); if (childNodes.length > 0) { childIndexStack.push(currentChildIndex); parentNodes.push(currentNode); currentChildIndex = childNodes.length - 1; currentNode = childNodes[currentChildIndex]; _currentDepth++; } else { childNodes = previousChildNodes; break; } } else { //No more open branches so we'll bail break; } } currentIndex--; return true; } /** * @private */ public function seek(bookmark:CursorBookmark, offset:int = 0, prefetch:int = 0):void { var value:int; if (bookmark == CursorBookmark.FIRST) { value = 0; } else if (bookmark == CursorBookmark.CURRENT) { value = currentIndex; } else if (bookmark == CursorBookmark.LAST) { value = collection.length - 1; } else { value = int(bookmark.value); } value = Math.max(Math.min(value + offset, collection.length), 0); var dc:int = Math.abs(currentIndex - value); var de:int = Math.abs(collection.length - value); var movedown:Boolean = true; // if we're closer to the current than the beginning if (dc < value) { // if we're closer to the end than the current position if (de < dc) { moveToLast(); if (de == 0) { // if de = 0; we need to be "off the end" moveNext(); value = 0; } else { value = de - 1; } movedown = false; } else { movedown = currentIndex < value; value = dc; // if current is off the end, reset if (currentIndex == collection.length) { value--; moveToLast(); } } } else // we're closer to the beginning than the current { // if we're closer to the end than the beginning if (de < value) { moveToLast(); if (de == 0) { // if de = 0; we need to be "off the end" moveNext(); value = 0; } else { value = de - 1; } movedown = false; } else { moveToFirst(); } } if (movedown) { while (value && value > 0) { moveNext(); value--; } } else { while (value && value > 0) { movePrevious(); value--; } } } /** * @private */ private function moveToFirst():void { childNodes = []; modelCursor.seek(CursorBookmark.FIRST, 0); if (model.length > 1) more = true; else more = false; currentChildIndex = 0; parentNodes = []; childIndexStack = []; currentIndex = 0; _currentDepth = 1; } /** * @private */ public function moveToLast():void { childNodes = []; childIndexStack = []; _currentDepth = 1; parentNodes = []; var emptyBranch:Boolean = false; //first move to the end of the top level collection modelCursor.seek(CursorBookmark.LAST, 0); //if its a branch and open then get children for the last item var currentNode:Object = modelCursor.current; //if current node is open get its children while (openNodes[itemToUID(currentNode)] && dataDescriptor.isBranch(currentNode, model) && dataDescriptor.hasChildren(currentNode, model)) { var previousChildNodes:Object = childNodes; childNodes = dataDescriptor.getChildren(currentNode, model); if (childNodes != null && childNodes.length > 0) { parentNodes.push(currentNode); childIndexStack.push(currentChildIndex); currentNode = childNodes[childNodes.length - 1]; currentChildIndex = childNodes.length - 1; _currentDepth++; } else { childNodes = previousChildNodes; break; } } currentIndex = collection.length - 1; } /** * @private */ public function insert(item:Object):void { //No impl } /** * @private */ public function remove():Object { return null; } //-------------------------------------------------------------------------- // // Event handlers // //-------------------------------------------------------------------------- /** * @private */ public function collectionChangeHandler(event:CollectionEvent):void { var i:int; var n:int; var node:Object; var nodeParent:Object var parent:Object; var parentStack:Array; var parentTable:Dictionary; var isBefore:Boolean = false; // get the parent of the current item parentStack = getParentStack(current); // hash it by parent to map to depth parentTable = new Dictionary(); n = parentStack.length; // don't insert the immediate parent for (i = 0; i < n - 1; i++) { // 0 is null parent (the model) parentTable[parentStack[i]] = i + 1; } // remember the current parent parent = parentStack[parentStack.length - 1]; if (event.kind == CollectionEventKind.ADD) { n = event.items.length; if (event.location <= currentIndex) { currentIndex += n; isBefore = true; } for (i = 0; i < n; i++) { node = event.items[i]; if (isBefore) { // if the added node is before the current // and they share parent's then we have to // adjust the currentChildIndex or // the stack of child indexes. nodeParent = collection.getParentItem(node); if (nodeParent == parent) currentChildIndex++; else if (parentTable[nodeParent] != null) { childIndexStack[parentTable[nodeParent]]++; } } } } else if (event.kind == CollectionEventKind.REMOVE) { n = event.items.length; if (event.location <= currentIndex) { if (event.location + n >= currentIndex) { // the current node was removed // the list classes expect that we // leave the cursor on whatever falls // into that slot var newIndex:int = event.location; moveToFirst(); seek(CursorBookmark.FIRST, newIndex); for (i = 0; i < n; i++) { node = event.items[i]; delete collection.parentMap[itemToUID(node)]; } return; } currentIndex -= n; isBefore = true; } for (i = 0; i < n; i++) { node = event.items[i]; if (isBefore) { // if the removed node is before the current // and they share parent's then we have to // adjust the currentChildIndex or // the stack of child indexes. nodeParent = collection.getParentItem(node); if (nodeParent == parent) currentChildIndex--; else if (parentTable[nodeParent] != null) { childIndexStack[parentTable[nodeParent]]--; } } delete collection.parentMap[itemToUID(node)]; } } } } }
package org.assetloader.loaders { import org.assetloader.base.AssetType; import flash.net.URLRequest; public class XMLLoaderTest extends BaseLoaderTest { [Before] override public function runBeforeEachTest() : void { super.runBeforeEachTest(); _loaderName = "XMLLoader"; _payloadType = XML; _payloadTypeName = "XML"; _payloadPropertyName = "xml"; _path += "testXML.xml"; _type = AssetType.XML; _loader = new XMLLoader(new URLRequest(_path), _id); } } }
package emap.utils { /** * * 定义常用路径函数。 * */ import cn.vision.collections.Map; import cn.vision.core.NoInstance; import emap.interfaces.INode; import emap.vos.VORoute; public final class RouteUtil extends NoInstance { /** * * 获取两个节点之间的路径键值。 * * @param $start:INode 起始节点。 * @param $end:INode 终止节点。 * * @return String 键值。 * */ public static function getKey($start:INode, $end:INode):String { if ($start && $end) var result:String = $start.serial + "," + $end.serial; return result; } /** * * 获取两个节点之间的路径 * * @param $start:INode 起始节点。 * @param $end:INode 终止节点。 * @param $routes:Map 路径字典。 * * @return VORoute 节点之间路径。 * */ public static function getRoute($start:INode, $end:INode):VORoute { return $start.routes[getKey($start, $end)]; } } }
package { import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFieldAutoSize; /** * Displays a happy ad. Normally you would load in another ad server SWF or load in an ad using * the Loader class. Instead, we just draw something without a load, since this is an example. */ public class FakeAd extends Sprite { // NOTE for internal Brightcove development: make sure to make the same changes to the other // FakeAd classes public function FakeAd(lineColor:Number, fillColor:Number, label:String) { graphics.lineStyle(2, lineColor); graphics.beginFill(fillColor); graphics.drawCircle(150, 150, 140); graphics.moveTo(50, 170); graphics.lineTo(110, 220); graphics.curveTo(160, 270, 210, 210); graphics.lineTo(260, 170); graphics.drawCircle(200, 70, 20); graphics.drawCircle(110, 70, 20); graphics.endFill(); var format:TextFormat = new TextFormat(); format.font = "Verdana"; format.color = lineColor; format.size = 12; format.align = "center"; var textField:TextField = new TextField(); textField.x = 50; textField.y = 110; textField.width = 200; textField.wordWrap = true; textField.autoSize = TextFieldAutoSize.LEFT; textField.text = label; textField.setTextFormat(format); addChild(textField); } } }
package com.flexcapacitor.managers { import com.flexcapacitor.controller.Console; import com.flexcapacitor.controller.Radiate; import com.flexcapacitor.effects.file.LoadFile; import com.flexcapacitor.events.HTMLDragEvent; import com.flexcapacitor.formatters.HTMLFormatterTLF; import com.flexcapacitor.model.AttachmentData; import com.flexcapacitor.model.DocumentData; import com.flexcapacitor.model.HTMLDragData; import com.flexcapacitor.model.IDocument; import com.flexcapacitor.model.IDocumentData; import com.flexcapacitor.model.IProject; import com.flexcapacitor.model.ImageData; import com.flexcapacitor.services.IServiceEvent; import com.flexcapacitor.services.WPAttachmentService; import com.flexcapacitor.services.WPService; import com.flexcapacitor.utils.ArrayUtils; import com.flexcapacitor.utils.ClassUtils; import com.flexcapacitor.utils.DisplayObjectUtils; import com.flexcapacitor.utils.HTMLDragManager; import com.flexcapacitor.utils.supportClasses.ComponentDefinition; import com.flexcapacitor.utils.supportClasses.ComponentDescription; import com.flexcapacitor.utils.supportClasses.FileData; import flash.desktop.ClipboardFormats; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.DisplayObject; import flash.display.LoaderInfo; import flash.display.StageQuality; import flash.events.Event; import flash.events.IOErrorEvent; import flash.events.SecurityErrorEvent; import flash.net.FileReference; import flash.net.FileReferenceList; import flash.utils.ByteArray; import flash.utils.Dictionary; import mx.collections.ArrayCollection; import mx.core.DragSource; import mx.core.IVisualElementContainer; import mx.core.UIComponent; import mx.events.DragEvent; import spark.components.Application; import spark.components.Image; import spark.components.RichText; import spark.primitives.BitmapImage; import spark.primitives.supportClasses.GraphicElement; import flashx.textLayout.conversion.TextConverter; import flashx.textLayout.elements.TextFlow; /** * Manages adding and removing assets, attachments **/ public class LibraryManager extends Console { public function LibraryManager(s:SINGLEDOUBLE) { } /** * Upload attachment * */ public static var uploadAttachmentService:WPAttachmentService; /** * Service to get list of attachments * */ public static var getAttachmentsService:WPService; /** * Service to delete attachments * */ public static var deleteAttachmentsService:WPService; /** * Service to delete attachment * */ public static var deleteAttachmentService:WPService; /** * Set to true when deleting an attachment * */ [Bindable] public static var deleteAttachmentInProgress:Boolean; /** * Set to true when deleting attachments * */ [Bindable] public static var deleteAttachmentsInProgress:Boolean; /** * Set to true when getting list of attachments * */ [Bindable] public static var getAttachmentsInProgress:Boolean; /** * Set to true when uploading an attachment * */ [Bindable] public static var uploadAttachmentInProgress:Boolean; private static var _attachments:Array = []; /** * Attachments * */ [Bindable] public static function get attachments():Array { return _attachments; } public static function set attachments(value:Array):void { _attachments = value; } private static var _assets:ArrayCollection = new ArrayCollection(); /** * Assets of the current document * */ [Bindable] public static function get assets():ArrayCollection { return _assets; } public static function set assets(value:ArrayCollection):void { _assets = value; } /** * Templates for creating new projects or documents * */ [Bindable] public static var templates:Array; public static var deferredFileLoader:LoadFile; public static var deferredDocument:IDocument; public static var loadingMXML:Boolean; public static var loadingFXG:Boolean; public static var loadingSVG:Boolean; public static var loadingPSD:Boolean; public static var attachmentsToUpload:Array; public static var currentAttachmentToUpload:AttachmentData; public static var lastAttemptedUpload:Object; /** * Get the current document. * */ public static function get selectedDocument():IDocument { return Radiate.selectedDocument; } /** * Get the current project. * */ public static function get selectedProject():IProject { return Radiate.selectedProject; } /** * When importing an image via base64 string we * save a reference to the loader info so it doesn't get garbage collected **/ public static var contentLoaderDictionary:Dictionary = new Dictionary(true); /** * Get images from the server * */ public static function getAttachments(id:int = 0):void { // get selected document // we need to create service if (getAttachmentsService==null) { getAttachmentsService = new WPService(); getAttachmentsService.addEventListener(WPService.RESULT, getAttachmentsResultsHandler, false, 0, true); getAttachmentsService.addEventListener(WPService.FAULT, getAttachmentsFaultHandler, false, 0, true); } getAttachmentsService.host = Radiate.getWPURL(); if (id!=0) { getAttachmentsService.id = String(id); } getAttachmentsInProgress = true; getAttachmentsService.getAttachments(id); } /** * Upload attachment data to the server * */ public static function uploadAttachmentData(attachmentData:AttachmentData, id:String):void { if (attachmentData==null) { warn("No attachment to upload"); return; } var imageData:ImageData = attachmentData as ImageData; var formattedName:String = attachmentData.name!=null ? attachmentData.name : null; if (formattedName) { if (formattedName.indexOf(" ")!=-1) { formattedName = formattedName.replace(/ /g, ""); } } if (imageData && imageData.bitmapData && imageData.byteArray==null) { attachmentData.byteArray = DisplayObjectUtils.getByteArrayFromBitmapData(BitmapData(imageData.bitmapData)); if (formattedName && formattedName.indexOf(".")==-1) { formattedName = formattedName + ".png"; } imageData.contentType = DisplayObjectUtils.PNG_MIME_TYPE; } uploadAttachment(attachmentData.byteArray, id, formattedName, null, attachmentData.contentType, null, attachmentData); } /** * Upload image to the server. * File name cannot have spaces and must have an extension. * If you pass bitmap data it is converted to a PNG * */ public static function uploadAttachment(data:Object, id:String, fileName:String = null, dataField:String = null, contentType:String = null, customData:Object = null, attachmentData:AttachmentData = null):void { // get selected document // we need to create service if (uploadAttachmentService==null) { uploadAttachmentService = new WPAttachmentService(); uploadAttachmentService.addEventListener(WPService.RESULT, uploadAttachmentResultsHandler, false, 0, true); uploadAttachmentService.addEventListener(WPService.FAULT, uploadAttachmentFaultHandler, false, 0, true); //uploadAttachmentService = service; } uploadAttachmentService.host = Radiate.getWPURL(); if (id!=null) { uploadAttachmentService.id = id; } if (attachmentData) { currentAttachmentToUpload = attachmentData; currentAttachmentToUpload.saveInProgress = true; } uploadAttachmentService.customData = customData; uploadAttachmentInProgress = true; var formattedName:String = fileName!=null ? fileName : null; if (formattedName) { if (formattedName.indexOf(" ")!=-1) { formattedName = formattedName.replace(/ /g, ""); } if (formattedName.indexOf(".")==-1) { if (contentType==DisplayObjectUtils.PNG_MIME_TYPE) { formattedName = formattedName + ".png"; } } } if (data is FileReference) { uploadAttachmentService.file = data as FileReference; uploadAttachmentService.uploadAttachment(); } else if (data) { if (data is ByteArray) { uploadAttachmentService.fileData = data as ByteArray; } else if (data is BitmapData) { uploadAttachmentService.fileData = DisplayObjectUtils.getByteArrayFromBitmapData(BitmapData(data)); if (formattedName && formattedName.indexOf(".")==-1) { formattedName = formattedName + ".png"; } contentType = DisplayObjectUtils.PNG_MIME_TYPE; } if (formattedName) { uploadAttachmentService.fileName = formattedName; } if (dataField) { uploadAttachmentService.dataField = dataField; } // default content type in service is application/octet if (contentType) { uploadAttachmentService.contentType = contentType; } uploadAttachmentService.uploadAttachment(); } else { attachmentData.saveInProgress = false; uploadAttachmentInProgress = false; warn("No data or file is available for upload. Please select the file to upload."); } } /** * Get assets available to upload * */ public static function getAssetsAvailableToUpload():Array { var numberOfAssets:int; var attachmentData:AttachmentData; var assetsToUpload:Array = []; numberOfAssets = assets.length; for (var i:int=0;i<numberOfAssets;i++) { attachmentData = assets[i] as AttachmentData; if (attachmentData) { if (attachmentData.id==null) { if (assetsToUpload.indexOf(attachmentData)==-1) { assetsToUpload.push(attachmentData); } } } } return assetsToUpload; } /** * Save all attachments. * */ public static function saveAllAttachments(iDocument:DocumentData, saveToProject:Boolean = false, locations:String = null, saveEvenIfClean:Boolean = true):Boolean { if (locations==null) locations = DocumentData.REMOTE_LOCATION; var loadLocally:Boolean = ServicesManager.getIsLocalLocation(locations); var loadRemote:Boolean = ServicesManager.getIsRemoteLocation(locations); var document:IDocument; var anyDocumentSaved:Boolean; var numberOfAttachments:int; var numberOfAttachmentsToUpload:int; var numberOfAssets:int; var attachmentData:AttachmentData; var imageData:ImageData; var targetPostID:String; var projectID:String; var attachmentParentID:String; var hasAttachments:Boolean; var customData:Object; var uploadingStillInProgress:Boolean; // Continues in uploadAttachmentResultsHandler if (uploadAttachmentInProgress) { DeferManager.callAfter(100, saveAllAttachments, iDocument, saveToProject, locations, saveEvenIfClean); return true; } if (saveToProject) { projectID = iDocument.parentId; targetPostID = projectID; } else { targetPostID = iDocument.id; } // save attachments numberOfAssets = assets.length; if (numberOfAssets==0) { info("No attachments to save"); return false; } if (attachmentsToUpload==null) { attachmentsToUpload = []; } else if (attachmentsToUpload.length) { uploadingStillInProgress = true; } // get attachments that still need uploading if (!uploadingStillInProgress) { for (var i:int=0;i<numberOfAssets;i++) { attachmentData = assets[i] as AttachmentData; if (attachmentData) { attachmentParentID = attachmentData.parentId; if (attachmentParentID==null) { attachmentData.parentId = iDocument.id; attachmentParentID = iDocument.id; } // only add if matches document or project // you need to set the parent ID at if (attachmentParentID!=targetPostID && attachmentParentID!=projectID) { continue; } if (attachmentData.id==null) { if (attachmentsToUpload.indexOf(attachmentData)==-1) { attachmentsToUpload.push(attachmentData); } } } } } numberOfAttachmentsToUpload = attachmentsToUpload.length; customData = {}; for (var m:int = 0; m < numberOfAttachmentsToUpload; m++) { attachmentData = attachmentsToUpload[m]; // trying to add a custom field with the uid - doesn't works if (attachmentData.uid) { customData["custom[uid]"] = attachmentData.uid; customData["caption"] = attachmentData.uid; customData["post_excerpt"] = attachmentData.uid; customData["post_title"] = attachmentData.name; } imageData = attachmentData as ImageData; if (imageData) { if (imageData.byteArray==null && imageData.bitmapData) { imageData.byteArray = DisplayObjectUtils.getByteArrayFromBitmapData(imageData.bitmapData); //imageData.name = ClassUtils.getIdentifierNameOrClass(initiator) + ".png"; imageData.contentType = DisplayObjectUtils.PNG_MIME_TYPE; imageData.file = null; } if (!imageData.saveInProgress && imageData.id==null) { //imageData.save(); hasAttachments = true; imageData.saveInProgress = true; currentAttachmentToUpload = imageData; //trace("Uploading attachment " + currentAttachmentToUpload.name + " to post " + targetPostID); uploadAttachment(imageData.byteArray, targetPostID, imageData.name, null, imageData.contentType, customData); break; } } else { hasAttachments = true; attachmentData.saveInProgress = true; currentAttachmentToUpload = attachmentData; //trace("Uploading attachment " + currentAttachmentToUpload.name + " to post " + targetPostID); uploadAttachment(attachmentData.byteArray, targetPostID, attachmentData.name, null, attachmentData.contentType, customData); break; } } //for (var i:int;i<numberOfAttachments;i++) { //document = documents[i]; //document.upload(locations); // TODO add support to save after response from server // because ID's may have been added from new documents //saveData(); //document.saveCompleteCallback = saveData; //saveDocumentLocally(document); // anyDocumentSaved = true; //} if (hasAttachments) { DeferManager.callAfter(100, saveAllAttachments, iDocument, saveToProject, locations, saveEvenIfClean); } return anyDocumentSaved; } /** * Result get attachments * */ public static function getAttachmentsResultsHandler(event:IServiceEvent):void { Radiate.info("Retrieved list of attachments"); var data:Object = event.data; var potentialAttachments:Array = []; var numberOfAttachments:int; var object:Object; var attachment:AttachmentData; if (data && data.count>0) { numberOfAttachments = data.count; for (var i:int;i<numberOfAttachments;i++) { object = data.attachments[i]; if (String(object.mime_type).indexOf("image/")!=-1) { attachment = new ImageData(); attachment.unmarshall(object); } else { attachment = new AttachmentData(); attachment.unmarshall(object); } potentialAttachments.push(attachment); } } getAttachmentsInProgress = false; attachments = potentialAttachments; Radiate..dispatchAttachmentsResultsEvent(true, attachments); } /** * Result from attachments fault * */ public static function getAttachmentsFaultHandler(event:IServiceEvent):void { Radiate.info("Could not get list of attachments"); getAttachmentsInProgress = false; //dispatchEvent(saveResultsEvent); Radiate..dispatchAttachmentsResultsEvent(false, []); } /** * Result upload attachment * */ public static function uploadAttachmentResultsHandler(event:IServiceEvent):void { var data:Object = event.data; var successful:Boolean = data && data.status && data.status=="ok" ? true : false; var numberOfRemoteAttachments:int; var remoteAttachments:Array = data && data.post && data.post.attachments ? data.post.attachments : []; var containsName:Boolean; var numberOfAttachmentsToUpload:int; var numberOfDocuments:int; var foundAttachment:Boolean; var lastAddedRemoteAttachment:Object; const documents:Array = DocumentManager.documents; // last attachment successfully uploaded lastAddedRemoteAttachment = remoteAttachments && remoteAttachments.length ? remoteAttachments[remoteAttachments.length-1]: null; var localIDExists:Boolean = com.flexcapacitor.utils.ArrayUtils.hasItem(assets, lastAddedRemoteAttachment.id, "id"); if (currentAttachmentToUpload) { currentAttachmentToUpload.saveInProgress = false; } if (lastAddedRemoteAttachment && currentAttachmentToUpload) { //trace("Last uploaded attachment is " + lastAddedRemoteAttachment.title + " with id of " + lastAddedRemoteAttachment.id); containsName = lastAddedRemoteAttachment.slug.indexOf(currentAttachmentToUpload.slugSafeName)!=-1; } if (!localIDExists) { foundAttachment = true; if (currentAttachmentToUpload) { currentAttachmentToUpload.unmarshall(lastAddedRemoteAttachment); currentAttachmentToUpload.uploadFailed = false; } // loop through documents and replace bitmap data with url to source numberOfDocuments = documents.length; k = 0; for (var k:int;k<numberOfDocuments;k++) { var iDocument:IDocument = documents[k] as IDocument; if (iDocument) { DisplayObjectUtils.walkDownComponentTree(iDocument.componentDescription, replaceBitmapDataWithURL, [currentAttachmentToUpload]); } } } else { warn("Attachment " + currentAttachmentToUpload.name + " could not be uploaded"); currentAttachmentToUpload ? currentAttachmentToUpload.uploadFailed = true : -1; successful = false; foundAttachment = false; } lastAttemptedUpload = attachmentsToUpload && attachmentsToUpload.length ? attachmentsToUpload.unshift() : null; uploadAttachmentInProgress = false; if (!foundAttachment) { successful = false; Radiate..dispatchUploadAttachmentResultsEvent(successful, [], data.post); } else { Radiate..dispatchUploadAttachmentResultsEvent(successful, [currentAttachmentToUpload], data.post); } if (attachmentsToUpload && attachmentsToUpload.length) { // we should do this sequencially } currentAttachmentToUpload = null; } /** * Result from upload attachment fault * */ public static function uploadAttachmentFaultHandler(event:IServiceEvent):void { Radiate.info("Upload attachment fault"); lastAttemptedUpload = attachmentsToUpload && attachmentsToUpload.length ? attachmentsToUpload.unshift() : null; uploadAttachmentInProgress = false; if (currentAttachmentToUpload) { currentAttachmentToUpload.saveInProgress = false; } if (attachmentsToUpload.length) { // we should do this sequencially } //dispatchEvent(saveResultsEvent); Radiate..dispatchUploadAttachmentResultsEvent(false, [], event.data, event.faultEvent); currentAttachmentToUpload = null; } /** * Delete attachments. You should save the project after * document is deleted. * */ public static function deleteAttachmentsResultsHandler(event:IServiceEvent):void { //..Radiate.info("Delete document results"); var data:Object = event.data; var deletedItems:Object = data ? data.deletedItems : []; var successful:Boolean; var error:String; var message:String; if (data && data is Object && "successful" in data) { successful = data.successful != "false"; } deleteAttachmentsInProgress = false; //Include 'id' or 'slug' var in your request. if (event.faultEvent is IOErrorEvent) { message = "Are you connected to the internet? "; if (event.faultEvent is IOErrorEvent) { message = IOErrorEvent(event.faultEvent).text; } else if (event.faultEvent is SecurityErrorEvent) { if (SecurityErrorEvent(event.faultEvent).errorID==2048) { } message += SecurityErrorEvent(event.faultEvent).text; } } Radiate.dispatchAttachmentsDeletedEvent(successful, data); if (successful) { if (DocumentManager.deleteDocumentProjectId!=-1 && DocumentManager.saveProjectAfterDelete) { var iProject:IProject = ProjectManager.getProjectByID(DocumentManager.deleteDocumentProjectId); if (iProject) { iProject.saveOnlyProject(); } } } DocumentManager.saveProjectAfterDelete = false; } /** * Result from delete attachments fault * */ public static function deleteAttachmentsFaultHandler(event:IServiceEvent):void { var data:Object = event.data; Radiate.info("Could not connect to the server to delete the document. "); deleteAttachmentsInProgress = false; Radiate.dispatchAttachmentsDeletedEvent(false, data); } /** * Remove an asset from the documents assets collection * */ public static function removeAssetFromDocument(assetData:IDocumentData, documentData:DocumentData, locations:String = null, dispatchEvents:Boolean = true):Boolean { if (locations==null) locations = DocumentData.REMOTE_LOCATION; var remote:Boolean = ServicesManager.getIsRemoteLocation(locations); var index:int = assets.getItemIndex(assetData); var removedInternally:Boolean; if (index!=-1) { assets.removeItemAt(index); removedInternally = true; } if (remote && assetData && assetData.id) { // we need to create service if (deleteAttachmentService==null) { deleteAttachmentService = new WPService(); deleteAttachmentService.addEventListener(WPService.RESULT, DocumentManager.deleteDocumentResultsHandler, false, 0, true); deleteAttachmentService.addEventListener(WPService.FAULT, DocumentManager.deleteDocumentFaultHandler, false, 0, true); } deleteAttachmentService.host = Radiate.getWPURL(); DocumentManager.deleteDocumentInProgress = true; deleteAttachmentService.deleteAttachment(int(assetData.id), true); } Radiate..dispatchAssetRemovedEvent(assetData, removedInternally); return removedInternally; } /** * Remove assets from the documents assets collection * */ public static function removeAssetsFromDocument(attachments:Array, locations:String = null, dispatchEvents:Boolean = true):Boolean { if (locations==null) locations = DocumentData.REMOTE_LOCATION; var remote:Boolean = ServicesManager.getIsRemoteLocation(locations); var removedInternally:Boolean; var attachmentData:AttachmentData; var attachmentIDs:Array = []; var numberOfAttachments:int; var index:int; numberOfAttachments = attachments ? attachments.length : 0; for (var i:int; i < numberOfAttachments; i++) { attachmentData = attachments[i]; index = assets.getItemIndex(attachmentData); if (index>-1) { assets.removeItemAt(index); removedInternally = true; } } if (remote && attachments && attachments.length) { // we need to create service if (deleteAttachmentsService==null) { deleteAttachmentsService = new WPService(); deleteAttachmentsService.addEventListener(WPService.RESULT, deleteAttachmentsResultsHandler, false, 0, true); deleteAttachmentsService.addEventListener(WPService.FAULT, deleteAttachmentsFaultHandler, false, 0, true); } deleteAttachmentsService.host = Radiate.getWPURL(); deleteAttachmentsInProgress = true; for (var j:int = 0; j < attachments.length; j++) { attachmentData = attachments[j]; if (attachmentData.id!=null) { attachmentIDs.push(attachmentData.id); } } if (attachmentIDs.length) { deleteAttachmentsService.deleteAttachments(attachmentIDs, true); } else { Radiate..dispatchAttachmentsDeletedEvent(true, {localDeleted:true}); } } // dispatch assets removed // later dispatch attachment deleted event when result comes back from server Radiate..dispatchAssetsRemovedEvent(attachments, removedInternally); return removedInternally; } /** * Replaces occurances where the bitmapData in Image and BitmapImage have * been uploaded to the server and we now want to point the image to a URL * rather than bitmap data * */ public static function replaceBitmapDataWithURL(component:ComponentDescription, imageData:ImageData):void { var instance:Object; if (imageData && component && component.instance) { instance = component.instance; if (instance is Image || instance is BitmapImage) { if (instance.source is BitmapData && instance.source == imageData.bitmapData && imageData.bitmapData!=null) { ComponentManager.setProperty(instance, "source", imageData.url); } } } } /** * Saves the selected target as an image in the library. * If successful returns ImageData. If unsuccessful returns Error * Quality is set to BEST by default. There are higher quality settings but there are * numerous bugs when enabled. Embedded or system fonts are 75% of there normal size and gradients fills are only a few colors. * */ public static function saveToLibrary(target:Object, clip:Boolean = false, scale:Number = 1, quality:String = StageQuality.BEST):Object { var radiate:Radiate = Radiate.instance; var snapshot:Object; var data:ImageData; var previousScaleX:Number; var previousScaleY:Number; if (target && selectedDocument) { previousScaleX = target.scaleX; previousScaleY = target.scaleY; target.scaleX = scale; target.scaleY = scale; if (!clip) { if (target is UIComponent) { // new 2015 method from Bitmap utils snapshot = DisplayObjectUtils.getSnapshotWithQuality(target as UIComponent, quality); } else if (target is DisplayObject) { snapshot = DisplayObjectUtils.rasterize2(target as DisplayObject); } else if (target is GraphicElement) { snapshot = DisplayObjectUtils.getGraphicElementBitmapData(target as GraphicElement); } } else { if (target is UIComponent) { snapshot = DisplayObjectUtils.getUIComponentWithQuality(target as UIComponent); } else if (target is DisplayObject) { snapshot = DisplayObjectUtils.rasterize2(target as DisplayObject); } else if (target is GraphicElement) { snapshot = DisplayObjectUtils.getGraphicElementBitmapData(target as GraphicElement); } } target.scaleX = previousScaleX; target.scaleY = previousScaleY; if (snapshot is BitmapData) { // need to trim the transparent areas snapshot = DisplayObjectUtils.trimTransparentBitmapData(snapshot as BitmapData); data = new ImageData(); data.bitmapData = snapshot as BitmapData; data.byteArray = DisplayObjectUtils.getByteArrayFromBitmapData(snapshot as BitmapData); data.name = ClassUtils.getIdentifierNameOrClass(target) + ".png"; data.contentType = DisplayObjectUtils.PNG_MIME_TYPE; data.file = null; LibraryManager.addAssetToDocument(data, Radiate.selectedDocument); return data; } else { //Radiate.error("Could not create a snapshot of the selected item. " + snapshot); } } return snapshot; } /** * Get the image data object that is contains this bitmap data. * Note: Getting image.bitmapData returns a clone, bitmapdata.clone(). * Use image.source if it is bitmapData. * */ public static function getImageDataFromBitmapData(bitmapData:BitmapData):ImageData { var numberOfAssets:int = assets.length; var imageData:ImageData; for (var i:int = 0; i < numberOfAssets; i++) { imageData = assets.getItemAt(i) as ImageData; if (imageData && imageData.bitmapData===bitmapData) { return imageData; } } return null; } /** * Get bitmap data matching ImageData.uid. * */ public static function getBitmapDataFromImageDataID(uid:String):BitmapData { var numberOfAssets:int = assets.length; var imageData:ImageData; for (var i:int = 0; i < numberOfAssets; i++) { imageData = assets.getItemAt(i) as ImageData; if (imageData && imageData.uid===uid) { return imageData.bitmapData; } } return null; } /** * Add multiple assets to a document or project * */ public static function addAssetsToDocument(assetsToAdd:Array, documentData:DocumentData, dispatchEvents:Boolean = true):void { var numberOfAssets:int; var added:Boolean; numberOfAssets = assetsToAdd ? assetsToAdd.length : 0; for (var i:int;i<numberOfAssets;i++) { addAssetToDocument(assetsToAdd[i], documentData, dispatchEvents); } } /** * Add an asset to the document assets collection * Should be renamed to something like addAssetToGlobalResourcesAndAssociateWithDocument * */ public static function addAssetToDocument(attachmentData:DocumentData, documentData:IDocumentData, dispatchEvent:Boolean = true):void { var numberOfAssets:int = assets ? assets.length : 0; var found:Boolean; var addedAttachmentData:DocumentData; var reparented:Boolean; for (var i:int;i<numberOfAssets;i++) { addedAttachmentData = assets.getItemAt(i) as DocumentData; if (attachmentData.id==addedAttachmentData.id && addedAttachmentData.id!=null) { found = true; break; } } if (documentData) { if (attachmentData.parentId != documentData.id) { attachmentData.parentId = documentData.id; reparented = true; } } if (!found) { assets.addItem(attachmentData); } if ((!found || reparented) && dispatchEvent) { Radiate..dispatchAssetAddedEvent(attachmentData); } } /** * Adds PSD to the document. <br/> * Adds assets to the library and document<br/> * Missing support for masks, shapes and text (text is shown as image)<br/> * Can take quite a while to import. <br/> * Could use performance testing. * */ public static function addPSDToDocument(psdFileData:ByteArray, iDocument:IDocument, matchDocumentSizeToPSD:Boolean = true, addToAssets:Boolean = true):void { if (deferredDocument==null) { deferredDocument = iDocument; } PSDImporter.addPSDToDocument(deferredDocument, psdFileData, iDocument, matchDocumentSizeToPSD, addToAssets, deferredFileLoader, deferredFileLoader); } /** * Adds bitmap data to the document. Since it is asynchronous we listen for init event * */ public static function addBase64ImageDataToDocument(iDocument:IDocument, fileData:FileData, destination:Object = null, name:String = null, addComponent:Boolean = true, resizeIfNeeded:Boolean = true, resizeDocumentToContent:Boolean = false):void { var bitmapData:BitmapData = DisplayObjectUtils.getBitmapDataFromBase64(fileData.dataURI, null, true, fileData.type); if (destination==null) destination = getDestinationForExternalFileDrop(); var imageData:ImageData = addBitmapDataToDocument(iDocument, bitmapData, destination, fileData.name, addComponent, resizeIfNeeded, resizeDocumentToContent); // it's possible we weren't able to determine the dimensions of the image // so we add a listener to check after loading it with a loader var contentLoaderInfo:LoaderInfo = DisplayObjectUtils.loader.contentLoaderInfo; // save a reference to the loader info so it doesn't get garbage collected contentLoaderDictionary[contentLoaderInfo] = ComponentManager.lastCreatedComponent; contentLoaderInfo.addEventListener(Event.INIT, handleLoadingImages, false, 0, true); } /** * Handles when image is fully loaded from base 64 string data **/ public static function handleLoadingImages(event:Event):void { var newBitmapData:BitmapData; var bitmap:Bitmap; var contentLoaderInfo:LoaderInfo = event.currentTarget as LoaderInfo; var componentInstance:Object = contentLoaderDictionary[contentLoaderInfo]; if (contentLoaderInfo.loader.content) { bitmap = contentLoaderInfo.loader.content as Bitmap; newBitmapData = bitmap ? bitmap.bitmapData : null; } if (newBitmapData && componentInstance) { if (newBitmapData.compare(componentInstance.bitmapData)!=0) { const WIDTH:String = "width"; const HEIGHT:String = "height"; var properties:Array = []; var propertiesObject:Object; var documentProperties:Array = []; var documentPropertiesObject:Object; var imageData:ImageData; var originalBitmapData:BitmapData; //originalBitmapData = componentInstance.bitmapData; returns a clone use image.source originalBitmapData = componentInstance.source; imageData = getImageDataFromBitmapData(originalBitmapData); if (imageData.resizeDocumentToFit) { documentPropertiesObject = {}; documentPropertiesObject[WIDTH] = newBitmapData.width; documentPropertiesObject[HEIGHT] = newBitmapData.height; documentProperties.push(WIDTH); documentProperties.push(HEIGHT); ComponentManager.setProperties(selectedDocument.instance, documentProperties, documentPropertiesObject, "Document resized to image"); } else if (imageData.resizeToFitDocument) { propertiesObject = ImageManager.getConstrainedImageSizeObject(selectedDocument, newBitmapData); } if (propertiesObject==null) { ComponentManager.setProperty(componentInstance, "source", newBitmapData, "Source loaded"); } else { propertiesObject.source = newBitmapData; properties.push(WIDTH); properties.push(HEIGHT); properties.push("source"); ComponentManager.setProperties(componentInstance, properties, propertiesObject, "Source loaded"); } if (imageData) { imageData.bitmapData = newBitmapData; } } } if (contentLoaderInfo) { contentLoaderInfo.removeEventListener(Event.INIT, handleLoadingImages); } contentLoaderDictionary[contentLoaderInfo] = null; delete contentLoaderDictionary[contentLoaderInfo]; } /** * Adds an asset to the document * */ public static function addImageDataToDocument(imageData:ImageData, iDocument:IDocument, constrainImageToDocument:Boolean = true, smooth:Boolean = true, constrainDocumentToImage:Boolean = false):Boolean { var item:ComponentDefinition; var application:Application; var componentInstance:Object; var path:String; var bitmapData:BitmapData; var resized:Boolean; item = ComponentManager.getComponentType("Image"); application = iDocument && iDocument.instance ? iDocument.instance as Application : null; if (!application) { warn("No document instance was available to add image into. Create a new document and add the image to it manually"); return false; } // set to true so if we undo it has defaults to start with componentInstance = ComponentManager.createComponentToAdd(iDocument, item, true); bitmapData = imageData.bitmapData; const WIDTH:String = "width"; const HEIGHT:String = "height"; var styles:Array = []; var properties:Array = []; var propertiesObject:Object; var documentProperties:Array = []; var documentPropertiesObject:Object; if (constrainDocumentToImage) { documentPropertiesObject = {}; documentPropertiesObject[WIDTH] = bitmapData.width; documentPropertiesObject[HEIGHT] = bitmapData.height; documentProperties.push(WIDTH); documentProperties.push(HEIGHT); ComponentManager.setProperties(iDocument.instance, documentProperties, documentPropertiesObject, "Document resized to image"); } else if (constrainImageToDocument) { propertiesObject = ImageManager.getConstrainedImageSizeObject(iDocument, bitmapData); } if (propertiesObject==null) { propertiesObject = {}; } else { resized = true; properties.push(WIDTH); properties.push(HEIGHT); } propertiesObject.scaleMode = "stretch"; properties.push("scaleMode"); if (smooth) { properties.push("smooth"); propertiesObject.smooth = true; // the bitmap is all white when smoothing quality is enabled (safari mac fp 25.0.0.171( // changing any settings such as smooth enable or disable then shows the image correctly // so disabling for now //styles.push("smoothingQuality"); //propertiesObject.smoothingQuality = "high"; } if (imageData is ImageData) { path = imageData.url; if (path) { propertiesObject.width = undefined; propertiesObject.height = undefined; propertiesObject.source = path; properties.push(WIDTH); properties.push(HEIGHT); } else if (imageData.bitmapData) { propertiesObject.source = imageData.bitmapData; } properties.push("source"); } ComponentManager.addElement(componentInstance, iDocument.instance, properties, styles, null, propertiesObject); ComponentManager.updateComponentAfterAdd(iDocument, componentInstance); return resized; } /** * Add file list data to a document * */ public static function addFileListDataToDocument(iDocument:IDocument, fileList:Array, destination:Object = null, operation:String = "drop", createDocument:Boolean = false):void { if (fileList==null) { error("Not a valid file list"); return; } if (fileList && fileList.length==0) { error("No files in the file list"); return; } if (iDocument==null) { if (createDocument) { iDocument = DocumentManager.createNewDocumentAndSwitchToDesignView(fileList); } else { error("No document is open. Create a new document first. "); return; } } var urlFormatData:Object; var path_txt:String; var extension:String; var fileSafeList:Array; var hasPSD:Boolean; var hasMXML:Boolean; var hasFXG:Boolean; var hasSVG:Boolean; var extensionIndex:int; fileSafeList = []; // only accepting image files at this time for each (var file:FileReference in fileList) { if ("extension" in file) { extension = file.extension.toLowerCase(); } else { extensionIndex = file.name.lastIndexOf("."); extension = extensionIndex!=-1 ? file.name.substring(extensionIndex+1) : null; } if (extension=="png" || extension=="jpg" || extension=="jpeg" || extension=="gif") { fileSafeList.push(file); } else if (extension=="psd") { fileSafeList.push(file); hasPSD = true; } else if (extension=="mxml") { fileSafeList.push(file); hasMXML = true; } else if (extension=="fxg") { fileSafeList.push(file); hasFXG = true; } else if (extension=="svg") { fileSafeList.push(file); hasSVG = true; } else { path_txt = "Not a recognised file format"; } } var fileLoader:LoadFile; const PASTE:String = "paste"; const DROP:String = "drop"; if (operation==PASTE) { setupPasteFileLoader(); fileLoader = deferredFileLoader; } else if (operation==DROP) { setupPasteFileLoader(); fileLoader = deferredFileLoader; } fileLoader.removeReferences(true); if (!hasPSD && !hasMXML && !hasSVG && !hasFXG) { fileLoader.loadIntoLoader = true; } else { fileLoader.loadIntoLoader = false; } if (fileSafeList.length>0) { if (fileSafeList.length>1 && hasPSD) { warn("You cannot load a PSD and image files at the same time. Select one or the other"); return; } else if (fileSafeList.length>1 && hasMXML) { warn("You cannot load a MXML file and other files at the same time. Select one or the other"); return; } else if (fileSafeList.length>1 && hasFXG) { warn("You cannot load a FXG file and other files at the same time. Select one or the other"); return; } else if (fileSafeList.length>1 && hasSVG) { warn("You cannot load a SVG file and other files at the same time. Select one or the other"); return; } if (hasPSD) { loadingPSD = true; } else if (hasMXML) { loadingMXML = true; } else if (hasFXG) { loadingFXG = true; } else if (hasSVG) { loadingSVG = true; } else { loadingPSD = false; } deferredDocument = iDocument; fileLoader.filesArray = fileSafeList; fileLoader.play(); } else { deferredDocument = null; info("No files of the acceptable type were found. Acceptable files are PNG, JPEG, GIF, PSD"); } } /** * Add bitmap data to a document * */ public static function addBitmapDataToDocument(iDocument:IDocument, bitmapData:BitmapData, destination:Object = null, name:String = null, addComponent:Boolean = false, resizeIfNeeded:Boolean = true, resizeDocumentToContent:Boolean = false):ImageData { if (bitmapData==null) { error("Not valid bitmap data"); } if (iDocument==null) { error("Not a valid document"); } if (bitmapData==null || iDocument==null) { return null; } var imageData:ImageData = new ImageData(); var resized:Boolean; var smooth:Boolean = true; imageData.bitmapData = bitmapData; imageData.byteArray = DisplayObjectUtils.getByteArrayFromBitmapData(bitmapData); if (name==null) { name = "Image"; } imageData.name = name; imageData.contentType = DisplayObjectUtils.PNG_MIME_TYPE; imageData.file = null; imageData.resizeToFitDocument = resizeIfNeeded; imageData.resizeDocumentToFit = resizeDocumentToContent; if (addComponent) { resized = LibraryManager.addImageDataToDocument(imageData, iDocument, resizeIfNeeded, smooth, resizeDocumentToContent); //uploadAttachment(fileLoader.fileReference); if (resized) { info("Image was added to the library and the document and resized to fit"); } else { info("Image was added to the library and the document"); } Radiate.setTarget(ComponentManager.lastCreatedComponent); //dispatchAssetLoadedEvent(imageData, iDocument, resized, true); } addAssetToDocument(imageData, iDocument); return imageData; //info("An image from the clipboard was added to the library"); } /** * Add text data to a document * */ public static function addTextDataToDocument(iDocument:IDocument, text:String, destination:Object = null, useRichText:Boolean = true):void { if (text==null || text=="") { error("Not valid text data"); } if (iDocument==null) { error("Not a valid document"); } if (text==null || iDocument==null) { return; } var componentType:String = useRichText ? "spark.components.RichText" : "spark.components.Label"; var definition:ComponentDefinition = ComponentManager.getDynamicComponentType(componentType, true); var component:Object = ComponentManager.createComponentToAdd(iDocument, definition, false); var textFlow:TextFlow; if (useRichText) { textFlow = TextConverter.importToFlow(text, TextConverter.PLAIN_TEXT_FORMAT); ComponentManager.addElement(component, destination, ["textFlow"], null, null, {textFlow:textFlow}); } else { ComponentManager.addElement(component, destination, ["text"], null, null, {text:text}); } ComponentManager.updateComponentAfterAdd(iDocument, component); //info("Text from the clipboard was added to the document"); } /** * Add html data to a document. The importer is awful * */ public static function addHTMLDataToDocument(iDocument:IDocument, text:String, destination:Object = null):void { if (text==null || text=="") { error("Not valid text data"); } if (iDocument==null) { error("Not a valid document"); } if (text==null || iDocument==null) { return; } var definition:ComponentDefinition = ComponentManager.getDynamicComponentType("spark.components.RichText", true); if (!definition) { return; } var componentInstance:RichText = ComponentManager.createComponentToAdd(iDocument, definition, false) as RichText; var formatter:HTMLFormatterTLF = HTMLFormatterTLF.staticInstance; var translatedHTMLText:String; var textFlow:TextFlow; formatter.replaceLinebreaks = true; formatter.replaceMultipleBreaks = true; formatter.replaceEmptyBlockQoutes = true; translatedHTMLText = formatter.format(text); textFlow = TextConverter.importToFlow(translatedHTMLText, TextConverter.TEXT_FIELD_HTML_FORMAT); componentInstance.textFlow = textFlow; ComponentManager.addElement(componentInstance, destination, ["textFlow"], null, null, {textFlow:textFlow}); ComponentManager.updateComponentAfterAdd(iDocument, componentInstance); //info("HTML from the clipboard was added to the library"); } public static var acceptablePasteFormats:Array = ["Object", "UIComponent", "air:file list", "air:url", "air:bitmap", "air:text"]; public static var acceptableDropFormats:Array = ["UIComponent", "air:file list", "air:url", "air:bitmap"]; /** * Returns true if it's a type of content we can accept to be pasted in * */ public static function isAcceptablePasteFormat(formats:Array):Boolean { if (formats==null || formats.length==0) return false; if (ArrayUtils.containsAny(formats, acceptablePasteFormats)) { return true; } return false; } /** * Returns true if it's a type of content we can accept to be dragged and dropped. * If we are dragging a UIComponent we don't want to accept it by default because * it could be us dragging a component around the design view * */ public static function isAcceptableDragAndDropFormat(dragSource:DragSource, includeUIComponents:Boolean = false):Boolean { if (dragSource==null) return false; if ((dragSource.hasFormat("UIComponent") && includeUIComponents) || dragSource.hasFormat("air:file list") || dragSource.hasFormat("air:url") || dragSource.hasFormat("air:bitmap")) { var url:String; // if internal html preview is visible we should return false since // dragged images are triggering the drop panel if (DocumentManager.isDocumentPreviewOpen(selectedDocument) && dragSource.hasFormat("air:url")) { // http://www.radii8.com/.../image.jpg //url = dragSource.dataForFormat(ClipboardFormats.URL_FORMAT) as String; return false; } return true; } return false; } protected static function setupPasteFileLoader():void { if (deferredFileLoader==null) { deferredFileLoader = new LoadFile(); //pasteFileLoader.addEventListener(LoadFile.LOADER_COMPLETE, pasteFileCompleteHandler, false, 0, true); //pasteFileLoader.addEventListener(LoadFile.COMPLETE, pasteFileCompleteHandler, false, 0, true); deferredFileLoader.addEventListener(LoadFile.LOADER_COMPLETE, dropFileCompleteHandler, false, 0, true); deferredFileLoader.addEventListener(LoadFile.COMPLETE, dropFileCompleteHandler, false, 0, true); } }/* // mostly a duplicate of setup paste file loader but haven't had chance to test it protected function setupDropFileLoader():void { if (dropFileLoader==null) { dropFileLoader = new LoadFile(); dropFileLoader.addEventListener(LoadFile.LOADER_COMPLETE, dropFileCompleteHandler, false, 0, true); dropFileLoader.addEventListener(LoadFile.COMPLETE, dropFileCompleteHandler, false, 0, true); } }*/ /** * Occurs after files are dropped into the document are fully loaded * */ protected static function dropFileCompleteHandler(event:Event):void { var resized:Boolean; var imageData:ImageData; // if we need to load the images ourselves then skip complete event // and wait until loader complete event if (deferredFileLoader.loadIntoLoader && event.type!=LoadFile.LOADER_COMPLETE) { return; } if (!deferredDocument) { error("No document was found to add a file into"); return; } if (loadingPSD) { loadingPSD = false; info("Importing PSD"); DeferManager.callAfter(250, addPSDToDocument, deferredFileLoader.data, deferredDocument); return; } if (loadingMXML) { loadingMXML = false; info("Importing MXML"); DeferManager.callAfter(250, ImportManager.importMXMLDocument, selectedProject, deferredDocument, deferredFileLoader.dataAsString, deferredDocument.instance); return; } if (loadingFXG) { loadingFXG = false; info("Importing FXG"); DeferManager.callAfter(250, ImportManager.importFXGDocument, selectedProject, deferredDocument, deferredFileLoader.dataAsString, deferredDocument.instance); return; } if (loadingSVG) { loadingSVG = false; info("Importing SVG"); DeferManager.callAfter(250, ImportManager.importSVGDocument, selectedProject, deferredDocument, deferredFileLoader.dataAsString, deferredDocument.instance); return; } imageData = new ImageData(); imageData.bitmapData = deferredFileLoader.bitmapData; imageData.byteArray = deferredFileLoader.data; imageData.name = deferredFileLoader.currentFileReference.name; imageData.contentType = deferredFileLoader.loaderContentType; imageData.file = deferredFileLoader.currentFileReference; addAssetToDocument(imageData, deferredDocument); resized = addImageDataToDocument(imageData, deferredDocument); //list.selectedItem = data; //uploadAttachment(fileLoader.fileReference); if (resized) { info("An image was added to the library and the document and resized to fit"); } else { info("An image was added to the library"); } Radiate.setTarget(ComponentManager.lastCreatedComponent); Radiate..dispatchAssetLoadedEvent(imageData, deferredDocument, resized, true); } /** * Get destination component or application when image files are * dropped from an external source * */ public static function getDestinationForExternalFileDrop():Object { var destination:Object = Radiate.instance.target; var addToDocumentForNow:Boolean = true; // get destination of clipboard contents if (destination && !(destination is IVisualElementContainer)) { if (addToDocumentForNow) { destination = null; } else { destination = destination.owner; } } if (!destination && selectedDocument) { destination = selectedDocument.instance; } return destination; } public static function dropItemWeb(object:Object, createNewDocument:Boolean = false, createDocumentIfNeeded:Boolean = true, resizeIfNeeded:Boolean = true, resizeDocumentToContent:Boolean = false):void { var fileData:FileData; var byteArray:ByteArray; var destination:Object; var htmlDragData:HTMLDragData; var extension:String; var hasPSD:Boolean; var hasMXML:Boolean; var hasFXG:Boolean; var hasSVG:Boolean; var hasImage:Boolean; var fileSafeList:Array; var value:String; var smooth:Boolean = true; fileSafeList = []; if (object is HTMLDragEvent) { htmlDragData = object.data as HTMLDragData; } else if (object is HTMLDragData) { htmlDragData = object as HTMLDragData; } if (htmlDragData.mimeType==HTMLDragManager.INVALID) { warn("The dropped file was not valid."); return; } fileData = new FileData(htmlDragData); ViewManager.mainView.dropImagesLocation.visible = false; extension = htmlDragData.getExtension(); if (extension=="png" || extension=="jpg" || extension=="jpeg" || extension=="gif") { hasImage = true; fileSafeList.push(fileData); } else if (extension=="psd") { fileSafeList.push(fileData); hasPSD = true; } else if (extension=="mxml") { fileSafeList.push(fileData); hasMXML = true; } else if (extension=="fxg") { fileSafeList.push(fileData); hasFXG = true; } else if (extension=="svg") { fileSafeList.push(fileData); hasSVG = true; } else { //path_txt = "Not a recognised file format"; } if (createNewDocument || (createDocumentIfNeeded && selectedDocument==null)) { DocumentManager.createNewDocumentAndSwitchToDesignView(htmlDragData, selectedProject, resizeIfNeeded, resizeDocumentToContent); } else { if (hasImage) { addBase64ImageDataToDocument(selectedDocument, fileData, destination, fileData.name, true, resizeIfNeeded, resizeDocumentToContent); } else if (hasPSD) { byteArray = htmlDragData.getByteArray(); addPSDToDocument(byteArray, selectedDocument); } else if (hasMXML) { value = htmlDragData.getString(); ImportManager.importMXMLDocument(selectedProject, selectedDocument, value, selectedDocument.instance); } else if (hasFXG) { value = htmlDragData.getString(); ImportManager.importFXGDocument(selectedProject, selectedDocument, value, selectedDocument.instance); } else if (hasSVG) { value = htmlDragData.getString(); ImportManager.importSVGDocument(selectedProject, selectedDocument, value, selectedDocument.instance); } } } public static function dropItem(event:DragEvent, createNewDocument:Boolean = false):void { var dragSource:DragSource; var hasFileListFormat:Boolean; var hasFilePromiseListFormat:Boolean; var hasURLFormat:Boolean; var isSelf:Boolean; var AIR_URL:String = "air:url"; var isHTMLPreviewOpen:Boolean; AIR_URL = ClipboardFormats.URL_FORMAT; dragSource = event.dragSource; hasFileListFormat = dragSource.hasFormat(ClipboardFormats.FILE_LIST_FORMAT); hasFilePromiseListFormat = dragSource.hasFormat(ClipboardFormats.FILE_PROMISE_LIST_FORMAT); hasURLFormat = dragSource.hasFormat(AIR_URL); isHTMLPreviewOpen = DocumentManager.isDocumentPreviewOpen(selectedDocument); var destination:Object; var droppedFiles:Array; if (isAcceptableDragAndDropFormat(dragSource)) { if (hasFileListFormat) { droppedFiles = dragSource.dataForFormat(ClipboardFormats.FILE_LIST_FORMAT) as Array; } else if (hasFilePromiseListFormat) { droppedFiles = dragSource.dataForFormat(ClipboardFormats.FILE_PROMISE_LIST_FORMAT) as Array; } // not handling URL format. need to load it and check the file type else if (hasURLFormat) { // if internal html preview is visible we should return false since if (isHTMLPreviewOpen) { // dragged images are triggering the drop panel } return; } if (droppedFiles) { if (selectedDocument==null || createNewDocument) { DocumentManager.createNewDocumentAndSwitchToDesignView(droppedFiles, selectedProject); } else if (selectedDocument) { destination = getDestinationForExternalFileDrop(); addFileListDataToDocument(selectedDocument, droppedFiles as Array, destination); } else { } } } // Error: Attempt to access a dead clipboard // at flash.desktop::Clipboard/checkAccess() // at flash.desktop::Clipboard/getData() // Occurs when accessing a dragSource at a later time than the drop event // droppedFiles = dragSource.dataForFormat(ClipboardFormats.FILE_LIST_FORMAT) as Array; } /** * Adds image to document from bitmap data **/ public static function dropInBitmapData(bitmapData:BitmapData, createNewDocument:Boolean = false, createDocumentIfNeeded:Boolean = true, name:String = null):void { var fileData:FileData; var destination:Object; var imageData:ImageData; if (createNewDocument || (createDocumentIfNeeded && selectedDocument==null)) { DocumentManager.createNewDocumentAndSwitchToDesignView(bitmapData, selectedProject, true, false, name); } else { destination = getDestinationForExternalFileDrop(); imageData = addBitmapDataToDocument(selectedDocument, bitmapData, destination, name, true); } } /** * Used on select event when browsing for file * */ public static function loadSelectedFile(files:Object):void { var destination:Object; var filesToAdd:Array = []; if (files is FileReferenceList) { filesToAdd = FileReferenceList(files).fileList; } else if (files is FileReference) { filesToAdd = [files]; } else if (files is Array) { filesToAdd = (files as Array).slice(); } if (filesToAdd && filesToAdd.length) { destination = getDestinationForExternalFileDrop(); deferredDocument = selectedDocument; addFileListDataToDocument(selectedDocument, filesToAdd, destination); } else { warn("No files were selected."); } } //---------------------------------- // instance //---------------------------------- public static function get instance():LibraryManager { if (!_instance) { _instance = new LibraryManager(new SINGLEDOUBLE()); } return _instance; } public static function getInstance():LibraryManager { return instance; } private static var _instance:LibraryManager; } } class SINGLEDOUBLE{}
package kabam.rotmg.messaging.impl.incoming { import flash.display.BitmapData; import flash.utils.ByteArray; import flash.utils.IDataInput; public class Pic extends IncomingMessage { public var bitmapData_:BitmapData = null; public function Pic(param1:uint, param2:Function) { super(param1,param2); } override public function parseFromInput(param1:IDataInput) : void { var _local2:int = param1.readInt(); var _local3:int = param1.readInt(); var _local4:ByteArray = new ByteArray(); param1.readBytes(_local4,0,_local2 * _local3 * 4); this.bitmapData_ = new BitmapData(_local2,_local3,true,0); this.bitmapData_.setPixels(this.bitmapData_.rect,_local4); } override public function toString() : String { return formatToString("PIC","bitmapData_"); } } }
package kabam.rotmg.assets.EmbeddedAssets { import mx.core.*; [Embed(source="spritesheets/EmbeddedAssets_d2Chars16x16rEmbed_.png")] public class EmbeddedAssets_d2Chars16x16rEmbed_ extends BitmapAsset { public function EmbeddedAssets_d2Chars16x16rEmbed_() { super(); return; } } }
package io.decagames.rotmg.dailyQuests.signal { import org.osflash.signals.Signal; public class CloseRefreshPopupSignal extends Signal { public function CloseRefreshPopupSignal() { super(); } } }
/* * Copyright (C) 2003-2012 Igniterealtime Community Contributors * * Daniel Henninger * Derrick Grigg <dgrigg@rogers.com> * Juga Paazmaya <olavic@gmail.com> * Nick Velloff <nick.velloff@gmail.com> * Sean Treadway <seant@oncotype.dk> * Sean Voisen <sean@voisen.org> * Mark Walters <mark@yourpalmark.com> * Michael McCarthy <mikeycmccarthy@gmail.com> * * * 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.igniterealtime.xiff.events { import flash.events.Event; public class ConnectionSuccessEvent extends Event { public static const CONNECT_SUCCESS:String = "connection"; public function ConnectionSuccessEvent() { super( ConnectionSuccessEvent.CONNECT_SUCCESS, false, false ); } override public function clone():Event { return new ConnectionSuccessEvent(); } override public function toString():String { return '[ConnectionSuccessEvent type="' + type + '" bubbles=' + bubbles + ' cancelable=' + cancelable + ' eventPhase=' + eventPhase + ']'; } } }
//////////////////////////////////////////////////////////////////////////////// // // 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.charts.styles { import mx.core.mx_internal; import mx.graphics.IFill; import mx.graphics.IStroke; import mx.graphics.SolidColor; import mx.graphics.Stroke; import mx.styles.CSSStyleDeclaration; import mx.styles.IStyleManager2; use namespace mx_internal; /** * Initializes the core default styles for the charts classes. Each chart and element is responsible for initializing their own * style values, but they rely on the common values computed by the HaloDefaults class. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class HaloDefaults { include "../../core/Version.as"; //-------------------------------------------------------------------------- // // Class variables // //-------------------------------------------------------------------------- /** * @private */ private static var inited:Boolean; [Inspectable(environment="none")] /** * The default selectors applied to the individual series in a chart. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ mx_internal static var chartBaseChartSeriesStyles:Array; [Inspectable(environment="none")] /** * The default color values used by chart controls to color different series (or, in a PieSeries, different items). * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ mx_internal static var defaultColors:Array = [ 0xE48701 ,0xA5BC4E ,0x1B95D9 ,0xCACA9E ,0x6693B0 ,0xF05E27 ,0x86D1E4 ,0xE4F9A0 ,0xFFD512 ,0x75B000 ,0x0662B0 ,0xEDE8C6 ,0xCC3300 ,0xD1DFE7 ,0x52D4CA ,0xC5E05D ,0xE7C174 ,0xFFF797 ,0xC5F68F ,0xBDF1E6 ,0x9E987D ,0xEB988D ,0x91C9E5 ,0x93DC4A ,0xFFB900 ,0x9EBBCD ,0x009797 ,0x0DB2C2 ]; [Inspectable(environment="none")] /** * The default SolidColor objects used as fills by chart controls to color different series (or, in a PieSeries, different items). * These Fill objects correspond to the values in the <code>defaultColors</code> Array. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ mx_internal static var defaultFills:Array = []; [Inspectable(environment="none")] mx_internal static var pointStroke:IStroke; [Inspectable(environment="none")] /** * A pre-defined invisible Stroke that is used by several chart styles. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ mx_internal static var emptyStroke:IStroke; //-------------------------------------------------------------------------- // // Class methods // //-------------------------------------------------------------------------- /** * Creates a CSSStyleDeclaration object or returns an existing one. * * @param selectorName The name of the selector to return. If no existing CSSStyleDeclaration object matches * this name, this method creates a new one and returns it. * * @param styleManager The styleManager instance to be used for getting and setting style declarations. * * @return The CSSStyleDeclaration object that matches the provided selector name. If no CSSStyleDeclaration object matches * that name, this method creates a new one and returns it. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static function createSelector( selectorName:String, styleManager:IStyleManager2):CSSStyleDeclaration { var selector:CSSStyleDeclaration = styleManager.getStyleDeclaration(selectorName); if (!selector) { selector = new CSSStyleDeclaration(); styleManager.setStyleDeclaration(selectorName, selector, false); } return selector; } /** * Initializes the common values used by the default styles for the chart and element classes. * * @param styleManager The styleManager instance to be used for getting and setting style declarations. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static function init(styleManager:IStyleManager2):void { if (inited) return; var seriesStyleCount:int = defaultColors.length; for (var i:int = 0; i < seriesStyleCount; i++) { defaultFills[i] = new SolidColor(defaultColors[i]); } pointStroke = new Stroke(0, 0, 0.5); emptyStroke = new Stroke(0, 0, 0); chartBaseChartSeriesStyles = []; var f:Function; for (i = 0; i < seriesStyleCount; i++) { var styleName:String = "haloSeries" + i; chartBaseChartSeriesStyles[i] = styleName; var o:CSSStyleDeclaration = HaloDefaults.createSelector("." + styleName, styleManager); f = function (o:CSSStyleDeclaration, defaultFill:IFill,defaultStroke:IStroke):void { o.defaultFactory = function():void { this.fill = defaultFill; this.areaFill = defaultFill; this.areaStroke = emptyStroke; this.lineStroke = defaultStroke; } } f(o, HaloDefaults.defaultFills[i],new Stroke(defaultColors[i], 3, 1)); } } } }
/** * VERSION: 2.11 * DATE: 10/2/2009 * AS3 * UPDATES AND DOCUMENTATION AT: http://www.TweenMax.com **/ package com.greensock.plugins { import com.greensock.*; import com.greensock.core.*; /** * If you'd like to tween something to a destination value that may change at any time, * DynamicPropsPlugin allows you to simply associate a function with a property so that * every time the tween is updated, it calls that function to get the new destination value * for the associated property. For example, if you want a MovieClip to tween to wherever the * mouse happens to be, you could do:<br /><br /><code> * * TweenLite.to(mc, 3, {dynamicProps:{x:getMouseX, y:getMouseY}}); <br /> * function getMouseX():Number {<br /> * return this.mouseX;<br /> * }<br /> * function getMouseY():Number {<br /> * return this.mouseY;<br /> * }<br /><br /></code> * * Of course you can get as complex as you want inside your custom function, as long as * it returns the destination value, TweenLite/Max will take care of adjusting things * on the fly.<br /><br /> * * You can optionally pass any number of parameters to functions using the "params" * special property like so:<br /><br /><code> * * TweenLite.to(mc, 3, {dynamicProps:{x:myFunction, y:myFunction, params:{x:[mc2, "x"], y:[mc2, "y"]}}}); <br /> * function myFunction(object:MovieClip, propName:String):Number {<br /> * return object[propName];<br /> * }<br /><br /></code> * * DynamicPropsPlugin is a <a href="http://blog.greensock.com/club/">Club GreenSock</a> membership benefit. * You must have a valid membership to use this class without violating the terms of use. * Visit <a href="http://blog.greensock.com/club/">http://blog.greensock.com/club/</a> to sign up or get * more details. <br /><br /> * * <b>USAGE:</b><br /><br /> * <code> * import com.greensock.TweenLite; <br /> * import com.greensock.plugins.TweenPlugin; <br /> * import com.greensock.plugins.DynamicPropsPlugin; <br /> * TweenPlugin.activate([DynamicPropsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.<br /><br /> * * TweenLite.to(my_mc, 3, {dynamicProps:{x:getMouseX, y:getMouseY}}); <br /><br /> * * function getMouseX():Number {<br /> * return this.mouseX;<br /> * }<br /> * function getMouseY():Number {<br /> * return this.mouseY;<br /> * } <br /><br /> * </code> * * <b>Copyright 2009, GreenSock. All rights reserved.</b> This work is subject to the terms in <a href="http://www.greensock.com/terms_of_use.html">http://www.greensock.com/terms_of_use.html</a> or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. * * @author Jack Doyle, jack@greensock.com */ public class DynamicPropsPlugin extends TweenPlugin { /** @private **/ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility /** @private **/ protected var _target:Object; /** @private **/ protected var _props:Array; /** @private **/ protected var _lastFactor:Number; /** @private **/ public function DynamicPropsPlugin() { super(); this.propName = "dynamicProps"; //name of the special property that the plugin should intercept/manage this.overwriteProps = []; //will be populated in init() _props = []; } /** @private **/ override public function onInitTween(target:Object, value:*, tween:TweenLite):Boolean { _target = tween.target; var params:Object = value.params || {}; _lastFactor = 0; for (var p:String in value) { if (p != "params") { _props[_props.length] = new DynamicProperty(p, value[p] as Function, params[p]); this.overwriteProps[this.overwriteProps.length] = p; } } return true; } /** @private **/ override public function killProps(lookup:Object):void { var i:int = _props.length; while (i--) { if (_props[i].name in lookup) { _props.splice(i, 1); } } super.killProps(lookup); } /** @private **/ override public function set changeFactor(n:Number):void { if (n != _lastFactor) { var i:int = _props.length, prop:DynamicProperty, end:Number; var ratio:Number = (n == 1 || _lastFactor == 1) ? 0 : 1 - ((n - _lastFactor) / (1 - _lastFactor)); while (i--) { prop = _props[i]; end = (prop.params) ? prop.getter.apply(null, prop.params) : prop.getter(); _target[prop.name] = end - ((end - _target[prop.name]) * ratio); } _lastFactor = n; } } } } internal class DynamicProperty { public var name:String; public var getter:Function; public var params:Array; public function DynamicProperty(name:String, getter:Function, params:Array) { this.name = name; this.getter = getter; this.params = params; } }
// A simple 'HelloWorld' GUI created purely from code. // This sample demonstrates: // - Creation of controls and building a UI hierarchy // - Loading UI style from XML and applying it to controls // - Handling of global and per-control events #include "Scripts/Utilities/Sample.as" Window@ window; void Start() { // Execute the common startup for samples SampleStart(); // Enable OS cursor input.mouseVisible = true; // Load XML file containing default UI style sheet XMLFile@ style = cache.GetResource("XMLFile", "UI/DefaultStyle.xml"); // Set the loaded style as default style ui.root.defaultStyle = style; // Initialize Window InitWindow(); // Create and add some controls to the Window InitControls(); SubscribeToEvents(); } void InitControls() { // Create a CheckBox CheckBox@ checkBox = CheckBox(); checkBox.name = "CheckBox"; // Create a Button Button@ button = Button(); button.name = "Button"; button.minHeight = 24; // Create a LineEdit LineEdit@ lineEdit = LineEdit(); lineEdit.name = "LineEdit"; lineEdit.minHeight = 24; // Add controls to Window window.AddChild(checkBox); window.AddChild(button); window.AddChild(lineEdit); // Apply previously set default style checkBox.SetStyleAuto(); button.SetStyleAuto(); lineEdit.SetStyleAuto(); } void InitWindow() { // Create the Window and add it to the UI's root node window = Window(); ui.root.AddChild(window); // Set Window size and layout settings window.SetMinSize(384, 192); window.SetLayout(LM_VERTICAL, 6, IntRect(6, 6, 6, 6)); window.SetAlignment(HA_CENTER, VA_CENTER); window.name = "Window"; // Create Window 'titlebar' container UIElement@ titleBar = UIElement(); titleBar.SetMinSize(0, 24); titleBar.verticalAlignment = VA_TOP; titleBar.layoutMode = LM_HORIZONTAL; // Create the Window title Text Text@ windowTitle = Text(); windowTitle.name = "WindowTitle"; windowTitle.text = "Hello GUI!"; // Create the Window's close button Button@ buttonClose = Button(); buttonClose.name = "CloseButton"; // Add the controls to the title bar titleBar.AddChild(windowTitle); titleBar.AddChild(buttonClose); // Add the title bar to the Window window.AddChild(titleBar); // Apply styles window.SetStyleAuto(); windowTitle.SetStyleAuto(); buttonClose.style = "CloseButton"; // Lastly, subscribe to buttonClose release (following a 'press') events SubscribeToEvent(buttonClose, "Released", "HandleClosePressed"); } void SubscribeToEvents() { // Subscribe handler; invoked whenever a mouse click event is dispatched SubscribeToEvent("UIMouseClick", "HandleControlClicked"); } void HandleClosePressed(StringHash eventType, VariantMap& eventData) { engine.Exit(); } void HandleControlClicked(StringHash eventType, VariantMap& eventData) { // Get the Text control acting as the Window's title Text@ windowTitle = window.GetChild("WindowTitle", true); // Get control that was clicked // Note difference to C++: in C++ we would call GetPtr() and cast the void pointer to UIElement, here we must specify // what kind of object we are getting. Null will be returned on type mismatch UIElement@ clicked = eventData["Element"].GetUIElement(); String name = "...?"; if (clicked !is null) { // Get the name of the control that was clicked name = clicked.name; } // Update the Window's title text windowTitle.text = "Hello " + name + "!"; }
package command { import org.puremvc.as3.interfaces.INotification; import org.puremvc.as3.patterns.command.SimpleCommand; import proxy.SocketProxy; public class SocketSimpleCommand extends SimpleCommand { public function SocketSimpleCommand() { super(); } override public function execute(notification:INotification):void { var pro:SocketProxy = facade.retrieveProxy(SocketProxy.NAME) as SocketProxy; pro.connect(); } } }
package { import flash.display.Graphics; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Sprite; import com.foxarc.images.BitmapEncoder; public class Background extends Sprite { private var bit:Bitmap; public function Background():void { } internal function draw():void { if (bit && bit.stage) removeChild(bit); graphics.clear(); if (!Local.D.d[12]) { graphics.beginFill(Local.D.d[6]); graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); graphics.endFill(); } else { var bd:BitmapData = BitmapEncoder.decodeBase64(Local.D.d[0]); bit = new Bitmap(bd); addChild(bit); } x = stage.stageWidth * .5 - width * .5; y = stage.stageHeight * .5 - height * .5; } } }
/** * VERSION: 1.02 * DATE: 10/2/2009 * ACTIONSCRIPT VERSION: 3.0 * UPDATES AND DOCUMENTATION AT: http://www.TweenMax.com **/ package com.greensock.plugins { import com.greensock.*; /** * Some components require resizing with setActualSize() instead of standard tweens of width/height in * order to scale properly. The SetActualSizePlugin accommodates this easily. You can define the width, * height, or both. <br /><br /> * * <b>USAGE:</b><br /><br /> * <code> * import com.greensock.TweenLite; <br /> * import com.greensock.plugins.TweenPlugin; <br /> * import com.greensock.plugins.SetActualSizePlugin; <br /> * TweenPlugin.activate([SetActualSizePlugin]); //activation is permanent in the SWF, so this line only needs to be run once.<br /><br /> * * TweenLite.to(myComponent, 1, {setActualSize:{width:200, height:30}});<br /><br /> * </code> * * <b>Copyright 2011, GreenSock. All rights reserved.</b> This work is subject to the terms in <a href="http://www.greensock.com/terms_of_use.html">http://www.greensock.com/terms_of_use.html</a> or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. * * @author Jack Doyle, jack@greensock.com */ public class SetActualSizePlugin extends TweenPlugin { /** @private **/ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility /** @private **/ public var width:Number; /** @private **/ public var height:Number; /** @private **/ protected var _target:Object; /** @private **/ protected var _setWidth:Boolean; /** @private **/ protected var _setHeight:Boolean; /** @private **/ protected var _hasSetSize:Boolean; /** @private **/ public function SetActualSizePlugin() { super(); this.propName = "setActualSize"; this.overwriteProps = ["setActualSize","setSize","width","height","scaleX","scaleY"]; this.round = true; } /** @private **/ override public function onInitTween(target:Object, value:*, tween:TweenLite):Boolean { _target = target; _hasSetSize = Boolean("setActualSize" in _target); if ("width" in value && _target.width != value.width) { addTween((_hasSetSize) ? this : _target, "width", _target.width, value.width, "width"); _setWidth = _hasSetSize; } if ("height" in value && _target.height != value.height) { addTween((_hasSetSize) ? this : _target, "height", _target.height, value.height, "height"); _setHeight = _hasSetSize; } if (_tweens.length == 0) { //protects against occassions when the tween's start and end values are the same. In that case, the _tweens Array will be empty. _hasSetSize = false; } return true; } /** @private **/ override public function killProps(lookup:Object):void { super.killProps(lookup); if (_tweens.length == 0 || "setActualSize" in lookup) { this.overwriteProps = []; } } /** @private **/ override public function set changeFactor(n:Number):void { updateTweens(n); if (_hasSetSize) { _target.setActualSize((_setWidth) ? this.width : _target.width, (_setHeight) ? this.height : _target.height); } } } }
package entityExpress.core { public class Component { public function Component() { } } }
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.SymbolUiButtonDefaultGeneric; import visuals.ui.elements.backgrounds.SymbolBackgroundScalableGeneric; import visuals.ui.elements.backgrounds.SymbolSlice9BackgroundDialogGeneric; import visuals.ui.elements.bonus.SymbolBonusInfoGeneric; public class SymbolDialogBonusInfoNotificationGeneric extends Sprite { private var _nativeObject:SymbolDialogBonusInfoNotification = null; public var dialogBackground:SymbolSlice9BackgroundDialogGeneric = null; public var txtDialogTitle:ILabel = null; public var txtInfo:ILabelArea = null; public var bonusBackground:SymbolBackgroundScalableGeneric = null; public var txtBonusCaption:ILabel = null; public var txtBonusInfo:ILabelArea = null; public var position5:SymbolBonusInfoGeneric = null; public var position4:SymbolBonusInfoGeneric = null; public var position3:SymbolBonusInfoGeneric = null; public var position2:SymbolBonusInfoGeneric = null; public var position1:SymbolBonusInfoGeneric = null; public var position6:SymbolBonusInfoGeneric = null; public var position7:SymbolBonusInfoGeneric = null; public var btnOk:SymbolUiButtonDefaultGeneric = null; public function SymbolDialogBonusInfoNotificationGeneric(param1:MovieClip = null) { if(param1) { _nativeObject = param1 as SymbolDialogBonusInfoNotification; } else { _nativeObject = new SymbolDialogBonusInfoNotification(); } super(null,FlashSprite.fromNative(_nativeObject)); var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer; dialogBackground = new SymbolSlice9BackgroundDialogGeneric(_nativeObject.dialogBackground); txtDialogTitle = FlashLabel.fromNative(_nativeObject.txtDialogTitle); txtInfo = FlashLabelArea.fromNative(_nativeObject.txtInfo); bonusBackground = new SymbolBackgroundScalableGeneric(_nativeObject.bonusBackground); txtBonusCaption = FlashLabel.fromNative(_nativeObject.txtBonusCaption); txtBonusInfo = FlashLabelArea.fromNative(_nativeObject.txtBonusInfo); position5 = new SymbolBonusInfoGeneric(_nativeObject.position5); position4 = new SymbolBonusInfoGeneric(_nativeObject.position4); position3 = new SymbolBonusInfoGeneric(_nativeObject.position3); position2 = new SymbolBonusInfoGeneric(_nativeObject.position2); position1 = new SymbolBonusInfoGeneric(_nativeObject.position1); position6 = new SymbolBonusInfoGeneric(_nativeObject.position6); position7 = new SymbolBonusInfoGeneric(_nativeObject.position7); btnOk = new SymbolUiButtonDefaultGeneric(_nativeObject.btnOk); } public function setNativeInstance(param1:SymbolDialogBonusInfoNotification) : void { FlashSprite.setNativeInstance(_sprite,param1); _nativeObject = param1; syncInstances(); } public function syncInstances() : void { if(_nativeObject.dialogBackground) { dialogBackground.setNativeInstance(_nativeObject.dialogBackground); } FlashLabel.setNativeInstance(txtDialogTitle,_nativeObject.txtDialogTitle); FlashLabelArea.setNativeInstance(txtInfo,_nativeObject.txtInfo); if(_nativeObject.bonusBackground) { bonusBackground.setNativeInstance(_nativeObject.bonusBackground); } FlashLabel.setNativeInstance(txtBonusCaption,_nativeObject.txtBonusCaption); FlashLabelArea.setNativeInstance(txtBonusInfo,_nativeObject.txtBonusInfo); if(_nativeObject.position5) { position5.setNativeInstance(_nativeObject.position5); } if(_nativeObject.position4) { position4.setNativeInstance(_nativeObject.position4); } if(_nativeObject.position3) { position3.setNativeInstance(_nativeObject.position3); } if(_nativeObject.position2) { position2.setNativeInstance(_nativeObject.position2); } if(_nativeObject.position1) { position1.setNativeInstance(_nativeObject.position1); } if(_nativeObject.position6) { position6.setNativeInstance(_nativeObject.position6); } if(_nativeObject.position7) { position7.setNativeInstance(_nativeObject.position7); } if(_nativeObject.btnOk) { btnOk.setNativeInstance(_nativeObject.btnOk); } } } }
package hansune.media { import flash.errors.IllegalOperationError; import flash.events.ErrorEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.IEventDispatcher; /** * build 가 완료되었을 때 */ [Event(name="complete", type="flash.events.Event")] /** * 각종 에러 */ [Event(name="error", type="flash.events.ErrorEvent")] /** *SuperSound 는 BGSound 와 EffectSound 를 통합하여 쓰기 편하게 만듦. * @author hansoo * */ public class SuperSound extends EventDispatcher { private static var ins:SuperSound; private static var instance:SuperSound; private var effectSound:EffectSound; private var bgmSound:Vector.<BGSound>; private var bgmItems:Vector.<SuperSoundItem>; private var effectItems:Vector.<SuperSoundItem>; public function SuperSound(tt:TT) { super(); bgmItems = new Vector.<SuperSoundItem>(); effectItems = new Vector.<SuperSoundItem>(); bgmSound = new Vector.<BGSound>(); effectSound = new EffectSound(); } private static function buildInstance():void { if(instance == null) { instance = new SuperSound(new TT()); } } /** * 배경 음악 파일을 Que에 등록한다. * @param bgm * @return * */ public static function addBGMQue(bgm:SuperSoundItem):uint { buildInstance(); return instance.bgmItems.push(bgm); } /** * 효과 음악 파일을 Que에 등록한다. * @param effect * @return * */ public static function addEffectQue(effect:SuperSoundItem):uint { buildInstance(); return instance.effectItems.push(effect); } /** * Que 등록되어 있는 SuperSoundItem 들을 로드한다.<br/> * build 를 실행해야 사용할 수 있다. * @return * */ public static function build():SuperSound { buildInstance(); instance.build(); return instance; } /** * 등록된 데이터를 해제한다. * @return * */ public static function release():SuperSound { if(instance == null) return null; instance.release(); return instance; } /** * SuperSound 내부 객체에 addEventListener 한다. * @param type * @param listener * @param useCapture * @param priority * @param useWeakReference * */ public static function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void { instance.addEventListener(type, listener, useCapture, priority, useWeakReference); } /** * SuperSound 내부 객체에 removeEventListener 한다. * @param type * @param listener * @param useCapture * */ public static function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void { instance.removeEventListener(type, listener, useCapture); } private function build():void { var i:int = 0; for(i=0; i<bgmItems.length; i++){ bgmSound.push(new BGSound(bgmItems[i].sourceUrl, bgmItems[i].isLoop)); } for(i=0; i<effectItems.length; i++){ effectSound.addQue(effectItems[i].sourceUrl, effectItems[i].name); } effectSound.addEventListener(Event.COMPLETE, onLoad); effectSound.addEventListener(ErrorEvent.ERROR, onError); effectSound.runQue(); if(effectItems.length == 0) { dispatchEvent(new Event(Event.COMPLETE)); } trace("build"); } private function onLoad(e:Event):void { dispatchEvent(new Event(Event.COMPLETE)); } private function onError(e:ErrorEvent):void { dispatchEvent(new ErrorEvent(e.type, e.bubbles, e.cancelable, "can't load effect sound file")); } private function release():void { var i:int = 0; var ll:int = bgmItems.length; for(i=0; i<ll; i++){ bgmSound[i].off(); } for(i=0; i<ll; i++){ bgmSound.pop(); } effectSound.dispose(); } /** * 이펙트 효과음 플레이 * @param name * */ public static function effect(name:String):EffectSound { if(instance == null) { throw new IllegalOperationError("build 명령어를 먼저 수행해야 합니다."); } instance.effectSound.name = name; return instance.effectSound; } /** * 백그라운 음악 * @param name * @return BGSound * */ public static function bgm(name:String):BGSound { var bgmSound:BGSound = null; for(var i:int=0; i< instance.bgmItems.length; i++){ if(instance.bgmItems[i].name == name){ bgmSound = instance.bgmSound[i]; break; } } return bgmSound; } } } internal class TT { public function TT(){} }
package metadata { import dataTypes.spatialGeometry.SG_Rectangle; import dataTypes.temporalGeometry.TG_Period; import flash.filesystem.File; import instanceModel.Kit; import mx.collections.ArrayList; public class Metadata { public var title:String; public var kitURL:String; public var overview:String; public var keywords:ArrayList; public var responsibleParty:String; public var publicationDate:Date; public var geographicExtent:SG_Rectangle; //public var temporalExtent:TemporalExtent; public function Metadata() { keywords = new ArrayList(); geographicExtent = new SG_Rectangle(); //temporalExtent = new TemporalExtent(); } public function getXML():XML { var str:String = '<?xml version=“1.1” encoding="UTF-8"?>'; str += '<Metadata '; str += 'title="' + this.title + '" ' + 'overview="' + this.overview + '" ' + 'keywords="' var m:int = keywords.length; for (var i:int = 0; i < m; i++) { var key:String = this.keywords.getItemAt(i) as String; str += key + ','; } str = str.substr(0, str.length - 1) + '" '; str += 'responsibleParty="' + this.responsibleParty + '" ' + 'publicationDate="' + this.publicationDate.getTime() + '" ' + 'kitURL="' + this.kitURL + '">'; str += '<geographicExtent>'; str += this.geographicExtent.getXML().toXMLString(); str += '</geographicExtent>'; /* str += '<temporalExtent>'; str += this.temporalExtent.getXML().toXMLString(); str += '</temporalExtent>'; */ str += '</Metadata>'; return XML(str); } public function setXML(_xml:XML):void { this.title = _xml.@title.toString(); this.overview = _xml.@overview.toString(); this.keywords = new ArrayList(); var str:String = _xml.@keywords.toString(); if (str != "") { var strArray:Array = str.split(','); var m:int = strArray.length; for (var i:int = 0; i < m; i++) { keywords.addItem(strArray[i] as String); } } this.responsibleParty = _xml.@responsibleParty.toString(); this.publicationDate = new Date(Number(_xml.@publicationDate)); this.kitURL = _xml.@kitURL.toString(); var strXMLList:XMLList = _xml.geographicExtent.children(); this.geographicExtent.setXML(strXMLList[0]); /* strXMLList = _xml.temporalExtent.children(); this.temporalExtent.setXML(strXMLList[0]); */ } } }
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2008-2009 Vincent Petithory - http://blog.lunar-dev.net/ // // 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 stdpx.blendmodes { import stdpx.types.ShaderMetadata; import stdpx.types.IMetadataAttachedShader; import stdpx.types.IShader; import flash.display.Shader; public class BlendModeDifference extends Shader implements IMetadataAttachedShader, IShader { [Embed(source="BlendModeDifference.pbj", mimeType="application/octet-stream")] private static var ShaderByteCode:Class; include "../types/metadata.as"; public function BlendModeDifference() { super(); this.byteCode = new ShaderByteCode(); } /** * @inheritDoc */ public function clone():Shader { return new BlendModeDifference(); } /** * @inheritDoc */ public function valueOf():Shader { return this; } /** * @inheritDoc */ public function toString():String { return "[BlendMode Difference]"; } } }
/* The MIT License Copyright (c) 2010 Jackson Dunstan 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 { import asunit4.ui.*; [SWF(width='640', height='480', backgroundColor='#D3D3D3', frameRate='30')] public class TestCorrectness extends MinimalRunnerUI { public function TestCorrectness() { run(AllTests); } } }
package kabam.rotmg.errors.view { import flash.display.DisplayObjectContainer; import flash.display.LoaderInfo; import flash.events.ErrorEvent; import flash.events.IEventDispatcher; import kabam.rotmg.errors.control.ErrorSignal; import robotlegs.bender.bundles.mvcs.Mediator; import robotlegs.bender.framework.api.ILogger; public class ErrorMediator extends Mediator { private const UNCAUGHT_ERROR_EVENTS:String = "uncaughtErrorEvents"; private const UNCAUGHT_ERROR:String = "uncaughtError"; public function ErrorMediator() { super(); } [Inject] public var contextView:DisplayObjectContainer; [Inject] public var error:ErrorSignal; [Inject] public var logger:ILogger; private var loaderInfo:LoaderInfo; override public function initialize():void { this.loaderInfo = this.contextView.loaderInfo; if (this.canCatchGlobalErrors()) { this.addGlobalErrorListener(); } } override public function destroy():void { if (this.canCatchGlobalErrors()) { this.removeGlobalErrorListener(); } } private function canCatchGlobalErrors():Boolean { return "uncaughtErrorEvents" in this.loaderInfo; } private function addGlobalErrorListener():void { var _local1:IEventDispatcher = IEventDispatcher(this.loaderInfo["uncaughtErrorEvents"]); _local1.addEventListener("uncaughtError", this.handleUncaughtError); } private function removeGlobalErrorListener():void { var _local1:IEventDispatcher = IEventDispatcher(this.loaderInfo["uncaughtErrorEvents"]); _local1.removeEventListener("uncaughtError", this.handleUncaughtError); } private function handleUncaughtError(_arg_1:ErrorEvent):void { this.error.dispatch(_arg_1); } } }
// 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/. class foo{ // infinite recursion calling setter from setter and back again // fix make sure you do handle stack overflow private var _inf; private var _inf2; public function get inf(){ return inf2; } public function get inf2(){ return inf; } } var OBJ = new foo(); OBJ.inf; // should cause infinite recursion
package org.ranapat.resourceloader { import flash.sampler.getSavedThis; import flash.utils.describeType; import flash.utils.getDefinitionByName; import flash.utils.getQualifiedClassName; internal final class Tools { public static function ensureAbstractClass(instance:Object, _class:Class):void { var className:String = getQualifiedClassName(instance); if (getDefinitionByName(className) == _class) { throw new Error(getQualifiedClassName(_class) + " Class can not be instantiated directly."); } } } }
package com.hypixel.objects { public class hypixelQuest extends Object { private var nameQuest: String; private var data: Object = {}; public function hypixelQuest(name: String, data: Object): void { this.nameQuest = name; this.data = data; } public function name(): String { return this.nameQuest; } public function completions(): Array { return data['completions']; } public function active(): Object { return data['active']; } } }
read a read b load a load b add print
package io.decagames.rotmg.utils.colors { import flash.display.BitmapData; import flash.display.DisplayObject; import flash.filters.ColorMatrixFilter; import flash.geom.Point; import flash.geom.Rectangle; public class GreyScale { public static function setGreyScale(param1:BitmapData):BitmapData { var _loc2_:* = [0.2225, 0.7169, 0.0606, 0, 0, 0.2225, 0.7169, 0.0606, 0, 0, 0.2225, 0.7169, 0.0606, 0, 0, 0, 0, 0, 1, 0]; var _loc3_:ColorMatrixFilter = new ColorMatrixFilter(_loc2_); param1.applyFilter(param1, new Rectangle(0, 0, param1.width, param1.height), new Point(0, 0), _loc3_); return param1; } public static function greyScaleToDisplayObject(param1:DisplayObject, param2:Boolean):void { var _loc4_:* = [0.2225, 0.7169, 0.0606, 0, 0, 0.2225, 0.7169, 0.0606, 0, 0, 0.2225, 0.7169, 0.0606, 0, 0, 0, 0, 0, 1, 0]; var _loc3_:ColorMatrixFilter = new ColorMatrixFilter(_loc4_); if (param2) { param1.filters = [_loc3_]; } else { param1.filters = []; } } public function GreyScale() { super(); } } }
/* * This file is part of Flowplayer, http://flowplayer.org * * By: Daniel Rossi, <electroteque@gmail.com>, Anssi Piirainen Flowplayer Oy * Copyright (c) 2009 Electroteque Multimedia, Flowplayer Oy * * Released under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ package org.flowplayer.youtube { /** * @author api */ public class Config { private var _apiPlayerURL:String = "http://www.youtube.com/apiplayer?version=3"; private var _gdataApiURL:String = "http://gdata.youtube.com/feeds/api/videos/"; private var _gdataApiVersion:String = "2"; private var _gdataApiFormat:String = "5"; private var _defaultQuality:String = "default"; private var _enableGdata:Boolean = false; private var _bitratesOnStart:Boolean = false; private var _videoFormats:Object = { 'small': {fmt: "5", label: "FLV Lowest Quality", shortlabel: "FLV", vq: 1, fmt_map: "", type: "video/x-flv", qid: 1, width: 320, height: 240, bitrate: 64}, //'18': {fmt: "18", label: "MP4 480x270p 18", shortlabel: "18", vq: 2, fmt_map: "18/512000/9/0/115", type: "video/mp4", qid: 2, width: 480, height: 270, bitrate: 512}, 'medium': {fmt: "34", label: "FLV 640x360p 34", shortlabel: "34", vq: 2, fmt_map: "34/512000/9/0/115", type: "video/x-flv", qid: 3, width: 640, height: 360, bitrate: 512}, 'large': {fmt: "35", label: "FLV 854x480p 35", shortlabel: "35", vq: 2, fmt_map: "35/640000/9/0/115", type: "video/x-flv", qid: 4, width: 854, height: 480, bitrate: 640}, 'hd720': {fmt: "22", label: "MP4 1280x720p 22", shortlabel: "22", vq: 2, fmt_map: "22/2000000/9/0/115", type: "video/mp4", qid: 5, width: 1280, height: 720, bitrate: 20000}, 'hd1080': {fmt: "37", label: "MP4 Highest Quality 1920x1080p 37", shortlabel: "37", vq: 2, fmt_map: "37/4000000/9/0/115", type: "video/mp4", qid: 6, width: 1920, height: 1080, bitrate: 40000} }; public function get enableGdata():Boolean { return _enableGdata; } public function set enableGdata(enable:Boolean):void { _enableGdata = enable; } public function get apiPlayerURL():String { return _apiPlayerURL; } public function set apiPlayerURL(url:String):void { _apiPlayerURL = url; } public function get gdataApiURL():String { return _gdataApiURL; } public function set gdataApiURL(url:String):void { _gdataApiURL = url; } public function get gdataApiVersion():String { return _gdataApiVersion; } public function set gdataApiVersion(version:String):void { _gdataApiVersion = version; } public function get gdataApiFormat():String { return _gdataApiFormat; } public function set gdataApiFormat(url:String):void { _gdataApiFormat = url; } public function get defaultQuality():String { return _defaultQuality; } public function set defaultQuality(quality:String):void { _defaultQuality = quality; } public function get videoFormats():Object { return _videoFormats; } public function get bitratesOnStart():Boolean { return _bitratesOnStart; } public function set bitratesOnStart(enable:Boolean):void { _bitratesOnStart = enable; } } }
package com.company.assembleegameclient.objects.particles { import com.company.assembleegameclient.objects.GameObject; import com.company.assembleegameclient.util.RandomUtil; public class GasEffect extends ParticleEffect { public var go_:GameObject; public var props:EffectProperties; public var color_:int; public var rate:Number; public var type:String; public function GasEffect(param1:GameObject, param2:EffectProperties) { super(); this.go_ = param1; this.color_ = param2.color; this.rate = param2.rate; this.props = param2; } override public function update(param1:int, param2:int) : Boolean { var _local7:Number = NaN; var _local4:Number = NaN; var _local5:Number = NaN; var _local8:Number = NaN; var _local10:Number = NaN; var _local9:* = null; if(this.go_.map_ == null) { return false; } x_ = this.go_.x_; y_ = this.go_.y_; var _local3:int = 20; var _local6:int = 0; while(_local6 < this.rate) { _local7 = (Math.random() + 0.3) * 200; _local4 = Math.random(); _local5 = RandomUtil.plusMinus(this.props.speed - this.props.speed * (_local4 * (1 - this.props.speedVariance))); _local8 = RandomUtil.plusMinus(this.props.speed - this.props.speed * (_local4 * (1 - this.props.speedVariance))); _local10 = this.props.life * 1000 - this.props.life * 1000 * (_local4 * this.props.lifeVariance); _local9 = new GasParticle(_local7,this.color_,_local10,this.props.spread,0.75,_local5,_local8); map_.addObj(_local9,x_,y_); _local6++; } return true; } } }
package com.ankamagames.atouin.messages { import com.ankamagames.jerakine.messages.Message; public class MapContainerRollOverMessage implements Message { public function MapContainerRollOverMessage() { super(); } } }
; AMD64 mpn_and_n ; Copyright 2009 Jason Moxham ; This file is part of the MPIR Library. ; The MPIR Library is free software; you can redistribute it and/or modify ; it under the terms of the GNU Lesser General Public License as published ; by the Free Software Foundation; either version 2.1 of the License, or (at ; your option) any later version. ; The MPIR Library is distributed in the hope that it will be useful, but ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public ; License for more details. ; You should have received a copy of the GNU Lesser General Public License ; along with the MPIR Library; see the file COPYING.LIB. If not, write ; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ; Boston, MA 02110-1301, USA. ; (rdi, rcx) = (rsi, rcx) & (rdx, rcx) %include 'yasm_mac.inc' BITS 64 GLOBAL_FUNC mpn_and_n mov rax, rcx and rax, 3 shr rcx, 2 jz skiploop align 8 loop1: mov r11, [rsi] mov r8, [rsi+8] lea rsi, [rsi+32] and r11, [rdx] and r8, [rdx+8] lea rdx, [rdx+32] mov [rdi], r11 mov [rdi+8], r8 lea rdi, [rdi+32] mov r9, [rsi-16] mov r10, [rsi-8] and r9, [rdx-16] and r10, [rdx-8] mov [rdi-16], r9 dec rcx mov [rdi-8], r10 jnz loop1 skiploop: inc rax dec rax jz end mov r11, [rsi] and r11, [rdx] mov [rdi], r11 dec rax jz end mov r11, [rsi+8] and r11, [rdx+8] mov [rdi+8], r11 dec rax jz end mov r11, [rsi+16] and r11, [rdx+16] mov [rdi+16], r11 end: ret
package { import flash.display.Sprite; import flash.events.Event; import starling.core.Starling; [SWF(width="1024", height="768", frameRate="60", backgroundColor="#000000")] public class Main extends Sprite { private var _starling:Starling; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point _starling = new Starling(NaturalSplineExample, stage); stage.color = 0x00000000; _starling.antiAliasing = 1; _starling.start(); } } }
/** * VERSION: 1.12 * DATE: 10/2/2009 * ACTIONSCRIPT VERSION: 3.0 * UPDATES AND DOCUMENTATION AT: http://www.TweenMax.com **/ package com.greensock.plugins { import com.greensock.*; /** * Identical to bezier except that instead of defining bezier control point values, you * define points through which the bezier values should move. This can be more intuitive * than using control points. Simply pass as many objects in the bezier Array as you'd like, * one for each point through which the values should travel. For example, if you want the * curved motion path to travel through the coordinates x:250, y:100 and x:50, y:200 and then * end up at 500, 100, you'd do: <br /><br /> * * <code>TweenLite.to(mc, 2, {bezierThrough:[{x:250, y:100}, {x:50, y:200}, {x:500, y:200}]});</code><br /><br /> * * Keep in mind that you can bezierThrough tween ANY properties, not just x/y. <br /><br /> * * Also, if you'd like to rotate the target in the direction of the bezier path, * use the orientToBezier special property. In order to alter a rotation property accurately, * TweenLite/Max needs 5 pieces of information: * <ol> * <li> Position property 1 (typically <code>"x"</code>)</li> * <li> Position property 2 (typically <code>"y"</code>)</li> * <li> Rotational property (typically <code>"rotation"</code>)</li> * <li> Number of degrees to add (optional - makes it easy to orient your MovieClip properly)</li> * <li> Tolerance (default is 0.01, but increase this if the rotation seems to jitter during the tween)</li> * </ol><br /> * * The orientToBezier property should be an Array containing one Array for each set of these values. * For maximum flexibility, you can pass in any number of arrays inside the container array, one * for each rotational property. This can be convenient when working in 3D because you can rotate * on multiple axis. If you're doing a standard 2D x/y tween on a bezier, you can simply pass * in a boolean value of true and TweenLite/Max will use a typical setup, <code>[["x", "y", "rotation", 0, 0.01]]</code>. * Hint: Don't forget the container Array (notice the double outer brackets) <br /><br /> * * <b>USAGE:</b><br /><br /> * <code> * import com.greensock.TweenLite; <br /> * import com.greensock.plugins.TweenPlugin; <br /> * import com.greensock.plugins.BezierThroughPlugin; <br /> * TweenPlugin.activate([BezierThroughPlugin]); // activation is permanent in the SWF, so this line only needs to be run once.<br /><br /> * * TweenLite.to(mc, 2, {bezierThrough:[{x:250, y:100}, {x:50, y:200}, {x:500, y:200}]}); <br /><br /> * </code> * * <b>Copyright 2010, GreenSock. All rights reserved.</b> This work is subject to the terms in <a href="http://www.greensock.com/terms_of_use.html">http://www.greensock.com/terms_of_use.html</a> or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. * * @author Jack Doyle, jack@greensock.com */ public class BezierThroughPlugin extends BezierPlugin { /** @private **/ public static const API : Number = 1.0; // If the API/Framework for plugins changes in the future, this number helps determine compatibility /** @private **/ public function BezierThroughPlugin() { super(); this.propName = "bezierThrough"; // name of the special property that the plugin should intercept/manage } /** @private **/ override public function onInitTween(target : Object, value : *, tween : TweenLite) : Boolean { if (!(value is Array)) { return false; } init(tween, value as Array, true); return true; } } }
/* Feathers Copyright 2012-2021 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.controls.renderers.IListItemRenderer; import feathers.core.IValidating; import feathers.data.IListCollection; import feathers.events.FeathersEventType; import feathers.layout.HorizontalAlign; import feathers.layout.ILayout; import feathers.layout.ISpinnerLayout; import feathers.layout.VerticalSpinnerLayout; import feathers.skins.IStyleProvider; import flash.events.KeyboardEvent; import flash.events.TransformGestureEvent; import flash.geom.Rectangle; import flash.ui.Keyboard; import starling.display.DisplayObject; import starling.events.Event; /** * Determines if the <code>selectionOverlaySkin</code> is hidden when * the list is not focused. * * <listing version="3.0"> * list.hideSelectionOverlayUnlessFocused = true;</listing> * * <p>Note: If the <code>showSelectionOverlay</code> property is * <code>false</code>, the <code>selectionOverlaySkin</code> will always * be hidden.</p> * * @default false * * @see #style:selectionOverlaySkin * @see #style:showSelectionOverlay */ [Style(name="hideSelectionOverlayUnlessFocused",type="Boolean")] /** * An optional skin to display in the horizontal or vertical center of * the list to highlight the currently selected item. If the list * scrolls vertically, the <code>selectionOverlaySkin</code> will fill * the entire width of the list, and it will be positioned in the * vertical center. If the list scrolls horizontally, the * <code>selectionOverlaySkin</code> will fill the entire height of the * list, and it will be positioned in the horizontal center. * * <p>The following example gives the spinner list a selection overlay * skin:</p> * * <listing version="3.0"> * list.selectionOverlaySkin = new Image( texture );</listing> * * @default null */ [Style(name="selectionOverlaySkin",type="starling.display.DisplayObject")] /** * Determines if the <code>selectionOverlaySkin</code> is visible or hidden. * * <p>The following example hides the selection overlay skin:</p> * * <listing version="3.0"> * list.showSelectionOverlay = false;</listing> * * @default true * * @see #style:selectionOverlaySkin * @see #style:hideSelectionOverlayUnlessFocused */ [Style(name="showSelectionOverlay",type="Boolean")] /** * A customized <code>List</code> component where scrolling updates the * the selected item. Layouts may loop infinitely. * * <p>The following example creates a list, gives it a data provider, tells * the item renderer how to interpret the data, and listens for when the * selection changes:</p> * * <listing version="3.0"> * var list:SpinnerList = new SpinnerList(); * * list.dataProvider = new ArrayCollection( * [ * { text: "Milk", thumbnail: textureAtlas.getTexture( "milk" ) }, * { text: "Eggs", thumbnail: textureAtlas.getTexture( "eggs" ) }, * { text: "Bread", thumbnail: textureAtlas.getTexture( "bread" ) }, * { text: "Chicken", thumbnail: textureAtlas.getTexture( "chicken" ) }, * ]); * * list.itemRendererFactory = function():IListItemRenderer * { * var renderer:DefaultListItemRenderer = new DefaultListItemRenderer(); * renderer.labelField = "text"; * renderer.iconSourceField = "thumbnail"; * return renderer; * }; * * list.addEventListener( Event.CHANGE, list_changeHandler ); * * this.addChild( list );</listing> * * @see ../../../help/spinner-list.html How to use the Feathers SpinnerList component * * @productversion Feathers 2.1.0 */ public class SpinnerList extends List { /** * The default <code>IStyleProvider</code> for all <code>SpinnerList</code> * components. * * @default null * @see feathers.core.FeathersControl#styleProvider */ public static var globalStyleProvider:IStyleProvider; /** * Constructor. */ public function SpinnerList() { super(); this._scrollBarDisplayMode = ScrollBarDisplayMode.NONE; this._snapToPages = true; this._snapOnComplete = true; this.decelerationRate = DecelerationRate.FAST; this.addEventListener(Event.TRIGGERED, spinnerList_triggeredHandler); this.addEventListener(FeathersEventType.SCROLL_COMPLETE, spinnerList_scrollCompleteHandler); } /** * @private */ override protected function get defaultStyleProvider():IStyleProvider { if(SpinnerList.globalStyleProvider) { return SpinnerList.globalStyleProvider; } return List.globalStyleProvider; } /** * <code>SpinnerList</code> requires that the <code>snapToPages</code> * property is set to <code>true</code>. Attempts to set it to * <code>false</code> will result in a runtime error. * * @throws ArgumentError SpinnerList requires snapToPages to be true. */ override public function set snapToPages(value:Boolean):void { if(!value) { throw new ArgumentError("SpinnerList requires snapToPages to be true."); } super.snapToPages = value; } /** * <code>SpinnerList</code> requires that the <code>allowMultipleSelection</code> * property is set to <code>false</code>. Attempts to set it to * <code>true</code> will result in a runtime error. * * @throws ArgumentError SpinnerList requires allowMultipleSelection to be false. */ override public function set allowMultipleSelection(value:Boolean):void { if(value) { throw new ArgumentError("SpinnerList requires allowMultipleSelection to be false."); } super.allowMultipleSelection = value; } /** * <code>SpinnerList</code> requires that the <code>isSelectable</code> * property is set to <code>true</code>. Attempts to set it to * <code>false</code> will result in a runtime error. * * @throws ArgumentError SpinnerList requires isSelectable to be true. */ override public function set isSelectable(value:Boolean):void { if(!value) { throw new ArgumentError("SpinnerList requires isSelectable to be true."); } super.snapToPages = value; } /** * @private */ protected var _spinnerLayout:ISpinnerLayout; /** * @private */ override public function set layout(value:ILayout):void { if(value && !(value is ISpinnerLayout)) { throw new ArgumentError("SpinnerList requires layouts to implement the ISpinnerLayout interface."); } super.layout = value; this._spinnerLayout = ISpinnerLayout(value); } /** * @private */ override public function set selectedIndex(value:int):void { if(value < 0 && this._dataProvider !== null && this._dataProvider.length > 0) { //a SpinnerList must always select an item, unless the data //provider is empty return; } if(this._selectedIndex != value) { this.scrollToDisplayIndex(value, 0); } super.selectedIndex = value; } /** * @private */ override public function set selectedItem(value:Object):void { if(this._dataProvider === null) { this.selectedIndex = -1; return; } var index:int = this._dataProvider.getItemIndex(value); if(index < 0) { return; } this.selectedIndex = index; } /** * @private */ override public function set dataProvider(value:IListCollection):void { if(this._dataProvider == value) { return; } super.dataProvider = value; if(!this._dataProvider || this._dataProvider.length == 0) { this.selectedIndex = -1; } else { this.selectedIndex = 0; } } /** * @private */ protected var _selectionOverlaySkin:DisplayObject = null; /** * @private */ public function get selectionOverlaySkin():DisplayObject { return this._selectionOverlaySkin; } /** * @private */ public function set selectionOverlaySkin(value:DisplayObject):void { if(this.processStyleRestriction(arguments.callee)) { if(value !== null) { value.dispose(); } return; } if(this._selectionOverlaySkin === value) { return; } if(this._selectionOverlaySkin && this._selectionOverlaySkin.parent == this) { this.removeRawChildInternal(this._selectionOverlaySkin); } this._selectionOverlaySkin = value; if(this._selectionOverlaySkin) { this.addRawChildInternal(this._selectionOverlaySkin); } this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _showSelectionOverlay:Boolean = true; /** * @private */ public function get showSelectionOverlay():Boolean { return this._showSelectionOverlay; } /** * @private */ public function set showSelectionOverlay(value:Boolean):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._showSelectionOverlay === value) { return; } this._showSelectionOverlay = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _hideSelectionOverlayUnlessFocused:Boolean = false; /** * @private */ public function get hideSelectionOverlayUnlessFocused():Boolean { return this._hideSelectionOverlayUnlessFocused; } /** * @private */ public function set hideSelectionOverlayUnlessFocused(value:Boolean):void { if(this.processStyleRestriction(arguments.callee)) { return; } if(this._hideSelectionOverlayUnlessFocused === value) { return; } this._hideSelectionOverlayUnlessFocused = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ override protected function initialize():void { //SpinnerList has a different default layout than its superclass, //List, so set it before calling super.initialize() if(this._layout === null) { if(this._hasElasticEdges && this._verticalScrollPolicy === ScrollPolicy.AUTO && this._scrollBarDisplayMode !== ScrollBarDisplayMode.FIXED) { //so that the elastic edges work even when the max scroll //position is 0, similar to iOS. this._verticalScrollPolicy = ScrollPolicy.ON; } var layout:VerticalSpinnerLayout = new VerticalSpinnerLayout(); layout.useVirtualLayout = true; layout.padding = 0; layout.gap = 0; layout.horizontalAlign = HorizontalAlign.JUSTIFY; layout.requestedRowCount = 4; this.ignoreNextStyleRestriction(); this.layout = layout; } super.initialize(); } /** * @private */ override protected function refreshMinAndMaxScrollPositions():void { var oldActualPageWidth:Number = this.actualPageWidth; var oldActualPageHeight:Number = this.actualPageHeight; super.refreshMinAndMaxScrollPositions(); if(this._maxVerticalScrollPosition != this._minVerticalScrollPosition) { this.actualPageHeight = this._spinnerLayout.snapInterval; if(!this.isScrolling && this.pendingItemIndex == -1 && this.actualPageHeight != oldActualPageHeight) { //if the height of items have changed, we need to tweak the //scroll position to re-center the selected item. //we don't do this if the user is currently scrolling or if //the selected index has changed (which will set //pendingItemIndex). var verticalPageIndex:int = this.calculateNearestPageIndexForItem(this._selectedIndex, this._verticalPageIndex, this._maxVerticalPageIndex); this._verticalScrollPosition = this.actualPageHeight * verticalPageIndex; } } else if(this._maxHorizontalScrollPosition != this._minHorizontalScrollPosition) { this.actualPageWidth = this._spinnerLayout.snapInterval; if(!this.isScrolling && this.pendingItemIndex == -1 && this.actualPageWidth != oldActualPageWidth) { var horizontalPageIndex:int = this.calculateNearestPageIndexForItem(this._selectedIndex, this._horizontalPageIndex, this._maxHorizontalPageIndex); this._horizontalScrollPosition = this.actualPageWidth * horizontalPageIndex; } } } /** * @private */ override protected function handlePendingScroll():void { if(this.pendingItemIndex >= 0) { var itemIndex:int = this.pendingItemIndex; this.pendingItemIndex = -1; if(this._maxVerticalPageIndex != this._minVerticalPageIndex) { this.pendingVerticalPageIndex = this.calculateNearestPageIndexForItem(itemIndex, this._verticalPageIndex, this._maxVerticalPageIndex); this.hasPendingVerticalPageIndex = this.pendingVerticalPageIndex != this._verticalPageIndex; } else if(this._maxHorizontalPageIndex != this._minHorizontalPageIndex) { this.pendingHorizontalPageIndex = this.calculateNearestPageIndexForItem(itemIndex, this._horizontalPageIndex, this._maxHorizontalPageIndex); this.hasPendingHorizontalPageIndex = this.pendingHorizontalPageIndex != this._horizontalPageIndex; } } super.handlePendingScroll(); } /** * @private */ override protected function layoutChildren():void { super.layoutChildren(); if(this._selectionOverlaySkin !== null) { if(this._showSelectionOverlay && this._hideSelectionOverlayUnlessFocused && this._focusManager !== null && this._isFocusEnabled) { this._selectionOverlaySkin.visible = this._hasFocus; } else { this._selectionOverlaySkin.visible = this._showSelectionOverlay; } var selectionBounds:Rectangle = this._spinnerLayout.selectionBounds; this._selectionOverlaySkin.x = this._leftViewPortOffset + selectionBounds.x; this._selectionOverlaySkin.y = this._topViewPortOffset + selectionBounds.y; this._selectionOverlaySkin.width = selectionBounds.width; this._selectionOverlaySkin.height = selectionBounds.height; if(this._selectionOverlaySkin is IValidating) { IValidating(this._selectionOverlaySkin).validate(); } } } /** * @private */ protected function calculateNearestPageIndexForItem(itemIndex:int, currentPageIndex:int, maxPageIndex:int):int { if(maxPageIndex != int.MAX_VALUE) { return itemIndex; } var itemCount:int = this._dataProvider.length; var fullDataProviderOffsets:int = currentPageIndex / itemCount; var currentItemIndex:int = currentPageIndex % itemCount; if(itemIndex < currentItemIndex) { var previousPageIndex:Number = fullDataProviderOffsets * itemCount + itemIndex; var nextPageIndex:Number = (fullDataProviderOffsets + 1) * itemCount + itemIndex; } else { previousPageIndex = (fullDataProviderOffsets - 1) * itemCount + itemIndex; nextPageIndex = fullDataProviderOffsets * itemCount + itemIndex; } if((nextPageIndex - currentPageIndex) < (currentPageIndex - previousPageIndex)) { return nextPageIndex; } return previousPageIndex; } /** * @private */ override protected function scroller_removedFromStageHandler(event:Event):void { if(this._verticalAutoScrollTween) { this._verticalAutoScrollTween.advanceTime(this._verticalAutoScrollTween.totalTime); } if(this._horizontalAutoScrollTween) { this._horizontalAutoScrollTween.advanceTime(this._horizontalAutoScrollTween.totalTime); } super.scroller_removedFromStageHandler(event); } /** * @private */ protected function spinnerList_scrollCompleteHandler(event:Event):void { var itemCount:int = this._dataProvider.length; if(this._maxVerticalPageIndex != this._minVerticalPageIndex) { var pageIndex:int = this._verticalPageIndex % itemCount; } else if(this._maxHorizontalPageIndex != this._minHorizontalPageIndex) { pageIndex = this._horizontalPageIndex % itemCount; } if(pageIndex < 0) { pageIndex = itemCount + pageIndex; } var item:Object = this._dataProvider.getItemAt(pageIndex); var itemRenderer:IListItemRenderer = this.itemToItemRenderer(item); if(itemRenderer !== null && !itemRenderer.isEnabled) { //if the item renderer isn't enabled, we cannot select it //go back to the previously selected index if(this._maxVerticalPageIndex != this._minVerticalPageIndex) { this.scrollToPageIndex(this._horizontalPageIndex, this._selectedIndex, this._pageThrowDuration); } else if(this._maxHorizontalPageIndex != this._minHorizontalPageIndex) { this.scrollToPageIndex(this._selectedIndex, this._verticalPageIndex, this._pageThrowDuration); } return; } this.selectedIndex = pageIndex; } /** * @private */ protected function spinnerList_triggeredHandler(event:Event, item:Object):void { var itemIndex:int = this._dataProvider.getItemIndex(item); //property must change immediately, but the animation can take longer this.selectedIndex = itemIndex; if(this._maxVerticalPageIndex != this._minVerticalPageIndex) { itemIndex = this.calculateNearestPageIndexForItem(itemIndex, this._verticalPageIndex, this._maxVerticalPageIndex); this.throwToPage(this._horizontalPageIndex, itemIndex, this._pageThrowDuration); } else if(this._maxHorizontalPageIndex != this._minHorizontalPageIndex) { itemIndex = this.calculateNearestPageIndexForItem(itemIndex, this._horizontalPageIndex, this._maxHorizontalPageIndex); this.throwToPage(itemIndex, this._verticalPageIndex, this._pageThrowDuration); } } /** * @private */ override protected function dataProvider_removeItemHandler(event:Event, index:int):void { super.dataProvider_removeItemHandler(event, index); if(this._maxVerticalPageIndex != this._minVerticalPageIndex) { var itemIndex:int = this.calculateNearestPageIndexForItem(this._selectedIndex, this._verticalPageIndex, this._maxVerticalPageIndex); if(itemIndex > this._dataProvider.length) { itemIndex -= this._dataProvider.length; } this.scrollToDisplayIndex(itemIndex, 0); } else if(this._maxHorizontalPageIndex != this._minHorizontalPageIndex) { itemIndex = this.calculateNearestPageIndexForItem(this._selectedIndex, this._horizontalPageIndex, this._maxHorizontalPageIndex); if(itemIndex > this._dataProvider.length) { itemIndex -= this._dataProvider.length; } this.scrollToDisplayIndex(itemIndex, 0); } } /** * @private */ override protected function dataProvider_addItemHandler(event:Event, index:int):void { super.dataProvider_addItemHandler(event, index); if(this._maxVerticalPageIndex != this._minVerticalPageIndex) { var itemIndex:int = this.calculateNearestPageIndexForItem(this._selectedIndex, this._verticalPageIndex, this._maxVerticalPageIndex); if(itemIndex > this._dataProvider.length) { itemIndex -= this._dataProvider.length; } this.scrollToDisplayIndex(itemIndex, 0); } else if(this._maxHorizontalPageIndex != this._minHorizontalPageIndex) { itemIndex = this.calculateNearestPageIndexForItem(this._selectedIndex, this._horizontalPageIndex, this._maxHorizontalPageIndex); if(itemIndex > this._dataProvider.length) { itemIndex -= this._dataProvider.length; } this.scrollToDisplayIndex(itemIndex, 0); } } /** * @private */ override protected function nativeStage_keyDownHandler(event:KeyboardEvent):void { if(event.isDefaultPrevented()) { return; } if(!this._dataProvider) { return; } if(event.keyCode == Keyboard.HOME || event.keyCode == Keyboard.END || event.keyCode == Keyboard.PAGE_UP || event.keyCode == Keyboard.PAGE_DOWN || event.keyCode == Keyboard.UP || event.keyCode == Keyboard.DOWN || event.keyCode == Keyboard.LEFT || event.keyCode == Keyboard.RIGHT) { var newIndex:int = this.dataViewPort.calculateNavigationDestination(this.selectedIndex, event.keyCode); if(this.selectedIndex != newIndex) { //property must change immediately, but the animation can take longer this.selectedIndex = newIndex; if(this._maxVerticalPageIndex != this._minVerticalPageIndex) { event.preventDefault(); var pageIndex:int = this.calculateNearestPageIndexForItem(newIndex, this._verticalPageIndex, this._maxVerticalPageIndex); this.throwToPage(this._horizontalPageIndex, pageIndex, this._pageThrowDuration); } else if(this._maxHorizontalPageIndex != this._minHorizontalPageIndex) { event.preventDefault(); pageIndex = this.calculateNearestPageIndexForItem(newIndex, this._horizontalPageIndex, this._maxHorizontalPageIndex); this.throwToPage(pageIndex, this._verticalPageIndex, this._pageThrowDuration); } } } } /** * @private */ override protected function stage_gestureDirectionalTapHandler(event:TransformGestureEvent):void { if(event.isDefaultPrevented()) { //something else has already handled this event return; } var keyCode:uint = int.MAX_VALUE; if(event.offsetY < 0) { keyCode = Keyboard.UP; } else if(event.offsetY > 0) { keyCode = Keyboard.DOWN; } else if(event.offsetX > 0) { keyCode = Keyboard.RIGHT; } else if(event.offsetX < 0) { keyCode = Keyboard.LEFT; } if(keyCode == int.MAX_VALUE) { return; } var newIndex:int = this.dataViewPort.calculateNavigationDestination(this.selectedIndex, keyCode); if(this.selectedIndex != newIndex) { //property must change immediately, but the animation can take longer this.selectedIndex = newIndex; if(this._maxVerticalPageIndex != this._minVerticalPageIndex) { event.stopImmediatePropagation(); //event.preventDefault(); var pageIndex:int = this.calculateNearestPageIndexForItem(newIndex, this._verticalPageIndex, this._maxVerticalPageIndex); this.throwToPage(this._horizontalPageIndex, pageIndex, this._pageThrowDuration); } else if(this._maxHorizontalPageIndex != this._minHorizontalPageIndex) { event.stopImmediatePropagation(); //event.preventDefault(); pageIndex = this.calculateNearestPageIndexForItem(newIndex, this._horizontalPageIndex, this._maxHorizontalPageIndex); this.throwToPage(pageIndex, this._verticalPageIndex, this._pageThrowDuration); } } } } }