CombinedText stringlengths 4 3.42M |
|---|
package serverProto.ninjaexam
{
import com.netease.protobuf.Message;
import com.netease.protobuf.WritingBuffer;
import flash.utils.IDataInput;
import com.netease.protobuf.ReadUtils;
public final class ProtoResetNinjaExamReq extends Message
{
public function ProtoResetNinjaExamReq()
{
super();
}
override final function writeToBuffer(param1:WritingBuffer) : void
{
var _loc2_:* = undefined;
for(_loc2_ in this)
{
super.writeUnknown(param1,_loc2_);
}
}
override final function readFromSlice(param1:IDataInput, param2:uint) : void
{
var _loc3_:uint = 0;
while(param1.bytesAvailable > param2)
{
_loc3_ = ReadUtils.read$TYPE_UINT32(param1);
if(false?0:0)
{
}
super.readUnknown(param1,_loc3_);
}
}
}
}
|
package view.ui.buttons
{
import view.ui.text.BaseText;
/**
*
* @author Nina Pavlich
*
* @overview
*
*
*/
public class BaseTextButton extends BaseText
{
public function BaseTextButton(style:String="", txt:String="")
{
super(style, txt);
this.mouseChildren = false;
this.useHandCursor = true;
this.buttonMode = true
}
}
/**
* Before you hit the road,
* please commend your code
* or all your BaseTextButtons will explode
*/
}
|
package Ankama_Tooltips.ui
{
public class WorldCompanionFighterTooltipUi extends AbstractWorldFighterTooltipUi
{
public function WorldCompanionFighterTooltipUi()
{
super();
}
}
}
|
package framework.view.pages.inHouse.data
{
public class ValidateType
{
public static const NAMES_LENGTH:String = "namesLength";
public static const PASSPORT_LENGTH:String = "passportLength";
public static const ROOM_NUMBER:String = "roomNumber";
public static const FIRST_NAME:String = "firstName";
public static const LAST_NAME:String = "lastName";
public static const COMPANY_NAME:String = "lastName";
public static const ZIP_CODE:String = "zipCode";
}
} |
package org.gestouch.gestures
{
import flash.geom.Point;
import org.gestouch.core.GestureState;
import org.gestouch.core.Touch;
/**
* @author Pavel fljot
*/
public class TransformGesture extends AbstractContinuousGesture
{
public var slop:Number = Gesture.DEFAULT_SLOP;
protected var _touch1:Touch;
protected var _touch2:Touch;
protected var _transformVector:Point;
public function TransformGesture(target:Object = null)
{
super(target);
}
protected var _offsetX:Number = 0;
public function get offsetX():Number
{
return _offsetX;
}
protected var _offsetY:Number = 0;
public function get offsetY():Number
{
return _offsetY;
}
protected var _rotation:Number = 0;
public function get rotation():Number
{
return _rotation;
}
protected var _scale:Number = 1;
public function get scale():Number
{
return _scale;
}
// --------------------------------------------------------------------------
//
// Public methods
//
// --------------------------------------------------------------------------
override public function reflect():Class
{
return TransformGesture;
}
override public function reset():void
{
_touch1 = null;
_touch2 = null;
super.reset();
}
// --------------------------------------------------------------------------
//
// Protected methods
//
// --------------------------------------------------------------------------
override protected function onTouchBegin(touch:Touch):void
{
if (touchesCount > 2)
{
failOrIgnoreTouch(touch);
return;
}
if (touchesCount == 1)
{
_touch1 = touch;
}
else
{
_touch2 = touch;
_transformVector = _touch2.location.subtract(_touch1.location);
}
updateLocation();
if (state == GestureState.BEGAN || state == GestureState.CHANGED)
{
// notify that location (and amount of touches) has changed
setState(GestureState.CHANGED);
}
}
override protected function onTouchMove(touch:Touch):void
{
var prevLocation:Point = _location.clone();
updateLocation();
var currTransformVector:Point;
if (state == GestureState.POSSIBLE)
{
if (slop > 0 && touch.locationOffset.length < slop)
{
// Not recognized yet
if (_touch2)
{
// Recalculate _transformVector to avoid initial "jump" on recognize
_transformVector = _touch2.location.subtract(_touch1.location);
}
return;
}
}
if (_touch2 && !currTransformVector)
{
currTransformVector = _touch2.location.subtract(_touch1.location);
}
_offsetX = _location.x - prevLocation.x;
_offsetY = _location.y - prevLocation.y;
if (_touch2)
{
_rotation = Math.atan2(currTransformVector.y, currTransformVector.x) - Math.atan2(_transformVector.y, _transformVector.x);
_scale = currTransformVector.length / _transformVector.length;
_transformVector = _touch2.location.subtract(_touch1.location);
}
setState(state == GestureState.POSSIBLE ? GestureState.BEGAN : GestureState.CHANGED);
}
override protected function onTouchEnd(touch:Touch):void
{
if (touchesCount == 0)
{
if (state == GestureState.BEGAN || state == GestureState.CHANGED)
{
setState(GestureState.ENDED);
}
else if (state == GestureState.POSSIBLE)
{
setState(GestureState.FAILED);
}
}
else// == 1
{
if (touch == _touch1)
{
_touch1 = _touch2;
}
_touch2 = null;
if (state == GestureState.BEGAN || state == GestureState.CHANGED)
{
updateLocation();
setState(GestureState.CHANGED);
}
}
}
override protected function resetNotificationProperties():void
{
super.resetNotificationProperties();
_offsetX = _offsetY = 0;
_rotation = 0;
_scale = 1;
}
}
} |
/**
* gen by tools!
* time:Thu Oct 10 18:10:57 GMT+0800 2013
* from:功能点开启配置.csv
* to:function_open_setting.json
**/
package SJ.Game.data.json
{
import engine_starling.data.SDataBaseJson;
public class Json_function_open_setting extends SDataBaseJson
{
public function Json_function_open_setting()
{
}
private var _functionid:* = null;
public function get functionid():*{return _functionid;}
public function set functionid(value:*):void{_functionid=value;}
private var _name:* = null;
public function get name():*{return _name;}
public function set name(value:*):void{_name=value;}
private var _modulename:* = null;
public function get modulename():*{return _modulename;}
public function set modulename(value:*):void{_modulename=value;}
private var _type:* = null;
public function get type():*{return _type;}
public function set type(value:*):void{_type=value;}
private var _index:* = null;
public function get index():*{return _index;}
public function set index(value:*):void{_index=value;}
private var _needopen:* = null;
public function get needopen():*{return _needopen;}
public function set needopen(value:*):void{_needopen=value;}
private var _guidelist:* = null;
public function get guidelist():*{return _guidelist;}
public function set guidelist(value:*):void{_guidelist=value;}
private var _level:* = null;
public function get level():*{return _level;}
public function set level(value:*):void{_level=value;}
private var _taskid:* = null;
public function get taskid():*{return _taskid;}
public function set taskid(value:*):void{_taskid=value;}
private var _icon:* = null;
public function get icon():*{return _icon;}
public function set icon(value:*):void{_icon=value;}
private var _desc:* = null;
public function get desc():*{return _desc;}
public function set desc(value:*):void{_desc=value;}
}
}
|
package com.yahoo.infographics.styles
{
import com.yahoo.renderers.styles.IStyle;
/**
* Style class used when the data type of an axis is category
*/
public class CategoryAxisStyles extends AxisStyles implements IStyle
{
/**
* Constructor
*/
public function CategoryAxisStyles()
{
super();
}
/**
* @inheritDoc
*/
public static var styleMap:Object =
{
dataFormat:"dataFormat"
};
/**
* @private
* Storage for dataFormat
*/
private var _dataFormat:Object = {
external:false,
func:"defaultFunction"
};
/**
* Contains data for formatting axis labels.
* <ul>
* <li><code>external</code>: Indicates whether to use an external js function.</li>
* <li><code>function</code>: String reference to the function that is to be used.</li>
* <li><code>props</code>: hash of properties that might be used in the formatting function.</li>
* </ul>
*/
public function get dataFormat():Object
{
return this._dataFormat;
}
/**
* @private (setter)
*/
public function set dataFormat(value:Object):void
{
for(var i:String in value)
{
this._dataFormat[i] = value[i];
}
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// 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 com.riaspace.nativeApplicationUpdater.utils
{
import flash.desktop.NativeProcess;
import flash.desktop.NativeProcessStartupInfo;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.filesystem.File;
[Event(name="complete",type="flash.events.Event")]
[Event(name="error",type="flash.events.ErrorEvent")]
public class HdiutilHelper extends EventDispatcher
{
private var dmg:File;
private var result:Function;
private var error:Function;
private var hdiutilProcess:NativeProcess;
public var mountPoint:String;
public function HdiutilHelper(dmg:File)
{
this.dmg = dmg;
this.result = result;
this.error = error;
}
public function attach():void
{
var info:NativeProcessStartupInfo = new NativeProcessStartupInfo();
info.executable = new File("/usr/bin/hdiutil");
var args:Vector.<String> = new Vector.<String>();
args.push("attach", "-plist", dmg.nativePath);
info.arguments = args;
hdiutilProcess = new NativeProcess();
hdiutilProcess.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, hdiutilProcess_errorHandler);
hdiutilProcess.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, hdiutilProcess_errorHandler);
hdiutilProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, hdiutilProcess_outputHandler);
hdiutilProcess.start(info);
}
private function hdiutilProcess_outputHandler(event:ProgressEvent):void
{
hdiutilProcess.removeEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, hdiutilProcess_errorHandler);
hdiutilProcess.removeEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, hdiutilProcess_errorHandler);
hdiutilProcess.removeEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, hdiutilProcess_outputHandler);
hdiutilProcess.exit();
// Storing current XML settings
var xmlSettings:Object = XML.settings();
// Setting required custom XML settings
XML.setSettings(
{
ignoreWhitespace : true,
ignoreProcessingInstructions : true,
ignoreComments : true,
prettyPrinting : false
});
var plist:XML = new XML(hdiutilProcess.standardOutput.readUTFBytes(event.bytesLoaded));
var dicts:XMLList = plist.dict.array.dict;
// INFO: for some reason E4X didn't work
for each(var dict:XML in dicts)
{
for each(var element:XML in dict.elements())
{
if (element.name() == "key" && element.text() == "mount-point")
{
mountPoint = dict.child(element.childIndex() + 1);
break;
}
}
}
// Reverting back original XML settings
XML.setSettings(xmlSettings);
if (mountPoint)
dispatchEvent(new Event(Event.COMPLETE));
else
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, "Couldn't find mount point!"));
}
private function hdiutilProcess_errorHandler(event:IOErrorEvent):void
{
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, event.text, event.errorID));
}
}
} |
package com.stuffwithstuff.bantam.parselets
{
import com.stuffwithstuff.bantam.Parser;
import com.stuffwithstuff.bantam.Token;
import com.stuffwithstuff.bantam.TokenType;
import com.stuffwithstuff.bantam.expressions.Expression;
import com.stuffwithstuff.bantam.expressions.OperatorExpression;
/**
* @author Simon Richardson - me@simonrichardson.info
*/
public final class BinaryOperatorParselet implements InfixParselet
{
private var _operator : TokenType;
private var _precedence : int;
private var _isRight : Boolean;
public function BinaryOperatorParselet(operator : TokenType, precedence : int, isRight : Boolean)
{
_operator = operator;
_precedence = precedence;
_isRight = isRight;
}
public function parse(parser : Parser, left : Expression, token : Token) : Expression
{
// To handle right-associative operators like "^", we allow a slightly
// lower precedence when parsing the right-hand side. This will let a
// parselet with the same precedence appear on the right, which will then
// take *this* parselet's result as its left-hand argument.
const right : Expression = parser.parseExpressionBy(_precedence - (_isRight ? 1 : 0));
return new OperatorExpression(left, _operator, right);
}
public function get precedence() : int
{
return _precedence;
}
}
}
|
package com.unhurdle.spectrum.card
{
import com.unhurdle.spectrum.ActionMenu;
import com.unhurdle.spectrum.Group;
import org.apache.royale.events.Event;
import com.unhurdle.spectrum.Popover;
COMPILE::JS
{
import org.apache.royale.core.WrappedHTMLElement;
import org.apache.royale.html.util.addElementToWrapper;
import org.apache.royale.core.WrappedHTMLElement;
}
[Event(name="change", type="org.apache.royale.events.Event")]
[Event(name="beforeShow", type="org.apache.royale.events.Event")]
public class CardActionMenu extends Group
{
public function CardActionMenu()
{
super();
}
override protected function getSelector():String{
return getCardSelector() + "-actionButton";
}
public var menu:ActionMenu;
private function handleChange(event:Event):void{
dispatchEvent(event);
}
private function handleBeforeShow(event:Event):void{
dispatchEvent(new Event("beforeShow"));
}
COMPILE::JS
override protected function createElement():WrappedHTMLElement{
var elem:WrappedHTMLElement = addElementToWrapper(this,'div');
menu = new ActionMenu();
//change should bubble automatically
menu.addEventListener("change",handleChange)
menu.addEventListener("beforeShow",handleBeforeShow)
addElement(menu);
return elem;
}
public function get dataProvider():Object{
return menu.dataProvider;
}
public function set dataProvider(value:Object):void{
menu.dataProvider = value;
}
public function get alignRight():Boolean
{
return menu.alignRight;
}
public function set alignRight(value:Boolean):void
{
menu.alignRight = value;
}
public function get selectable():Boolean
{
return menu.selectable;
}
public function set selectable(value:Boolean):void
{
menu.selectable = value;
}
public function get selectedIndex():int
{
return menu.selectedIndex;
}
public function set selectedIndex(value:int):void
{
menu.selectedIndex = value;
}
private var _selectedItem:Object;
public function get selectedItem():Object
{
return menu.selectedItem;
}
public function set selectedItem(value:Object):void
{
menu.selectedItem = value;
}
public function get text():String
{
return menu.text;
}
public function set text(value:String):void
{
menu.text = value;
}
/**
* Icon selector name
*/
public function get icon():String
{
return menu.icon;
}
public function set icon(value:String):void
{
menu.icon = value;
}
public function get iconClass():String
{
return menu.iconClass;
}
public function set iconClass(value:String):void
{
menu.iconClass = value;
}
public function get iconSize():String
{
return menu.iconSize;
}
public function set iconSize(value:String):void
{
menu.iconSize = value;
}
public function get iconType():String
{
return menu.iconType;
}
public function set iconType(value:String):void
{
menu.iconType = value;
}
public function get quiet():Boolean
{
return menu.quiet;
}
public function set quiet(value:Boolean):void
{
menu.quiet = value;
}
public function get disabled():Boolean
{
return menu.disabled;
}
public function set disabled(value:Boolean):void
{
menu.disabled = value;
}
public function get invalid():Boolean
{
return menu.invalid;
}
public function set invalid(value:Boolean):void
{
menu.invalid = value;
}
public function get selected():Boolean
{
return menu.selected;
}
public function set selected(value:Boolean):void
{
menu.selected = value;
}
public function get popover():Popover
{
return menu.popover;
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// 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.buttonBarClasses
{
import mx.controls.dataGridClasses.DataGridColumn;
import org.apache.royale.html.supportClasses.TextButtonItemRenderer;
/**
* The TextButtonDataGridColumnItemRenderer is the default renderer for mx.controls.DataGrid's columns
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public class TextButtonDataGridColumnItemRenderer extends TextButtonItemRenderer
{
override protected function updateButtonLabelFromData():void
{
text = data ? (data as DataGridColumn).headerText : "";
}
}
}
|
/**
* Starling Builder
* Copyright 2015 SGN Inc. 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 starlingbuilder.demo2
{
import starling.display.Sprite;
import starling.events.Touch;
import starling.events.TouchEvent;
import starling.events.TouchPhase;
public class ExternalElementTest extends Sprite
{
private var _sprite:Sprite;
public function ExternalElementTest()
{
_sprite = UIBuilderDemo.uiBuilder.create(ParsedLayouts.external_element_test, false) as Sprite;
addChild(_sprite);
addEventListener(TouchEvent.TOUCH, onTouch);
}
private function onTouch(event:TouchEvent):void
{
var touch:Touch = event.getTouch(this);
if (touch && touch.phase == TouchPhase.ENDED)
{
removeFromParent(true);
}
}
}
}
|
package com.company.assembleegameclient.map {
import com.company.assembleegameclient.engine3d.TextureMatrix;
import com.company.assembleegameclient.objects.GameObject;
import com.company.assembleegameclient.util.TileRedrawer;
import flash.display.BitmapData;
import flash.display.IGraphicsData;
import flash.geom.Vector3D;
public class Square {
public static const UVT:Vector.<Number> = new <Number>[0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0];
private static const LOOKUP:Vector.<int> = new <int>[26171, 44789, 20333, 70429, 98257, 59393, 33961];
public var map_:Map;
public var x_:int;
public var y_:int;
public var tileType_:uint = 0xFF;
public var center_:Vector3D;
public var vin_:Vector.<Number>;
public var obj_:GameObject = null;
public var props_:GroundProperties;
public var texture_:BitmapData = null;
public var sink_:int = 0;
public var lastDamage_:int = 0;
public var faces_:Vector.<SquareFace>;
public var topFace_:SquareFace = null;
public var baseTexMatrix_:TextureMatrix = null;
public var lastVisible_:int;
public function Square(_arg1:Map, _arg2:int, _arg3:int) {
this.props_ = GroundLibrary.defaultProps_;
this.faces_ = new Vector.<SquareFace>();
super();
this.map_ = _arg1;
this.x_ = _arg2;
this.y_ = _arg3;
this.center_ = new Vector3D((this.x_ + 0.5), (this.y_ + 0.5), 0);
this.vin_ = new <Number>[this.x_, this.y_, 0, (this.x_ + 1), this.y_, 0, (this.x_ + 1), (this.y_ + 1), 0, this.x_, (this.y_ + 1), 0];
}
private static function hash(_arg1:int, _arg2:int):int {
var _local3:int = LOOKUP[((_arg1 + _arg2) % 7)];
var _local4 = (((_arg1 << 16) | _arg2) ^ 81397550);
_local4 = ((_local4 * _local3) % 0xFFFF);
return (_local4);
}
public function dispose():void {
var _local1:SquareFace;
this.map_ = null;
this.center_ = null;
this.vin_ = null;
this.obj_ = null;
this.texture_ = null;
for each (_local1 in this.faces_) {
_local1.dispose();
}
this.faces_.length = 0;
if (this.topFace_ != null) {
this.topFace_.dispose();
this.topFace_ = null;
}
this.faces_ = null;
this.baseTexMatrix_ = null;
}
public function setTileType(_arg1:uint):void {
this.tileType_ = _arg1;
this.props_ = GroundLibrary.propsLibrary_[this.tileType_];
this.texture_ = GroundLibrary.getBitmapData(this.tileType_, hash(this.x_, this.y_));
this.baseTexMatrix_ = new TextureMatrix(this.texture_, UVT);
this.faces_.length = 0;
}
public function isWalkable():Boolean {
return (((!(this.props_.noWalk_)) && ((((this.obj_ == null)) || (!(this.obj_.props_.occupySquare_))))));
}
public function draw(_arg1:Vector.<IGraphicsData>, _arg2:Camera, _arg3:int):void {
var _local4:SquareFace;
if (this.texture_ == null) {
return;
}
if (this.faces_.length == 0) {
this.rebuild3D();
}
for each (_local4 in this.faces_) {
if (!_local4.draw(_arg1, _arg2, _arg3)) {
if (_local4.face_.vout_[1] < _arg2.clipRect_.bottom) {
this.lastVisible_ = 0;
}
return;
}
}
}
public function drawTop(_arg1:Vector.<IGraphicsData>, _arg2:Camera, _arg3:int):void {
this.topFace_.draw(_arg1, _arg2, _arg3);
}
private function rebuild3D():void {
var _local2:Number;
var _local3:Number;
var _local4:BitmapData;
var _local5:Vector.<Number>;
var _local6:uint;
this.faces_.length = 0;
this.topFace_ = null;
var _local1:BitmapData;
if (this.props_.animate_.type_ != AnimateProperties.NO_ANIMATE) {
this.faces_.push(new SquareFace(this.texture_, this.vin_, this.props_.xOffset_, this.props_.xOffset_, this.props_.animate_.type_, this.props_.animate_.dx_, this.props_.animate_.dy_));
_local1 = TileRedrawer.redraw(this, false);
if (_local1 != null) {
this.faces_.push(new SquareFace(_local1, this.vin_, 0, 0, AnimateProperties.NO_ANIMATE, 0, 0));
}
}
else {
_local1 = TileRedrawer.redraw(this, true);
_local2 = 0;
_local3 = 0;
if (_local1 == null) {
if (this.props_.randomOffset_) {
_local2 = (int((this.texture_.width * Math.random())) / this.texture_.width);
_local3 = (int((this.texture_.height * Math.random())) / this.texture_.height);
}
else {
_local2 = this.props_.xOffset_;
_local3 = this.props_.yOffset_;
}
}
this.faces_.push(new SquareFace((((_local1) != null) ? _local1 : this.texture_), this.vin_, _local2, _local3, AnimateProperties.NO_ANIMATE, 0, 0));
}
if (this.props_.sink_) {
this.sink_ = (((_local1) == null) ? 12 : 6);
}
else {
this.sink_ = 0;
}
if (this.props_.topTD_) {
_local4 = this.props_.topTD_.getTexture();
_local5 = this.vin_.concat();
_local6 = 2;
while (_local6 < _local5.length) {
_local5[_local6] = 1;
_local6 = (_local6 + 3);
}
this.topFace_ = new SquareFace(_local4, _local5, 0, 0, this.props_.topAnimate_.type_, this.props_.topAnimate_.dx_, this.props_.topAnimate_.dy_);
}
}
}
}
|
package com.longtailvideo.jwplayer.media {
import com.longtailvideo.jwplayer.events.MediaEvent;
import com.longtailvideo.jwplayer.model.PlayerConfig;
import com.longtailvideo.jwplayer.model.PlaylistItem;
import com.longtailvideo.jwplayer.parsers.SMILParser;
import com.longtailvideo.jwplayer.player.PlayerState;
import com.longtailvideo.jwplayer.utils.AssetLoader;
import com.longtailvideo.jwplayer.utils.NetClient;
import com.longtailvideo.jwplayer.utils.RootReference;
import com.longtailvideo.jwplayer.utils.Utils;
import com.wowza.encryptionAS3.TEA;
import flash.events.AsyncErrorEvent;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.geom.Rectangle;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.net.NetStreamPlayOptions;
import flash.net.NetStreamPlayTransitions;
import flash.net.ObjectEncoding;
import flash.net.Responder;
import flash.utils.clearInterval;
import flash.utils.setInterval;
import flash.utils.setTimeout;
/**
* Wrapper for playback of media streamed over RTMP.
**/
public class RTMPMediaProvider extends MediaProvider {
/** Initialize RTMP provider. **/
public function RTMPMediaProvider(stageVideoEnabled:Boolean = true) {
_stageEnabled = stageVideoEnabled;
super('rtmp');
_bandwidth = Number.MAX_VALUE;
}
/** The RTMP application URL. **/
private var _application:String;
/** Is automatic quality switching enabled? **/
private var _auto:Boolean;
/** The last bandwidth measurement. **/
private var _bandwidth:Number;
/** The netconnection instance **/
private var _connection:NetConnection;
/** ID for the position interval. **/
private var _interval:Number;
/** Current quality level **/
private var _level:Number;
/** Array with quality levels. **/
private var _levels:Array;
/** Loader for loading SMIL files. **/
private var _loader:AssetLoader;
/** Flag for metadata received. **/
private var _metadata:Boolean;
/** Flag for paused **/
private var _isPaused:Boolean = false;
/** StageVideo object to be instantiated. **/
private var _stage:Object;
/** Whether or not StageVideo is enabled **/
private var _stageEnabled:Boolean;
/** NetStream instance that handles playback. **/
private var _stream:NetStream;
/** Level to transition to. **/
private var _transition:Boolean;
/** Video type that's detected. **/
private var _type:String;
/** Video object to be instantiated. **/
private var _video:Video;
private var _loading:Boolean = false;
private var _afterLoading:Function = null;
/** Return the list of quality levels. **/
override public function get qualityLevels():Array {
var levels:Array = [];
if (_levels) {
if (_levels.length > 1) {
levels.push({label: 'Auto'});
}
for (var i:Number = 0; i < _levels.length; i++) {
levels.push(_levels[i]);
}
}
return levels;
}
/** Return the index of the current quality. **/
override public function get currentQuality():Number {
var level:Number = 0;
if (_level) {
level = _level;
if (_auto) {
level++;
}
}
return level;
}
/** Change the current quality. **/
override public function set currentQuality(quality:Number):void {
var level:Number = -1;
// Ignore when single level, when transitioning or when out of bounds
if (_levels.length > 1 && !_transition && quality > -1 && quality < _levels.length + 1) {
// Switch to auto
if (quality == 0 && !_auto) {
level = 0;
_auto = true;
swapLevel(autoLevel(), true);
// Switch to/within manual
} else if (quality > 0 && (_auto || quality != _level + 1)) {
swapLevel(quality - 1, true);
_auto = false;
level = quality;
}
}
if (level > -1) {
_config.qualityLabel = qualityLevels[quality].label;
var event:MediaEvent = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_LEVEL_CHANGED);
event.levels = qualityLevels;
event.currentQuality = quality;
dispatchEvent(event);
}
}
/** Constructor; sets up the connection and loader. **/
public override function initializeMediaProvider(cfg:PlayerConfig):void {
super.initializeMediaProvider(cfg);
// Allow stagevideo to be disabled by user config
if (_stageEnabled && cfg.hasOwnProperty('stagevideo') && cfg['stagevideo'].toString() == "false") _stageEnabled = false;
_connection = new NetConnection();
_connection.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
_connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
_connection.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandler);
_connection.objectEncoding = ObjectEncoding.AMF0;
if (getConfigProperty('proxytype')) {
_connection.proxyType = getConfigProperty('proxytype');
}
_connection.client = new NetClient(this);
_loader = new AssetLoader();
_loader.addEventListener(Event.COMPLETE, loaderComplete);
_loader.addEventListener(ErrorEvent.ERROR, loaderError);
}
/** Load content. **/
override public function load(itm:PlaylistItem):void {
_loading = true;
_item = itm;
_position = 0;
// Set Video or StageVideo
if (!_video) {
_video = new Video(320, 240);
_video.smoothing = true;
_video.addEventListener('renderState', renderHandler);
// Use stageVideo when available
if (_stageEnabled && RootReference.stage['stageVideos'].length > 0) {
_stage = RootReference.stage['stageVideos'][0];
_stage.viewPort = new Rectangle(0, 0, 320, 240);
_stage.addEventListener('renderState', renderHandler);
}
attachNetStream(_stream);
}
media = _video;
//If you send buffering events before the provider's media is set
// The view will think that the controls should be locked because the provider doesn't have a display.
setState(PlayerState.BUFFERING);
// Load either file, streamer or manifest
if (_item.file.substr(0, 4) === 'rtmp') {
// Split application and stream
var definst:Number = _item.file.indexOf('_definst_');
var prefix:Number = Math.max(_item.file.indexOf('mp4:'),
_item.file.indexOf('mp3:'), _item.file.indexOf('flv:'));
var slash:Number = _item.file.lastIndexOf('/');
var id:String;
if (definst > 0) {
_application = _item.file.substr(0, definst + 10);
id = _item.file.substr(definst + 10);
} else if (prefix > -1) {
_application = _item.file.substr(0, prefix);
id = _item.file.substr(prefix);
} else {
_application = _item.file.substr(0, slash + 1);
id = _item.file.substr(slash + 1);
}
_levels = [{label: '0', id: loadID(id)}];
loadWrap();
} else if (_item.streamer) {
_application = _item.streamer;
_levels = [{label: '0', id: loadID(_item.file)}];
loadWrap();
} else {
_loader.load(_item.file, XML);
}
}
/** Pause playback. **/
override public function pause():void {
CONFIG::debugging {
trace('pause', new Error().getStackTrace());
}
// Pause VOD or close live stream
if (_stream) {
if (isVOD(_item.duration)) {
_isPaused = true;
_stream.pause();
} else {
_stream.close();
}
}
clearInterval(_interval);
super.pause();
}
/** Resume playing. **/
override public function play():void {
CONFIG::debugging {
trace('play', new Error().getStackTrace());
}
if (_loading) {
_afterLoading = play;
return;
}
attachNetStream(_stream);
if (_isPaused) {
// Resume VOD and restart live stream
if (isVOD(_item.duration)) {
_stream.resume();
} else {
_stream.play(_levels[_level].id);
setState(PlayerState.BUFFERING);
}
} else {
// Start stream.
_stream.play(_levels[_level].id);
}
_isPaused = false;
clearInterval(_interval);
_interval = setInterval(positionInterval, 100);
}
/** Resize the Video and possible StageVideo. **/
override public function resize(width:Number, height:Number):void {
super.resize(width, height);
if (_stage && _media) {
_stage.viewPort = _media.getRect(RootReference.root);
}
if (_auto) {
swapLevel(autoLevel());
}
}
/** Seek to a new position, only when duration is found. **/
override public function seek(pos:Number):void {
if (isVOD(_item.duration)) {
if (state != PlayerState.PLAYING) {
play();
}
setState(PlayerState.BUFFERING);
_stream.seek(pos);
_transition = false;
clearInterval(_interval);
_interval = setInterval(positionInterval, 100);
}
}
/** Close the stream; reset all variables. **/
override public function stop():void {
CONFIG::debugging {
trace('stop', new Error().getStackTrace());
}
if (_stream && _stream.time) {
_stream.close();
}
_stream = null;
if (_video) {
_video.clear();
}
attachNetStream(null);
_levels = [];
_application = _type = null;
_metadata = _transition = _auto = false;
_connection.close();
clearInterval(_interval);
_position = _level = 0;
super.stop();
}
/** Set the volume level. **/
override public function setVolume(vol:Number):void {
if (_stream) {
_stream.soundTransform = _config.soundTransform;
}
super.setVolume(vol);
}
/** Get metadata information from netstream class. **/
public function onClientData(data:Object):void {
switch (data.type) {
// Stream metadata received
case 'metadata':
if (data.width && data.height) {
_video.width = data.width;
_video.height = data.height;
resize(_config.width, _config.height);
}
if(data.duration === undefined) {
_item.duration = LIVE_DURATION;
}
if (data.duration && _item.duration < 1) {
_item.duration = data.duration;
// Support old item.start call
if (_item.start && !_metadata) {
_metadata = true;
seek(_item.start);
}
}
if (data.hasCuePoints && data.cuePoints is Array) {
for (var i:uint = data.cuePoints.length; i--;) {
var cue:* = data.cuePoints[i];// this is an array with object props
data.cuePoints[i] = {
type: cue.type,
name: cue.name,
time: cue.time,
parameters: Utils.extend({}, cue.parameters)
};
}
}
data.provider = "rtmp";
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata: data});
break;
// FCSubscribe call successfull
case 'fcsubscribe':
setStream();
break;
// TX3G text data received
case 'textdata':
data.provider = "rtmp";
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata: data});
break;
// Quality level transition completed
case 'transition':
_transition = false;
break;
// Stream completed playback
case 'complete':
if (state != PlayerState.IDLE) {
stop();
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE);
}
break;
}
}
private function attachNetStream(stream:NetStream):void {
if (_stage) {
_stage.attachNetStream(_stream);
} else {
_video.attachNetStream(_stream);
}
}
/** Extract the correct rtmp syntax from the file string. **/
private function loadID(url:String):String {
var parts:Array = url.split("?");
var extension:String = parts[0].substr(-4);
// Remove flv: if the url starts with that
if (parts[0].indexOf('flv:') == 0) {
parts[0] = parts[0].substr(4);
_type = "flv";
}
switch (extension) {
case '.flv':
_type = 'flv';
parts[0] = parts[0].substr(0, parts[0].length - 4);
url = parts.join("?");
break;
case '.mp3':
_type = 'mp3';
parts[0] = parts[0].substr(0, parts[0].length - 4);
parts[0].indexOf('mp3:') == 0 ? null : parts[0] = 'mp3:' + parts[0];
url = parts.join("?");
break;
case '.mp4':
case '.mov':
case '.m4v':
case '.f4v':
_type = 'mp4';
parts[0].indexOf('mp4:') == 0 ? null : parts[0] = 'mp4:' + parts[0];
url = parts.join("?");
break;
case '.aac':
case '.m4a':
case '.f4a':
_type = 'aac';
parts[0].indexOf('mp4:') == 0 ? null : parts[0] = 'mp4:' + parts[0];
url = parts.join("?");
break;
default:
// Live streams will go here after the flv has been stripped
url = parts.join("?");
}
return url;
}
/** Finalizes the loading process **/
private function loadWrap():void {
// Do not set media object for audio streams
if (_type == 'aac' || _type == 'mp3') {
media = null;
}
var level:Number = 0;
if (_config.qualityLabel) {
var levels:Array = qualityLevels;
for (var i:Number = 0; i < levels.length; i++) {
if (_config.qualityLabel == levels[i].label) {
level = i;
break;
}
}
}
if (level <= 0) {
if (_levels.length) {
_auto = true;
_level = autoLevel();
}
else {
_auto = false;
_level = 0;
}
}
else {
_level = level - 1;
}
// Connect to RTMP server
try {
_connection.connect(_application);
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED);
} catch (e:Error) {
error("Error loading stream: Could not connect to server");
}
// Dispatch quality levels event
var event:MediaEvent = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_LEVELS);
event.currentQuality = level;
event.levels = qualityLevels;
dispatchEvent(event);
}
/** Interval for the position progress. **/
private function positionInterval():void {
var pos:Number = Math.round((_stream.time) * 10) / 10;
var bfr:Number = Math.round(_stream.bufferLength * 10 / _stream.bufferTime) / 10;
// Toggle between buffering and playback states
if (bfr < 0.6 && isVOD(_item.duration) && pos < _item.duration - 5 && state != PlayerState.BUFFERING) {
setState(PlayerState.BUFFERING);
if (_auto) {
swapLevel(autoLevel());
}
} else if (bfr > 0.8 && state != PlayerState.PLAYING) {
setState(PlayerState.PLAYING);
}
// Send time ticks when playing
if (state == PlayerState.PLAYING) {
_position = pos;
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {position: pos, duration: _item.duration});
}
// Track bandwidth if buffer is neither depleted nor filled.
if (bfr > 0.2 && bfr < 2) {
_bandwidth = Math.round(_stream.info.maxBytesPerSecond * 8 / 1024);
}
// Send out event to notify swap.
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {
metadata: {
bandwidth: _bandwidth.toString(),
qualitylevel: _level,
screenwidth: _config.width,
transitioning: _transition.toString(),
bufferfill: bfr
}
});
}
/** Init NetStream after the connection is setup. **/
private function setStream():void {
_loading = false;
_stream = new NetStream(_connection);
_stream.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
_stream.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandler);
// Set configurable bufferlength or default.
if (getConfigProperty('bufferlength')) {
_stream.bufferTime = getConfigProperty('bufferlength');
} else {
_stream.bufferTime = 2;
}
_stream.client = new NetClient(this);
if (_stage) {
_stage.attachNetStream(_stream);
} else {
_video.attachNetStream(_stream);
}
_stream.soundTransform = config.soundTransform;
// JWPLAYER_MEDIA_BUFFER_FULL will trigger a play() of the video...?
if (_afterLoading !== null) {
// set to this.play if play was called while loading
_afterLoading();
_afterLoading = null;
}
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL);
}
/** Get the streamlength returned from the connection. **/
private function streamlengthHandler(length:Number):void {
_metadata = true;
_item.duration = length;
}
private function swapLevel(index:Number, force:Boolean = false):void {
// Don't swap if we're already in the level or in a transition.
if (_level == index || (!force && _transition)) {
return;
}
_level = index;
// If a manual quality switch has been requested before the stream is ready, don't swap the stream
if (!_stream) return;
if (force) {
// Force instant swap (results in re-buffer).
clearInterval(_interval);
_interval = setInterval(positionInterval, 100);
_transition = false;
_stream.close();
_stream.play(_levels[index].id);
_stream.seek(_position);
setState(PlayerState.BUFFERING);
} else {
// Do a smooth swap (takes some time)
_transition = true;
var nso:NetStreamPlayOptions = new NetStreamPlayOptions();
nso.streamName = _levels[_level].id;
nso.transition = NetStreamPlayTransitions.SWITCH;
_stream.play2(nso);
}
}
/** Determine which level to use for autoswitching. **/
private function autoLevel():Number {
var sortedLevels:Array = [];
var useWidth:Boolean = true;
var useBitrate:Boolean = true;
if (_levels[0].bitrate) {
sortedLevels = _levels.sort(function (obj1:Object, obj2:Object):Number {
return (obj2.bitrate > obj1.bitrate ? 1 : (obj1.bitrate > obj2.bitrate ? -1 : 0) );
}, Array.RETURNINDEXEDARRAY);
}
else if (_levels[0].width) {
sortedLevels = _levels.sort(function (obj1:Object, obj2:Object):Number {
return (obj2.width > obj1.width ? 1 : (obj1.width > obj2.width ? -1 : 0) );
}, Array.RETURNINDEXEDARRAY);
}
else {
return 0;
}
// Check to make sure all levels contain a width and bitrate. If one level does not contain the required informtaion, that heursitic won't be used.
for (var i:Number = 0; i < _levels.length; i++) {
if (!_levels[i].bitrate > 0 && useBitrate) {
useBitrate = false;
}
if (!_levels[i].width > 0 && useWidth) {
useWidth = false;
}
}
// Grab the highest one first.
var level:Number = 0;
var j:Number = 0;
// Next restrict by screenwidth
if (useWidth) {
level = sortedLevels[sortedLevels.length - 1];
for (j = 0; j < sortedLevels.length; j++) {
if (_levels[sortedLevels[j]].width < _config.width * 1.5) {
level = sortedLevels[j];
break;
}
}
}
// Next further restrict by bandwidth
if (_bandwidth && useBitrate) {
level = sortedLevels[sortedLevels.length - 1];
for (i = j; i < sortedLevels.length; i++) {
if (_levels[sortedLevels[i]].bitrate < _bandwidth / 1.5) {
level = sortedLevels[i];
break;
}
}
}
if (!useBitrate && !useWidth) {
level = 0;
}
return level;
}
/** Send out video render state. **/
protected function renderHandler(event:Event):void {
var stagevideo:String = 'off';
if (_stage) {
stagevideo = 'on';
}
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {
metadata: {
stagevideo: stagevideo,
renderstate: event['status']
}
});
}
/** Catch security errors. **/
private function errorHandler(evt:ErrorEvent):void {
error(evt.text);
}
/** Get one or more levels from the loadbalancing XML. **/
private function loaderComplete(event:Event):void {
var xml:XML = (event.target as AssetLoader).loadedObject;
// Grab the RTMP application from head > meta@base.
var app:String = SMILParser.parseApplication(xml);
if (app.length > 10) {
_application = app;
} else {
error("Error loading stream: Manifest not found or invalid");
}
// Grab the quality levels from body > node.
var parsed:Array = SMILParser.parseLevels(xml);
if (parsed.length) {
// Translate the stream IDs.
for (var i:Number = 0; i < parsed.length; i++) {
parsed[i].id = loadID(parsed[i].id)
}
_levels = parsed;
loadWrap();
} else {
error("Error loading stream: Manifest not found or invalid");
}
}
/** Error handler for manifest loader. **/
private function loaderError(evt:ErrorEvent):void {
error("Error loading stream: Manifest not found or invalid");
}
/** Receive NetStream status updates. **/
private function statusHandler(evt:NetStatusEvent):void {
switch (evt.info.code) {
case 'NetConnection.Connect.Success':
// Do securetoken call.
if (evt.info.secureToken != undefined) {
var hash:String = TEA.decrypt(evt.info.secureToken, getConfigProperty('securetoken'));
_connection.call("secureTokenResponse", null, hash);
}
// Call streamlength, since FMS doesn't send metadata for MP3.
if (_type == 'mp3') {
_connection.call("getStreamLength", new Responder(streamlengthHandler), _levels[_level].id);
}
// Do live stream subscription, for Edgecast/Limelight.
if (getConfigProperty('subscribe')) {
for (var i:Number = 0; i < _levels.length; i++) {
_connection.call("FCSubscribe", null, _levels[i].id);
}
} else {
// No subscription? Then simply setup the connection.
setStream();
}
break;
// Server cannot be reached (anymore)
case 'NetConnection.Connect.Rejected':
case 'NetConnection.Connect.Failed':
var code:Number;
var redirect:String;
try {
code = evt.info.ex.code;
redirect = evt.info.ex.redirect;
} catch (e:Error) {
}
if (code == 302 && redirect) {
var newItem:PlaylistItem = new PlaylistItem({
streamer: redirect,
file: _item.file.replace(_application, ""),
type: "rtmp"
});
stop();
setTimeout(load, 0, newItem);
return;
} else {
error("Error loading stream: Could not connect to server");
}
break;
// Server connected, but stream failed.
case 'NetStream.Seek.Failed':
case 'NetStream.Failed':
case 'NetStream.Play.StreamNotFound':
error("Error loading stream: ID not found on server");
break;
// This event gets send when a live encoder is stopped.
case 'NetStream.Play.UnpublishNotify':
stop();
sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE);
break;
// Wowza automatically closes connection after a timeout
case 'NetConnection.Connect.Closed':
if (state == PlayerState.PAUSED) {
stop();
}
break;
}
}
}
} |
// Decompiled by AS3 Sorcerer 6.08
// www.as3sorcerer.com
//io.decagames.rotmg.pets.components.guiTab.PetsTabContentMediator
package io.decagames.rotmg.pets.components.guiTab
{
import robotlegs.bender.bundles.mvcs.Mediator;
import io.decagames.rotmg.pets.data.PetsModel;
public class PetsTabContentMediator extends Mediator
{
[Inject]
public var view:PetsTabContentView;
[Inject]
public var model:PetsModel;
override public function initialize():void
{
this.view.init(this.model.getActivePet());
}
override public function destroy():void
{
}
}
}//package io.decagames.rotmg.pets.components.guiTab
|
package com.xflying.ane.AirPushNotification
{
import flash.events.Event;
public class PushNotificationEvent extends Event
{
public static const PERMISSION_GIVEN_WITH_TOKEN_EVENT : String = "permissiongivenwithtokenevent";
public static const PERMISSION_REFUSED_EVENT : String = "permissionRefusedEvent";
public static const COMING_FROM_NOTIFICATION_EVENT : String = "comingFromNotificationEvent";
/** App is launched (for the first time) when clicking on the push notification*/
public static const APP_STARTING_FROM_NOTIFICATION_EVENT : String = "startingFromNotificationEvent";
/** App was in background when clicking on the push notification*/
public static const APP_BROUGHT_TO_FOREGROUND_FROM_NOTIFICATION_EVENT : String = "BroughtToForegroundFromNotificationEvent";
/** App was in background and awoken by iOS when receiving the push notification (background fetch on iOS 7+) */
public static const APP_STARTED_IN_BACKGROUND_FROM_NOTIFICATION_EVENT : String = "StartedInBackgroundFromNotificationEvent";
/** App was in foreground when receiving push notification*/
public static const NOTIFICATION_RECEIVED_WHEN_IN_FOREGROUND_EVENT : String = "NotificationReceivedWhenInForegroundEvent";
public static const APP_NOTIFICATION_DATA_EVENT : String = "AppNotificationDataEvent";
// Not available on earlier OS versions
public static const NOTIFICATION_SETTINGS_ENABLED: String = "notificationSettingsEnabled";
public static const NOTIFICATION_SETTINGS_DISABLED: String = "notificationSettingsDisabled";
public static const MESSAGE_BAR_IS_TAPPED: String = "messageBarIsTapped";
public var token : String;
public var errorCode : String;
public var errorMessage : String;
public var parameters:Object;
public function PushNotificationEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
}
}
} |
0.////////////////////////////////////////////////////////////////////////////////
//
// 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 bindables
{
import org.apache.royale.events.Event;
import org.apache.royale.utils.Timer;
public class InstanceTimer
{
public function InstanceTimer(){
initTimer(1500);
}
private static var _inst:InstanceTimer;
public static function getInstance():InstanceTimer {
return _inst || (_inst = new InstanceTimer());
}
private var timer:Timer;
private function updateTimer(e:Event=null):void{
timerCount++
// trace('updateTimer',timerCount);
}
private function initTimer(val:uint):void{
timer = new Timer(val);
timer.addEventListener(Timer.TIMER,updateTimer);
timer.start();
trace('init InstanceTimer');
}
[Bindable]
public var timerCount:uint = 0;
[Bindable]
public static var stimerCount:uint = 0;
}
}
|
package com.game.building
{
import com.component.hpbar.HpBar;
import com.game.unit.core.RateBehavior;
import core.unit.base.IProperties;
public class RatePower extends RateBehavior
{
protected var ip:IProperties;
protected var update:Function;
public function RatePower(ip:IProperties,rate:int,update:Function)
{
super();
this.ip = ip;
this.rate = rate;
this.update = update;
}
override public function rateRender(tick:int):void{
super.rateRender(tick);
}
override protected function set count(value:int):void{
super.count = value;
update(percent,0x0000ff);
}
public function halfCool():void{
count = _rate/2;
}
public function allCool():void{
count = _rate;
}
public function restore(value:int):Boolean{
count += value;
return _count >= _rate;
}
}
} |
package some.utility.classes
{
import mx.graphics.SolidColorStroke;
import spark.components.HGroup;
import spark.primitives.Line;
public class LineGroup extends HGroup
{
public function draw(x1:Number, x2:Number, y1:Number, y2:Number):void
{
var l:Line = new Line();
l.stroke = new SolidColorStroke();
l.xFrom = x1;
l.xTo = x2;
l.yFrom = y1;
l.yTo = y2;
this.addElement(l);
}
}
} |
/*
* MIT License
*
* Copyright (c) 2017 Digital Strawberry LLC
*
* 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 tests.migrations
{
import breezedb.IBreezeDatabase;
import breezedb.migrations.BreezeMigration;
// Always failing migration
public class Migration_Unsuccessful extends BreezeMigration
{
public function Migration_Unsuccessful()
{
super();
}
override public function run(db:IBreezeDatabase):void
{
done(false);
}
}
}
|
package views.client {
import events.InteractionEvent;
import starling.display.Quad;
import starling.display.Sprite;
import starling.events.Touch;
import starling.events.TouchEvent;
import starling.events.TouchPhase;
import starling.text.TextField;
import starling.utils.Align;
public class MenuItem extends Sprite {
private var bg:Quad;
private var bgOff:Quad;
private var w:int = 120;
private var isSelected:Boolean;
private var lbl:TextField;
private var type:int;
public function MenuItem(_lbl:String,_type:int,_isSelected:Boolean=false) {
super();
type = _type;
isSelected = _isSelected;
bg = new Quad(w,27,0x0D1012);
bgOff = new Quad(w,28,0x666666);
bg.alpha = 0.92;
bgOff.alpha = 0.25;
bgOff.visible = !isSelected;
lbl = new TextField(w,32,_lbl);
lbl.format.setTo("Fira Sans Semi-Bold 13",13,0xD8D8D8,Align.CENTER);
lbl.x = 0;
lbl.batchable = true;
lbl.touchable = false;
bgOff.useHandCursor = false;
bgOff.addEventListener(TouchEvent.TOUCH,onClick);
addChild(bg);
addChild(bgOff);
addChild(lbl);
}
protected function onClick(event:TouchEvent):void {
var touch:Touch = event.getTouch(bgOff);
if(touch && touch.phase == TouchPhase.ENDED)
this.dispatchEvent(new InteractionEvent(InteractionEvent.ON_MENU_ITEM_MENU,{type:type}));
}
public function setSelected(_b:Boolean):void {
isSelected = _b;
bgOff.visible = !isSelected;
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2010 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package spark.components.gridClasses
{
/**
* The GridSelectionMode class defines the valid constant values for the
* <code>selectionMode</code> property of the Spark DataGrid and Grid controls.
*
* <p>Use the constants in ActionsScript, as the following example shows: </p>
* <pre>
* myDG.selectionMode = GridSelectionMode.MULTIPLE_CELLS;
* </pre>
*
* <p>In MXML, use the String value of the constants,
* as the following example shows:</p>
* <pre>
* <s:DataGrid id="myGrid" width="350" height="150"
* selectionMode="multipleCells">
* ...
* </s:DataGrid>
* </pre>
*
* @see spark.components.DataGrid#selectionMode
* @see spark.components.Grid#selectionMode
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public final class GridSelectionMode
{
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public function GridSelectionMode()
{
super();
}
//--------------------------------------------------------------------------
//
// Class constants
//
//--------------------------------------------------------------------------
/**
* Specifies that no selection is allowed.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public static const NONE:String = "none";
/**
* Specifies that one row can be selected.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public static const SINGLE_ROW:String = "singleRow";
/**
* Specifies that one or more rows can be selected.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public static const MULTIPLE_ROWS:String = "multipleRows";
/**
* Specifies that one cell can be selected.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public static const SINGLE_CELL:String = "singleCell";
/**
* Specifies that one or more cells can be selected.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public static const MULTIPLE_CELLS:String = "multipleCells";
}
} |
/**
* @author nikkoh
*/
package utils.io{
/** */
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
/** */
public class SendAndLoad extends EventDispatcher {
/**
* SEND DATA
* @param address <String>
* @param message <URLVariables>
*/
public static function sendAndLoad(address:String,message:URLVariables):void{
//trace(this + ":sendData()");
/** */
var request:URLRequest = new URLRequest(address);
request.data = message;
/** */
var loader:URLLoader = new URLLoader();
loader.addEventListener(SendAndLoadConstants.SUCCESS,onSuccess);
loader.addEventListener(SendAndLoadConstants.SERVER_ERROR,onError);
/** */
var onSuccess:Function = function(event:Event):void{
//trace(this + ":onSuccess()");
dispatchEvent(event);
};
/** */
var onError:Function = function(event:IOErrorEvent):void {
//trace(this + ":onError()");
dispatchEvent(event);
};
/** */
loader.load(request);
}
}
} |
package effortView
{
import com.pickgliss.ui.ComponentFactory;
import com.pickgliss.ui.core.Disposeable;
import effortView.leftView.EffortLeftView;
import effortView.rightView.EffortFullView;
import effortView.rightView.EffortRightHonorView;
import effortView.rightView.EffortRightView;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
public class EffortPannelView extends Sprite implements Disposeable
{
private var _effortLeftView:EffortLeftView;
private var _effoetRigthView:EffortRightView;
private var _effoetFullView:EffortFullView;
private var _effoetRigthHonorView:EffortRightHonorView;
private var _controller:EffortController;
public function EffortPannelView(param1:EffortController)
{
this._controller = param1;
super();
this.init();
this.initEvent();
}
private function init() : void
{
this._effortLeftView = new EffortLeftView(this._controller);
var _loc1_:Point = ComponentFactory.Instance.creatCustomObject("effortView.EffortLeftView.EffortLeftViewPos");
this._effortLeftView.x = _loc1_.x;
this._effortLeftView.y = _loc1_.y;
addChild(this._effortLeftView);
this._effoetFullView = new EffortFullView(this._controller);
addChild(this._effoetFullView);
}
private function initEvent() : void
{
this._controller.addEventListener(Event.CHANGE,this.__rightChange);
}
private function __rightChange(param1:Event) : void
{
var _loc2_:Point = null;
var _loc3_:Point = null;
var _loc4_:Point = null;
if(this._controller.currentRightViewType == 0)
{
if(this._effoetRigthView)
{
removeChild(this._effoetRigthView);
this._effoetRigthView.dispose();
this._effoetRigthView = null;
}
if(this._effoetRigthHonorView)
{
removeChild(this._effoetRigthHonorView);
this._effoetRigthHonorView.dispose();
this._effoetRigthHonorView = null;
}
if(!this._effoetFullView)
{
this._effoetFullView = new EffortFullView(this._controller);
_loc2_ = ComponentFactory.Instance.creatCustomObject("effortView.EffortLeftView.EffortFullViewPos");
this._effoetFullView.x = _loc2_.x;
this._effoetFullView.y = _loc2_.y;
addChild(this._effoetFullView);
}
}
else if(this._controller.currentRightViewType == 6)
{
if(this._effoetRigthView)
{
removeChild(this._effoetRigthView);
this._effoetRigthView.dispose();
this._effoetRigthView = null;
}
if(this._effoetFullView)
{
removeChild(this._effoetFullView);
this._effoetFullView.dispose();
this._effoetFullView = null;
}
if(!this._effoetRigthHonorView)
{
this._effoetRigthHonorView = new EffortRightHonorView(this._controller);
_loc3_ = ComponentFactory.Instance.creatCustomObject("effortView.EffortLeftView.EffortRightViewPos");
this._effoetRigthHonorView.x = _loc3_.x;
this._effoetRigthHonorView.y = _loc3_.y;
addChild(this._effoetRigthHonorView);
}
}
else
{
if(this._effoetRigthHonorView)
{
removeChild(this._effoetRigthHonorView);
this._effoetRigthHonorView.dispose();
this._effoetRigthHonorView = null;
}
if(this._effoetFullView)
{
removeChild(this._effoetFullView);
this._effoetFullView.dispose();
}
this._effoetFullView = null;
if(!this._effoetRigthView)
{
this._effoetRigthView = new EffortRightView(this._controller);
_loc4_ = ComponentFactory.Instance.creatCustomObject("effortView.EffortLeftView.EffortRightViewPos");
this._effoetRigthView.x = _loc4_.x;
this._effoetRigthView.y = _loc4_.y;
addChild(this._effoetRigthView);
}
}
}
public function dispose() : void
{
if(this._effoetRigthView)
{
removeChild(this._effoetRigthView);
this._effoetRigthView.dispose();
this._effoetRigthView = null;
}
if(this._effoetFullView)
{
removeChild(this._effoetFullView);
this._effoetFullView.dispose();
this._effoetFullView = null;
}
if(this._effortLeftView)
{
removeChild(this._effortLeftView);
this._effortLeftView.dispose();
}
if(this._effoetRigthHonorView)
{
removeChild(this._effoetRigthHonorView);
this._effoetRigthHonorView.dispose();
this._effoetRigthHonorView = null;
}
if(this.parent)
{
this.parent.removeChild(this);
}
}
}
}
|
package org.xfltools.xfldom
{
import flash.display.GradientType;
import flash.display.GraphicsSolidFill;
import flash.display.IGraphicsData;
import org.xfltools.utils.XMLAssistant;
import flash.display.IGraphicsFill;
/**
* ...
* @author Tim Diggle
*/
public class FillStyle implements IDOMComponent,IGraphicsDrawable
{
private var _index:int;
private var _fillData:Vector.<IGraphicsDrawable>;
public function FillStyle()
{
}
public function fromXML(xml:XML):void
{
_index = parseInt(xml.@index);
_fillData = new Vector.<IGraphicsDrawable>();
for each (var solidColorXML:XML in XMLAssistant.getChildList(xml, [DOMXMLNodeName.SOLID_COLOR]))
{
var solidColor:SolidColor = new SolidColor();
solidColor.fromXML(solidColorXML);
_fillData.push(solidColor);
}
for each (var linearGradientXML:XML in XMLAssistant.getChildList(xml, [DOMXMLNodeName.LINEAR_GRADIENT]))
{
var linearGradient:Gradient = new Gradient(GradientType.LINEAR);
linearGradient.fromXML(linearGradientXML);
_fillData.push(linearGradient);
}
for each (var radialGradientXML:XML in XMLAssistant.getChildList(xml, [DOMXMLNodeName.RADIAL_GRADIENT]))
{
var radialGradient:Gradient = new Gradient(GradientType.RADIAL);
radialGradient.fromXML(radialGradientXML);
_fillData.push(radialGradient);
}
}
public function get fill():IGraphicsFill
{
return _fillData[0].toGraphicsData()[0] as IGraphicsFill;
}
public function get index():int
{
return _index;
}
public function toGraphicsData():Vector.<IGraphicsData>
{
var graphicsData:Vector.<IGraphicsData> = new Vector.<IGraphicsData>();
for each (var fillData:IGraphicsDrawable in _fillData)
{
graphicsData = graphicsData.concat(fillData.toGraphicsData());
}
return graphicsData;
}
}
} |
package flexUnitTests.as3.mongo.wire.messages.client.opupdate
{
import as3.mongo.db.document.Document;
import as3.mongo.wire.messages.MsgHeader;
import as3.mongo.wire.messages.client.OpUpdate;
public class TestOpUpdate extends OpUpdate
{
public function TestOpUpdate(aFullCollectionName:String, aFlags:int, aSelector:Document, aUpdate:Document)
{
super(aFullCollectionName, aFlags, aSelector, aUpdate);
}
public function set mockMsgHeader(value:MsgHeader):void
{
_msgHeader = value;
}
}
}
|
/*
Feathers
Copyright 2012-2015 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.core
{
/**
* Interface for tool tip management.
*
* @see ../../../help/tool-tips.html Tool tips in Feathers
* @see feathers.core.ToolTipManager
*/
public interface IToolTipManager
{
/**
* Cleans up event listeners and display objects used by the tool tip
* manager.
*/
function dispose():void;
}
}
|
/**
* PerformanceTest by Grant Skinner. Apr 21, 2009
* Visit www.gskinner.com/blog for documentation, updates and more free code.
*
*
* Copyright (c) 2009 Grant Skinner
*
* 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 performancetests {
import flash.utils.Dictionary;
public class CollectionSplice {
// Constants:
// Public Properties:
// optional property specifying the default number of iterations to run each test in the suite.
public var iterations:uint=2;
// optional property specifying a description to be used when reporting on this test suite:
public var description:String = "Testing constructing, populating, and iterating different collections."
public var methods:Array = ["tare","array", "vector", "linkedList","dictionary", "hash"];
//public var methodLabels:Array = ["", "array", "vector", "linkedList"];
// the number of elements in each collection:
public var loops:uint = 100000;
// Protected Properties:
protected var removeCount:uint = loops/10>>0;
// set up some variables used in the test:
var arr:Array;
var vec:Vector.<Number>;
var ll:LinkedList;
var dic:Dictionary;
var obj:Object;
// Initialization:
// Public getter / setters:
// Public Methods:
public function CollectionSplice() {
arr = [];
for (var i:uint=0; i<loops; i++) {
arr[i] = i/3;
}
vec = new Vector.<Number>();
for (i=0; i<loops; i++) {
vec[i] = i/3;
}
var o:LinkedList;
var old:LinkedList;
for (i=0; i<loops; i++) {
old = o;
o = new LinkedList(i/3,old);
if (old) { old.next = o; }
if (i == loops>>1) { ll = o; }
}
dic = new Dictionary();
for (i=0; i<loops; i++) {
dic[i] = true;
}
obj = {};
for (i=0; i<loops; i++) {
obj["_"+i] = true;
}
}
// tare method that will be run to calculate the base time required to run the loop
// so it can be subtracted from the other test results.
public function tare():void {
for (var i:uint=0; i<loops; i++) {
}
}
public function array():void {
for (var i:uint=0; i<removeCount; i++) {
arr.splice(i,1);
}
}
public function vector():void {
for (var i:uint=0; i<removeCount; i++) {
vec.splice(i,1);
}
}
public function linkedList():void {
var o:LinkedList = ll;
for (var i:uint=0; i<removeCount; i++) {
o.prev.next = o.next;
o.next.prev = o.prev;
o = o.next;
}
}
public function dictionary():void {
for (var i:uint=0; i<removeCount; i++) {
delete(dictionary[i]);
}
}
public function hash():void {
for (var i:uint=0; i<removeCount; i++) {
delete(hash["_"+i]);
}
}
// Protected Methods:
}
}
class LinkedList {
public var prev:LinkedList;
public var next:LinkedList;
public var value:Number;
public function LinkedList(value:Number,prev:LinkedList) {
this.value = value;
this.prev = prev;
}
} |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 Original Code is [Open Source Virtual Machine.].
*
* The Initial Developer of the Original Code is
* Adobe System Incorporated.
* Portions created by the Initial Developer are Copyright (C) 2005-2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Adobe AS3 Team
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var SECTION = "8.1";
var VERSION = "ECMA_1";
startTest();
var TITLE = "The undefined type";
writeHeaderToLog( SECTION + " "+ TITLE);
var testcases = getTestCases();
test();
function getTestCases() {
var array = new Array();
var item = 0;
var x;
array[item++] = new TestCase( SECTION,
"var x; typeof x",
"undefined",
typeof x);
var x;
array[item++] = new TestCase( SECTION,
"var x; typeof x == 'undefined",
true,
typeof x == 'undefined');
var x;
array[item++] = new TestCase( SECTION,
"var x; x == void 0",
true,
x == void 0);
return array;
}
|
package com.bojinx.utils.logging
{
public interface Logger
{
/**
* The name of the logger.
*/
function get name():String;
/**
* Logs a message with the <code>DEBUG</code> log level.
*
* @param message the log message
* @param error an optional Error instance associated with the log message.
*/
function debug( message:String, ... rest ):void;
/**
* Logs a message with the <code>ERROR</code> log level.
*
* @param message the log message
* @param error an optional Error instance associated with the log message.
*/
function error( message:String, ... rest ):void;
/**
* Logs a message with the <code>FATAL</code> log level.
*
* @param message the log message
* @param error an optional Error instance associated with the log message.
*/
function fatal( message:String, ... rest ):void;
/**
* Logs a message with the <code>INFO</code> log level.
*
* @param message the log message
* @param error an optional Error instance associated with the log message.
*/
function info( message:String, ... rest ):void;
/**
* Logs a message with the <code>TRACE</code> log level.
*
* @param message the log message
* @param error an optional Error instance associated with the log message.
*/
function trace( message:String, ... rest ):void;
/**
* Logs a message with the <code>WARN</code> log level.
*
* @param message the log message
* @param error an optional Error instance associated with the log message.
*/
function warn( message:String, ... rest ):void;
}
}
|
package raix.interactive.tests.operators.calculation
{
import raix.interactive.Enumerable;
import raix.reactive.tests.AssertEx;
[TestCase]
public class ScanFixture
{
[Test]
public function aggregates_with_accumulator_and_emits_rolling_aggregate_when_no_result_selector_specified() : void
{
AssertEx.assertArrayStrictlyEquals(
[1, 3, 6],
Enumerable.range(1, 3)
.scan(0, function(seed:int,v:int) : int { return seed + v; }).toArray());
}
[Test]
public function maps_result_through_result_selector_if_specified() : void
{
AssertEx.assertArrayStrictlyEquals(
["1!", "3!", "6!"],
Enumerable.range(1, 3).scan(0,
function(seed:int,v:int) : int { return seed + v; },
function(v:int):String { return v.toString() + "!"; }).toArray());
}
}
} |
package cmodule.lua_wrapper
{
public var gpreStaticInits:Array;
}
|
package utils.strings
{
import utils.hex.StringUtils;;
public class URLUtilsOLD
{
public static const http_symbol:String = "http";
public static const https_symbol:String = "https";
public static const file_symbol:String = "file";
public function URLUtilsOLD() {
}
public static function getFullURL(baseUrl:String,url:String):String {
var i:int = url.indexOf(URLUtilsOLD.http_symbol+"://");
if (i > -1) {
return ((i > -1) ? "" : URLUtilsOLD.protocol(baseUrl)) + "//" + url;
}
i = url.indexOf(URLUtilsOLD.https_symbol+"://");
return ((i > -1) ? "" : URLUtilsOLD.protocol(baseUrl)) + "//" + url;
}
public static function removePort(domain:String):String {
try {
var ar:Array = domain.split(':');
return ar[0];
} catch (e:Error) { }
return domain;
}
public static function domain_without_port(url:String):String {
var domain:String = URLUtilsOLD._domain(url);
return URLUtilsOLD.removePort(domain);
}
public static function domain(url:String):String {
return URLUtilsOLD.domain_without_port(url);
}
public static function domain_with_port(url:String):String {
var domain:String = URLUtilsOLD._domain(url);
return domain;
}
public static function domain_with_port_and_protocol(url:String):String {
var domain:String = URLUtilsOLD._domain(url);
var toks:Array = [];
if (domain.length > 0) {
toks = url.split(domain);
}
return ((toks.length > 0) ? toks[0] : '') + domain;
}
public static function url_prefix_sans_domain_name_and_protocol(url:String):String {
var domain_with_port_and_protocol:String = URLUtilsOLD.domain_with_port_and_protocol(url);
var toks:Array = url.replace(domain_with_port_and_protocol,'').split('?');
var toks_slash:Array = toks[0].split('/');
var toks_dot:Array = toks_slash[toks_slash.length-1].split('.');
if (toks_dot.length == 2) {
toks_slash[toks_slash.length-1] = '';
toks[0] = toks_slash.join('/');
}
return ((toks.length > 0) ? toks[0] : '');
}
public static function protocol(url:String):String {
try {
var ar:Array = url.split("/");
var i:int = ar[0].indexOf(URLUtilsOLD.http_symbol+":");
if (i > -1) {
return ar[0];
}
i = ar[0].indexOf(URLUtilsOLD.https_symbol+":");
if (i > -1) {
return ar[0];
}
i = ar[0].indexOf(URLUtilsOLD.file_symbol+":");
if (i > -1) {
return ar[0];
}
return '';
} catch (e:Error) {}
return '';
}
public static function isDomainLocal(domain:String):Boolean {
return (domain.indexOf('127.0.0.1') > -1) || (domain.indexOf('localhost') > -1);
}
public static function parse_overrides(url:String):Object {
var domain:String = URLUtilsOLD.domain_with_port_and_protocol(url);
var prefix:String = URLUtilsOLD.url_prefix_sans_domain_name_and_protocol(url);
var toks:Array = url.split('?');
toks = toks[toks.length-1].split('&');
var options:Object = {'domain':domain,'prefix':prefix}
var _toks:Array;
for (var i:String in toks) {
_toks = toks[i].split('=');
options[_toks[0]] = StringUtils.urlDecode(_toks[_toks.length-1]);
}
return options;
}
private static function _domain(url:String):String {
try {
var ar:Array = url.split("/");
var errCount:int = 0;
var numCount:int = 0;
if (ar.length > 1) {
var i:int = ar[0].indexOf(URLUtilsOLD.http_symbol+":");
numCount++;
if (i > -1) {
return ar[2];
} else {
errCount++;
}
i = ar[0].indexOf(URLUtilsOLD.https_symbol+":");
numCount++;
if (i > -1) {
return ar[2];
} else {
errCount++;
}
i = ar[0].indexOf(URLUtilsOLD.file_symbol+":");
numCount++;
if (i > -1) {
return '';
} else {
errCount++;
}
if (errCount == 3) {
return ar[0];
}
}
return '';
} catch (e:Error) {}
return '';
}
public static function maskOffCacheBuster(url:String):String {
if (url is String) {
var toks:Array = url.split('?');
toks.pop();
return toks.join('');
}
return url;
}
}
} |
package com.syndrome.sanguo.battle.mediator
{
import com.syndrome.sanguo.battle.CombatConsole;
import com.syndrome.sanguo.battle.combat_ui.card.CardManager;
import com.syndrome.sanguo.battle.combat_ui.card.cardslot.EncampmentCardSlot;
import com.syndrome.sanguo.battle.common.UserInfo;
import com.syndrome.sanguo.battle.property.CardSlotConst;
import net.IProtocolhandler;
/**
* 洗切卡组
*/
public class ShuffleCardSlotDisplay implements IProtocolhandler
{
public function ShuffleCardSlotDisplay()
{
}
public function handle(message:Object):void
{
var cardIds:Array = message["cardIds"];
var playerName:String = message["playerName"];
var encampmentCardSlot:EncampmentCardSlot;
if(UserInfo.myUserName == playerName)
{
encampmentCardSlot = CardManager.getSlotByType(CardSlotConst.encampmentCardSlot , true ) as EncampmentCardSlot ;
}
else
{
encampmentCardSlot = CardManager.getSlotByType(CardSlotConst.encampmentCardSlot , false ) as EncampmentCardSlot ;
}
CombatConsole.getInstance().addActionList([500,[encampmentCardSlot.washCampsite,cardIds]]);
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// 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 flashx.textLayout.conversion
{
import flash.system.System;
import flash.utils.getQualifiedClassName;
import flashx.textLayout.TextLayoutVersion;
import flashx.textLayout.tlf_internal;
import flashx.textLayout.debug.assert;
import flashx.textLayout.elements.Configuration;
import flashx.textLayout.elements.ContainerFormattedElement;
import flashx.textLayout.elements.FlowElement;
import flashx.textLayout.elements.FlowGroupElement;
import flashx.textLayout.elements.GlobalSettings;
import flashx.textLayout.elements.LinkElement;
import flashx.textLayout.elements.ParagraphFormattedElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TableCellElement;
import flashx.textLayout.elements.TableElement;
import flashx.textLayout.elements.TableRowElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.elements.TextRange;
import flashx.textLayout.formats.ITextLayoutFormat;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.formats.WhiteSpaceCollapse;
import flashx.textLayout.property.Property;
use namespace tlf_internal;
/**
* Base export converter for TextLayout format.
*/
public class BaseTextLayoutExporter extends ConverterBase implements ITextExporter
{
private var _rootTag:XML;
private var _ns:Namespace;
public function BaseTextLayoutExporter(ns:Namespace, rootTag:XML, configuration:ImportExportConfiguration)
{
config = configuration;
_ns = ns;
_rootTag = rootTag;
}
/**
* @copy ITextExporter#export()
*/
public function export(source:TextFlow, conversionType:String):Object
{
clear();
var result:XML = exportToXML(source);
return conversionType == ConversionType.STRING_TYPE ? convertXMLToString(result) : result;
}
/**
* Export text content of a TextFlow into XFL format.
*
* @param source the text to export
* @return XML the exported content
*/
protected function exportToXML(textFlow:TextFlow) : XML
{
var result:XML;
if (_rootTag)
{
result = new XML(_rootTag);
result.addNamespace(_ns);
result.appendChild(exportChild(textFlow));
}
else
{
result = XML(exportTextFlow(this, textFlow));
result.addNamespace(_ns);
}
return result;
}
/**
* Export text content as a string
*
* @param xml the XML to convert
* @return String the exported content
* @private
*/
static tlf_internal function convertXMLToString(xml:XML):String
{
var result:String;
// Adjust settings so that leading and trailing spaces in the XML don't get dropped when it is converted to a string
var originalSettings:Object = XML.settings();
try
{
XML.ignoreProcessingInstructions = false;
XML.ignoreWhitespace = false;
XML.prettyPrinting = false;
result = xml.toXMLString();
if (Configuration.playerEnablesArgoFeatures)
System["disposeXML"](xml);
XML.setSettings(originalSettings);
}
catch(e:Error)
{
XML.setSettings(originalSettings);
throw(e);
}
return result;
}
/**
* Base functionality for exporting a FlowElement.
*
* @param exporter Root object for the export
* @param flowElement Element to export
* @return XMLList XML for the element
*/
static public function exportFlowElement(exporter:BaseTextLayoutExporter, flowElement:FlowElement):XMLList
{
return exporter.exportFlowElement(flowElement);
}
/**
* Overridable worker method for exporting a FlowElement. Creates the XMLList.
*
* @param flowElement Element to export
* @return XMLList XML for the element
*/
protected function exportFlowElement (flowElement:FlowElement):XMLList
{
var className:String = flash.utils.getQualifiedClassName(flowElement);
var elementName:String = config.lookupName(className); // NO PMD
var output:XML = <{elementName}/>;
output.setNamespace(_ns);
return XMLList(output);
}
static public function exportSpanText(destination:XML, span:SpanElement, replacementRegex:RegExp, replacementXMLCallback:Function):void
{
//get the text for this span
var spanText:String = span.text;
// Check to see if it has text that needs to be converted
var matchLocation:Array = spanText.match(replacementRegex);
if(matchLocation)
{
var dummy:XML;
// We have text that has characters to be converted. Break it up into runs of text interspersed with elements corresponding to match these characters
while(matchLocation != null)
{
var ix:int = matchLocation.index;
var tempStr:String = spanText.substr(0, ix);
//if we have some text which does not need to be replaced, then write it now
if(tempStr.length > 0)
{
// output[0].appendChild(tempStr); // extraneous tags can appear around a string child added after an XML element: see bug 1852072
// workaround for above-mentioned bug
dummy = <dummy/>;
dummy.appendChild(tempStr); // no extraneous tags here since there is no preceding XML element sibling
destination.appendChild(dummy.text()[0]);
}
var replacementXML:XML = replacementXMLCallback(spanText.charAt(ix));
CONFIG::debug{ assert(replacementXML != null, "Specified match regex, but provided null replacement XML"); }
destination.appendChild(replacementXML);
//remove the text up to this point
spanText = spanText.slice(ix + 1, spanText.length);
//look for another character to be replaced
matchLocation = spanText.match(replacementRegex);
//if we don't have any more matches, but there is still text, write that out as the last span
if(!matchLocation && spanText.length > 0)
{
// output[0].appendChild(spanText); // extraneous tags can appear around a string child added after an XML element: see bug 1852072
// workaround for above-mentioned bug
dummy = <dummy/>;
dummy.appendChild(spanText); // no extraneous tags here since there is no preceding XML element sibling
destination.appendChild(dummy.text()[0]);
}
}
}
else
{
//this is the simple case where we don't have a character to replace
destination.appendChild(spanText);
}
}
/**
* Base functionality for exporting a Span. Exports as a FlowElement,
* and exports the text of the span.
*
* @param exporter Root object for the export
* @param span Element to export
* @return XMLList XML for the element
*/
static public function exportSpan(exporter:BaseTextLayoutExporter, span:SpanElement):XMLList
{
var output:XMLList = exportFlowElement(exporter, span);
exportSpanText(output[0], span, exporter.spanTextReplacementRegex, exporter.getSpanTextReplacementXML);
return output;
}
static private const brRegEx:RegExp = /\u2028/;
/**
* Gets the regex that specifies characters in span text to be replaced with XML elements.
* Note: Each match is a single character
*/
protected function get spanTextReplacementRegex():RegExp
{
return brRegEx;
}
/**
* Gets the xml element used to represent a character in the export format
*/
protected function getSpanTextReplacementXML(ch:String):XML
{
CONFIG::debug {assert(ch == '\u2028', "Did not recognize character to be replaced with XML"); }
var breakXML:XML = <br/>;
breakXML.setNamespace(flowNS);
return breakXML;
}
/**
* Base functionality for exporting a FlowGroupElement. Exports as a FlowElement,
* and exports the children of a element.
*
* @param exporter Root object for the export
* @param flowBlockElement Element to export
* @return XMLList XML for the element
*/
static public function exportFlowGroupElement(exporter:BaseTextLayoutExporter, flowBlockElement:FlowGroupElement):XMLList
{
var output:XMLList = exportFlowElement(exporter, flowBlockElement);
var count:int = flowBlockElement.numChildren;
// output each child
for(var index:int; index < count; ++index)
{
var flowChild:FlowElement = flowBlockElement.getChildAt(index);
var childXML:XMLList = exporter.exportChild(flowChild);
if (childXML) {
output.appendChild(childXML);
}
}
return output;
}
/**
* Base functionality for exporting a ParagraphFormattedElement. Exports as a FlowGroupElement,
* and exports paragraph attributes.
*
* @param exporter Root object for the export
* @param flowParagraph Element to export
* @return XMLList XML for the element
*/
static public function exportParagraphFormattedElement(exporter:BaseTextLayoutExporter, flowParagraph:ParagraphFormattedElement):XMLList
{
return exporter.exportParagraphFormattedElement(flowParagraph);
}
static public function exportList(exporter:BaseTextLayoutExporter, flowParagraph:ParagraphFormattedElement):XMLList
{
return exporter.exportList(flowParagraph);
}
protected function exportList(flowElement:FlowElement):XMLList
{
var result:XMLList = exportFlowElement(flowElement);
var count:int = FlowGroupElement(flowElement).numChildren;
// output each child
for(var index:int; index < count; ++index)
{
var flowChild:FlowElement = FlowGroupElement(flowElement).getChildAt(index);
result.appendChild(exportChild(flowChild));
}
return result;
}
static public function exportListItem(exporter:BaseTextLayoutExporter, flowParagraph:ParagraphFormattedElement):XMLList
{
return exporter.exportListItem(flowParagraph);
}
protected function exportListItem(flowElement:FlowElement):XMLList
{
var result:XMLList = exportFlowElement(flowElement);
var count:int = FlowGroupElement(flowElement).numChildren;
// output each child
for(var index:int; index < count; ++index)
{
var flowChild:FlowElement = FlowGroupElement(flowElement).getChildAt(index);
result.appendChild(exportChild(flowChild));
}
return result;
}
/**
* Base functionality for exporting a ContainerFormattedElement. Exports as a ParagraphFormattedElement,
* and exports container attributes.
*
* @param exporter Root object for the export
* @param container Element to export
* @return XMLList XML for the element
*/
static public function exportContainerFormattedElement(exporter:BaseTextLayoutExporter, container:ContainerFormattedElement):XMLList
{
return exporter.exportContainerFormattedElement(container);
}
/**
* Overridable worker method for exporting a ParagraphFormattedElement. Creates the XMLList.
*
* @param flowElement Element to export
* @return XMLList XML for the element
*/
protected function exportContainerFormattedElement(flowElement:FlowElement):XMLList
{
return exportParagraphFormattedElement(flowElement);
}
/**
* Base functionality for exporting a TableElement. Exports as a TableElement,
* and exports table attributes.
*
* @param exporter Root object for the export
* @param container Element to export
* @return XMLList XML for the element
*/
static public function exportTableElement(exporter:BaseTextLayoutExporter, table:TableElement):XMLList
{
return exporter.exportTableElement(table);
}
/**
* Overridable worker method for exporting a TableElement. Creates the XMLList.
*
* @param flowElement Element to export
* @return XMLList XML for the element
*/
protected function exportTableElement(tableElement:TableElement):XMLList
{
var result:XMLList = exportFlowElement(tableElement);
var count:int = tableElement.numRows;
// output each child
for(var index:int = 0; index < count; ++index)
{
var flowChild:FlowElement = tableElement.getRowAt(index);
result.appendChild(exportChild(flowChild));
}
return result;
}
/**
* Base functionality for exporting a TableRowElement. Exports as a TableRowElement,
* and exports table row attributes.
*
* @param exporter Root object for the export
* @param container Element to export
* @return XMLList XML for the element
*/
static public function exportTableRowElement(exporter:BaseTextLayoutExporter, tableRow:TableRowElement):XMLList
{
return exporter.exportTableRowElement(tableRow);
}
/**
* Overridable worker method for exporting a TableRowElement. Creates the XMLList.
*
* @param flowElement Element to export
* @return XMLList XML for the element
*/
protected function exportTableRowElement(tableRowElement:TableRowElement):XMLList
{
var result:XMLList = exportFlowElement(tableRowElement);
var count:int = tableRowElement.numCells;
// output each child
for(var index:int; index < count; ++index)
{
var flowChild:FlowElement = tableRowElement.getCellAt(index);
result.appendChild(exportChild(flowChild));
}
return result;
}
/**
* Base functionality for exporting a TableCellElement. Exports as a TableCellElement,
* and exports table cell attributes.
*
* @param exporter Root object for the export
* @param container Element to export
* @return XMLList XML for the element
*/
static public function exportTableCellElement(exporter:BaseTextLayoutExporter, tableCell:TableCellElement):XMLList
{
return exporter.exportTableCellElement(tableCell);
}
/**
* Overridable worker method for exporting a TableCellElement. Creates the XMLList.
*
* @param flowElement Element to export
* @return XMLList XML for the element
*/
protected function exportTableCellElement(tableCellElement:TableCellElement):XMLList
{
var result:XMLList = exportFlowElement(tableCellElement);
return result;
}
/**
* Overridable worker method for exporting a ParagraphFormattedElement. Creates the XMLList.
*
* @param flowElement Element to export
* @return XMLList XML for the element
*/
protected function exportParagraphFormattedElement(flowElement:FlowElement):XMLList
{
var result:XMLList = exportFlowElement(flowElement);
var count:int = ParagraphFormattedElement(flowElement).numChildren;
// output each child
for(var index:int; index < count; ++index)
{
var flowChild:FlowElement = ParagraphFormattedElement(flowElement).getChildAt(index);
result.appendChild(exportChild(flowChild));
}
return result;
}
/**
* Base functionality for exporting a TextFlow. Exports as a ContainerElement,
* and exports container attributes.
*
* @param exporter Root object for the export
* @param textFlow Element to export
* @return XMLList XML for the element
*/
static public function exportTextFlow(exporter:BaseTextLayoutExporter, textFlow:TextFlow):XMLList
{
var output:XMLList = exportContainerFormattedElement(exporter, textFlow);
if (exporter.config.whiteSpaceCollapse) {
// TextLayout will use PRESERVE on output
output.@[TextLayoutFormat.whiteSpaceCollapseProperty.name] = exporter.config.whiteSpaceCollapse;
}
// TextLayout adds version information
output.@["version"] = TextLayoutVersion.getVersionString(TextLayoutVersion.CURRENT_VERSION);
return output;
}
/**
* Exports the object. It will find the appropriate exporter and use it to
* export the object.
*
* @param exporter Root object for the export
* @param flowElement Element to export
* @return XMLList XML for the flowElement
*/
public function exportChild(flowElement:FlowElement):XMLList
{
var className:String = flash.utils.getQualifiedClassName(flowElement);
var info:FlowElementInfo = config.lookupByClass(className);
if (info != null)
return info.exporter(this, flowElement);
return null;
}
/**
* Helper function to export styles (core or user) in the form of xml attributes or xml children.
*
* @param xml object to which attributes/children are added
* @param sortableStyles an array of objects (xmlName,xmlVal) members that is sorted and exported.
*/
protected function exportStyles(xml:XMLList, sortableStyles:Array):void
{
// Sort the styles based on name for predictable export order
sortableStyles.sortOn("xmlName");
for each(var exportInfo:Object in sortableStyles)
{
var xmlVal:Object = exportInfo.xmlVal;
CONFIG::debug{ assert(useClipboardAnnotations || exportInfo.xmlName != ConverterBase.MERGE_TO_NEXT_ON_PASTE, "Found paste merge attribute in exported TextFlow"); }
/* Filter out paste attributes */
if (!useClipboardAnnotations && exportInfo.xmlName == ConverterBase.MERGE_TO_NEXT_ON_PASTE)
continue;
if (xmlVal is String)
xml.@[exportInfo.xmlName] = xmlVal; // as an attribute
else if (xmlVal is XMLList)
xml.appendChild(xmlVal); // as a child
}
}
internal function get flowNS():Namespace
{
return _ns;
}
protected function get formatDescription():Object
{
return null;
}
}
}
|
package utils.display
{
import flash.display.DisplayObject;
/**
* Moves a display object to a given x and y position.
* x and y parameters are optional and if either is omitted, the current position will not change.
*
* @author Mims Wright
*/
public function moveTo(displayObject:DisplayObject, x:Number = NaN, y:Number = NaN):void
{
if (isNaN(x)) { x = displayObject.x; }
if (isNaN(y)) { y = displayObject.y; }
displayObject.x = x;
displayObject.y = y;
}
} |
/*
Copyright (c) 2006. 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.
@ignore
*/
package flexlib.scheduling.scheduleClasses.lineRenderer
{
import flash.display.Graphics;
FLEX_TARGET_VERSION::flex4
{
import flash.geom.Point;
import flash.display.GraphicsStroke;
}
import flash.display.LineScaleMode;
import flash.geom.Rectangle;
import flexlib.scheduling.scheduleClasses.utils.GraphicUtils;
import flash.display.JointStyle;
/**
* @private
*/
public class DottedVerticalLineRenderer extends Line implements ILineRenderer
{
public function moveTo(g:Graphics, x:Number, y:Number):void
{
g.moveTo(x, y);
}
public function drawTo(g:Graphics, x:Number, y:Number):void
{
GraphicUtils.drawDottedVerticalLineTo(g, x, 0, y);
}
public function get scaleMode():String
{
return LineScaleMode.NORMAL;
}
FLEX_TARGET_VERSION::flex4
{
public function createGraphicsStroke(rect:Rectangle, targetOrigin:Point):GraphicsStroke
{
return new GraphicsStroke();
}
public function get miterLimit():Number
{
return 3;
}
public function get joints():String
{
return JointStyle.ROUND;
}
}
}
} |
package away3d.tools.commands
{
import away3d.arcane;
import away3d.entities.Mesh;
import away3d.tools.utils.Bounds;
use namespace arcane;
/**
* Class Aligns an arrays of Object3Ds, Vector3D's or Vertexes compaired to each other.<code>Align</code>
*/
public class Align {
public static const X_AXIS:String = "x";
public static const Y_AXIS:String = "y";
public static const Z_AXIS:String = "z";
public static const POSITIVE:String = "+";
public static const NEGATIVE:String = "-";
public static const AVERAGE:String = "av";
private static var _axis:String;
private static var _condition:String;
/**
* Aligns a series of meshes to their bounds along a given axis.
*
* @param meshes A Vector of Mesh objects
* @param axis Represent the axis to align on.
* @param condition Can be POSITIVE ('+') or NEGATIVE ('-'), Default is POSITIVE ('+')
*/
public static function alignMeshes(meshes:Vector.<Mesh>, axis:String, condition:String = POSITIVE):void
{
checkAxis(axis);
checkCondition(condition);
var base:Number;
var bounds:Vector.<MeshBound> = getMeshesBounds(meshes);
var i:uint;
var prop:String = getProp();
var mb:MeshBound;
var m:Mesh;
var val:Number;
switch(_condition){
case POSITIVE:
base = getMaxBounds(bounds);
for(i = 0;i<meshes.length;++i){
m = meshes[i];
mb = bounds[i];
val = m[_axis];
val -= base - mb[prop]+m[_axis];
m[_axis] = -val;
bounds[i] = null;
}
break;
case NEGATIVE:
base = getMinBounds(bounds);
for(i = 0;i<meshes.length;++i){
m = meshes[i];
mb = bounds[i];
val = m[_axis];
val -= base + mb[prop]+m[_axis];
m[_axis] = -val;
bounds[i] = null;
}
}
bounds = null;
}
/**
* Place one or more meshes at y 0 using their min bounds
*/
public static function alignToFloor(meshes:Vector.<Mesh>):void
{
if(meshes.length == 0) return;
for(var i:uint = 0;i<meshes.length;++i){
Bounds.getMeshBounds(meshes[i]);
meshes[i].y = Bounds.minY+ (Bounds.maxY - Bounds.minY);
}
}
/**
* Applies to array elements the alignment according to axis, x, y or z and a condition.
* each element must have public x,y and z properties. In case elements are meshes only their positions is affected. Method doesn't take in account their respective bounds
* String condition:
* "+" align to highest value on a given axis
* "-" align to lowest value on a given axis
* "" align to a given axis on 0; This is the default.
* "av" align to average of all values on a given axis
*
* @param aObjs Array. An array with elements with x,y and z public properties such as Mesh, Object3D, ObjectContainer3D,Vector3D or Vertex
* @param axis String. Represent the axis to align on.
* @param condition [optional]. String. Can be '+", "-", "av" or "", Default is "", aligns to given axis at 0.
*/
public static function align(aObjs:Array, axis:String, condition:String = ""):void
{
checkAxis(axis);
checkCondition(condition);
var base:Number;
switch(_condition){
case POSITIVE:
base = getMax(aObjs, _axis);
break;
case NEGATIVE:
base = getMin(aObjs, _axis);
break;
case AVERAGE:
base = getAverage(aObjs, _axis);
break;
case "":
base = 0;
}
for(var i:uint = 0;i<aObjs.length;++i)
aObjs[i][_axis] = base;
}
/**
* Applies to array elements a distributed alignment according to axis, x,y or z. In case elements are meshes only their positions is affected. Method doesn't take in account their respective bounds
* each element must have public x,y and z properties
* @param aObjs Array. An array with elements with x,y and z public properties such as Mesh, Object3D, ObjectContainer3D,Vector3D or Vertex
* @param axis String. Represent the axis to align on.
*/
public static function distribute(aObjs:Array, axis:String):void
{
checkAxis(axis);
var max:Number = getMax(aObjs, _axis);
var min:Number = getMin(aObjs, _axis);
var unit:Number = (max - min) / aObjs.length;
aObjs.sortOn(axis, 16);
var step:Number = 0;
for(var i:uint = 0;i<aObjs.length;++i){
aObjs[i][_axis] = min+step;
step+=unit;
}
}
private static function checkAxis(axis:String):void
{
axis = axis.substring(0, 1).toLowerCase();
if(axis == X_AXIS || axis == Y_AXIS || axis == Z_AXIS){
_axis = axis;
return;
}
throw new Error("Invalid axis: string value must be 'x', 'y' or 'z'");
}
private static function checkCondition(condition:String):void
{
condition = condition.toLowerCase();
var aConds:Array = [POSITIVE, NEGATIVE, "", AVERAGE];
for(var i:uint = 0;i<aConds.length;++i){
if(aConds[i] == condition){
_condition = condition;
return;
}
}
throw new Error("Invalid condition: possible string value are '+', '-', 'av' or '' ");
}
private static function getMin(a:Array, prop:String):Number
{
var min:Number = Infinity;
for(var i:uint = 0;i<a.length;++i)
min = Math.min(a[i][prop], min);
return min;
}
private static function getMax(a:Array, prop:String):Number
{
var max:Number = -Infinity;
for(var i:uint = 0;i<a.length;++i)
max = Math.max(a[i][prop], max);
return max;
}
private static function getAverage(a:Array, prop:String):Number
{
var av:Number = 0;
var loop:int = a.length;
for(var i:uint = 0;i<loop;++i)
av += a[i][prop];
return av/loop;
}
private static function getMeshesBounds(meshes:Vector.<Mesh>):Vector.<MeshBound>
{
var mbs:Vector.<MeshBound> = new Vector.<MeshBound>();
var mb:MeshBound;
for(var i:uint = 0;i<meshes.length;++i){
Bounds.getMeshBounds(meshes[i]);
mb = new MeshBound();
mb.mesh = meshes[i];
mb.minX = Bounds.minX;
mb.minY = Bounds.minY;
mb.minZ = Bounds.minZ;
mb.maxX = Bounds.maxX;
mb.maxY = Bounds.maxY;
mb.maxZ = Bounds.maxZ;
mbs.push(mb);
}
return mbs;
}
private static function getProp():String
{
var prop:String;
switch(_axis){
case X_AXIS:
prop = (_condition == POSITIVE)? "maxX" : "minX";
break;
case Y_AXIS:
prop = (_condition == POSITIVE)? "maxY" : "minY";
break;
case Z_AXIS:
prop = (_condition == POSITIVE)? "maxZ" : "minZ";
}
return prop;
}
private static function getMinBounds(bounds:Vector.<MeshBound>):Number
{
var min:Number = Infinity;
var mb:MeshBound;
for(var i:uint = 0;i<bounds.length;++i){
mb = bounds[i];
switch(_axis){
case X_AXIS:
min = Math.min(mb.maxX+mb.mesh.x, min);
break;
case Y_AXIS:
min = Math.min(mb.maxY+mb.mesh.y, min);
break;
case Z_AXIS:
min = Math.min(mb.maxZ+mb.mesh.z, min);
}
}
return min;
}
private static function getMaxBounds(bounds:Vector.<MeshBound>):Number
{
var max:Number = -Infinity;
var mb:MeshBound;
for(var i:uint = 0;i<bounds.length;++i){
mb = bounds[i];
switch(_axis){
case X_AXIS:
max = Math.max(mb.maxX+mb.mesh.x, max);
break;
case Y_AXIS:
max = Math.max(mb.maxY+mb.mesh.y, max);
break;
case Z_AXIS:
max = Math.max(mb.maxZ+mb.mesh.z, max);
}
}
return max;
}
}
}
class MeshBound {
import away3d.entities.Mesh;
public var mesh:Mesh;
public var minX:Number;
public var minY:Number;
public var minZ:Number;
public var maxX:Number;
public var maxY:Number;
public var maxZ:Number;
} |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import avmplus.System;
import com.adobe.test.Assert;
import com.adobe.test.Utils;
// var SECTION = "regress_654807";
// var VERSION = "AS3";
// var TITLE = "SealedArray";
// var bug = "654807";
// standard Assert.expectError function doesn't handle no-error well.
function MyTestCase(desc:String, expected:String, testFunc:Function)
{
try {
var actual = testFunc();
Assert.expectEq(desc, expected, String(actual));
} catch (e) {
actualErr = e;
Utils.grabError(actualErr, expected);
Assert.expectEq(desc, expected, String(actualErr).substr(0, expected.length));
}
}
class SealedArray extends Array {}
dynamic class DynamicArray extends Array {}
dynamic class DynamicSealedArray extends SealedArray {}
class SealedDynamicArray extends DynamicArray {}
function run_tests(b:Array, mode:String)
{
// idiom "String(b.concat())" is used to create a copy of the
// possibly-subclass-of-Array, since toString may not work on the subclass
MyTestCase(mode+" get_length",
"0",
function() { var r = b.length; return String(r); });
MyTestCase(mode+" push",
{ dynamic:"0,1,2", semisealed:"0,1,2", sealed:"ReferenceError: Error #1056"}[mode],
function() { b.push(0,1,2); return String(b.concat()); });
MyTestCase(mode+" get_length",
{ dynamic:"3", semisealed:"3", sealed:"0"}[mode],
function() { var r = b.length; return String(r); });
MyTestCase(mode+" unshift",
{ dynamic:"4,5,6,0,1,2", semisealed:"4,5,6,0,1,2", sealed:"ReferenceError: Error #1056"}[mode],
function() { b.unshift(4,5,6); return String(b.concat()); });
MyTestCase(mode+" get_length",
{ dynamic:"6", semisealed:"6", sealed:"0"}[mode],
function() { var r = b.length; return String(r); });
MyTestCase(mode+" concat",
{ dynamic:"4,5,6,0,1,2,4,5,6,0,1,2", semisealed:"4,5,6,0,1,2,4,5,6,0,1,2", sealed:""}[mode],
function() { var r = b.concat(b); return String(r.concat()); });
MyTestCase(mode+" get_length",
{ dynamic:"6", semisealed:"6", sealed:"0"}[mode],
function() { var r = b.length; return String(r); });
MyTestCase(mode+" reverse",
{ dynamic:"2,1,0,6,5,4", semisealed:"2,1,0,6,5,4", sealed:""}[mode],
function() { b.reverse(); return String(b.concat()); });
MyTestCase(mode+" get_length",
{ dynamic:"6", semisealed:"6", sealed:"0"}[mode],
function() { var r = b.length; return String(r); });
MyTestCase(mode+" shift",
{ dynamic:"2:1,0,6,5,4", semisealed:"2:1,0,6,5,4", sealed:"undefined:"}[mode],
function() { var r = b.shift(); return String(r) + ":" + String(b.concat()); });
MyTestCase(mode+" get_length",
{ dynamic:"5", semisealed:"5", sealed:"0"}[mode],
function() { var r = b.length; return String(r); });
// splice fails differently when delCount == 0 vs delCount > 0
MyTestCase(mode+" splice",
{ dynamic:"9,1,0,6,5,4", semisealed:"9,1,0,6,5,4", sealed:"ReferenceError: Error #1056"}[mode],
function() { b.splice(0, 0, 9); return String(b.concat()); });
MyTestCase(mode+" get_length",
{ dynamic:"6", semisealed:"6", sealed:"0"}[mode],
function() { var r = b.length; return String(r); });
MyTestCase(mode+" pop",
{ dynamic:"4:9,1,0,6,5", semisealed:"4:9,1,0,6,5", sealed:"undefined:"}[mode],
function() { var r = b.pop(); return String(r) + ":" + String(b.concat()); });
MyTestCase(mode+" get_length",
{ dynamic:"5", semisealed:"5", sealed:"0"}[mode],
function() { var r = b.length; return String(r); });
MyTestCase(mode+" set_length",
{ dynamic:"3:9,1,0", semisealed:"5:9,1,0,6,5", sealed:"0:"}[mode],
function() { b.length = 3; var r = b.length; return String(r) + ":" + String(b.concat()); });
MyTestCase(mode+" getprop",
{ dynamic:"9", semisealed:"ReferenceError: Error #1069", sealed:"ReferenceError: Error #1069"}[mode],
function() { return b[0]; });
MyTestCase(mode+" setprop",
{ dynamic:"undefined", semisealed:"ReferenceError: Error #1056", sealed:"ReferenceError: Error #1056"}[mode],
function() { b[0] = 44; });
MyTestCase(mode+" hasprop",
{ dynamic:"true", semisealed:"false", sealed:"false"}[mode],
function() { return b.hasOwnProperty(0); });
MyTestCase(mode+" delprop",
{ dynamic:"true", semisealed:"false", sealed:"false"}[mode],
function() { return delete b[0]; });
// splice fails differently when delCount == 0 vs delCount > 0
MyTestCase(mode+" splice",
{ dynamic:"9,1,0", semisealed:"ReferenceError: Error #1069", sealed:"ReferenceError: Error #1056"}[mode],
function() { b.splice(0, 1, 9); return String(b.concat()); });
MyTestCase(mode+" join",
{ dynamic:"9~1~0", semisealed:"ReferenceError: Error #1069", sealed:""}[mode],
function() { return String(b.join("~")); });
MyTestCase(mode+" toString",
{ dynamic:"9,1,0", semisealed:"ReferenceError: Error #1069", sealed:""}[mode],
function() { return b.toString(); });
MyTestCase(mode+" toLocaleString",
{ dynamic:"9,1,0", semisealed:"ReferenceError: Error #1069", sealed:""}[mode],
function() { return b.toLocaleString(); });
MyTestCase(mode+" sort",
{ dynamic:"0,1,9", semisealed:"ReferenceError: Error #1069", sealed:""}[mode],
function() { return String(b.sort(Array.NUMERIC)); });
MyTestCase(mode+" indexOf",
{ dynamic:"2", semisealed:"ReferenceError: Error #1069", sealed:"-1"}[mode],
function() { return String(b.indexOf(9)); });
MyTestCase(mode+" lastIndexOf",
{ dynamic:"2", semisealed:"ReferenceError: Error #1069", sealed:"-1"}[mode],
function() { return String(b.lastIndexOf(9)); });
MyTestCase(mode+" every",
{ dynamic:"true", semisealed:"ReferenceError: Error #1069", sealed:"true"}[mode],
function() { return String(b.every( function(i) { return true; } )); });
MyTestCase(mode+" filter",
{ dynamic:"0,9", semisealed:"ReferenceError: Error #1069", sealed:""}[mode],
function() { return String(b.filter( function(i) { return i != 1; } )); });
MyTestCase(mode+" forEach",
{ dynamic:"undefined", semisealed:"ReferenceError: Error #1069", sealed:"undefined"}[mode],
function() { return String(b.forEach( function(i) { } )); });
MyTestCase(mode+" some",
{ dynamic:"true", semisealed:"ReferenceError: Error #1069", sealed:"false"}[mode],
function() { return String(b.some( function(i) { return true } )); });
MyTestCase(mode+" map",
{ dynamic:"1,2,10", semisealed:"ReferenceError: Error #1069", sealed:""}[mode],
function() { return String(b.map( function(i) { return i+1 } )); });
MyTestCase(mode+" for...in",
{ dynamic:"0,1,2,", semisealed:"0,1,2,3,4,", sealed:""}[mode],
function() { var s = ""; for (var i in b) { s += String(i) + ","; } return s; });
MyTestCase(mode+" for each...in",
{ dynamic:"0,1,9,", semisealed:"9,1,0,6,5,", sealed:""}[mode],
function() { var s = ""; for each (var i in b) { s += String(i) + ","; } return s; });
}
run_tests(new Array, "dynamic");
run_tests(new SealedArray, System.swfVersion < 13 ? "semisealed" : "sealed");
run_tests(new DynamicArray, "dynamic");
run_tests(new DynamicSealedArray, "dynamic");
run_tests(new SealedDynamicArray, System.swfVersion < 13 ? "semisealed" : "sealed");
|
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package spark.components.supportClasses
{
import flash.display.DisplayObject;
import mx.core.FlexVersion;
import mx.core.UIComponent;
import mx.core.mx_internal;
import spark.components.Group;
import spark.core.DisplayObjectSharingMode;
import spark.core.IGraphicElement;
import spark.skins.IHighlightBitmapCaptureClient;
use namespace mx_internal;
/**
* The Skin class defines the base class for all skins used by skinnable components.
* The SkinnableComponent class defines the base class for skinnable components.
*
* <p>You typically write the skin classes in MXML, as the followiong example shows:</p>
*
* <pre> <?xml version="1.0"?>
* <Skin xmlns="http://ns.adobe.com/mxml/2009">
*
* <Metadata>
* <!-- Specify the component that uses this skin class. -->
* [HostComponent("my.component.MyComponent")]
* </Metadata>
*
* <states>
* <!-- Specify the states controlled by this skin. -->
* </states>
*
* <!-- Define skin. -->
*
* </Skin></pre>
*
* @see mx.core.SkinnableComponent
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public class Skin extends Group implements IHighlightBitmapCaptureClient
{
include "../../core/Version.as";
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public function Skin()
{
super();
}
/**
* List of id's of items that should be excluded when rendering the focus ring.
* Only items of type DisplayObject or GraphicElement should be excluded. Items
* of other types will be ignored.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public function get focusSkinExclusions():Array
{
return null;
}
private static var exclusionAlphaValues:Array;
/**
* Called before a bitmap capture is made for this skin. The default implementation
* excludes items in the <code>focusSkinExclusions</code> array.
*
* @return <code>true</code> if the component must be redrawn. Otherwise, <code>false</code>.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public function beginHighlightBitmapCapture():Boolean
{
var exclusions:Array = focusSkinExclusions;
if (!exclusions)
{
if (("hostComponent" in this) && this["hostComponent"] is SkinnableComponent)
exclusions = SkinnableComponent(this["hostComponent"]).suggestedFocusSkinExclusions;
}
var exclusionCount:Number = (exclusions == null) ? 0 : exclusions.length;
/* we'll store off the previous alpha of the exclusions so we
can restore them when we're done
*/
exclusionAlphaValues = [];
var needRedraw:Boolean = false;
for (var i:int = 0; i < exclusionCount; i++)
{
// skip if the part isn't there
if (!(exclusions[i] in this))
continue;
var ex:Object = this[exclusions[i]];
/* we're going to go under the covers here to try and modify alpha with the least
amount of disruption to the component. For UIComponents, we go to Sprite's alpha property;
*/
if (ex is UIComponent)
{
exclusionAlphaValues[i] = (ex as UIComponent).$alpha;
(ex as UIComponent).$alpha = 0;
}
else if (ex is DisplayObject)
{
exclusionAlphaValues[i] = (ex as DisplayObject).alpha;
(ex as DisplayObject).alpha = 0;
}
else if (ex is IGraphicElement)
{
/* if we're lucky, the IGE has its own DisplayObject, and we can just trip its alpha.
If not, we're going to have to set it to 0, and force a redraw of the whole component */
var ge:IGraphicElement = ex as IGraphicElement;
if (ge.displayObjectSharingMode == DisplayObjectSharingMode.OWNS_UNSHARED_OBJECT)
{
exclusionAlphaValues[i] = ge.displayObject.alpha;
ge.displayObject.alpha = 0;
}
else
{
exclusionAlphaValues[i] = ge.alpha;
ge.alpha = 0;
needRedraw = true;
}
}
}
/* if we excluded an IGE without its own DO, we need to update the component before grabbing the bitmap */
return needRedraw;
}
/**
* Called after a bitmap capture is made for this skin. The default implementation
* restores the items in the <code>focusSkinExclusions</code> array.
*
* @return <code>true</code> if the component must be redrawn. Otherwise, <code>false</code>.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
public function endHighlightBitmapCapture():Boolean
{
var exclusions:Array = focusSkinExclusions;
if (!exclusions)
{
if ("hostComponent" in this && this["hostComponent"] is SkinnableComponent)
exclusions = SkinnableComponent(this["hostComponent"]).suggestedFocusSkinExclusions;
}
var exclusionCount:Number = (exclusions == null) ? 0 : exclusions.length;
var needRedraw:Boolean = false;
for (var i:int=0; i < exclusionCount; i++)
{
// skip if the part isn't there
if (!(exclusions[i] in this))
continue;
var ex:Object = this[exclusions[i]];
if (ex is UIComponent)
{
(ex as UIComponent).$alpha = exclusionAlphaValues[i];
}
else if (ex is DisplayObject)
{
(ex as DisplayObject).alpha = exclusionAlphaValues[i];
}
else if (ex is IGraphicElement)
{
var ge:IGraphicElement = ex as IGraphicElement;
if (ge.displayObjectSharingMode == DisplayObjectSharingMode.OWNS_UNSHARED_OBJECT)
{
ge.displayObject.alpha = exclusionAlphaValues[i];
}
else
{
ge.alpha = exclusionAlphaValues[i];
needRedraw = true;
}
}
}
exclusionAlphaValues = null;
return needRedraw;
}
/**
* @private
*/
override protected function initializeAccessibility():void
{
// Do nothing. Skins shouldn't support accessibility
}
/**
* @private
* Make the component's explicitMinWidth property override its skin's.
* This is useful for cases where the skin's minWidth constrains
* the skin's measured size. In those cases the user could set
* explicit limits on the component itself thus relaxing the
* hard-coded limits in the skin. See SDK-24741.
*/
override public function get explicitMinWidth():Number
{
if (parent is SkinnableComponent)
{
var parentExplicitMinWidth:Number = SkinnableComponent(parent).explicitMinWidth;
if (!isNaN(parentExplicitMinWidth))
return parentExplicitMinWidth;
}
return super.explicitMinWidth;
}
/**
* @private
* Make the component's explicitMinWidth property override its skin's.
* This is useful for cases where the skin's minWidth constrains
* the skin's measured size. In those cases the user could set
* explicit limits on the component itself thus relaxing the
* hard-coded limits in the skin. See SDK-24741.
*/
override public function get explicitMinHeight():Number
{
if (parent is SkinnableComponent)
{
var parentExplicitMinHeight:Number = SkinnableComponent(parent).explicitMinHeight;
if (!isNaN(parentExplicitMinHeight))
return parentExplicitMinHeight;
}
return super.explicitMinHeight;
}
/**
* @private
* Make the component's explicitMinWidth property override its skin's.
* This is useful for cases where the skin's minWidth constrains
* the skin's measured size. In those cases the user could set
* explicit limits on the component itself thus relaxing the
* hard-coded limits in the skin. See SDK-24741.
*/
override public function get explicitMaxWidth():Number
{
if (parent is SkinnableComponent)
{
var parentExplicitMaxWidth:Number = SkinnableComponent(parent).explicitMaxWidth;
if (!isNaN(parentExplicitMaxWidth))
return parentExplicitMaxWidth;
}
return super.explicitMaxWidth;
}
/**
* @private
* Make the component's explicitMinWidth property override its skin's.
* This is useful for cases where the skin's minWidth constrains
* the skin's measured size. In those cases the user could set
* explicit limits on the component itself thus relaxing the
* hard-coded limits in the skin. See SDK-24741.
*/
override public function get explicitMaxHeight():Number
{
if (parent is SkinnableComponent)
{
var parentExplicitMaxHeight:Number = SkinnableComponent(parent).explicitMaxHeight;
if (!isNaN(parentExplicitMaxHeight))
return parentExplicitMaxHeight;
}
return super.explicitMaxHeight;
}
/**
* @private
*/
override protected function canSkipMeasurement():Boolean
{
if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_4_5)
{
return super.canSkipMeasurement();
}
// Explicit width/height on the skin should mean "the default size".
// As such, we should still measure so that we get correct measuredWidth,
// measuredHeight, measuredMinWidth, measuredMinHeight.
// Look at the SkinnableComponent's measure() to see how these are used.
return false;
}
}
}
|
/*
* SmartFoxServer PRO
* Simple H2 database example
* v 1.0.0
*
* (c) 2007 gotoAndPlay()
*
* SQL code used for creating the test db table:
*
* CREATE TABLE retrocomputers (
* ID INT AUTO_INCREMENT PRIMARY KEY,
* BRAND VARCHAR(120),
* MODEL VARCHAR(200),
* CPU VARCHAR(100),
* RAM VARCHAR(50)
* )
*
*/
// a global variable
var dbase
/*
* Initializion point:
*
* this function is called as soon as the extension
* is loaded in the server.
*
* You can add here all the initialization code
*
*/
function init()
{
trace("Initing dbExtension")
// get a reference to the database manager object
// This will let you interact the database configure for this zone
dbase = _server.getDatabaseManager()
}
/*
* This method is called by the server when an extension
* is being removed / destroyed.
*
* Always make sure to release resources like setInterval(s)
* open files etc in this method.
*
* In this case we delete the reference to the databaseManager
*/
function destroy()
{
// Release the reference to the dbase manager
delete dbase
}
/*
*
* Handle Client Requests
*
* cmd = a string with the client command to execute
* params = list of parameters expected from the client
* user = the User object representing the sender
* fromRoom = the id of the room where the request was generated
*
*/
function handleRequest(cmd, params, user, fromRoom)
{
if (cmd == "getList")
{
sendComputerList(user)
}
}
function sendComputerList(user)
{
var sql = "SELECT * FROM retrocomputers ORDER BY BRAND"
// execute query on DB
// queryRes is a ResultSet object
var queryRes = dbase.executeQuery(sql)
if (queryRes != null)
{
var response = {}
response._cmd = "getList"
/*
* Here's the new SmartFoxServer 1.6 framework update:
* You can pass the query ResultSet DIRECTLY to the send response
* which will serialize the record set behind the scenes!
*/
response.list = queryRes
_server.sendResponse(response, -1, null, [user])
}
}
/*
* This method handles internal events
* Internal events are dispactched by the Zone or Room where the extension is attached to
*
* the (evt) object
*/
function handleInternalEvent(evt)
{
// Code for handling events goes here...
}
|
////////////////////////////////////////////////////////////////////////////////
//
// 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 flexUnitTests.reflection.support
{
public class TestClass5
{
//Note: do not change this test class unless you change the related tests to
//support any changes that might appear when testing reflection into it
public function TestClass5(){
}
[TestMeta(foo="instanceMethod")]
public function method():void{
}
[TestMeta(foo="instanceMethod")]
public function methodWithArgs(mandatory:String,optional:Boolean=true):void{
}
[TestMeta(foo="instanceVariable")]
public var testVar:String;
[TestMeta(foo="instanceAccessor")]
public function get testGetter():String{
return null
}
[TestMeta(foo="instanceAccessor")]
public function set testSetter(value:String):void{
}
[TestMeta(foo="staticMethod")]
public static function method():void{
}
[TestMeta(foo="staticMethod")]
public static function methodWithArgs(mandatory:String,optional:Boolean=true):void{
}
[TestMeta(foo="staticVariable")]
public static var testVar:String;
[TestMeta(foo="staticAccessor")]
public static function get testGetter():String{
return null
}
[TestMeta(foo="staticAccessor")]
public static function set testSetter(value:String):void{
}
}
}
|
/*
Feathers
Copyright 2012-2014 Joshua Tynjala. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/
package feathers.core
{
import flash.utils.Proxy;
import flash.utils.flash_proxy;
/**
* Detects when its own properties have changed and dispatches an event
* to notify listeners.
*
* <p>Supports nested <code>PropertyProxy</code> instances using attribute
* <code>@</code> notation. Placing an <code>@</code> before a property name
* is like saying, "If this nested <code>PropertyProxy</code> doesn't exist
* yet, create one. If it does, use the existing one."</p>
*/
public final dynamic class PropertyProxy extends Proxy
{
/**
* Creates a <code>PropertyProxy</code> from a regular old <code>Object</code>.
*/
public static function fromObject(source:Object, onChangeCallback:Function = null):PropertyProxy
{
const newValue:PropertyProxy = new PropertyProxy(onChangeCallback);
for(var propertyName:String in source)
{
newValue[propertyName] = source[propertyName];
}
return newValue;
}
/**
* Constructor.
*/
public function PropertyProxy(onChangeCallback:Function = null)
{
if(onChangeCallback != null)
{
this._onChangeCallbacks[this._onChangeCallbacks.length] = onChangeCallback;
}
}
/**
* @private
*/
private var _subProxyName:String;
/**
* @private
*/
private var _onChangeCallbacks:Vector.<Function> = new <Function>[];
/**
* @private
*/
private var _names:Array = [];
/**
* @private
*/
private var _storage:Object = {};
/**
* @private
*/
override flash_proxy function hasProperty(name:*):Boolean
{
return this._storage.hasOwnProperty(name);
}
/**
* @private
*/
override flash_proxy function getProperty(name:*):*
{
if(this.flash_proxy::isAttribute(name))
{
const nameAsString:String = name is QName ? QName(name).localName : name.toString();
if(!this._storage.hasOwnProperty(nameAsString))
{
const subProxy:PropertyProxy = new PropertyProxy(subProxy_onChange);
subProxy._subProxyName = nameAsString;
this._storage[nameAsString] = subProxy;
this._names[this._names.length] = nameAsString;
this.fireOnChangeCallback(nameAsString);
}
return this._storage[nameAsString];
}
return this._storage[name];
}
/**
* @private
*/
override flash_proxy function setProperty(name:*, value:*):void
{
const nameAsString:String = name is QName ? QName(name).localName : name.toString();
this._storage[nameAsString] = value;
if(this._names.indexOf(nameAsString) < 0)
{
this._names[this._names.length] = nameAsString;
}
this.fireOnChangeCallback(nameAsString);
}
/**
* @private
*/
override flash_proxy function deleteProperty(name:*):Boolean
{
var nameAsString:String = name is QName ? QName(name).localName : name.toString();
var index:int = this._names.indexOf(nameAsString);
if(index == 0)
{
this._names.shift();
}
else
{
var lastIndex:int = this._names.length - 1;
if(index == lastIndex)
{
this._names.pop();
}
else
{
this._names.splice(index, 1);
}
}
var result:Boolean = delete this._storage[nameAsString];
if(result)
{
this.fireOnChangeCallback(nameAsString);
}
return result;
}
/**
* @private
*/
override flash_proxy function nextNameIndex(index:int):int
{
if(index < this._names.length)
{
return index + 1;
}
return 0;
}
/**
* @private
*/
override flash_proxy function nextName(index:int):String
{
return this._names[index - 1];
}
/**
* @private
*/
override flash_proxy function nextValue(index:int):*
{
const name:* = this._names[index - 1];
return this._storage[name];
}
/**
* Adds a callback to react to property changes.
*/
public function addOnChangeCallback(callback:Function):void
{
this._onChangeCallbacks[this._onChangeCallbacks.length] = callback;
}
/**
* Removes a callback.
*/
public function removeOnChangeCallback(callback:Function):void
{
var index:int = this._onChangeCallbacks.indexOf(callback);
if(index < 0)
{
return;
}
if(index == 0)
{
this._onChangeCallbacks.shift();
return;
}
var lastIndex:int = this._onChangeCallbacks.length - 1;
if(index == lastIndex)
{
this._onChangeCallbacks.pop();
return;
}
this._onChangeCallbacks.splice(index, 1);
}
/**
* @private
*/
private function fireOnChangeCallback(forName:String):void
{
const callbackCount:int = this._onChangeCallbacks.length;
for(var i:int = 0; i < callbackCount; i++)
{
var callback:Function = this._onChangeCallbacks[i] as Function;
callback(this, forName);
}
}
/**
* @private
*/
private function subProxy_onChange(proxy:PropertyProxy, name:String):void
{
this.fireOnChangeCallback(proxy._subProxyName);
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// 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 flash.utils.*;
import mx.controls.Image;
import mx.preloaders.*;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
public class LabelProgressBar extends mx.preloaders.DownloadProgressBar
{
public function LabelProgressBar()
{
super();
}
override public function initialize():void
{
super.initialize();
initializingLabel='Initializing Label...'
MINIMUM_DISPLAY_TIME = 2000;
}
override protected function showDisplayForInit(elapsedTime:int, count:int):Boolean
{
return true;
}
override protected function showDisplayForDownloading(elapsedTime:int,
event:ProgressEvent):Boolean
{
return true;
}
}
} |
// =================================================================================================
//
// CadetEngine Framework
// Copyright 2012 Unwrong Ltd. 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 cadet2DBox2D.components.behaviours
{
import flash.events.Event;
import flash.geom.Point;
import Box2D.Common.Math.b2Vec2;
import Box2D.Dynamics.Joints.b2DistanceJointDef;
import Box2D.Dynamics.Joints.b2Joint;
import cadet.core.Component;
import cadet.events.ComponentEvent;
import cadet.events.ValidationEvent;
import cadet.util.ComponentUtil;
import cadet2D.components.connections.Connection;
import cadet2DBox2D.components.processes.PhysicsProcess;
public class DistanceJointBehaviour extends Component implements IJoint
{
// Invalidation types
private static const JOINT :String = "joint";
private static const BEHAVIOURS :String = "behaviours";
protected var _connection :Connection;
protected var _physicsProcess :PhysicsProcess;
protected var joint :b2Joint;
protected var physicsBehaviourA :RigidBodyBehaviour;
protected var physicsBehaviourB :RigidBodyBehaviour;
[Serializable]
public var length :Number = -1;
[Serializable][Inspectable]
public var damping :Number = 0.5;
[Serializable][Inspectable]
public var collideConnected :Boolean = true;
public function DistanceJointBehaviour()
{
name = "DistanceJointBehaviour";
}
override protected function addedToScene():void
{
addSiblingReference(Connection, "connection");
addSceneReference(PhysicsProcess, "physicsProcess");
}
override protected function removedFromScene():void
{
destroyJoint();
}
public function set connection( value:Connection ):void
{
destroyJoint();
if ( _connection )
{
_connection.removeEventListener(ComponentEvent.ADDED_TO_PARENT, connectionChangeHandler);
_connection.removeEventListener(ComponentEvent.REMOVED_FROM_PARENT, connectionChangeHandler);
_connection.removeEventListener(ValidationEvent.INVALIDATE, connectionChangeHandler);
}
_connection = value;
if ( _connection )
{
_connection.addEventListener(ComponentEvent.ADDED_TO_PARENT, connectionChangeHandler);
_connection.addEventListener(ComponentEvent.REMOVED_FROM_PARENT, connectionChangeHandler);
_connection.addEventListener(ValidationEvent.INVALIDATE, connectionChangeHandler);
}
invalidate(BEHAVIOURS);
invalidate(JOINT);
}
public function get connection():Connection { return _connection; }
public function set physicsProcess( value:PhysicsProcess ):void
{
destroyJoint();
if ( _physicsProcess )
{
_physicsProcess.removeEventListener(ValidationEvent.INVALIDATE, invalidatePhysicsProcessHandler);
}
_physicsProcess = value;
if ( _physicsProcess )
{
_physicsProcess.addEventListener(ValidationEvent.INVALIDATE, invalidatePhysicsProcessHandler);
}
invalidate(JOINT);
}
public function get physicsProcess():PhysicsProcess { return _physicsProcess; }
private function invalidatePhysicsProcessHandler( event:ValidationEvent ):void
{
invalidate(JOINT);
}
private function connectionChangeHandler( event:Event ):void
{
invalidate(BEHAVIOURS);
}
protected function destroyJoint():void
{
if ( !joint ) return;
if ( !_physicsProcess ) return;
_physicsProcess.destroyJoint( joint );
joint = null;
}
protected function validateBehaviours():void
{
if ( !_connection )
{
physicsBehaviourA = null;
physicsBehaviourB = null;
return;
}
if ( !_connection.transformA ) return;
if ( !_connection.transformB ) return;
if ( !_connection.transformA.parentComponent ) return;
if ( !_connection.transformB.parentComponent ) return;
physicsBehaviourA = ComponentUtil.getChildOfType( _connection.transformA.parentComponent, RigidBodyBehaviour );
physicsBehaviourB = ComponentUtil.getChildOfType( _connection.transformB.parentComponent, RigidBodyBehaviour );
}
protected function validateJoint():void
{
if ( !_scene ) return;
if ( !physicsBehaviourA ) return
if ( !physicsBehaviourB ) return
if ( !_physicsProcess ) return
physicsBehaviourA.validateNow();
physicsBehaviourB.validateNow();
var jointDef:b2DistanceJointDef = new b2DistanceJointDef();
jointDef.dampingRatio = damping;
jointDef.collideConnected = collideConnected;
jointDef.frequencyHz = 0.5;
var pt1:Point = _connection.transformA.matrix.transformPoint( connection.localPosA.toPoint() );
var pt2:Point = _connection.transformB.matrix.transformPoint( connection.localPosB.toPoint() );
var posA:b2Vec2 = new b2Vec2( pt1.x * _physicsProcess.scaleFactor, pt1.y * _physicsProcess.scaleFactor );
var posB:b2Vec2 = new b2Vec2( pt2.x * _physicsProcess.scaleFactor, pt2.y * _physicsProcess.scaleFactor );
jointDef.Initialize( physicsBehaviourA.getBody(), physicsBehaviourB.getBody(), posA, posB );
if ( length != -1 ) jointDef.length = length;
joint = _physicsProcess.createJoint( jointDef );
}
override public function validateNow():void
{
if ( isInvalid( BEHAVIOURS ) )
{
validateBehaviours();
}
if ( isInvalid( JOINT ) )
{
validateJoint();
}
super.validateNow();
}
}
} |
package feathers.examples.tileList
{
import feathers.controls.Button;
import feathers.controls.List;
import feathers.controls.PageIndicator;
import feathers.controls.renderers.DefaultListItemRenderer;
import feathers.controls.renderers.IListItemRenderer;
import feathers.data.ListCollection;
import feathers.layout.TiledRowsLayout;
import feathers.text.BitmapFontTextFormat;
import starling.display.Image;
import starling.display.Sprite;
import starling.events.Event;
import starling.events.ResizeEvent;
import starling.text.BitmapFont;
import starling.textures.Texture;
import starling.textures.TextureAtlas;
public class Main extends Sprite
{
[Embed(source="/../assets/images/atlas.png")]
private static const ICONS_IMAGE:Class;
[Embed(source="/../assets/images/atlas.xml",mimeType="application/octet-stream")]
private static const ICONS_XML:Class;
[Embed(source="/../assets/images/arial20.fnt",mimeType="application/octet-stream")]
private static const FONT_XML:Class;
public function Main()
{
this.addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
}
private var _iconAtlas:TextureAtlas;
private var _font:BitmapFont;
private var _list:List;
private var _pageIndicator:PageIndicator;
protected function layout():void
{
this._pageIndicator.width = this.stage.stageWidth;
this._pageIndicator.validate();
this._pageIndicator.y = this.stage.stageHeight - this._pageIndicator.height;
const shorterSide:Number = Math.min(this.stage.stageWidth, this.stage.stageHeight);
const layout:TiledRowsLayout = TiledRowsLayout(this._list.layout);
layout.paddingTop = layout.paddingRight = layout.paddingBottom =
layout.paddingLeft = shorterSide * 0.06;
layout.gap = shorterSide * 0.04;
this._list.itemRendererProperties.gap = shorterSide * 0.01;
this._list.width = this.stage.stageWidth;
this._list.height = this._pageIndicator.y;
this._list.validate();
this._pageIndicator.pageCount = Math.ceil(this._list.maxHorizontalScrollPosition / this._list.width) + 1;
}
protected function addedToStageHandler(event:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
this.stage.addEventListener(ResizeEvent.RESIZE, stage_resizeHandler);
this._iconAtlas = new TextureAtlas(Texture.fromBitmap(new ICONS_IMAGE(), false), XML(new ICONS_XML()));
this._font = new BitmapFont(this._iconAtlas.getTexture("arial20_0"), XML(new FONT_XML()));
const collection:ListCollection = new ListCollection(
[
{ label: "Facebook", texture: this._iconAtlas.getTexture("facebook") },
{ label: "Twitter", texture: this._iconAtlas.getTexture("twitter") },
{ label: "Google", texture: this._iconAtlas.getTexture("google") },
{ label: "YouTube", texture: this._iconAtlas.getTexture("youtube") },
{ label: "StumbleUpon", texture: this._iconAtlas.getTexture("stumbleupon") },
{ label: "Yahoo", texture: this._iconAtlas.getTexture("yahoo") },
{ label: "Tumblr", texture: this._iconAtlas.getTexture("tumblr") },
{ label: "Blogger", texture: this._iconAtlas.getTexture("blogger") },
{ label: "Reddit", texture: this._iconAtlas.getTexture("reddit") },
{ label: "Flickr", texture: this._iconAtlas.getTexture("flickr") },
{ label: "Yelp", texture: this._iconAtlas.getTexture("yelp") },
{ label: "Vimeo", texture: this._iconAtlas.getTexture("vimeo") },
{ label: "LinkedIn", texture: this._iconAtlas.getTexture("linkedin") },
{ label: "Delicious", texture: this._iconAtlas.getTexture("delicious") },
{ label: "FriendFeed", texture: this._iconAtlas.getTexture("friendfeed") },
{ label: "MySpace", texture: this._iconAtlas.getTexture("myspace") },
{ label: "Digg", texture: this._iconAtlas.getTexture("digg") },
{ label: "DeviantArt", texture: this._iconAtlas.getTexture("deviantart") },
{ label: "Picasa", texture: this._iconAtlas.getTexture("picasa") },
{ label: "LiveJournal", texture: this._iconAtlas.getTexture("livejournal") },
{ label: "Slashdot", texture: this._iconAtlas.getTexture("slashdot") },
{ label: "Bebo", texture: this._iconAtlas.getTexture("bebo") },
{ label: "Viddler", texture: this._iconAtlas.getTexture("viddler") },
{ label: "Newsvine", texture: this._iconAtlas.getTexture("newsvine") },
{ label: "Posterous", texture: this._iconAtlas.getTexture("posterous") },
{ label: "Orkut", texture: this._iconAtlas.getTexture("orkut") },
]);
const listLayout:TiledRowsLayout = new TiledRowsLayout();
listLayout.paging = TiledRowsLayout.PAGING_HORIZONTAL;
listLayout.useSquareTiles = false;
listLayout.tileHorizontalAlign = TiledRowsLayout.TILE_HORIZONTAL_ALIGN_CENTER;
listLayout.horizontalAlign = TiledRowsLayout.HORIZONTAL_ALIGN_CENTER;
this._list = new List();
this._list.dataProvider = collection;
this._list.layout = listLayout;
this._list.snapToPages = true;
this._list.scrollBarDisplayMode = List.SCROLL_BAR_DISPLAY_MODE_NONE;
this._list.horizontalScrollPolicy = List.SCROLL_POLICY_ON;
this._list.itemRendererFactory = tileListItemRendererFactory;
this._list.addEventListener(Event.SCROLL, list_scrollHandler);
this.addChild(this._list);
const normalSymbolTexture:Texture = this._iconAtlas.getTexture("normal-page-symbol");
const selectedSymbolTexture:Texture = this._iconAtlas.getTexture("selected-page-symbol");
this._pageIndicator = new PageIndicator();
this._pageIndicator.normalSymbolFactory = function():Image
{
return new Image(normalSymbolTexture);
}
this._pageIndicator.selectedSymbolFactory = function():Image
{
return new Image(selectedSymbolTexture);
}
this._pageIndicator.direction = PageIndicator.DIRECTION_HORIZONTAL;
this._pageIndicator.pageCount = 1;
this._pageIndicator.gap = 3;
this._pageIndicator.paddingTop = this._pageIndicator.paddingRight = this._pageIndicator.paddingBottom =
this._pageIndicator.paddingLeft = 6;
this._pageIndicator.addEventListener(Event.CHANGE, pageIndicator_changeHandler);
this.addChild(this._pageIndicator);
this.layout();
}
protected function tileListItemRendererFactory():IListItemRenderer
{
const renderer:DefaultListItemRenderer = new DefaultListItemRenderer();
renderer.labelField = "label";
renderer.iconSourceField = "texture";
renderer.iconPosition = Button.ICON_POSITION_TOP;
renderer.defaultLabelProperties.textFormat = new BitmapFontTextFormat(this._font, NaN, 0x000000);
return renderer;
}
protected function list_scrollHandler(event:Event):void
{
this._pageIndicator.selectedIndex = this._list.horizontalPageIndex;
}
protected function pageIndicator_changeHandler(event:Event):void
{
this._list.scrollToPageIndex(this._pageIndicator.selectedIndex, 0, 0.25);
}
protected function stage_resizeHandler(event:ResizeEvent):void
{
this.layout();
}
}
}
|
package com.playfab.ServerModels
{
import com.playfab.PlayFabUtil;
public class WriteTitleEventRequest
{
public var Body:Object;
public var EventName:String;
public var Timestamp:Date;
public function WriteTitleEventRequest(data:Object=null)
{
if(data == null)
return;
Body = data.Body;
EventName = data.EventName;
Timestamp = PlayFabUtil.parseDate(data.Timestamp);
}
}
}
|
/**
*
* AirMobileFramework
*
* https://github.com/AbsolutRenal
*
* Copyright (c) 2012 AbsolutRenal (Renaud Cousin). All rights reserved.
*
* This ActionScript source code is free.
* You can redistribute and/or modify it in accordance with the
* terms of the accompanying Simplified BSD License Agreement.
*
* This framework also include some third party free Classes like Greensocks Tweening engine, Text and Fonts manager, Audio manager, Stats manager (by mrdoob)
**/
package fwk.utils.loaders {
import com.greensock.TweenLite;
import flash.display.MovieClip;
import flash.events.Event;
/**
* @author renaud.cousin
*/
public class AbstractLoaderPage extends MovieClip {
protected const DISPLAY_DURATION:Number = .4;
public function AbstractLoaderPage() {
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
//----------------------------------------------------------------------
// E V E N T S
//----------------------------------------------------------------------
protected function onAddedToStage(event:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
alpha = 0;
}
//----------------------------------------------------------------------
// P R I V A T E
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// P R O T E C T E D
//----------------------------------------------------------------------
protected function closeComplete():void{
if(this.parent != null){
this.parent.removeChild(this);
}
}
//----------------------------------------------------------------------
// P U B L I C
//----------------------------------------------------------------------
public function display():void{
TweenLite.to(this, DISPLAY_DURATION, {alpha:1});
}
public function close():void{
TweenLite.killTweensOf(this);
TweenLite.to(this, DISPLAY_DURATION, {alpha:0, onComplete:closeComplete});
}
public function setProgress(percent:uint):void{
// XXX => TO BE OVERRIDEN
}
public function resize():void{
if(stage != null){
x = stage.stageWidth / 2;
y = stage.stageHeight / 2;
}
}
//----------------------------------------------------------------------
// G E T T E R / S E T T E R
//----------------------------------------------------------------------
}
}
|
package com.tinyspeck.engine.net {
public class NetOutgoingTradeUnlockVO extends NetOutgoingMessageVO {
public var tsid:String;
public function NetOutgoingTradeUnlockVO(player_tsid:String) {
super(MessageTypes.TRADE_UNLOCK);
this.tsid = player_tsid;
}
}
} |
/*
* Copyright 2017 FreshPlanet
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.freshplanet.ane.AirDeviceId {
import com.freshplanet.ane.AirDeviceId.events.AirDeviceIdEvent;
import flash.events.EventDispatcher;
import flash.events.StatusEvent;
import flash.external.ExtensionContext;
import flash.system.Capabilities;
public class AirDeviceId extends EventDispatcher {
// --------------------------------------------------------------------------------------//
// //
// PUBLIC API //
// //
// --------------------------------------------------------------------------------------//
/** AirAlert is supported on iOS and Android devices. */
public static function get isSupported() : Boolean {
return isAndroid || isIOS;
}
/**
* AirDeviceId instance
* @return AirDeviceId instance
*/
public static function get instance() : AirDeviceId {
return _instance ? _instance : new AirDeviceId();
}
/**
* Get vendor identifier
* @return
*/
public function getIDFV():String {
if (isSupported)
return _context.call( 'getIDFV' ) as String;
return null;
}
/**
* Get advertising identifier
* @return
*/
public function getIDFA() : void {
if ( isSupported )
_context.call( 'getIDFA' );
}
// --------------------------------------------------------------------------------------//
// //
// PRIVATE API //
// //
// --------------------------------------------------------------------------------------//
private static const EXTENSION_ID : String = "com.freshplanet.ane.AirDeviceId";
private static var _instance : AirDeviceId = null;
private var _context : ExtensionContext = null;
/**
* "private" singleton constructor
*/
public function AirDeviceId() {
if ( !_instance ) {
_context = ExtensionContext.createExtensionContext( EXTENSION_ID, null );
if (_context != null ) {
_context.addEventListener( StatusEvent.STATUS, _onStatus );
}
else {
trace('[AirDeviceId] Error - Extension Context is null.');
}
_instance = this;
}
else {
throw Error( 'This is a singleton, use getInstance(), do not call the constructor directly.' );
}
}
/**
* Status events allow the native part of the ANE to communicate with the ActionScript part.
* We use event.code to represent the type of event, and event.level to carry the data.
*/
private function _onStatus( event:StatusEvent ) : void {
if ( event.code == AirDeviceIdEvent.RECEIVED_IDFA ) {
this.dispatchEvent(new AirDeviceIdEvent(AirDeviceIdEvent.RECEIVED_IDFA, event.level));
}
else if ( event.code == "log" ) {
trace( '[AirDeviceId] ' + event.level );
}
}
private static function get isIOS():Boolean {
return Capabilities.manufacturer.indexOf("iOS") > -1 && Capabilities.os.indexOf("x86_64") < 0 && Capabilities.os.indexOf("i386") < 0;
}
private static function get isAndroid():Boolean {
return Capabilities.manufacturer.indexOf("Android") > -1;
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// 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
//
// No warranty of merchantability or fitness of any kind.
// Use this software at your own risk.
//
////////////////////////////////////////////////////////////////////////////////
package actionScripts.events
{
import flash.events.Event;
import actionScripts.valueObjects.ProjectVO;
public class ShowSettingsEvent extends Event
{
public static const EVENT_SHOW_SETTINGS:String = "showSettingsEvent";
public var project:ProjectVO;
public var jumpToSection:String;
public function ShowSettingsEvent(project:ProjectVO, jumpToSection:String=null)
{
this.project = project;
this.jumpToSection = jumpToSection;
super(EVENT_SHOW_SETTINGS, false, true);
}
}
} |
package Shared.AS3
{
import flash.events.Event;
import flash.events.EventDispatcher;
public dynamic class BSButtonHintData extends EventDispatcher
{
public static const BUTTON_HINT_DATA_CHANGE:String = // method body index: 232 method index: 232
"ButtonHintDataChange";
private var _strButtonText:String;
private var _strPCKey:String;
private var _strPSNButton:String;
private var _strXenonButton:String;
private var _uiJustification:uint;
private var _callbackFunction:Function;
private var _bButtonDisabled:Boolean;
private var _bSecondaryButtonDisabled:Boolean;
private var _bButtonVisible:Boolean;
private var _bButtonFlashing:Boolean;
private var _hasSecondaryButton:Boolean;
private var _strSecondaryPCKey:String;
private var _strSecondaryXenonButton:String;
private var _strSecondaryPSNButton:String;
private var _secondaryButtonCallback:Function;
private var m_CanHold:Boolean = false;
private var m_HoldPercent:Number = 0.0;
private var _isWarning:Boolean;
private var _strDynamicMovieClipName:String;
public var onAnnounceDataChange:Function;
public var onTextClick:Function;
public var onSecondaryButtonClick:Function;
public function BSButtonHintData(param1:String, param2:String, param3:String, param4:String, param5:uint, param6:Function)
{
// method body index: 265 method index: 265
this.onAnnounceDataChange = this.onAnnounceDataChange_Impl;
this.onTextClick = this.onTextClick_Impl;
this.onSecondaryButtonClick = this.onSecondaryButtonClick_Impl;
super();
this._strPCKey = param2;
this._strButtonText = param1;
this._strXenonButton = param4;
this._strPSNButton = param3;
this._uiJustification = param5;
this._callbackFunction = param6;
this._bButtonDisabled = false;
this._bButtonVisible = true;
this._bButtonFlashing = false;
this._hasSecondaryButton = false;
this._strSecondaryPCKey = "";
this._strSecondaryPSNButton = "";
this._strSecondaryXenonButton = "";
this._secondaryButtonCallback = null;
this._strDynamicMovieClipName = "";
this._isWarning = false;
}
public function get PCKey() : String
{
// method body index: 233 method index: 233
return this._strPCKey;
}
public function get PSNButton() : String
{
// method body index: 234 method index: 234
return this._strPSNButton;
}
public function get XenonButton() : String
{
// method body index: 235 method index: 235
return this._strXenonButton;
}
public function get Justification() : uint
{
// method body index: 236 method index: 236
return this._uiJustification;
}
public function get SecondaryPCKey() : String
{
// method body index: 237 method index: 237
return this._strSecondaryPCKey;
}
public function get SecondaryPSNButton() : String
{
// method body index: 238 method index: 238
return this._strSecondaryPSNButton;
}
public function get SecondaryXenonButton() : String
{
// method body index: 239 method index: 239
return this._strSecondaryXenonButton;
}
public function get DynamicMovieClipName() : String
{
// method body index: 240 method index: 240
return this._strDynamicMovieClipName;
}
public function set DynamicMovieClipName(param1:String) : void
{
// method body index: 241 method index: 241
if(this._strDynamicMovieClipName != param1)
{
this._strDynamicMovieClipName = param1;
this.AnnounceDataChange();
}
}
public function get canHold() : Boolean
{
// method body index: 242 method index: 242
return this.m_CanHold;
}
public function set canHold(param1:Boolean) : void
{
// method body index: 243 method index: 243
if(this.m_CanHold != param1)
{
this.m_CanHold = param1;
this.AnnounceDataChange();
}
}
public function get holdPercent() : Number
{
// method body index: 244 method index: 244
return this.m_HoldPercent;
}
public function set holdPercent(param1:Number) : void
{
// method body index: 245 method index: 245
if(this.m_HoldPercent != param1)
{
this.m_HoldPercent = param1;
this.AnnounceDataChange();
}
}
public function get ButtonDisabled() : Boolean
{
// method body index: 246 method index: 246
return this._bButtonDisabled;
}
public function set ButtonDisabled(param1:Boolean) : void
{
// method body index: 247 method index: 247
if(this._bButtonDisabled != param1)
{
this._bButtonDisabled = param1;
this.AnnounceDataChange();
}
}
public function get ButtonEnabled() : Boolean
{
// method body index: 248 method index: 248
return !this.ButtonDisabled;
}
public function set ButtonEnabled(param1:Boolean) : void
{
// method body index: 249 method index: 249
this.ButtonDisabled = !param1;
}
public function get SecondaryButtonDisabled() : Boolean
{
// method body index: 250 method index: 250
return this._bSecondaryButtonDisabled;
}
public function set SecondaryButtonDisabled(param1:Boolean) : void
{
// method body index: 251 method index: 251
if(this._bSecondaryButtonDisabled != param1)
{
this._bSecondaryButtonDisabled = param1;
this.AnnounceDataChange();
}
}
public function get SecondaryButtonEnabled() : Boolean
{
// method body index: 252 method index: 252
return !this.SecondaryButtonDisabled;
}
public function set SecondaryButtonEnabled(param1:Boolean) : void
{
// method body index: 253 method index: 253
this.SecondaryButtonDisabled = !param1;
}
public function get ButtonText() : String
{
// method body index: 254 method index: 254
return this._strButtonText;
}
public function set ButtonText(param1:String) : void
{
// method body index: 255 method index: 255
if(this._strButtonText != param1)
{
this._strButtonText = param1;
this.AnnounceDataChange();
}
}
public function get ButtonVisible() : Boolean
{
// method body index: 256 method index: 256
return this._bButtonVisible;
}
public function set ButtonVisible(param1:Boolean) : void
{
// method body index: 257 method index: 257
if(this._bButtonVisible != param1)
{
this._bButtonVisible = param1;
this.AnnounceDataChange();
}
}
public function get ButtonFlashing() : Boolean
{
// method body index: 258 method index: 258
return this._bButtonFlashing;
}
public function set ButtonFlashing(param1:Boolean) : void
{
// method body index: 259 method index: 259
if(this._bButtonFlashing != param1)
{
this._bButtonFlashing = param1;
this.AnnounceDataChange();
}
}
public function get hasSecondaryButton() : Boolean
{
// method body index: 260 method index: 260
return this._hasSecondaryButton;
}
public function get IsWarning() : Boolean
{
// method body index: 261 method index: 261
return this._isWarning;
}
public function set IsWarning(param1:Boolean) : void
{
// method body index: 262 method index: 262
if(this._isWarning != param1)
{
this._isWarning = param1;
this.AnnounceDataChange();
}
}
private function AnnounceDataChange() : void
{
// method body index: 263 method index: 263
dispatchEvent(new Event(BUTTON_HINT_DATA_CHANGE));
if(this.onAnnounceDataChange is Function)
{
this.onAnnounceDataChange();
}
}
private function onAnnounceDataChange_Impl() : void
{
// method body index: 264 method index: 264
}
public function SetButtons(param1:String, param2:String, param3:String) : *
{
// method body index: 266 method index: 266
var _loc4_:Boolean = false;
if(this._strPCKey != param1)
{
this._strPCKey = param1;
_loc4_ = true;
}
if(this._strPSNButton != param2)
{
this._strPSNButton = param2;
_loc4_ = true;
}
if(this._strXenonButton != param3)
{
this._strXenonButton = param3;
_loc4_ = true;
}
if(_loc4_)
{
this.AnnounceDataChange();
}
}
public function SetSecondaryButtons(param1:String, param2:String, param3:String) : *
{
// method body index: 267 method index: 267
this._hasSecondaryButton = true;
var _loc4_:Boolean = false;
if(this._strSecondaryPCKey != param1)
{
this._strSecondaryPCKey = param1;
_loc4_ = true;
}
if(this._strSecondaryPSNButton != param2)
{
this._strSecondaryPSNButton = param2;
_loc4_ = true;
}
if(this._strSecondaryXenonButton != param3)
{
this._strSecondaryXenonButton = param3;
_loc4_ = true;
}
if(_loc4_)
{
this.AnnounceDataChange();
}
}
public function set secondaryButtonCallback(param1:Function) : void
{
// method body index: 268 method index: 268
this._secondaryButtonCallback = param1;
}
private function onTextClick_Impl() : void
{
// method body index: 269 method index: 269
if(this._callbackFunction is Function)
{
this._callbackFunction.call();
}
}
private function onSecondaryButtonClick_Impl() : void
{
// method body index: 270 method index: 270
if(this._secondaryButtonCallback is Function)
{
this._secondaryButtonCallback.call();
}
}
}
}
|
package kabam.rotmg.external.command {
import org.osflash.signals.Signal;
public class RequestPlayerCreditsSignal extends Signal {
}
}
|
package sh.saqoo.logging {
import sh.saqoo.debug.mtrace;
import sh.saqoo.util.ArrayUtil;
import flash.utils.getQualifiedClassName;
public function log(caller:*, ...args):void {
if (args && !(args[0] is String)) {
mtrace.apply(null, args);
} else {
var arr:Array = ArrayUtil.fromArguments(args);
var className:String = caller ? getQualifiedClassName(caller).replace('::', '.') : '';
arr.unshift('[' + className + ']');
mtrace.apply(null, arr);
}
}
}
|
package com.ankamagames.dofus.network.messages.game.chat
{
import com.ankamagames.dofus.network.types.game.data.items.ObjectItem;
import com.ankamagames.jerakine.network.CustomDataWrapper;
import com.ankamagames.jerakine.network.ICustomDataInput;
import com.ankamagames.jerakine.network.ICustomDataOutput;
import com.ankamagames.jerakine.network.INetworkMessage;
import com.ankamagames.jerakine.network.utils.FuncTree;
import flash.utils.ByteArray;
public class ChatServerCopyWithObjectMessage extends ChatServerCopyMessage implements INetworkMessage
{
public static const protocolId:uint = 6746;
private var _isInitialized:Boolean = false;
public var objects:Vector.<ObjectItem>;
private var _objectstree:FuncTree;
public function ChatServerCopyWithObjectMessage()
{
this.objects = new Vector.<ObjectItem>();
super();
}
override public function get isInitialized() : Boolean
{
return super.isInitialized && this._isInitialized;
}
override public function getMessageId() : uint
{
return 6746;
}
public function initChatServerCopyWithObjectMessage(channel:uint = 0, content:String = "", timestamp:uint = 0, fingerprint:String = "", receiverId:Number = 0, receiverName:String = "", objects:Vector.<ObjectItem> = null) : ChatServerCopyWithObjectMessage
{
super.initChatServerCopyMessage(channel,content,timestamp,fingerprint,receiverId,receiverName);
this.objects = objects;
this._isInitialized = true;
return this;
}
override public function reset() : void
{
super.reset();
this.objects = new Vector.<ObjectItem>();
this._isInitialized = false;
}
override public function pack(output:ICustomDataOutput) : void
{
var data:ByteArray = new ByteArray();
this.serialize(new CustomDataWrapper(data));
writePacket(output,this.getMessageId(),data);
}
override public function unpack(input:ICustomDataInput, length:uint) : void
{
this.deserialize(input);
}
override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree
{
var tree:FuncTree = new FuncTree();
tree.setRoot(input);
this.deserializeAsync(tree);
return tree;
}
override public function serialize(output:ICustomDataOutput) : void
{
this.serializeAs_ChatServerCopyWithObjectMessage(output);
}
public function serializeAs_ChatServerCopyWithObjectMessage(output:ICustomDataOutput) : void
{
super.serializeAs_ChatServerCopyMessage(output);
output.writeShort(this.objects.length);
for(var _i1:uint = 0; _i1 < this.objects.length; _i1++)
{
(this.objects[_i1] as ObjectItem).serializeAs_ObjectItem(output);
}
}
override public function deserialize(input:ICustomDataInput) : void
{
this.deserializeAs_ChatServerCopyWithObjectMessage(input);
}
public function deserializeAs_ChatServerCopyWithObjectMessage(input:ICustomDataInput) : void
{
var _item1:ObjectItem = null;
super.deserialize(input);
var _objectsLen:uint = input.readUnsignedShort();
for(var _i1:uint = 0; _i1 < _objectsLen; _i1++)
{
_item1 = new ObjectItem();
_item1.deserialize(input);
this.objects.push(_item1);
}
}
override public function deserializeAsync(tree:FuncTree) : void
{
this.deserializeAsyncAs_ChatServerCopyWithObjectMessage(tree);
}
public function deserializeAsyncAs_ChatServerCopyWithObjectMessage(tree:FuncTree) : void
{
super.deserializeAsync(tree);
this._objectstree = tree.addChild(this._objectstreeFunc);
}
private function _objectstreeFunc(input:ICustomDataInput) : void
{
var length:uint = input.readUnsignedShort();
for(var i:uint = 0; i < length; i++)
{
this._objectstree.addChild(this._objectsFunc);
}
}
private function _objectsFunc(input:ICustomDataInput) : void
{
var _item:ObjectItem = new ObjectItem();
_item.deserialize(input);
this.objects.push(_item);
}
}
}
|
package com.hurlant.eval.ast
{
public class LetExpr implements IAstExpr {
public var head : Head;
public var expr : IAstExpr;
function LetExpr (head,expr) {
this.head = head;
this.expr = expr;
}
}
} |
/* 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/. */
// var SECTION = "Definitions"; // provide a document reference (ie, ECMA section)
// var VERSION = "Clean AS2"; // Version of JavaScript or ECMA
// var TITLE = "Extend Dynamic Class Implement Default interface"; // Provide ECMA section title or a description
var BUGNUMBER = "";
/**
* Calls to Assert.expectEq here. Assert.expectEq is a function that is defined
* in shell.js and takes three arguments:
* - a string representation of what is being tested
* - the expected result
* - the actual result
*
* For example, a test might look like this:
*
* var helloWorld = "Hello World";
*
* Assert.expectEq(
* "var helloWorld = 'Hello World'", // description of the test
* "Hello World", // expected result
* helloWorld ); // actual result
*
*/
import DynamicClass.*;
import com.adobe.test.Assert;
var THISTEST = new DynExtDynamicImplDefDefPub();
// *******************************************
// define default method from interface as a
// public method in the sub class
// *******************************************
// Should give an error
Assert.expectEq( "*** default(<empty>) method implemented interface ***", 1, 1 );
Assert.expectEq( "THISTEST.testGetBoolean(false)", false, THISTEST.testGetBoolean(false) );
Assert.expectEq( "THISTEST.testGetBoolean(true)", true, THISTEST.testGetBoolean(true) );
// *******************************************
// define public method from interface as a
// public method in the sub class
// *******************************************
Assert.expectEq( "*** public method implemented interface ***", 1, 1 );
Assert.expectEq( "THISTEST.testGetPubBoolean(false)", false, THISTEST.testGetPubBoolean(false) );
Assert.expectEq( "THISTEST.testGetPubBoolean(true)", true, THISTEST.testGetPubBoolean(true) );
// *******************************************
// define default method from interface 2 as a
// public method in the sub class
// *******************************************
//Should give an error
Assert.expectEq( "*** default(<empty>) method implemented interface 2 ***", 1, 1 );
Assert.expectEq( "THISTEST.testGetSetNumber(420)", 420, THISTEST.testGetSetNumber(420) );
// *******************************************
// define public method from interface 2 as a
// public method in the sub class
// *******************************************
Assert.expectEq( "*** public method implemented interface 2 ***", 1, 1 );
Assert.expectEq( "THISTEST.setPubNumber(14), THISTEST.iGetPubNumber()", 14, (THISTEST.setPubNumber(14), THISTEST.iGetPubNumber()) );
//*******************************************
// access from outside of class
//*******************************************
var EXTDCLASS = new DynExtDynamicImplDefDefPub();
arr = new Array(1, 2, 3);
Assert.expectEq( "*** access public methods and properties from outside of class ***", 1, 1 );
Assert.expectEq( "EXTDCLASS.setPubArray(arr), EXTDCLASS.pubArray", arr, (EXTDCLASS.setPubArray(arr), EXTDCLASS.pubArray) );
// ********************************************
// access public method from a default
// method of a sub class
//
// ********************************************
EXTDCLASS = new DynExtDynamicImplDefDefPub();
Assert.expectEq( "*** Access public method from default method of sub class ***", 1, 1 );
Assert.expectEq( "EXTDCLASS.testGetSubArray(arr)", arr, EXTDCLASS.testGetSubArray(arr) );
// <TODO> fill in the rest of the cases here
// ********************************************
// access public method from a public
// method of a sub class
//
// ********************************************
EXTDCLASS = new DynExtDynamicImplDefDefPub();
Assert.expectEq( "*** Access public method from public method of sub class ***", 1, 1 );
Assert.expectEq( "EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()", arr, (EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()) );
// <TODO> fill in the rest of the cases here
// ********************************************
// access public method from a private
// method of a sub class
//
// ********************************************
EXTDCLASS = new DynExtDynamicImplDefDefPub();
Assert.expectEq( "*** Access public method from private method of sub class ***", 1, 1 );
Assert.expectEq( "EXTDCLASS.testPrivSubArray(arr)", arr, EXTDCLASS.testPrivSubArray(arr) );
// <TODO> fill in the rest of the cases here
// displays results.
|
package locodeco.util
{
public final class TSIDGen
{
private static var _counter:Number;
{ // static init
_counter = new Date().getTime();
}
public static function newTSID(prefix:String = 'T'):String {
return prefix + '_' + _counter++;
}
}
} |
package cmodule.lua_wrapper
{
const __2E_str65354:int = gstaticInitter.alloc(27,1);
}
|
package test
{
import flash.display.Sprite;
import mx.effects.easing.Linear;
public class MotionTest extends Sprite
{
public function MotionTest()
{
super();
var v : Number;
var from : Number = 100;
var to : Number = 300;
for( var i : int = 0; i < 100; i ++ )
{
v = Linear.easeNone( i, from, to, 100 )
graphics.lineStyle( 1, 0xFF0000 );
if ( i == 0 )
{
graphics.moveTo( i, v );
}
else
{
graphics.lineTo( i, v );
}
trace( i, v );
}
}
}
} |
package flashx.textLayout.utils
{
[ExcludeClass]
public final class Twips
{
public static const ONE_TWIP:Number = 0.05;
public static const TWIPS_PER_PIXEL:int = 20;
public static const MAX_VALUE:int = int.MAX_VALUE;
public static const MIN_VALUE:int = int.MIN_VALUE;
public function Twips()
{
super();
}
public static function to(n:Number) : int
{
return int(n * 20);
}
public static function roundTo(n:Number) : int
{
return int(Math.round(n) * 20);
}
public static function from(t:int) : Number
{
return Number(t) / 20;
}
public static function ceil(n:Number) : Number
{
return Math.ceil(n * 20) / 20;
}
public static function floor(n:Number) : Number
{
return Math.floor(n * 20) / 20;
}
public static function round(n:Number) : Number
{
return Math.round(n * 20) / 20;
}
}
}
|
import asunit.flash.events.Event;
import asunit.flash.events.IEventDispatcher;
import asunit.flash.events.EventDispatcher;
import asunit.flash.utils.Timer;
import asunit.framework.TestCase;
class asunit.framework.AsyncMethodTest extends TestCase {
public var className:String = "asunit.framework.AsyncMethodTest";
private var instance:MovieClip;
public function AsyncMethodTest(testMethod:String) {
super(testMethod);
}
private function setUp():Void {
instance = context.createEmptyMovieClip("test", context.getNextHighestDepth());
}
private function tearDown():Void {
instance.removeMovieClip();
instance = null;
}
public function testInstantiated():Void {
assertTrue("MovieClip instantiated", instance instanceof MovieClip);
}
public function testAsyncMethod():Void {
var handler:Function = addAsync(asyncHandler);
Timer.setTimeout(this, handler, 100);
}
private function asyncHandler():Void {
assertTrue(instance instanceof MovieClip);
}
public function testAsyncVisualEntity():Void {
var handler:Function = addAsync(spriteHandler);
Timer.setTimeout(this, handler, 100);
}
private function spriteHandler():Void {
assertTrue(instance instanceof MovieClip);
}
public function testAsyncVisualEntity2():Void {
var handler:Function = addAsync(spriteHandler);
Timer.setTimeout(this, handler, 100);
}
// This is an asynchronous test method
public function testAsyncFeature():Void {
// create a new object that dispatches events...
var dispatcher : IEventDispatcher = new EventDispatcher();
// get a TestCase async event handler reference
// the 2nd arg is an optional timeout in ms. (default=1000ms )
var handler:Function = addAsync(changeHandler, 2000);
// subscribe to your event dispatcher using the returned handler
dispatcher.addEventListener(Event.CHANGE, handler, this);
// cause the event to be dispatched.
// either immediately:
//dispatcher.dispatchEvent(new Event(Event.CHANGE));
// or in the future < your assigned timeout
Timer.setTimeout( dispatcher, dispatchEvent, 200, new Event(Event.CHANGE));
}
private function changeHandler(event:Event):Void {
// perform assertions in your handler
assertEquals(Event.CHANGE, event.type);
}
}
|
/**
* Created with IntelliJ IDEA.
* User: mobitile
* Date: 4/20/13
* Time: 11:32 AM
* To change this template use File | Settings | File Templates.
*/
package skein.impl.feathers.components.builder.components
{
import feathers.controls.ScrollContainer;
import feathers.core.FeathersControl;
import feathers.layout.AnchorLayout;
import feathers.layout.VerticalLayout;
import skein.components.builder.components.GroupBuilder;
import skein.components.builder.components.ChildrenBuilder;
import skein.components.builder.components.GroupBuilder;
import skein.components.builder.mixins.ComponentMixin;
import skein.components.builder.mixins.ElementContainerMixin;
import skein.components.builder.mixins.EventDispatcherMixin;
import skein.components.builder.mixins.LayoutElementMixin;
import skein.components.builder.mixins.SpriteMixin;
import skein.components.core.ComponentsGlobals;
import skein.components.enum.Side;
import skein.core.PropertySetter;
import skein.core.skein_internal;
import skein.impl.feathers.components.builder.FeathersBuilder;
import skein.impl.feathers.components.builder.mixins.FeathersComponentNature;
import skein.impl.feathers.components.builder.mixins.FeathersElementContainerMixin;
import skein.impl.feathers.components.builder.mixins.FeathersEventDispatcherNature;
import skein.impl.feathers.components.builder.mixins.FeathersLayoutElementNature;
import skein.impl.feathers.components.builder.mixins.FeathersSpriteNature;
import starling.display.DisplayObjectContainer;
import starling.display.Sprite;
use namespace skein_internal;
public class FeathersGroupBuilder extends FeathersBuilder implements GroupBuilder
{
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
public function FeathersGroupBuilder(host:Object, generator:Class = null)
{
super();
this.host = host;
new VerticalLayout().hasOwnProperty("gap");// TODO ?
this.createInstance(generator);
this.spriteMixin = new FeathersSpriteNature(this.instance as Sprite);
this.componentMixin = new FeathersComponentNature(this.instance);
this.layoutElementNature = new FeathersLayoutElementNature(this.instance);
this.eventDispatcherMixin = new FeathersEventDispatcherNature(this.instance);
this.elementContainerMixin = new FeathersElementContainerMixin(this.instance);
}
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
//-------------------------------------
// Variables: Mixins
//-------------------------------------
private var spriteMixin:SpriteMixin;
private var componentMixin:ComponentMixin;
private var layoutElementNature:LayoutElementMixin;
private var eventDispatcherMixin:EventDispatcherMixin;
private var elementContainerMixin:ElementContainerMixin;
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
//-------------------------------------
// instance
//-------------------------------------
protected function get instance():FeathersControl
{
return _instance as FeathersControl;
}
//--------------------------------------------------------------------------
//
// Overridden methods
//
//--------------------------------------------------------------------------
override protected function createInstance(generator:Class = null):void
{
this._instance = generator ? new generator() : new ScrollContainer();
// Object(this.instance).layout = new AnchorLayout();// TODO: set layout explicitly
}
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
//------------------------------------
// Methods: Object
//------------------------------------
public function set(property:String, value:Object):GroupBuilder
{
PropertySetter.set(_instance, property, value);
return this;
}
//------------------------------------
// Methods: Sprite
//------------------------------------
public function x(value:Object):GroupBuilder
{
spriteMixin.x(value);
return this;
}
public function y(value:Object):GroupBuilder
{
spriteMixin.y(value);
return this;
}
public function width(value:Object):GroupBuilder
{
spriteMixin.width(value);
return this;
}
public function height(value:Object):GroupBuilder
{
spriteMixin.height(value);
return this;
}
public function rotation(value:Object, axis:String = null):GroupBuilder
{
spriteMixin.rotation(value, axis);
return this;
}
public function visible(value:Object):GroupBuilder
{
spriteMixin.visible(value);
return this;
}
public function alpha(value:Object):GroupBuilder
{
spriteMixin.alpha(value);
return this;
}
public function z(value:Object):GroupBuilder
{
spriteMixin.z(value);
return this;
}
public function scale(value:Object, axis:String = null):GroupBuilder
{
spriteMixin.scale(value, axis);
return this;
}
public function mask(value:Object):GroupBuilder
{
spriteMixin.mask(value);
return this;
}
//-----------------------------------
// Methods: EventDispatcher
//-----------------------------------
public function on(type:String, handler:Function, weak:Boolean = true):GroupBuilder
{
eventDispatcherMixin.on(type, handler, weak);
return this;
}
//-----------------------------------
// Methods: LayoutElement
//-----------------------------------
public function left(value:Object):GroupBuilder
{
layoutElementNature.left(value);
return this;
}
public function leftAnchor(value:Object):GroupBuilder
{
layoutElementNature.leftAnchor(value);
return this;
}
public function top(value:Object):GroupBuilder
{
layoutElementNature.top(value);
return this;
}
public function topAnchor(value:Object):GroupBuilder
{
layoutElementNature.topAnchor(value);
return this;
}
public function right(value:Object):GroupBuilder
{
layoutElementNature.right(value);
return this;
}
public function rightAnchor(value:Object):GroupBuilder
{
layoutElementNature.rightAnchor(value);
return this;
}
public function bottom(value:Object):GroupBuilder
{
layoutElementNature.bottom(value);
return this;
}
public function bottomAnchor(value:Object):GroupBuilder
{
layoutElementNature.bottomAnchor(value);
return this;
}
public function horizontalCenter(value:Object):GroupBuilder
{
layoutElementNature.horizontalCenter(value);
return this;
}
public function verticalCenter(value:Object):GroupBuilder
{
layoutElementNature.verticalCenter(value);
return this;
}
public function includeInLayout(value:Object):GroupBuilder
{
layoutElementNature.includeInLayout(value);
return this;
}
//-----------------------------------
// Methods: Component
//-----------------------------------
public function id(id:Object):GroupBuilder
{
this.instanceId = id;
return this;
}
public function styleName(value:Object):GroupBuilder
{
componentMixin.styleName(value);
return this;
}
public function enabled(value:Object):GroupBuilder
{
componentMixin.enabled(value);
return this;
}
//-----------------------------------
// Methods: ElementContainer
//-----------------------------------
public function contains(...elements):GroupBuilder
{
elementContainerMixin.contains(elements);
return this;
}
public function children():ChildrenBuilder
{
return new FeathersChildrenBuilder(host, this, instance);
}
//-----------------------------------
// Methods: Group
//-----------------------------------
public function layout(value:Object):GroupBuilder
{
PropertySetter.set(this.instance, "layout", value);
// what if layout has been changed after set it's properties?
return this;
}
public function gap(value:Object):GroupBuilder
{
if (Object(instance).layout && "gap" in Object(instance).layout)
PropertySetter.set(Object(instance).layout, "gap", value);
return this;
}
public function padding(value:Object, side:String = null):GroupBuilder
{
switch (side)
{
case Side.LEFT : paddingLeft(value); break;
case Side.TOP : paddingTop(value); break;
case Side.RIGHT : paddingRight(value); break;
case Side.BOTTOM : paddingBottom(value); break;
default :
paddingLeft(value);
paddingTop(value);
paddingRight(value);
paddingBottom(value);
break;
}
return this;
}
public function paddingLeft(value:Object):GroupBuilder
{
if (Object(instance).layout && "paddingLeft" in Object(instance).layout)
PropertySetter.set(Object(instance).layout, "paddingLeft", value);
return this;
}
public function paddingTop(value:Object):GroupBuilder
{
if (Object(instance).layout && "paddingTop" in Object(instance).layout)
PropertySetter.set(Object(instance).layout, "paddingTop", value);
return this;
}
public function paddingRight(value:Object):GroupBuilder
{
if (Object(instance).layout && "paddingRight" in Object(instance).layout)
PropertySetter.set(Object(instance).layout, "paddingRight", value);
return this;
}
public function paddingBottom(value:Object):GroupBuilder
{
if (Object(instance).layout && "paddingBottom" in Object(instance).layout)
PropertySetter.set(Object(instance).layout, "paddingBottom", value);
return this;
}
public function horizontalAlign(value:Object):GroupBuilder
{
if (Object(instance).layout && "horizontalAlign" in Object(instance).layout)
PropertySetter.set(Object(instance).layout, "horizontalAlign", value);
return this;
}
public function verticalAlign(value:Object):GroupBuilder
{
if (Object(instance).layout && "verticalAlign" in Object(instance).layout)
PropertySetter.set(Object(instance).layout, "verticalAlign", value);
return this;
}
public function horizontalScrollPolicy(value:Object):GroupBuilder
{
PropertySetter.set(this.instance, "horizontalScrollPolicy", value);
return this;
}
public function verticalScrollPolicy(value:Object):GroupBuilder
{
PropertySetter.set(this.instance, "verticalScrollPolicy", value);
return this;
}
//-----------------------------------
// Methods: Extra
//-----------------------------------
public function bindWidthTo(source:Object):GroupBuilder
{
ComponentsGlobals.bindWidth(source, this.instance);
return this;
}
public function bindHeightTo(source:Object):GroupBuilder
{
ComponentsGlobals.bindHeight(source, this.instance);
return this;
}
}
}
|
package kabam.rotmg.game.model {
import com.company.assembleegameclient.objects.GameObject;
import com.company.assembleegameclient.objects.Player;
import flash.utils.Dictionary;
public class GameModel {
public function GameModel() {
super();
}
public var player:Player;
public var gameObjects:Dictionary;
public function getGameObject(_arg_1:int):GameObject {
var _local2:GameObject = this.gameObjects[_arg_1];
if (!_local2 && this.player.objectId_ == _arg_1) {
_local2 = this.player;
}
return _local2;
}
}
}
|
package coco.component
{
import flash.events.MouseEvent;
import coco.event.UIEvent;
import coco.event.UIEvent;
import coco.util.debug;
/**
* ItemRendererOwnerHelper
*
* @author Coco
*
*/
public class ItemRendererOwnerHelper
{
public function ItemRendererOwnerHelper(target:IItemRendererOwner)
{
owner = target;
owner.addEventListener(UIEvent.SELECTED, renderer_selectingHandler);
usedItemRenderers = new Vector.<IItemRenderer>();
unusedItemRenderers = new Vector.<IItemRenderer>();
}
//----------------------------------------------------------------------------------------------------------------
//
// Properties
//
//----------------------------------------------------------------------------------------------------------------
private var isMouseDownOnRenderer:Boolean = false;
private var isMouseOverOnRenderer:Boolean = false;
private var mouseDownRenderer:IItemRenderer;
private var owner:IItemRendererOwner;
public var usedItemRenderers:Vector.<IItemRenderer>;
public var unusedItemRenderers:Vector.<IItemRenderer>;
//----------------------------------------------------------------------------------------------------------------
//
// Methods
//
//----------------------------------------------------------------------------------------------------------------
public function add(renderer:IItemRenderer):void
{
if (!renderer) return;
debug('[ItemRendererOwnerHelper] [' + owner.name + '] Add ItemRenderer Index: ' + renderer.index);
renderer.visible = true;
renderer.addEventListener(MouseEvent.MOUSE_DOWN, renderer_mouseDownHandler);
renderer.addEventListener(MouseEvent.MOUSE_UP, renderer_mouseUpHandler);
renderer.addEventListener(MouseEvent.ROLL_OVER, renderer_rollOverHandler);
renderer.addEventListener(MouseEvent.ROLL_OUT, renderer_rollOutHandler);
usedItemRenderers.push(renderer);
}
public function remove(renderer:IItemRenderer):void
{
if (!renderer) return;
debug('[ItemRendererOwnerHelper] [' + owner.name +'] Remove ItemRenderer Index: ' + renderer.index);
renderer.visible = false;
renderer.removeEventListener(MouseEvent.MOUSE_DOWN, renderer_mouseDownHandler);
renderer.removeEventListener(MouseEvent.MOUSE_UP, renderer_mouseUpHandler);
renderer.removeEventListener(MouseEvent.ROLL_OVER, renderer_rollOverHandler);
renderer.removeEventListener(MouseEvent.ROLL_OUT, renderer_rollOutHandler);
unusedItemRenderers.push(renderer);
}
public function updateSelected():void
{
debug('[ItemRendererOwnerHelper] [' + owner.name + '] Selected Indices: ' + owner.selectedIndices);
for each (var itemRenderer:IItemRenderer in usedItemRenderers)
{
itemRenderer.selected = isSelected(itemRenderer);
}
}
private function isSelected(renderer:IItemRenderer):Boolean
{
if (owner.allowMultipleSelection)
return owner.selectedIndices.indexOf(renderer.index) != -1;
else
return renderer.index == owner.selectedIndex;
}
/**
* select item renderer
*
* @param renderer
*
*/
private function select(renderer:IItemRenderer):void
{
if (!renderer)
return;
if (owner.allowMultipleSelection)
selectedMultipleItemRenderer(renderer);
else
selectedItemRenderer(renderer);
}
// 单选
private function selectedItemRenderer(renderer:IItemRenderer):void
{
var newIndex:int;
var newIndices:Vector.<int> = owner.selectedIndices;
newIndices.splice(0, owner.selectedIndices.length); // clear
if (renderer.index == owner.selectedIndex && !owner.requestSelection)
newIndex = -1;
else
newIndex = renderer.index;
if (newIndex != -1)
newIndices.push(newIndex);
finalSelected(newIndex, newIndices);
}
// 多选
private function selectedMultipleItemRenderer(renderer:IItemRenderer):void
{
var newIndex:int;
var newIndices:Vector.<int>;
// bug here
var rendererIndex:int = owner.selectedIndices.indexOf(renderer.index);
if (rendererIndex != -1)
{
// 已经选中状态
if (owner.selectedIndices.length == 1 && owner.requestSelection)
{
newIndex = renderer.index;
newIndices = owner.selectedIndices;
}
else
{
newIndices = owner.selectedIndices.concat();
newIndices.splice(rendererIndex, 1);
newIndex = newIndices.length > 0 ? newIndices[0] : -1;
}
}
else
{
newIndex = renderer.index;
newIndices = owner.selectedIndices.concat();
newIndices.push(renderer.index);
}
finalSelected(newIndex, newIndices);
}
private function finalSelected(newIndex:int, newIndices:Vector.<int>):void
{
var event:UIEvent = new UIEvent(UIEvent.CHANGE);
event.oldIndex = owner.selectedIndex;
event.newIndex = newIndex;
owner.selectedIndex = newIndex;
owner.selectedIndices = newIndices;
// bug repair
// must dispatch event after selectedIndex was setted
owner.dispatchEvent(event);
}
private function renderer_mouseDownHandler(e:MouseEvent):void
{
isMouseDownOnRenderer = isMouseOverOnRenderer = true;
mouseDownRenderer = e.currentTarget as IItemRenderer;
}
private function renderer_rollOverHandler(e:MouseEvent):void
{
isMouseOverOnRenderer = true;
}
private function renderer_rollOutHandler(e:MouseEvent):void
{
isMouseOverOnRenderer = false;
}
private function renderer_mouseUpHandler(e:MouseEvent):void
{
var mouseUpRenderer:IItemRenderer = e.currentTarget as IItemRenderer;
if (isMouseDownOnRenderer &&
isMouseOverOnRenderer &&
mouseUpRenderer == mouseDownRenderer &&
!isNaN(mouseUpRenderer.index))
{
var event:UIEvent = new UIEvent(UIEvent.SELECTED, true, true);
event.renderer = mouseDownRenderer;
mouseDownRenderer.dispatchEvent(event);
}
}
private function renderer_selectingHandler(e:UIEvent):void
{
if (!e.isDefaultPrevented())
select(mouseDownRenderer);
}
}
} |
/**
* Copyright (c) 2015 egg82 (Alexander Mason)
*
* 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 egg82.engines.loggers {
import egg82.engines.InputEngine;
import egg82.enums.LogLevel;
import egg82.events.engines.InputEngineEvent;
import egg82.log.interfaces.ILogger;
import egg82.patterns.ServiceLocator;
import egg82.utils.Util;
import flash.geom.Point;
import flash.utils.getQualifiedClassName;
public class LoggingInputEngine extends InputEngine {
//vars
private var logger:ILogger = ServiceLocator.getService("logger") as ILogger;
//constructor
override public function LoggingInputEngine() {
}
//public
override public function initialize():void {
logger.writeLog("[" + getQualifiedClassName(this) + "] Initialized", LogLevel.INFO);
super.initialize();
}
override public function isKeysDown(keyCodes:Array):Boolean {
logger.writeLog("[" + getQualifiedClassName(this) + "] Called " + Util.getFunctionName(arguments.callee, this) + " with params " + JSON.stringify([keyCodes]), LogLevel.INFO);
return super.isKeysDown(keyCodes);
}
override public function isButtonsDown(controller:uint, buttonCodes:Array):Boolean {
logger.writeLog("[" + getQualifiedClassName(this) + "] Called " + Util.getFunctionName(arguments.callee, this) + " with params " + JSON.stringify([controller, buttonCodes]), LogLevel.INFO);
return super.isButtonsDown(controller, buttonCodes);
}
override public function isSticksPressed(controller:uint, stickCodes:Array):Boolean {
logger.writeLog("[" + getQualifiedClassName(this) + "] Called " + Util.getFunctionName(arguments.callee, this) + " with params " + JSON.stringify([controller, stickCodes]), LogLevel.INFO);
return super.isSticksPressed(controller, stickCodes);
}
override public function isMouseDown(mouseCodes:Array):Boolean {
logger.writeLog("[" + getQualifiedClassName(this) + "] Called " + Util.getFunctionName(arguments.callee, this) + " with params " + JSON.stringify([mouseCodes]), LogLevel.INFO);
return super.isMouseDown(mouseCodes);
}
override public function getTrigger(controller:uint, trigger:uint):Number {
logger.writeLog("[" + getQualifiedClassName(this) + "] Called " + Util.getFunctionName(arguments.callee, this) + " with params " + JSON.stringify([controller, trigger]), LogLevel.INFO);
return super.getTrigger(controller, trigger);
}
override public function getStickProperties(controller:uint, stick:uint):Point {
logger.writeLog("[" + getQualifiedClassName(this) + "] Called " + Util.getFunctionName(arguments.callee, this) + " with params " + JSON.stringify([controller, stick]), LogLevel.INFO);
return super.getStickProperties(controller, stick);
}
override public function getStick(controller:uint, stick:uint):Point {
logger.writeLog("[" + getQualifiedClassName(this) + "] Called " + Util.getFunctionName(arguments.callee, this) + " with params " + JSON.stringify([controller, stick]), LogLevel.INFO);
return super.getStick(controller, stick);
}
override public function isUsingController():Boolean {
logger.writeLog("[" + getQualifiedClassName(this) + "] Called " + Util.getFunctionName(arguments.callee, this), LogLevel.INFO);
return super.isUsingController();
}
//private
override protected function dispatch(event:String, data:Object = null):void {
if (event == InputEngineEvent.UPDATE || event == InputEngineEvent.POST_UPDATE) {
return;
}
try {
logger.writeLog("[" + getQualifiedClassName(this) + "] Dispatched event \"" + event + "\" with data " + JSON.stringify(data), LogLevel.INFO);
} catch (ex:Error) {
//logger.writeLog("[" + getQualifiedClassName(this) + "] Error while dispatching event \"" + event + "\": " + ex.message, LogLevel.WARNING);
}
super.dispatch(event, data);
}
}
} |
package com.ankamagames.dofus.network.enums
{
public class PlayerStateEnum
{
public static const NOT_CONNECTED:uint = 0;
public static const GAME_TYPE_ROLEPLAY:uint = 1;
public static const GAME_TYPE_FIGHT:uint = 2;
public static const UNKNOWN_STATE:uint = 99;
public function PlayerStateEnum()
{
super();
}
}
}
|
/*
Copyright (c) 2006, 2007 Alec Cove
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.
*/
/*
TODO:
- Need removeForces method(s)
- Center and Position are the same, needs review. Also the comments need review.
- Should have alwaysRepaint functionality for Constraints, and bump up to AbstractItem
- See if there's anywhere where Vectors can be downgraded to simple Point classes
*/
package org.cove.ape {
import flash.display.DisplayObject;
import flash.utils.getQualifiedClassName;
/**
* The abstract base class for all particles.
*
* <p>
* You should not instantiate this class directly -- instead use one of the subclasses.
* </p>
*/
public class AbstractParticle extends AbstractItem {
/** @private */
public var curr:APEVector;
/** @private */
internal var prev:APEVector;
/** @private */
internal var samp:APEVector;
/** @private */
internal var interval:Interval;
private var temp:APEVector;
private var forces:APEVector;
private var forceList:Array;
private var collision:Collision;
private var firstCollision:Boolean;
private var _kfr:Number;
private var _mass:Number;
private var _invMass:Number;
private var _friction:Number;
public var _fixed:Boolean;
public var _collidable:Boolean;
private var _center:APEVector;
public var multisample:int;
private var damping:Number;
/**
* @private
*/
public function AbstractParticle (
x:Number,
y:Number,
isFixed:Boolean,
mass:Number,
elasticity:Number,
friction:Number) {
if (getQualifiedClassName(this) == "org.cove.ape::AbstractParticle") {
throw new ArgumentError("AbstractParticle can't be instantiated directly");
}
interval = new Interval(0,0);
curr = new APEVector(x, y);
prev = new APEVector(x, y);
samp = new APEVector();
temp = new APEVector();
fixed = isFixed;
forces = new APEVector();
forceList = new Array();
collision = new Collision(new APEVector(), new APEVector());
collidable = true;
firstCollision = false;
this.mass = mass;
this.elasticity = elasticity;
this.friction = friction;
setStyle();
_center = new APEVector();
multisample = 0;
damping = APEngine.damping;
}
/**
* The mass of the particle. Valid values are greater than zero. By default, all particles
* have a mass of 1. The mass property has no relation to the size of the particle.
*
* @throws ArgumentError ArgumentError if the mass is set less than zero.
*/
public function get mass():Number {
return _mass;
}
/**
* @private
*/
public function set mass(m:Number):void {
if (m <= 0) throw new ArgumentError("mass may not be set <= 0");
_mass = m;
_invMass = 1 / _mass;
}
/**
* The elasticity of the particle. Standard values are between 0 and 1.
* The higher the value, the greater the elasticity.
*
* <p>
* During collisions the elasticity values are combined. If one particle's
* elasticity is set to 0.4 and the other is set to 0.4 then the collision will
* be have a total elasticity of 0.8. The result will be the same if one particle
* has an elasticity of 0 and the other 0.8.
* </p>
*
* <p>
* Setting the elasticity to greater than 1 (of a single particle, or in a combined
* collision) will cause particles to bounce with energy greater than naturally
* possible.
* </p>
*/
public function get elasticity():Number {
return _kfr;
}
/**
* @private
*/
public function set elasticity(k:Number):void {
_kfr = k;
}
/**
* Determines the number of intermediate position steps during each collision test.
* Setting this number higher on fast moving particles can prevent 'tunneling'
* -- when a particle moves so fast it misses collision with another particle.
*
* <p>
* If two particles both have multisample levels greater than 0 then their
* multisample levels must be equal to be tested correctly. For example, if one
* particle has a multisample level of 4 and another has a multisample level of 5
* then the two particles will not be tested for multisampled collision. This is
* due to the unequal amount of steps in the collision test.
* </p>
*
* <p>
* Multisampling is currently buggy and should only be applied to particles that
* have high velocity. You can selectively apply multisampling by doing something
* like:
* </p>
*
* <p>
* <code>
* if (myparticle.velocity.magnitude() > 20) {
* myparticle.multisample = 100;
* } else {
* myparticle.multsample = 0;
* }
* </code>
* </p>
*/
/*
public function get multisample():int {
return _multisample;
}
*/
/**
* @private
*/
/*
public function set multisample(m:int):void {
_multisample = m;
}*/
/**
* Returns A Vector of the current location of the particle
*/
public function get center():APEVector {
_center.setTo(px, py)
return _center;
}
/**
* The surface friction of the particle. Values must be in the range of 0 to 1.
*
* <p>
* 0 is no friction (slippery), 1 is full friction (sticky).
* </p>
*
* <p>
* During collisions, the friction values are summed, but are clamped between 1
* and 0. For example, If two particles have 0.7 as their surface friction, then
* the resulting friction between the two particles will be 1 (full friction).
* </p>
*
* <p>
* There is a bug in the current release where colliding non-fixed particles with
* friction greater than 0 will behave erratically. A workaround is to only set
* the friction of fixed particles.
* </p>
*
* @throws ArgumentError ArgumentError if the friction is set less than zero or
* greater than 1
*/
public function get friction():Number {
return _friction;
}
/**
* @private
*/
public function set friction(f:Number):void {
if (f < 0 || f > 1) {
throw new ArgumentError("Legal friction must be >= 0 and <=1");
}
_friction = f;
}
/**
* The fixed state of the particle. If the particle is fixed, it does not move in
* response to forces or collisions. Fixed particles are good for surfaces.
*/
public function get fixed():Boolean {
return _fixed;
}
/**
* @private
*/
public function set fixed(f:Boolean):void {
_fixed = f;
}
/**
* The position of the particle. Getting the position of the particle is useful
* for drawing it or testing it for some custom purpose.
*
* <p>
* When you get the <code>position</code> of a particle you are given a copy of
* the current location. Because of this you cannot change the position of a
* particle by altering the <code>x</code> and <code>y</code> components of the
* Vector you have retrieved from the position property. You have to do something
* instead like: <code> position = new Vector(100,100)</code>, or you can use the
* <code>px</code> and <code>py</code> properties instead.
* </p>
*
* <p>
* You can alter the position of a particle three ways: change its position, set
* its velocity, or apply a force to it. Setting the position of a non-fixed
* particle is not the same as setting its fixed property to true. A particle held
* in place by its position will behave as if it's attached there by a 0 length
* spring constraint.
* </p>
*/
public function get position():APEVector {
return new APEVector(curr.x,curr.y);
}
/**
* @private
*/
public function set position(p:APEVector):void {
curr.copy(p);
prev.copy(p);
}
/**
* The x position of this particle
*/
public function get px():Number {
return curr.x;
}
/**
* @private
*/
public function set px(x:Number):void {
curr.x = x;
prev.x = x;
}
/**
* The y position of this particle
*/
public function get py():Number {
return curr.y;
}
/**
* @private
*/
public function set py(y:Number):void {
curr.y = y;
prev.y = y;
}
/**
* The velocity of the particle. If you need to change the motion of a particle,
* you should either use this property, or one of the addForce methods. Generally,
* the addForce methods are best for slowly altering the motion. The velocity
* property is good for instantaneously setting the velocity, e.g., for
* projectiles.
*
*/
public function get velocity():APEVector {
return curr.minus(prev);
}
/**
* @private
*/
public function set velocity(v:APEVector):void {
prev = curr.minus(v);
}
/**
* Determines if the particle can collide with other particles or constraints.
* The default state is true.
*/
public function get collidable():Boolean {
return _collidable;
}
/**
* @private
*/
public function set collidable(b:Boolean):void {
_collidable = b;
}
/**
* Assigns a DisplayObject to be used when painting this particle.
*/
public function setDisplay(d:DisplayObject, offsetX:Number=0, offsetY:Number=0,
rotation:Number=0):void {
displayObject = d;
displayObjectRotation = rotation;
displayObjectOffset = new APEVector(offsetX, offsetY);
}
/**
* Adds a force to the particle. Using this method to a force directly to the
* particle will only apply that force for a single APEngine.step() cycle.
*
* @param f An IForce object.
*/
public function addForce(f:IForce):void {
forceList.push(f);
}
/**
* The <code>update()</code> method is called automatically during the
* APEngine.step() cycle. This method integrates the particle.
*/
public function update(dt2:Number):void {
if (_fixed) return;
accumulateForces();
temp.copy(curr);
var nv:APEVector = velocity;
nv.plusEquals(forces.multEquals(dt2));
curr.plusEquals(nv.multEquals(damping));
prev.copy(temp);
clearForces();
}
/**
* Resets the collision state of the particle. This value is used in conjuction
* with the CollisionEvent.FIRST_COLLISION event.
*/
public function resetFirstCollision():void {
firstCollision = false;
}
/**
* @private
*/
internal function initDisplay():void {
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
}
/**
* @private
*/
internal function getComponents(collisionNormal:APEVector):Collision {
var vel:APEVector = velocity;
var vdotn:Number = collisionNormal.dot(vel);
collision.vn = collisionNormal.mult(vdotn);
collision.vt = vel.minus(collision.vn);
return collision;
}
/**
* @private
*
* Make sure to align the overriden versions of this method in
* WheelParticle
*/
public function resolveCollision(mtd:APEVector, vel:APEVector, n:APEVector, d:Number,
o:int, p:AbstractParticle):void {
testParticleEvents(p);
if (fixed || (! solid) || (! p.solid)) return;
curr.copy(samp);
curr.plusEquals(mtd);
velocity = vel;
}
/**
* @private
*/
internal function testParticleEvents(p:AbstractParticle):void {
if (hasEventListener(CollisionEvent.COLLIDE)) {
dispatchEvent(new CollisionEvent(
CollisionEvent.COLLIDE, false, false, p));
}
if (hasEventListener(CollisionEvent.FIRST_COLLIDE) && ! firstCollision) {
firstCollision = true;
dispatchEvent(new CollisionEvent(
CollisionEvent.FIRST_COLLIDE, false, false, p));
}
}
/**
* @private
*/
public function get invMass():Number {
return (fixed) ? 0 : _invMass;
}
/**
* Accumulates both the particle forces and the global forces
*/
private function accumulateForces():void {
var f:IForce;
var len:int = forceList.length;
for (var i:int = 0; i < len; i++) {
f = forceList[i];
forces.plusEquals(f.getValue(_invMass));
}
var globalForces:Array = APEngine.forces;
len = globalForces.length;
for (i = 0; i < len; i++) {
f = globalForces[i];
forces.plusEquals(f.getValue(_invMass));
}
}
/**
* Clears out all forces on the particle
*/
private function clearForces():void {
forceList.length = 0;
forces.setTo(0,0);
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.html.beads.models
{
import org.apache.royale.core.IValueToggleButtonModel;
import org.apache.royale.events.Event;
import org.apache.royale.events.ValueChangeEvent;
/**
* The ValueToggleButtonModel class bead extends the
* org.apache.royale.html.beads.models.ToggleButtonModel and adds
* value intended to represent a collection of similar org.apache.royale.html.Buttons
* such as org.apache.royale.html.RadioButtons.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public class ValueToggleButtonModel extends ToggleButtonModel implements IValueToggleButtonModel
{
/**
* constructor.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function ValueToggleButtonModel()
{
super();
}
private var _value:Object;
/**
* The current value of the button collection.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function get value():Object
{
return _value;
}
public function set value(newValue:Object):void
{
if( newValue != _value )
{
var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", _value, newValue);
_value = newValue;
dispatchEvent(vce);
}
}
private var _groupName:String;
/**
* The name of the collection has shared by all of the buttons in the collection.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function get groupName():String
{
return _groupName;
}
public function set groupName(value:String):void
{
if( value != _groupName )
{
_groupName = value;
dispatchEvent(new Event("groupNameChange"));
}
}
private var _selectedValue:Object;
/**
* The value that is currently selected.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function get selectedValue():Object
{
return _selectedValue;
}
public function set selectedValue(newValue:Object):void
{
if( _selectedValue != newValue )
{
_selectedValue = newValue;
dispatchEvent(new Event("selectedValueChange"));
}
}
}
}
|
// 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/.
print('hello')
|
package kabam.rotmg.messaging.impl.incoming {
import flash.utils.IDataInput;
public class KeyInfoResponse extends IncomingMessage {
public var name:String;
public var description:String;
public var creator:String;
public function KeyInfoResponse(param1:uint, param2:Function) {
super(param1,param2);
}
override public function parseFromInput(param1:IDataInput) : void {
this.name = param1.readUTF();
this.description = param1.readUTF();
this.creator = param1.readUTF();
}
override public function toString() : String {
return formatToString("KEYINFORESPONSE","name","description","creator");
}
}
}
|
package cfgData.dataStruct
{
public class GuildBeastCFG
{
public var id:uint;
public var name:String = "";
public var quality:uint;
public var sceneId:uint;
public var battleNpcId:uint;
public var unitId:uint;
public function GuildBeastCFG()
{
super();
}
}
}
|
/*
* _________ __ __
* _/ / / /____ / /________ ____ ____ ___
* _/ / / __/ -_) __/ __/ _ `/ _ `/ _ \/ _ \
* _/________/ \__/\__/\__/_/ \_,_/\_, /\___/_//_/
* /___/
*
* Tetragon : Game Engine for multi-platform ActionScript projects.
* http://www.tetragonengine.com/ - Copyright (C) 2012 Sascha Balkau
*
* 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 tetragon.entity.components
{
import tetragon.entity.EntityComponent;
import flash.display.DisplayObject;
/**
* A component representing a display object that can be drawn to the screen.
* The graphic can be any kind of display object, e.g. Sprite, Shape, Bitmap etc.
*/
public class GraphicsComponent extends EntityComponent
{
//-----------------------------------------------------------------------------------------
// Properties
//-----------------------------------------------------------------------------------------
/** @private */
private var _graphicID:String;
/** @private */
private var _graphic:DisplayObject;
//-----------------------------------------------------------------------------------------
// Getters & Setters
//-----------------------------------------------------------------------------------------
public function get graphicID():String
{
return _graphicID;
}
public function set graphicID(v:String):void
{
_graphicID = v;
}
public function get graphic():DisplayObject
{
return _graphic;
}
public function set graphic(v:DisplayObject):void
{
_graphic = v;
}
}
}
|
/*
* Copyright 2007-2008 (c) Benjamin Bojko, bbojko.de
*
* This Code may be used under the conditions of the Creative
* Commons Public License "Attribution-NonCommercial 3.0 Unported"
* and thereby may be used, modified and extended for non
* commercial purposes.
*
* More information at:
* http://creativecommons.org/licenses/by-nc/3.0/legalcode
*
*/
package com.rockdot.library.util.tracker.histogramm {
import flash.display.BitmapData;
public class AbstractHistogramm {
//==================================================================
protected var _bmd:BitmapData;
protected var _values:Array;
protected var _maxValue:int=0;
protected var _maxIndex:int=0;
protected var _median:int=127;
protected var _ommitMax:Boolean=false;
protected var maxChanged:Boolean=false;
protected var medianChanged:Boolean=false;
//==================================================================
/**
*
* @param ommitMax returns 2nd max instead of 1st
*/
public function AbstractHistogramm( bmd:BitmapData, resolution:int=256, ommitMax:Boolean=false ) {
_bmd = bmd;
_ommitMax = ommitMax;
_values = new Array(resolution);
reset();
}
//==================================================================
public function update():void {
reset();
updateValues();
maxChanged = true;
medianChanged = true;
}
//==================================================================
public function reset():void {
for(var i:int=0; i<_values.length; i++) {
_values[i] = 0;
}
}
//==================================================================
public function getValue( index:int ):int {
if(index>0 && index<_values.length) return _values[index];
else return -1;
}
//==================================================================
//==================================================================
public function get bmd():BitmapData { return _bmd; }
public function get values():Array { return _values; }
public function get resolution():int { return _values.length; }
public function get ommitMax():Boolean { return _ommitMax; }
public function get maxValue():int {
if(maxChanged) updateMax();
return _maxValue;
}
public function get maxIndex():int {
if(maxChanged) updateMax();
return _maxIndex;
}
public function get median():int {
if(medianChanged) updateMedian();
return _median;
}
public function set bmd( b:BitmapData ):void { _bmd=b; }
public function set ommitMax( b:Boolean ):void { _ommitMax = b; }
//==================================================================
public function toString():String {
return "[ AbstractHistogramm ]";
}
//==================================================================
/**
*
*/
protected function updateValues():void {
trace(this+" updateValues() must be overridden");
}
/**
*
*/
protected function updateMax():void {
maxChanged = false;
_maxValue = 0;
_maxIndex = 0;
for(var i:int=0; i<_values.length; i++) {
if(_values[i] > _maxValue) {
_maxValue = _values[i];
_maxIndex = i;
}
}
if(!ommitMax) return;
// find 2nd max value
var _maxValue2:int = 0;
var _maxIndex2:int = 0;
for(var j:int=0; j<_values.length; j++) {
if(_values[j]>_maxValue2 && j!=_maxIndex) {
_maxValue2 = _values[j];
_maxIndex2 = j;
}
}
_maxValue = _maxValue2;
_maxIndex = _maxIndex2;
}
/**
*
*/
protected function updateMedian():void {
medianChanged = false;
var sum:int=0;
var halfLength:int = _bmd.width*bmd.height >> 1; // .../2
for(var i:int=0; i<_values.length; i++) {
sum += _values[i];
if(sum >= halfLength) {
_median = i;
return;
}
}
_median = -1;
}
}
} |
dynamic class gfx.controls.Button extends gfx.core.UIComponent
{
var state: String = "up";
var toggle: Boolean = false;
var doubleClickEnabled: Boolean = false;
var autoRepeat: Boolean = false;
var lockDragStateChange: Boolean = false;
var soundMap = {theme: "default", focusIn: "focusIn", focusOut: "focusOut", select: "select", rollOver: "rollOver", rollOut: "rollOut", press: "press", doubleClick: "doubleClick", click: "click"};
var _selected: Boolean = false;
var _autoSize: String = "none";
var _disableFocus: Boolean = false;
var _disableConstraints: Boolean = false;
var doubleClickDuration: Number = 250;
var buttonRepeatDuration: Number = 100;
var buttonRepeatDelay: Number = 100;
var pressedByKeyboard: Boolean = false;
var stateMap = {up: ["up"], over: ["over"], down: ["down"], release: ["release", "over"], out: ["out", "up"], disabled: ["disabled"], selecting: ["selecting", "over"], kb_selecting: ["kb_selecting", "up"], kb_release: ["kb_release", "out", "up"], kb_down: ["kb_down", "down"]};
var __height;
var __width;
var _disabled;
var _displayFocus;
var _focused;
var _group;
var _height;
var _label;
var _name;
var _parent;
var _width;
var _x;
var buttonRepeatInterval;
var constraints;
var dispatchEvent;
var dispatchEventAndSound;
var doubleClickInterval;
var focusEnabled;
var focusIndicator;
var gotoAndPlay;
var initialized;
var inspectableGroupName;
var invalidate;
var onDragOut;
var onDragOver;
var onPress;
var onRelease;
var onReleaseOutside;
var onRollOut;
var onRollOver;
var sizeIsInvalid;
var tabEnabled;
var textField;
var validateNow;
function Button()
{
super();
this.focusEnabled = this.tabEnabled = this._disableFocus ? false : !this._disabled;
if (this.inspectableGroupName != null && this.inspectableGroupName != "")
{
this.group = this.inspectableGroupName;
}
}
function get labelID()
{
return null;
}
function set labelID(value)
{
if (value != "")
{
this.label = gfx.utils.Locale.getTranslatedString(value);
}
}
function get label()
{
return this._label;
}
function set label(value)
{
this._label = value;
if (this.initialized)
{
if (this.textField != null)
{
this.textField.text = this._label;
}
if (this.autoSize != "none")
{
this.sizeIsInvalid = true;
}
this.updateAfterStateChange();
}
}
function get disabled()
{
return this._disabled;
}
function set disabled(value)
{
if (this._disabled != value)
{
super.disabled = value;
this.clearRepeatInterval();
this.focusEnabled = this.tabEnabled = this._disableFocus ? false : !this._disabled;
this.setState(this._disabled ? "disabled" : "up");
return;
}
}
function get selected()
{
return this._selected;
}
function set selected(value)
{
if (this._selected != value)
{
this._selected = value;
if (this._disabled)
{
this.setState("disabled");
}
else if (this._focused)
{
if (this.pressedByKeyboard && this.focusIndicator != null)
{
this.setState("kb_selecting");
}
else
{
this.setState("selecting");
}
}
else
{
this.setState(this.displayFocus && this.focusIndicator == null ? "over" : "up");
}
if (this.dispatchEvent != null)
{
this.dispatchEventAndSound({type: "select", selected: this._selected});
}
return;
}
}
function get groupName()
{
return this._group == null ? null : this._group.name;
}
function set groupName(value)
{
this.group = value;
}
function get group()
{
return this._group;
}
function set group(value)
{
var __reg2 = gfx.controls.ButtonGroup(value);
if (typeof value == "string")
{
__reg2 = this._parent["_buttonGroup_" + value];
if (__reg2 == null)
{
this._parent["_buttonGroup_" + value] = __reg2 = new gfx.controls.ButtonGroup(value.toString(), this._parent);
}
}
if (this._group != __reg2)
{
if (this._group != null)
{
this._group.removeButton(this);
}
this._group = __reg2;
if (this._group != null)
{
__reg2.addButton(this);
}
return;
}
}
function get disableFocus()
{
return this._disableFocus;
}
function set disableFocus(value)
{
this._disableFocus = value;
this.focusEnabled = this.tabEnabled = this._disableFocus ? false : !this._disabled;
}
function get disableConstraints()
{
return this._disableConstraints;
}
function set disableConstraints(value)
{
this._disableConstraints = value;
}
function get autoSize()
{
return this._autoSize;
}
function set autoSize(value)
{
if (this._autoSize != value)
{
this._autoSize = value;
if (this.initialized)
{
this.sizeIsInvalid = true;
this.validateNow();
}
return;
}
}
function setSize(width, height)
{
super.setSize(width, height);
}
function handleInput(details, pathToFocus)
{
if ((__reg0 = details.navEquivalent) === gfx.ui.NavigationCode.ENTER)
{
var __reg2 = details.controllerIdx;
if (details.value == "keyDown" || details.value == "keyHold")
{
if (!this.pressedByKeyboard)
{
this.handlePress(__reg2);
}
}
else
{
this.handleRelease(__reg2);
}
return true;
}
return false;
}
function toString()
{
return "[Scaleform Button " + this._name + "]";
}
function configUI()
{
this.constraints = new gfx.utils.Constraints(this, true);
if (!this._disableConstraints)
{
this.constraints.addElement(this.textField, gfx.utils.Constraints.ALL);
}
super.configUI();
if (this._autoSize != "none")
{
this.sizeIsInvalid = true;
}
this.onRollOver = this.handleMouseRollOver;
this.onRollOut = this.handleMouseRollOut;
this.onPress = this.handleMousePress;
this.onRelease = this.handleMouseRelease;
this.onReleaseOutside = this.handleReleaseOutside;
this.onDragOver = this.handleDragOver;
this.onDragOut = this.handleDragOut;
if (this.focusIndicator != null && !this._focused && this.focusIndicator._totalFrames == 1)
{
this.focusIndicator._visible = false;
}
this.updateAfterStateChange();
}
function draw()
{
if (this.sizeIsInvalid)
{
this.alignForAutoSize();
this._width = this.__width;
this._height = this.__height;
}
if (this.initialized)
{
this.constraints.update(this.__width, this.__height);
}
}
function updateAfterStateChange()
{
if (this.initialized)
{
if (this.textField != null && this._label != null)
{
this.textField.text = this._label;
}
this.validateNow();
if (this.constraints != null)
{
this.constraints.update(this.width, this.height);
}
this.dispatchEvent({type: "stateChange", state: this.state});
}
}
function calculateWidth()
{
if (this.constraints == null)
{
this.invalidate();
return 0;
}
var __reg2 = this.constraints.getElement(this.textField).metrics;
var __reg3 = this.textField.textWidth + __reg2.left + __reg2.right + 5;
return __reg3;
}
function alignForAutoSize()
{
if (!this.initialized || this._autoSize == "none" || this.textField == null)
{
return undefined;
}
var __reg2 = this.__width;
this.width = this.calculateWidth();
if ((__reg0 = this._autoSize) === "right")
{
var __reg3 = this._x + __reg2;
this._x = __reg3 - this.__width;
return;
}
else if (__reg0 !== "center")
{
return;
}
var __reg4 = this._x + __reg2 / 2;
this._x = __reg4 - this.__width / 2;
return;
}
function setState(state)
{
this.state = state;
var __reg5 = this.getStatePrefixes();
var __reg3 = this.stateMap[state];
if (__reg3 == null || __reg3.length == 0)
{
return undefined;
}
do
{
var __reg4 = __reg5.pop().toString();
var __reg2 = __reg3.length - 1;
while (__reg2 >= 0)
{
this.gotoAndPlay(__reg4 + __reg3[__reg2]);
--__reg2;
}
}
while (__reg5.length > 0);
this.updateAfterStateChange();
}
function getStatePrefixes()
{
return this._selected ? ["selected_", ""] : [""];
}
function changeFocus()
{
if (this._disabled)
{
return undefined;
}
if (this.focusIndicator == null)
{
this.setState(this._focused || this._displayFocus ? "over" : "out");
if (this.pressedByKeyboard && !this._focused)
{
this.pressedByKeyboard = false;
}
}
if (this.focusIndicator != null)
{
if (this.focusIndicator._totalframes == 1)
{
this.focusIndicator._visible = this._focused != 0;
}
else
{
this.focusIndicator.gotoAndPlay(this._focused ? "show" : "hide");
this.focusIndicator.gotoAndPlay("state" + this._focused);
}
if (this.pressedByKeyboard && !this._focused)
{
this.setState("kb_release");
this.pressedByKeyboard = false;
}
}
}
function handleMouseRollOver(controllerIdx)
{
if (this._disabled)
{
return undefined;
}
if ((!this._focused && !this._displayFocus) || this.focusIndicator != null)
{
this.setState("over");
}
this.dispatchEventAndSound({type: "rollOver", controllerIdx: controllerIdx});
}
function handleMouseRollOut(controllerIdx)
{
if (this._disabled)
{
return undefined;
}
if ((!this._focused && !this._displayFocus) || this.focusIndicator != null)
{
this.setState("out");
}
this.dispatchEventAndSound({type: "rollOut", controllerIdx: controllerIdx});
}
function handleMousePress(controllerIdx, keyboardOrMouse, button)
{
if (this._disabled)
{
return undefined;
}
if (!this._disableFocus)
{
Selection.setFocus(this, controllerIdx);
}
this.setState("down");
this.dispatchEventAndSound({type: "press", controllerIdx: controllerIdx, button: button});
if (this.autoRepeat)
{
this.buttonRepeatInterval = setInterval(this, "beginButtonRepeat", this.buttonRepeatDelay, controllerIdx, button);
}
}
function handlePress(controllerIdx)
{
if (this._disabled)
{
return undefined;
}
this.pressedByKeyboard = true;
this.setState(this.focusIndicator == null ? "down" : "kb_down");
this.dispatchEventAndSound({type: "press", controllerIdx: controllerIdx});
}
function handleMouseRelease(controllerIdx, keyboardOrMouse, button)
{
if (this._disabled)
{
return undefined;
}
clearInterval(this.buttonRepeatInterval);
delete this.buttonRepeatInterval;
if (this.doubleClickEnabled)
{
if (this.doubleClickInterval == null)
{
this.doubleClickInterval = setInterval(this, "doubleClickExpired", this.doubleClickDuration);
}
else
{
this.doubleClickExpired();
this.dispatchEventAndSound({type: "doubleClick", controllerIdx: controllerIdx, button: button});
this.setState("release");
return undefined;
}
}
this.setState("release");
this.handleClick(controllerIdx, button);
}
function handleRelease(controllerIdx)
{
if (this._disabled)
{
return undefined;
}
this.setState(this.focusIndicator == null ? "release" : "kb_release");
this.handleClick(controllerIdx);
this.pressedByKeyboard = false;
}
function handleClick(controllerIdx, button)
{
if (this.toggle)
{
this.selected = !this._selected;
}
this.dispatchEventAndSound({type: "click", controllerIdx: controllerIdx, button: button});
}
function handleDragOver(controllerIdx, button)
{
if (this._disabled || this.lockDragStateChange)
{
return undefined;
}
if (this._focused || this._displayFocus)
{
this.setState(this.focusIndicator == null ? "down" : "kb_down");
}
else
{
this.setState("over");
}
this.dispatchEvent({type: "dragOver", controllerIdx: controllerIdx, button: button});
}
function handleDragOut(controllerIdx, button)
{
if (this._disabled || this.lockDragStateChange)
{
return undefined;
}
if (this._focused || this._displayFocus)
{
this.setState(this.focusIndicator == null ? "release" : "kb_release");
}
else
{
this.setState("out");
}
this.dispatchEvent({type: "dragOut", controllerIdx: controllerIdx, button: button});
}
function handleReleaseOutside(controllerIdx, button)
{
this.clearRepeatInterval();
if (this._disabled)
{
return undefined;
}
if (this.lockDragStateChange)
{
if (this._focused || this._displayFocus)
{
this.setState(this.focusIndicator == null ? "release" : "kb_release");
}
else
{
this.setState("kb_release");
}
}
this.dispatchEvent({type: "releaseOutside", state: this.state, button: button});
}
function doubleClickExpired()
{
clearInterval(this.doubleClickInterval);
delete(this.doubleClickInterval);
}
function beginButtonRepeat(controllerIdx, button)
{
this.clearRepeatInterval();
this.buttonRepeatInterval = setInterval(this, "handleButtonRepeat", this.buttonRepeatDuration, controllerIdx, button);
}
function handleButtonRepeat(controllerIdx, button)
{
this.dispatchEventAndSound({type: "click", controllerIdx: controllerIdx, button: button});
}
function clearRepeatInterval()
{
clearInterval(this.buttonRepeatInterval);
delete(this.buttonRepeatInterval);
}
}
|
/*
Feathers
Copyright 2012-2020 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.layout
{
import starling.display.DisplayObject;
import starling.errors.AbstractClassError;
import starling.events.Event;
import starling.events.EventDispatcher;
/**
* Dispatched when a property of the layout changes, indicating that a
* redraw is probably needed.
*
* <p>The properties of the event object have the following values:</p>
* <table class="innertable">
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td><code>bubbles</code></td><td>false</td></tr>
* <tr><td><code>currentTarget</code></td><td>The Object that defines the
* event listener that handles the event. For example, if you use
* <code>myButton.addEventListener()</code> to register an event listener,
* myButton is the value of the <code>currentTarget</code>.</td></tr>
* <tr><td><code>data</code></td><td>null</td></tr>
* <tr><td><code>target</code></td><td>The Object that dispatched the event;
* it is not always the Object listening for the event. Use the
* <code>currentTarget</code> property to always access the Object
* listening for the event.</td></tr>
* </table>
*
* @eventType starling.events.Event.CHANGE
*/
[Event(name="change",type="starling.events.Event")]
/**
* Dispatched when the layout would like to adjust the container's scroll
* position. Typically, this is used when the virtual dimensions of an item
* differ from its real dimensions. This event allows the container to
* adjust scrolling so that it appears smooth, without jarring jumps or
* shifts when an item resizes.
*
* <p>The properties of the event object have the following values:</p>
* <table class="innertable">
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td><code>bubbles</code></td><td>false</td></tr>
* <tr><td><code>currentTarget</code></td><td>The Object that defines the
* event listener that handles the event. For example, if you use
* <code>myButton.addEventListener()</code> to register an event listener,
* myButton is the value of the <code>currentTarget</code>.</td></tr>
* <tr><td><code>data</code></td><td>A <code>flash.geom.Point</code> object
* representing how much the scroll position should be adjusted in both
* horizontal and vertical directions. Measured in pixels.</td></tr>
* <tr><td><code>target</code></td><td>The Object that dispatched the event;
* it is not always the Object listening for the event. Use the
* <code>currentTarget</code> property to always access the Object
* listening for the event.</td></tr>
* </table>
*
* @eventType starling.events.Event.SCROLL
*/
[Event(name="scroll",type="starling.events.Event")]
public class BaseVariableVirtualLayout extends EventDispatcher
{
/**
* Constructor.
*/
public function BaseVariableVirtualLayout()
{
super();
if(Object(this).constructor === BaseLinearLayout)
{
throw new AbstractClassError()
}
}
/**
* @private
*/
protected var _virtualCache:Array = [];
/**
* @private
*/
protected var _useVirtualLayout:Boolean = true;
/**
* @copy feathers.layout.IVirtualLayout#useVirtualLayout
*
* @default true
*/
public function get useVirtualLayout():Boolean
{
return this._useVirtualLayout;
}
/**
* @private
*/
public function set useVirtualLayout(value:Boolean):void
{
if(this._useVirtualLayout == value)
{
return;
}
this._useVirtualLayout = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _typicalItem:DisplayObject;
/**
* @copy feathers.layout.IVirtualLayout#typicalItem
*
* @see #resetTypicalItemDimensionsOnMeasure
* @see #typicalItemWidth
* @see #typicalItemHeight
*/
public function get typicalItem():DisplayObject
{
return this._typicalItem;
}
/**
* @private
*/
public function set typicalItem(value:DisplayObject):void
{
if(this._typicalItem == value)
{
return;
}
this._typicalItem = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _hasVariableItemDimensions:Boolean = false;
/**
* When the layout is virtualized, and this value is true, the items
* may have variable dimensions. If false, the items will all share
* the same dimensions with the typical item.
*
* @default false
*/
public function get hasVariableItemDimensions():Boolean
{
return this._hasVariableItemDimensions;
}
/**
* @private
*/
public function set hasVariableItemDimensions(value:Boolean):void
{
if(this._hasVariableItemDimensions == value)
{
return;
}
this._hasVariableItemDimensions = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @copy feathers.layout.ILayout#requiresLayoutOnScroll
*/
public function get requiresLayoutOnScroll():Boolean
{
return this._useVirtualLayout;
}
/**
* @copy feathers.layout.IVariableVirtualLayout#resetVariableVirtualCache()
*/
public function resetVariableVirtualCache():void
{
this._virtualCache.length = 0;
}
/**
* @copy feathers.layout.IVariableVirtualLayout#resetVariableVirtualCacheAtIndex()
*/
public function resetVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void
{
delete this._virtualCache[index];
if(item)
{
this._virtualCache[index] = item.height;
this.dispatchEventWith(Event.CHANGE);
}
}
/**
* @copy feathers.layout.IVariableVirtualLayout#addToVariableVirtualCacheAtIndex()
*/
public function addToVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void
{
var heightValue:* = item ? item.height : undefined;
this._virtualCache.insertAt(index, heightValue);
}
/**
* @copy feathers.layout.IVariableVirtualLayout#removeFromVariableVirtualCacheAtIndex()
*/
public function removeFromVariableVirtualCacheAtIndex(index:int):void
{
this._virtualCache.removeAt(index);
}
}
} |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import DefaultClass.*;
import com.adobe.test.Assert;
// var SECTION = "Definitions"; // provide a document reference (ie, ECMA section)
// var VERSION = "AS 3.0"; // Version of JavaScript or ECMA
// var TITLE = "Override public function in final class extending default class"; // Provide ECMA section title or a description
var BUGNUMBER = "";
var CLASSDEFN = new FinExtDefaultOverRidePublic();
var booleanValue:Boolean = true;
Assert.expectEq( "CLASSDEFN.setPubBoolean( booleanValue ); CLASSDEFN.getPubBoolean()", booleanValue, ( CLASSDEFN.setPubBoolean( booleanValue ), CLASSDEFN.getPubBoolean() ) );
Assert.expectEq( "CLASSDEFN.orSet", true, CLASSDEFN.orSet );
Assert.expectEq( "CLASSDEFN.orGet", true, CLASSDEFN.orGet );
// This function is for executing the test case and then
// displaying the result on to the console or the LOG file.
|
package com.playata.application.ui.elements.item
{
import com.playata.application.data.constants.CItemTemplate;
import com.playata.application.data.item.Item;
import com.playata.application.data.item.ItemPatternFilter;
import com.playata.application.data.item_pattern.ItemPattern;
import com.playata.application.data.user.User;
import com.playata.application.ui.elements.generic.button.UiButton;
import com.playata.application.ui.elements.generic.checkbox.UiCheckBox;
import com.playata.application.ui.elements.generic.textfield.UiTextTooltip;
import com.playata.framework.core.Runtime;
import com.playata.framework.core.TypedObject;
import com.playata.framework.display.ui.controls.ITextInput;
import com.playata.framework.input.InteractionEvent;
import com.playata.framework.localization.LocText;
import visuals.ui.elements.sewing_machine.SymbolItemPatternFilterGeneric;
public class UiItemPatternFilter
{
private static var _filterText:String = "";
private static var _showStatRewards:Boolean = true;
private static var _showItemRewards:Boolean = true;
private static var _showEnergyRewards:Boolean = true;
private static var _showTitleRewards:Boolean = true;
private static var _showEventItem:Boolean = true;
private static var _showStoryDungeonItem:Boolean = true;
private static var _showOtherItem:Boolean = true;
private static var _showCommon:Boolean = true;
private static var _showRare:Boolean = true;
private static var _showEpic:Boolean = true;
private var _content:SymbolItemPatternFilterGeneric = null;
private var _callback:Function = null;
private var _ckbShowStat:UiCheckBox = null;
private var _ckbShowItem:UiCheckBox = null;
private var _ckbShowEnergy:UiCheckBox = null;
private var _ckbShowTitle:UiCheckBox = null;
private var _ckbShowEventItem:UiCheckBox = null;
private var _ckbShowStoryDungeonItem:UiCheckBox = null;
private var _ckbShowOtherItem:UiCheckBox = null;
private var _ckbShowCommon:UiCheckBox = null;
private var _ckbShowRare:UiCheckBox = null;
private var _ckbShowEpic:UiCheckBox = null;
private var _tooltipSearch:UiTextTooltip = null;
private var _btnSaveSettings:UiButton = null;
public function UiItemPatternFilter(param1:SymbolItemPatternFilterGeneric, param2:Function)
{
super();
_content = param1;
_content.visible = false;
_callback = param2;
getSavedSettings();
_content.txtShowStatRewards.text = LocText.current.text("dialog/item_pattern/show_stat_rewards");
_content.txtShowStatRewards.autoFontSize = true;
_content.txtShowItemRewards.text = LocText.current.text("dialog/item_pattern/show_item_rewards");
_content.txtShowItemRewards.autoFontSize = true;
_content.txtShowEnergyRewards.text = LocText.current.text("dialog/item_pattern/show_quest_energy_rewards");
_content.txtShowEnergyRewards.autoFontSize = true;
_content.txtShowTitleRewards.text = LocText.current.text("dialog/item_pattern/show_title_rewards");
_content.txtShowTitleRewards.autoFontSize = true;
_content.txtShowEventItem.text = LocText.current.text("dialog/item_pattern/show_event_items");
_content.txtShowEventItem.autoFontSize = true;
_content.txtShowStoryDungeonItem.text = LocText.current.text("dialog/item_pattern/show_story_dungeon_items");
_content.txtShowStoryDungeonItem.autoFontSize = true;
_content.txtShowOtherItem.text = LocText.current.text("dialog/item_pattern/show_other_items");
_content.txtShowOtherItem.autoFontSize = true;
_content.txtShowCommon.text = LocText.current.text("dialog/item_pattern/show_common_items");
_content.txtShowCommon.autoFontSize = true;
_content.txtShowRare.text = LocText.current.text("dialog/item_pattern/show_rare_items");
_content.txtShowRare.autoFontSize = true;
_content.txtShowEpic.text = LocText.current.text("dialog/item_pattern/show_epic_items");
_content.txtShowEpic.autoFontSize = true;
_ckbShowStat = new UiCheckBox(_content.ckbShowStatRewards,_showStatRewards,"",onCheckedChangedShowStatRewards,null,_content.txtShowStatRewards);
_ckbShowItem = new UiCheckBox(_content.ckbShowItemRewards,_showItemRewards,"",onCheckedChangedShowItemRewards,null,_content.txtShowItemRewards);
_ckbShowEnergy = new UiCheckBox(_content.ckbShowEnergyRewards,_showEnergyRewards,"",onCheckedChangedShowEnergyRewards,null,_content.txtShowEnergyRewards);
_ckbShowTitle = new UiCheckBox(_content.ckbShowTitleRewards,_showTitleRewards,"",onCheckedChangedShowTitleRewards,null,_content.txtShowTitleRewards);
_ckbShowEventItem = new UiCheckBox(_content.ckbShowEventItem,_showEventItem,"",onCheckedChangedShowEventItem,null,_content.txtShowEventItem);
_ckbShowStoryDungeonItem = new UiCheckBox(_content.ckbShowStoryDungeonItem,_showStoryDungeonItem,"",onCheckedChangedShowStoryDungeonItem,null,_content.txtShowStoryDungeonItem);
_ckbShowOtherItem = new UiCheckBox(_content.ckbShowOtherItem,_showOtherItem,"",onCheckedChangedShowOtherItem,null,_content.txtShowOtherItem);
_ckbShowCommon = new UiCheckBox(_content.ckbShowCommon,_showCommon,"",onCheckedChangedShowCommon,null,_content.txtShowCommon);
_ckbShowRare = new UiCheckBox(_content.ckbShowRare,_showRare,"",onCheckedChangedShowRare,null,_content.txtShowRare);
_ckbShowEpic = new UiCheckBox(_content.ckbShowEpic,_showEpic,"",onCheckedChangedShowEpic,null,_content.txtShowEpic);
_tooltipSearch = new UiTextTooltip(_content.inputSearch,LocText.current.text("dialog/item_pattern/button_search_tooltip"));
if(_filterText != "")
{
_content.inputSearch.text = _filterText;
}
else
{
_content.inputSearch.text = LocText.current.text("dialog/item_pattern/search_text");
}
_content.inputSearch.onClick.add(handleSearchClick);
_content.inputSearch.onChange.add(handleTextChanged);
_btnSaveSettings = new UiButton(_content.btnSaveSettings,LocText.current.text("dialog/item_pattern/button_save_filter"),updateSavedSettings);
_content.background.applySettings(new TypedObject({"interactionEnabled":true}));
updateSaveButton();
}
public static function isAllowed(param1:ItemPattern) : Boolean
{
var _loc2_:Boolean = true;
switch(int(param1.currentTargetValue().rewardType) - 1)
{
case 0:
_loc2_ = _showStatRewards;
break;
case 1:
_loc2_ = _showItemRewards;
break;
case 2:
_loc2_ = _showEnergyRewards;
}
if(!_loc2_ && param1.currentTargetValue().hasTitleReward)
{
_loc2_ = _showTitleRewards;
}
if(_loc2_)
{
_loc2_ = false;
var _loc5_:int = 0;
var _loc4_:* = param1.getItemIdentifiers(User.current.character.gender);
for each(var _loc3_ in param1.getItemIdentifiers(User.current.character.gender))
{
if(isItemAllowed(_loc3_,param1))
{
_loc2_ = true;
break;
}
}
if(!_loc2_ && _filterText != "" && _filterText != LocText.current.text("dialog/item_pattern/search_text"))
{
if(param1.title.toLowerCase().indexOf(_filterText) >= 0)
{
_loc2_ = true;
}
else
{
_loc2_ = false;
}
}
}
return _loc2_;
}
public static function isItemAllowed(param1:String, param2:ItemPattern) : Boolean
{
var _loc3_:* = null;
var _loc4_:* = null;
var _loc5_:Boolean = true;
if(_filterText != "" && _filterText != LocText.current.text("dialog/item_pattern/search_text"))
{
if(param2.title.toLowerCase().indexOf(_filterText) < 0)
{
_loc5_ = false;
}
if(!_loc5_)
{
_loc3_ = LocText.current.text("item/" + Item.getBaseIdentifier(param1) + "/name");
if(_loc3_.toLowerCase().indexOf(_filterText) >= 0)
{
_loc5_ = true;
}
}
}
if(_loc5_)
{
_loc4_ = CItemTemplate.fromId(param1);
if(_loc4_.quality == 1 && !_showCommon)
{
_loc5_ = false;
}
else if(_loc4_.quality == 2 && !_showRare)
{
_loc5_ = false;
}
else if(_loc4_.quality == 3 && !_showEpic)
{
_loc5_ = false;
}
if(_loc5_)
{
_loc5_ = false;
if(!_loc5_ && Item.isStoryDungeonItem(param1))
{
_loc5_ = _showStoryDungeonItem;
}
if(!_loc5_ && _loc4_.isEvent)
{
_loc5_ = _showEventItem;
}
if(!_loc5_ && !Item.isStoryDungeonItem(param1) && !_loc4_.isEvent)
{
_loc5_ = _showOtherItem;
}
}
}
return _loc5_;
}
public static function get isFilterActive() : Boolean
{
return !_showStatRewards || !_showItemRewards || !_showEnergyRewards || !_showTitleRewards || !_showEventItem || !_showStoryDungeonItem || !_showOtherItem || !_showCommon || !_showRare || !_showEpic;
}
public function dispose() : void
{
_btnSaveSettings.dispose();
_btnSaveSettings = null;
_ckbShowStat.dispose();
_ckbShowStat = null;
_ckbShowItem.dispose();
_ckbShowItem = null;
_ckbShowEnergy.dispose();
_ckbShowEnergy = null;
_ckbShowTitle.dispose();
_ckbShowTitle = null;
_ckbShowEventItem.dispose();
_ckbShowEventItem = null;
_ckbShowStoryDungeonItem.dispose();
_ckbShowStoryDungeonItem = null;
_ckbShowOtherItem.dispose();
_ckbShowOtherItem = null;
_ckbShowCommon.dispose();
_ckbShowCommon = null;
_ckbShowRare.dispose();
_ckbShowRare = null;
_ckbShowEpic.dispose();
_ckbShowEpic = null;
_callback = null;
_content = null;
_filterText = "";
_showStatRewards = true;
_showItemRewards = true;
_showEnergyRewards = true;
_showTitleRewards = true;
_showEventItem = true;
_showStoryDungeonItem = true;
_showOtherItem = true;
_showCommon = true;
_showRare = true;
_showEpic = true;
}
private function getSavedSettings() : void
{
var _loc1_:ItemPatternFilter = User.current.itemPatternFilter;
if(_loc1_)
{
_showStatRewards = _loc1_.showStatRewards;
_showItemRewards = _loc1_.showItemRewards;
_showEnergyRewards = _loc1_.showEnergyRewards;
_showTitleRewards = _loc1_.showTitleRewards;
_showEventItem = _loc1_.showEventItem;
_showStoryDungeonItem = _loc1_.showStoryDungeonItem;
_showOtherItem = _loc1_.showOtherItem;
_showCommon = _loc1_.showCommon;
_showRare = _loc1_.showRare;
_showEpic = _loc1_.showEpic;
}
}
private function updateSavedSettings(param1:InteractionEvent) : void
{
var _loc2_:* = null;
if(!_showStatRewards && !_showItemRewards && !_showEnergyRewards && !_showTitleRewards && !_showEventItem && !_showStoryDungeonItem && !_showOtherItem && !_showCommon && !_showRare && !_showEpic)
{
_loc2_ = {
"ssr":true,
"sir":true,
"ser":true,
"str":true,
"sei":true,
"ssdi":true,
"soi":true,
"srci":true,
"srri":true,
"srei":true
};
}
else
{
_loc2_ = {
"ssr":_showStatRewards,
"sir":_showItemRewards,
"ser":_showEnergyRewards,
"str":_showTitleRewards,
"sei":_showEventItem,
"ssdi":_showStoryDungeonItem,
"soi":_showOtherItem,
"srci":_showCommon,
"srri":_showRare,
"srei":_showEpic
};
}
User.current.setSettingValue("item_pattern_filter_settings",_loc2_);
updateSaveButton();
}
public function toggle() : void
{
_content.visible = !_content.visible;
if(_content.inputSearch.text == "")
{
_content.inputSearch.text = LocText.current.text("dialog/item_pattern/search_text");
}
}
public function hide() : void
{
_content.visible = false;
if(_content.inputSearch.text == "")
{
_content.inputSearch.text = LocText.current.text("dialog/item_pattern/search_text");
}
}
private function handleSearchClick(param1:InteractionEvent) : void
{
if(_content.inputSearch.text == LocText.current.text("dialog/item_pattern/search_text"))
{
_content.inputSearch.text = "";
}
}
private function handleTextChanged(param1:ITextInput) : void
{
_filterText = _content.inputSearch.text.toLowerCase();
Runtime.delayFunction(textChanged,0.5,[_filterText]);
}
private function textChanged(param1:String) : void
{
if(_callback != null && param1 == _filterText)
{
_callback();
}
}
private function onCheckedChangedShowStatRewards(param1:Boolean) : void
{
_showStatRewards = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowItemRewards(param1:Boolean) : void
{
_showItemRewards = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowEnergyRewards(param1:Boolean) : void
{
_showEnergyRewards = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowTitleRewards(param1:Boolean) : void
{
_showTitleRewards = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowEventItem(param1:Boolean) : void
{
_showEventItem = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowStoryDungeonItem(param1:Boolean) : void
{
_showStoryDungeonItem = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowOtherItem(param1:Boolean) : void
{
_showOtherItem = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowCommon(param1:Boolean) : void
{
_showCommon = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowRare(param1:Boolean) : void
{
_showRare = param1;
_callback();
updateSaveButton();
}
private function onCheckedChangedShowEpic(param1:Boolean) : void
{
_showEpic = param1;
_callback();
updateSaveButton();
}
private function updateSaveButton() : void
{
var _loc1_:ItemPatternFilter = User.current.itemPatternFilter;
if(_loc1_)
{
_btnSaveSettings.buttonEnabled = !(_showStatRewards == _loc1_.showStatRewards && _showItemRewards == _loc1_.showItemRewards && _showEnergyRewards == _loc1_.showEnergyRewards && _showTitleRewards == _loc1_.showTitleRewards && _showEventItem == _loc1_.showEventItem && _showStoryDungeonItem == _loc1_.showStoryDungeonItem && _showOtherItem == _loc1_.showOtherItem && _showCommon == _loc1_.showCommon && _showRare == _loc1_.showRare && _showEpic == _loc1_.showEpic);
}
}
}
}
|
package com.zcup.core.net.remote
{
/**
*
* @atuhor: mldongs
* @qq: 25772076
* @time: Aug 11, 2011 3:28:51 PM
**/
public interface IResponder
{
/**
* 回调成功函数
* @param result
* 结果
*
*/
function onResult(result:Result):void;
/**
* 回调失败函数
* @param fault
*
*/
function onFault(fault:Object):void;
}
} |
package {
internal interface ILogger {
function log(msg:String):void;
}
}
|
package com.github.izerui.file.event
{
import flash.events.Event;
public class FileUploadEvent extends Event
{
public static const UPLOAD_SINGLE_FILE_COMPLETE:String="upload_single_file_complete";
public static const UPLOAD_COMPLETE:String="upload_complete";
public function FileUploadEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
}
}
} |
package com.playata.framework.network.lib.flash
{
import com.playata.framework.core.data.IByteArray;
import com.playata.framework.core.error.CancelException;
import com.playata.framework.core.error.IOException;
import com.playata.framework.core.error.SecurityException;
import com.playata.framework.core.lib.flash.FlashByteArray;
import com.playata.framework.core.signal.ISignal;
import com.playata.framework.core.signal.Signal;
import com.playata.framework.network.DataProgress;
import com.playata.framework.network.IUriData;
import com.playata.framework.network.UriDataType;
import com.playata.framework.network.request.RequestData;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.events.SecurityErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class FlashUriData implements IUriData
{
protected var _uri:String = null;
protected var _dataType:UriDataType = null;
protected var _requestMethod:String = null;
protected var _requestData:RequestData = null;
protected var _urlLoader:URLLoader = null;
protected var _onProgress:ISignal = null;
protected var _onComplete:ISignal = null;
protected var _onError:ISignal = null;
protected var _data = null;
public function FlashUriData(param1:String, param2:UriDataType)
{
super();
_uri = param1;
_dataType = param2;
}
public function dispose() : void
{
disposeUrlLoader();
if(!§§pop())
{
_onProgress.removeAll();
}
if(!§§pop())
{
_onComplete.removeAll();
}
if(!§§pop())
{
_onError.removeAll();
}
}
public function get onProgress() : ISignal
{
if(_onProgress === null)
{
_onProgress = new Signal();
}
return _onProgress;
}
public function get onComplete() : ISignal
{
if(_onComplete === null)
{
_onComplete = new Signal();
}
return _onComplete;
}
public function get onError() : ISignal
{
if(_onError === null)
{
_onError = new Signal();
}
return _onError;
}
public function get isLoaded() : Boolean
{
return _data !== null;
}
public function get dataAsBytes() : IByteArray
{
if(_data === null)
{
return null;
}
return new FlashByteArray(_data);
}
public function get dataAsString() : String
{
if(_data === null)
{
return null;
}
return _data as String;
}
public function set requestMethod(param1:String) : void
{
_requestMethod = param1;
}
public function get requestMethod() : String
{
return _requestMethod;
}
public function set requestData(param1:RequestData) : void
{
_requestData = param1;
}
public function get requestData() : RequestData
{
return _requestData;
}
public function load(param1:Function = null, param2:Function = null, param3:Function = null) : void
{
if(param1 !== null)
{
this.onError.add(param1);
}
if(param2 !== null)
{
this.onComplete.add(param2);
}
if(param3 !== null)
{
this.onProgress.add(param3);
}
var _loc4_:URLRequest = new URLRequest(_uri);
if(_requestMethod != null)
{
_loc4_.method = _requestMethod;
}
if(_requestData != null)
{
_loc4_.data = _requestData.asURLVariables;
}
_urlLoader = new URLLoader();
_urlLoader.dataFormat = _dataType == UriDataType.BINARY?"binary":"text";
_urlLoader.addEventListener("ioError",handleIoError);
_urlLoader.addEventListener("securityError",handleSecurityError);
_urlLoader.addEventListener("progress",handleProgress);
_urlLoader.addEventListener("complete",handleComplete);
_urlLoader.load(_loc4_);
}
public function cancel() : void
{
_onComplete = null;
_data = null;
disposeUrlLoader();
if(!§§pop())
{
_onError.dispatch(new CancelException("UriLoader cancelled"));
}
}
private function handleIoError(param1:IOErrorEvent) : void
{
if(!§§pop())
{
_onError.dispatch(new IOException(param1.text,param1.errorID));
}
}
private function handleSecurityError(param1:SecurityErrorEvent) : void
{
if(!§§pop())
{
_onError.dispatch(new SecurityException(param1.text,param1.errorID));
}
}
private function handleProgress(param1:ProgressEvent) : void
{
if(!§§pop())
{
_onProgress.dispatch(new DataProgress(param1.bytesLoaded,param1.bytesTotal));
}
}
private function handleComplete(param1:Event) : void
{
_data = _urlLoader.data;
disposeUrlLoader();
if(!§§pop())
{
_onComplete.dispatch();
}
}
private function disposeUrlLoader() : void
{
if(_urlLoader != null)
{
_urlLoader.removeEventListener("ioError",handleIoError);
_urlLoader.removeEventListener("securityError",handleSecurityError);
_urlLoader.removeEventListener("progress",handleProgress);
_urlLoader.removeEventListener("complete",handleComplete);
_urlLoader.data = null;
try
{
_urlLoader.close();
}
catch(e:Error)
{
}
_urlLoader = null;
}
}
}
}
|
package com.company.assembleegameclient.objects {
import com.company.assembleegameclient.game.GameSprite;
import com.company.assembleegameclient.ui.panels.Panel;
import com.company.assembleegameclient.ui.tooltip.ToolTip;
import flash.display.BitmapData;
import kabam.rotmg.game.view.SellableObjectPanel;
public class SellableObject extends GameObject implements IInteractiveObject {
public var price_:int = 0;
public var currency_:int = -1;
public var rankReq_:int = 0;
public var guildRankReq_:int = -1;
public var quantity_:int = 1;
public function SellableObject(_arg1:XML) {
super(_arg1);
isInteractive_ = true;
}
public function setPrice(_arg1:int):void {
this.price_ = _arg1;
}
public function setCurrency(_arg1:int):void {
this.currency_ = _arg1;
}
public function setRankReq(_arg1:int):void {
this.rankReq_ = _arg1;
}
public function soldObjectName():String {
return (null);
}
public function soldObjectInternalName():String {
return (null);
}
public function getTooltip():ToolTip {
return (null);
}
public function getIcon():BitmapData {
return (null);
}
public function getSellableType():int {
return (-1);
}
public function getQuantity():int {
return (this.quantity_);
}
public function getPanel(_arg1:GameSprite):Panel {
return (new SellableObjectPanel(_arg1, this));
}
}
}
|
package com.ankamagames.dofus.network.messages.game.actions.fight
{
import com.ankamagames.dofus.network.messages.game.actions.AbstractGameActionMessage;
import com.ankamagames.jerakine.network.CustomDataWrapper;
import com.ankamagames.jerakine.network.ICustomDataInput;
import com.ankamagames.jerakine.network.ICustomDataOutput;
import com.ankamagames.jerakine.network.INetworkMessage;
import com.ankamagames.jerakine.network.utils.FuncTree;
import flash.utils.ByteArray;
public class GameActionFightExchangePositionsMessage extends AbstractGameActionMessage implements INetworkMessage
{
public static const protocolId:uint = 8844;
private var _isInitialized:Boolean = false;
public var targetId:Number = 0;
public var casterCellId:int = 0;
public var targetCellId:int = 0;
public function GameActionFightExchangePositionsMessage()
{
super();
}
override public function get isInitialized() : Boolean
{
return super.isInitialized && this._isInitialized;
}
override public function getMessageId() : uint
{
return 8844;
}
public function initGameActionFightExchangePositionsMessage(actionId:uint = 0, sourceId:Number = 0, targetId:Number = 0, casterCellId:int = 0, targetCellId:int = 0) : GameActionFightExchangePositionsMessage
{
super.initAbstractGameActionMessage(actionId,sourceId);
this.targetId = targetId;
this.casterCellId = casterCellId;
this.targetCellId = targetCellId;
this._isInitialized = true;
return this;
}
override public function reset() : void
{
super.reset();
this.targetId = 0;
this.casterCellId = 0;
this.targetCellId = 0;
this._isInitialized = false;
}
override public function pack(output:ICustomDataOutput) : void
{
var data:ByteArray = new ByteArray();
this.serialize(new CustomDataWrapper(data));
writePacket(output,this.getMessageId(),data);
}
override public function unpack(input:ICustomDataInput, length:uint) : void
{
this.deserialize(input);
}
override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree
{
var tree:FuncTree = new FuncTree();
tree.setRoot(input);
this.deserializeAsync(tree);
return tree;
}
override public function serialize(output:ICustomDataOutput) : void
{
this.serializeAs_GameActionFightExchangePositionsMessage(output);
}
public function serializeAs_GameActionFightExchangePositionsMessage(output:ICustomDataOutput) : void
{
super.serializeAs_AbstractGameActionMessage(output);
if(this.targetId < -9007199254740992 || this.targetId > 9007199254740992)
{
throw new Error("Forbidden value (" + this.targetId + ") on element targetId.");
}
output.writeDouble(this.targetId);
if(this.casterCellId < -1 || this.casterCellId > 559)
{
throw new Error("Forbidden value (" + this.casterCellId + ") on element casterCellId.");
}
output.writeShort(this.casterCellId);
if(this.targetCellId < -1 || this.targetCellId > 559)
{
throw new Error("Forbidden value (" + this.targetCellId + ") on element targetCellId.");
}
output.writeShort(this.targetCellId);
}
override public function deserialize(input:ICustomDataInput) : void
{
this.deserializeAs_GameActionFightExchangePositionsMessage(input);
}
public function deserializeAs_GameActionFightExchangePositionsMessage(input:ICustomDataInput) : void
{
super.deserialize(input);
this._targetIdFunc(input);
this._casterCellIdFunc(input);
this._targetCellIdFunc(input);
}
override public function deserializeAsync(tree:FuncTree) : void
{
this.deserializeAsyncAs_GameActionFightExchangePositionsMessage(tree);
}
public function deserializeAsyncAs_GameActionFightExchangePositionsMessage(tree:FuncTree) : void
{
super.deserializeAsync(tree);
tree.addChild(this._targetIdFunc);
tree.addChild(this._casterCellIdFunc);
tree.addChild(this._targetCellIdFunc);
}
private function _targetIdFunc(input:ICustomDataInput) : void
{
this.targetId = input.readDouble();
if(this.targetId < -9007199254740992 || this.targetId > 9007199254740992)
{
throw new Error("Forbidden value (" + this.targetId + ") on element of GameActionFightExchangePositionsMessage.targetId.");
}
}
private function _casterCellIdFunc(input:ICustomDataInput) : void
{
this.casterCellId = input.readShort();
if(this.casterCellId < -1 || this.casterCellId > 559)
{
throw new Error("Forbidden value (" + this.casterCellId + ") on element of GameActionFightExchangePositionsMessage.casterCellId.");
}
}
private function _targetCellIdFunc(input:ICustomDataInput) : void
{
this.targetCellId = input.readShort();
if(this.targetCellId < -1 || this.targetCellId > 559)
{
throw new Error("Forbidden value (" + this.targetCellId + ") on element of GameActionFightExchangePositionsMessage.targetCellId.");
}
}
}
}
|
table bed
"Browser extensible data"
(
string chrom; "Reference sequence chromosome or scaffold"
uint chromStart; "Start position in chromosome"
uint chromEnd; "End position in chromosome"
string name; "Name of item"
uint score; "Optional score, nominal range 0-1000"
char[1] strand; "+ or -"
uint thickStart; "Start of where display should be thick (start codon)"
uint thickEnd; "End of where display should be thick (stop codon)"
uint reserved; "Used as itemRgb as of 2004-11-22"
int blockCount; "Number of blocks"
int[blockCount] blockSizes; "Comma separated list of block sizes"
int[blockCount] chromStarts; "Start positions relative to chromStart"
)
|
/**
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "{}"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright {yyyy} {name of copyright owner}
*
* 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.deleidos.rtws.commons.tenantutils.service.system.rest
{
import com.deleidos.rtws.commons.error.ParseError;
import com.deleidos.rtws.commons.event.OperationStatusEvent;
import com.deleidos.rtws.commons.service.rest.SimpleRestService;
import com.deleidos.rtws.commons.tenantutils.service.system.ISystemsService;
import com.deleidos.rtws.commons.tenantutils.service.system.ctxt.SystemsServiceOpContext;
import com.deleidos.rtws.commons.tenantutils.service.system.event.SystemsInfoServiceStatusEvent;
import com.deleidos.rtws.commons.tenantutils.service.system.event.SystemsServiceStatusEvent;
import com.deleidos.rtws.commons.tenantutils.service.system.marshal.SystemServiceMarshaller;
import com.deleidos.rtws.commons.util.StringUtils;
import mx.collections.ArrayList;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
public class SystemsService extends SimpleRestService implements ISystemsService
{
private static const SERVICE_BASE_PATH:String = "proxy/rtws/tenantapi/json/systems";
private static const DEFAULT_SERVICE_TIMEOUT:Number = 60;
public function SystemsService(baseUrl:String=null, defaultTimeout:Number=NaN)
{
super((StringUtils.isNotBlank(baseUrl) ? baseUrl : SERVICE_BASE_PATH), (isNaN(defaultTimeout) ? defaultTimeout : DEFAULT_SERVICE_TIMEOUT));
}
public function fetchSystemsInfo(tenantId:String, opTrackingToken:Object=null):void
{
if(StringUtils.isBlank(tenantId))
{
throw new ArgumentError("tenantId is required");
}
var ctx:SystemsServiceOpContext = new SystemsServiceOpContext();
ctx.opType = SystemsServiceOpContext.FETCH_SYSTEMS_INFO;
ctx.opTrackingToken = opTrackingToken;
ctx.tenantId = tenantId;
var url:String = "/all";
url += "/" + encodeURIComponent(tenantId);
this.get(url, null, ctx);
}
override protected function handleFailure(event:FaultEvent, context:Object):void
{
var serviceCtx:SystemsServiceOpContext = (context as SystemsServiceOpContext);
if(serviceCtx == null || StringUtils.isBlank(serviceCtx.opType))
{
throw new ArgumentError("Invalid Service Context");
}
var failureMsg:String = null;
if(event != null && event.fault != null)
{
failureMsg = event.fault.faultString;
}
var eventToDispatch:SystemsServiceStatusEvent = null;
switch(serviceCtx.opType)
{
case SystemsServiceOpContext.FETCH_SYSTEMS_INFO:
{
if(StringUtils.isBlank(failureMsg))
{
failureMsg = "List Tenant Systems Call Failed";
}
eventToDispatch = new SystemsInfoServiceStatusEvent(
SystemsInfoServiceStatusEvent.FETCH_SYSTEMS_INFO, OperationStatusEvent.SUB_TYPE_FAILURE,
serviceCtx.opTrackingToken, failureMsg);
break;
}
default:
{
throw new ArgumentError("Unknown Service Op Type");
break;
}
}
if(eventToDispatch != null)
{
this.dispatch(eventToDispatch);
}
}
override protected function handleSuccess(event:ResultEvent, context:Object):void
{
var serviceCtx:SystemsServiceOpContext = (context as SystemsServiceOpContext);
if(serviceCtx == null || StringUtils.isBlank(serviceCtx.opType))
{
throw new ArgumentError("Invalid Service Context");
}
var eventToDispatch:SystemsServiceStatusEvent = null;
switch(serviceCtx.opType)
{
case SystemsServiceOpContext.FETCH_SYSTEMS_INFO:
{
try
{
var systems:ArrayList = systems = SystemServiceMarshaller.parseSystemInfo(event, false);
eventToDispatch = new SystemsInfoServiceStatusEvent(
SystemsInfoServiceStatusEvent.FETCH_SYSTEMS_INFO,
OperationStatusEvent.SUB_TYPE_SUCCESS, serviceCtx.opTrackingToken);
eventToDispatch.tenantId = serviceCtx.tenantId;
(eventToDispatch as SystemsInfoServiceStatusEvent).systems = systems;
}
catch(parseError:ParseError)
{
eventToDispatch = new SystemsInfoServiceStatusEvent(
SystemsInfoServiceStatusEvent.FETCH_SYSTEMS_INFO, OperationStatusEvent.SUB_TYPE_FAILURE,
serviceCtx.opTrackingToken, parseError.message);
}
break;
}
default:
{
throw new ArgumentError("Unknown Service Op Type");
break;
}
}
if(eventToDispatch != null)
{
this.dispatch(eventToDispatch);
}
}
}
} |
package maryfisher.framework.view {
/**
* ...
* @author mary_fisher
*/
public interface ITickedObject {
function nextTick(interval:int):void;
}
} |
package zen.shaders {
import zen.shaders.core.*;
import zen.enums.*;
import flash.utils.ByteArray;
import flash.events.EventDispatcher;
import flash.utils.getQualifiedClassName;
import flash.events.Event;
import zen.shaders.textures.ShaderMaterialBase;
import flash.events.*;
import flash.utils.*;
import zen.shaders.textures.*;
import flash.display.*;
/** Filters are small pieces of pre compiled ZSL shaders to be used in Shader3D materials */
public class ShaderFilter extends ShaderContext implements IEventDispatcher {
// to keep IEventDispatcher functions
private var _byteCode:ByteArray;
private var _blendMode:String;
private var _techniqueName:String;
private var _events:EventDispatcher;
private var _passes:int;
public var url:String;
public var enabled:Boolean = true;
public function ShaderFilter(byteCode:ByteArray = null, blendMode:String = "multiply", techniqueName:String = null) {
super("topLevel");
this._events = new EventDispatcher(this);
this._byteCode = byteCode;
this.blendMode = blendMode;
if (this._byteCode) {
bind(this._byteCode);
}
this.name = getQualifiedClassName(this);
this.name = (name.substr((name.indexOf("::") + 2)) + ":topLevel");
this.techniqueName = techniqueName;
}
public function clone():ShaderFilter {
var p:*;
var f:ShaderFilter = new ((Object(this).constructor as Class))();
if (Object(this).constructor == ShaderFilter) {
f.byteCode = this.byteCode;
f.techniqueName = this.techniqueName;
}
for (p in params) {
if ((((params[p] is ShaderTexture)) || ((params[p] is ShaderMatrix)))) {
f.params[p].value = params[p].value;
} else {
if (params[p].value) {
f.params[p].value = params[p].value.concat();
}
}
}
f.blendMode = this._blendMode;
f.techniqueName = this._techniqueName;
f.enabled = this.enabled;
return (f);
}
public function process(scope:ShaderContext2):void {
var p:Array;
var i:int;
var ns:ShaderContext = getScope(this._techniqueName);
if (!(ns)) {
return;
}
if (this.blendMode == null) {
if (ns.varType == ZSLFlags.TECHNIQUE) {
scope.call(this._techniqueName);
} else {
if (scope.outputFragment) {
p = [];
i = 0;
while (i < ns.paramCount) {
p.push(scope.outputFragment);
i++;
}
scope.outputFragment = ns.call("", p);
}
}
} else {
scope.call(this._techniqueName);
}
}
public function get blendMode():String {
return (this._blendMode);
}
public function set blendMode(value:String):void {
if ((((value == "")) || ((value == "null")))) {
value = null;
}
this._blendMode = value;
}
public function get techniqueName():String {
return (this._techniqueName);
}
public function set techniqueName(value:String):void {
this._passes = getPasses(value);
if (value != this._techniqueName) {
this._techniqueName = value;
this.build();
}
}
public function build():void {
this.dispatchEvent(new Event("build"));
}
public function get hash():String {
return (getQualifiedClassName(this));
}
public function get byteCode():ByteArray {
return (this._byteCode);
}
public function set byteCode(value:ByteArray):void {
if (value != this._byteCode) {
this._byteCode = value;
this._techniqueName = null;
bind(this._byteCode);
}
}
public function init(material:ShaderMaterialBase, index:int, pass:int):void {
}
public function get passes():int {
return (this._passes);
}
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void {
this._events.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void {
this._events.removeEventListener(type, listener, useCapture);
}
public function dispatchEvent(event:Event):Boolean {
return (this._events.dispatchEvent(event));
}
public function hasEventListener(type:String):Boolean {
return (this._events.hasEventListener(type));
}
public function willTrigger(type:String):Boolean {
return (this._events.willTrigger(type));
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// 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 mx.collections.CursorBookmark;
import mx.collections.ICollectionView;
import mx.collections.ISort;
import mx.collections.IViewCursor;
import mx.collections.ListCollectionView;
import mx.collections.XMLListAdapter;
import mx.collections.XMLListCollection;
import mx.core.EventPriority;
import mx.core.mx_internal;
import mx.events.CollectionEvent;
import mx.events.CollectionEventKind;
import mx.events.PropertyChangeEvent;
import mx.events.TreeEvent;
import mx.utils.IXMLNotifiable;
import mx.utils.XMLNotifier;
import org.apache.royale.events.CollectionEvent;
import org.apache.royale.events.EventDispatcher;
import org.apache.royale.collections.ITreeData;
use namespace mx_internal;
[ExcludeClass]
/**
* @private
* This class provides a hierarchical view of a standard collection.
* It is used by Tree to parse user data.
*/
public class HierarchicalCollectionView extends EventDispatcher
implements ICollectionView, IXMLNotifiable, ITreeData
{
// include "../../core/Version.as";
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function HierarchicalCollectionView(
model:ICollectionView,
treeDataDescriptor:ITreeDataDescriptor,
itemToUID:Function,
argOpenNodes:Object = null)
{
super();
parentMap = {};
childrenMap = new ChildrenMap();
treeData = model;
/*
// listen for add/remove events from developer as weak reference
treeData.addEventListener(CollectionEvent.COLLECTION_CHANGE,
collectionChangeHandler,
false,
EventPriority.DEFAULT_HANDLER,
true);
addEventListener(CollectionEvent.COLLECTION_CHANGE,
expandEventHandler,
false,
0,
true);
*/
treeData.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
collectionChangeHandler);
addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
expandEventHandler);
dataDescriptor = treeDataDescriptor;
this.itemToUID = itemToUID;
openNodes = argOpenNodes;
//calc initial length
currentLength = calculateLength();
}
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
/**
* @private
*/
private var dataDescriptor:ITreeDataDescriptor;
/**
* @private
*/
private var treeData:ICollectionView;
/**
* @private
*/
private var cursor:HierarchicalViewCursor;
/**
* @private
* The total number of nodes we know about.
*/
private var currentLength:int;
/**
* @private
*
* @royalesuppresspublicvarwarning
*/
public var openNodes:Object; // change to get/set if folks set it from MXML
/**
* @private
* Mapping of UID to parents. Must be maintained as things get removed/added
* This map is created as objects are visited
*
* @royalesuppresspublicvarwarning
*/
public var parentMap:Object; // change to get/set if folks set it from MXML
/**
* @private
* Top level XML node if there is one
*/
private var parentNode:XML;
/**
* @private
* Mapping of nodes to children. Used by getChildren.
*/
private var childrenMap:ChildrenMap;
/**
* @private
*/
private var itemToUID:Function;
//----------------------------------
// filter
//----------------------------------
/**
* Not Supported in Tree.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get filterFunction():Function
{
return null;
}
/**
* Not Supported in Tree.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function set filterFunction(value:Function):void
{
//No Impl.
}
//----------------------------------
// length
//----------------------------------
/**
* The length of the currently parsed collection. This
* length only includes nodes that we know about.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get length():int
{
return currentLength;
}
//----------------------------------
// sort
//----------------------------------
/**
* @private
* Not Supported in Tree.
*/
public function get sort():ISort
{
return null;
}
/**
* @private
* Not Supported in Tree.
*/
public function set sort(value:ISort):void
{
//No Impl
}
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* Returns the parent of a node. Top level node's parent is null
* If we don't know the parent we return undefined.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function getParentItem(node:Object):*
{
var uid:String = itemToUID(node);
if (parentMap.hasOwnProperty(uid))
return parentMap[uid];
return undefined;
}
/**
* @private
* Calculate the total length of the collection, but only count nodes
* that we can reach.
*/
public function calculateLength(node:Object = null, parent:Object = null):int
{
var length:int = 0;
var childNodes:ICollectionView;
var firstNode:Boolean = true;
if (node == null)
{
var modelOffset:int = 0;
// special case counting the whole thing
// watch for page faults
var modelCursor:IViewCursor = treeData.createCursor();
if (modelCursor.beforeFirst)
{
// indicates that an IPE occurred on the first item
return treeData.length;
}
while (!modelCursor.afterLast)
{
node = modelCursor.current;
if (node is XML)
{
if (firstNode)
{
firstNode = false;
var parNode:* = node.parent();
if (parNode)
{
startTrackUpdates(parNode);
childrenMap.put(parNode, treeData);
parentNode = parNode;
}
}
startTrackUpdates(node);
}
if (node === null)
length += 1;
else
length += calculateLength(node, null) + 1;
modelOffset++;
/*
try
{*/
modelCursor.moveNext();
/*
}
catch(e:ItemPendingError)
{
// just stop where we are, no sense paging
// the whole thing just to get length. make a rough
// guess assuming that all un-paged nodes are closed
length += treeData.length - modelOffset;
return length;
}
*/
}
}
else
{
var uid:String = itemToUID(node);
parentMap[uid] = parent;
if (node != null &&
openNodes[uid] &&
dataDescriptor.isBranch(node, treeData))
{
childNodes = getChildren(node);
if (childNodes != null)
{
var numChildren:int = childNodes.length;
for (var i:int = 0; i < numChildren; i++)
{
var child:Object = iCollectionViewGetItemAt(childNodes, i);
if (node is XML)
startTrackUpdates(child); // originally: childNodes[i]
length += calculateLength(child, node) + 1; // originally: childNodes[i]
}
}
}
}
return length;
}
/**
* @private
* This method is merely for ICollectionView interface compliance.
*/
public function describeData():Object
{
return null;
}
/**
* Returns a new instance of a view iterator over the items in this view
*
* @see mx.utils.IViewCursor
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function createCursor():IViewCursor
{
return new HierarchicalViewCursor(
this, treeData, dataDescriptor, itemToUID, openNodes);
}
/**
* Checks the collection for item using standard equality test.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function contains(item:Object):Boolean
{
var cursor:IViewCursor = createCursor();
var done:Boolean = false;
while (!done)
{
if (cursor.current == item)
return true;
done = cursor.moveNext();
}
return false;
}
/**
* @private
*/
public function disableAutoUpdate():void
{
//no-op
}
/**
* @private
*/
public function enableAutoUpdate():void
{
//no-op
}
/**
* @private
*/
public function itemUpdated(item:Object, property:Object = null,
oldValue:Object = null,
newValue:Object = null):void
{
var event:mx.events.CollectionEvent =
new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
event.kind = mx.events.CollectionEventKind.UPDATE;
var objEvent:PropertyChangeEvent =
new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
objEvent.property = property;
objEvent.oldValue = oldValue;
objEvent.newValue = newValue;
event.items.push(objEvent);
dispatchEvent(event);
}
/**
* @private
*/
public function refresh():Boolean
{
var event:mx.events.CollectionEvent =
new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
event.kind = mx.events.CollectionEventKind.REFRESH;
dispatchEvent(event);
return true;
}
/**
* @private
* delegate getChildren in order to add event listeners for nested collections
*/
private function getChildren(node:Object):ICollectionView
{
var children:ICollectionView = dataDescriptor.getChildren(node, treeData);
var oldChildren:ICollectionView = childrenMap.fetch(node) as ICollectionView;
if (oldChildren != children)
{
if (oldChildren != null)
{
oldChildren.removeEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler);
}
if (children)
{
/*
children.addEventListener(CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler, false, 0, true);*/
children.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler);
childrenMap.put(node, children);
}
else
childrenMap.remove(node);
}
return children;
}
/**
* @private
* Force a recalulation of length
*/
private function updateLength(node:Object = null, parent:Object = null):void
{
currentLength = calculateLength();
}
/**
* @private
* Fill the node array with the node and all of its visible children
* update the parentMap as you go.
*/
private function getVisibleNodes(node:Object, parent:Object, nodeArray:Array):void
{
var childNodes:ICollectionView;
nodeArray.push(node);
var uid:String = itemToUID(node);
parentMap[uid] = parent;
if (openNodes[uid] &&
dataDescriptor.isBranch(node, treeData) &&
dataDescriptor.hasChildren(node, treeData))
{
childNodes = getChildren(node);
if (childNodes != null)
{
var numChildren:int = childNodes.length;
for (var i:int = 0; i < numChildren; i++)
{
getVisibleNodes(iCollectionViewGetItemAt(childNodes, i), node, nodeArray); // originally: childNodes[i]
}
}
}
}
/**
* @private
* Factor in the open children before this location in the model
*/
private function getVisibleLocation(oldLocation:int):int
{
var newLocation:int = 0;
var modelCursor:IViewCursor = treeData.createCursor();
for (var i:int = 0; i < oldLocation && !modelCursor.afterLast; i++)
{
newLocation += calculateLength(modelCursor.current, null) + 1;
modelCursor.moveNext();
}
return newLocation;
}
/**
* @private
* factor in the open children before this location in a sub collection
*/
private function getVisibleLocationInSubCollection(parent:Object, oldLocation:int):int
{
var newLocation:int = oldLocation;
var target:Object = parent;
parent = getParentItem(parent);
var children:ICollectionView;
var cursor:IViewCursor;
while (parent != null)
{
children = childrenMap.fetch(parent) as ICollectionView;
cursor = children.createCursor();
while (!cursor.afterLast)
{
if (cursor.current == target)
{
newLocation++;
break;
}
newLocation += calculateLength(cursor.current, parent) + 1;
cursor.moveNext();
}
target = parent;
parent = getParentItem(parent);
}
cursor = treeData.createCursor();
while (!cursor.afterLast)
{
if (cursor.current == target)
{
newLocation++;
break;
}
newLocation += calculateLength(cursor.current, parent) + 1;
cursor.moveNext();
}
return newLocation;
}
//--------------------------------------------------------------------------
//
// Event handlers
//
//--------------------------------------------------------------------------
/**
* @private
*/
public function collectionChangeHandler(event:mx.events.CollectionEvent):void
{
var i:int;
var n:int;
var location:int;
var uid:String;
var parent:Object;
var node:Object;
var items:Array;
var convertedEvent:mx.events.CollectionEvent;
if (event is mx.events.CollectionEvent)
{
var ce:mx.events.CollectionEvent = mx.events.CollectionEvent(event);
if (ce.kind == CollectionEventKind.RESET)
{
updateLength();
dispatchEvent(event);
}
else if (ce.kind == mx.events.CollectionEventKind.ADD)
{
n = ce.items.length;
convertedEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
ce.kind);
convertedEvent.location = getVisibleLocation(ce.location);
for (i = 0; i < n; i++)
{
node = ce.items[i];
if (node is XML)
startTrackUpdates(node);
getVisibleNodes(node, null, convertedEvent.items);
}
currentLength += convertedEvent.items.length;
dispatchEvent(convertedEvent);
}
else if (ce.kind == mx.events.CollectionEventKind.REMOVE)
{
n = ce.items.length;
convertedEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
ce.kind);
convertedEvent.location = getVisibleLocation(ce.location);
for (i = 0; i < n; i++)
{
node = ce.items[i];
if (node is XML)
stopTrackUpdates(node);
getVisibleNodes(node, null, convertedEvent.items);
}
currentLength -= convertedEvent.items.length;
dispatchEvent(convertedEvent);
}
else if (ce.kind == mx.events.CollectionEventKind.UPDATE)
{
// so far, nobody cares about the details so just
// send it
//updateLength();
dispatchEvent(event);
}
else if (ce.kind == mx.events.CollectionEventKind.REPLACE)
{
// someday handle case where node is marked as open
// before it becomes the replacement.
// for now, just pass on the data and remove
// old visible rows
n = ce.items.length;
convertedEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
mx.events.CollectionEventKind.REMOVE);
for (i = 0; i < n; i++)
{
node = ce.items[i].oldValue;
if (node is XML)
stopTrackUpdates(node);
getVisibleNodes(node, null, convertedEvent.items);
}
// prune the replacements from this list
var j:int = 0;
for (i = 0; i < n; i++)
{
node = ce.items[i].oldValue;
while (convertedEvent.items[j] != node)
j++;
convertedEvent.items.splice(j, 1);
}
if (convertedEvent.items.length)
{
currentLength -= convertedEvent.items.length;
// nobody cares about location yet.
dispatchEvent(convertedEvent);
}
dispatchEvent(event);
}
}
}
/**
* @private
*/
public function nestedCollectionChangeHandler(event:mx.events.CollectionEvent):void
{
var i:int;
var n:int;
var location:int;
var uid:String;
var parent:Object;
var node:Object;
var items:Array;
var convertedEvent:mx.events.CollectionEvent;
if (event is mx.events.CollectionEvent)
{
var ce:mx.events.CollectionEvent = mx.events.CollectionEvent(event);
if (ce.kind == mx.events.CollectionEventKind.EXPAND)
{
event.stopImmediatePropagation();
}
else if (ce.kind == mx.events.CollectionEventKind.ADD)
{
// optimize someday. We do a full tree walk so we can
// not only count how many but find the parents of the
// new nodes. A better scheme would be to just
// increment by the number of visible nodes, but we
// don't have a good way to get the parents.
updateLength();
n = ce.items.length;
convertedEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
ce.kind);
for (i = 0; i < n; i++)
{
node = ce.items[i];
if (node is XML)
startTrackUpdates(node);
parent = getParentItem(node);
if (parent != null)
getVisibleNodes(node, parent, convertedEvent.items);
}
convertedEvent.location = getVisibleLocationInSubCollection(parent, ce.location);
dispatchEvent(convertedEvent);
}
else if (ce.kind == mx.events.CollectionEventKind.REMOVE)
{
n = ce.items.length;
convertedEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
ce.kind);
for (i = 0; i < n; i++)
{
node = ce.items[i];
if (node is XML)
stopTrackUpdates(node);
parent = getParentItem(node);
if (parent != null)
getVisibleNodes(node, parent, convertedEvent.items);
}
convertedEvent.location = getVisibleLocationInSubCollection(parent, ce.location);
currentLength -= convertedEvent.items.length;
dispatchEvent(convertedEvent);
}
else if (ce.kind == mx.events.CollectionEventKind.UPDATE)
{
// so far, nobody cares about the details so just
// send it
dispatchEvent(event);
}
else if (ce.kind == mx.events.CollectionEventKind.REPLACE)
{
// someday handle case where node is marked as open
// before it becomes the replacement.
// for now, just pass on the data and remove
// old visible rows
n = ce.items.length;
convertedEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
mx.events.CollectionEventKind.REMOVE);
for (i = 0; i < n; i++)
{
node = ce.items[i].oldValue;
parent = getParentItem(node);
if (parent != null)
getVisibleNodes(node, parent, convertedEvent.items);
}
// prune the replacements from this list
var j:int = 0;
for (i = 0; i < n; i++)
{
node = ce.items[i].oldValue;
if (node is XML)
stopTrackUpdates(node);
while (convertedEvent.items[j] != node)
j++;
convertedEvent.items.splice(j, 1);
}
if (convertedEvent.items.length)
{
currentLength -= convertedEvent.items.length;
// nobody cares about location yet.
dispatchEvent(convertedEvent);
}
dispatchEvent(event);
}
else if (ce.kind == mx.events.CollectionEventKind.RESET)
{
// removeAll() sends a RESET.
// when we get a reset we don't know what went away
// and we don't know how many things went away, so
// we just fake a refresh as if there was a filter
// applied that filtered out whatever went away
updateLength();
convertedEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE,
false,
true,
mx.events.CollectionEventKind.REFRESH);
dispatchEvent(convertedEvent);
}
}
}
/**
* Called whenever an XML object contained in our list is updated
* in some way. The initial implementation stab is very lenient,
* any changeType will cause an update no matter how much further down
* in a hierarchy.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function xmlNotification(currentTarget:Object,
type:String,
target:Object,
value:Object,
detail:Object):void
{
var prop:String;
var oldValue:Object;
var newValue:Object;
var children:XMLListCollection;
var location:int;
var event:mx.events.CollectionEvent;
var list:XMLListAdapter;
// trace("HierarchicalCollectionView.xmlNotification(" + currentTarget
// + ", " + type
// + ", " + target
// + ", " + value
// + ", " + detail
// + ")");
// trace("currentTarget", currentTarget.toXMLString());
// trace("target", target.toXMLString());
// trace("value", value.toXMLString());
// trace("type", type);
if (currentTarget === target)
{
switch(type)
{
case "nodeAdded":
{
var q:*;
/* Flash needs this because XML instances would not always
lookup correctly in a Dictionary.*/
COMPILE::SWF
{
for each (q in childrenMap.keys)
{
if (q === currentTarget)
{
list = childrenMap.fetch(q).list as XMLListAdapter;
break;
}
}
}
COMPILE::JS
{
q = currentTarget;
list = childrenMap.fetch(q).list as XMLListAdapter;
}
if (!list && target is XML && XML(target).children().length() == 1)
{
// this is a special case (SDK-13807), when you add your first xml node
// we need to add the listener, and getChildren() does it for us.
list = (getChildren(target) as XMLListCollection).list as XMLListAdapter;
}
if (list && !list.busy())
{
if (childrenMap.fetch(q) === treeData)
{
children = treeData as XMLListCollection;
if (parentNode)
{
children.dispatchResetEvent = false;
children.source = parentNode.*;
}
}
else
{
// this should refresh the collection
children = getChildren(q) as XMLListCollection;
}
if (children)
{
// now we fake an event on behalf of the
// child collection
location = value.childIndex();
event = new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
event.kind = mx.events.CollectionEventKind.ADD;
event.location = location;
event.items = [ value ];
children.dispatchEvent(event);
}
}
break;
}
/* needed?
case "nodeChanged":
{
prop = value.localName();
oldValue = detail;
newValue = value;
break;
}
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
case "nodeRemoved":
{
var p:*;
children = null;
// lookup doesn't work, must scan instead
COMPILE::SWF
{
for (p in childrenMap.keys)
{
if (p === currentTarget)
{
children = childrenMap.fetch(p) as XMLListCollection;
break;
}
}
}
COMPILE::JS
{
p = currentTarget;
children = childrenMap.fetch(p) as XMLListCollection;
}
if (children != null)
{
list = children.list as XMLListAdapter;
if (list && !list.busy())
{
var xmllist:XMLList = children.source as XMLList;
if (childrenMap.fetch(p) === treeData)
{
children = treeData as XMLListCollection;
if (parentNode)
{
children.dispatchResetEvent = false;
children.source = parentNode.*;
}
}
else
{
var oldChildren:XMLListCollection = children;
// this should refresh the collection
children = getChildren(p) as XMLListCollection;
if (!children)
{
// last item got removed so there's no child collection
oldChildren.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler);
//oldChildren.addEventListener(CollectionEvent.COLLECTION_CHANGE,
// nestedCollectionChangeHandler, false, 0, true);
event = new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
event.kind = mx.events.CollectionEventKind.REMOVE;
event.location = 0;
event.items = [ value ];
oldChildren.dispatchEvent(event);
oldChildren.removeEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE,
nestedCollectionChangeHandler);
}
}
if (children)
{
var n:int = xmllist.length();
for (var i:int = 0; i < n; i++)
{
if (xmllist[i] === value)
{
event = new mx.events.CollectionEvent(mx.events.CollectionEvent.COLLECTION_CHANGE);
event.kind = mx.events.CollectionEventKind.REMOVE;
event.location = location;
event.items = [ value ];
children.dispatchEvent(event);
break;
}
}
}
}
}
break;
}
default:
{
break;
}
}
}
}
/**
* This is called by addItemAt and when the source is initially
* assigned.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
private function startTrackUpdates(item:Object):void
{
XMLNotifier.getInstance().watchXML(item, this);
}
/**
* This is called by removeItemAt, removeAll, and before a new
* source is assigned.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
private function stopTrackUpdates(item:Object):void
{
XMLNotifier.getInstance().unwatchXML(item, this);
}
/**
* @private
*/
public function expandEventHandler(event:mx.events.CollectionEvent):void
{
if (event is mx.events.CollectionEvent)
{
var ce:mx.events.CollectionEvent = mx.events.CollectionEvent(event);
if (ce.kind == mx.events.CollectionEventKind.EXPAND)
{
event.stopImmediatePropagation();
updateLength();
}
}
}
private var iterator:IViewCursor;
public function getDepth(node:Object):int
{
if (!iterator)
iterator = createCursor();
if (iterator.current == node)
return getCurrentCursorDepth();
var offset:int = getItemIndex(node);
//otherwise seek to offset and get the depth
var bookmark:CursorBookmark = iterator.bookmark;
iterator.seek(CursorBookmark.FIRST, offset);
var depth:int = getCurrentCursorDepth();
//put the cursor back
iterator.seek(bookmark, 0);
return depth;
}
/**
* @private
*/
public function getItemIndex(item:Object):int
{
if (!iterator)
iterator = createCursor();
iterator.seek(CursorBookmark.FIRST, 0);
var i:int = 0;
do
{
if (iterator.current === item)
break;
i++;
}
while (iterator.moveNext());
return i;
}
/**
* @private
* Utility method to get the depth of the current item from the cursor.
*/
private function getCurrentCursorDepth():int //private
{
if (dataDescriptor is ITreeDataDescriptor2)
return ITreeDataDescriptor2(dataDescriptor).getNodeDepth(iterator.current, iterator, treeData);
return HierarchicalViewCursor(iterator).currentDepth;
}
public function isOpen(node:Object):Boolean
{
var uid:String = itemToUID(node);
return (openNodes[uid] != null);
}
public function hasChildren(node:Object):Boolean
{
return dataDescriptor.hasChildren(node, treeData)
}
public function openNode(node:Object):void
{
var uid:String = itemToUID(node);
openNodes[uid] = 1;
// sent to update the length in the collection (updateLength() -> calculateLength() -> updates XML tracking)
var expandEvent:mx.events.CollectionEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE, false, true, mx.events.CollectionEventKind.EXPAND);
expandEvent.items = [node];
dispatchEvent(expandEvent);
var index:int = getItemIndex(node);
dispatchAddEvents(node, index + 1, org.apache.royale.events.CollectionEvent.ITEM_ADDED);
var collectionEvent:org.apache.royale.events.CollectionEvent;
collectionEvent = new org.apache.royale.events.CollectionEvent(org.apache.royale.events.CollectionEvent.ITEM_UPDATED);
collectionEvent.item = node;
collectionEvent.index = index;
dispatchEvent(collectionEvent);
var itemOpenEvent:TreeEvent;
itemOpenEvent = new TreeEvent(TreeEvent.ITEM_OPEN);
itemOpenEvent.item = node;
dispatchEvent(itemOpenEvent);
}
private function dispatchAddEvents(node:Object, index:int, type:String):int
{
var children:ICollectionView = getChildren(node);
var cursor:IViewCursor = children.createCursor();
var item:Object;
var collectionEvent:org.apache.royale.events.CollectionEvent;
if (cursor.afterLast)
return index;
do
{
item = cursor.current;
collectionEvent = new org.apache.royale.events.CollectionEvent(type);
collectionEvent.item = item;
collectionEvent.index = index;
dispatchEvent(collectionEvent);
currentLength++;
index++;
if (isOpen(item))
{
index = dispatchAddEvents(item, index, type);
}
} while (cursor.moveNext());
return index;
}
public function closeNode(node:Object):void
{
var uid:String = itemToUID(node);
delete openNodes[uid];
// sent to update the length in the collection (updateLength() -> calculateLength() -> updates XML tracking)
var expandEvent:mx.events.CollectionEvent = new mx.events.CollectionEvent(
mx.events.CollectionEvent.COLLECTION_CHANGE, false, true, mx.events.CollectionEventKind.EXPAND);
expandEvent.items = [node];
dispatchEvent(expandEvent);
var index:int = getItemIndex(node);
dispatchRemoveEvents(node, index + 1, org.apache.royale.events.CollectionEvent.ITEM_REMOVED);
var collectionEvent:org.apache.royale.events.CollectionEvent;
collectionEvent = new org.apache.royale.events.CollectionEvent(org.apache.royale.events.CollectionEvent.ITEM_UPDATED);
collectionEvent.item = node;
collectionEvent.index = index;
dispatchEvent(collectionEvent);
}
private function dispatchRemoveEvents(node:Object, index:int, type:String, eventQueue:Array = null):int
{
var children:ICollectionView = getChildren(node);
var cursor:IViewCursor = children.createCursor();
var item:Object;
var collectionEvent:org.apache.royale.events.CollectionEvent;
var topLevel:Boolean = (eventQueue == null);
if (!eventQueue)
eventQueue = [];
if (cursor.afterLast)
return index;
do
{
item = cursor.current;
collectionEvent = new org.apache.royale.events.CollectionEvent(type);
collectionEvent.item = item;
collectionEvent.index = index;
eventQueue.push(collectionEvent);
index++;
if (isOpen(item))
{
index = dispatchRemoveEvents(item, index, type, eventQueue);
}
} while (cursor.moveNext());
if (topLevel)
{
// dispatch events in reverse order
while (eventQueue.length)
{
collectionEvent = eventQueue.pop() as org.apache.royale.events.CollectionEvent;
dispatchEvent(collectionEvent);
currentLength--;
}
}
return index;
}
public static function iCollectionViewGetItemAt(coll:ICollectionView, idx:uint):Object
{
if (coll is ListCollectionView)
{
return (coll as ListCollectionView).getItemAt(idx);
}
var it:IViewCursor = coll.createCursor();
it.seek(CursorBookmark.FIRST, idx);
return it.current;
}
}
}
COMPILE::SWF
{
import flash.utils.Dictionary;
}
class ChildrenMap
{
COMPILE::SWF
private var cache:Dictionary = new Dictionary(true);
// use Object.defineProperty some day to block iteration of this property?
private var propName:String = "__ChildrenMap__";
public function fetch(obj:Object):Object
{
COMPILE::SWF
{
return cache[obj];
}
COMPILE::JS
{
return obj[propName];
}
}
public function put(obj:Object, value:Object):void
{
COMPILE::SWF
{
cache[obj] = value;
}
COMPILE::JS
{
obj[propName] = value;
}
}
public function remove(obj:Object):void
{
COMPILE::SWF
{
delete cache[obj];
}
COMPILE::JS
{
delete obj[propName];
}
}
public function get keys():Array
{
var output:Array = [];
COMPILE::SWF
{
for (var p:* in cache.keys)
{
output.push(p);
}
}
// for JS, assume we won't ever need to produce the keys since
// the runtime shouldn't be messing with XML node instances
return output;
}
}
|
// =================================================================================================
//
// Starling Framework
// Copyright 2011 Gamua OG. 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 starling.events
{
import starling.display.DisplayObject;
import starling.display.DisplayObjectContainer;
/** A TouchEvent is triggered either by touch or mouse input.
*
* <p>In Starling, both touch events and mouse events are handled through the same class:
* TouchEvent. To process user input from a touch screen or the mouse, you have to register
* an event listener for events of the type <code>TouchEvent.TOUCH</code>. This is the only
* event type you need to handle; the long list of mouse event types as they are used in
* conventional Flash are mapped to so-called "TouchPhases" instead.</p>
*
* <p>The difference between mouse input and touch input is that</p>
*
* <ul>
* <li>only one mouse cursor can be present at a given moment and</li>
* <li>only the mouse can "hover" over an object without a pressed button.</li>
* </ul>
*
* <strong>Which objects receive touch events?</strong>
*
* <p>In Starling, any display object receives touch events, as long as the
* <code>touchable</code> property of the object and its parents is enabled. There
* is no "InteractiveObject" class in Starling.</p>
*
* <strong>How to work with individual touches</strong>
*
* <p>The event contains a list of all touches that are currently present. Each individual
* touch is stored in an object of type "Touch". Since you are normally only interested in
* the touches that occurred on top of certain objects, you can query the event for touches
* with a specific target:</p>
*
* <code>var touches:Vector.<Touch> = touchEvent.getTouches(this);</code>
*
* <p>This will return all touches of "this" or one of its children. When you are not using
* multitouch, you can also access the touch object directly, like this:</p>
*
* <code>var touch:Touch = touchEvent.getTouch(this);</code>
*
* @see Touch
* @see TouchPhase
*/
public class TouchEvent extends Event
{
/** Event type for touch or mouse input. */
public static const TOUCH:String = "touch";
private var mTouches:Vector.<Touch>;
private var mShiftKey:Boolean;
private var mCtrlKey:Boolean;
private var mTimestamp:Number;
/** Creates a new TouchEvent instance. */
public function TouchEvent(type:String, touches:Vector.<Touch>, shiftKey:Boolean=false,
ctrlKey:Boolean=false, bubbles:Boolean=true)
{
super(type, bubbles);
mTouches = touches ? touches : new <Touch>[];
mShiftKey = shiftKey;
mCtrlKey = ctrlKey;
mTimestamp = -1.0;
var numTouches:int=touches.length;
for (var i:int=0; i<numTouches; ++i)
if (touches[i].timestamp > mTimestamp)
mTimestamp = touches[i].timestamp;
}
/** Returns a list of touches that originated over a certain target. */
public function getTouches(target:DisplayObject, phase:String=null):Vector.<Touch>
{
var touchesFound:Vector.<Touch> = new <Touch>[];
var numTouches:int = mTouches.length;
for (var i:int=0; i<numTouches; ++i)
{
var touch:Touch = mTouches[i];
var correctTarget:Boolean = (touch.target == target) ||
((target is DisplayObjectContainer) &&
(target as DisplayObjectContainer).contains(touch.target));
var correctPhase:Boolean = (phase == null || phase == touch.phase);
if (correctTarget && correctPhase)
touchesFound.push(touch);
}
return touchesFound;
}
/** Returns a touch that originated over a certain target. */
public function getTouch(target:DisplayObject, phase:String=null):Touch
{
var touchesFound:Vector.<Touch> = getTouches(target, phase);
if (touchesFound.length > 0) return touchesFound[0];
else return null;
}
/** Indicates if a target is currently being touched or hovered over. */
public function interactsWith(target:DisplayObject):Boolean
{
if (getTouch(target) == null)
return false;
else
{
var touches:Vector.<Touch> = getTouches(target);
for (var i:int=touches.length-1; i>=0; --i)
if (touches[i].phase != TouchPhase.ENDED)
return true;
return false;
}
}
/** The time the event occurred (in seconds since application launch). */
public function get timestamp():Number { return mTimestamp; }
/** All touches that are currently available. */
public function get touches():Vector.<Touch> { return mTouches.concat(); }
/** Indicates if the shift key was pressed when the event occurred. */
public function get shiftKey():Boolean { return mShiftKey; }
/** Indicates if the ctrl key was pressed when the event occurred. (Mac OS: Cmd or Ctrl) */
public function get ctrlKey():Boolean { return mCtrlKey; }
}
} |
/**
* VERSION: 2.0
* DATE: 8/18/2009
* ACTIONSCRIPT VERSION: 3.0
* UPDATES AND DOCUMENTATION AT: http://www.TweenMax.com
**/
package com.greensock.plugins {
import flash.filters.*;
import flash.display.*;
import com.greensock.*;
/**
* Tweens a BevelFilter. The following properties are available (you only need to define the ones you want to tween): <br />
* <code>
* <ul>
* <li> distance : Number [0]</li>
* <li> angle : Number [0]</li>
* <li> highlightColor : uint [0xFFFFFF]</li>
* <li> highlightAlpha : Number [0.5]</li>
* <li> shadowColor : uint [0x000000]</li>
* <li> shadowAlpha :Number [0.5]</li>
* <li> blurX : Number [2]</li>
* <li> blurY : Number [2]</li>
* <li> strength : Number [0]</li>
* <li> quality : uint [2]</li>
* <li> index : uint</li>
* <li> addFilter : Boolean [false]</li>
* <li> remove : Boolean [false]</li>
* </ul>
* </code>
*
*
* <b>USAGE:</b><br /><br />
* <code>
* import com.greensock.TweenLite; <br />
* import com.greensock.plugins.TweenPlugin; <br />
* import com.greensock.plugins.BevelFilterPlugin; <br />
* TweenPlugin.activate([BevelFilterPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.<br /><br />
*
* TweenLite.to(mc, 1, {bevelFilter:{blurX:10, blurY:10, distance:6, angle:45, strength:1}});<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 BevelFilterPlugin extends FilterPlugin {
/** @private **/
public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
/** @private **/
private static var _propNames:Array = ["distance","angle","highlightColor","highlightAlpha","shadowColor","shadowAlpha","blurX","blurY","strength","quality"];
/** @private **/
public function BevelFilterPlugin() {
super();
this.propName = "bevelFilter";
this.overwriteProps = ["bevelFilter"];
}
/** @private **/
override public function onInitTween(target:Object, value:*, tween:TweenLite):Boolean {
_target = target;
_type = BevelFilter;
initFilter(value, new BevelFilter(0, 0, 0xFFFFFF, 0.5, 0x000000, 0.5, 2, 2, 0, value.quality || 2), _propNames);
return true;
}
}
} |
//
// $Id$
package com.threerings.msoy.applets.net {
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.HTTPStatusEvent;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import mx.containers.TitleWindow;
import mx.controls.ProgressBar;
import mx.controls.TextArea;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
import com.threerings.util.ValueEvent;
import com.threerings.flex.FlexUtil;
import com.threerings.msoy.applets.AppletContext;
public class Downloader extends TitleWindow
{
public function Downloader (ctx :AppletContext)
{
title = ctx.APPLET.get("t.downloading");
showCloseButton = true;
addEventListener(CloseEvent.CLOSE, handleClose);
_loader = new URLLoader();
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, handleDownloadStatus);
_loader.addEventListener(IOErrorEvent.IO_ERROR, handleDownloadError);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleDownloadError);
_loader.addEventListener(Event.COMPLETE, handleDownloadComplete);
_progress = new ProgressBar();
_progress.percentWidth = 100;
FlexUtil.setVisible(_progress, false);
_progress.source = _loader;
addChild(_progress);
PopUpManager.addPopUp(this, ctx.getApplication(), true);
PopUpManager.centerPopUp(this);
}
public function startDownload (url :String = null, forcedName :String = null) :void
{
if (url == null) {
return;
}
_forcedName = forcedName;
FlexUtil.setVisible(_progress, true);
_url = url;
_loader.load(new URLRequest(url));
}
protected function handleDownloadStatus (event :HTTPStatusEvent) :void
{
//_status.text = "HTTP Status: " + event.status;
// I'm pretty sure certain URLs will give a status and that's it, so we
// need to be prepared to stop the download here.
//downloadStopped();
}
protected function handleDownloadError (event :ErrorEvent) :void
{
var status :TextArea = new TextArea();
status.percentWidth = 100;
status.editable = false;
status.setStyle("borderStyle", "none");
status.text = "Error downloading: " + event.text;
addChild(status);
downloadStopped();
}
protected function downloadStopped () :void
{
FlexUtil.setVisible(_progress, false);
}
protected function handleDownloadComplete (event :Event) :void
{
close([ makeFilename(_url), _loader.data ]);
}
protected function makeFilename (url :String) :String
{
if (_forcedName != null) {
return _forcedName;
}
return url.substr(url.lastIndexOf("/") + 1); // works even if index is -1
}
protected function handleClose (event :CloseEvent) :void
{
close();
}
protected function close (returnValue :Object = null) :void
{
try {
_loader.close();
} catch (err :Error) {
// ignore
}
PopUpManager.removePopUp(this);
dispatchEvent(new ValueEvent(Event.COMPLETE, returnValue));
}
protected var _loader :URLLoader;
protected var _progress :ProgressBar;
protected var _url :String;
/** If non-null, a forced filename to use with this download. */
protected var _forcedName :String;
}
}
|
/*
Copyright (c) 2006. 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.
@ignore
*/package flexlib.scheduling.timelineClasses
{
import flexlib.scheduling.util.DateUtil;
import mx.collections.ArrayCollection;
import mx.collections.IList;
public class TimeRangeDescriptorUtil
{
public static var defaultTimeRangeDescriptor : Array = [
[ DateUtil.MINUTE_IN_MILLISECONDS, "L:NNAA" ],
[ 5 * DateUtil.MINUTE_IN_MILLISECONDS, "L:NNAA" ],
[ 10 * DateUtil.MINUTE_IN_MILLISECONDS, "L:NNAA" ],
[ 15 * DateUtil.MINUTE_IN_MILLISECONDS, "L:NNAA" ],
[ 30 * DateUtil.MINUTE_IN_MILLISECONDS, "L:NNAA" ],
[ 60 * DateUtil.MINUTE_IN_MILLISECONDS, "L:NNAA" ],
[ 2 * DateUtil.HOUR_IN_MILLISECONDS, "L:NNAA" ],
[ 6 * DateUtil.HOUR_IN_MILLISECONDS, "L:NNAA" ],
[ 12 * DateUtil.HOUR_IN_MILLISECONDS, "L:NNAA" ],
[ 24 * DateUtil.HOUR_IN_MILLISECONDS, "DD/MM/YY" ],
[ 2 * DateUtil.DAY_IN_MILLISECONDS, "DD/MM/YY" ],
[ 4 * DateUtil.DAY_IN_MILLISECONDS, "DD/MM/YY" ],
[ 7 * DateUtil.DAY_IN_MILLISECONDS, "DD/MM/YY" ],
[ 14 * DateUtil.DAY_IN_MILLISECONDS, "DD/MM/YY" ],
[ 30 * DateUtil.DAY_IN_MILLISECONDS, "MMM YY" ],
[ 4 * DateUtil.MONTH_IN_MILLISECONDS, "MMM YY" ],
[ 6 * DateUtil.MONTH_IN_MILLISECONDS, "MMM YY" ],
[ 9 * DateUtil.MONTH_IN_MILLISECONDS, "MMM YY" ],
[ 12 * DateUtil.MONTH_IN_MILLISECONDS, "MMM YY" ],
[ 2 * DateUtil.YEAR_IN_MILLISECONDS, "YYYY" ],
[ 5 * DateUtil.YEAR_IN_MILLISECONDS, "YYYY" ],
[ 10 * DateUtil.YEAR_IN_MILLISECONDS, "YYYY" ],
[ 25 * DateUtil.YEAR_IN_MILLISECONDS, "YYYY" ],
[ 500 * DateUtil.YEAR_IN_MILLISECONDS, "YYYY" ] ];
public static function convertArrayToTimeRangeDescriptor( timeDescriptor : Array ) : IList
{
var dataProvider : IList = new ArrayCollection();
var len : Number = timeDescriptor.length;
for( var i : Number = 0; i < len; i++ )
{
var item : Array = timeDescriptor[ i ];
var entry : ITimeDescriptor = new SimpleTimeDescriptor();
entry.date = new Date( item[ 0 ] );
entry.description = item[ 1 ];
dataProvider.addItem( entry );
}
return dataProvider;
}
public static function getDefaultTimeRangeDescriptor() : IList
{
return TimeRangeDescriptorUtil.convertArrayToTimeRangeDescriptor( defaultTimeRangeDescriptor );
}
}
} |
/* -*- Mode: js; js-indent-level: 2; indent-tabs-mode: nil; tab-width: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/*
* Copyright 2013 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 avm1lib {
import flash.text.TextField;
[native(cls="AS2TextField")]
public dynamic class AS2TextField extends Object {
private native function _init(nativeTextField:TextField);
function AS2TextField(nativeTextField:TextField) {
_init(nativeTextField);
}
public native function get _as3Object():TextField;
public function get _alpha() {
return this._as3Object.alpha;
}
public function set _alpha(value) {
this._as3Object.alpha = value;
}
public function get antiAliasType() {
return this._as3Object.antiAliasType;
}
public function set antiAliasType(value) {
this._as3Object.antiAliasType = value;
}
public function get autoSize() {
return this._as3Object.autoSize;
}
public function set autoSize(value) {
this._as3Object.autoSize = value;
}
public function get background() {
return this._as3Object.background;
}
public function set background(value) {
this._as3Object.background = value;
}
public function get backgroundColor() {
return this._as3Object.backgroundColor;
}
public function set backgroundColor(value) {
this._as3Object.backgroundColor = value;
}
public function get border() {
return this._as3Object.border;
}
public function set border(value) {
this._as3Object.border = value;
}
public function get borderColor() {
return this._as3Object.borderColor;
}
public function set borderColor(value) {
this._as3Object.borderColor = value;
}
public function get bottomScroll() {
return this._as3Object.bottomScrollV;
}
public function get condenseWhite() {
return this._as3Object.condenseWhite;
}
public function set condenseWhite(value) {
this._as3Object.condenseWhite = value;
}
public function get embedFonts() {
return this._as3Object.embedFonts;
}
public function set embedFonts(value) {
this._as3Object.embedFonts = value;
}
public function getNewTextFormat() {
return this._as3Object.defaultTextFormat;
}
public function getTextFormat() {
return this._as3Object.getTextFormat;
}
public function get _height() {
return this._as3Object.height;
}
public function set _height(value) {
this._as3Object.height = value;
}
public function get _highquality() {
return 1;
}
public function set _highquality(value) {
}
public function get hscroll() {
return this._as3Object.scrollH;
}
public function set hscroll(value) {
this._as3Object.scrollH = value;
}
public function get html() {
throw 'Not implemented: get$_html';
}
public function set html(value) {
throw 'Not implemented: set$_html';
}
public function get htmlText() {
return this._as3Object.htmlText;
}
public function set htmlText(value) {
this._as3Object.htmlText = value;
}
public function get length() {
return this._as3Object.length;
}
public function get maxChars() {
return this._as3Object.maxChars;
}
public function set maxChars(value) {
this._as3Object.maxChars = value;
}
public function get maxhscroll() {
return this._as3Object.maxScrollH;
}
public function get maxscroll() {
return this._as3Object.maxScrollV;
}
public function get multiline() {
return this._as3Object.multiline;
}
public function set multiline(value) {
this._as3Object.multiline = value;
}
public function get _name() {
return Object(this._as3Object)._name;
}
public function set _name(value) {
Object(this._as3Object)._name = value;
}
public function get _parent() {
return this._as3Object.parent;
}
public function set _parent(value) {
throw 'Not implemented: set$_parent';
}
public function get password() {
return this._as3Object.displayAsPassword;
}
public function set password(value) {
this._as3Object.displayAsPassword = value;
}
public function get _quality() {
return 'HIGH';
}
public function set _quality(value) {
}
public function get _rotation() {
return this._as3Object.rotation;
}
public function set _rotation(value) {
this._as3Object.rotation = value;
}
public function get scroll() {
return this._as3Object.scrollV;
}
public function set scroll(value) {
this._as3Object.scrollV = value;
}
public function get selectable() {
return this._as3Object.selectable;
}
public function set selectable(value) {
this._as3Object.selectable = value;
}
public function setNewTextFormat(value) {
this._as3Object.defaultTextFormat = value;
}
public function setTextFormat() {
this._as3Object.setTextFormat.apply(this._as3Object, arguments);
}
public function get _soundbuftime() {
throw 'Not implemented: get$_soundbuftime';
}
public function set _soundbuftime(value) {
throw 'Not implemented: set$_soundbuftime';
}
public function get tabEnabled() {
return this._as3Object.tabEnabled;
}
public function set tabEnabled(value) {
this._as3Object.tabEnabled = value;
}
public function get tabIndex() {
return this._as3Object.tabIndex;
}
public function set tabIndex(value) {
this._as3Object.tabIndex = value;
}
public function get _target() {
return AS2Utils.getTarget(this);
}
public function get text() {
return this._as3Object.text;
}
public function set text(value) {
this._as3Object.text = value;
}
public function get textColor() {
return this._as3Object.textColor;
}
public function set textColor(value) {
this._as3Object.textColor = value;
}
public function get textHeight() {
return this._as3Object.textHeight;
}
public function set textHeight(value) {
throw 'Not supported: set$textHeight';
}
public function get textWidth() {
return this._as3Object.textWidth;
}
public function set textWidth(value) {
throw 'Not supported: set$textWidth';
}
public function get type() {
return this._as3Object.type;
}
public function set type(value) {
this._as3Object.type = value;
}
public function get _url() {
return this._as3Object.loaderInfo.url;
}
public native function get variable();
public native function set variable(value);
public function get _visible() {
return this._as3Object.visible;
}
public function set _visible(value) {
this._as3Object.visible = +value !== 0;
}
public function get _width() {
return this._as3Object.width;
}
public function set _width(value) {
this._as3Object.width = value;
}
public function get wordWrap() {
return this._as3Object.wordWrap;
}
public function set wordWrap(value) {
this._as3Object.wordWrap = value;
}
public function get _x() {
return this._as3Object.x;
}
public function set _x(value) {
this._as3Object.x = value;
}
public function get _xmouse() {
return this._as3Object.mouseX;
}
public function get _xscale() {
return this._as3Object.scaleX;
}
public function set _xscale(value) {
this._as3Object.scaleX = value;
}
public function get _y() {
return this._as3Object.y;
}
public function set _y(value) {
this._as3Object.y = value;
}
public function get _ymouse() {
return this._as3Object.mouseY;
}
public function get _yscale() {
return this._as3Object.scaleY;
}
public function set _yscale(value) {
this._as3Object.scaleY = value;
}
{
AS2Utils.addEventHandlerProxy(prototype, 'onDragOut', 'dragOut');
AS2Utils.addEventHandlerProxy(prototype, 'onDragOver', 'dragOver');
AS2Utils.addEventHandlerProxy(prototype, 'onKeyDown', 'keyDown');
AS2Utils.addEventHandlerProxy(prototype, 'onKeyUp', 'keyUp');
AS2Utils.addEventHandlerProxy(prototype, 'onKillFocus', 'focusOut', function (e) {
return [e.relatedObject];
});
AS2Utils.addEventHandlerProxy(prototype, 'onLoad', 'load');
AS2Utils.addEventHandlerProxy(prototype, 'onMouseDown', 'mouseDown');
AS2Utils.addEventHandlerProxy(prototype, 'onMouseUp', 'mouseUp');
AS2Utils.addEventHandlerProxy(prototype, 'onPress', 'mouseDown');
AS2Utils.addEventHandlerProxy(prototype, 'onRelease', 'mouseUp');
AS2Utils.addEventHandlerProxy(prototype, 'onReleaseOutside', 'releaseOutside');
AS2Utils.addEventHandlerProxy(prototype, 'onRollOut', 'mouseOut');
AS2Utils.addEventHandlerProxy(prototype, 'onRollOver', 'mouseOver');
AS2Utils.addEventHandlerProxy(prototype, 'onSetFocus', 'focusIn', function (e) {
return [e.relatedObject];
});
}
}
}
|
package kabam.rotmg.messaging.impl.incoming {
import flash.utils.IDataInput;
public class GlobalNotification extends IncomingMessage {
public function GlobalNotification(id:uint, callback:Function) {
super(id, callback);
}
public var type:int;
public var text:String;
override public function parseFromInput(data:IDataInput):void {
this.type = data.readInt();
this.text = data.readUTF();
}
override public function toString():String {
return formatToString("GLOBAL_NOTIFICATION", "type", "text");
}
}
}
|
package {
import starling.display.Image;
import starling.display.Sprite;
import starling.utils.deg2rad;
public class Symbols {
static var symbolsContainer:Sprite;
static var id:Image;
static var hexColorList:Array = [0xD60100, 0xFF7415, 0xFFFF00, 0x31CD01, 0x0086E0];
static function create() {
var initList:Array = [];
for (var i:int = 0; i < 10; i++) {
initList[i] = Atlas.generate("symbol" + i);
}
initList.length = 0;
initList = null;
}
static function place(contID:int, symID:int, colorID:int):void {
Screen.screenContainer.unflatten();
Data.saveObj.symbols[contID] = symID+1;
symbolsContainer = Screen["symbolsContainer" + contID];
while (symbolsContainer.numChildren > 0) {
symbolsContainer.removeChildAt(0);
}
id = Atlas.generate("symbol" + symID);
symbolsContainer.addChild(id);
id.color = hexColorList[colorID];
id.width = int(Scale.rectSprite.width*0.16927);
id.height = id.width;
Screen.screenContainer.flatten();
}
}
}
|
package gs.rtmp.core
{
import flash.net.NetConnection;
/**
* The RTMPConnector class makes a connection to
* a server with NetConnection, but tries simultaneous
* connection attempts in order to find the fastest
* connection.
*/
public class RTMPConnector extends RTMPObject
{
/**
* Whether or not to include the RTMPT protocol
* in connection attempts.
*/
public static var tunnel:Boolean;
/**
* The endpoint to connect to,
*/
public var endpoint:String;
/**
* The first connected NetConnection.
*/
private var _connectedNC:NetConnection;
/**
* The number of connections that haven't reported
* status yet.
*/
private var idleConnections:int;
/**
* Whether or not an event was dispatched for fail.
*/
private var dispatchedFail:Boolean;
/**
* Whether or not I dispose of myself when all is complete.
*/
private var _disposeWhenFinished:Boolean;
/**
* Whether or not the _connectedNC was already
* closed with the connections manager.
*/
private var terminated:Boolean;
/**
* Holder for ports and protocols to try.
*/
private var conAttempts:Array;
/**
* Constructor for RTMPConnector instances.
*/
public function RTMPConnector()
{
super();
idleConnections=0;
}
/**
* Updates protocols and ports.
*/
private function updateProtocolsAndPorts():void
{
conAttempts = [
{port:"1935",protocol:"rtmp"},
{port:"443",protocol:"rtmp"},
{port:"80",protocol:"rtmp"},
];
if(tunnel)
{
conAttempts.push({port:"80",protocol:"rtmpt"});
}
}
/**
* Initiate connection attempts.
*/
public function connect():void
{
if(!endpoint)
{
trace("Error: The endpoint wasn't set for this RTMPConnector");
return;
}
updateProtocolsAndPorts();
var e:String;
if(endpoint.indexOf("rtmp://") > -1)e=endpoint.substring(7);
else if(endpoint.indexOf("rtmpt://") > -1)e=endpoint.substring(8);
var a:Array = e.split("/");
var domain:String = a.shift();
var path:String = "/" + a.join("/");
var i:int=0;
var l:int=conAttempts.length;
var ncc:NCConnector;
var conn:String;
for(;i<l;i++)
{
conn=conAttempts[int(i)].protocol + "://" + domain + ":"+ conAttempts[int(i)].port+path;
if(connections.hasConnection(conn))
{
var n:NetConnection=connections.getConnection(conn);
connections.usingConnection(n);
onConnectionAvailable(n);
return;
}
ncc=new NCConnector(this,conn);
ncc.connect();
idleConnections++;
}
}
/**
* When a connection is available in the RTMPConnections
* cache.
*/
private function onConnectionAvailable(nc:NetConnection):void
{
if(!nc)return;
_connectedNC=nc;
dispatchEvent(new ConnectorEvent(ConnectorEvent.CONNECTED));
idleConnections=0;
autoDispose();
}
/**
* @private
* Callback that NCConnector uses to pass the successfully
* connected NC back.
*/
public function onSuccess(ncc:NCConnector):void
{
if(!ncc)return;
if(_connectedNC)
{
ncc.close();
ncc.dispose();
return;
}
idleConnections=Math.max(0,--idleConnections);
if(ncc)
{
_connectedNC=ncc.netConnection;
ncc.dispose();
}
if(connections)connections.addConnection(_connectedNC);
dispatchEvent(new ConnectorEvent(ConnectorEvent.CONNECTED));
autoDispose();
}
/**
* @private
* When a NCConnector completely fails at connecting.
*/
public function onFailed():void
{
idleConnections=Math.max(0,--idleConnections);
invalidateIdleConnections();
autoDispose();
}
/**
* On an attempt.
*/
public function onAttempt(ncc:NCConnector):void
{
if(_connectedNC) return;
dispatchEvent(new ConnectorEvent(ConnectorEvent.ATTEMPT,ncc.endpoint,false,true));
}
/**
* Helper function for closing and disposing.
*/
private function autoDispose():void
{
if(idleConnections < 1 && _disposeWhenFinished)
{
if(connectedNC && connectedNC.connected)
{
if(!terminated)
{
if(connections)connections.closeConnection(_connectedNC);
connections=null;
terminated=true;
}
}
dispose();
}
}
/**
* Dispose of this.
*/
override public function dispose():void
{
endpoint=null;
idleConnections=0;
conAttempts=null;
dispatchedFail=false;
super.dispose();
}
/**
* Dispose of myself when all outstanding connection attempts
* have failed or completed.
*/
public function disposeWhenFinished():void
{
_disposeWhenFinished=true;
autoDispose();
}
/**
* Invalidates the status of all idle connections.
*/
private function invalidateIdleConnections():void
{
if(idleConnections <= 0 && !_connectedNC)
{
if(_disposeWhenFinished)
{
dispose();
_disposeWhenFinished=false;
}
else if(!dispatchedFail)
{
dispatchEvent(new ConnectorEvent(ConnectorEvent.FAILED));
dispatchedFail=true;
}
}
}
/**
* The connected NetConnection object after everything
* is complete.
*/
public function get connectedNC():NetConnection
{
return _connectedNC;
}
}
} |
/*
* _________ __ __
* _/ / / /____ / /________ ____ ____ ___
* _/ / / __/ -_) __/ __/ _ `/ _ `/ _ \/ _ \
* _/________/ \__/\__/\__/_/ \_,_/\_, /\___/_//_/
* /___/
*
* Tetragon : Game Engine for multi-platform ActionScript projects.
* http://www.tetragonengine.com/ - Copyright (C) 2012 Sascha Balkau
*
* 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 tetragon.core.constants
{
/**
* Provides constants for time measurement units.
*/
public final class TimeUnit
{
//-----------------------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------------------
public static const MILLISECOND:int = 1;
public static const SECOND:int = 1000;
public static const MINUTE:int = SECOND * 60; // 60.000
public static const HOUR:int = MINUTE * 60; // 3.600.000
public static const DAY:int = HOUR * 24; // 86.400.000
public static const WEEK:int = DAY * 7; // 604.800.000
public static const YEAR:Number = DAY * 365; // 31.536.000.000
public static const SYMBOL_MILLISECOND:String = "ms";
public static const SYMBOL_SECOND:String = "s";
public static const SYMBOL_MINUTE:String = "m";
public static const SYMBOL_HOUR:String = "h";
public static const SYMBOL_DAY:String = "d";
public static const SYMBOL_WEEK:String = "w";
public static const SYMBOL_YEAR:String = "y";
public static const SYMBOL_LONG_MILLISECOND:String = "Millisecond";
public static const SYMBOL_LONG_SECOND:String = "Second";
public static const SYMBOL_LONG_MINUTE:String = "Minute";
public static const SYMBOL_LONG_HOUR:String = "Hour";
public static const SYMBOL_LONG_DAY:String = "Day";
public static const SYMBOL_LONG_WEEK:String = "Week";
public static const SYMBOL_LONG_YEAR:String = "Year";
}
}
|
package com.framework.loader {
/**
* @author suminc7
*/
import flash.display.Loader;
import flash.errors.IllegalOperationError;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
public class ClassLoader extends EventDispatcher {
public static var CLASS_LOADED : String = "classLoaded";
public static var LOAD_ERROR : String = "loadError";
private var loader : Loader;
private var swfLib : String;
private var request : URLRequest;
private var loadedClass : Class;
public function ClassLoader() {
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
}
public function load(lib : String) : void {
trace('lib: ' + (lib));
swfLib = lib;
request = new URLRequest(swfLib);
var context : LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
loader.load(request, context);
}
public function getClass(className : String) : Class {
trace('className: ' + (className));
try {
return loader.contentLoaderInfo.applicationDomain.getDefinition(className) as Class;
} catch (e : Error) {
throw new IllegalOperationError(className + " definition not found in " + swfLib);
}
return null;
}
private function completeHandler(e : Event) : void {
dispatchEvent(new Event(ClassLoader.CLASS_LOADED));
}
private function ioErrorHandler(e : Event) : void {
dispatchEvent(new Event(ClassLoader.LOAD_ERROR));
}
private function securityErrorHandler(e : Event) : void {
dispatchEvent(new Event(ClassLoader.LOAD_ERROR));
}
}
}
|
/*
Feathers
Copyright 2012-2015 Joshua Tynjala. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/
package feathers.skins
{
import feathers.core.IFeathersControl;
/**
* Sets styles on a Feathers UI component by passing the component to a
* function when the style provider's <code>applyStyles()</code> is called.
*
* <p>In the following example, a <code>FunctionStyleProvider</code> is
* created:</p>
* <listing version="3.0">
* var button:Button = new Button();
* button.label = "Click Me";
* button.styleProvider = new FunctionStyleProvider( function( target:Button ):void
* {
* target.defaultSkin = new Image( texture );
* // set other styles...
* });
* this.addChild( button );</listing>
*
* @see ../../../help/skinning.html Skinning Feathers components
*/
public class FunctionStyleProvider implements IStyleProvider
{
/**
* Constructor.
*/
public function FunctionStyleProvider(skinFunction:Function)
{
this._styleFunction = skinFunction;
}
/**
* @private
*/
protected var _styleFunction:Function;
/**
* The target Feathers UI component is passed to this function when
* <code>applyStyles()</code> is called.
*
* <p>The function is expected to have the following signature:</p>
* <pre>function( item:IFeathersControl ):void</pre>
*/
public function get styleFunction():Function
{
return this._styleFunction;
}
/**
* @private
*/
public function set styleFunction(value:Function):void
{
this._styleFunction = value;
}
/**
* @inheritDoc
*/
public function applyStyles(target:IFeathersControl):void
{
if(this._styleFunction == null)
{
return;
}
this._styleFunction(target);
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.