CombinedText
stringlengths
4
3.42M
/* * FLINT PARTICLE SYSTEM * ..................... * * Author: Richard Lord * Copyright (c) Richard Lord 2008-2011 * http://flintparticles.org * * * Licence Agreement * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.flintparticles.threeD.actions { import org.flintparticles.common.actions.ActionBase; import org.flintparticles.common.emitters.Emitter; import org.flintparticles.common.particles.Particle; import org.flintparticles.threeD.particles.Particle3D; /** * The SpeedLimit action limits the particle's maximum speed to the specified * speed. The behaviour can be switched to instead limit the minimum speed to * the specified speed. * * <p>This action has aa priority of -5, so that it executes after all accelerations * have occured.</p> */ public class SpeedLimit extends ActionBase { private var _limit:Number; private var _limitSq:Number; private var _isMinimum:Boolean; /** * The constructor creates a SpeedLimit action for use by * an emitter. To add a SpeedLimit to all particles created by an emitter, use the * emitter's addAction method. * * @see org.flintparticles.common.emitters.Emitter#addAction() * * @param speed The speed limit for the action in pixels per second. * @param isMinimum If true, particles travelling slower than the speed limit * are accelerated to the speed limit, otherwise particles travelling faster * than the speed limit are decelerated to the speed limit. */ public function SpeedLimit( speed:Number = Number.MAX_VALUE, isMinimum:Boolean = false ) { priority = -5; this.limit = speed; this.isMinimum = isMinimum; } /** * The speed limit */ public function get limit():Number { return _limit; } public function set limit( value:Number ):void { _limit = value; _limitSq = value * value; } /** * Whether the speed is a minimum (true) or maximum (false) speed. */ public function get isMinimum():Boolean { return _isMinimum; } public function set isMinimum( value:Boolean ):void { _isMinimum = value; } /** * @inheritDoc */ override public function update( emitter:Emitter, particle:Particle, time:Number ):void { var p:Particle3D = Particle3D( particle ); var speedSq:Number = p.velocity.lengthSquared; if ( ( _isMinimum && speedSq < _limitSq ) || ( !_isMinimum && speedSq > _limitSq ) ) { var scale:Number = _limit / Math.sqrt( speedSq ); p.velocity.scaleBy( scale ); } } } }
package com.playata.framework.platform.settings { public class SpielaffePlatformSettings implements IPlatformSettings { public function SpielaffePlatformSettings() { super(); } public function get reloadParams() : Vector.<String> { return null; } } }
package ddt.manager { import com.pickgliss.utils.ObjectUtils; import ddt.data.analyze.PetInfoAnalyzer; import flash.utils.Dictionary; import pet.date.PetInfo; import pet.date.PetTemplateInfo; public class PetInfoManager { private static var _list:Dictionary; public function PetInfoManager() { super(); } public static function setup(param1:PetInfoAnalyzer) : void { _list = param1.list; } public static function getPetByTemplateID(param1:int) : PetTemplateInfo { return _list[param1]; } public static function fillPetInfo(param1:PetInfo) : void { var _loc2_:PetTemplateInfo = _list[param1.TemplateID]; ObjectUtils.copyProperties(param1,_loc2_); } } }
// Decompiled by AS3 Sorcerer 6.08 // www.as3sorcerer.com //kabam.rotmg.ui.model.EnvironmentData package kabam.rotmg.ui.model { public class EnvironmentData { public var isDesktop:Boolean; public var canMapEdit:Boolean; public var buildLabel:String; } }//package kabam.rotmg.ui.model
package com.game.framework.data { import com.asvital.dev.Log; import com.game.framework.enum.MaskBackGroundType; import com.game.framework.error.OperateError; import com.game.framework.ifaces.INotifyData; import com.game.framework.ifaces.ITargetID; import com.game.framework.ifaces.IURL; import flash.events.Event; import flash.events.EventDispatcher; [Event(name="sideSelectIndexChange", type="com.game.framework.data.AlertDialogBuilder")] /** * AlerDialog 描述对象 *@author sixf */ public class AlertDialogBuilder extends EventDispatcher { private var _titleData:DialogDataItem; private var _view:IURL; private var _notify:INotifyData; private var _width:int=0; private var _height:int=0; private var _targetID:ITargetID; private var _diaLogButtons:Vector.<DialogButtonData> = new Vector.<DialogButtonData>(); private var _sideBtnData:Vector.<DialogDataItem> = new Vector.<DialogDataItem>(); private var _sideTabHeight:int=140; private var _isShadow:Boolean =true; private var _modal:Boolean =true; public static const sideSelectIndexChange:String="sideSelectIndexChange"; private var _titleCenter:Boolean =true; private var _alertBorderType:String = AlertBorderType.DEFAULT; private var _sideSelectIndex:int = -1; private var _maskBackGroundType:int =MaskBackGroundType.DEFAUTL; public function AlertDialogBuilder() { _titleData = new DialogDataItem("undefined",null); } public function get targetID():ITargetID { return _targetID; } public function set targetID(value:ITargetID):void { _targetID = value; } public function get maskBackGroundType():int { return _maskBackGroundType; } public function set maskBackGroundType(value:int):void { _maskBackGroundType = value; } public function get alertBorderType():String { return _alertBorderType; } public function set alertBorderType(value:String):void { _alertBorderType = value; } [Bindable(event=sideSelectIndexChange)] /** * 侧边按钮的选中 */ public function get sideSelectIndex():int { return _sideSelectIndex; } /** * @private */ public function set sideSelectIndex(value:int):void { //if(_sideSelectIndex != value){ _sideSelectIndex = value; if(_sideSelectIndex<0){ Log.error("多个视图的弹出窗口,必须选中一个。 sideSelectIndex 属性不能为 -1。"); _sideSelectIndex = 0; } dispatchEvent(new Event(sideSelectIndexChange)); //} } public function set sideBtnData(value:Vector.<DialogDataItem>):void { if(value==null){ throw new OperateError("sideBtnData 参数不能为 null",this); } _sideBtnData = value; } public function get titleData():DialogDataItem { return _titleData; } public function set titleData(value:DialogDataItem):void { if(value!=null){ _titleData.label = value.label; _titleData.view = value.view; } } public function get titleCenter():Boolean { return _titleCenter; } public function set titleCenter(value:Boolean):void { _titleCenter = value; } /** * 每个元素是 * @return * */ public function getDiaLogButtons():Vector.<DialogButtonData> { return _diaLogButtons; } /** * 将两个 diaLogButtons 数组合并,生成 新的数据,不创建新的副本。 * @param value * */ public function setDiaLogButtons(value:Vector.<DialogButtonData>):void { _diaLogButtons=_diaLogButtons.concat(value); } /** * 窗口的高 * 不设置,程序处理 * @return * */ public function get height():int { return _height; } public function set height(value:int):void { _height = value; } /** * 窗口的宽 * 不设置,程序处理 * @param value * */ public function get width():int { return _width; } public function set width(value:int):void { _width = value; } /** * 调用者 设置,被调用者设置,无效 * @return * */ public function get view():IURL { return _view; } public function set view(value:IURL):void { _view = value; } /** * 模态窗口 * @return * */ public function get modal():Boolean { return _modal; } public function set modal(value:Boolean):void { _modal = value; } /** * 投影 * @return * */ public function get isShadow():Boolean { return _isShadow; } public function set isShadow(value:Boolean):void { _isShadow = value; } /** * 当是有侧边按钮时,按钮的 高 * @return * */ public function get sideTabHeight():int { return _sideTabHeight; } public function set sideTabHeight(value:int):void { _sideTabHeight = value; } /** * 侧边的切换,tab 标签 ,数据 */ public function get sideBtnData():Vector.<DialogDataItem> { return _sideBtnData; } /** * 传成被调用者的消息 * @return * */ public function get notify():INotifyData { return _notify; } public function set notify(value:INotifyData):void { _notify = value; } /** * 添加 一按钮 * @param buttonData * @return * */ public function setPositiveButton(buttonData:DialogButtonData):AlertDialogBuilder{ buttonData.type = DialogButtonData.Positive; _diaLogButtons.push(buttonData); return this; } /** * 添加 一按钮 * @param buttonData * @return * */ public function setNegativeButton(buttonData:DialogButtonData):AlertDialogBuilder{ buttonData.type = DialogButtonData.Negative; _diaLogButtons.push(buttonData); return this; } } }
import gfx.io.GameDelegate; import gfx.ui.NavigationCode; import gfx.ui.InputDetails; import skyui.components.list.ListLayoutManager; import skyui.components.list.TabularList; import skyui.components.list.ListLayout; import skyui.props.PropertyDataExtender; import skyui.defines.Input; import skyui.defines.Inventory; import skyui.VRInput; import skyui.util.Debug; class BarterMenu extends ItemMenu { #include "../version.as" /* PRIVATE VARIABLES */ private var _buyMult: Number = 1; private var _sellMult: Number = 1; private var _confirmAmount: Number = 0; private var _playerGold: Number = 0; private var _vendorGold: Number = 0; private var _categoryListIconArt: Array; private var _tabBarIconArt: Array; /* PROPERTIES */ // @override ItemMenu public var bEnableTabs: Boolean = true; private var _handleInputRateLimiter: Boolean; private var _tabSwitchRateLimiter: Boolean; private var vrActionConditions = undefined; /* INITIALIZATION */ public function BarterMenu() { super(); _categoryListIconArt = ["inv_all", "inv_weapons", "inv_armor", "inv_potions", "inv_scrolls", "inv_food", "inv_ingredients", "inv_books", "inv_keys", "inv_misc"]; _tabBarIconArt = ["buy", "sell"]; } /* PUBLIC FUNCTIONS */ public function InitExtensions(): Void { super.InitExtensions(); GameDelegate.addCallBack("SetBarterMultipliers", this, "SetBarterMultipliers"); itemCard.addEventListener("messageConfirm",this,"onTransactionConfirm"); itemCard.addEventListener("sliderChange",this,"onQuantitySliderChange"); inventoryLists.tabBarIconArt = _tabBarIconArt; // Initialize menu-specific list components var categoryList: CategoryList = inventoryLists.categoryList; categoryList.iconArt = _categoryListIconArt; // We need access to the categoryList to figure out if want to // show the new icon or not inventoryLists.itemList.listState.categoryList = categoryList; } // @override ItemMenu public function setConfig(a_config: Object): Void { super.setConfig(a_config); var itemList: TabularList = inventoryLists.itemList; itemList.addDataProcessor(new BarterDataSetter(_buyMult, _sellMult)); itemList.addDataProcessor(new InventoryIconSetter(a_config["Appearance"])); itemList.addDataProcessor(new PropertyDataExtender(a_config["Appearance"], a_config["Properties"], "itemProperties", "itemIcons", "itemCompoundProperties")); var layout: ListLayout = ListLayoutManager.createLayout(a_config["ListLayout"], "ItemListLayout"); itemList.layout = layout; // Not 100% happy with doing this here, but has to do for now. if (inventoryLists.categoryList.selectedEntry) layout.changeFilterFlag(inventoryLists.categoryList.selectedEntry.flag); inventoryLists.itemList.listState.layout = layout; } // @GFx public function handleInput(details: InputDetails, pathToFocus: Array): Boolean { if(_handleInputRateLimiter) return true; skyui.util.Input.rateLimit(this, "_handleInputRateLimiter", 10); // If the item card is in focus, don't capture right/left events. // The item card is likely waiting for quantity slider input. var bShouldCaptureInput = (pathToFocus[0] != itemCard); // Is the user asking a tab switch? if (bShouldCaptureInput && Shared.GlobalFunc.IsKeyPressed(details) && details.navEquivalent == NavigationCode.LEFT && inventoryLists.categoryList.selectionAtBeginningOfSegment()) { // Rate limit tab switching so the user won't accidentally tab switch multiple times if(!_tabSwitchRateLimiter) { inventoryLists.toggleTab(); skyui.util.Input.rateLimit(this, "_tabSwitchRateLimiter", 1000/3); } return true; } return super.handleInput(details, pathToFocus); } public function handleVRInput(event): Boolean { //Debug.dump("BarterMenu::handleVRInput", event); if (!bFadedIn) return; var action = VRInput.instance.triggeredAction(vrActionConditions, event); if(action == "search") { inventoryLists.searchWidget.startInput(); return true; } return false; } private function onExitButtonPress(): Void { closeMenu() } // @API public function SetBarterMultipliers(a_buyMult: Number, a_sellMult: Number): Void { _buyMult = a_buyMult; _sellMult = a_sellMult; } // @API public function ShowRawDealWarning(a_warning: String): Void { itemCard.ShowConfirmMessage(a_warning); } // @override ItemMenu public function UpdateItemCardInfo(a_updateObj: Object): Void { if (isViewingVendorItems()) { a_updateObj.value = a_updateObj.value * _buyMult; a_updateObj.value = Math.max(a_updateObj.value, 1); } else { a_updateObj.value = a_updateObj.value * _sellMult; } a_updateObj.value = Math.floor(a_updateObj.value + 0.5); itemCard.itemInfo = a_updateObj; bottomBar.updateBarterPerItemInfo(a_updateObj); } // @override ItemMenu public function UpdatePlayerInfo(a_playerGold: Number, a_vendorGold: Number, a_vendorName: String, a_playerUpdateObj: Object): Void { _vendorGold = a_vendorGold; _playerGold = a_playerGold; bottomBar.updateBarterInfo(a_playerUpdateObj, itemCard.itemInfo, a_playerGold, a_vendorGold, a_vendorName); } /* PRIVATE FUNCTIONS */ // @override ItemMenu private function onShowItemsList(event: Object): Void { setupVRInput(); if(!vrActionConditions) { vrActionConditions = VRInput.instance.getActionConditions("BarterMenu"); if(VRInput.instance.logDetails) Debug.dump("vrActionConditions", vrActionConditions); } inventoryLists.showItemsList(); //super.onShowItemsList(event); } // @override ItemMenu private function onItemHighlightChange(event: Object): Void { if (event.index != -1) updateBottomBar(true); super.onItemHighlightChange(event); } // @override ItemMenu private function onHideItemsList(event: Object): Void { super.onHideItemsList(event); bottomBar.updateBarterPerItemInfo({type:Inventory.ICT_NONE}); updateBottomBar(false); } private function onQuantitySliderChange(event: Object): Void { var price = itemCard.itemInfo.value * event.value; if (isViewingVendorItems()) { price = price * -1; } bottomBar.updateBarterPriceInfo(_playerGold, _vendorGold, itemCard.itemInfo, price); } // @override ItemMenu private function onQuantityMenuSelect(event: Object): Void { var price = event.amount * itemCard.itemInfo.value; if (price > _vendorGold && !isViewingVendorItems()) { _confirmAmount = event.amount; GameDelegate.call("GetRawDealWarningString", [price], this, "ShowRawDealWarning"); bottomBar.updateBarterPriceInfo(_playerGold, _vendorGold, itemCard.itemInfo, price); return; } doTransaction(event.amount); } // @override ItemMenu private function onItemCardSubMenuAction(event: Object): Void { super.onItemCardSubMenuAction(event); if (event.menu == "quantity") { if (event.opening) { onQuantitySliderChange({value:itemCard.itemInfo.count}); return; } bottomBar.updateBarterPriceInfo(_playerGold, _vendorGold); } } private function onTransactionConfirm(): Void { doTransaction(_confirmAmount); _confirmAmount = 0; } private function doTransaction(a_amount: Number): Void { GameDelegate.call("ItemSelect",[a_amount, itemCard.itemInfo.value, isViewingVendorItems()]); // Update barter multipliers // Update itemList => dataProcessor => BarterDataSetter updateBarterMultipliers // Update itemCardInfo GameDelegate.call("RequestItemCardInfo",[], this, "UpdateItemCardInfo"); } private function isViewingVendorItems(): Boolean { return inventoryLists.categoryList.activeSegment == 0; } // @override ItemMenu private function updateBottomBar(a_bSelected: Boolean): Void { navPanel.clearButtons(); if (a_bSelected) { var activateControls = skyui.util.Input.pickControls(_platform, {PCArt:"E",XBoxArt:"360_A",PS3Art:"PS3_A",ViveArt:"trigger",MoveArt:"PS3_MOVE",OculusArt:"trigger",WindowsMRArt:"trigger"}); navPanel.addButton({text: (isViewingVendorItems() ? "$Buy" : "$Sell"), controls: activateControls}); } else { // navPanel.addButton({text: "$Exit", controls: _cancelControls}); // navPanel.addButton({text: "$Search", controls: _searchControls}); if (_platform != 0) { navPanel.addButton({text: "$Column", controls: {namedKey: "Action_Up"}}); navPanel.addButton({text: "$Order", controls: {namedKey: "Action_Double_Up"}}); } navPanel.addButton({text: "$Switch Tab", controls: {namedKey: "Action_Left"}}); } navPanel.addButton({ text: "$Search", controls: skyui.util.Input.pickControls(_platform, {PCArt: "Space", ViveArt: "radial_Either_Down", MoveArt: "PS3_X", OculusArt: "OCC THUMB_REST", WindowsMRArt: "OCC THUMB_REST", KnucklesArt: "OCC THUMB_REST"})}); navPanel.updateButtons(true); } }
package com.codeazur.as3swf.data.actions.swf5 { import com.codeazur.as3swf.data.actions.*; public class ActionDelete extends Action implements IAction { public static const CODE:uint = 0x3a; public function ActionDelete(code:uint, length:uint) { super(code, length); } override public function toString(indent:uint = 0):String { return "[ActionDelete]"; } } }
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** 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 Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * 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 ***** */ START("13.5.4.3 - XMLList attributes()"); //TEST(1, true, XMLList.prototype.hasOwnProperty("attributes")); // Test with XMLList of size 0 x1 = new XMLList() TEST(2, "xml", typeof(x1.attributes())); TEST_XML(3, "", x1.attributes()); // Test with XMLList of size 1 x1 += <alpha attr1="value1" attr2="value2">one</alpha>; TEST(4, "xml", typeof(x1.attributes())); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); TEST(5, correct, x1.attributes()); // Test with XMLList of size > 1 x1 += <bravo attr3="value3" attr4="value4">two</bravo>; TEST(6, "xml", typeof(x1.attributes())); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); correct += new XML("value3"); correct += new XML("value4"); TEST(7, correct, x1.attributes()); var xmlDoc = "<TEAM foo = 'bar' two='second'>Giants</TEAM><CITY two = 'third'>Giants</CITY>"; AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes() instanceof XMLList", true, (MYXML = new XMLList(xmlDoc), MYXML.attributes() instanceof XMLList )); AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes() instanceof XML", false, (MYXML = new XMLList(xmlDoc), MYXML.attributes() instanceof XML )); AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes().length()", 3, (MYXML = new XMLList(xmlDoc), MYXML.attributes().length() )); XML.prettyPrinting = false; AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes().toString()", "barsecondthird", (MYXML = new XMLList(xmlDoc), MYXML.attributes().toString() )); XML.prettyPrinting = true; AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes().toString()", "barsecondthird", (MYXML = new XMLList(xmlDoc), MYXML.attributes().toString() )); AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes()[0].nodeKind()", "attribute", (MYXML = new XMLList(xmlDoc), MYXML.attributes()[0].nodeKind() )); AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes()[1].nodeKind()", "attribute", (MYXML = new XMLList(xmlDoc), MYXML.attributes()[1].nodeKind() )); AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes()[2].nodeKind()", "attribute", (MYXML = new XMLList(xmlDoc), MYXML.attributes()[2].nodeKind() )); AddTestCase( "MYXML = new XMLList(xmlDoc), MYXML.attributes().toXMLString()", "bar" + NL() + "second" + NL() + "third", (MYXML = new XMLList(xmlDoc), MYXML.attributes().toXMLString() )); END();
package framework.resource.faxb.tutorial { [XmlType(name="showArea", propOrder="")] public class ShowArea { [XmlAttribute(name="x", required="true")] public var x: int; [XmlAttribute(name="y", required="true")] public var y: int; [XmlAttribute(name="width", required="true")] public var width: int; [XmlAttribute(name="height", required="true")] public var height: int; } }
package net.psykosoft.psykopaint2.core.commands.bootstrap { import eu.alebianco.robotlegs.utils.impl.AsyncCommand; import net.psykosoft.psykopaint2.core.managers.assets.ShakeAndBakeManager; public class ConnectCoreModuleShakeAndBakeCommand extends AsyncCommand { [Inject] public var shaker:ShakeAndBakeManager; override public function execute():void { trace( this, "execute()" ); shaker.connect( ShakeAndBakeManager.CORE_CONNECTOR_URL, onShakeAndBakeConnected ); } private function onShakeAndBakeConnected():void { trace( this, "shake and bake connected" ); dispatchComplete( true ); } } }
// Note: If you wish to use some of these functions, consider adding Dashboard as a plugin dependency! #if MP4 class CSceneVehicleVisInner { CTrackManiaPlayer@ m_player; //NOTE: CSceneVehicleVisState is defined in Export/StateWrappers.as! CSceneVehicleVisState@ AsyncState; CSceneVehicleVisInner(CGamePlayer@ player) { @m_player = cast<CTrackManiaPlayer>(player); @AsyncState = CSceneVehicleVisState(m_player); } } namespace Vehicle { // Get vehicle vis from a given player. CSceneVehicleVisInner@ GetVis(CGameScene@ sceneVis, CGamePlayer@ player) { if (player is null) { return null; } return CSceneVehicleVisInner(player); } // Not used for anything in MP4 afaik, but keeping the interface identical. CSceneVehicleVisInner@ GetSingularVis(CGameScene@ sceneVis) { return null; } // Get RPM for vehicle vis. This is contained within the state, but not exposed by default, which // is why this function exists. float GetRPM(CSceneVehicleVisState@ vis) { return vis.RPM; } // Get relative side speed for vehicle. float GetSideSpeed(CSceneVehicleVisState@ vis) { return vis.SideSpeed; } // Get entity ID of the given vehicle vis. uint GetEntityId(CSceneVehicleVisInner@ vis) { // Not present return 0; } } #endif
package cmodule.lua_wrapper { public const _db_setfenv:int = regFunc(FSM_db_setfenv.start); }
/* Copyright (c) 2007 FlexLib Contributors. See: http://code.google.com/p/flexlib/wiki/ProjectContributors 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 flexlib.mdi.events { import flash.events.Event; import flexlib.mdi.containers.MDIWindow; import flexlib.mdi.managers.MDIManager; import mx.effects.Effect; /** * Event type dispatched by MDIManager. Majority of events based on/relayed from managed windows. */ public class MDIManagerEvent extends Event { public static const WINDOW_ADD:String = "windowAdd"; public static const WINDOW_MINIMIZE:String = "windowMinimize"; public static const WINDOW_RESTORE:String = "windowRestore"; public static const WINDOW_MAXIMIZE:String = "windowMaximize"; public static const WINDOW_CLOSE:String = "windowClose"; public static const WINDOW_FOCUS_START:String = "windowFocusStart"; public static const WINDOW_FOCUS_END:String = "windowFocusEnd"; public static const WINDOW_DRAG_START:String = "windowDragStart"; public static const WINDOW_DRAG:String = "windowDrag"; public static const WINDOW_DRAG_END:String = "windowDragEnd"; public static const WINDOW_RESIZE_START:String = "windowResizeStart"; public static const WINDOW_RESIZE:String = "windowResize"; public static const WINDOW_RESIZE_END:String = "windowResizeEnd"; public static const CASCADE:String = "cascade"; public static const TILE:String = "tile"; public var window:MDIWindow; public var manager:MDIManager; public var effect:Effect; public var effectItems:Array; public var resizeHandle:String; public function MDIManagerEvent(type:String, window:MDIWindow, manager:MDIManager, effect:Effect = null, effectItems:Array = null, resizeHandle:String = null, bubbles:Boolean = false) { super(type, bubbles, true); this.window = window; this.manager = manager; this.effect = effect; this.effectItems = effectItems; this.resizeHandle = resizeHandle; } override public function clone():Event { return new MDIManagerEvent(type, window, manager, effect, effectItems, resizeHandle, bubbles); } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.skins.halo { import flash.display.GradientType; import flash.display.Graphics; import mx.core.IContainer; import mx.core.EdgeMetrics; import mx.core.IUIComponent; import mx.core.mx_internal; import mx.graphics.RectangularDropShadow; import mx.skins.RectangularBorder; import mx.styles.IStyleClient; import mx.styles.StyleManager; import mx.utils.ColorUtil; import mx.graphics.GradientEntry; use namespace mx_internal; /** * Defines the appearance of the default border for the Halo theme. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class HaloBorder extends RectangularBorder { include "../../core/Version.as"; //-------------------------------------------------------------------------- // // Class constants // //-------------------------------------------------------------------------- /** * @private * A look up table for the offsets. */ private static var BORDER_WIDTHS:Object = { none: 0, solid: 1, inset: 2, outset: 2, alert: 3, dropdown: 2, menuBorder: 1, comboNonEdit: 2 }; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function HaloBorder() { super(); // 'default' is a keyword; setting it this way avoids a compiler error BORDER_WIDTHS["default"] = 3; } //-------------------------------------------------------------------------- // // Fields // //-------------------------------------------------------------------------- /** * @private * A reference to the object used to cast a drop shadow. * See the drawDropShadow() method for details. */ private var dropShadow:RectangularDropShadow; mx_internal var backgroundColor:Object; mx_internal var backgroundAlphaName:String; mx_internal var backgroundHole:Object; mx_internal var bRoundedCorners:Boolean; mx_internal var radius:Number; mx_internal var radiusObj:Object; //-------------------------------------------------------------------------- // // Overridden properties // //-------------------------------------------------------------------------- //---------------------------------- // borderMetrics //---------------------------------- /** * @private * Internal object that contains the thickness of each edge * of the border */ protected var _borderMetrics:EdgeMetrics; /** * @private * Return the thickness of the border edges. * * @return Object top, bottom, left, right thickness in pixels */ override public function get borderMetrics():EdgeMetrics { if (_borderMetrics) return _borderMetrics; var borderThickness:Number; // Add support for "custom" style type here when we support it. var borderStyle:String = getStyle("borderStyle"); if (borderStyle == "default" || borderStyle == "alert") { return EdgeMetrics.EMPTY; } else if (borderStyle == "controlBar" || borderStyle == "applicationControlBar") { _borderMetrics = new EdgeMetrics(1, 1, 1, 1); } else if (borderStyle == "solid") { borderThickness = getStyle("borderThickness"); if (isNaN(borderThickness)) borderThickness = 0; _borderMetrics = new EdgeMetrics(borderThickness, borderThickness, borderThickness, borderThickness); var borderSides:String = getStyle("borderSides"); if (borderSides != "left top right bottom") { // Adjust metrics based on which sides we have if (borderSides.indexOf("left") == -1) _borderMetrics.left = 0; if (borderSides.indexOf("top") == -1) _borderMetrics.top = 0; if (borderSides.indexOf("right") == -1) _borderMetrics.right = 0; if (borderSides.indexOf("bottom") == -1) _borderMetrics.bottom = 0; } } else { borderThickness = BORDER_WIDTHS[borderStyle]; if (isNaN(borderThickness)) borderThickness = 0; _borderMetrics = new EdgeMetrics(borderThickness, borderThickness, borderThickness, borderThickness); } return _borderMetrics; } //-------------------------------------------------------------------------- // // Overridden methods // //-------------------------------------------------------------------------- /** * @private * If borderStyle may have changed, clear the cached border metrics. */ override public function styleChanged(styleProp:String):void { super.styleChanged(styleProp); if (styleProp == null || styleProp == "styleName" || styleProp == "borderStyle" || styleProp == "borderThickness" || styleProp == "borderSides") { _borderMetrics = null; } } /** * @private * Draw the border, either 3D or 2D or nothing at all. */ override protected function updateDisplayList(w:Number, h:Number):void { if (isNaN(w) || isNaN(h)) return; super.updateDisplayList(w, h); // Store background color in an object, // so that null is distinct from black. backgroundColor = getBackgroundColor(); bRoundedCorners = false; backgroundAlphaName = "backgroundAlpha"; backgroundHole = null; radius = 0; radiusObj = null; drawBorder(w,h); drawBackground(w,h); } //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * @private */ mx_internal function drawBorder(w:Number, h:Number):void { var borderStyle:String = getStyle("borderStyle"); // Other styles that we may fetch. var highlightAlphas:Array = getStyle("highlightAlphas"); var backgroundAlpha:Number; var borderCapColor:uint; var borderColor:uint; var borderSides:String; var borderThickness:Number; var buttonColor:uint; var docked:Boolean; var dropdownBorderColor:uint; var fillColors:Array; var footerColors:Array; var highlightColor:uint; var shadowCapColor:uint; var shadowColor:uint; var themeColor:uint; var translucent:Boolean; var hole:Object; var drawTopHighlight:Boolean = false; var borderColorDrk1:Number var borderColorDrk2:Number var borderColorLt1:Number var borderInnerColor:Object; var g:Graphics = graphics; g.clear(); if (borderStyle) { switch (borderStyle) { case "none": { break; } case "inset": // used for text input & numeric stepper { borderColor = getStyle("borderColor"); borderColorDrk1 = ColorUtil.adjustBrightness2(borderColor, -40); borderColorDrk2 = ColorUtil.adjustBrightness2(borderColor, +25); borderColorLt1 = ColorUtil.adjustBrightness2(borderColor, +40); borderInnerColor = backgroundColor; if (borderInnerColor === null || borderInnerColor === "") { borderInnerColor = borderColor; } draw3dBorder(borderColorDrk2, borderColorDrk1, borderColorLt1, Number(borderInnerColor), Number(borderInnerColor), Number(borderInnerColor)); break; } case "outset": { borderColor = getStyle("borderColor"); borderColorDrk1 = ColorUtil.adjustBrightness2(borderColor, -40); borderColorDrk2 = ColorUtil.adjustBrightness2(borderColor, -25); borderColorLt1 = ColorUtil.adjustBrightness2(borderColor, +40); borderInnerColor = backgroundColor; if (borderInnerColor === null || borderInnerColor === "") { borderInnerColor = borderColor; } draw3dBorder(borderColorDrk2, borderColorLt1, borderColorDrk1, Number(borderInnerColor), Number(borderInnerColor), Number(borderInnerColor)); break; } case "alert": case "default": { break; } case "dropdown": // never used { // The dropdownBorderColor is currently only used // when displaying an error state. dropdownBorderColor = getStyle("dropdownBorderColor"); drawDropShadow(0, 0, w, h, 4, 0, 0, 4); // frame drawRoundRect( 0, 0, w, h, { tl: 4, tr: 0, br: 0, bl: 4 }, 0x4D555E, 1); // gradient drawRoundRect( 0, 0, w, h, { tl: 4, tr: 0, br: 0, bl: 4}, [ 0xFFFFFF, 0xFFFFFF ], [ 0.7, 0 ], verticalGradientMatrix(0, 0, w, h)); // button top higlight edge drawRoundRect( 1, 1, w - 1, h - 2, { tl: 3, tr: 0, br: 0, bl: 3 }, 0xFFFFFF, 1); // button face drawRoundRect( 1, 2, w - 1, h - 3, { tl: 3, tr: 0, br: 0, bl: 3 }, [ 0xEEEEEE, 0xFFFFFF ], 1, verticalGradientMatrix(0, 0, w - 1, h - 3)); if (!isNaN(dropdownBorderColor)) { // combo background in error state drawRoundRect( 0, 0, w + 1, h, { tl: 4, tr: 0, br: 0, bl: 4 }, dropdownBorderColor, 0.5); // button top higlight edge drawRoundRect( 1, 1, w - 1, h - 2, { tl: 3, tr: 0, br: 0, bl: 3 }, 0xFFFFFF, 1); //button face drawRoundRect( 1, 2, w - 1, h - 3, { tl: 3, tr: 0, br: 0, bl: 3 }, [ 0xEEEEEE, 0xFFFFFF ], 1, verticalGradientMatrix(0, 0, w - 1, h - 3)); } // Make sure the border isn't filled in down below. backgroundColor = null; break; } case "menuBorder": { borderColor = getStyle("borderColor"); drawRoundRect( 0, 0, w, h, 0, borderColor, 1); drawDropShadow(1, 1, w - 2, h - 2, 0, 0, 0, 0); break; } case "comboNonEdit": { break; } case "controlBar": { if (w == 0 || h == 0) { // If the width or height is 0, don't draw anything. backgroundColor = null; break; } footerColors = getStyle("footerColors"); var showChrome:Boolean = footerColors != null; var borderAlpha:Number = getStyle("borderAlpha"); if (showChrome) { g.lineStyle(0, footerColors.length > 0 ? footerColors[1] : footerColors[0], borderAlpha); g.moveTo(0, 0); g.lineTo(w, 0); g.lineStyle(0, 0, 0); // cornerRadius is defined on our parent container. Reach up // and grab it. Yes, this is cheating... if (parent && parent.parent && parent.parent is IStyleClient) { radius = IStyleClient(parent.parent).getStyle("cornerRadius"); borderAlpha = IStyleClient(parent.parent).getStyle("borderAlpha"); } if (isNaN(radius)) radius = 0; // If our parent has square bottom corners, // use square corners. if (IStyleClient(parent.parent). getStyle("roundedBottomCorners").toString().toLowerCase() != "true") { radius = 0; } drawRoundRect( 0, 1, w, h - 1, { tl: 0, tr: 0, bl:radius, br: radius }, footerColors, borderAlpha, verticalGradientMatrix(0, 0, w, h)); if (footerColors.length > 1 && footerColors[0] != footerColors[1]) { drawRoundRect( 0, 1, w, h - 1, { tl: 0, tr: 0, bl: radius, br: radius }, [ 0xFFFFFF, 0xFFFFFF ], highlightAlphas, verticalGradientMatrix(0, 0, w, h)); drawRoundRect( 1, 2, w - 2, h - 3, { tl: 0, tr: 0, bl: radius - 1, br: radius - 1 }, footerColors, borderAlpha, verticalGradientMatrix(0, 0, w, h)); } } // Don't draw the background color below. // We've already handled it here. backgroundColor = null; break; } case "applicationControlBar": { fillColors = getStyle("fillColors"); backgroundAlpha = getStyle("backgroundAlpha"); highlightAlphas = getStyle("highlightAlphas"); var fillAlphas:Array = getStyle("fillAlphas"); docked = getStyle("docked"); // background color of the bar var backgroundColorNum:uint = uint(backgroundColor); radius = getStyle("cornerRadius"); if (!radius) radius = 0; drawDropShadow(0, 1, w, h - 1, radius, radius, radius, radius); if (backgroundColor !== null && styleManager.isValidStyleValue(backgroundColor)) { drawRoundRect( 0, 1, w, h - 1, radius, backgroundColorNum, backgroundAlpha, verticalGradientMatrix(0, 0, w, h)); } // surface drawRoundRect( 0, 1, w, h - 1, radius, fillColors, fillAlphas, verticalGradientMatrix(0, 0, w, h)); // highlight drawRoundRect( 0, 1, w, (h / 2) - 1, { tl: radius, tr: radius, bl: 0, br: 0 }, [ 0xFFFFFF, 0xFFFFFF ], highlightAlphas, verticalGradientMatrix(0, 0, w, h / 2 - 1)); // edge drawRoundRect( 0, 1, w, h - 1, { tl: radius, tr: radius, bl: 0, br: 0 }, 0xFFFFFF, 0.3, null, GradientType.LINEAR, null, { x: 0, y: 2, w: w, h: h - 2, r: { tl: radius, tr: radius, bl: 0, br: 0 } }); // Don't draw the background color below. // We've already handled it here. backgroundColor = null; break; } default: // ((borderStyle == "solid") || (borderStyle == null)) { borderColor = getStyle("borderColor"); borderThickness = getStyle("borderThickness"); borderSides = getStyle("borderSides"); var bHasAllSides:Boolean = true; radius = getStyle("cornerRadius"); bRoundedCorners = getStyle("roundedBottomCorners").toString().toLowerCase() == "true"; var holeRadius:Number = Math.max(radius - borderThickness, 0); hole = { x: borderThickness, y: borderThickness, w: w - borderThickness * 2, h: h - borderThickness * 2, r: holeRadius }; if (!bRoundedCorners) { radiusObj = {tl:radius, tr:radius, bl:0, br:0}; hole.r = {tl:holeRadius, tr:holeRadius, bl:0, br:0}; } if (borderSides != "left top right bottom") { // Convert the radius values from a scalar to an object // because we need to adjust individual radius values // if we are missing any sides. hole.r = { tl: holeRadius, tr: holeRadius, bl: bRoundedCorners ? holeRadius : 0, br: bRoundedCorners ? holeRadius : 0 }; radiusObj = { tl: radius, tr: radius, bl: bRoundedCorners ? radius : 0, br: bRoundedCorners ? radius : 0}; borderSides = borderSides.toLowerCase(); if (borderSides.indexOf("left") == -1) { hole.x = 0; hole.w += borderThickness; hole.r.tl = 0; hole.r.bl = 0; radiusObj.tl = 0; radiusObj.bl = 0; bHasAllSides = false; } if (borderSides.indexOf("top") == -1) { hole.y = 0; hole.h += borderThickness; hole.r.tl = 0; hole.r.tr = 0; radiusObj.tl = 0; radiusObj.tr = 0; bHasAllSides = false; } if (borderSides.indexOf("right") == -1) { hole.w += borderThickness; hole.r.tr = 0; hole.r.br = 0; radiusObj.tr = 0; radiusObj.br = 0; bHasAllSides = false; } if (borderSides.indexOf("bottom") == -1) { hole.h += borderThickness; hole.r.bl = 0; hole.r.br = 0; radiusObj.bl = 0; radiusObj.br = 0; bHasAllSides = false; } } if (radius == 0 && bHasAllSides) { drawDropShadow(0, 0, w, h, 0, 0, 0, 0); g.beginFill(borderColor); g.drawRect(0, 0, w, h); g.drawRect(borderThickness, borderThickness, w - 2 * borderThickness, h - 2 * borderThickness); g.endFill(); } else if (radiusObj) { drawDropShadow(0, 0, w, h, radiusObj.tl, radiusObj.tr, radiusObj.br, radiusObj.bl); drawRoundRect( 0, 0, w, h, radiusObj, borderColor, 1, null, null, null, hole); // Reset radius here so background drawing // below is correct. radiusObj.tl = Math.max(radius - borderThickness, 0); radiusObj.tr = Math.max(radius - borderThickness, 0); radiusObj.bl = bRoundedCorners ? Math.max(radius - borderThickness, 0) : 0; radiusObj.br = bRoundedCorners ? Math.max(radius - borderThickness, 0) : 0; } else { drawDropShadow(0, 0, w, h, radius, radius, radius, radius); drawRoundRect( 0, 0, w, h, radius, borderColor, 1, null, null, null, hole); // Reset radius here so background drawing // below is correct. radius = Math.max(getStyle("cornerRadius") - borderThickness, 0); } } } // switch } } /** * @private * Draw a 3D border. */ mx_internal function draw3dBorder(c1:Number, c2:Number, c3:Number, c4:Number, c5:Number, c6:Number):void { var w:Number = width; var h:Number = height; /* // temp color override to verify layout of lines var c1:Number = 0x919999; var c2:Number = 0x6F7777; var c3:Number = 0xD5DDDD; var c4:Number = 0xC4CCCC; var c5:Number = 0xEEEEEE; var c6:Number = 0xD5DDDD; */ drawDropShadow(0, 0, width, height, 0, 0, 0, 0); var g:Graphics = graphics; // outside sides g.beginFill(c1); g.drawRect(0, 0, w, h); g.drawRect(1, 0, w - 2, h); g.endFill(); // outside top g.beginFill(c2); g.drawRect(1, 0, w - 2, 1); g.endFill(); // outside bottom g.beginFill(c3); g.drawRect(1, h - 1, w - 2, 1); g.endFill(); // inside top g.beginFill(c4); g.drawRect(1, 1, w - 2, 1); g.endFill(); // inside bottom g.beginFill(c5); g.drawRect(1, h - 2, w - 2, 1); g.endFill(); // inside sides g.beginFill(c6); g.drawRect(1, 2, w - 2, h - 4); g.drawRect(2, 2, w - 4, h - 4); g.endFill(); } /** * @private */ mx_internal function drawBackground(w:Number, h:Number):void { // The behavior used to be that we always create a background // regardless of whether we have a background color or not. // Now we only create a background if we have a color // or if the mouseShield or mouseShieldChildren styles are true. // Look at Container.addEventListener and Container.isBorderNeeded // for the mouseShield logic. JCS 6/24/05 if ((backgroundColor !== null && backgroundColor !== "") || getStyle("mouseShield") || getStyle("mouseShieldChildren")) { var nd:Number = Number(backgroundColor); var alpha:Number = 1.0; var bm:EdgeMetrics = getBackgroundColorMetrics(); var g:Graphics = graphics; if (isNaN(nd) || backgroundColor === "" || backgroundColor === null) { alpha = 0; nd = 0xFFFFFF; } else { alpha = getStyle(backgroundAlphaName); } // If we have a non-zero radius, use drawRoundRect() // to fill in the background. if (radius != 0 || backgroundHole) { var bottom:Number = bm.bottom; if (radiusObj) { var topRadius:Number = Math.max(radius - Math.max(bm.top, bm.left, bm.right), 0); var bottomRadius:Number = bRoundedCorners ? Math.max(radius - Math.max(bm.bottom, bm.left, bm.right), 0) : 0; radiusObj = { tl: topRadius, tr: topRadius, bl: bottomRadius, br: bottomRadius }; drawRoundRect( bm.left, bm.top, width - (bm.left + bm.right), height - (bm.top + bottom), radiusObj, nd, alpha, null, GradientType.LINEAR, null, backgroundHole); } else { drawRoundRect( bm.left, bm.top, width - (bm.left + bm.right), height - (bm.top + bottom), radius, nd, alpha, null, GradientType.LINEAR, null, backgroundHole); } } else { g.beginFill(nd, alpha); g.drawRect(bm.left, bm.top, w - bm.right - bm.left, h - bm.bottom - bm.top); g.endFill(); } } } /** * @private * Apply a drop shadow using a bitmap filter. * * Bitmap filters are slow, and their slowness is proportional * to the number of pixels being filtered. * For a large HaloBorder, it's wasteful to create a big shadow. * Instead, we'll create the shadow offscreen * and stretch it to fit the HaloBorder. */ mx_internal function drawDropShadow(x:Number, y:Number, width:Number, height:Number, tlRadius:Number, trRadius:Number, brRadius:Number, blRadius:Number):void { // Do I need a drop shadow in the first place? If not, return // immediately. if (getStyle("dropShadowEnabled") == false || getStyle("dropShadowEnabled") == "false" || width == 0 || height == 0) { return; } // Calculate the angle and distance for the shadow var distance:Number = getStyle("shadowDistance"); var direction:String = getStyle("shadowDirection"); var angle:Number; if (getStyle("borderStyle") == "applicationControlBar") { var docked:Boolean = getStyle("docked"); angle = docked ? 90 : getDropShadowAngle(distance, direction); distance = Math.abs(distance); } else { angle = getDropShadowAngle(distance, direction); distance = Math.abs(distance) + 2; } // Create a RectangularDropShadow object, set its properties, // and draw the shadow if (!dropShadow) dropShadow = new RectangularDropShadow(); dropShadow.distance = distance; dropShadow.angle = angle; dropShadow.color = getStyle("dropShadowColor"); dropShadow.alpha = 0.4; dropShadow.tlRadius = tlRadius; dropShadow.trRadius = trRadius; dropShadow.blRadius = blRadius; dropShadow.brRadius = brRadius; dropShadow.drawShadow(graphics, x, y, width, height); } /** * @private * Convert the value of the shadowDirection property * into a shadow angle. */ mx_internal function getDropShadowAngle(distance:Number, direction:String):Number { if (direction == "left") return distance >= 0 ? 135 : 225; else if (direction == "right") return distance >= 0 ? 45 : 315; else // direction == "center" return distance >= 0 ? 90 : 270; } /** * @private */ mx_internal function getBackgroundColor():Object { var p:IUIComponent = parent as IUIComponent; if (p && !p.enabled) { var color:Object = getStyle("backgroundDisabledColor"); if (color !== null && styleManager.isValidStyleValue(color)) return color; } return getStyle("backgroundColor"); } /** * @private */ mx_internal function getBackgroundColorMetrics():EdgeMetrics { return borderMetrics; } } }
/** * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ * * Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below). * * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 3.0 of the License, or (at your option) any later * version. * * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. * */ package org.bigbluebutton.clientcheck.service { import flash.events.Event; import flash.events.HTTPStatusEvent; import flash.events.IOErrorEvent; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLRequestHeader; import flash.net.URLRequestMethod; import mx.utils.ObjectUtil; import org.osflash.signals.ISignal; import org.osflash.signals.Signal; import org.bigbluebutton.clientcheck.service.util.URLFetcher; public class ConfigService { protected var _successSignal:Signal=new Signal(); protected var _unsuccessSignal:Signal=new Signal(); public function get successSignal():ISignal { return _successSignal; } public function get unsuccessSignal():ISignal { return _unsuccessSignal; } public function getConfig(serverUrl:String, urlRequest:URLRequest):void { var configUrl:String=serverUrl; var fetcher:URLFetcher=new URLFetcher; fetcher.successSignal.add(onSuccess); fetcher.unsuccessSignal.add(onUnsuccess); fetcher.fetch(configUrl, urlRequest); } protected function onSuccess(data:Object, responseUrl:String, urlRequest:URLRequest):void { successSignal.dispatch(new XML(data)); } protected function onUnsuccess(reason:String):void { unsuccessSignal.dispatch(reason); } } }
package as3lib.core.string { import as3lib.core.valid.isWhitespace; /** * 删除左部任何空白字符,包括空格、制表符、换页符、,换行等等 [\f\n\r\t\v] * @param * @return */ public function leftTrim(str:String):String { if (str == null) return ''; var startIndex:int = 0; while (isWhitespace(str.charAt(startIndex))) ++startIndex; if(startIndex == str.length) return str.slice(startIndex); else return ""; } }
package feathers.examples.componentsExplorer.data { import feathers.controls.ItemRendererLayoutOrder; import feathers.layout.HorizontalAlign; import feathers.layout.RelativePosition; import feathers.layout.VerticalAlign; public class ItemRendererSettings { public static const ICON_ACCESSORY_TYPE_DISPLAY_OBJECT:String = "Display Object"; public static const ICON_ACCESSORY_TYPE_TEXTURE:String = "Texture"; public static const ICON_ACCESSORY_TYPE_LABEL:String = "Label"; public function ItemRendererSettings() { } public var hasIcon:Boolean = true; public var hasAccessory:Boolean = true; public var layoutOrder:String = ItemRendererLayoutOrder.LABEL_ICON_ACCESSORY; public var iconType:String = ICON_ACCESSORY_TYPE_TEXTURE; public var iconPosition:String = RelativePosition.LEFT; public var useInfiniteGap:Boolean = false; public var accessoryPosition:String = RelativePosition.RIGHT; public var accessoryType:String = ICON_ACCESSORY_TYPE_DISPLAY_OBJECT; public var useInfiniteAccessoryGap:Boolean = true; public var horizontalAlign:String = HorizontalAlign.LEFT; public var verticalAlign:String = VerticalAlign.MIDDLE; } }
/** @todo: Parser.parseXML */ package org.asaplibrary.data.xml { import asunit.framework.TestCase; import org.asaplibrary.data.xml.Parser; import org.asaplibrary.util.FrameDelay; import org.asaplibrary.util.FrameDelay; import org.asaplibrary.data.URLData; public class ParserTestCase extends TestCase { private var mURLs:Array; public function testParse () : void { var xml:XML = <settings> <urls> <url name="addressform" url="../xml/address.xml" /> <url name="entries" url="../xml/entries.xml" /> </urls> </settings> assertTrue("testParse", handleSettingsLoaded(xml) != false); } // parse XML // @param o: XML // @return true if parsing went ok, otherwise false private function handleSettingsLoaded (inXml:XML) : Boolean { var xmlList:XMLList = XMLList(inXml); mURLs = Parser.parseList(xmlList.urls.url, URLData, false); return (mURLs != null); } } }
package game.net.data.s { import flash.utils.ByteArray; import game.net.data.DataBase; import game.net.data.vo.*; import game.net.data.IData; public class SColiseumReport extends DataBase { public var lists : Vector.<IData>; public static const CMD : int=33014; public function SColiseumReport() { } /** * * @param data */ override public function deSerialize(data:ByteArray):void { super.deSerialize(data); lists=readObjectArray(ColiseumReportList); } override public function serialize():ByteArray { var byte:ByteArray= new ByteArray(); writeObjects(lists,byte); return byte; } override public function getCmd():int { return CMD; } } } // vim: filetype=php :
package serverProto.practice { import com.netease.protobuf.Message; import com.netease.protobuf.fieldDescriptors.FieldDescriptor$TYPE_SINT32; import com.netease.protobuf.fieldDescriptors.FieldDescriptor$TYPE_MESSAGE; import com.netease.protobuf.WireType; import serverProto.inc.ProtoPlayerKey; import com.netease.protobuf.WritingBuffer; import com.netease.protobuf.WriteUtils; import flash.utils.IDataInput; import com.netease.protobuf.ReadUtils; import flash.errors.IOError; public final class ProtoPracticeNinjaRequest extends Message { public static const NINJA_SEQ:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.practice.ProtoPracticeNinjaRequest.ninja_seq","ninjaSeq",1 << 3 | WireType.VARINT); public static const TIME_TYPE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.practice.ProtoPracticeNinjaRequest.time_type","timeType",2 << 3 | WireType.VARINT); public static const PAY_TYPE:FieldDescriptor$TYPE_SINT32 = new FieldDescriptor$TYPE_SINT32("serverProto.practice.ProtoPracticeNinjaRequest.pay_type","payType",3 << 3 | WireType.VARINT); public static const FRIEND:FieldDescriptor$TYPE_MESSAGE = new FieldDescriptor$TYPE_MESSAGE("serverProto.practice.ProtoPracticeNinjaRequest.friend","friend",4 << 3 | WireType.LENGTH_DELIMITED,ProtoPlayerKey); public var ninjaSeq:int; private var time_type$field:int; private var hasField$0:uint = 0; private var pay_type$field:int; private var friend$field:ProtoPlayerKey; public function ProtoPracticeNinjaRequest() { super(); } public function clearTimeType() : void { this.hasField$0 = this.hasField$0 & 4.294967294E9; this.time_type$field = new int(); } public function get hasTimeType() : Boolean { return (this.hasField$0 & 1) != 0; } public function set timeType(param1:int) : void { this.hasField$0 = this.hasField$0 | 1; this.time_type$field = param1; } public function get timeType() : int { return this.time_type$field; } public function clearPayType() : void { this.hasField$0 = this.hasField$0 & 4.294967293E9; this.pay_type$field = new int(); } public function get hasPayType() : Boolean { return (this.hasField$0 & 2) != 0; } public function set payType(param1:int) : void { this.hasField$0 = this.hasField$0 | 2; this.pay_type$field = param1; } public function get payType() : int { return this.pay_type$field; } public function clearFriend() : void { this.friend$field = null; } public function get hasFriend() : Boolean { return this.friend$field != null; } public function set friend(param1:ProtoPlayerKey) : void { this.friend$field = param1; } public function get friend() : ProtoPlayerKey { return this.friend$field; } override final function writeToBuffer(param1:WritingBuffer) : void { var _loc2_:* = undefined; WriteUtils.writeTag(param1,WireType.VARINT,1); WriteUtils.write$TYPE_SINT32(param1,this.ninjaSeq); if(this.hasTimeType) { WriteUtils.writeTag(param1,WireType.VARINT,2); WriteUtils.write$TYPE_SINT32(param1,this.time_type$field); } if(this.hasPayType) { WriteUtils.writeTag(param1,WireType.VARINT,3); WriteUtils.write$TYPE_SINT32(param1,this.pay_type$field); } if(this.hasFriend) { WriteUtils.writeTag(param1,WireType.LENGTH_DELIMITED,4); WriteUtils.write$TYPE_MESSAGE(param1,this.friend$field); } for(_loc2_ in this) { super.writeUnknown(param1,_loc2_); } } override final function readFromSlice(param1:IDataInput, param2:uint) : void { /* * Decompilation error * Code may be obfuscated * Tip: You can try enabling "Automatic deobfuscation" in Settings * Error type: IndexOutOfBoundsException (Index: 4, Size: 4) */ throw new flash.errors.IllegalOperationError("Not decompiled due to error"); } } }
package kabam.rotmg.assets { import mx.core.BitmapAsset; [Embed(source="EmbeddedAssets_mountainTempleChars16x16Embed_.png")] public class EmbeddedAssets_mountainTempleChars16x16Embed_ extends BitmapAsset { public function EmbeddedAssets_mountainTempleChars16x16Embed_() { super(); } } }
package com.ankamagames.dofus.internalDatacenter.mount { import com.ankamagames.dofus.datacenter.mounts.Mount; import com.ankamagames.dofus.datacenter.mounts.MountBehavior; import com.ankamagames.dofus.datacenter.mounts.MountFamily; import com.ankamagames.dofus.misc.ObjectEffectAdapter; import com.ankamagames.dofus.network.types.game.mount.MountClientData; import com.ankamagames.jerakine.data.I18n; import com.ankamagames.jerakine.interfaces.IDataCenter; import com.ankamagames.tiphon.types.look.TiphonEntityLook; import flash.utils.Dictionary; public class MountData implements IDataCenter { private static var _dictionary_cache:Dictionary = new Dictionary(); public var id:Number = 0; public var modelId:uint = 0; public var name:String = ""; public var description:String = ""; public var entityLook:TiphonEntityLook; public var colors:Array; public var sex:Boolean = false; public var level:uint = 0; public var ownerId:Number = 0; public var experience:Number = 0; public var experienceForLevel:Number = 0; public var experienceForNextLevel:Number = 0; public var xpRatio:uint; public var maxPods:uint = 0; public var isRideable:Boolean = false; public var isWild:Boolean = false; public var borning:Boolean = false; public var energy:uint = 0; public var energyMax:uint = 0; public var stamina:uint = 0; public var staminaMax:uint = 0; public var maturity:uint = 0; public var maturityForAdult:uint = 0; public var serenity:int = 0; public var serenityMax:uint = 0; public var aggressivityMax:int = 0; public var love:uint = 0; public var loveMax:uint = 0; public var fecondationTime:int = 0; public var isFecondationReady:Boolean; public var reproductionCount:int = 0; public var reproductionCountMax:uint = 0; public var boostLimiter:uint = 0; public var boostMax:Number = 0; public var harnessGID:uint = 0; public var useHarnessColors:Boolean; public var effectList:Array; public var ancestor:Object; public var ability:Array; private var _model:Mount; private var _familyHeadUri:String; public function MountData() { this.effectList = new Array(); this.ability = new Array(); super(); } public static function makeMountData(o:MountClientData, cache:Boolean = true, xpRatio:uint = 0) : MountData { var ability:uint = 0; var nEffect:int = 0; var i:int = 0; var mountData:MountData = new MountData(); if(_dictionary_cache[o.id] && cache) { mountData = getMountFromCache(o.id); } var mount:Mount = Mount.getMountById(o.model); if(!o.name) { mountData.name = I18n.getUiText("ui.common.noName"); } else { mountData.name = o.name; } mountData.id = o.id; mountData.modelId = o.model; mountData.description = mount.name; mountData.sex = o.sex; mountData.ownerId = o.ownerId; mountData.level = o.level; mountData.experience = o.experience; mountData.experienceForLevel = o.experienceForLevel; mountData.experienceForNextLevel = o.experienceForNextLevel; mountData.xpRatio = xpRatio; try { mountData.entityLook = TiphonEntityLook.fromString(mount.look); mountData.colors = mountData.entityLook.getColors(); } catch(e:Error) { } var a:Vector.<uint> = o.ancestor.concat(); a.unshift(o.model); mountData.ancestor = makeParent(a,0,-1,0); mountData.ability = new Array(); for each(ability in o.behaviors) { mountData.ability.push(MountBehavior.getMountBehaviorById(ability)); } mountData.effectList = new Array(); nEffect = o.effectList.length; for(i = 0; i < nEffect; i++) { mountData.effectList.push(ObjectEffectAdapter.fromNetwork(o.effectList[i])); } mountData.maxPods = o.maxPods; mountData.isRideable = o.isRideable; mountData.isWild = o.isWild; mountData.energy = o.energy; mountData.energyMax = o.energyMax; mountData.stamina = o.stamina; mountData.staminaMax = o.staminaMax; mountData.maturity = o.maturity; mountData.maturityForAdult = o.maturityForAdult; mountData.serenity = o.serenity; mountData.serenityMax = o.serenityMax; mountData.aggressivityMax = o.aggressivityMax; mountData.love = o.love; mountData.loveMax = o.loveMax; mountData.fecondationTime = o.fecondationTime; mountData.isFecondationReady = o.isFecondationReady; mountData.reproductionCount = o.reproductionCount; mountData.reproductionCountMax = o.reproductionCountMax; mountData.boostLimiter = o.boostLimiter; mountData.boostMax = o.boostMax; mountData.harnessGID = o.harnessGID; mountData.useHarnessColors = o.useHarnessColors; if(!_dictionary_cache[o.id] || !cache) { _dictionary_cache[mountData.id] = mountData; } return mountData; } public static function getMountFromCache(id:uint) : MountData { return _dictionary_cache[id]; } private static function makeParent(ancestor:Vector.<uint>, generation:uint, start:int, index:uint) : Object { var nextStart:uint = start + Math.pow(2,generation - 1); var ancestorIndex:uint = nextStart + index; if(ancestor.length <= ancestorIndex) { return null; } var mount:Mount = Mount.getMountById(ancestor[ancestorIndex]); if(!mount) { return null; } return { "mount":mount, "mother":makeParent(ancestor,generation + 1,nextStart,0 + 2 * (ancestorIndex - nextStart)), "father":makeParent(ancestor,generation + 1,nextStart,1 + 2 * (ancestorIndex - nextStart)), "entityLook":TiphonEntityLook.fromString(mount.look) }; } public function get model() : Mount { if(!this._model) { this._model = Mount.getMountById(this.modelId); } return this._model; } public function get familyHeadUri() : String { var family:MountFamily = null; if(!this._familyHeadUri) { family = MountFamily.getMountFamilyById(this.model.familyId); this._familyHeadUri = family.headUri; } return this._familyHeadUri; } } }
/* as3isolib - An open-source ActionScript 3.0 Isometric Library developed to assist in creating isometrically projected content (such as games and graphics) targeted for the Flash player platform http://code.google.com/p/as3isolib/ Copyright (c) 2006 - 3000 J.W.Opitz, All Rights Reserved. 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 as3isolib.events { import flash.events.Event; /** * The IsoEvent class represents the event object passed to the listener for various isometric display events. */ public class IsoEvent extends Event { ///////////////////////////////////////////////////////////// // CONST ///////////////////////////////////////////////////////////// /** * The IsoEvent.INVALIDATE constant defines the value of the type property of the event object for an iso event. */ static public const INVALIDATE:String = "as3isolib_invalidate"; /** * The IsoEvent.RENDER constant defines the value of the type property of the event object for an iso event. */ static public const RENDER:String = "as3isolib_render"; /** * The IsoEvent.RENDER_COMPLETE constant defines the value of the type property of the event object for an iso event. */ static public const RENDER_COMPLETE:String = "as3isolib_renderComplete"; /** * The IsoEvent.MOVE constant defines the value of the type property of the event object for an iso event. */ static public const MOVE:String = "as3isolib_move"; /** * The IsoEvent.RESIZE constant defines the value of the type property of the event object for an iso event. */ static public const RESIZE:String = "as3isolib_resize"; /** * The IsoEvent.CHILD_ADDED constant defines the value of the type property of the event object for an iso event. */ static public const CHILD_ADDED:String = "as3isolib_childAdded"; /** * The IsoEvent.CHILD_REMOVED constant defines the value of the type property of the event object for an iso event. */ static public const CHILD_REMOVED:String = "as3isolib_childRemoved"; ///////////////////////////////////////////////////////////// // DATA ///////////////////////////////////////////////////////////// /** * Specifies the property name of the property values assigned in oldValue and newValue. */ public var propName:String; /** * Specifies the previous value assigned to the property specified in propName. */ public var oldValue:Object; /** * Specifies the new value assigned to the property specified in propName. */ public var newValue:Object; /** * Constructor */ public function IsoEvent (type:String, bubbles:Boolean = false, cancelable:Boolean = false) { super(type, bubbles, cancelable); } /** * @inheritDoc */ override public function clone ():Event { var evt:IsoEvent = new IsoEvent(type, bubbles, cancelable); evt.propName = propName; evt.oldValue = oldValue; evt.newValue = newValue; return evt; } } }
package a24.util { import flash.geom.Rectangle; public final class GraphicsUtil24 { public function GraphicsUtil24() { super(); } public function drawRectHitArea(param1:Object, param2:Object = null, param3:Boolean = false) : void { if(!param2) { param2 = param1; } param1.graphics.clear(); var _loc4_:Rectangle = param2.getRect(param2); param1.graphics.beginFill(65535,!!param3?0.5:0); param1.graphics.drawRect(_loc4_.x,_loc4_.y,_loc4_.width,_loc4_.height); } public function drawCircleHitArea(param1:Object, param2:Object = null, param3:Boolean = false) : void { if(!param2) { param2 = param1; } param1.graphics.clear(); var _loc4_:Rectangle = param2.getRect(param2); param1.graphics.beginFill(65535,!!param3?0.5:0); param1.graphics.drawCircle(_loc4_.x + _loc4_.width / 2,_loc4_.y + _loc4_.height / 2,_loc4_.width / 2); } } }
package cmodule.lua_wrapper { const __2E_str1208:int = gstaticInitter.alloc(6,1); }
/* * hexagonlib - Multi-Purpose ActionScript 3 Library. * __ __ * __/ \__/ \__ __ * / \__/HEXAGON \__/ \ * \__/ \__/ LIBRARY _/ * \__/ \__/ * * Licensed under the MIT License * * Copyright (c) 2007-2008 Sascha Balkau / Hexagon Star Softworks * * 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.view.ui.event { import flash.events.Event; /** * The ListEvent class defines events for list-based components including the List, * DataGrid, TileList, and ComboBox components. These events include the following: <ul> * <li><code>ListEvent.ITEM_CLICK</code>: dispatched after the user clicks the mouse * over an item in the component.</li> <li><code>ListEvent.ITEM_DOUBLE_CLICK</code>: * dispatched after the user clicks the mouse twice in rapid succession over an item in * the component.</li> <li><code>ListEvent.ITEM_ROLL_OUT</code>: dispatched after the * user rolls the mouse pointer out of an item in the component.</li> <li><code> * ListEvent.ITEM_ROLL_OVER</code>: dispatched after the user rolls the mouse pointer * over an item in the component.</li> </ul> * * @see fl.controls.List List * @see fl.controls.SelectableList SelectableList */ public class UIListEvent extends Event { //////////////////////////////////////////////////////////////////////////////////////// // Constants // //////////////////////////////////////////////////////////////////////////////////////// /** * Defines the value of the <code>type</code> property of an <code>itemRollOut</code> * event object. <p> This event has the following properties: </p> <table * class="innertable" width="100%"> <tr> <th>Property</th> <th>Value</th> </tr> <tr> * <td><code>bubbles</code></td> <td><code>false</code></td> </tr> <tr> * <td><code>cancelable</code></td> <td><code>false</code>; there is no default behavior * to cancel.</td> </tr> <tr> <td><code>columnIndex</code></td> <td>The zero-based index * of the column that contains the renderer.</td> </tr> <tr> <td><code>currentTarget * </code></td> <td>The object that is actively processing the event object with an * event listener.</td> </tr> <tr> <td><code>index</code></td> <td>The zero-based index * in the DataProvider that contains the renderer.</td> </tr> <tr> * <td><code>item</code></td> <td>A reference to the data that belongs to the * renderer.</td> </tr> <tr> <td><code>rowIndex</code></td> <td>The zero-based index of * the row that contains the renderer.</td> </tr> <tr> <td><code>target</code></td> * <td>The object that dispatched the event. The target is not always the object * listening for the event. Use the <code>currentTarget</code> property to access the * object that is listening for the event.</td> </tr> </table> * * @eventType itemRollOut * @see #ITEM_ROLL_OVER */ public static const ITEM_ROLL_OUT:String = "itemRollOut"; /** * Defines the value of the <code>type</code> property of an * <code>itemRollOver</code> event object. <p>This event has the following * properties:</p> <table class="innertable" width="100%"> * <tr><th>Property</th><th>Value</th></tr> * <tr><td><code>bubbles</code></td><td><code>false</code></td></tr> * <tr><td><code>cancelable</code></td><td><code>false</code>; there is no default * behavior to cancel.</td></tr> <tr><td><code>columnIndex</code></td><td>The * zero-based index of the column that contains the renderer.</td></tr> * <tr><td><code>currentTarget</code></td><td>The object that is actively processing * the event object with an event listener.</td></tr> * <tr><td><code>index</code></td><td>The zero-based index in the DataProvider that * contains the renderer.</td></tr> <tr><td><code>item</code></td><td>A reference to * the data that belongs to the renderer.</td></tr> * <tr><td><code>rowIndex</code></td><td>The zero-based index of the row that * contains the renderer.</td></tr> <tr><td><code>target</code></td><td>The object * that dispatched the event. The target is not always the object listening for the * event. Use the <code>currentTarget</code> property to access the object that is * listening for the event.</td></tr> </table> * * @eventType itemRollOver * @see #ITEM_ROLL_OUT */ public static const ITEM_ROLL_OVER:String = "itemRollOver"; /** * Defines the value of the <code>type</code> property of an <code>itemClick</code> * event object. <p>This event has the following properties:</p> <table * class="innertable" width="100%"> <tr><th>Property</th><th>Value</th></tr> * <tr><td><code>bubbles</code></td><td><code>false</code></td></tr> * <tr><td><code>cancelable</code></td><td><code>true</code></td></tr> * <tr><td><code>columnIndex</code></td><td>The zero-based index of the column that * contains the renderer.</td></tr> <tr><td><code>currentTarget</code></td><td>The * object that is actively processing the event object with an event * listener.</td></tr> <tr><td><code>index</code></td><td>The zero-based index in * the DataProvider that contains the renderer.</td></tr> * <tr><td><code>item</code></td><td>A reference to the data that belongs to the * renderer. </td></tr> <tr><td><code>rowIndex</code></td><td>The zero-based index * of the row that contains the renderer.</td></tr> * <tr><td><code>target</code></td><td>The object that dispatched the event. The * target is not always the object listening for the event. Use the * <code>currentTarget</code> property to access the object that is listening for * the event.</td></tr> </table> * * @eventType itemClick */ public static const ITEM_CLICK:String = "itemClick"; /** * Defines the value of the <code>type</code> property of an * <code>itemDoubleClick</code> event object. <p>This event has the following * properties:</p> <table class="innertable" width="100%"> * <tr><th>Property</th><th>Value</th></tr> * <tr><td><code>bubbles</code></td><td><code>false</code></td></tr> * <tr><td><code>cancelable</code></td><td><code>true</code></td></tr> * <tr><td><code>columnIndex</code></td><td>The zero-based index of the column that * contains the renderer.</td></tr> <tr><td><code>currentTarget</code></td><td>The * object that is actively processing the event object with an event * listener.</td></tr> <tr><td><code>index</code></td><td>The zero-based index in * the DataProvider that contains the renderer.</td></tr> * <tr><td><code>item</code></td><td>A reference to the data that belongs to the * renderer. </td></tr> <tr><td><code>rowIndex</code></td><td>The zero-based index * of the row that contains the renderer.</td></tr> * <tr><td><code>target</code></td><td>The object that dispatched the event. The * target is not always the object listening for the event. Use the * <code>currentTarget</code> property to access the object that is listening for * the event.</td></tr> </table> * * @eventType itemDoubleClick */ public static const ITEM_DOUBLE_CLICK:String = "itemDoubleClick"; //////////////////////////////////////////////////////////////////////////////////////// // Properties // //////////////////////////////////////////////////////////////////////////////////////// protected var _rowIndex:int; protected var _columnIndex:int; protected var _index:int; protected var _item:Object; //////////////////////////////////////////////////////////////////////////////////////// // Public Methods // //////////////////////////////////////////////////////////////////////////////////////// /** * Creates a new ListEvent object with the specified parameters. * * @param type The event type; this value identifies the action that caused the * event. * @param bubbles Indicates whether the event can bubble up the display list * hierarchy. * @param cancelable Indicates whether the behavior associated with the event can be * prevented. * @param columnIndex The zero-based index of the column that contains the renderer * or visual representation of the data in the column. * @param rowIndex The zero-based index of the row that contains the renderer or * visual representation of the data in the row. * @param index The zero-based index of the item in the DataProvider. * @param item A reference to the data that belongs to the renderer. */ public function UIListEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, columnIndex:int = -1, rowIndex:int = -1, index:int = -1, item:Object = null) { super(type, bubbles, cancelable); _rowIndex = rowIndex; _columnIndex = columnIndex; _index = index; _item = item; } /** * Creates a copy of the ListEvent object and sets the value of each parameter to * match the original. * * @return A new ListEvent object with parameter values that match those of the * original. */ override public function clone():Event { return new UIListEvent(type, bubbles, cancelable, _columnIndex, _rowIndex); } /** * Returns a string that contains all the properties of the ListEvent object. The * string is in the following format: <p>[<code>ListEvent type=<em>value</em> * bubbles=<em>value</em> cancelable=<em>value</em> columnIndex=<em>value</em> * rowIndex=<em>value</em></code>]</p> * * @return A string representation of the ListEvent object. */ override public function toString():String { return formatToString("ListEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "index", "item"); } //////////////////////////////////////////////////////////////////////////////////////// // Getters & Setters // //////////////////////////////////////////////////////////////////////////////////////// /** * Gets the row index of the item that is associated with this event. * * @see #columnIndex */ public function get rowIndex():Object { return _rowIndex; } /** * Gets the column index of the item that is associated with this event. * * @see #rowIndex */ public function get columnIndex():int { return _columnIndex; } /** * Gets the zero-based index of the cell that contains the renderer. */ public function get index():int { return _index; } /** * Gets the data that belongs to the current cell renderer. */ public function get item():Object { return _item; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.charts.chartClasses { import flash.events.Event; import flash.events.EventDispatcher; import mx.charts.LinearAxis; import mx.core.mx_internal; import mx.events.FlexEvent; use namespace mx_internal; //-------------------------------------- // Events //-------------------------------------- /** * Dispatched when the transformation from data space to screen space * has changed, typically either because the axes that make up * the transformation have changed in some way, * or the data transform itself has size. * * @eventType mx.events.FlexEvent.TRANSFORM_CHANGE * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ [Event(name="transformChange", type="mx.events.FlexEvent")] /** * The DataTransform object represents a portion of a chart * that contains glyphs and can transform values * to screen coordinates and vice versa. * Each DataTransform object has a horizontal axis, a vertical axis, * and a set of glyphs (background, data, and overlay) to render. * * <p>In theory, a chart can contain multiple overlaid DataTransform objects. * This allows you to display a chart with multiple data sets * rendered in the same area but with different ranges. * For example, you might want to show monthly revenues * compared to the number of units sold. * If revenue was typically in millions while units was typically * in the thousands, it would be difficult to render these effectively * along the same range. * Overlaying them in different DataTransform objects allows * the end user to compare trends in the values * when they are rendered with different ranges.</p> * * <p>Charts can only contain one set of DataTransform.</p> * * <p>Most of the time, you will use the ChartBase object, * which hides the existance of the DataTransform object * between the chart and its contained glyphs and axis objects. * If you create your own ChartElement objects, you must understand * the methods of the DataTransform class to correctly implement their element.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class DataTransform extends EventDispatcher { include "../../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function DataTransform() { super(); } //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // axes //---------------------------------- /** * @private * Storage for the axes property. */ private var _axes:Object = {}; [Inspectable(environment="none")] /** * The set of axes associated with this transform. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get axes():Object { return _axes; } //---------------------------------- // elements //---------------------------------- /** * @private */ private var _elements:Array /* of ChartElement */ = []; [Inspectable(environment="none")] /** * The elements that are associated with this transform. * This Array includes background, series, and overlay elements * associated with the transform. * This value is assigned by the enclosing chart object. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get elements():Array /* of ChartElement */ { return _elements; } /** * @private */ public function set elements(value:Array /* of ChartElement */):void { _elements = value; } //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * Maps a set of numeric values representing data to screen coordinates. * This method assumes the values are all numbers, * so any non-numeric values must have been previously converted * with the <code>mapCache()</code> method. * * @param cache An array of objects containing the data values * in their fields. This is also where this function * will store the converted numeric values. * * @param xField The field where the data values for the x axis * can be found. * * @param xConvertedField The field where the mapped x screen coordinate * will be stored. * * @param yField The field where the data values for the y axis * can be found. * * @param yConvertedField The field where the mapped y screen coordinate * will be stored. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function transformCache(cache:Array /* of Object */, xField:String, xConvertedField:String, yField:String, yConvertedField:String):void { } /** * Transforms x and y coordinates relative to the DataTransform * coordinate system into a two-dimensional value in data space. * * @param ...values The x and y positions (in that order). * * @return An Array containing the transformed values. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function invertTransform(...values):Array { return null; } /** * Informs the DataTransform that some of the underlying data * being represented on the chart has changed. * The DataTransform generally has no knowledge of the source * of the underlying data being represented by the chart, * so glyphs should call this when their data changes * so that the DataTransform can recalculate range scales * based on their data. * This does <b>not</b> invalidate the DataTransform, * because there is no guarantee the data has changed. * The axis objects (or range objects) must trigger an invalidate event. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function dataChanged():void { for (var p:String in _axes) { if (_axes[p]) _axes[p].dataChanged(); } } /** * Collects important displayed values for all elements * associated with this data transform. * Axis instances call this method to collect the values * they need to consider when auto-generating appropriate ranges. * This method returns an Array of BoundedValue objects. * * <p>To collect important values for the horizontal axis * of a CartesianTransform, pass 0. * To collect values for the vertical axis, pass 1.</p> * * @param dimension The dimension to collect values for. * * @param requiredFields Defines the data that are required * by this transform. * * @return A Array of BoundedValue objects. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function describeData(dimension:String, requiredFields:uint):Array /* of BoundedValue */ { var results:Array /* of BoundedValue */ = []; var n:int = elements.length; for (var i:int = 0; i < n; i++) { var dataGlyph:IChartElement = (elements[i] as IChartElement); if (!dataGlyph) continue; results = results.concat( dataGlyph.describeData(dimension, requiredFields)); } return results; } /** * Retrieves the axis instance responsible for transforming * the data dimension specified by the <code>dimension</code> parameter. * If no axis has been previously assigned, a default axis is created. * The default axis for all dimensions is a LinearAxis * with the <code>autoAdjust</code> property set to <code>false</code>. * * @param dimension The dimension whose axis is responsible * for transforming the data. * * @return The axis instance. * * @see mx.charts.LinearAxis * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function getAxis(dimension:String):IAxis { if (!(_axes[dimension])) { var newAxis:LinearAxis = new LinearAxis(); newAxis.autoAdjust = false; setAxisNoEvent(dimension,newAxis); } return _axes[dimension]; } /** * Assigns an axis instance to a particular dimension of the transform. * Axis objects are assigned by the enclosing chart object. * * @param dimension The dimension of the transform. * @param v The target axis instance. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function setAxis(dimension:String, v:IAxis):void { if(setAxisNoEvent(dimension, v)) mappingChangeHandler(); } /** * @private */ private function setAxisNoEvent(dimension:String, v:IAxis):Boolean { var oldV:IAxis = _axes[dimension]; if(oldV != v) { if (oldV) { oldV.unregisterDataTransform(this); oldV.removeEventListener("mappingChange", mappingChangeHandler); } _axes[dimension] = v; { v.registerDataTransform(this, dimension); v.addEventListener("mappingChange", mappingChangeHandler, false, 0, true); } return true; } return false; } //-------------------------------------------------------------------------- // // Event handlers // //-------------------------------------------------------------------------- /** * @private */ private function mappingChangeHandler(event:Event = null):void { var n:int = elements.length; for (var i:int = 0; i < n; i++) { var g:IChartElement = elements[i] as IChartElement; if (g) g.mappingChanged(); } } } }
/* ***** 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) 2004-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 ***** */ package PublicClass { import PublicClass.*; class ExtPublicClassFinInner extends PublicClass { // ************************************ // access final method of parent // from default method of sub class // ************************************ function subGetArray() : Array { return this.getFinArray(); } function subSetArray(a:Array) { this.setFinArray(a); } public function testSubGetArray(arr:Array):Array { this.subSetArray(arr); return subGetArray(); } // ************************************ // access final method of parent // from public method of sub class // ************************************ public function pubSubGetArray() : Array { return this.getFinArray(); } public function pubSubSetArray(a:Array) { this.setFinArray(a); } // ************************************ // access final method of parent // from private method of sub class // ************************************ private function privSubGetArray() : Array { return this.getFinArray(); } private function privSubSetArray(a:Array) { this.setFinArray(a); } // function to test above from test scripts public function testPrivSubArray(a:Array) : Array { this.privSubSetArray(a); return this.privSubGetArray(); } // ************************************ // access final method of parent // from final method of sub class // ************************************ final function finSubGetArray() : Array { return this.getFinArray(); } final function finSubSetArray(a:Array) { this.setFinArray(a); } public function testFinSubArray(a:Array):Array { this.finSubSetArray(a); return this.finSubGetArray(); } // *************************************** // access final method from public static method // of the sub class // *************************************** public static function pubStatSubGetArray():Array { return getFinArray(); } // *************************************** // access final property from // default method of sub class // *************************************** function subGetDPArray() : Array { return finArray; } function subSetDPArray(a:Array) { finArray = a; } public function testSubDPArray(a:Array):Array { this.subSetDPArray(a); return this.subGetDPArray(); } // *************************************** // access final property from // public method of sub class // *************************************** public function pubSubGetDPArray() : Array { return this.finArray; } public function pubSubSetDPArray(a:Array) { this.finArray = a; } // *************************************** // access final property from // private method of sub class // *************************************** private function privSubGetDPArray() : Array { return this.finArray; } private function privSubSetDPArray(a:Array) { this.finArray = a; } // *************************************** // access final property from // final method of sub class // *************************************** public final function finSubGetDPArray() : Array { return pubFinArray; } public final function finSubSetDPArray(a:Array) { pubFinArray = a; } // access final property from public static method public static function pubStatSubGetFPArray():Array { return finArray; } } public class ExtPublicClassFin extends ExtPublicClassFinInner {} }
package com.ek.duckstazy.game.base { /** * @author eliasku */ public class ActorMask { public static const ALL:uint = 0xffffffff; public static const DEFAULT:uint = 0x1; public static const PLAYER:uint = 0x2; public static const BLOCK:uint = 0x4; public static const PICKABLE:uint = 0x8; } }
package qihoo.triplecleangame.protos { import com.netease.protobuf.*; import com.netease.protobuf.fieldDescriptors.*; import flash.utils.Endian; import flash.utils.IDataInput; import flash.utils.IDataOutput; import flash.utils.IExternalizable; import flash.errors.IOError; // @@protoc_insertion_point(imports) // @@protoc_insertion_point(class_metadata) public dynamic final class PBRequestInfo extends com.netease.protobuf.Message { public static const QID:FieldDescriptor$TYPE_UINT64 = new FieldDescriptor$TYPE_UINT64("qihoo.triplecleangame.protos.PBRequestInfo.qid", "qid", (1 << 3) | com.netease.protobuf.WireType.VARINT); private var qid$field:UInt64; public function clearQid():void { qid$field = null; } public function get hasQid():Boolean { return qid$field != null; } public function set qid(value:UInt64):void { qid$field = value; } public function get qid():UInt64 { return qid$field; } public static const ITEMID:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("qihoo.triplecleangame.protos.PBRequestInfo.itemID", "itemID", (2 << 3) | com.netease.protobuf.WireType.VARINT); private var itemID$field:int; private var hasField$0:uint = 0; public function clearItemID():void { hasField$0 &= 0xfffffffe; itemID$field = new int(); } public function get hasItemID():Boolean { return (hasField$0 & 0x1) != 0; } public function set itemID(value:int):void { hasField$0 |= 0x1; itemID$field = value; } public function get itemID():int { return itemID$field; } public static const ITEMNUM:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("qihoo.triplecleangame.protos.PBRequestInfo.itemNum", "itemNum", (3 << 3) | com.netease.protobuf.WireType.VARINT); private var itemNum$field:int; public function clearItemNum():void { hasField$0 &= 0xfffffffd; itemNum$field = new int(); } public function get hasItemNum():Boolean { return (hasField$0 & 0x2) != 0; } public function set itemNum(value:int):void { hasField$0 |= 0x2; itemNum$field = value; } public function get itemNum():int { return itemNum$field; } /** * @private */ override public final function writeToBuffer(output:com.netease.protobuf.WritingBuffer):void { if (hasQid) { com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 1); com.netease.protobuf.WriteUtils.write$TYPE_UINT64(output, qid$field); } if (hasItemID) { com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 2); com.netease.protobuf.WriteUtils.write$TYPE_INT32(output, itemID$field); } if (hasItemNum) { com.netease.protobuf.WriteUtils.writeTag(output, com.netease.protobuf.WireType.VARINT, 3); com.netease.protobuf.WriteUtils.write$TYPE_INT32(output, itemNum$field); } for (var fieldKey:* in this) { super.writeUnknown(output, fieldKey); } } /** * @private */ override public final function readFromSlice(input:flash.utils.IDataInput, bytesAfterSlice:uint):void { var qid$count:uint = 0; var itemID$count:uint = 0; var itemNum$count:uint = 0; while (input.bytesAvailable > bytesAfterSlice) { var tag:uint = com.netease.protobuf.ReadUtils.read$TYPE_UINT32(input); switch (tag >> 3) { case 1: if (qid$count != 0) { throw new flash.errors.IOError('Bad data format: PBRequestInfo.qid cannot be set twice.'); } ++qid$count; this.qid = com.netease.protobuf.ReadUtils.read$TYPE_UINT64(input); break; case 2: if (itemID$count != 0) { throw new flash.errors.IOError('Bad data format: PBRequestInfo.itemID cannot be set twice.'); } ++itemID$count; this.itemID = com.netease.protobuf.ReadUtils.read$TYPE_INT32(input); break; case 3: if (itemNum$count != 0) { throw new flash.errors.IOError('Bad data format: PBRequestInfo.itemNum cannot be set twice.'); } ++itemNum$count; this.itemNum = com.netease.protobuf.ReadUtils.read$TYPE_INT32(input); break; default: super.readUnknown(input, tag); break; } } } } }
// Action script... // [Initial MovieClip Action of sprite 20565] #initclip 86 if (!ank.battlefield.SelectionHandler) { if (!ank) { _global.ank = new Object(); } // end if if (!ank.battlefield) { _global.ank.battlefield = new Object(); } // end if var _loc1 = (_global.ank.battlefield.SelectionHandler = function (b, c, d) { this.initialize(b, c, d); }).prototype; _loc1.initialize = function (b, c, d) { this._mcBattlefield = b; this._oDatacenter = d; this._mcContainer = c; this.clear(); }; _loc1.clear = function (Void) { for (var k in this._mcContainer.Select) { var _loc3 = this._mcContainer.Select[k]; if (_loc3 != undefined) { var _loc4 = _loc3.inObjectClips; for (var l in _loc4) { _loc4[l].removeMovieClip(); } // end of for...in } // end if _loc3.removeMovieClip(); } // end of for...in }; _loc1.clearLayer = function (sLayer) { if (sLayer == undefined) { sLayer = "default"; } // end if var _loc3 = this._mcContainer.Select[sLayer]; if (_loc3 != undefined) { var _loc4 = _loc3.inObjectClips; for (var k in _loc4) { _loc4[k].removeMovieClip(); } // end of for...in } // end if _loc3.removeMovieClip(); }; _loc1.select = function (bSelected, nCellNum, nColor, sLayer, nAlpha) { var _loc7 = this._mcBattlefield.mapHandler.getCellData(nCellNum); if (sLayer == undefined) { sLayer = "default"; } // end if var _loc8 = this._mcContainer.Select[sLayer]; if (_loc8 == undefined) { _loc8 = this._mcContainer.Select.createEmptyMovieClip(sLayer, this._mcContainer.Select.getNextHighestDepth()); _loc8.inObjectClips = new Array(); } // end if if (_loc7 != undefined && _loc7.x != undefined) { var _loc9 = _loc7.movement > 1 && _loc7.layerObject2Num != 0; var _loc10 = "cell" + String(nCellNum); if (bSelected) { if (_loc9) { var _loc12 = this._mcContainer.Object2["select" + nCellNum]; if (_loc12 == undefined) { _loc12 = this._mcContainer.Object2.createEmptyMovieClip("select" + nCellNum, nCellNum * 100 + 2); } // end if var _loc11 = _loc12[sLayer]; if (_loc11 == undefined) { _loc11 = _loc12.attachMovie("s" + _loc7.groundSlope, sLayer, _loc12.getNextHighestDepth()); } // end if _loc8.inObjectClips.push(_loc11); } else { _loc11 = _loc8.attachMovie("s" + _loc7.groundSlope, _loc10, nCellNum * 100); } // end else if _loc11._x = _loc7.x; _loc11._y = _loc7.y; var _loc13 = new Color(_loc11); _loc13.setRGB(Number(nColor)); _loc11._alpha = nAlpha != undefined ? (nAlpha) : (100); } else if (_loc9) { this._mcContainer.Object2["select" + nCellNum][sLayer].unloadMovie(); this._mcContainer.Object2["select" + nCellNum][sLayer].removeMovieClip(); } else { _loc8[_loc10].unloadMovie(); _loc8[_loc10].removeMovieClip(); } // end else if } // end else if }; _loc1.selectMultiple = function (bSelect, aCellList, nColor, sLayer, nAlpha) { for (var i in aCellList) { this.select(bSelect, aCellList[i], nColor, sLayer, nAlpha); } // end of for...in }; _loc1.getLayers = function () { var _loc2 = new Array(); for (var k in this._mcContainer.Select) { var _loc3 = this._mcContainer.Select[k]; if (_loc3 != undefined) { _loc2.push(_loc3._name); } // end if } // end of for...in return (_loc2); }; ASSetPropFlags(_loc1, null, 1); } // end if #endinitclip
_root._quality = "Best"; _global.myLoadVars = new LoadVars(); this.createEmptyMovieClip("my_rectangle_mc", 10); my_rectangle_mc._x = 280; my_rectangle_mc._y = 70; scrollSize.setScrollProperties(5, 40, 80); scrollSize.setScrollPosition(80); scrollScaleX.setScrollProperties(5, 0, 200); scrollScaleX.setScrollPosition(150); scrollScaleY.setScrollProperties(5, 0, 200); scrollScaleY.setScrollPosition(150); scrollRadius.setScrollProperties(5, 0, 40); scrollRadius.setScrollPosition(0); scrollRotation.setScrollProperties(5, 0, 90); scrollRotation.setScrollPosition(90); scrollRed.setScrollProperties(5, 0, 255); scrollRed.setScrollPosition(128); scrollGreen.setScrollProperties(5, 0, 255); scrollGreen.setScrollPosition(128); scrollBlue.setScrollProperties(5, 0, 255); scrollBlue.setScrollPosition(128); scrollAlpha.setScrollProperties(5, 0, 100); scrollAlpha.setScrollPosition(100); my_rectangle_mc.boxWidth = 80; my_rectangle_mc.boxHeight = 80; my_rectangle_mc.cornerRadius = 0; my_rectangle_mc.lineHeight = 4; my_rectangle_mc.lineColor = 0x999999; my_rectangle_mc.lineAlpha = 100; my_rectangle_mc.fillColor = 0x999999; my_rectangle.mc.fillAlpha = 100; my_rectangle_mc.onEnterFrame = function () { this.clear(); this._xscale = _root.scrollScaleX.getScrollPosition()+1; this._yscale = _root.scrollScaleY.getScrollPosition()+1; this.boxWidth = _root.scrollSize.getScrollPosition()+40; this.boxHeight = _root.scrollSize.getScrollPosition()+40; this.cornerRadius = _root.scrollRadius.getScrollPosition(); this._rotation = _root.scrollRotation.getScrollPosition(); this.r = _root.scrollRed.getScrollPosition(); this.g = _root.scrollGreen.getScrollPosition(); this.b = _root.scrollBlue.getScrollPosition(); this.fillColor = (this.r* 0x10000) | (this.g * 0x100) | (this.b); this.lineColor = (this.r* 0x10000) | (this.g * 0x100) | (this.b); this.fillAlpha = _root.scrollAlpha.getScrollPosition()+5; this.lineAlpha = _root.scrollAlpha.getScrollPosition()+5; _global.myLoadVars.xscale = this._xscale; _global.myLoadVars.yscale = this._yscale; _global.myLoadVars.boxWidth = this.boxWidth; _global.myLoadVars.boxHeight = this.boxHeight; _global.myLoadVars.cornerRadius = this.cornerRadius; _global.myLoadVars.rotation = this._rotation; _global.myLoadVars.r = this.r; _global.myLoadVars.g = this.g; _global.myLoadVars.b = this.b; _global.myLoadVars.fillColor = this.fillColor; _global.myLoadVars.lineColor = this.lineColor; _global.myLoadVars.fillAlpha = this.fillAlpha; _global.myLoadVars.lineAlpha = this.lineAlpha; this.beginFill(this.fillColor, this.fillAlpha); this.lineStyle(this.lineHeight, this.lineColor, this.lineAlpha); this.moveTo(this.cornerRadius, 0); this.lineTo(this.boxWidth - this.cornerRadius, 0); this.curveTo(this.boxWidth, 0, this.boxWidth, this.cornerRadius); this.lineTo(this.boxWidth, this.cornerRadius); this.lineTo(this.boxWidth, this.boxHeight - this.cornerRadius); this.curveTo(this.boxWidth, this.boxHeight, this.boxWidth - this.cornerRadius, this.boxHeight); this.lineTo(this.boxWidth - this.cornerRadius, this.boxHeight); this.lineTo(this.cornerRadius, this.boxHeight); this.curveTo(0, this.boxHeight, 0, this.boxHeight - this.cornerRadius); this.lineTo(0, this.boxHeight - this.cornerRadius); this.lineTo(0, this.cornerRadius); this.curveTo(0, 0, this.cornerRadius, 0); this.lineTo(this.cornerRadius, 0); this.endFill(); };
package com.gestureworks.cml.components { import com.gestureworks.cml.elements.*; import com.gestureworks.cml.events.*; import com.gestureworks.events.GWGestureEvent; import flash.display.DisplayObject; /** * The AlbumViewer component is primarily meant to display an Album element and its associated meta-data. * * <p>It is composed of the following: * <ul> * <li>album</li> * <li>front</li> * <li>back</li> * <li>menu</li> * <li>frame</li> * <li>background</li> * </ul></p> * * <p>The width and height of the component are automatically set to the dimensions of the Album element unless it is * previously specifed by the component.</p> * * <codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock "> * </codeblock> * * @author Shaun * @see Component * @see com.gestureworks.cml.elements.Album * @see com.gestureworks.cml.elements.TouchContainer */ public class AlbumViewer extends Component { /** * Constructor */ public function AlbumViewer() { super(); mouseChildren = true; addEventListener(StateEvent.CHANGE, albumComplete); addEventListener(GWGestureEvent.ROTATE, updateAngle); } /** * Initialization function */ override public function init():void { // automatically try to find elements based on AS3 class var albums:Array = searchChildren(Album, Array); if (!album && albums[0]) album = albums[0]; if (!front && album) front = album; if (!back && albums[1]) back = albums[1]; if (!pageButtons) pageButtons = searchChildren(RadioButtons); if (pageButtons) { RadioButtons(pageButtons).labels = ""; var t:Number = Album(album).belt.numChildren-1; //exclude background for (var i:Number = 0; i < t; i++) { if (i != t-1) RadioButtons(pageButtons).labels += Number(i).toString() + ","; else RadioButtons(pageButtons).labels += Number(i).toString(); } RadioButtons(pageButtons).init(); } if (album && searchChildren(RadioButtons)) { album.addEventListener(StateEvent.CHANGE, onStateEvent); } super.init(); } private var _album:*; /** * Sets the album element. * This can be set using a simple CSS selector (id or class) or directly to a display object. * Regardless of how this set, a corresponding display object is always returned. */ public function get album():* {return _album} public function set album(value:*):void { if (!value) return; if (value is DisplayObject) _album = value; else _album = searchChildren(value); } private var _pageButtons:*; /** * Sets the page buttons element. * This can be set using a simple CSS selector (id or class) or directly to a display object. * Regardless of how this set, a corresponding display object is always returned. */ public function get pageButtons():* { return _pageButtons; } public function set pageButtons(value:*):void { if (!value) return; if (value is DisplayObject) _pageButtons = value; else _pageButtons = searchChildren(value); } private var _linkAlbums:Boolean = false; /** * When the back is also an album, this flag indicates the actions applied to one album will be * applied to the other album. Both albums must have the same number of objects. */ public function get linkAlbums():Boolean { return _linkAlbums; } public function set linkAlbums(l:Boolean):void { _linkAlbums = l; } /** * Updates the angle of the album element */ override public function set rotation(value:Number):void { super.rotation = value; if (album) album.dragAngle = value; if (linkAlbums && back) back.dragAngle = value; } /** * Updates the angle of the album element */ override public function set rotationX(value:Number):void { super.rotationX = value; if (album) album.dragAngle = value; if (linkAlbums && back) back.dragAngle = value; } /** * Updates the angle of the album element */ override public function set rotationY(value:Number):void { super.rotationX = value; if (album) album.dragAngle = value; if (linkAlbums && back) back.dragAngle = value; } /** * Updates the angle of the album element */ private function updateAngle(e:GWGestureEvent):void { if (album) album.dragAngle = rotation; if (linkAlbums && back) back.dragAngle = rotation; } /** * Updates dimensions and other attributes */ override protected function updateLayout(event:*=null):void { // update width and height to the size of the album, if not already specified if (!width && album) width = album.width; if (!height && album) height = album.height; super.updateLayout(); } /** * Process AlbumViewer state events * @param event */ override protected function onStateEvent(event:StateEvent):void { if (event.property == "albumState") { var indices:RadioButtons = searchChildren(RadioButtons); if (indices) { indices.selectButton(Album(album).currentIndex.toString()); } } else if (event.value == "forward") { if (side == "back" && back is Album) back.next(); else album.next(); } else if (event.value == "back") { if (side == "back" && back is Album) back.previous(); else album.previous(); } else super.onStateEvent(event); } /** * If front and back albums can be linked, synchronize the back album properties with the front and * listen for state changes from each album. */ private function synchAlbums():void { linkAlbums = linkAlbums ? (back is Album) : false; if (linkAlbums) { if (album.belt.numChildren != back.belt.numChildren) throw new Error("Cannot link albums with different number of objects"); back.horizontal = album.horizontal; back.loop = album.loop; back.margin = album.margin; back.snapping = album.snapping; back.centerContent = album.centerContent; addEventListener(StateEvent.CHANGE, updateAlbums); } } /** * Each album reports its state changes (horizontal or vertical movement) to the viewer and the viewer updates the alternate album * with the changes. * @param e */ private function updateAlbums(e:StateEvent):void { if (e.property == "albumState" && e.value) { var link:Album = e.target == front ? back : front; link.updateState(e.value); } } /** * Updates the viewer when the album element is loaded * @param e */ private function albumComplete(e:StateEvent):void { if (e.property == "isLoaded" && e.value) { updateLayout(); e.target.dragAngle = rotation; if (e.target == back && linkAlbums) synchAlbums(); } } public function clear():void { width = 0; height = 0; } /** * @inheritDoc */ override public function dispose():void { super.dispose(); _album = null; _pageButtons = null; } } }
package com.does.lotte.object.maps { import com.does.lotte.abstract.MapObject; import com.does.lotte.interfaces.IMap; import com.does.lotte.types.KeyType; import flash.events.Event; /** * @author chaesumin */ public class Map1 extends MapObject implements IMap { public static const tx : int = 11; public static const ty : int = 3; public function Map1() { addEventListener(Event.ADDED_TO_STAGE, initAddStage); addEventListener(Event.REMOVED_FROM_STAGE, initRemoveStage); init(); } private function initAddStage(event : Event) : void { removeEventListener(Event.ADDED_TO_STAGE, initAddStage); start(); } private function initRemoveStage(event : Event) : void { removeEventListener(Event.REMOVED_FROM_STAGE, initRemoveStage); } private function init() : void { mapStr = ""; mapStr += "000000000000000000000000"; mapStr += "000000000000000000000000"; mapStr += "000000011111111110000000"; mapStr += "000000010010010010000000"; mapStr += "000000010010010010000000"; mapStr += "000011110010010010000000"; mapStr += "000010011111113111110000"; mapStr += "000010010001000010010000"; mapStr += "048111110001000010010000"; mapStr += "000010010001110010011140"; mapStr += "000010010001010010010000"; mapStr += "000010010001111111130000"; mapStr += "000031111111001001000000"; mapStr += "000000010001001001000000"; mapStr += "000000010001001001000000"; mapStr += "000000011111111111000000"; mapStr += "000000000000000000000000"; mapStr += "000000000000000000000000"; hGrid = 18; vGrid = 24; } private function start() : void { } override protected function teleport(ax : int, ay : int) : void { // if (ax == 1 && ay == 8 && char.getType() == KeyType.LEFT) { // char.setType(KeyType.LEFT); // char.setPosition(22, 9, 0); // } else if (ax == 22 && ay == 9 && char.getType() == KeyType.RIGHT) { // char.setType(KeyType.RIGHT); // char.setPosition(1, 8, 0); // } if (ax == 1 && ay == 8 && char.getType() == KeyType.DOWN) { char.setType(KeyType.DOWN); char.setPosition(22, 9, 0); } else if (ax == 22 && ay == 9 && char.getType() == KeyType.UP) { char.setType(KeyType.UP); char.setPosition(1, 8, 0); } } } }
package com.explodingRabbit.utils { import com.smbc.interfaces.ICustomTimer; import flash.events.TimerEvent; import flash.utils.Timer; public class CustomTimer extends Timer implements ICustomTimer { private var _startTime:Number; private var _initialDelay:Number; private var _paused:Boolean; private var _name:String; public function CustomTimer(delay:Number,repeatCount:int = 0,tmrName:String = null) { super(delay,repeatCount); _name = tmrName; _initialDelay = delay; addEventListener(TimerEvent.TIMER,onTimer,false,0,true); } private function onTimer(event:TimerEvent):void { _startTime = new Date().time; delay = _initialDelay; } // timer gets reset override public function start():void { if((currentCount < repeatCount) || (repeatCount == 0)) { delay = _initialDelay; // added to “reset” timer _paused = false; _startTime = new Date().time; super.start(); } } public function pause():void { if (running) { _paused = true; stop(); var newDelay:Number = delay - (new Date().time - _startTime); super.delay = (newDelay < 0) ? 0 : newDelay; } } // timer continues from where it left off public function resume():void { if(currentCount < repeatCount || repeatCount == 0) { _paused = false; _startTime = new Date().time; super.start(); } } override public function set delay(n:Number):void { super.delay = _initialDelay = n; } public function get name():String { return _name; } public function get paused():Boolean { return _paused; } public function get initialDelay():Number { return _initialDelay; } } }
package com.hurlant.crypto.hash { import flash.utils.*; public interface IHash { function toString():String; function getHashSize():uint; function getInputSize():uint; function hash(_arg1:ByteArray):ByteArray; } }//package com.hurlant.crypto.hash
package aerys.minko.example.core.skybox { import aerys.minko.example.core.primitives.PrimitivesExample; import aerys.minko.render.Effect; import aerys.minko.render.geometry.primitive.CubeGeometry; import aerys.minko.render.material.Material; import aerys.minko.render.resource.texture.CubeTextureResource; import aerys.minko.scene.node.Mesh; import aerys.minko.type.enum.FrustumCulling; public class SkyboxExample extends PrimitivesExample { [Embed(source="../assets/skybox/negx.jpg")] private static const NEG_X : Class; [Embed(source="../assets/skybox/negy.jpg")] private static const NEG_Y : Class; [Embed(source="../assets/skybox/negz.jpg")] private static const NEG_Z : Class; [Embed(source="../assets/skybox/posx.jpg")] private static const POS_X : Class; [Embed(source="../assets/skybox/posy.jpg")] private static const POS_Y : Class; [Embed(source="../assets/skybox/posz.jpg")] private static const POS_Z : Class; override protected function initializeScene() : void { super.initializeScene(); // create cubemap var texture : CubeTextureResource = new CubeTextureResource(1024); texture.setContentFromBitmapDatas( new POS_X().bitmapData, new NEG_X().bitmapData, new POS_Y().bitmapData, new NEG_Y().bitmapData, new POS_Z().bitmapData, new NEG_Z().bitmapData, true ); // create geometry with custom shader. var skybox : Mesh = new Mesh( CubeGeometry.cubeGeometry, new Material(new Effect(new SkyboxShader()), { diffuseCubeMap: texture }) ); skybox.frustumCulling = FrustumCulling.DISABLED; var scale:Number = camera.zFar; skybox.transform.setScale(scale, scale, scale); scene.addChild(skybox); } } }
package com.ankamagames.dofus.network.types.game.mount { import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkType; import com.ankamagames.jerakine.network.utils.FuncTree; public class UpdateMountCharacteristic implements INetworkType { public static const protocolId:uint = 826; public var type:uint = 0; public function UpdateMountCharacteristic() { super(); } public function getTypeId() : uint { return 826; } public function initUpdateMountCharacteristic(type:uint = 0) : UpdateMountCharacteristic { this.type = type; return this; } public function reset() : void { this.type = 0; } public function serialize(output:ICustomDataOutput) : void { this.serializeAs_UpdateMountCharacteristic(output); } public function serializeAs_UpdateMountCharacteristic(output:ICustomDataOutput) : void { output.writeByte(this.type); } public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_UpdateMountCharacteristic(input); } public function deserializeAs_UpdateMountCharacteristic(input:ICustomDataInput) : void { this._typeFunc(input); } public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_UpdateMountCharacteristic(tree); } public function deserializeAsyncAs_UpdateMountCharacteristic(tree:FuncTree) : void { tree.addChild(this._typeFunc); } private function _typeFunc(input:ICustomDataInput) : void { this.type = input.readByte(); if(this.type < 0) { throw new Error("Forbidden value (" + this.type + ") on element of UpdateMountCharacteristic.type."); } } } }
/* 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.utils.text { import flash.utils.Dictionary; /** * Duplicates the functionality of the <code>restrict</code> property on * <code>flash.text.TextField</code>. * * @see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#restrict Full description of flash.text.TextField.restrict in Adobe's Flash Platform API Reference */ public class TextInputRestrict { /** * @private */ protected static const REQUIRES_ESCAPE:Dictionary = new Dictionary(); REQUIRES_ESCAPE[/\[/g] = "\\["; REQUIRES_ESCAPE[/\]/g] = "\\]"; REQUIRES_ESCAPE[/\{/g] = "\\{"; REQUIRES_ESCAPE[/\}/g] = "\\}"; REQUIRES_ESCAPE[/\(/g] = "\\("; REQUIRES_ESCAPE[/\)/g] = "\\)"; REQUIRES_ESCAPE[/\|/g] = "\\|"; REQUIRES_ESCAPE[/\//g] = "\\/"; REQUIRES_ESCAPE[/\./g] = "\\."; REQUIRES_ESCAPE[/\+/g] = "\\+"; REQUIRES_ESCAPE[/\*/g] = "\\*"; REQUIRES_ESCAPE[/\?/g] = "\\?"; REQUIRES_ESCAPE[/\$/g] = "\\$"; /** * Constructor. */ public function TextInputRestrict(restrict:String = null) { this.restrict = restrict; } /** * @private */ protected var _restrictStartsWithExclude:Boolean = false; /** * @private */ protected var _restricts:Vector.<RegExp> /** * @private */ private var _restrict:String; /** * Indicates the set of characters that a user can input. * * <p>In the following example, the text is restricted to numbers:</p> * * <listing version="3.0"> * object.restrict = "0-9";</listing> * * @default null * * @see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#restrict Full description of flash.text.TextField.restrict in Adobe's Flash Platform API Reference */ public function get restrict():String { return this._restrict; } /** * @private */ public function set restrict(value:String):void { if(this._restrict === value) { return; } this._restrict = value; if(value) { if(this._restricts) { this._restricts.length = 0; } else { this._restricts = new <RegExp>[]; } if(this._restrict === "") { this._restricts.push(/^$/); } else if(this._restrict) { var startIndex:int = 0; var isExcluding:Boolean = value.indexOf("^") == 0; this._restrictStartsWithExclude = isExcluding; do { var nextStartIndex:int = value.indexOf("^", startIndex + 1); if(nextStartIndex >= 0) { var partialRestrict:String = value.substr(startIndex, nextStartIndex - startIndex); this._restricts.push(this.createRestrictRegExp(partialRestrict, isExcluding)); } else { partialRestrict = value.substr(startIndex) this._restricts.push(this.createRestrictRegExp(partialRestrict, isExcluding)); break; } startIndex = nextStartIndex; isExcluding = !isExcluding; } while(true) } } else { this._restricts = null; } } /** * Accepts a character code and determines if it is allowed or not. */ public function isCharacterAllowed(charCode:int):Boolean { if(!this._restricts) { return true; } var character:String = String.fromCharCode(charCode); var isExcluding:Boolean = this._restrictStartsWithExclude; var isIncluded:Boolean = isExcluding; var restrictCount:int = this._restricts.length; for(var i:int = 0; i < restrictCount; i++) { var restrict:RegExp = this._restricts[i]; if(isExcluding) { isIncluded = isIncluded && restrict.test(character); } else { isIncluded = isIncluded || restrict.test(character); } isExcluding = !isExcluding; } return isIncluded; } /** * Accepts a string of characters and filters out characters that are * not allowed. */ public function filterText(value:String):String { if(!this._restricts) { return value; } var textLength:int = value.length; var restrictCount:int = this._restricts.length; for(var i:int = 0; i < textLength; i++) { var character:String = value.charAt(i); var isExcluding:Boolean = this._restrictStartsWithExclude; var isIncluded:Boolean = isExcluding; for(var j:int = 0; j < restrictCount; j++) { var restrict:RegExp = this._restricts[j]; if(isExcluding) { isIncluded = isIncluded && restrict.test(character); } else { isIncluded = isIncluded || restrict.test(character); } isExcluding = !isExcluding; } if(!isIncluded) { value = value.substr(0, i) + value.substr(i + 1); i--; textLength--; } } return value; } /** * @private */ protected function createRestrictRegExp(restrict:String, isExcluding:Boolean):RegExp { if(!isExcluding && restrict.indexOf("^") == 0) { //unlike regular expressions, which always treat ^ as excluding, //restrict uses ^ to swap between excluding and including. //if we're including, we need to remove ^ for the regexp restrict = restrict.substr(1); } //we need to do backslash first. otherwise, we'll get duplicates restrict = restrict.replace(/\\/g, "\\\\"); for(var key:Object in REQUIRES_ESCAPE) { var keyRegExp:RegExp = key as RegExp; var value:String = REQUIRES_ESCAPE[keyRegExp] as String; restrict = restrict.replace(keyRegExp, value); } return new RegExp("[" + restrict + "]"); } } }
/** * Created by singuerinc on 09/05/2014. */ package signals { import flash.geom.Point; import org.osflash.signals.PrioritySignal; public class MoveWindowSignal extends PrioritySignal { public function MoveWindowSignal() { super(Point); } public var point:Point; override public function dispatch(...valueObjects):void { this.point = valueObjects[0]; super.dispatch.apply(this, valueObjects); } } }
package com.murphy.particlefield.views { import com.murphy.particlefield.models.ParticleFieldModel; import flash.display.Bitmap; import flash.display.DisplayObjectContainer; import flash.display.MovieClip; import flash.display.Sprite; import flash.text.TextField; public class ParticleFieldView extends Sprite { public var bmp_canvasContainer:Bitmap; public var mc_diagnostics:MovieClip; public var tf_particleCount:TextField; public var tf_addParticles:TextField; protected var _parent:DisplayObjectContainer; protected var _model:ParticleFieldModel; public function ParticleFieldView(parentDisplayObject:DisplayObjectContainer, model:ParticleFieldModel) { _parent = parentDisplayObject; _model = model; init(); } protected function init():void { _parent.addChild( this ); bmp_canvasContainer = new Bitmap(); this.addChild(bmp_canvasContainer); tf_particleCount = new TextField(); tf_addParticles = new TextField(); mc_diagnostics = new MovieClip(); this.addChild(tf_particleCount); this.addChild(tf_addParticles); this.addChild(mc_diagnostics); _parent.addChild(this); } } }
package zen.shaders.core { import zen.shaders.*; import zen.enums.*; import zen.shaders.ShaderBase; import flash.utils.Dictionary; import zen.shaders.*; import flash.utils.*; public class ShaderRegister extends ShaderBase { private static const _sizes:Array = [0, 1, 3, 7, 15]; private var maxRegisters:int; public var memory:Vector.<int>; public var addr:Dictionary; private static function fill(v:int):String { var value:String = v.toString(2); while (value.length < 4) { value = ("0" + value); } return (value); } public function reset(name:String, maxRegisters:int = 0):void { this.name = name; this.maxRegisters = maxRegisters; this.memory = new Vector.<int>(maxRegisters); this.addr = new Dictionary(true); } public function dispose():void { this.memory = null; this.addr = null; } public function alloc(v:uint):int { var start:int; var count:int; var offset:int; var semantic:String; var mem:int; var reg:int; var source:int = ShaderCompiler.getSourceAddress((v & 0xFFFF)); if (ShaderCompiler.globals[source]) { semantic = ShaderCompiler.globals[source].semantic; } if (((((semantic) && (!((semantic == ""))))) && (!((this.addr[semantic] == undefined))))) { this.addr[source] = this.addr[semantic]; return (-1); } if (this.addr[source] != undefined) { return (-1); } var fill:Boolean; var size:int = ShaderCompiler.getSourceSize(source); var length:int = ShaderCompiler.getSourceLength(source); var type:int = ShaderCompiler.getRegisterType(v); if ((((((((type == ZSLFlags.INPUT)) || ((type == ZSLFlags.PARAM)))) || ((type == ZSLFlags.SAMPLER2D)))) || ((type == ZSLFlags.SAMPLERCUBE)))) { fill = true; } var address:int; var a:int; while ((((a < (this.memory.length * 4))) && (!((count == (size * length)))))) { start = (address / 4); offset = (address % 4); while (this.memory.length <= start) { this.memory.length++; } mem = this.memory[start]; reg = (_sizes[size] << offset); if ((((size <= (4 - offset))) && (((mem ^ (reg & mem)) == mem)))) { count = (count + size); if ((((size >= 3)) || (fill))) { address = (address + 4); } else { address = (address + size); } } else { if ((((size >= 3)) || (fill))) { address = (address + 4); } else { address++; } a = address; count = 0; } } if ((a / 4) >= this.maxRegisters) { this.memory.length++; } this.addr[source] = a; if (semantic) { this.addr[semantic] = a; } count = 0; while (count != (size * length)) { start = (a / 4); offset = (a % 4); if (fill) { this.memory[start] = 15; } else { this.memory[start] = (this.memory[start] | (_sizes[size] << offset)); } if (size >= 3) { a = (a + 4); } else { a = (a + size); } count = (count + size); } return (this.addr[source]); } public function free(v:uint):void { var start:int; var offset:int; var count:int; var source:int = ShaderCompiler.getSourceAddress((v & 0xFFFF)); if (this.addr[source] == undefined) { return; } var size:int = ShaderCompiler.getSourceSize((v & 0xFFFF)); var length:int = ShaderCompiler.getSourceLength((v & 0xFFFF)); var address:int = this.addr[source]; while (count != (size * length)) { start = (address / 4); offset = (address % 4); this.memory[start] = (this.memory[start] | (_sizes[size] << offset)); this.memory[start] = (this.memory[start] - (_sizes[size] << offset)); if (size >= 3) { address = (address + 4); } else { address = (address + size); } count = (count + size); } this.addr[source] = undefined; } } }
package as3snapi.networks.odnoklassnikiru.features { public interface IFeatureOdnoklassnikiApi { function apiRequest(method:String, params:Object, onSuccess:Function, onFail:Function, exeption:Boolean = false):void ; } }
//common tunnel functionality bool getTunnels(CBlob@ this, CBlob@[]@ tunnels) { CBlob@[] list; getBlobsByTag("travel tunnel", @list); const u8 teamNum = this.getTeamNum(); for (uint i = 0; i < list.length; i++) { CBlob@ blob = list[i]; if (blob !is this && blob.getTeamNum() == this.getTeamNum() && !blob.hasTag("under raid")) // HACK { tunnels.push_back(blob); } } return tunnels.length > 0; }
/* * Copyright (c) 2009 Erin Catto http://www.gphysics.com * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ /** * Specifies a segment for use with RayCast functions. */ package Box2D.Collision { import Box2D.Common.Math.b2Vec2; public class b2RayCastInput { function b2RayCastInput(p1:b2Vec2 = null, p2:b2Vec2 = null, maxFraction:Number = 1) { if (p1) this.p1.SetV(p1); if (p2) this.p2.SetV(p2); this.maxFraction = maxFraction; } /** * The start point of the ray */ public var p1:b2Vec2 = new b2Vec2(); /** * The end point of the ray */ public var p2:b2Vec2 = new b2Vec2(); /** * Truncate the ray to reach up to this fraction from p1 to p2 */ public var maxFraction:Number; } }
import skyui.util.Translator; import skyui.defines.Actor; import skyui.defines.Armor; import skyui.defines.Form; import skyui.defines.Item; import skyui.defines.Material; import skyui.defines.Weapon; import skyui.defines.Inventory; class InventoryDataSetter extends ItemcardDataExtender { /* INITIALIZATION */ public function InventoryDataSetter() { super(); } /* PUBLIC FUNCTIONS */ // @override ItemcardDataExtender public function processEntry(a_entryObject: Object, a_itemInfo: Object): Void { a_entryObject.baseId = a_entryObject.formId & 0x00FFFFFF; a_entryObject.type = a_itemInfo.type; a_entryObject.isEquipped = (a_entryObject.equipState > 0); a_entryObject.isStolen = (a_itemInfo.stolen == true); a_entryObject.infoValue = (a_itemInfo.value > 0) ? (Math.round(a_itemInfo.value * 100) / 100) : null; a_entryObject.infoWeight =(a_itemInfo.weight > 0) ? (Math.round(a_itemInfo.weight * 100) / 100) : null; a_entryObject.infoValueWeight = (a_itemInfo.weight > 0 && a_itemInfo.value > 0) ? (Math.round((a_itemInfo.value / a_itemInfo.weight) * 100) / 100) : null; switch (a_entryObject.formType) { case Form.TYPE_SCROLLITEM: a_entryObject.subTypeDisplay = Translator.translate("$Scroll"); a_entryObject.duration = (a_entryObject.duration > 0) ? (Math.round(a_entryObject.duration * 100) / 100) : null; a_entryObject.magnitude = (a_entryObject.magnitude > 0) ? (Math.round(a_entryObject.magnitude * 100) / 100) : null; break; case Form.TYPE_ARMOR: a_entryObject.isEnchanted = (a_itemInfo.effects != ""); a_entryObject.infoArmor = (a_itemInfo.armor > 0) ? (Math.round(a_itemInfo.armor * 100) / 100) : null; processArmorClass(a_entryObject); processArmorPartMask(a_entryObject); processMaterialKeywords(a_entryObject); processArmorOther(a_entryObject); processArmorBaseId(a_entryObject); break; case Form.TYPE_BOOK: processBookType(a_entryObject); break; case Form.TYPE_INGREDIENT: a_entryObject.subTypeDisplay = Translator.translate("$Ingredient"); break; case Form.TYPE_LIGHT: a_entryObject.subTypeDisplay = Translator.translate("$Torch"); break; case Form.TYPE_MISC: processMiscType(a_entryObject); processMiscBaseId(a_entryObject); break; case Form.TYPE_WEAPON: a_entryObject.isEnchanted = (a_itemInfo.effects != ""); a_entryObject.isPoisoned = (a_itemInfo.poisoned == true); a_entryObject.infoDamage = (a_itemInfo.damage > 0) ? (Math.round(a_itemInfo.damage * 100) / 100) : null; processWeaponType(a_entryObject); processMaterialKeywords(a_entryObject); processWeaponBaseId(a_entryObject); break; case Form.TYPE_AMMO: a_entryObject.isEnchanted = (a_itemInfo.effects != ""); a_entryObject.infoDamage = (a_itemInfo.damage > 0) ? (Math.round(a_itemInfo.damage * 100) / 100) : null; processAmmoType(a_entryObject); processMaterialKeywords(a_entryObject); processAmmoBaseId(a_entryObject); break; case Form.TYPE_KEY: processKeyType(a_entryObject); break; case Form.TYPE_POTION: a_entryObject.duration = (a_entryObject.duration > 0) ? (Math.round(a_entryObject.duration * 100) / 100) : null; a_entryObject.magnitude = (a_entryObject.magnitude > 0) ? (Math.round(a_entryObject.magnitude * 100) / 100) : null; processPotionType(a_entryObject); break; case Form.TYPE_SOULGEM: processSoulGemType(a_entryObject); processSoulGemStatus(a_entryObject); processSoulGemBaseId(a_entryObject); break; } } /* PRIVATE FUNCTIONS */ private function processArmorClass(a_entryObject: Object): Void { if (a_entryObject.weightClass == Armor.WEIGHT_NONE) a_entryObject.weightClass = null; a_entryObject.weightClassDisplay = Translator.translate("$Other"); switch (a_entryObject.weightClass) { case Armor.WEIGHT_LIGHT: a_entryObject.weightClassDisplay = Translator.translate("$Light"); break; case Armor.WEIGHT_HEAVY: a_entryObject.weightClassDisplay = Translator.translate("$Heavy"); break; default: if (a_entryObject.keywords == undefined) break; if (a_entryObject.keywords["VendorItemClothing"] != undefined) { a_entryObject.weightClass = Armor.WEIGHT_CLOTHING; a_entryObject.weightClassDisplay = Translator.translate("$Clothing"); } else if (a_entryObject.keywords["VendorItemJewelry"] != undefined) { a_entryObject.weightClass = Armor.WEIGHT_JEWELRY; a_entryObject.weightClassDisplay = Translator.translate("$Jewelry"); } } } private function processMaterialKeywords(a_entryObject: Object): Void { a_entryObject.material = null; a_entryObject.materialDisplay = Translator.translate("$Other"); if (a_entryObject.keywords == undefined) return; if (a_entryObject.keywords["ArmorMaterialDaedric"] != undefined || a_entryObject.keywords["WeapMaterialDaedric"] != undefined) { a_entryObject.material = Material.DAEDRIC; a_entryObject.materialDisplay = Translator.translate("$Daedric"); } else if (a_entryObject.keywords["ArmorMaterialDragonplate"] != undefined) { a_entryObject.material = Material.DRAGONPLATE; a_entryObject.materialDisplay = Translator.translate("$Dragonplate"); } else if (a_entryObject.keywords["ArmorMaterialDragonscale"] != undefined) { a_entryObject.material = Material.DRAGONSCALE; a_entryObject.materialDisplay = Translator.translate("$Dragonscale"); } else if (a_entryObject.keywords["ArmorMaterialDwarven"] != undefined || a_entryObject.keywords["WeapMaterialDwarven"] != undefined) { a_entryObject.material = Material.DWARVEN; a_entryObject.materialDisplay = Translator.translate("$Dwarven"); } else if (a_entryObject.keywords["ArmorMaterialEbony"] != undefined || a_entryObject.keywords["WeapMaterialEbony"] != undefined) { a_entryObject.material = Material.EBONY; a_entryObject.materialDisplay = Translator.translate("$Ebony"); } else if (a_entryObject.keywords["ArmorMaterialElven"] != undefined || a_entryObject.keywords["WeapMaterialElven"] != undefined) { a_entryObject.material = Material.ELVEN; a_entryObject.materialDisplay = Translator.translate("$Elven"); } else if (a_entryObject.keywords["ArmorMaterialElvenGilded"] != undefined) { a_entryObject.material = Material.ELVENGILDED; a_entryObject.materialDisplay = Translator.translate("$Elven Gilded"); } else if (a_entryObject.keywords["ArmorMaterialGlass"] != undefined || a_entryObject.keywords["WeapMaterialGlass"] != undefined) { a_entryObject.material = Material.GLASS; a_entryObject.materialDisplay = Translator.translate("$Glass"); } else if (a_entryObject.keywords["ArmorMaterialHide"] != undefined) { a_entryObject.material = Material.HIDE; a_entryObject.materialDisplay = Translator.translate("$Hide"); } else if (a_entryObject.keywords["ArmorMaterialImperialHeavy"] != undefined || a_entryObject.keywords["ArmorMaterialImperialLight"] != undefined || a_entryObject.keywords["WeapMaterialImperial"] != undefined) { a_entryObject.material = Material.IMPERIAL; a_entryObject.materialDisplay = Translator.translate("$Imperial"); } else if (a_entryObject.keywords["ArmorMaterialImperialStudded"] != undefined) { a_entryObject.material = Material.IMPERIALSTUDDED; a_entryObject.materialDisplay = Translator.translate("$Studded"); } else if (a_entryObject.keywords["ArmorMaterialIron"] != undefined || a_entryObject.keywords["WeapMaterialIron"] != undefined) { a_entryObject.material = Material.IRON; a_entryObject.materialDisplay = Translator.translate("$Iron"); } else if (a_entryObject.keywords["ArmorMaterialIronBanded"] != undefined) { a_entryObject.material = Material.IRONBANDED; a_entryObject.materialDisplay = Translator.translate("$Iron Banded"); // Must be above leather, vampire armor has 2 material keywords } else if (a_entryObject.keywords["DLC1ArmorMaterialVampire"] != undefined) { a_entryObject.material = Material.VAMPIRE; a_entryObject.materialDisplay = Translator.translate("$Vampire"); } else if (a_entryObject.keywords["ArmorMaterialLeather"] != undefined) { a_entryObject.material = Material.LEATHER; a_entryObject.materialDisplay = Translator.translate("$Leather"); } else if (a_entryObject.keywords["ArmorMaterialOrcish"] != undefined || a_entryObject.keywords["WeapMaterialOrcish"] != undefined) { a_entryObject.material = Material.ORCISH; a_entryObject.materialDisplay = Translator.translate("$Orcish"); } else if (a_entryObject.keywords["ArmorMaterialScaled"] != undefined) { a_entryObject.material = Material.SCALED; a_entryObject.materialDisplay = Translator.translate("$Scaled"); } else if (a_entryObject.keywords["ArmorMaterialSteel"] != undefined || a_entryObject.keywords["WeapMaterialSteel"] != undefined) { a_entryObject.material = Material.STEEL; a_entryObject.materialDisplay = Translator.translate("$Steel"); } else if (a_entryObject.keywords["ArmorMaterialSteelPlate"] != undefined) { a_entryObject.material = Material.STEELPLATE; a_entryObject.materialDisplay = Translator.translate("$Steel Plate"); } else if (a_entryObject.keywords["ArmorMaterialStormcloak"] != undefined) { a_entryObject.material = Material.STORMCLOAK; a_entryObject.materialDisplay = Translator.translate("$Stormcloak"); } else if (a_entryObject.keywords["ArmorMaterialStudded"] != undefined) { a_entryObject.material = Material.STUDDED; a_entryObject.materialDisplay = Translator.translate("$Studded"); } else if (a_entryObject.keywords["DLC1ArmorMaterialDawnguard"] != undefined) { a_entryObject.material = Material.DAWNGUARD; a_entryObject.materialDisplay = Translator.translate("$Dawnguard"); } else if (a_entryObject.keywords["DLC1ArmorMaterialFalmerHardened"] != undefined || a_entryObject.keywords["DLC1ArmorMaterialFalmerHeavy"] != undefined) { a_entryObject.material = Material.FALMERHARDENED; a_entryObject.materialDisplay = Translator.translate("$Falmer Hardened"); } else if (a_entryObject.keywords["DLC1ArmorMaterialHunter"] != undefined) { a_entryObject.material = Material.HUNTER; a_entryObject.materialDisplay = Translator.translate("$Hunter"); } else if (a_entryObject.keywords["DLC1LD_CraftingMaterialAetherium"] != undefined) { a_entryObject.material = Material.AETHERIUM; a_entryObject.materialDisplay = Translator.translate("$Aetherium"); } else if (a_entryObject.keywords["DLC1WeapMaterialDragonbone"] != undefined) { a_entryObject.material = Material.DRAGONBONE; a_entryObject.materialDisplay = Translator.translate("$Dragonbone"); } else if (a_entryObject.keywords["DLC2ArmorMaterialBonemoldHeavy"] != undefined || a_entryObject.keywords["DLC2ArmorMaterialBonemoldLight"] != undefined) { a_entryObject.material = Material.BONEMOLD; a_entryObject.materialDisplay = Translator.translate("$Bonemold"); } else if (a_entryObject.keywords["DLC2ArmorMaterialChitinHeavy"] != undefined || a_entryObject.keywords["DLC2ArmorMaterialChitinLight"] != undefined) { a_entryObject.material = Material.CHITIN; a_entryObject.materialDisplay = Translator.translate("$Chitin"); } else if (a_entryObject.keywords["DLC2ArmorMaterialMoragTong"] != undefined) { a_entryObject.material = Material.MORAGTONG; a_entryObject.materialDisplay = Translator.translate("$Morag Tong"); } else if (a_entryObject.keywords["DLC2ArmorMaterialNordicHeavy"] != undefined || a_entryObject.keywords["DLC2ArmorMaterialNordicLight"] != undefined || a_entryObject.keywords["DLC2WeaponMaterialNordic"] != undefined) { a_entryObject.material = Material.NORDIC; a_entryObject.materialDisplay = Translator.translate("$Nordic"); } else if (a_entryObject.keywords["DLC2ArmorMaterialStalhrimHeavy"] != undefined || a_entryObject.keywords["DLC2ArmorMaterialStalhrimLight"] != undefined || a_entryObject.keywords["DLC2WeaponMaterialStalhrim"] != undefined) { a_entryObject.material = Material.STALHRIM; a_entryObject.materialDisplay = Translator.translate("$Stalhrim"); if (a_entryObject.keywords["DLC2dunHaknirArmor"] != undefined) { a_entryObject.material = Material.DEATHBRAND; a_entryObject.materialDisplay = Translator.translate("$Deathbrand"); } } else if (a_entryObject.keywords["WeapMaterialDraugr"] != undefined) { a_entryObject.material = Material.DRAUGR; a_entryObject.materialDisplay = Translator.translate("$Draugr"); } else if (a_entryObject.keywords["WeapMaterialDraugrHoned"] != undefined) { a_entryObject.material = Material.DRAUGRHONED; a_entryObject.materialDisplay = Translator.translate("$Draugr Honed"); } else if (a_entryObject.keywords["WeapMaterialFalmer"] != undefined) { a_entryObject.material = Material.FALMER; a_entryObject.materialDisplay = Translator.translate("$Falmer"); } else if (a_entryObject.keywords["WeapMaterialFalmerHoned"] != undefined) { a_entryObject.material = Material.FALMERHONED; a_entryObject.materialDisplay = Translator.translate("$Falmer Honed"); } else if (a_entryObject.keywords["WeapMaterialSilver"] != undefined) { a_entryObject.material = Material.SILVER; a_entryObject.materialDisplay = Translator.translate("$Silver"); } else if (a_entryObject.keywords["WeapMaterialWood"] != undefined) { a_entryObject.material = Material.WOOD; a_entryObject.materialDisplay = Translator.translate("$Wood"); } } private function processWeaponType(a_entryObject: Object): Void { a_entryObject.subType = null; a_entryObject.subTypeDisplay = Translator.translate("$Weapon"); switch (a_entryObject.weaponType) { case Weapon.ANIM_HANDTOHANDMELEE: case Weapon.ANIM_H2H: a_entryObject.subType = Weapon.TYPE_MELEE; a_entryObject.subTypeDisplay = Translator.translate("$Melee"); break; case Weapon.ANIM_ONEHANDSWORD: case Weapon.ANIM_1HS: a_entryObject.subType = Weapon.TYPE_SWORD; a_entryObject.subTypeDisplay = Translator.translate("$Sword"); break; case Weapon.ANIM_ONEHANDDAGGER: case Weapon.ANIM_1HD: a_entryObject.subType = Weapon.TYPE_DAGGER; a_entryObject.subTypeDisplay = Translator.translate("$Dagger"); break; case Weapon.ANIM_ONEHANDAXE: case Weapon.ANIM_1HA: a_entryObject.subType = Weapon.TYPE_WARAXE; a_entryObject.subTypeDisplay = Translator.translate("$War Axe"); break; case Weapon.ANIM_ONEHANDMACE: case Weapon.ANIM_1HM: a_entryObject.subType = Weapon.TYPE_MACE; a_entryObject.subTypeDisplay = Translator.translate("$Mace"); break; case Weapon.ANIM_TWOHANDSWORD: case Weapon.ANIM_2HS: a_entryObject.subType = Weapon.TYPE_GREATSWORD; a_entryObject.subTypeDisplay = Translator.translate("$Greatsword"); break; case Weapon.ANIM_TWOHANDAXE: case Weapon.ANIM_2HA: a_entryObject.subType = Weapon.TYPE_BATTLEAXE; a_entryObject.subTypeDisplay = Translator.translate("$Battleaxe"); if (a_entryObject.keywords != undefined && a_entryObject.keywords["WeapTypeWarhammer"] != undefined) { a_entryObject.subType = Weapon.TYPE_WARHAMMER; a_entryObject.subTypeDisplay = Translator.translate("$Warhammer"); } break; case Weapon.ANIM_BOW: case Weapon.ANIM_BOW2: a_entryObject.subType = Weapon.TYPE_BOW; a_entryObject.subTypeDisplay = Translator.translate("$Bow"); break; case Weapon.ANIM_STAFF: case Weapon.ANIM_STAFF2: a_entryObject.subType = Weapon.TYPE_STAFF; a_entryObject.subTypeDisplay = Translator.translate("$Staff"); break; case Weapon.ANIM_CROSSBOW: case Weapon.ANIM_CBOW: a_entryObject.subType = Weapon.TYPE_CROSSBOW; a_entryObject.subTypeDisplay = Translator.translate("$Crossbow"); break; } } private function processWeaponBaseId(a_entryObject: Object): Void { switch (a_entryObject.baseId) { case Form.BASEID_WEAPPICKAXE: case Form.BASEID_SSDROCKSPLINTERPICKAXE: case Form.BASEID_DUNVOLUNRUUDPICKAXE: a_entryObject.subType = Weapon.TYPE_PICKAXE; a_entryObject.subTypeDisplay = Translator.translate("$Pickaxe"); break; case Form.BASEID_AXE01: case Form.BASEID_DUNHALTEDSTREAMPOACHERSAXE: a_entryObject.subType = Weapon.TYPE_WOODAXE; a_entryObject.subTypeDisplay = Translator.translate("$Wood Axe"); break; } } private function processArmorPartMask(a_entryObject: Object): Void { if (a_entryObject.partMask == undefined) return; // Sets subType as the most important bitmask index. for (var i = 0; i < Armor.PARTMASK_PRECEDENCE.length; i++) { if (a_entryObject.partMask & Armor.PARTMASK_PRECEDENCE[i]) { a_entryObject.mainPartMask = Armor.PARTMASK_PRECEDENCE[i]; break; } } if (a_entryObject.mainPartMask == undefined) return; switch (a_entryObject.mainPartMask) { case Armor.PARTMASK_HEAD: a_entryObject.subType = Armor.EQUIP_HEAD; a_entryObject.subTypeDisplay = Translator.translate("$Head"); break; case Armor.PARTMASK_HAIR: a_entryObject.subType = Armor.EQUIP_HAIR; a_entryObject.subTypeDisplay = Translator.translate("$Head"); break; case Armor.PARTMASK_LONGHAIR: a_entryObject.subType = Armor.EQUIP_LONGHAIR; a_entryObject.subTypeDisplay = Translator.translate("$Head"); break; case Armor.PARTMASK_BODY: a_entryObject.subType = Armor.EQUIP_BODY; a_entryObject.subTypeDisplay = Translator.translate("$Body"); break; case Armor.PARTMASK_HANDS: a_entryObject.subType = Armor.EQUIP_HANDS; a_entryObject.subTypeDisplay = Translator.translate("$Hands"); break; case Armor.PARTMASK_FOREARMS: a_entryObject.subType = Armor.EQUIP_FOREARMS; a_entryObject.subTypeDisplay = Translator.translate("$Forearms"); break; case Armor.PARTMASK_AMULET: a_entryObject.subType = Armor.EQUIP_AMULET; a_entryObject.subTypeDisplay = Translator.translate("$Amulet"); break; case Armor.PARTMASK_RING: a_entryObject.subType = Armor.EQUIP_RING; a_entryObject.subTypeDisplay = Translator.translate("$Ring"); break; case Armor.PARTMASK_FEET: a_entryObject.subType = Armor.EQUIP_FEET; a_entryObject.subTypeDisplay = Translator.translate("$Feet"); break; case Armor.PARTMASK_CALVES: a_entryObject.subType = Armor.EQUIP_CALVES; a_entryObject.subTypeDisplay = Translator.translate("$Calves"); break; case Armor.PARTMASK_SHIELD: a_entryObject.subType = Armor.EQUIP_SHIELD; a_entryObject.subTypeDisplay = Translator.translate("$Shield"); break; case Armor.PARTMASK_CIRCLET: a_entryObject.subType = Armor.EQUIP_CIRCLET; a_entryObject.subTypeDisplay = Translator.translate("$Circlet"); break; case Armor.PARTMASK_EARS: a_entryObject.subType = Armor.EQUIP_EARS; a_entryObject.subTypeDisplay = Translator.translate("$Ears"); break; case Armor.PARTMASK_TAIL: a_entryObject.subType = Armor.EQUIP_TAIL; a_entryObject.subTypeDisplay = Translator.translate("$Tail"); break; default: a_entryObject.subType = a_entryObject.mainPartMask; break; } } private function processArmorOther(a_entryObject): Void { if (a_entryObject.weightClass != null) return; switch (a_entryObject.mainPartMask) { case Armor.PARTMASK_HEAD: case Armor.PARTMASK_HAIR: case Armor.PARTMASK_LONGHAIR: case Armor.PARTMASK_BODY: case Armor.PARTMASK_HANDS: case Armor.PARTMASK_FOREARMS: case Armor.PARTMASK_FEET: case Armor.PARTMASK_CALVES: case Armor.PARTMASK_SHIELD: case Armor.PARTMASK_TAIL: a_entryObject.weightClass = Armor.WEIGHT_CLOTHING; a_entryObject.weightClassDisplay = Translator.translate("$Clothing"); break; case Armor.PARTMASK_AMULET: case Armor.PARTMASK_RING: case Armor.PARTMASK_CIRCLET: case Armor.PARTMASK_EARS: a_entryObject.weightClass = Armor.WEIGHT_JEWELRY; a_entryObject.weightClassDisplay = Translator.translate("$Jewelry"); break; } } private function processArmorBaseId(a_entryObject: Object): Void { switch (a_entryObject.baseId) { case Form.BASEID_CLOTHESWEDDINGWREATH: a_entryObject.weightClass = Armor.WEIGHT_JEWELRY; a_entryObject.weightClassDisplay = Translator.translate("$Jewelry"); break case Form.BASEID_DLC1CLOTHESVAMPIRELORDARMOR: a_entryObject.subType = Armor.EQUIP_BODY; a_entryObject.subTypeDisplay = Translator.translate("$Body"); break; } } private function processBookType(a_entryObject: Object): Void { a_entryObject.subType = Item.OTHER; a_entryObject.subTypeDisplay = Translator.translate("$Book"); a_entryObject.isRead = ((a_entryObject.flags & Item.BOOKFLAG_READ) != 0); if (a_entryObject.bookType == Item.BOOKTYPE_NOTE) { a_entryObject.subType = Item.BOOK_NOTE; a_entryObject.subTypeDisplay = Translator.translate("$Note"); } if (a_entryObject.keywords == undefined) return; if (a_entryObject.keywords["VendorItemRecipe"] != undefined) { a_entryObject.subType = Item.BOOK_RECIPE; a_entryObject.subTypeDisplay = Translator.translate("$Recipe"); } else if (a_entryObject.keywords["VendorItemSpellTome"] != undefined) { a_entryObject.subType = Item.BOOK_SPELLTOME; a_entryObject.subTypeDisplay = Translator.translate("$Spell Tome"); } } private function processAmmoType(a_entryObject: Object): Void { if ((a_entryObject.flags & Weapon.AMMOFLAG_NONBOLT) != 0) { a_entryObject.subType = Weapon.AMMO_ARROW; a_entryObject.subTypeDisplay = Translator.translate("$Arrow"); } else { a_entryObject.subType = Weapon.AMMO_BOLT; a_entryObject.subTypeDisplay = Translator.translate("$Bolt"); } } private function processAmmoBaseId(a_entryObject: Object): Void { switch (a_entryObject.baseId) { case Form.BASEID_DAEDRICARROW: a_entryObject.material = Material.DAEDRIC; a_entryObject.materialDisplay = Translator.translate("$Daedric"); break; case Form.BASEID_EBONYARROW: a_entryObject.material = Material.EBONY; a_entryObject.materialDisplay = Translator.translate("$Ebony"); break; case Form.BASEID_GLASSARROW: a_entryObject.material = Material.GLASS; a_entryObject.materialDisplay = Translator.translate("$Glass"); break; case Form.BASEID_ELVENARROW: case Form.BASEID_DLC1ELVENARROWBLESSED: case Form.BASEID_DLC1ELVENARROWBLOOD: a_entryObject.material = Material.ELVEN; a_entryObject.materialDisplay = Translator.translate("$Elven"); break; case Form.BASEID_DWARVENARROW: case Form.BASEID_DWARVENSPHEREARROW: case Form.BASEID_DWARVENSPHEREBOLT01: case Form.BASEID_DWARVENSPHEREBOLT02: case Form.BASEID_DLC2DWARVENBALLISTABOLT: a_entryObject.material = Material.DWARVEN; a_entryObject.materialDisplay = Translator.translate("$Dwarven"); break; case Form.BASEID_ORCISHARROW: a_entryObject.material = Material.ORCISH; a_entryObject.materialDisplay = Translator.translate("$Orcish"); break; case Form.BASEID_NORDHEROARROW: a_entryObject.material = Material.NORDIC; a_entryObject.materialDisplay = Translator.translate("$Nordic"); break; case Form.BASEID_DRAUGRARROW: a_entryObject.material = Material.DRAUGR; a_entryObject.materialDisplay = Translator.translate("$Draugr"); break; case Form.BASEID_FALMERARROW: a_entryObject.material = Material.FALMER; a_entryObject.materialDisplay = Translator.translate("$Falmer"); break; case Form.BASEID_STEELARROW: case Form.BASEID_MQ101STEELARROW: a_entryObject.material = Material.STEEL; a_entryObject.materialDisplay = Translator.translate("$Steel"); break; case Form.BASEID_IRONARROW: case Form.BASEID_CWARROW: case Form.BASEID_CWARROWSHORT: case Form.BASEID_TRAPDART: case Form.BASEID_DUNARCHERPRATICEARROW: case Form.BASEID_DUNGEIRMUNDSIGDISARROWSILLUSION: case Form.BASEID_FOLLOWERIRONARROW: case Form.BASEID_TESTDLC1BOLT: a_entryObject.material = Material.IRON; a_entryObject.materialDisplay = Translator.translate("$Iron"); break; case Form.BASEID_FORSWORNARROW: a_entryObject.material = Material.HIDE; a_entryObject.materialDisplay = Translator.translate("$Forsworn"); break; case Form.BASEID_DLC2RIEKLINGSPEARTHROWN: a_entryObject.material = Material.WOOD; a_entryObject.materialDisplay = Translator.translate("$Wood"); a_entryObject.subTypeDisplay = Translator.translate("$Spear"); break; } } private function processKeyType(a_entryObject: Object): Void { a_entryObject.subTypeDisplay = Translator.translate("$Key"); if (a_entryObject.infoValue <= 0) a_entryObject.infoValue = null; if (a_entryObject.infoValue <= 0) a_entryObject.infoValue = null; } private function processPotionType(a_entryObject: Object): Void { a_entryObject.subType = Item.POTION_POTION; a_entryObject.subTypeDisplay = Translator.translate("$Potion"); if ((a_entryObject.flags & Item.ALCHFLAG_FOOD) != 0) { a_entryObject.subType = Item.POTION_FOOD; a_entryObject.subTypeDisplay = Translator.translate("$Food"); // SKSE >= 1.6.6 if (a_entryObject.useSound.formId != undefined && a_entryObject.useSound.formId == Form.FORMID_ITMPotionUse) { a_entryObject.subType = Item.POTION_DRINK; a_entryObject.subTypeDisplay = Translator.translate("$Drink"); } } else if ((a_entryObject.flags & Item.ALCHFLAG_POISON) != 0) { a_entryObject.subType = Item.POTION_POISON; a_entryObject.subTypeDisplay = Translator.translate("$Poison"); } else { switch (a_entryObject.actorValue) { case Actor.AV_HEALTH: a_entryObject.subType = Item.POTION_HEALTH; a_entryObject.subTypeDisplay = Translator.translate("$Health"); break; case Actor.AV_MAGICKA: a_entryObject.subType = Item.POTION_MAGICKA; a_entryObject.subTypeDisplay = Translator.translate("$Magicka"); break; case Actor.AV_STAMINA: a_entryObject.subType = Item.POTION_STAMINA; a_entryObject.subTypeDisplay = Translator.translate("$Stamina"); break; case Actor.AV_HEALRATE: a_entryObject.subType = Item.POTION_HEALRATE; a_entryObject.subTypeDisplay = Translator.translate("$Health"); break; case Actor.AV_MAGICKARATE: a_entryObject.subType = Item.POTION_MAGICKARATE; a_entryObject.subTypeDisplay = Translator.translate("$Magicka"); break; case Actor.AV_STAMINARATE: a_entryObject.subType = Item.POTION_STAMINARATE; a_entryObject.subTypeDisplay = Translator.translate("$Stamina"); break; case Actor.AV_HEALRATEMULT: a_entryObject.subType = Item.POTION_HEALRATEMULT; a_entryObject.subTypeDisplay = Translator.translate("$Health"); break; case Actor.AV_MAGICKARATEMULT: a_entryObject.subType = Item.POTION_MAGICKARATEMULT; a_entryObject.subTypeDisplay = Translator.translate("$Magicka"); break; case Actor.AV_STAMINARATEMULT: a_entryObject.subType = Item.POTION_STAMINARATEMULT; a_entryObject.subTypeDisplay = Translator.translate("$Stamina"); break; case Actor.AV_FIRERESIST: a_entryObject.subType = Item.POTION_FIRERESIST; break; case Actor.AV_ELECTRICRESIST: a_entryObject.subType = Item.POTION_ELECTRICRESIST; break; case Actor.AV_FROSTRESIST: a_entryObject.subType = Item.POTION_FROSTRESIST; break; } } } private function processSoulGemType(a_entryObject: Object): Void { a_entryObject.subType = Item.OTHER; a_entryObject.subTypeDisplay = Translator.translate("$Soul Gem"); // Ignores soulgems that have a size of None if (a_entryObject.gemSize != undefined && a_entryObject.gemSize != Item.SOULGEM_NONE) a_entryObject.subType = a_entryObject.gemSize; } private function processSoulGemStatus(a_entryObject: Object): Void { if (a_entryObject.gemSize == undefined || a_entryObject.soulSize == undefined || a_entryObject.soulSize == Item.SOULGEM_NONE) a_entryObject.status = Item.SOULGEMSTATUS_EMPTY; else if (a_entryObject.soulSize >= a_entryObject.gemSize) a_entryObject.status = Item.SOULGEMSTATUS_FULL; else a_entryObject.status = Item.SOULGEMSTATUS_PARTIAL; } private function processSoulGemBaseId(a_entryObject: Object): Void { switch (a_entryObject.baseId) { case Form.BASEID_DA01SOULGEMBLACKSTAR: case Form.BASEID_DA01SOULGEMAZURASSTAR: a_entryObject.subType = Item.SOULGEM_AZURA; break; } } private function processMiscType(a_entryObject: Object): Void { a_entryObject.subType = Item.OTHER; a_entryObject.subTypeDisplay = Translator.translate("$Misc"); if (a_entryObject.keywords == undefined) return; if (a_entryObject.keywords["BYOHAdoptionClothesKeyword"] != undefined) { a_entryObject.subType = Item.MISC_CHILDRENSCLOTHES; a_entryObject.subTypeDisplay = Translator.translate("$Clothing"); } else if (a_entryObject.keywords["BYOHAdoptionToyKeyword"] != undefined) { a_entryObject.subType = Item.MISC_TOY; a_entryObject.subTypeDisplay = Translator.translate("$Toy"); } else if (a_entryObject.keywords["BYOHHouseCraftingCategoryWeaponRacks"] != undefined || a_entryObject.keywords["BYOHHouseCraftingCategoryShelf"] != undefined || a_entryObject.keywords["BYOHHouseCraftingCategoryFurniture"] != undefined || a_entryObject.keywords["BYOHHouseCraftingCategoryExterior"] != undefined || a_entryObject.keywords["BYOHHouseCraftingCategoryContainers"] != undefined || a_entryObject.keywords["BYOHHouseCraftingCategoryBuilding"] != undefined || a_entryObject.keywords["BYOHHouseCraftingCategorySmithing"] != undefined) { a_entryObject.subType = Item.MISC_HOUSEPART; a_entryObject.subTypeDisplay = Translator.translate("$House Part"); } else if (a_entryObject.keywords["VendorItemDaedricArtifact"] != undefined) { a_entryObject.subType = Item.MISC_ARTIFACT; a_entryObject.subTypeDisplay = Translator.translate("$Artifact"); } else if (a_entryObject.keywords["VendorItemGem"] != undefined) { a_entryObject.subType = Item.MISC_GEM; a_entryObject.subTypeDisplay = Translator.translate("$Gem"); } else if (a_entryObject.keywords["VendorItemAnimalHide"] != undefined) { a_entryObject.subType = Item.MISC_HIDE; a_entryObject.subTypeDisplay = Translator.translate("$Hide"); } else if (a_entryObject.keywords["VendorItemTool"] != undefined) { a_entryObject.subType = Item.MISC_TOOL; a_entryObject.subTypeDisplay = Translator.translate("$Tool"); } else if (a_entryObject.keywords["VendorItemAnimalPart"] != undefined) { a_entryObject.subType = Item.MISC_REMAINS; a_entryObject.subTypeDisplay = Translator.translate("$Remains"); } else if (a_entryObject.keywords["VendorItemOreIngot"] != undefined) { a_entryObject.subType = Item.MISC_INGOT; a_entryObject.subTypeDisplay = Translator.translate("$Ingot"); } else if (a_entryObject.keywords["VendorItemClutter"] != undefined) { a_entryObject.subType = Item.MISC_CLUTTER; a_entryObject.subTypeDisplay = Translator.translate("$Clutter"); } else if (a_entryObject.keywords["VendorItemFirewood"] != undefined) { a_entryObject.subType = Item.MISC_FIREWOOD; a_entryObject.subTypeDisplay = Translator.translate("$Firewood"); } } private function processMiscBaseId(a_entryObject: Object): Void { switch (a_entryObject.baseId) { case Form.BASEID_GEMAMETHYSTFLAWLESS: a_entryObject.subType = Item.MISC_GEM; a_entryObject.subTypeDisplay = Translator.translate("$Gem"); break; case Form.BASEID_RUBYDRAGONCLAW: case Form.BASEID_IVORYDRAGONCLAW: case Form.BASEID_GLASSCLAW: case Form.BASEID_EBONYCLAW: case Form.BASEID_EMERALDDRAGONCLAW: case Form.BASEID_DIAMONDCLAW: case Form.BASEID_IRONCLAW: case Form.BASEID_CORALDRAGONCLAW: case Form.BASEID_E3GOLDENCLAW: case Form.BASEID_SAPPHIREDRAGONCLAW: case Form.BASEID_MS13GOLDENCLAW: a_entryObject.subTypeDisplay = Translator.translate("$Claw"); a_entryObject.subType = Item.MISC_DRAGONCLAW; break; case Form.BASEID_LOCKPICK: a_entryObject.subType = Item.MISC_LOCKPICK; a_entryObject.subTypeDisplay = Translator.translate("$Lockpick"); break; case Form.BASEID_GOLD001: a_entryObject.subType = Item.MISC_GOLD; a_entryObject.subTypeDisplay = Translator.translate("$Gold"); break; case Form.BASEID_LEATHER01: a_entryObject.subTypeDisplay = Translator.translate("$Leather"); a_entryObject.subType = Item.MISC_LEATHER; break; case Form.BASEID_LEATHERSTRIPS: a_entryObject.subTypeDisplay = Translator.translate("$Strips"); a_entryObject.subType = Item.MISC_LEATHERSTRIPS; break; } } }
/******************************************************************************* * PushButton Engine * Copyright (C) 2009 PushButton Labs, LLC * For more information see http://www.pushbuttonengine.com * * This file is licensed under the terms of the MIT license, which is included * in the License.html file at the root directory of this SDK. ******************************************************************************/ package engine.framework.time { import engine.framework.core.PBComponent; /** * Base class for components that need to perform actions every tick. This * needs to be subclassed to be useful. */ public class TickedComponent extends PBComponent implements ITicked { /** * The update priority for this component. Higher numbered priorities have * onInterpolateTick and onTick called before lower priorities. */ public var updatePriority:Number = 0.0; private var _registerForUpdates:Boolean = true; private var _isRegisteredForUpdates:Boolean = false; private var _enabled:Boolean = true; [PBInject] public var timeManager:TimeManager; /** * Set to register/unregister for tick updates. */ public function set registerForTicks(value:Boolean):void { _registerForUpdates = value; if(_registerForUpdates && !_isRegisteredForUpdates) { // Need to register. _isRegisteredForUpdates = true; timeManager.addTickedObject(this, updatePriority); } else if(!_registerForUpdates && _isRegisteredForUpdates) { // Need to unregister. _isRegisteredForUpdates = false; timeManager.removeTickedObject(this); } } /** * @private */ public function get registerForTicks():Boolean { return _registerForUpdates; } /** * enabled do tick * this is a patch for register in time manager */ public function get enabled():Boolean{ return _enabled; } public function set enabled(v:Boolean):void { _enabled = v; } /** * @inheritDoc */ final public function onTick():void { // avoid memory leak to force remove this from time manager if(!owner) { timeManager.removeTickedObject(this); return; } if(_enabled) { applyBindings(); doTick(); } } /** * do tick, you need implement yourself * and don't call super in generally */ protected function doTick():void { } override protected function onAdd():void { super.onAdd(); // This causes the component to be registerd if it isn't already. registerForTicks = registerForTicks; } override protected function onRemove():void { super.onRemove(); // Make sure we are unregistered. registerForTicks = false; } } }
package org.as3commons.ui.layer.placement { /** * Value object containing the used placement values. * * <p>Values may differ from the specified one due to auto corrections.</p> */ public class UsedPlacement { /** * Used anchor of the fix object. */ public var sourceAnchor : uint; /** * Used anchor of the object to place. */ public var layerAnchor : uint; /** * Difference between the position determined by both used anchors * and the final calculated horizontal position. * * <p>A shift is set if the layer is auto corrected to fit specified * bounds.</p> */ public var hShift : int; /** * Difference between the position determined by both used anchors * and the final calculated vertical position. * * <p>A shift is set if the layer is auto corrected to fit specified * bounds.</p> */ public var vShift : int; /** * Indicates that anchors have been swapped horizontally. */ public var hSwapped : Boolean; /** * Indicates that anchors have been swapped vertically. */ public var vSwapped : Boolean; } }
package org.tuio.gestures { import flash.display.DisplayObject; import flash.utils.getTimer; import org.tuio.TuioContainer; import org.tuio.TuioEvent; import org.tuio.TouchEvent; public class OneFingerMoveGesture extends Gesture { public function OneFingerMoveGesture() { this.addStep(new GestureStep(TouchEvent.TOUCH_DOWN, { tuioContainerAlias:"A", targetAlias:"A" } )); this.addStep(new GestureStep(TouchEvent.TOUCH_MOVE, { die:true, tuioContainerAlias:"!B", targetAlias:"A" } )); this.addStep(new GestureStep(TouchEvent.TOUCH_UP, { die:true, tuioContainerAlias:"A" } )); this.addStep(new GestureStep(TouchEvent.TOUCH_MOVE, { tuioContainerAlias:"A", targetAlias:"A", goto:2 } )); } public override function dispatchGestureEvent(target:DisplayObject, gsg:GestureStepSequence):void { trace("one finger move" + getTimer()); } } }
package com.company.util { import flash.display.BitmapData; import flash.geom.Matrix; import flash.geom.Point; import flash.geom.Rectangle; import flash.utils.Dictionary; public class BitmapUtil { internal static const zeroPoint:Point = new Point(0, 0); internal static var rect:Rectangle = new Rectangle(); public static function mirror(_arg_1:BitmapData, _arg_2:int = 0):BitmapData { var _local5:int = 0; var _local6:int = 0; if (_arg_2 == 0) { _arg_2 = _arg_1.width; } var _local4:int = _arg_1.height; var _local3:BitmapData = new BitmapData(_arg_1.width, _local4, true, 0); while (_local6 < _arg_2) { _local5 = 0; while (_local5 < _local4) { _local3.setPixel32(_arg_2 - _local6 - 1, _local5, _arg_1.getPixel32(_local6, _local5)); _local5++; } _local6++; } return _local3; } public static function rotateBitmapData(_arg_1:BitmapData, _arg_2:int):BitmapData { var _local4:Matrix = new Matrix(); _local4.translate(-_arg_1.width * 0.5, -_arg_1.height * 0.5); _local4.rotate(_arg_2 * 1.5707963267949); _local4.translate(_arg_1.height * 0.5, _arg_1.width * 0.5); var _local3:BitmapData = new BitmapData(_arg_1.height, _arg_1.width, true, 0); _local3.draw(_arg_1, _local4); return _local3; } public static function cropToBitmapData(_arg_1:BitmapData, _arg_2:int, _arg_3:int, _arg_4:int, _arg_5:int):BitmapData { var _local6:BitmapData = new BitmapData(_arg_4, _arg_5); rect.x = _arg_2; rect.y = _arg_3; rect.width = _arg_4; rect.height = _arg_5; _local6.copyPixels(_arg_1, rect, zeroPoint); return _local6; } public static function amountTransparent(_arg_1:BitmapData):Number { var _local5:int = 0; var _local4:* = 0; var _local2:int = 0; var _local6:int = 0; var _local3:int = _arg_1.width; var _local7:int = _arg_1.height; while (_local6 < _local3) { _local5 = 0; while (_local5 < _local7) { _local4 = uint(_arg_1.getPixel32(_local6, _local5) & 4278190080); if (_local4 == 0) { _local2++; } _local5++; } _local6++; } return _local2 / (_local3 * _local7); } public static function mostCommonColor(_arg1:BitmapData):uint { var _local3:uint; var _local7:String; var _local8:int; var _local9:int; var _local2:Dictionary = new Dictionary(); var _local4:int; while (_local4 < _arg1.width) { _local8 = 0; while (_local8 < _arg1.width) { _local3 = _arg1.getPixel32(_local4, _local8); if ((_local3 & 0xFF000000) != 0) { if (!_local2.hasOwnProperty(_local3.toString())) { _local2[_local3] = 1; } else { var _local10:Dictionary = _local2; var _local11:uint = _local3; var _local12:uint = (_local10[_local11] + 1); _local10[_local11] = _local12; } } _local8++; } _local4++; } var _local5:uint; var _local6:uint; for (_local7 in _local2) { _local3 = parseInt(_local7); _local9 = _local2[_local7]; if ((((_local9 > _local6)) || ((((_local9 == _local6)) && ((_local3 > _local5)))))) { _local5 = _local3; _local6 = _local9; } } return (_local5); } public static function lineOfSight(_arg_1:BitmapData, _arg_2:IntPoint, _arg_3:IntPoint):Boolean { var _local18:* = 0; var _local17:int = 0; var _local15:int = 0; var _local5:int = 0; var _local11:* = int(_arg_1.width); var _local6:* = int(_arg_1.height); var _local10:* = int(_arg_2.x()); var _local8:* = int(_arg_2.y()); var _local14:* = int(_arg_3.x()); var _local13:* = int(_arg_3.y()); var _local7:* = (_local8 > _local13 ? _local8 - _local13 : Number(_local13 - _local8)) > (_local10 > _local14 ? _local10 - _local14 : Number(_local14 - _local10)); if (_local7) { _local18 = _local10; _local10 = _local8; _local8 = _local18; _local18 = _local14; _local14 = _local13; _local13 = _local18; _local18 = _local11; _local11 = _local6; _local6 = _local18; } if (_local10 > _local14) { _local18 = _local10; _local10 = _local14; _local14 = _local18; _local18 = _local8; _local8 = _local13; _local13 = _local18; } var _local16:int = _local14 - _local10; var _local20:int = _local8 > _local13 ? _local8 - _local13 : Number(_local13 - _local8); var _local19:int = -(_local16 + 1) * 0.5; var _local9:int = _local8 > _local13 ? -1 : 1; var _local21:int = _local14 > _local11 - 1 ? _local11 - 1 : _local14; var _local4:* = _local8; var _local12:* = _local10; if (_local12 < 0) { _local19 = _local19 + _local20 * -_local12; if (_local19 >= 0) { _local17 = _local19 / _local16 + 1; _local4 = _local4 + _local9 * _local17; _local19 = _local19 - _local17 * _local16; } _local12 = 0; } if (_local9 > 0 && _local4 < 0 || _local9 < 0 && _local4 >= _local6) { _local15 = _local9 > 0 ? -_local4 - 1 : Number(_local4 - _local6); _local19 = _local19 - _local16 * _local15; _local5 = -_local19 / _local20; _local12 = _local12 + _local5; _local19 = _local19 + _local5 * _local20; _local4 = _local4 + _local15 * _local9; } while (_local12 <= _local21) { if (!(_local9 > 0 && _local4 >= _local6 || _local9 < 0 && _local4 < 0)) { if (_local7) { if (_local4 >= 0 && _local4 < _local6 && _arg_1.getPixel(_local4, _local12) == 0) { return false; } } else if (_local4 >= 0 && _local4 < _local6 && _arg_1.getPixel(_local12, _local4) == 0) { return false; } _local19 = _local19 + _local20; if (_local19 >= 0) { _local4 = _local4 + _local9; _local19 = _local19 - _local16; } _local12++; continue; } break; } return true; } public function BitmapUtil(_arg_1:StaticEnforcer_2478) { super(); } } } class StaticEnforcer_2478 { function StaticEnforcer_2478() { super(); } }
package net.richardlord.coral.point { import com.gskinner.performance.MethodTest; import com.gskinner.performance.TestSuite; import net.richardlord.coral.Point3d; import net.richardlord.coral.Utils; public class PointAssignTest extends TestSuite { private var loops : uint = 500000; private var p1 : Point3d; private var p2 : Point3d; private var p3 : Point3d; public function PointAssignTest() { name = "VectorAssignTest"; description = "Comparing assign on Vectors " + loops + " loops."; tareTest = new MethodTest( tare ); iterations = 4; tests = [ new MethodTest( assignPoint, null, "assignPoint", 0, 1, "Point3d.assign( v )" ), ]; p1 = new Point3d(); p2 = Utils.randomPoint(); p3 = Utils.randomPoint(); } public function tare() : void { for (var i : uint = 0; i < loops; i++) { } } public function assignPoint() : void { for (var i : uint = 0; i < loops; i++) { p1.assign( p2 ); p1.assign( p3 ); } } } }
/* * =BEGIN CLOSED LICENSE * * Copyright (c) 2013-2014 Andras Csizmadia * http://www.vpmedia.eu * * For information about the licensing and copyright please * contact Andras Csizmadia at andras@vpmedia.eu * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * =END CLOSED LICENSE */ package hu.vpmedia.components.themes.simple { import hu.vpmedia.components.core.BaseStyleSheet; import hu.vpmedia.shapes.core.ShapeConfig; import hu.vpmedia.shapes.textures.SolidFill; import hu.vpmedia.shapes.textures.SolidStroke; /** * @inheritDoc */ public class ComboBoxStyleSheet extends BaseStyleSheet { public var backgroundDefault:ShapeConfig; public var backgroundOver:ShapeConfig; public var iconDefault:ShapeConfig; public var iconOver:ShapeConfig; public function ComboBoxStyleSheet() { super(); } /** * @inheritDoc */ override protected function initialize():void { backgroundDefault = new ShapeConfig(); var fill:SolidFill = new SolidFill(); fill.color = ThemeConfig.FILL_DEFAULT_COLOR; backgroundDefault.fill = fill; var stroke:SolidStroke = new SolidStroke(); stroke.color = ThemeConfig.STROKE_DEFAULT_COLOR; backgroundDefault.stroke = stroke; backgroundOver = new ShapeConfig(); fill = new SolidFill(); fill.color = ThemeConfig.FILL_OVER_COLOR; backgroundOver.fill = fill; stroke = new SolidStroke(); stroke.color = ThemeConfig.STROKE_OVER_COLOR; backgroundOver.stroke = stroke; } } }
/** * lightwriting.Canvas * * * @author Andrew Sevenson */ package lightwriting { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BlendMode; import flash.geom.Matrix; import flash.geom.Point; public class Canvas extends BitmapData { private static const ZERO_POINT:Point = new Point(); private var _brushPoint:Point = new Point(0, 0); private var _speedScale:Number = 1; public var brush:BitmapData; public var useSpeedScale:Boolean = false; public var blendMode:String = BlendMode.NORMAL;; /** * Creates a new instance of the Canvas class. */ public function Canvas (width:Number=600, height:Number=400, transparent:Boolean = true, fillColor:uint = 0xffffffff) : void { super(width, height, transparent, fillColor); } // STATIC PUBLIC FUNCTIONS // ------------------------------------------------------------------------------------------ // STATIC PRIVATE FUNCTIONS // ------------------------------------------------------------------------------------------ // PUBLIC FUNCTIONS // ------------------------------------------------------------------------------------------ /** * A clean up routine that destroys all external references to prepare the class for garbage collection. */ public function destroy () : void { dispose(); brush = null; } /** * Moves the brush head to the given point without drawing a line * @param x * @param y */ public function moveTo(x:Number, y:Number):void { _brushPoint.x = x; _brushPoint.y = y; } /** * Draws the current brush from the last point to this new point * @param x * @param y */ public function lineTo(x:Number, y:Number):void { if (!brush) return; // bail if there are no brushes var dir:Point = new Point(x - _brushPoint.x, y - _brushPoint.y); var len:Number = Math.sqrt(dir.x * dir.x + dir.y * dir.y); var steps:uint = Math.ceil(len); // normalize the direction dir.x /= len; dir.y /= len; var speedScalePerc:Number = (useSpeedScale) ? 1 - clamp( (len - 10) / 20, 0.01, 0.5) : 1; var drawPT:Point = new Point(); // reset the draw point drawPT.x = _brushPoint.x + dir.x; drawPT.y = _brushPoint.y + dir.y // loop through all of the steps for (var i:uint = 0; i < steps; i++) { drawPT.x += dir.x; drawPT.y += dir.y; if (i == steps - 1) { drawPT.x = x, drawPT.y = y; } drawBrushAtPoint(drawPT.x, drawPT.y, speedScalePerc); } // store this as the last place the brush was _brushPoint.x = x; _brushPoint.y = y; } private function clamp (value:Number, lowerBound:Number = 5e-324, upperBound:Number = 1.79e+308) : Number { if (value < lowerBound) return lowerBound; if (value > upperBound) return upperBound; return value; } // PRIVATE FUNCTIONS // ------------------------------------------------------------------------------------------ /** * Draws the current brush bitmap at the given point * @param x * @param y */ private function drawBrushAtPoint(x:Number, y:Number, targetScale:Number=1):void { if (!brush) return; if (useSpeedScale) { _speedScale += (targetScale - _speedScale) * 0.2; var m:Matrix = new Matrix(); m.scale(_speedScale, _speedScale); m.translate(x - (brush.width*_speedScale) * 0.5, y - (brush.height*_speedScale) * 0.5); draw(brush, m, null, blendMode, null, true); } else { _speedScale = 1; var pt:Point = new Point( Math.round(x - brush.width*0.5), Math.round(y - brush.width*0.5) ); copyPixels(brush, brush.rect, pt, brush, ZERO_POINT, true); } } // EVENT HANDLERS // ------------------------------------------------------------------------------------------ // GETTERS & SETTERS // ------------------------------------------------------------------------------------------ } }
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import com.adobe.test.Assert; var gTestfile = 'regress-247179.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 247179; var summary = 'RegExp \\b should not recognize non-ASCII alphanumerics as word characters'; var actual = ''; var expect = ''; //printBugNumber(BUGNUMBER); //printStatus (summary); expect = 3; actual = "m\ucc44nd".split(/\b/).length; Assert.expectEq(summary, expect, actual); expect = 4; actual = "m\ucc44nd".split(/\w/).length; Assert.expectEq('RegExp \\w should not recognize non-ASCII alphanumerics as word characters', expect, actual);
package limitGifted.command { import com.tencent.morefun.framework.base.Command; import def.PluginDef; public class LimitGiftedCommand extends Command { public function LimitGiftedCommand(param1:int = 2, param2:Boolean = true) { super(param1,param2); } override public function getPluginName() : String { return PluginDef.LIMITGIFTED; } } }
global __ozcustomisr,_ozserialgetc,_ozintwait,_ozkeyclick,__ozserbufget,__ozserbufput global _ozexitrestoreint,KeyBufGetPos,KeyBufPutPos,KeyboardBuffer,__ozclick_setting global __oz64hz_word global __oz64hz_dword global __ozrxhandshaking,__ozrxxoff psect data __ozrxhandshaking: defb 0 __ozrxxoff: defb 0 psect text PauseFirst equ 32 PauseBetween equ 5 BufLen EQU 256 _ozintwait: ;; waits for a keystroke, serial data, or interrupt event ld a,(__ozserbufget) ld c,a ld a,(__ozserbufput) cp c ret nz ld a,(KeyBufGetPos) ld c,a ld a,(KeyBufPutPos) cp c ret nz halt ret __ozcustomisr: in a,(46h) and 16 jp nz,_ozexitrestoreint ;; power switch depressed - get out quickly in a,(12h) and 128 jp z,_ozexitrestoreint ;; battery switch flipped - get out rapidly in a,(5) ld d,a ld a,0ffh out (6),a in a,(45h) and 1 jp z,GetOutPopAF in a,(40h) push hl ld e,a ld hl,__ozserbufput ld a,(hl) ld c,a inc a dec hl ; hl=__ozserbufget cp (hl) jr z,BufferFull inc hl ; hl=__ozserbufput ld (hl),a ld b,0 inc hl ; hl=SerialBuffer add hl,bc ld (hl),e ld hl,__ozserbufget sub (hl) ; a=buffer size cp 200 jr c,noXOFF ld a,(__ozrxhandshaking) or a jr z,noXOFF ld a,(__ozrxxoff) or a jr nz,noXOFF waittop: in a,(45h) and 20h jr z,waittop ld a,19 ; XOFF out (40h),a ld a,1 ld (__ozrxxoff),a noXOFF: BufferFull: pop hl GetOutPopAF: ei ld a,d ; from port (5) and 32 ;+16 jp nz,KbdAndClock ret KbdAndClock: ld a,(keybusy) or a ret nz dec a ; a=ff ld (keybusy),a jp key_isr key_isr_ret: xor a ld (keybusy),a ret psect bss __oz64hz_word: __oz64hz_dword: defs 4 keybusy: defs 1 __ozserbufget: defs 1 __ozserbufput: defs 1 SerialBuffer: defs BufLen ; Keyboard driver adapted from software labeled: ; Source code free for non-commercial use ; Assembled program (C)2000 OZdev <http://www.ozdev.com/> ; Benjamin Green <benjamin@lh.co.nz> keyTable: defs 10 ;; global _mask10,_mask11,_repeatcount,_repeatkey _mask10: defs 1 _mask11: defs 1 _repeatcount: defs 1 _repeatkey: defs 2 Mask2nd equ 01h MaskNew equ 02h MaskInv equ 04h MaskShift equ 08h kUpperMenu equ 8068h kUpperEnter equ 8066h kUpperEsc equ 8067h kEnter equ 8038h kLShift equ 0000h kRShift equ 8836h k2nd equ 8137h kEsc equ 8058h kMenu equ 8032h kNew equ 8233h kInv equ 8435h kUp equ 8040h kDown equ 8041h kRight equ 8043h kLeft equ 8042h kMain equ 7025h kTel equ 70e9h kSched equ 70eah kMemo equ 70ebh kMyProg equ 7015h kLight equ 803bh kPageUp equ 8044h kPageDown equ 8045h psect text key_isr: push bc push de push hl ld hl,(__oz64hz_dword) ld bc,1 add hl,bc ld (__oz64hz_dword),hl ld hl,(__oz64hz_dword+2) ld bc,0 adc hl,bc ld (__oz64hz_dword+2),hl ld a,(__ozrxxoff) or a jr z,NoXOFFcheck ld hl,__ozserbufput ld a,(hl) dec hl ; hl=__ozserbufget sub (hl) cp 150 jr nc,NoXOFFcheck waittop2: in a,(45h) and 20h jr z,waittop2 ld a,17 ; XON out (40h),a xor a ld (__ozrxxoff),a NoXOFFcheck: ld a,(KeyBufPutPos) inc a cp 0ch jr c,dontzero xor a dontzero: ld b,a ld a,(KeyBufGetPos) cp b jp z,KBufferFull xor a out (11h),a ld a,2 out (12h),a ld hl,keyTable+8 in a,(10h) ld b,(hl) ld (hl),a or b xor b and a jr z,noProgKey1 bitP0: bit 0,a jr z,bitP1 ld a,56 jp lookup bitP1: bit 1,a jr z,bitP2 ld a,57 jr lookup bitP2: bit 2,a jr z,bitP3 ld a,58 jr lookup bitP3: bit 3,a jr z,bitP4 ld a,59 jr lookup bitP4: bit 4,a jr z,bitP6 ld a,60 jr lookup bitP6: bit 6,a jr z,noProgKey1 ld a,61 jr lookup noProgKey1: ld a,1 out (12h),a ld hl,keyTable+9 in a,(10h) ld b,(hl) ld (hl),a or b xor b and a jr z,noProgKey2 abitP0: bit 0,a jr z,abitP3 ld a,62 jp lookup abitP3: bit 3,a jr z,abitP4 ld a,63 jr lookup abitP4: bit 4,a jr z,abitP5 ld a,64 jr lookup abitP5: bit 5,a jr z,abitP6 ld a,65 jr lookup abitP6: bit 6,a jr z,noProgKey2 ld a,66 lookup: ld e,a xor a ld (_mask11),a jr lookup2 noProgKey2: xor a out (12h),a ld hl,keyTable ld de,100h keyscan: ld a,d out (11h),a in a,(10h) ld b,(hl) ld (hl),a or b xor b and a jr nz,bit0 inc e inc hl sla d jr nz,keyscan bit0: bit 0,a jr z,bit1 ld a,e ld l,1 jr rlookup bit1: bit 1,a jr z,bit2 ld a,e add a,8 ld l,2 jr rlookup bit2: bit 2,a jr z,bit3 ld a,e add a,16 ld l,4 jr rlookup bit3: bit 3,a jr z,bit4 ld a,e add a,24 ld l,8 jr rlookup bit4: bit 4,a jr z,bit5 ld a,e add a,32 ld l,16 jr rlookup bit5: bit 5,a jr z,bit6 ld a,e add a,40 ld l,32 jr rlookup bit6: bit 6,a jr z,nokey ld a,e add a,48 ld l,64 rlookup: ld e,a ld a,l ld hl,_mask10 ld (hl),a inc hl ; =_mask11 ld (hl),d lookup2: xor a ld hl,keyTable ld b,(hl) bit 6,b jr z,no2nd ld a,Mask2nd no2nd: bit 5,b jr nz,shift ld hl,keyTable+6 bit 3,(hl) jr z,noShift shift: or MaskShift noShift: ld hl,keyTable+3 bit 6,(hl) jr z,noInv or MaskInv noInv: dec hl bit 6,(hl) jr z,noNew or MaskNew noNew: lookupKey: ld b,a ld hl,keys ld d,0 add hl,de add hl,de ld a,(hl) ld c,a inc hl ld a,(hl) xor b ld b,a ld hl,_repeatcount ld (hl),PauseFirst inc hl ; =_repeatkey ld (hl),c inc hl ld (hl),b putinbuf: ld a,(__ozclick_setting) or a call nz,_ozkeyclick putinbuf_noclick: ld a,(KeyBufPutPos) inc a cp 0ch jr c,dontzero2 xor a dontzero2: ld (KeyBufPutPos),a ld e,a ld d,0 ld hl,KeyboardBuffer add hl,de add hl,de ld (hl),c inc hl ld (hl),b KBufferFull: iret: ld a,0ffh out (11h),a out (12h),a pop hl pop de pop bc jp key_isr_ret clearrepeat: xor a ld (_mask11),a ; hl=_mask11 jr iret nokey: ld hl,_mask11 xor a or (hl) jr z,iret ; nothing to repeat ld c,a inc hl ; =_repeatcount inc hl ; =_repeatkey ld hl,_repeatkey xor a ld b,(hl) or b jr z,clearrepeat ; lower shift - do not repeat inc hl ld a,080h and (hl) jr z,doRepeat ; not any other shift key ld a,b cp kRShift.and.0ffh jr z,clearrepeat cp kNew.and.0ffh jr z,clearrepeat cp kInv.and.0ffh jr z,clearrepeat cp k2nd.and.0ffh jr z,clearrepeat doRepeat: ld hl,_mask10 ld a,c out (11h),a ; set mask xor a out (12h),a in a,(10h) and (hl) ; (_mask10) inc hl ; =_mask11 jr z,clearrepeat ; key to be repeated released inc hl ; =_repeatcount dec (hl) ld a,(hl) or a jr nz,iret ; not time yet ld (hl),PauseBetween inc hl ; =_repeatkey ld c,(hl) inc hl ld b,(hl) jr putinbuf_noclick keys: defw kEsc,'1','2','3','4','5','6','7' defw 'q','w','e','r','t','8','9','0' defw 0,'y','u','i','o','p',8,'.' defw 'g','h','j','k','l',13,kRShift,',' defw 'a','s','d','f',kLeft,kDown,kRight,kUp defw kLShift,'z','x','c','v','b','n','m' defw k2nd,kMenu,kNew,kInv,' ','-',kEnter,0 defw kMain,kTel,kSched,kMemo,kMyProg,kLight defw kUpperMenu,kUpperEsc,kUpperEnter,kPageUp,kPageDown _ozserialgetc: ld a,(__ozserbufget) ld e,a ld a,(__ozserbufput) cp e jr z,NothingInBuffer ld l,e ld h,0 ld bc,SerialBuffer add hl,bc ld a,(hl) ld l,a ld h,0 ld a,e inc a ld (__ozserbufget),a ret NothingInBuffer: ld hl,-1 ret _ozkeyclick: in a,(15h) and a ret nz ; bell char takes priority ld a,1 out (19h),a out (16h),a xor a keyclick: dec a jr nz,keyclick out (16h),a dontClick: ret
package com.krzepa.utils { import flash.display.*; import flash.events.*; public class EFDelay { public static var maxFrames:uint = 100; private static var _currentFrame:uint; public static var stage:Stage; private static var _actions:Array = []; private static var _flashvarsCallback:Function; private static var _flashvars:Object; private static var _flashvarsNames:Array; public function EFDelay() { super(); } public static function waitForFlashVars( flashvars:Object, requiredFlashVarsNames:Array, flashvarsReadyCallback:Function ):void { _flashvarsCallback = flashvarsReadyCallback; _flashvarsNames = requiredFlashVarsNames; _flashvars = flashvars; stage.addEventListener( Event.ENTER_FRAME, checkFlashvars ); _currentFrame = 0; } /* sprawdza flashvary bez wzgledu na wielkosc liter */ private static function checkFlashvars( evt:Event ):void { if(++_currentFrame > maxFrames) { stage.removeEventListener( Event.ENTER_FRAME, checkFlashvars ); _flashvarsCallback(null); return; } for( var i:uint = 0 ; i < _flashvarsNames.length ; ++i ) { if( !StrUtils.isSet(_flashvars[_flashvarsNames[i]]) && !StrUtils.isSet(_flashvars[String(_flashvarsNames[i]).toLowerCase()]) ) { return; } } stage.removeEventListener( Event.ENTER_FRAME, checkFlashvars ); _flashvarsCallback(_flashvars); } public static function removeMethod( closureFunction:Function ):void { var action:Action; var i:uint; while (i < _actions.length) { action = (_actions[i] as Action); if (action.func == closureFunction){ _actions.splice(i, 1); }; i++; }; } private static function executeMethods( evt:Event ):void { var i:uint; var item:Object; if (_actions.length){ i = 0; while (i < _actions.length) { item = _actions[i]; if (--item.frames <= 0){ if( item.args && item.args.length ) { item.func.call(null, item.args); } else { item.func.call(null); } _actions.splice(i, 1); } else { i++; }; }; } else { stage.removeEventListener(Event.ENTER_FRAME, executeMethods ); }; } public static function callMethod(closureFunction:Function, args:Array=null, framesDelay:uint=1):void { if (!stage){ throw (new Error("EFDealy > stage is not assigned!")); }; _actions.push(new Action(closureFunction, args, framesDelay)); stage.addEventListener( Event.ENTER_FRAME, executeMethods ); } } } class Action { public var func:Function; public var frames:uint; public var args:Array; function Action(func:Function, args:Array, frames:uint){ this.func = func; this.args = args; this.frames = frames; } }
//////////////////////////////////////////////////////////////////////////////// // // 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.beads { /** * The MultiSelectionItemRendererClassFactory class extends ItemRendererClassFactory to add a multiselection controller to item renderers * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9.7 */ import org.apache.royale.core.IBeadController; import org.apache.royale.core.IItemRendererOwnerView; import org.apache.royale.core.IBead; import org.apache.royale.core.ItemRendererClassFactory; import org.apache.royale.core.IItemRenderer; import org.apache.royale.core.IStrand; import org.apache.royale.html.beads.controllers.MultiSelectionItemRendererMouseController; public class MultiSelectionItemRendererClassFactory extends ItemRendererClassFactory { /** * Constructor. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9.7 */ public function MultiSelectionItemRendererClassFactory() { super(); } override public function createFromClass():IItemRenderer { var renderer:IItemRenderer = super.createFromClass(); var strand:IStrand = renderer as IStrand; var bead:IBead = strand.getBeadByType(IBeadController); if (bead) { strand.removeBead(bead); } strand.addBead(new MultiSelectionItemRendererMouseController()); return renderer; } } }
/* * Copyright 2018 Tua Rua Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tuarua.firebase.remoteconfig.events { import flash.events.ErrorEvent; public class RemoteConfigErrorEvent extends ErrorEvent { public static const FETCH_ERROR:String = "RemoteConfigErrorEvent.FetchError"; public static const ACTIVATE_ERROR:String = "RemoteConfigErrorEvent.ActivateError"; public function RemoteConfigErrorEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, text:String = "", id:int = 0) { super(type, bubbles, cancelable, text, id); } } }
package org.spicefactory.parsley.config.asconfig { import org.spicefactory.parsley.testmodel.ClassWithSimpleProperties; import org.spicefactory.parsley.testmodel.LazyTestClass; /** * @author Jens Halm */ public class AsConfig2 { [ObjectDefinition(id="foo")] public function get overwrittenId () : ClassWithSimpleProperties { return new ClassWithSimpleProperties(); } [DynamicObject] public function get prototypeInstance () : ClassWithSimpleProperties { return new ClassWithSimpleProperties(); } [ObjectDefinition(lazy="true")] public function get lazyInstance () : LazyTestClass { return new LazyTestClass(); } public function get eagerInstance () : LazyTestClass { return new LazyTestClass(); } [Internal] public function get notIncludedInContext () : Object { return null; } } }
package { public class Test {} } if(2 != "2") { trace("ERROR: 2 != \"2\""); } if(2 != 2) { trace("ERROR: 2 != 2"); } if(2 != 5) { trace("2 != 5"); } if(true != true) { trace("ERROR: true != true"); } if(false != false) { trace("ERROR: false != false"); } if(true != false) { trace("true != false"); } if(1 != true) { trace("ERROR: 1 != true"); } if(0 != false) { trace("ERROR: 0 != false"); } if("abc" != "abc") { trace("ERROR: \"abc\" != \"abc\""); } if(0 != undefined) { trace("0 != undefined"); } if(undefined != undefined) { trace("ERROR: undefined != undefined"); } if(NaN != NaN) { trace("NaN != NaN"); } if(undefined != NaN) { trace("undefined != NaN"); } if(0 != null) { trace("0 != null"); } if(null != null) { trace("ERROR: null != null"); } if(undefined != null) { trace("ERROR: undefined != null"); } if(NaN != null) { trace("NaN != null"); }
package io.decagames.rotmg.ui.spinner { import io.decagames.rotmg.ui.sliceScaling.SliceScalingBitmap; public class FixedNumbersSpinner extends NumberSpinner { public function FixedNumbersSpinner(_arg_1: SliceScalingBitmap, _arg_2: int, _arg_3: Vector.<int>, _arg_4: String = "") { super(_arg_1, _arg_2, 0, _arg_3.length - 1, 1, _arg_4); this._numbers = _arg_3; this.updateLabel(); } private var _numbers: Vector.<int>; override public function get value(): int { return this._numbers[_value]; } override public function set value(_arg_1: int): void { var _local2: int = _value; _value = this._numbers.indexOf(_arg_1); if (_value < 0) { _value = 0; } if (_value != _local2) { valueWasChanged.dispatch(this.value); } this.updateLabel(); } override protected function updateLabel(): void { label.text = this._numbers[_value] + suffix; label.x = -label.width / 2; } } }
package com.company.assembleegameclient.sound { import com.company.assembleegameclient.parameters.Parameters; import flash.events.Event; import flash.events.IOErrorEvent; import flash.media.Sound; import flash.media.SoundChannel; import flash.media.SoundTransform; import flash.net.URLRequest; import flash.utils.Dictionary; import kabam.rotmg.application.api.ApplicationSetup; import kabam.rotmg.core.StaticInjectorContext; public class SoundEffectLibrary { private static const URL_PATTERN:String = "{URLBASE}/sfx/{NAME}.mp3"; public static var nameMap_:Dictionary = new Dictionary(); private static var urlBase:String; private static var activeSfxList_:Dictionary = new Dictionary(true); public static function load(name:String):Sound { return nameMap_[name] = nameMap_[name] || makeSound(name); } public static function makeSound(name:String):Sound { var sound:Sound = new Sound(); sound.addEventListener(IOErrorEvent.IO_ERROR, onIOError); sound.load(makeSoundRequest(name)); return sound; } public static function play(name:String, volume:Number = 1.0, isFX:Boolean = true):void { var playFX:Boolean = Parameters.data.playSFX && isFX || !isFX && Parameters.data.playPewPew; if (!playFX) { return; } var actualVolume:Number = NaN; var trans:SoundTransform = null; var channel:SoundChannel = null; var sound:Sound = load(name); try { actualVolume = Number(volume); trans = new SoundTransform(actualVolume); channel = sound.play(0, 0, trans); channel.addEventListener(Event.SOUND_COMPLETE, onSoundComplete, false, 0, true); activeSfxList_[channel] = volume; } catch (error:Error) { trace("ERROR playing " + name + ": " + error.message); } } public static function updateTransform():void { var channel:SoundChannel = null; var transform:SoundTransform = null; for each(channel in activeSfxList_) { transform = channel.soundTransform; transform.volume = !!Boolean(Parameters.data.playSFX) ? Number(Number(activeSfxList_[channel])) : Number(Number(0)); channel.soundTransform = transform; } } private static function getUrlBase():String { var setup:ApplicationSetup = null; var base:String = ""; try { setup = StaticInjectorContext.getInjector().getInstance(ApplicationSetup); base = setup.getAppEngineUrl(true); } catch (error:Error) { base = "localhost"; } return base; } private static function makeSoundRequest(name:String):URLRequest { urlBase = urlBase || getUrlBase(); var url:String = URL_PATTERN.replace("{URLBASE}", urlBase).replace("{NAME}", name); return new URLRequest(url); } public function SoundEffectLibrary() { super(); } public static function onIOError(event:IOErrorEvent):void { trace("ERROR loading sound: " + event.text); } private static function onSoundComplete(e:Event):void { var channel:SoundChannel = e.target as SoundChannel; delete activeSfxList_[channel]; } } }
package laya.d3.loaders { import laya.d3.core.material.BaseMaterial; import laya.d3.graphics.IndexBuffer3D; import laya.d3.graphics.VertexBuffer3D; import laya.d3.graphics.VertexDeclaration; import laya.d3.graphics.VertexPosition; import laya.d3.graphics.VertexPositionNTBTexture; import laya.d3.graphics.VertexPositionNTBTexture0Texture1Skin; import laya.d3.graphics.VertexPositionNormal; import laya.d3.graphics.VertexPositionNormalColor; import laya.d3.graphics.VertexPositionNormalColorSkin; import laya.d3.graphics.VertexPositionNormalColorSkinTangent; import laya.d3.graphics.VertexPositionNormalColorTangent; import laya.d3.graphics.VertexPositionNormalColorTexture; import laya.d3.graphics.VertexPositionNormalColorTexture0Texture1; import laya.d3.graphics.VertexPositionNormalColorTexture0Texture1Skin; import laya.d3.graphics.VertexPositionNormalColorTexture0Texture1SkinTangent; import laya.d3.graphics.VertexPositionNormalColorTexture0Texture1Tangent; import laya.d3.graphics.VertexPositionNormalColorTextureSkin; import laya.d3.graphics.VertexPositionNormalColorTextureSkinTangent; import laya.d3.graphics.VertexPositionNormalColorTextureTangent; import laya.d3.graphics.VertexPositionNormalTangent; import laya.d3.graphics.VertexPositionNormalTexture; import laya.d3.graphics.VertexPositionNormalTexture0Texture1; import laya.d3.graphics.VertexPositionNormalTexture0Texture1Skin; import laya.d3.graphics.VertexPositionNormalTexture0Texture1SkinTangent; import laya.d3.graphics.VertexPositionNormalTexture0Texture1Tangent; import laya.d3.graphics.VertexPositionNormalTextureSkin; import laya.d3.graphics.VertexPositionNormalTextureSkinTangent; import laya.d3.graphics.VertexPositionNormalTextureTangent; import laya.d3.math.Matrix4x4; import laya.d3.resource.models.Mesh; import laya.d3.resource.models.SubMesh; import laya.net.Loader; import laya.utils.Byte; import laya.webgl.WebGLContext; /** * @private * <code>LoadModel</code> 类用于模型加载。 */ public class LoadModelV03 { /**@private */ private static var _attrReg:RegExp =/*[STATIC SAFE]*/ new RegExp("(\\w+)|([:,;])", "g");//切割字符串正则 /**@private */ private static var _BLOCK:Object = {count: 0}; /**@private */ private static var _DATA:Object = {offset: 0, size: 0}; /**@private */ private static var _strings:Array = []; /**@private */ private static var _readData:Byte; /**@private */ private static var _version:String; /**@private */ private static var _mesh:Mesh; /**@private */ private static var _subMeshes:Vector.<SubMesh>; /**@private */ private static var _materialMap:Object; /** * @private */ public static function parse(readData:Byte, version:String, mesh:Mesh, subMeshes:Vector.<SubMesh>, materialMap:Object):void { _mesh = mesh; _subMeshes = subMeshes; _materialMap = materialMap; _version = version; _readData = readData; READ_DATA(); READ_BLOCK(); READ_STRINGS(); for (var i:int = 0, n:int = _BLOCK.count; i < n; i++) { _readData.pos = _BLOCK.blockStarts[i]; var index:int = _readData.getUint16(); var blockName:String = _strings[index]; var fn:Function = LoadModelV03["READ_" + blockName]; if (fn == null) throw new Error("model file err,no this function:" + index + " " + blockName); else fn.call(); } _strings.length = 0; _readData = null; _version = null; _mesh = null; _subMeshes = null; _materialMap = null; } /** * @private */ private static function _readString():String { return _strings[_readData.getUint16()]; } /** * @private */ private static function READ_DATA():void { _DATA.offset = _readData.getUint32(); _DATA.size = _readData.getUint32(); } /** * @private */ private static function READ_BLOCK():void { var count:uint = _BLOCK.count = _readData.getUint16(); var blockStarts:Array = _BLOCK.blockStarts = []; var blockLengths:Array = _BLOCK.blockLengths = []; for (var i:int = 0; i < count; i++) { blockStarts.push(_readData.getUint32()); blockLengths.push(_readData.getUint32()); } } /** * @private */ private static function READ_STRINGS():void { var offset:uint = _readData.getUint32(); var count:uint = _readData.getUint16(); var prePos:int = _readData.pos; _readData.pos = offset + _DATA.offset; for (var i:int = 0; i < count; i++) _strings[i] = _readData.readUTFString(); _readData.pos = prePos; } /** * @private */ private static function READ_MESH():Boolean { var name:String = _readString(); var arrayBuffer:ArrayBuffer = _readData.__getBuffer(); var i:int, n:int; var vertexBufferCount:uint = _readData.getInt16(); var offset:int = _DATA.offset; for (i = 0; i < vertexBufferCount; i++) { var vbStart:uint = offset + _readData.getUint32(); var vbLength:uint = _readData.getUint32(); var vbDatas:Float32Array = new Float32Array(arrayBuffer.slice(vbStart, vbStart + vbLength)); var bufferAttribute:String = _readString(); var shaderAttributes:Array = bufferAttribute.match(_attrReg); var vertexDeclaration:VertexDeclaration = _getVertexDeclaration(shaderAttributes); var vertexBuffer:VertexBuffer3D = VertexBuffer3D.create(vertexDeclaration, (vbDatas.length * 4) / vertexDeclaration.vertexStride, WebGLContext.STATIC_DRAW, true); vertexBuffer.setData(vbDatas); _mesh._vertexBuffers.push(vertexBuffer); } var ibStart:uint = offset + _readData.getUint32(); var ibLength:uint = _readData.getUint32(); var ibDatas:Uint16Array = new Uint16Array(arrayBuffer.slice(ibStart, ibStart + ibLength)); var indexBuffer:IndexBuffer3D = IndexBuffer3D.create(IndexBuffer3D.INDEXTYPE_USHORT, ibLength / 2, WebGLContext.STATIC_DRAW, true); indexBuffer.setData(ibDatas); _mesh._indexBuffer = indexBuffer; var boneNames:Vector.<String> = _mesh._boneNames = new Vector.<String>(); var boneCount:uint = _readData.getUint16(); boneNames.length = boneCount; for (i = 0; i < boneCount; i++) boneNames[i] = _strings[_readData.getUint16()]; var bindPoseStart:uint = _readData.getUint32(); var binPoseLength:uint = _readData.getUint32(); var bindPoseDatas:Float32Array = new Float32Array(arrayBuffer.slice(offset + bindPoseStart, offset + bindPoseStart + binPoseLength)); _mesh._bindPoses = new Vector.<Matrix4x4>(); for (i = 0, n = bindPoseDatas.length; i < n; i += 16) { var bindPose:Matrix4x4 = new Matrix4x4(bindPoseDatas[i + 0], bindPoseDatas[i + 1], bindPoseDatas[i + 2], bindPoseDatas[i + 3], bindPoseDatas[i + 4], bindPoseDatas[i + 5], bindPoseDatas[i + 6], bindPoseDatas[i + 7], bindPoseDatas[i + 8], bindPoseDatas[i + 9], bindPoseDatas[i + 10], bindPoseDatas[i + 11], bindPoseDatas[i + 12], bindPoseDatas[i + 13], bindPoseDatas[i + 14], bindPoseDatas[i + 15]); _mesh._bindPoses.push(bindPose); } var inverseGlobalBindPoseStart:uint = _readData.getUint32(); var inverseGlobalBinPoseLength:uint = _readData.getUint32(); var invGloBindPoseDatas:Float32Array = new Float32Array(arrayBuffer.slice(offset + inverseGlobalBindPoseStart, offset + inverseGlobalBindPoseStart + inverseGlobalBinPoseLength)); _mesh._inverseBindPoses = new Vector.<Matrix4x4>(); for (i = 0, n = invGloBindPoseDatas.length; i < n; i += 16) { var inverseGlobalBindPose:Matrix4x4 = new Matrix4x4(invGloBindPoseDatas[i + 0], invGloBindPoseDatas[i + 1], invGloBindPoseDatas[i + 2], invGloBindPoseDatas[i + 3], invGloBindPoseDatas[i + 4], invGloBindPoseDatas[i + 5], invGloBindPoseDatas[i + 6], invGloBindPoseDatas[i + 7], invGloBindPoseDatas[i + 8], invGloBindPoseDatas[i + 9], invGloBindPoseDatas[i + 10], invGloBindPoseDatas[i + 11], invGloBindPoseDatas[i + 12], invGloBindPoseDatas[i + 13], invGloBindPoseDatas[i + 14], invGloBindPoseDatas[i + 15]); _mesh._inverseBindPoses.push(inverseGlobalBindPose); } //trace("READ_MESH:" + name); return true; } /** * @private */ private static function READ_SUBMESH():Boolean { var arrayBuffer:ArrayBuffer = _readData.__getBuffer(); var submesh:SubMesh = new SubMesh(_mesh); var vbIndex:int = _readData.getInt16(); var vbStart:int = _readData.getUint32(); var vbLength:int = _readData.getUint32(); submesh._vertexBuffer = _mesh._vertexBuffers[vbIndex]; submesh._vertexStart = vbStart; submesh._vertexCount = vbLength; var ibStart:int = _readData.getUint32(); var ibCount:int = _readData.getUint32(); var indexBuffer:IndexBuffer3D = _mesh._indexBuffer; submesh._indexBuffer = indexBuffer; submesh._indexStart = ibStart; submesh._indexCount = ibCount; submesh._indices = new Uint16Array(indexBuffer.getData().buffer, ibStart * 2, ibCount); var offset:int = _DATA.offset; var subIndexBufferStart:Vector.<int> = submesh._subIndexBufferStart; var subIndexBufferCount:Vector.<int> = submesh._subIndexBufferCount; var boneIndicesList:Vector.<Uint8Array> = submesh._boneIndicesList; var drawCount:int = _readData.getUint16(); subIndexBufferStart.length = drawCount; subIndexBufferCount.length = drawCount; boneIndicesList.length = drawCount; for (var i:int = 0; i < drawCount; i++) { subIndexBufferStart[i] = _readData.getUint32(); subIndexBufferCount[i] = _readData.getUint32(); var boneDicofs:int = _readData.getUint32(); var boneDicsize:int = _readData.getUint32(); submesh._boneIndicesList[i] = new Uint8Array(arrayBuffer.slice(offset + boneDicofs, offset + boneDicofs + boneDicsize)); } _subMeshes.push(submesh); return true; } /** * @private */ private static function _getVertexDeclaration(shaderAttributes:Array):VertexDeclaration { var position:Boolean, normal:Boolean, color:Boolean, texcoord0:Boolean, texcoord1:Boolean, tangent:Boolean, blendWeight:Boolean, blendIndex:Boolean; var binormal:Boolean = false; for (var i:int = 0; i < shaderAttributes.length; i++) { switch (shaderAttributes[i]) { case "POSITION": position = true; break; case "NORMAL": normal = true; break; case "COLOR": color = true; break; case "UV": texcoord0 = true; break; case "UV1": texcoord1 = true; break; case "BLENDWEIGHT": blendWeight = true; break; case "BLENDINDICES": blendIndex = true; break; case "TANGENT": tangent = true; break; case "BINORMAL": binormal = true; break; } } var vertexDeclaration:VertexDeclaration; if (position && normal && color && texcoord0 && texcoord1 && blendWeight && blendIndex && tangent) vertexDeclaration = VertexPositionNormalColorTexture0Texture1SkinTangent.vertexDeclaration; else if (position && normal && color && texcoord0 && texcoord1 && blendWeight && blendIndex) vertexDeclaration = VertexPositionNormalColorTexture0Texture1Skin.vertexDeclaration; else if (position && normal && tangent && binormal && texcoord0 && texcoord1 && blendWeight && blendIndex ) vertexDeclaration = VertexPositionNTBTexture0Texture1Skin.vertexDeclaration; else if (position && normal && texcoord0 && texcoord1 && blendWeight && blendIndex && tangent) vertexDeclaration = VertexPositionNormalTexture0Texture1SkinTangent.vertexDeclaration; else if (position && normal && texcoord0 && texcoord1 && blendWeight && blendIndex) vertexDeclaration = VertexPositionNormalTexture0Texture1Skin.vertexDeclaration; else if (position && normal && color && texcoord0 && blendWeight && blendIndex && tangent) vertexDeclaration = VertexPositionNormalColorTextureSkinTangent.vertexDeclaration; else if (position && normal && color && texcoord0 && blendWeight && blendIndex) vertexDeclaration = VertexPositionNormalColorTextureSkin.vertexDeclaration; else if (position && normal && texcoord0 && blendWeight && blendIndex && tangent) vertexDeclaration = VertexPositionNormalTextureSkinTangent.vertexDeclaration; else if (position && normal && texcoord0 && blendWeight && blendIndex) vertexDeclaration = VertexPositionNormalTextureSkin.vertexDeclaration; else if (position && normal && color && blendWeight && blendIndex && tangent) vertexDeclaration = VertexPositionNormalColorSkinTangent.vertexDeclaration; else if (position && normal && color && blendWeight && blendIndex) vertexDeclaration = VertexPositionNormalColorSkin.vertexDeclaration; else if (position && normal && color && texcoord0 && texcoord1 && tangent) vertexDeclaration = VertexPositionNormalColorTexture0Texture1Tangent.vertexDeclaration; else if (position && normal && color && texcoord0 && texcoord1) vertexDeclaration = VertexPositionNormalColorTexture0Texture1.vertexDeclaration; else if (position && normal && texcoord0 && texcoord1 && tangent) vertexDeclaration = VertexPositionNormalTexture0Texture1Tangent.vertexDeclaration; else if (position && normal && texcoord0 && texcoord1) vertexDeclaration = VertexPositionNormalTexture0Texture1.vertexDeclaration; else if (position && normal && color && texcoord0 && tangent) vertexDeclaration = VertexPositionNormalColorTextureTangent.vertexDeclaration; else if (position && normal && texcoord0 && tangent && binormal) vertexDeclaration = VertexPositionNTBTexture.vertexDeclaration; else if (position && normal && color && texcoord0) vertexDeclaration = VertexPositionNormalColorTexture.vertexDeclaration; else if (position && normal && texcoord0 && tangent) vertexDeclaration = VertexPositionNormalTextureTangent.vertexDeclaration; else if (position && normal && texcoord0) vertexDeclaration = VertexPositionNormalTexture.vertexDeclaration; else if (position && normal && color && tangent) vertexDeclaration = VertexPositionNormalColorTangent.vertexDeclaration; else if (position && normal && color) vertexDeclaration = VertexPositionNormalColor.vertexDeclaration; else if (position && normal && tangent) vertexDeclaration = VertexPositionNormalTangent.vertexDeclaration; else if (position && normal) vertexDeclaration = VertexPositionNormal.vertexDeclaration; else vertexDeclaration = VertexPosition.vertexDeclaration; return vertexDeclaration; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.skins.halo { import flash.display.Graphics; import mx.core.mx_internal; use namespace mx_internal; /** * The skin for all the states of the icon in a PopUpMenuButton. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class PopUpMenuIcon extends PopUpIcon { include "../../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function PopUpMenuIcon() { super(); } //-------------------------------------------------------------------------- // // Overridden Methods // //-------------------------------------------------------------------------- /** * @private */ override protected function updateDisplayList(w:Number, h:Number):void { super.updateDisplayList(w, h); var g:Graphics = graphics; g.clear(); g.lineStyle(1, arrowColor); g.moveTo(0, 0); g.lineTo(w / 2, height); g.lineTo(w, 0); } } }
/* 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.data { /** * A hierarchical data descriptor where children are defined as arrays in a * property defined on each branch. The property name defaults to <code>"children"</code>, * but it may be customized. * * <p>The basic structure of the data source takes the following form. The * root must always be an Array.</p> * <pre> * [ * { * text: "Branch 1", * children: * [ * { text: "Child 1-1" }, * { text: "Child 1-2" } * ] * }, * { * text: "Branch 2", * children: * [ * { text: "Child 2-1" }, * { text: "Child 2-2" }, * { text: "Child 2-3" } * ] * } * ]</pre> * * @productversion Feathers 1.0.0 */ public class ArrayChildrenHierarchicalCollectionDataDescriptor implements IHierarchicalCollectionDataDescriptor { /** * Constructor. */ public function ArrayChildrenHierarchicalCollectionDataDescriptor() { } /** * The field used to access the Array of a branch's children. */ public var childrenField:String = "children"; /** * @inheritDoc */ public function getLength(data:Object, ...rest:Array):int { var branch:Array = data as Array; var indexCount:int = rest.length; for(var i:int = 0; i < indexCount; i++) { var index:int = rest[i] as int; branch = branch[index][childrenField] as Array; } return branch.length; } /** * @inheritDoc */ public function getLengthAtLocation(data:Object, location:Vector.<int> = null):int { var branch:Array = data as Array; if(location !== null) { var indexCount:int = location.length; for(var i:int = 0; i < indexCount; i++) { var index:int = location[i]; branch = branch[index][childrenField] as Array; } } return branch.length; } /** * @inheritDoc */ public function getItemAt(data:Object, index:int, ...rest:Array):Object { rest.insertAt(0, index); var branch:Array = data as Array; var indexCount:int = rest.length - 1; for(var i:int = 0; i < indexCount; i++) { index = rest[i] as int; branch = branch[index][childrenField] as Array; } var lastIndex:int = rest[indexCount] as int; return branch[lastIndex]; } /** * @inheritDoc */ public function getItemAtLocation(data:Object, location:Vector.<int>):Object { if(location === null || location.length == 0) { return null; } var branch:Array = data as Array; var indexCount:int = location.length - 1; for(var i:int = 0; i < indexCount; i++) { var index:int = location[i]; branch = branch[index][childrenField] as Array; if(branch === null) { throw new RangeError("Branch not found at location: " + location); } } var lastIndex:int = location[indexCount]; return branch[lastIndex]; } /** * @inheritDoc */ public function setItemAt(data:Object, item:Object, index:int, ...rest:Array):void { rest.insertAt(0, index); var branch:Array = data as Array; var indexCount:int = rest.length - 1; for(var i:int = 0; i < indexCount; i++) { index = rest[i] as int; branch = branch[index][childrenField] as Array; } var lastIndex:int = rest[indexCount] as int; branch[lastIndex] = item; } /** * @inheritDoc */ public function setItemAtLocation(data:Object, item:Object, location:Vector.<int>):void { if(location === null || location.length == 0) { throw new RangeError("Branch not found at location: " + location); } var branch:Array = data as Array; var indexCount:int = location.length - 1; for(var i:int = 0; i < indexCount; i++) { var index:int = location[i]; branch = branch[index][childrenField] as Array; if(branch === null) { throw new RangeError("Branch not found at location: " + location); } } var lastIndex:int = location[indexCount]; branch[lastIndex] = item; } /** * @inheritDoc */ public function addItemAt(data:Object, item:Object, index:int, ...rest:Array):void { rest.insertAt(0, index); var branch:Array = data as Array; var indexCount:int = rest.length - 1; for(var i:int = 0; i < indexCount; i++) { index = rest[i] as int; branch = branch[index][childrenField] as Array; } var lastIndex:int = rest[indexCount] as int; branch.insertAt(lastIndex, item); } /** * @inheritDoc */ public function addItemAtLocation(data:Object, item:Object, location:Vector.<int>):void { if(location === null || location.length == 0) { throw new RangeError("Branch not found at location: " + location); } var branch:Array = data as Array; var indexCount:int = location.length - 1; for(var i:int = 0; i < indexCount; i++) { var index:int = location[i]; branch = branch[index][childrenField] as Array; if(branch === null) { throw new RangeError("Branch not found at location: " + location); } } var lastIndex:int = location[indexCount]; branch.insertAt(lastIndex, item); } /** * @inheritDoc */ public function removeItemAt(data:Object, index:int, ...rest:Array):Object { rest.insertAt(0, index); var branch:Array = data as Array; var indexCount:int = rest.length - 1; for(var i:int = 0; i < indexCount; i++) { index = rest[i] as int; branch = branch[index][childrenField] as Array; } var lastIndex:int = rest[indexCount] as int; return branch.removeAt(lastIndex); } /** * @inheritDoc */ public function removeItemAtLocation(data:Object, location:Vector.<int>):Object { if(location === null || location.length == 0) { throw new RangeError("Branch not found at location: " + location); } var branch:Array = data as Array; var indexCount:int = location.length - 1; for(var i:int = 0; i < indexCount; i++) { var index:int = location[i]; branch = branch[index][childrenField] as Array; if(branch === null) { throw new RangeError("Branch not found at location: " + location); } } var lastIndex:int = location[indexCount]; return branch.removeAt(lastIndex); } /** * @inheritDoc */ public function removeAll(data:Object):void { var branch:Array = data as Array; branch.length = 0; } /** * @inheritDoc */ public function getItemLocation(data:Object, item:Object, result:Vector.<int> = null, ...rest:Array):Vector.<int> { if(!result) { result = new <int>[]; } else { result.length = 0; } var branch:Array = data as Array; var restCount:int = rest.length; for(var i:int = 0; i < restCount; i++) { var index:int = rest[i] as int; result[i] = index; branch = branch[index][childrenField] as Array; } var isFound:Boolean = this.findItemInBranch(branch, item, result); if(!isFound) { result.length = 0; } return result; } /** * @inheritDoc */ public function isBranch(node:Object):Boolean { if(node === null) { return false; } return node.hasOwnProperty(this.childrenField) && node[this.childrenField] is Array; } /** * @private */ protected function findItemInBranch(branch:Array, item:Object, result:Vector.<int>):Boolean { var index:int = branch.indexOf(item); if(index >= 0) { result.push(index); return true; } var branchLength:int = branch.length; for(var i:int = 0; i < branchLength; i++) { var branchItem:Object = branch[i]; if(this.isBranch(branchItem)) { result.push(i); var isFound:Boolean = this.findItemInBranch(branchItem[childrenField] as Array, item, result); if(isFound) { return true; } result.pop(); } } return false; } } }
/* * =BEGIN CLOSED LICENSE * * Copyright (c) 2013-2014 Andras Csizmadia * http://www.vpmedia.eu * * For information about the licensing and copyright please * contact Andras Csizmadia at andras@vpmedia.eu * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * =END CLOSED LICENSE */ package hu.vpmedia.serializers.utils { /** * XMLDefinitionFilter instances are used with the create method * of the XMLDefinition class. Instances of XMLDefinitionFilter * define for an object type used in XMLDefinition.create() what * properties are included or excluded from the resulting XML or * what properties should be marked as a definition property. These * properties are defined in an object passed to the constructor * of a new XMLDefinitionFilter instance. Using the defaultType * parameter, you can also dictate what the default property * behavior is. Property types include INCLUDE, EXCLUDE, and * PROPERTY and are saved as static constants within this class. */ public class XMLDefinitionFilter { /** * Value for indicating that an object's property * should be included in generated definition XML. */ public static const INCLUDE:String = "include"; /** * Value for indicating that an object's property * should be excluded from generated definition XML. */ public static const EXCLUDE:String = "exclude"; /** * Value for indicating that an object's property * should be defined as definition property in XML. */ public static const PROPERTY:String = "property"; // class properties are only accessible // from definitions within this package internal var qualifiedClassName:String; internal var properties:Object; internal var defaultType:Object; /** * Constructor; creates a new XMLDefinitionFilter. * @param qualifiedClassName The fully qualifiedClassName class name * of the object type being filtered. This is in the form of * PackagePath::ClassName or the string returned by * getQualifiedClassName(). * @param properties A generic object of the type Object with * properties relating to the target type's properties. The * value of those properties within this object determine if the * property is included, excluded, or defined as a property in * the XML generated by XMLDefinition.create(). * @param defaultType The default filter type for properties not * referenced in the properties object. By default this is * XMLDefinitionFilter.INCLUDE. */ public function XMLDefinitionFilter(qualifiedClassName:String, properties:Object, defaultType:String = INCLUDE) { this.qualifiedClassName = qualifiedClassName; this.properties = properties; this.defaultType = defaultType; } } }
/* * Copyright (c) 2009 the original author or authors * * Permission is hereby granted to use, modify, and distribute this file * in accordance with the terms of the license agreement accompanying it. */ package org.robotlegs.utilities.modular.base { import flash.utils.Dictionary; import org.robotlegs.base.CommandMap; import org.robotlegs.core.IInjector; import org.robotlegs.core.IReflector; import org.robotlegs.utilities.modular.core.IModuleCommandMap; import org.robotlegs.utilities.modular.core.IModuleEventDispatcher; /** * Create command mappings that can be triggered by events dispatched on the * shared <code>ModuleEventDispatcher</code>. * * @author Joel Hooks * */ public class ModuleCommandMap extends CommandMap implements IModuleCommandMap { public function ModuleCommandMap(eventDispatcher:IModuleEventDispatcher, injector:IInjector, reflector:IReflector) { super(eventDispatcher, injector, reflector); } } }
package com.tencent.morefun.framework.loader { import flash.events.IEventDispatcher; import flash.system.ApplicationDomain; import flash.utils.ByteArray; import com.tencent.morefun.framework.loader.mission.Mission; public interface ILoader extends IEventDispatcher { function get traceFunction() : Function; function set traceFunction(param1:Function) : void; function get base() : String; function set base(param1:String) : void; function get applicationDomain() : ApplicationDomain; function set applicationDomain(param1:ApplicationDomain) : void; function trace(... rest) : void; function getClass(param1:String) : Class; function createObject(param1:String) : Object; function hasBytes(param1:String) : Boolean; function getBytes(param1:String, param2:Boolean = false) : ByteArray; function removeAllBytes() : void; function removeBytes(param1:String) : void; function saveCache(param1:Mission) : void; function getLazyMission(param1:String) : Mission; function get lazyMissionCount() : uint; function get currentLazyMission() : Mission; function loadLazyMission(param1:Mission) : void; function hasLazyMission(param1:String) : Boolean; function startLazyQueue() : void; function stopLazyQueue() : void; function get missionCount() : uint; function get currentMission() : Mission; function loadMission(param1:Mission) : void; function hasMission(param1:String) : Boolean; function removeMission(param1:String, param2:Boolean) : void; function removeAllMission(param1:Boolean) : void; function get flashCacheSize() : Number; function get isCachePanel() : Boolean; function transferCache() : void; function flushCache() : void; function get isNeedFlush() : Boolean; } }
package fl.controls { import fl.controls.progressBarClasses.IndeterminateBar; import fl.controls.ProgressBarDirection; import fl.controls.ProgressBarMode; import fl.core.InvalidationType; import fl.core.UIComponent; import flash.display.DisplayObject; import flash.display.Sprite; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.ProgressEvent; /** * Dispatched when the load operation completes. * * @eventType flash.events.Event.COMPLETE * * @includeExample examples/ProgressBar.complete.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Event("complete", type="flash.events.Event")] /** * Dispatched as content loads in event mode or polled mode. * * @eventType flash.events.ProgressEvent.PROGRESS * * @includeExample examples/ProgressBar.complete.1.as -noswf * * @see ProgressBarMode#EVENT ProgressBarMode.EVENT * @see ProgressBarMode#POLLED ProgressBarMode.POLLED * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Event("progress", type="flash.events.ProgressEvent")] /** * Name of the class to use as the default icon. Setting any other icon * style overrides this setting. * * @default null * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="icon", type="Class")] /** * Name of the class to use as the progress indicator track. * * @default ProgressBar_trackSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="trackSkin", type="Class")] /** * Name of the class to use as the determinate progress bar. * * @default ProgressBar_barSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="barSkin", type="Class")] /** * Name of the class to use as the indeterminate progress bar. This is passed to the * indeterminate bar renderer, which is specified by the <code>indeterminateBar</code> * style. * * @default ProgressBar_indeterminateSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="indeterminateSkin", type="Class")] /** * The class to use as a renderer for the indeterminate bar animation. * This is an advanced style. * * @default fl.controls.progressBarClasses.IndeterminateBar * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="indeterminateBar", type="Class")] /** * The padding that separates the progress bar indicator from the track, in pixels. * * @default 0 * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="barPadding", type="Number", format="Length")] /** * The ProgressBar component displays the progress of content that is * being loaded. The ProgressBar is typically used to display the status of * images, as well as portions of applications, while they are loading. * The loading process can be determinate or indeterminate. A determinate * progress bar is a linear representation of the progress of a task over * time and is used when the amount of content to load is known. An indeterminate * progress bar has a striped fill and a loading source of unknown size. * * @includeExample examples/ProgressBarExample.as * * @see ProgressBarDirection * @see ProgressBarMode * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public class ProgressBar extends UIComponent { /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var track : DisplayObject; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var determinateBar : DisplayObject; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var indeterminateBar : UIComponent; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _direction : String; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _indeterminate : Boolean; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _mode : String; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _minimum : Number; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _maximum : Number; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _value : Number; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _source : Object; /** * @private (protected) */ protected var _loaded : Number; /** * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ private static var defaultStyles : Object; /** * Indicates the fill direction for the progress bar. A value of * <code>ProgressBarDirection.RIGHT</code> indicates that the progress * bar is filled from left to right. A value of <code>ProgressBarDirection.LEFT</code> * indicates that the progress bar is filled from right to left. * * @default ProgressBarDirection.RIGHT * * @includeExample examples/ProgressBar.direction.1.as -noswf * * @see ProgressBarDirection * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get direction () : String; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set direction (value:String) : void; /** * Gets or sets a value that indicates the type of fill that the progress * bar uses and whether the loading source is known or unknown. A value of * <code>true</code> indicates that the progress bar has a striped fill * and a loading source of unknown size. A value of <code>false</code> * indicates that the progress bar has a solid fill and a loading source * of known size. * * <p>This property can only be set when the progress bar mode * is set to <code>ProgressBarMode.MANUAL</code>.</p> * * @default true * * @see #mode * @see ProgressBarMode * @see fl.controls.progressBarClasses.IndeterminateBar IndeterminateBar * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get indeterminate () : Boolean; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set indeterminate (value:Boolean) : void; /** * Gets or sets the minimum value for the progress bar when the * <code>ProgressBar.mode</code> property is set to <code>ProgressBarMode.MANUAL</code>. * * @default 0 * * @see #maximum * @see #percentComplete * @see #value * @see ProgressBarMode#MANUAL * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get minimum () : Number; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set minimum (value:Number) : void; /** * Gets or sets the maximum value for the progress bar when the * <code>ProgressBar.mode</code> property is set to <code>ProgressBarMode.MANUAL</code>. * * @default 0 * * @see #minimum * @see #percentComplete * @see #value * @see ProgressBarMode#MANUAL * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get maximum () : Number; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set maximum (value:Number) : void; /** * Gets or sets a value that indicates the amount of progress that has * been made in the load operation. This value is a number between the * <code>minimum</code> and <code>maximum</code> values. * * @default 0 * * @see #maximum * @see #minimum * @see #percentComplete * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get value () : Number; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set value (value:Number) : void; /** * @private (internal) */ public function set sourceName (name:String) : void; /** * Gets or sets a reference to the content that is being loaded and for * which the ProgressBar is measuring the progress of the load operation. * A typical usage of this property is to set it to a UILoader component. * * <p>Use this property only in event mode and polled mode.</p> * * @default null * * @includeExample examples/ProgressBar.source.1.as -noswf * @includeExample examples/ProgressBar.source.2.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get source () : Object; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set source (value:Object) : void; /** * Gets a number between 0 and 100 that indicates the percentage * of the content has already loaded. * * <p>To change the percentage value, use the <code>setProgress()</code> method.</p> * * @default 0 * * @includeExample examples/ProgressBar.percentComplete.1.as -noswf * @includeExample examples/ProgressBar.percentComplete.2.as -noswf * * @see #maximum * @see #minimum * @see #setProgress() * @see #value * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get percentComplete () : Number; /** * Gets or sets the method to be used to update the progress bar. * * <p>The following values are valid for this property:</p> * <ul> * <li><code>ProgressBarMode.EVENT</code></li> * <li><code>ProgressBarMode.POLLED</code></li> * <li><code>ProgressBarMode.MANUAL</code></li> * </ul> * * <p>Event mode and polled mode are the most common modes. In event mode, * the <code>source</code> property specifies loading content that generates * <code>progress</code> and <code>complete</code> events; you should use * a UILoader object in this mode. In polled mode, the <code>source</code> * property specifies loading content, such as a custom class, that exposes * <code>bytesLoaded</code> and <code>bytesTotal</code> properties. Any object * that exposes these properties can be used as a source in polled mode.</p> * * <p>You can also use the ProgressBar component in manual mode by manually * setting the <code>maximum</code> and <code>minimum</code> properties and * making calls to the <code>ProgressBar.setProgress()</code> method.</p> * * @default ProgressBarMode.EVENT * * @see ProgressBarMode * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get mode () : String; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set mode (value:String) : void; /** * @copy fl.core.UIComponent#getStyleDefinition() * * @includeExample ../core/examples/UIComponent.getStyleDefinition.1.as -noswf * * @see fl.core.UIComponent#getStyle() * @see fl.core.UIComponent#setStyle() * @see fl.managers.StyleManager * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static function getStyleDefinition () : Object; /** * Creates a new ProgressBar component instance. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function ProgressBar (); /** * Sets the state of the bar to reflect the amount of progress made when * using manual mode. The <code>value</code> argument is assigned to the * <code>value</code> property and the <code>maximum</code> argument is * assigned to the <code>maximum</code> property. The <code>minimum</code> * property is not altered. * * @param value A value describing the progress that has been made. * * @param maximum The maximum progress value of the progress bar. * * @see #maximum * @see #value * @see ProgressBarMode#MANUAL ProgressBarMode.manual * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function setProgress (value:Number, maximum:Number) : void; /** * Resets the progress bar for a new load operation. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function reset () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function _setProgress (value:Number, maximum:Number, fireEvent:Boolean = false) : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function setIndeterminate (value:Boolean) : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function resetProgress () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function setupSourceEvents () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function cleanupSourceEvents () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function pollSource (event:Event) : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function handleProgress (event:ProgressEvent) : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function handleComplete (event:Event) : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function draw () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function drawTrack () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function drawBars () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function drawDeterminateBar () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function drawLayout () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function configUI () : void; } }
package awaybuilder.desktop.view.mediators { import flash.events.Event; import awaybuilder.desktop.utils.ModalityManager; import awaybuilder.desktop.view.components.MessageBox; import org.robotlegs.mvcs.Mediator; public class MessageBoxMediator extends Mediator { [Inject] public var window:MessageBox; override public function onRegister():void { ModalityManager.modalityManager.addModalNature(this.window); this.eventMap.mapListener(this.window.content, Event.COMPLETE, content_completeHandler); this.eventMap.mapListener(this.window.content, Event.CANCEL, content_cancelHandler); this.eventMap.mapListener(this.window, Event.CLOSING, window_closingHandler); } private function content_completeHandler(event:Event):void { this.window.close(); } private function content_cancelHandler(event:Event):void { this.window.close(); } private function window_closingHandler(event:Event):void { this.mediatorMap.removeMediator(this); } } }
package kabam.rotmg.ui.view { import com.company.assembleegameclient.objects.Player; import com.company.assembleegameclient.ui.ExperienceBoostTimerPopup; import com.company.assembleegameclient.ui.StatusBar; import flash.display.Sprite; import flash.events.Event; public class StatMetersView extends Sprite { public function StatMetersView() { super(); init(); } public var expBar_:StatusBar; public var fameBar_:StatusBar; public var hpBar_:StatusBar; public var clientHpBar_:StatusBar; public var mpBar_:StatusBar; private var areTempXpListenersAdded:Boolean; private var curXPBoost:int; private var expTimer:ExperienceBoostTimerPopup; private var lastLevel:int; public function init():void { lastLevel = -2; this.expBar_ = new StatusBar(176, 15, 5931045, 5526612, "ExpBar.level", false, null, false, true); this.fameBar_ = new StatusBar(176, 15, 14835456, 5526612, "Currency.fame", false, null, false, true); this.hpBar_ = new StatusBar(176, 15, 14693428, 5526612, "StatusBar.HealthPoints"); this.clientHpBar_ = new StatusBar(176, 15, 14693428, 5526612, "CH"); this.mpBar_ = new StatusBar(176, 15, 6325472, 5526612, "StatusBar.ManaPoints"); this.hpBar_.y = 16; this.clientHpBar_.y = 32; this.mpBar_.y = 48; this.fameBar_.visible = false; addChild(this.expBar_); addChild(this.fameBar_); addChild(this.hpBar_); addChild(this.clientHpBar_); addChild(this.mpBar_); } public function dispose():void { while (this.numChildren > 0) { this.removeChildAt(0); } } public function update(param1:Player):void { if (param1.level_ != this.lastLevel) { this.expBar_.setLabelText("ExpBar.level", {"level": param1.level_}); this.lastLevel = param1.level_; } if (param1.level_ != 20) { if (this.expTimer) { this.expTimer.update(param1.xpTimer); } if (!this.expBar_.visible) { this.expBar_.visible = true; this.fameBar_.visible = false; } this.expBar_.draw(param1.exp_, param1.nextLevelExp_, 0); if (this.curXPBoost != param1.xpBoost_) { this.curXPBoost = param1.xpBoost_; if (this.curXPBoost) { this.expBar_.showMultiplierText(); } else { this.expBar_.hideMultiplierText(); } } if (param1.xpTimer) { if (!this.areTempXpListenersAdded) { this.expBar_.addEventListener("MULTIPLIER_OVER", this.onExpBarOver); this.expBar_.addEventListener("MULTIPLIER_OUT", this.onExpBarOut); this.areTempXpListenersAdded = true; } } else { if (this.areTempXpListenersAdded) { this.expBar_.removeEventListener("MULTIPLIER_OVER", this.onExpBarOver); this.expBar_.removeEventListener("MULTIPLIER_OUT", this.onExpBarOut); this.areTempXpListenersAdded = false; } if (this.expTimer && this.expTimer.parent) { removeChild(this.expTimer); this.expTimer = null; } } } else { if (!this.fameBar_.visible) { this.fameBar_.visible = true; this.expBar_.visible = false; } this.fameBar_.draw(param1.currFame_, param1.nextClassQuestFame_, 0); } this.clientHpBar_.draw(param1.clientHp, param1.maxHP_, param1.maxHPBoost_, param1.maxHPMax_, param1.level_, param1.exaltedHealth); this.hpBar_.draw(param1.hp_, param1.maxHP_, param1.maxHPBoost_, param1.maxHPMax_, param1.level_, param1.exaltedHealth); this.mpBar_.draw(param1.mp_, param1.maxMP_, param1.maxMPBoost_, param1.maxMPMax_, param1.level_, param1.exaltedMana); } private function onExpBarOver(param1:Event):void { var _loc2_:* = new ExperienceBoostTimerPopup(); this.expTimer = _loc2_; addChild(_loc2_); } private function onExpBarOut(param1:Event):void { if (this.expTimer && this.expTimer.parent) { removeChild(this.expTimer); this.expTimer = null; } } } }
package com.unhurdle { public class ParameterWriter { public function ParameterWriter() { } static public function writeToBuffer(param:OMVParameter,buffer:Array):void{ buffer.push(param.name); buffer.push(":"); buffer.push(param.type); if(param.optional){ if(param.type == "Boolean"){ buffer.push("=false"); } else if(param.type == "int" || param.type == "Number"){ buffer.push("=0"); } else { buffer.push("=null"); } //TODO: add better default values based on type } } } }
// forked from keim_at_Si's Code based Structure Synth // Code based Structure Synth // Structure Synth; http://structuresynth.sourceforge.net/ //------------------------------------------------------------ package { import flash.display.*; import flash.events.*; import flash.geom.*; import flash.utils.*; import flash.text.*; [SWF(width='465', height='465', backgroundColor='#000000', frameRate='30')] public class main extends Sprite { // 3D renders private var _materials:Vector.<Material> = new Vector.<Material>(); private var _light:Light = new Light(1,1,1); private var _screen:BitmapData = new BitmapData(465, 465, false, 0); private var _matscr:Matrix = new Matrix(1, 0, 0, 1, 232.5, 232.5); private var _tf:TextField = new TextField(); private var gl:Render3D = new Render3D(300,1); private var ss:StructureSynth = new StructureSynth(gl); // objects private var camera:Vector3D; private var structure:Vector.<Mesh> = new Vector.<Mesh>(5, true); private var structName:Array = ["tetrahedrons","hexahedrons","octahedrons","dodecahedrons","icosahedrons"]; // motions private var structNum:int = 0; // entry point function main() { var i:int; _tf.autoSize = "left"; camera = new Vector3D(0, -5, -50); _materials.push((new Material()).setColor(0xff8080, 64, 192, 32, 80), (new Material()).setColor(0xd0d080, 64, 192, 32, 80), (new Material()).setColor(0x80ff80, 64, 192, 32, 80), (new Material()).setColor(0x80c0c0, 64, 192, 48, 80), (new Material()).setColor(0x8080ff, 64, 192, 64, 80)); for (i=0; i<5; i++) structure[i] = new Mesh(_materials); addChild(gl).visible = false; addChild(new Bitmap(_screen)); addChild(_tf); addEventListener("enterFrame", _onEnterFrame); stage.addEventListener("click", _onClick); // register meshes ss.mesh("tetra", SolidFactory.tetrahedron (new Mesh(), 1, 0)); // 4vertices/4triangles ss.mesh("box", SolidFactory.hexahedron (new Mesh(), 1, 1, false)); // 8vertices/12triangles ss.mesh("octa", SolidFactory.octahedron (new Mesh(), 1, 2)); // 6vertices/8triangles ss.mesh("dodeca", SolidFactory.dodecahedron(new Mesh(), 1, 3)); // 12vertices/36triangles ss.mesh("icosa", SolidFactory.icosahedron (new Mesh(), 1, 4)); // 20vertices/20triangles // create mesh by Structure Synth // structure[0] ss.rule("s0r1", function() : void { ss.call("{rz 6 x -2.5} s0r2"); ss.call("{ry 60} s0r1"); }, {md:6}); ss.rule("s0r2", function() : void { ss.call("{rz -54.73561032 ry 45} tetra"); ss.call("{rz 6 x -2.5} s0r2"); }, {md:28}); ss.init(structure[0]).call("{y 30} s0r1"); ss.init(structure[0]).call("{y 0 ry 30} s0r1"); structure[0].updateFaces(); // structure[1] ss.rule("s1r1", function() : void { ss.call("s1r2"); ss.call("{rx 20 z 4} s1r1"); }, {md:18}); ss.rule("s1r2", function() : void { ss.call("box"); ss.call("{x 2.4 y -1 z -1 s 1 0.94 0.94} s1r2"); }, {md:32}); ss.init(structure[1]).call("{x -36 y 11} s1r1"); structure[1].updateFaces(); // structure[2] ss.rule("s2r1", function() : void { ss.call("3 * {y 2 rx 5} octa"); ss.call("{y 6 rz 30 ry 45 s 0.8} s2r1"); ss.call("{y 6 rz -30 ry 45 s 0.8} s2r1"); }); ss.rule("s2r1", function() : void { ss.call("3 * {y 2 rx -5} octa"); ss.call("{y 6 rz 30 ry 45 s 0.8} s2r1"); ss.call("{y 6 rz -30 ry 45 s 0.8} s2r1"); }); ss.init(structure[2], 8).call("{s 1.5} s2r1"); structure[2].updateFaces(); // structure[3] ss.rule("s3r1", function() : void { ss.call("s3r2"); ss.call("{s 1.5} s3r1"); }, {md:6}); ss.rule("s3r2", function() : void { ss.call("{y -4} dodeca"); ss.call("5 * {ry 72} s3r3"); }); ss.rule("s3r3", function() : void { ss.call("{rz 65 y -4} dodeca"); }); ss.init(structure[3]).call("s3r1"); ss.init(structure[3]).call("{rz 180} s3r1"); structure[3].updateFaces(); // structure[4] ss.rule("s4rx", function() : void { ss.call("icosa"); ss.call("{z 3 x 3} s4rz"); ss.call("{y 3 z 3} s4ry"); ss.call("{x 3 y 3} s4rx"); }); ss.rule("s4ry", function() : void { ss.call("icosa"); ss.call("{z 3 x 3} s4rz"); ss.call("{y 3 z 3} s4ry"); }); ss.rule("s4rz", function() : void { ss.call("icosa"); ss.call("{z 3 x 3} s4rz"); }); ss.init(structure[4], 8).call("{x -21.2132 y -21.2132 z -21.2132 s 2} s4rx"); structure[4].updateFaces(); structNum = -1; _onClick(null); } private function _onEnterFrame(e:Event) : void { _screen.fillRect(_screen.rect, 0); _light.transformBy(gl.id().tv(camera).rx((400-mouseY)*0.25).ry((232-mouseX)*0.75).matrix); _screen.draw(gl.push().t(0, 0, 0).project(structure[structNum]).renderSolid(_light).pop(), _matscr); } private function _onClick(e:Event) : void { if (++structNum == structure.length) structNum = 0; _tf.htmlText = "<font color='#ffffff' face='_typewriter'>Click to change the structure[" + structName[structNum] + "]</font>"; } } } import flash.display.*; import flash.geom.*; // Solid Factory //---------------------------------------------------------------------------------------------------- class SolidFactory { // regular solids //-------------------------------------------------- static public function tetrahedron(mesh:Mesh, size:Number, mat:int=0) : Mesh { mesh.vertices.push(size,size,size, size,-size,-size, -size,size,-size, -size,-size,size); mesh.qface(0,2,1,3,mat).qface(1,3,0,2,mat); return mesh.updateFaces(); } static public function hexahedron(mesh:Mesh, size:Number, mat:int=0, div:Boolean=true) : Mesh { for (var i:int=0; i<8; i++) mesh.vertices.push((i&1)?size:-size, ((i>>1)&1)?size:-size, (i>>2)?size:-size); mesh.qface(0,1,2,3,mat,div).qface(1,0,5,4,mat,div).qface(0,2,4,6,mat,div); mesh.qface(2,3,6,7,mat,div).qface(3,1,7,5,mat,div).qface(5,4,7,6,mat,div); return mesh.updateFaces(); } static public function octahedron(mesh:Mesh, size:Number, mat:int=0) : Mesh { mesh.vertices.push(0,0,-size, -size,0,0, 0,-size,0, size,0,0, 0,size,0, 0,0,size); mesh.qface(0,1,2,5,mat).qface(0,2,3,5,mat).qface(0,3,4,5,mat).qface(0,4,1,5,mat); return mesh.updateFaces(); } static public function dodecahedron(mesh:Mesh, size:Number, mat:int=0, div:Boolean=true) : Mesh { var a:Number=size*0.149071198, b:Number=size*0.241202266, c:Number=size*0.283550269, d:Number=size*0.390273464, e:Number=size*0.458793973, f:Number=size*0.631475730, g:Number=size*0.742344243; mesh.vertices.push(c,f,d, e,f,-a, 0,f,-b-b, -e,f,-a, -c,f,d); mesh.vertices.push(e,a,f, g,a,-b, 0,a,-d-d, -g,a,-b, -e,a,f); mesh.vertices.push(0,-a,d+d, g,-a,b, e,-a,-f, -e,-a,-f, -g,-a,b); mesh.vertices.push(0,-f,b+b, e,-f,a, c,-f,-d, -c,-f,-d, -e,-f,a); mesh.qface(0,3,1,2,mat,div).face(0,4,3,mat).qface(4,5,9,10,mat,div).face(4,0,5,mat); mesh.qface(0,6,5,11,mat,div).face(0,1,6,mat).qface(1,7,6,12,mat,div).face(1,2,7,mat); mesh.qface(2,8,7,13,mat,div).face(2,3,8,mat).qface(3,9,8,14,mat,div).face(3,4,9,mat); mesh.qface(17,11,12,6,mat,div).face(17,16,11,mat).qface(16,10,11,5,mat,div).face(16,15,10,mat); mesh.qface(15,14,10,9,mat,div).face(15,19,14,mat).qface(19,13,14,8,mat,div).face(19,18,13,mat); mesh.qface(18,12,13,7,mat,div).face(18,17,12,mat).qface(16,18,15,19,mat,div).face(16,17,18,mat); return mesh.updateFaces(); } static public function icosahedron(mesh:Mesh, size:Number, mat:int=0) : Mesh { var a:Number=size*0.276393202, b:Number=size*0.447213595, c:Number=size*0.525731112, d:Number=size*0.723606798, e:Number=size*0.850650808; mesh.vertices.push(0,size,0, 0,b,b+b, e,b,a, c,b,-d, -c,b,-d, -e,b,a); mesh.vertices.push(e,-b,-a, c,-b,d, -c,-b,d, -e,-b,-a, 0,-b,-b-b, 0,-size,0); mesh.qface(0,2,1,7,mat).qface(0,3,2,6,mat).qface(0,4,3,10,mat).qface(0,5,4,9,mat).qface(0,1,5,8,mat); mesh.qface(1,7,8,11,mat).qface(2,6,7,11,mat).qface(3,10,6,11,mat).qface(4,9,10,11,mat).qface(5,8,9,11,mat); return mesh.updateFaces(); } } // Structure Synth //---------------------------------------------------------------------------------------------------- class StructureSynth { private var _mesh:Mesh; private var _functions:* = new Object(); private var _meshes:* = new Object(); private var _maxDepth:int; private var _depth:int; private var _core:Render3D; static private var _rexLine:RegExp = /((\d+)\s*\*)?\s*({(.*?)})?\s*([^{}\s]+)/; static private var _rexOperate:RegExp = /(r?[x-z]|s)\s*([\-\d.]+)\s*([\-\d.]+)?\s*([\-\d.]+)?/g; function StructureSynth(core:Render3D) { _core = core; } /** register mesh to call in CFDG. * @param name Mesh name to call. * @param mesh Mesh data. */ public function mesh(name:String, mesh:Mesh) : StructureSynth { _meshes[name] = mesh; return this; } /** register rule. * @param name Rule name to call. * @param func Function to execute. The type is "function(depth:int) : void". * @param option Option["w"/"weight"] to set weight and the option["md"/"maxdepth"] to set maxdepth. */ public function rule(name:String, func:Function, option:*=null) : StructureSynth { if (!(name in _functions)) _functions[name] = new SSFunctionList(); _functions[name].rule(func, option||new Object()); return this; } /** initialize to constructing structure */ public function init(mesh:Mesh, maxDepth:int=512) : StructureSynth { for each (var func:SSFunctionList in _functions) func.init(); _maxDepth = maxDepth; _depth = 0; _mesh = mesh; _core.id(); return this; } /** command 1 line in CFDG. */ public function call(line:String) : StructureSynth { var i:int, imax:int, res:*; res = _rexLine.exec(line); if (res) { _core.push(); imax = (res[2]) ? int(res[2]) : 1; for (i=0; i<imax; i++) { operate(res[4]); if (res[5] in _functions) { if (++_depth <= _maxDepth) _functions[res[5]].call(); _depth--; } else if (res[5] in _meshes) { _core.project(_meshes[res[5]]); _mesh.put(_meshes[res[5]]); } } _core.pop(); } return this; } /** opreate matrix */ public function operate(ope:String) : void { //_rexOperate.lastIndex = 0; var res:* = _rexOperate.exec(ope); while(res) { var n:Number = Number(res[2]); switch (res[1]) { case 'x': _core.t(n,0,0); break; case 'y': _core.t(0,n,0); break; case 'z': _core.t(0,0,n); break; case 'rx': _core.rx(n); break; case 'ry': _core.ry(n); break; case 'rz': _core.rz(n); break; case 's': if (res[3]) _core.s(n, Number(res[3]), Number(res[4])); else _core.s(n, n, n); break; } res = _rexOperate.exec(ope); } } } class SSFunctionList { private var _totalWeight:Number = 0; private var _functions:Vector.<SSFunction> = new Vector.<SSFunction>(); public function rule(func:Function, option:*) : void { var ssf:SSFunction = new SSFunction(func, option); _functions.push(ssf); _totalWeight += ssf.weight; } public function init() : void { for each (var ssf:SSFunction in _functions) ssf.depth = 0; } public function call() : void { var w:Number = 0, rand:Number = Math.random() * _totalWeight; for each (var ssf:SSFunction in _functions) { w += ssf.weight; if (rand <= w) { if (++ssf.depth <= ssf.maxdepth) ssf.func(); ssf.depth--; return; } } } } class SSFunction { public var func:Function; public var weight:Number; public var maxdepth:int; public var depth:int = 0; function SSFunction(func:Function, option:*) { this.func = func; this.weight = option["w"] || option["weight"] || 1; this.maxdepth = option["md"] || option["maxdepth"] || int.MAX_VALUE; } } // 3D Engine //---------------------------------------------------------------------------------------------------- /** Core */ class Render3D extends Shape { /** model view matrix */ public var matrix:Matrix3D; private var _meshProjected:Mesh = null; // projecting mesh private var _facesProjected:Vector.<Face> = new Vector.<Face>(); // projecting face private var _projectionMatrix:Matrix3D; // projection matrix private var _matrixStac:Vector.<Matrix3D> = new Vector.<Matrix3D>(); // matrix stac private var _cmdTriangle:Vector.<int> = Vector.<int>([1,2,2]); // commands to draw triangle private var _cmdQuadrangle:Vector.<int> = Vector.<int>([1,2,2,2]); // commands to draw quadrangle private var _data:Vector.<Number> = new Vector.<Number>(8, true); // data to draw shape private var _clippingZ:Number; // z value of clipping plane /** constructor */ function Render3D(focus:Number=300, clippingZ:Number=-0.1) { var projector:PerspectiveProjection = new PerspectiveProjection() projector.focalLength = focus; _projectionMatrix = projector.toMatrix3D(); _clippingZ = -clippingZ; matrix = new Matrix3D(); _matrixStac.length = 1; _matrixStac[0] = matrix; } // control matrix //-------------------------------------------------- public function clear() : Render3D { matrix = _matrixStac[0]; _matrixStac.length = 1; return this; } public function push() : Render3D { _matrixStac.push(matrix.clone()); return this; } public function pop() : Render3D { matrix = (_matrixStac.length == 1) ? matrix : _matrixStac.pop(); return this; } public function id() : Render3D { matrix.identity(); return this; } public function t(x:Number, y:Number, z:Number) : Render3D { matrix.prependTranslation(x, y, z); return this; } public function tv(v:Vector3D) : Render3D { matrix.prependTranslation(v.x, v.y, v.z); return this; } public function s(x:Number, y:Number, z:Number) : Render3D { matrix.prependScale(x, y, z); return this; } public function sv(v:Vector3D) : Render3D { matrix.prependScale(v.x, v.y, v.z); return this; } public function r(angle:Number, axis:Vector3D) : Render3D { matrix.prependRotation(angle, axis); return this; } public function rv(v:Vector3D) : Render3D { matrix.prependRotation(v.w, v); return this; } public function rx(angle:Number) : Render3D { matrix.prependRotation(angle, Vector3D.X_AXIS); return this; } public function ry(angle:Number) : Render3D { matrix.prependRotation(angle, Vector3D.Y_AXIS); return this; } public function rz(angle:Number) : Render3D { matrix.prependRotation(angle, Vector3D.Z_AXIS); return this; } // projections //-------------------------------------------------- /** project */ public function project(mesh:Mesh) : Render3D { matrix.transformVectors(mesh.vertices, mesh.verticesOnWorld); var fn:Point3D, vs:Vector.<Number> = mesh.verticesOnWorld; var m:Vector.<Number> = matrix.rawData, m00:Number = m[0], m01:Number = m[1], m02:Number = m[2], m10:Number = m[4], m11:Number = m[5], m12:Number = m[6], m20:Number = m[8], m21:Number = m[9], m22:Number = m[10]; _facesProjected.length = 0; for each (var f:Face in mesh.faces) { var i0:int=(f.i0<<1)+f.i0, i1:int=(f.i1<<1)+f.i1, i2:int=(f.i2<<1)+f.i2, x0:Number=vs[i0++], x1:Number=vs[i1++], x2:Number=vs[i2++], y0:Number=vs[i0++], y1:Number=vs[i1++], y2:Number=vs[i2++], z0:Number=vs[i0], z1:Number=vs[i1], z2:Number=vs[i2]; if (z0<_clippingZ && z1<_clippingZ && z2<_clippingZ) { fn = f.normal; fn.world.x = fn.x * m00 + fn.y * m10 + fn.z * m20; fn.world.y = fn.x * m01 + fn.y * m11 + fn.z * m21; fn.world.z = fn.x * m02 + fn.y * m12 + fn.z * m22; if (vs[f.pvi-2]*fn.world.x + vs[f.pvi-1]*fn.world.y + vs[f.pvi]*fn.world.z <= 0) { _facesProjected.push(f); } } } _facesProjected.sort(function(f1:Face, f2:Face):Number{ return vs[f1.pvi] - vs[f2.pvi]; }); _meshProjected = mesh; return this; } /** project slower than transformVectors() but Vector3D.w considerable. */ public function projectPoint3D(points:Vector.<Point3D>) : Render3D { var m:Vector.<Number> = matrix.rawData, p:Point3D, m00:Number = m[0], m01:Number = m[1], m02:Number = m[2], m10:Number = m[4], m11:Number = m[5], m12:Number = m[6], m20:Number = m[8], m21:Number = m[9], m22:Number = m[10], m30:Number = m[12], m31:Number = m[13], m32:Number = m[14]; for each (p in points) { p.world.x = p.x * m00 + p.y * m10 + p.z * m20 + p.w * m30; p.world.y = p.x * m01 + p.y * m11 + p.z * m21 + p.w * m31; p.world.z = p.x * m02 + p.y * m12 + p.z * m22 + p.w * m32; } return this; } // rendering //-------------------------------------------------- /** render solid */ public function renderSolid(light:Light) : Render3D { var idx:int, mat:Material, materials:Vector.<Material> = _meshProjected.materials, vout:Vector.<Number> = _meshProjected.verticesOnScreen; Utils3D.projectVectors(_projectionMatrix, _meshProjected.verticesOnWorld, vout, _meshProjected.texCoord); graphics.clear(); for each (var face:Face in _facesProjected) { mat = materials[face.mat]; graphics.beginFill(mat.getColor(light, face.normal.world), mat.alpha); idx = face.i0<<1; _data[0] = vout[idx]; idx++; _data[1] = vout[idx]; idx = face.i1<<1; _data[2] = vout[idx]; idx++; _data[3] = vout[idx]; idx = face.i2<<1; _data[4] = vout[idx]; idx++; _data[5] = vout[idx]; if (face.i3 == -1) { graphics.drawPath(_cmdTriangle, _data); } else { idx = face.i3<<1; _data[6] = vout[idx]; idx++; _data[7] = vout[idx]; graphics.drawPath(_cmdQuadrangle, _data); } graphics.endFill(); } return this; } /** render with texture */ private var _indices:Vector.<int> = new Vector.<int>(); // temporary index list public function renderTexture(texture:BitmapData) : Render3D { var idx:int, mat:Material, indices:Vector.<int> = _indices; indices.length = 0; for each (var face:Face in _facesProjected) { indices.push(face.i0, face.i1, face.i2); } Utils3D.projectVectors(_projectionMatrix, _meshProjected.verticesOnWorld, _meshProjected.verticesOnScreen, _meshProjected.texCoord); graphics.clear(); graphics.beginBitmapFill(texture, null, false, true); graphics.drawTriangles(_meshProjected.verticesOnScreen, indices, _meshProjected.texCoord); graphics.endFill(); return this; } } /** Point3D */ class Point3D extends Vector3D { public var world:Vector3D; function Point3D(x:Number=0, y:Number=0, z:Number=0, w:Number=1) { super(x,y,z,w); world=clone(); } } /** Face */ class Face { public var i0:int, i1:int, i2:int, i3:int, pvi:int, mat:int, normal:Point3D; static private var _freeList:Vector.<Face> = new Vector.<Face>(); static public function free(face:Face) : void { _freeList.push(face); } static public function alloc(i0:int, i1:int, i2:int, i3:int, mat:int) : Face { var f:Face = _freeList.pop() || new Face(); f.i0=i0; f.i1=i1; f.i2=i2; f.i3=i3; f.pvi=0; f.mat=mat; return f; } } /** Mesh */ class Mesh { public var materials:Vector.<Material>; // material list public var vertices:Vector.<Number>; // vertex public var verticesOnWorld:Vector.<Number>; // vertex on camera coordinate public var verticesOnScreen:Vector.<Number>; // vertex on screen public var verticesCount:int; // vertex count public var texCoord:Vector.<Number>; // texture coordinate public var faces:Vector.<Face> = new Vector.<Face>(); // face list public var vnormals:Vector.<Vector3D>; // vertex normal /** constructor */ function Mesh(materials:Vector.<Material>=null) { this.materials = materials; this.vertices = new Vector.<Number>(); this.texCoord = new Vector.<Number>(); this.verticesOnWorld = new Vector.<Number>(); this.verticesOnScreen = new Vector.<Number>(); this.vnormals = null; this.verticesCount = 0; } /** clear all faces */ public function clear() : Mesh { for each (var face:Face in faces) Face.free(face); faces.length = 0; return this; } /** register face */ public function face(i0:int, i1:int, i2:int, mat:int=0) : Mesh { faces.push(Face.alloc(i0, i1, i2, -1, mat)); return this; } /** register quadrangle face. set div=true to divide into 2 triangles. */ public function qface(i0:int, i1:int, i2:int, i3:int, mat:int=0, div:Boolean=true) : Mesh { if (div) faces.push(Face.alloc(i0, i1, i2, -1, mat), Face.alloc(i3, i2, i1, -1, mat)); else faces.push(Face.alloc(i0, i1, i3, i2, mat)); return this; } /** put mesh on world coordinate. */ public function put(src:Mesh, mat:int=-1) : Mesh { var i0:int = vertices.length, imax:int, i:int; imax = (src.verticesCount<<1) + src.verticesCount; vertices.length += imax; for (i=0; i<imax; i++) vertices[i0+i] = src.verticesOnWorld[i]; i0 /= 3; for each (var f:Face in src.faces) { i = (mat == -1) ? f.mat : mat; if (f.i3==-1) face (f.i0+i0, f.i1+i0, f.i2+i0, i); else qface(f.i0+i0, f.i1+i0, f.i3+i0, f.i2+i0, i, false); } return this; } /** update face gravity point and normal */ public function updateFaces() : Mesh { verticesCount = vertices.length/3; var vs:Vector.<Number> = vertices; for each (var f:Face in faces) { f.pvi = vs.length+2; var i0:int=(f.i0<<1)+f.i0, i1:int=(f.i1<<1)+f.i1, i2:int=(f.i2<<1)+f.i2; var x01:Number=vs[i1]-vs[i0], x02:Number=vs[i2]-vs[i0]; vs.push((vs[i0++] + vs[i1++] + vs[i2++]) * 0.333333333333); var y01:Number=vs[i1]-vs[i0], y02:Number=vs[i2]-vs[i0]; vs.push((vs[i0++] + vs[i1++] + vs[i2++]) * 0.333333333333); var z01:Number=vs[i1]-vs[i0], z02:Number=vs[i2]-vs[i0]; vs.push((vs[i0++] + vs[i1++] + vs[i2++]) * 0.333333333333); f.normal = new Point3D(y02*z01-y01*z02, z02*x01-z01*x02, x02*y01-x01*y02, 0); f.normal.normalize(); if (f.i3 != -1) { var i3:int = (f.i3<<1)+f.i3; vs[f.pvi-2] = vs[f.pvi-2]*0.75 + vs[i3++]*0.25; vs[f.pvi-1] = vs[f.pvi-1]*0.75 + vs[i3++]*0.25; vs[f.pvi] = vs[f.pvi] *0.75 + vs[i3] *0.25; } } return this; } } /** Light */ class Light extends Point3D { public var halfVector:Vector3D = new Vector3D(); /** constructor (set position) */ function Light(x:Number=1, y:Number=1, z:Number=1) { super(x, y, z, 0); normalize(); } /** projection */ public function transformBy(matrix:Matrix3D) : void { world = matrix.deltaTransformVector(this); halfVector.x = world.x; halfVector.y = world.y; halfVector.z = world.z + 1; halfVector.normalize(); } } /** Material */ class Material extends BitmapData { public var alpha:Number = 1; // The alpha value is available for renderSolid() public var doubleSided:int = 0; // set doubleSided=-1 if double sided material /** constructor */ function Material(dif:int=128, spc:int=128) { super(dif, spc, false); } /** set color. */ public function setColor(col:uint, amb:int=64, dif:int=192, spc:int=0, pow:Number=8) : Material { fillRect(rect, col); var lmap:LightMap = new LightMap(width, height); draw(lmap.diffusion(amb, dif), null, null, "hardlight"); draw(lmap.specular (spc, pow), null, null, "add"); lmap.dispose(); return this; } /** calculate color by light and normal vector. */ public function getColor(l:Light, n:Vector3D) : uint { var dir:Vector3D = l.world, hv:Vector3D = l.halfVector; var ln:int = int((dir.x * n.x + dir.y * n.y + dir.z * n.z) * (width-1)), hn:int = int((hv.x * n.x + hv.y * n.y + hv.z * n.z) * (height-1)); if (ln<0) ln = (-ln) & doubleSided; if (hn<0) hn = (-hn) & doubleSided; return getPixel(ln, hn); } } class LightMap extends BitmapData { function LightMap(dif:int, spc:int) { super(dif, spc, false); } public function diffusion(amb:int, dif:int) : BitmapData { var col:int, rc:Rectangle = new Rectangle(0, 0, 1, height), ipk:Number = 1 / width; for (rc.x=0; rc.x<width; rc.x+=1) { col = ((rc.x * (dif - amb)) * ipk) + amb; fillRect(rc, (col<<16)|(col<<8)|col); } return this; } public function specular(spc:int, pow:Number) : BitmapData { var col:int, rc:Rectangle = new Rectangle(0, 0, width, 1), mpk:Number = (pow + 2) * 0.15915494309189534, ipk:Number = 1 / height; for (rc.y=0; rc.y<height; rc.y+=1) { col = Math.pow(rc.y * ipk, pow) * spc * mpk; if (col > 255) col = 255; fillRect(rc, (col<<16)|(col<<8)|col); } return this; } }
//////////////////////////////////////////////////////////////////////////////// // // 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.ui.rulers { import bxf.ui.inspectors.DynamicPropertyEditorBase; import flash.display.DisplayObject; import flash.display.GradientType; import flash.events.MouseEvent; import flash.geom.Matrix; import flash.geom.Point; import flash.geom.Rectangle; import flash.text.engine.TabAlignment; import flashx.textLayout.container.ContainerController; import flashx.textLayout.edit.EditManager; import flashx.textLayout.edit.ElementRange; import flashx.textLayout.edit.SelectionState; import flashx.textLayout.elements.ContainerFormattedElement; import flashx.textLayout.elements.ParagraphElement; import flashx.textLayout.elements.TextFlow; import flashx.textLayout.compose.TextFlowLine; import flashx.textLayout.events.SelectionEvent; import flashx.textLayout.formats.ITextLayoutFormat; import flashx.textLayout.formats.ITabStopFormat; import flashx.textLayout.formats.TextLayoutFormat; import flashx.textLayout.formats.TabStopFormat; import flashx.textLayout.formats.BlockProgression; import flashx.textLayout.tlf_internal; import flashx.textLayout.ui.inspectors.TabPropertyEditor; import flashx.textLayout.ui.inspectors.TextInspectorController; import mx.containers.Canvas; import mx.core.ScrollPolicy; import mx.core.UIComponent; import mx.events.PropertyChangeEvent; import mx.events.ResizeEvent; use namespace tlf_internal; public class RulerBar extends Canvas { public static const RULER_HORIZONTAL:String = "horizontal"; public static const RULER_VERTICAL:String = "vertical"; public function RulerBar() { super(); horizontalScrollPolicy = ScrollPolicy.OFF; verticalScrollPolicy = ScrollPolicy.OFF; mDefaultTabStop = new TabStopFormat(TabStopFormat.defaultFormat); addEventListener(MouseEvent.MOUSE_DOWN, onRulerMouseDown); selectMarker(null); TextInspectorController.Instance().AddRuler(this); curParagraphFormat = null; } override public function initialize():void { super.initialize(); adjustForActive(); } public function creationComplete():void { if (mSyncToPanel) { mSyncToPanel.addEventListener(ResizeEvent.RESIZE, onSyncPanelResize); } SyncRulerToPanel(); mIndentMarker = addParagraphPropertyMarker(TextLayoutFormat.textIndentProperty.name); mLeftMarginMarker = addParagraphPropertyMarker(TextLayoutFormat.paragraphStartIndentProperty.name); mRightMarginMarker = addParagraphPropertyMarker(TextLayoutFormat.paragraphEndIndentProperty.name); } public function set activeFlow(inFlow:TextFlow):void { if (inFlow && !inFlow.interactionManager is EditManager) throw new Error("Can't set the active flow to a flow without an EditManager."); if (mActiveFlow) { mActiveFlow.removeEventListener(SelectionEvent.SELECTION_CHANGE, onTextSelectionChanged); mEditManager = null; } mActiveFlow = inFlow; mLastSelActiveIdx = -1; mLastSelAnchorIdx = -1; mTabSet = null; RemoveTabMarkers(); selectMarker(null); if (mActiveFlow) { mEditManager = mActiveFlow.interactionManager as EditManager; mActiveFlow.addEventListener(SelectionEvent.SELECTION_CHANGE, onTextSelectionChanged); } else onTextSelectionChanged(null); } public function get activeFlow():TextFlow { return mActiveFlow; } public function set active(inActive:Boolean):void { mActive = inActive; selectMarker(null); adjustForActive(); } public function get active():Boolean { return mActive; } private function set rightRuler(inActive:Boolean):void { mRightRuler = inActive; adjustForActive(); } private function get rightRuler():Boolean { return mRightRuler; } private function adjustForActive():void { if (parent) { if (mActive && mRightRuler) { parent.visible = true; if (parent is Canvas) (parent as Canvas).includeInLayout = true; } else { parent.visible = false; if (parent is Canvas) (parent as Canvas).includeInLayout = false; } } } public function set orientation(inOrientation:String):void { if (inOrientation != mOrientation && (inOrientation == RULER_HORIZONTAL || inOrientation == RULER_VERTICAL)) { mOrientation = inOrientation; } } public function set syncToPanel(inPanel:UIComponent):void { mSyncToPanel = inPanel; } public function set tabPropertyEditor(inEditor:TabPropertyEditor):void { mPropertyEditor = inEditor; mPropertyEditor.addEventListener(DynamicPropertyEditorBase.MODELCHANGED_EVENT, onFormatValueChanged, false, 0, true); mPropertyEditor.addEventListener(DynamicPropertyEditorBase.MODELEDITED_EVENT, onFormatValueChanged, false, 0, true); selectMarker(mSelectedMarker); } private function onSyncPanelResize(evt:ResizeEvent):void { RedrawRuler(); } public function RedrawRuler():void { SyncRulerToPanel(); if (curParagraphFormat != null) { ShowTabs(curParagraphFormat); } } private function SyncRulerToPanel():void { if (mActiveFlow && mActiveFlow.flowComposer && rightRuler) { var selStart:int = Math.min(mActiveFlow.interactionManager.activePosition, mActiveFlow.interactionManager.anchorPosition); var line:TextFlowLine = selStart != -1 ? mActiveFlow.flowComposer.findLineAtPosition(selStart) : null; if (line) { var controller:ContainerController; var containerDO:DisplayObject; if (line.controller) { controller = line.controller; containerDO = controller.container as DisplayObject; } else { // get the last container controller = mActiveFlow.flowComposer.getControllerAt(mActiveFlow.flowComposer.numControllers-1); containerDO = controller.container as DisplayObject; } var localOrigin:Point = parent.globalToLocal(containerDO.parent.localToGlobal(new Point(containerDO.x, containerDO.y))); var columnBounds:Rectangle; var columnIndex:int = line.columnIndex; if (columnIndex == -1) columnBounds = controller.columnState.getColumnAt(controller.columnState.columnCount - 1); else { // columnIndex is an index into all the columns in the flow, so to get the actual // column bounds var idx:int = 0; var ch:ContainerController = mActiveFlow.flowComposer.getControllerAt(idx); while (ch && ch != controller) { columnIndex -= ch.columnState.columnCount; idx++; ch = idx == mActiveFlow.flowComposer.numControllers ? null : mActiveFlow.flowComposer.getControllerAt(idx); } // Pin the column number to the actual range of column indices. I have found this // is needed when the insertion point is inside a table (because the line's container // is not in the flow's list of containers) or when the insertion point is in regular // text after a table (the column number doesn't make sense, and I think it's a bug, which // I have written to Robin about. columnIndex = Math.max(0, Math.min(line.columnIndex, controller.columnState.columnCount - 1)); columnBounds = controller.columnState.getColumnAt(columnIndex); } if (columnBounds) { if (mOrientation == RULER_HORIZONTAL) { x = localOrigin.x + columnBounds.x; y = 0; height = parent.height; width = columnBounds.width; } else { x = parent.width; y = localOrigin.y + columnBounds.y; rotation = 90; height = parent.width; width = columnBounds.height; } } } } } private function onTextSelectionChanged(e:SelectionEvent):void { curParagraphFormat = null; if (mEditManager && (mEditManager.activePosition != mLastSelActiveIdx || mEditManager.anchorPosition != mLastSelAnchorIdx)) { mLastSelActiveIdx = mActiveFlow.interactionManager.activePosition; mLastSelAnchorIdx = mActiveFlow.interactionManager.anchorPosition; selectMarker(null); } if (e) { var selState:SelectionState = e.selectionState; var selectedElementRange:ElementRange = selState ? ElementRange.createElementRange(selState.textFlow, selState.absoluteStart, selState.absoluteEnd) : null; if (selectedElementRange) { var rootElement:ContainerFormattedElement = selectedElementRange.firstLeaf.getAncestorWithContainer(); if ((rootElement.computedFormat.blockProgression == BlockProgression.RL) == (mOrientation == RULER_VERTICAL)) { // should be active if (rightRuler != true) { mTabSet = null; } if (!rightRuler) rightRuler = true; } else { // should be inactive if (rightRuler != false) { mTabSet = null; } if (rightRuler) rightRuler = false; } curParagraphFormat = new TextLayoutFormat(selectedElementRange.firstParagraph.computedFormat); setRightToLeft(curParagraphFormat.direction == flashx.textLayout.formats.Direction.RTL); ShowTabs(curParagraphFormat); } else ShowTabs(null); } else ShowTabs(null); } private function RemoveTabMarkers():void { var markers:Array = getChildren(); for each (var marker:UIComponent in markers) if (marker is TabMarker) this.removeChild(marker); } private function ShowTabs(inFormat:ITextLayoutFormat):void { SyncRulerToPanel(); var tabs:Array = inFormat ? ((inFormat.tabStops && (inFormat.tabStops.length > 0)) ? inFormat.tabStops as Array : null) : null; if (isNewTabSet(tabs)) { mTabSet = tabs; if (mUpdateFromSelection) { RemoveTabMarkers(); var oldSel:RulerMarker = mSelectedMarker; selectMarker(null); if (mTabSet) for each(var tab:TabStopFormat in mTabSet) { var tabMarker:TabMarker = addTabMarker(tab); if (oldSel && oldSel.pos == tabMarker.pos) selectMarker(tabMarker); } } } if (inFormat) { if(mIndentMarker) { mIndentMarker.rightToLeftPar = mRightToLeft; mIndentMarker.pos = Number(inFormat.textIndent); mIndentMarker.relativeToPosition = inFormat.paragraphStartIndent; } if(mLeftMarginMarker) { mLeftMarginMarker.rightToLeftPar = mRightToLeft; mLeftMarginMarker.pos = rightToLeft ? Number(inFormat.paragraphEndIndent): Number(inFormat.paragraphStartIndent); } if(mRightMarginMarker) { mRightMarginMarker.rightToLeftPar = mRightToLeft; mRightMarginMarker.pos = rightToLeft ? Number(inFormat.paragraphStartIndent): Number(inFormat.paragraphEndIndent); } } } private function addTabMarker(tabAttrs:ITabStopFormat):TabMarker { var tabMarker:TabMarker = new TabMarker(this, tabAttrs); tabMarker.addEventListener(MouseEvent.MOUSE_DOWN, onMarkerMouseDown); addChild(tabMarker); return tabMarker; } private function addParagraphPropertyMarker(inProperty:String):ParagraphPropertyMarker { var propMarker:ParagraphPropertyMarker = new ParagraphPropertyMarker(this, inProperty); propMarker.addEventListener(MouseEvent.MOUSE_DOWN, onMarkerMouseDown); addChild(propMarker); return propMarker; } private function isNewTabSet(inTabs:Array):Boolean { if (inTabs == mTabSet) return false; if ((inTabs == null) != (mTabSet == null)) return true; if (inTabs) { if (inTabs.length == mTabSet.length) { var n:int = inTabs.length; for (var i:int = 0; i < n; ++i) { if (inTabs[i] != mTabSet[i]) return true; } return false; } else return true; } return false; } override protected function updateDisplayList(w:Number, h:Number):void { super.updateDisplayList(w, h); graphics.clear(); var m:Matrix = new Matrix(); m.createGradientBox(height, height, Math.PI / 2); graphics.beginGradientFill(GradientType.LINEAR, [0xffffff, 0xe0e0e0], [1, 1], [0, 255], m); graphics.drawRect(0, 0, w, h); graphics.endFill(); graphics.lineStyle(1, 0x404040, 1.0, true); for (var x:int = 0; x < w; x += 10) { var rulerX:Number = rightToLeft ? w - x - 1 : x; if (x % 100 == 0) graphics.moveTo(rulerX, 12); else if (x % 50 == 0) graphics.moveTo(rulerX, 9); else graphics.moveTo(rulerX, 5); graphics.lineTo(rulerX, 0); } } private function onMarkerMouseDown(e:MouseEvent):void { if (mEditManager) { var cookie:Object; if (e.target is TabMarker) { var tabMarker:TabMarker = e.target as TabMarker; selectMarker(tabMarker); e.stopPropagation(); cookie = new Object(); cookie["marker"] = tabMarker; cookie["offset"] = e.localX; cookie["onRuler"] = true; mUpdateFromSelection = false; new RulerDragTracker(this.parentApplication as UIComponent, this, cookie).BeginTracking(e, false); } else if (e.target is ParagraphPropertyMarker) { var propMarker:ParagraphPropertyMarker = e.target as ParagraphPropertyMarker; selectMarker(null); e.stopPropagation(); cookie = new Object(); cookie["marker"] = propMarker; cookie["offset"] = e.localX; new RulerDragTracker(this.parentApplication as UIComponent, this, cookie).BeginTracking(e, false); } } } private function onRulerMouseDown(e:MouseEvent):void { if (e.target is RulerBar && mEditManager) { var tabMarker:TabMarker = addTabMarker(mDefaultTabStop); tabMarker.markerLeft = e.localX + tabMarker.hOffset; selectMarker(tabMarker); mUpdateFromSelection = false; setFormatFromRuler(); e.stopPropagation(); var cookie:Object = new Object(); cookie["marker"] = tabMarker; cookie["offset"] = -tabMarker.hOffset; cookie["onRuler"] = true; new RulerDragTracker(this.parentApplication as UIComponent, this, cookie, 0).BeginTracking(e, false); } } public function TrackDrag(inCurPos:Point, inCookie:Object, inCommit:Boolean):void { if (inCookie) { if (inCookie["marker"] is TabMarker) { var tabMarker:TabMarker = inCookie["marker"] as TabMarker; var wasOnRuler:Boolean = inCookie["onRuler"]; if (inCookie["onRuler"] && inCurPos.y > height + 16) { inCookie["onRuler"] = false; removeChild(tabMarker); selectMarker(null); } else if (!inCookie["onRuler"] && inCurPos.y <= height + 16) { inCookie["onRuler"] = true; addChild(tabMarker); selectMarker(tabMarker); } tabMarker.markerLeft = inCurPos.x - inCookie["offset"]; if (wasOnRuler || inCookie["onRuler"]) setFormatFromRuler(); } else if (inCookie["marker"] is ParagraphPropertyMarker) { var propMarker:ParagraphPropertyMarker = inCookie["marker"] as ParagraphPropertyMarker; propMarker.markerLeft = inCurPos.x - inCookie["offset"]; var pa:TextLayoutFormat = new TextLayoutFormat(); pa[propMarker.property] = propMarker.pos; mEditManager.applyParagraphFormat(pa); } } if (inCommit) mUpdateFromSelection = true; } public function DragCancelled():void { mUpdateFromSelection = true; } private function selectMarker(inMarker:RulerMarker):void { if (mSelectedMarker) mSelectedMarker.setStyle("selected", false); mSelectedMarker = inMarker; if (mSelectedMarker) mSelectedMarker.setStyle("selected", true); updatePropertyEditor(); } private function updatePropertyEditor():void { if (mRightRuler && mPropertyEditor && mTabPanelActive) { mPropertyEditor.reset(); mPropertyEditor.properties["rulervisible"] = TextInspectorController.Instance().rulerVisible; if (TextInspectorController.Instance().rulerVisible) { var tab:ITabStopFormat = mSelectedMarker as ITabStopFormat; if (!tab) tab = mDefaultTabStop as ITabStopFormat; if (tab) { mPropertyEditor.properties["alignment"] = tab.alignment; if (tab != mDefaultTabStop) mPropertyEditor.properties["position"] = tab.position; if (tab.alignment == flash.text.engine.TabAlignment.DECIMAL) mPropertyEditor.properties["decimalAlignmentToken"] = tab.decimalAlignmentToken; } } mPropertyEditor.rebuildUI(); } } private function onFormatValueChanged(e:PropertyChangeEvent):void { if (mRightRuler) { var property:String = e.property as String; if (property == "rulervisible") TextInspectorController.Instance().rulerVisible = (e.newValue == "true" ? true : false); else { if (e.type == DynamicPropertyEditorBase.MODELEDITED_EVENT) mUpdateFromSelection = false; var tab:Object = mSelectedMarker; if (!tab) tab = mDefaultTabStop; var newValue:Object = e.newValue; if (property == "position") newValue = Number(newValue); tab[property] = newValue; if (property == "alignment" && newValue == flash.text.engine.TabAlignment.DECIMAL && tab["decimalAlignmentToken"] == null) tab["decimalAlignmentToken"] = ""; if (mSelectedMarker) setFormatFromRuler(); if (e.type == DynamicPropertyEditorBase.MODELCHANGED_EVENT) mUpdateFromSelection = true; updatePropertyEditor(); } } } private function setFormatFromRuler():void { var newTabs:Array = []; if (mSelectedMarker && mSelectedMarker.parent) newTabs.push(new TabStopFormat(mSelectedMarker as ITabStopFormat)); var markers:Array = getChildren(); for each (var marker:UIComponent in markers) if (marker is TabMarker) { var tab:TabMarker = marker as TabMarker; if (isUniquePosition(newTabs, tab.pos)) newTabs.push(new TabStopFormat(tab)); } newTabs.sortOn("position", Array.NUMERIC); var pa:TextLayoutFormat = new TextLayoutFormat(); pa.tabStops = newTabs; mEditManager.applyParagraphFormat(pa); updatePropertyEditor(); } private static function isUniquePosition(inTabFormat:Array, inNewPosition:Number):Boolean { for each (var tab:TabStopFormat in inTabFormat) if (tab.position == inNewPosition) return false; return true; } public function set tabPanelActive(inActive:Boolean):void { if (mTabPanelActive != inActive) { mTabPanelActive = inActive; if (mTabPanelActive) updatePropertyEditor(); } } public function get tabPanelActive():Boolean { return mTabPanelActive; } public function get rightToLeft():Boolean { return mRightToLeft; } private function setRightToLeft(inRTL:Boolean):void { if (inRTL != mRightToLeft) { mTabSet = null; mRightToLeft = inRTL; invalidateDisplayList(); } } private var mActive:Boolean = true; private var mActiveFlow:TextFlow = null; private var mEditManager:EditManager = null; private var mTabSet:Array = null; private var mSelectedMarker:RulerMarker = null; private var mUpdateFromSelection:Boolean = true; private var mDefaultTabStop:TabStopFormat; private var mPropertyEditor:TabPropertyEditor = null; private var mOrientation:String = RULER_HORIZONTAL; private var mSyncToPanel:UIComponent = null; private var mRightRuler:Boolean = true; private var mLastSelAnchorIdx:int = -1; private var mLastSelActiveIdx:int = -1; private var mIndentMarker:ParagraphPropertyMarker = null; private var mLeftMarginMarker:ParagraphPropertyMarker = null; private var mRightMarginMarker:ParagraphPropertyMarker = null; private var mTabPanelActive:Boolean = false; private var mRightToLeft:Boolean = false; private var curParagraphFormat:TextLayoutFormat = null; } }
/** * 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.tc.events { import flash.events.Event; import flash.utils.getQualifiedClassName; public class AccessEvent extends ParameterEvent { public static const SET_ROLE :String = getQualifiedClassName(AccessEvent) + ".SET_ROLE"; public function AccessEvent(type:String, parameters:Object = null, bubbles:Boolean = false, cancelable:Boolean = false) { super(type, parameters, bubbles, cancelable); } public override function clone():Event { return new AccessEvent(type, parameters, bubbles, cancelable); } } }
/* * =BEGIN CLOSED LICENSE * * Copyright (c) 2013-2014 Andras Csizmadia * http://www.vpmedia.eu * * For information about the licensing and copyright please * contact Andras Csizmadia at andras@vpmedia.eu * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * =END CLOSED LICENSE */ package hu.vpmedia.utils { /** * * Copyright (c) 2008 Noel Billig (www.dncompute.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ /* * @param width - if width is -1, the arrow is equilateral * @param shaftPosition - Determines how far along the arrow * shaft the head is connected. -1 will result in a * diamond shape, 0 will be a standard triangle, .5 will * be a recessed arrow (like a mouse pointer). Anything * greater than 1 will invert the shape. * @param shaftControlPosition - let's you curve the line where * the base points meet the shaft. Determines what percentage * from the shaft-head to base points to place the control points * @param shaftControlSize - Less than .5 sharpens the * shape, whereas anything greater than .5 makes it bulbous */ public class ArrowStyle { public var headWidth:Number = -1; //Relative width of arrow head /** * * Not used in drawArrowHead because the length is * determined by the points passed in * */ public var headLength:Number = 10; //Pixel Length of arrow head public var shaftThickness:Number = 2; public var shaftPosition:Number = 0; /** * Not used in drawArrow, only drawArrowHead * This let's you curve the line at the base of the arrow */ public var shaftControlPosition:Number = .5; /** * Not used in drawArrow, only drawArrowHead * This let's you curve the line at the base of the arrow */ public var shaftControlSize:Number = .5; public var edgeControlPosition:Number = .5; public var edgeControlSize:Number = .5; public function ArrowStyle(presets:Object = null) { if (presets != null) { for (var name:String in presets) { this[name] = presets[name]; } } } } }
package kabam.lib.console.signals { import org.osflash.signals.Signal; public final class RemoveConsoleSignal extends Signal { public function RemoveConsoleSignal() { super(); } } }
/* Copyright 2012-2013 Renaun Erickson 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. @author Renaun Erickson / renaun.com / @renaun */ package flash.profiler { public class showRedrawRegions { public function showRedrawRegions() { } } }
package org.motivateclock.view.clock { import flash.display.DisplayObject; import flash.display.MovieClip; import flash.display.SimpleButton; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.ui.Keyboard; import org.motivateclock.Model; import org.motivateclock.enum.TextKeyEnum; import org.motivateclock.enum.TypeEnum; import org.motivateclock.events.McEvent; import org.motivateclock.events.ModelEvent; import org.motivateclock.model.Project; import org.motivateclock.model.ProjectsModel; import org.motivateclock.resource.ResourceLib; import org.motivateclock.utils.RegularUtils; import org.motivateclock.view.components.Hint; import org.motivateclock.view.components.SmartContainer; import org.motivateclock.view.windows.SettingWindow; /** * @author: Valeriy Bashtovoy * */ public class ClockToggleView extends MovieClip { private var _workButton:ToggleButton; private var _restButton:ToggleButton; private var _pauseButton:SimpleButton; private var _exitButton:SimpleButton; private var _settingButton:SimpleButton; private var _idleButtonUpState:DisplayObject; private var _fontSize:int; private var _gfx:MovieClip; private var _smartContainer:SmartContainer; private var _offset:int = -1; private var _settingWindow:SettingWindow; private var _model:Model; private var _project:Project; public function ClockToggleView(model:Model) { _model = model; } public function initialize():void { _gfx = RegularUtils.getInstanceFromLib(ResourceLib.GFX_CLOCK_TOGGLE_VIEW) as MovieClip; addChild(_gfx); _settingWindow = SettingWindow.getInstance(); _pauseButton = _gfx["pauseButton"]; _exitButton = _gfx["exitButton"]; _settingButton = _gfx["settingButton"]; _workButton = new ToggleButton(); _workButton.y = 2; _restButton = new ToggleButton(); _restButton.y = 2; _idleButtonUpState = _pauseButton.upState; _smartContainer = new SmartContainer(this, SmartContainer.HORIZONTAL); _smartContainer.offset = _offset; _smartContainer.addItem(_workButton); _smartContainer.addItem(_pauseButton); _smartContainer.addItem(_restButton); _smartContainer.addItem(_settingButton); _smartContainer.addItem(_exitButton); _model.languageModel.addEventListener(McEvent.LANGUAGE_CHANGED, languageChangeHandler); languageChangeHandler(); projectChangeHandler(); typeChangeHandler(); _restButton.addEventListener(MouseEvent.CLICK, toggleClickHandler); _workButton.addEventListener(MouseEvent.CLICK, toggleClickHandler); _pauseButton.addEventListener(MouseEvent.CLICK, toggleClickHandler); _settingButton.addEventListener(MouseEvent.CLICK, clickHandler); _exitButton.addEventListener(MouseEvent.CLICK, clickHandler); _exitButton.addEventListener(MouseEvent.MOUSE_OVER, buttonOverHandler); _settingButton.addEventListener(MouseEvent.MOUSE_OVER, buttonOverHandler); _exitButton.addEventListener(MouseEvent.MOUSE_OUT, buttonOutHandler); _settingButton.addEventListener(MouseEvent.MOUSE_OUT, buttonOutHandler); _model.addEventListener(ModelEvent.TYPE_CHANGE, typeChangeHandler); ProjectsModel.getInstance().addEventListener(ModelEvent.PROJECT_CHANGE, projectChangeHandler); stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler, false, 0, true); } private function keyHandler(event:KeyboardEvent):void { if (!event.ctrlKey) { return; } switch (event.keyCode) { case Keyboard.O: if (!_settingWindow.visible) { _settingWindow.showSetting(); } else { _settingWindow.hide(); } break; } } private function languageChangeHandler(event:McEvent = null):void { _workButton.setLabel(_model.languageModel.getText(TextKeyEnum.WORK), _fontSize); _restButton.setLabel(_model.languageModel.getText(TextKeyEnum.REST), _fontSize); // set similar texts size for both button; var textSize:int = Math.min(_workButton.getTextFieldSize(), _restButton.getTextFieldSize()); _workButton.setTextFieldSize(textSize); _restButton.setTextFieldSize(textSize); _smartContainer.update(); } private function enabledIdleButton(value:Boolean):void { _pauseButton.enabled = value; if (!value) { _pauseButton.upState = _pauseButton.downState; } else { _pauseButton.upState = _idleButtonUpState; } } private function selectedIdleButton(value:Boolean):void { if (value) { _pauseButton.upState = _idleButtonUpState; } else { enabledIdleButton(false); } } private function projectChangeHandler(event:ModelEvent = null):void { if (_project) { _project.removeEventListener(ModelEvent.PROJECT_MODE_CHANGE, project_mode_changeHandler); } _project = _model.projectModel.currentProject; _model.currentType = TypeEnum.IDLE; _project.addEventListener(ModelEvent.PROJECT_MODE_CHANGE, project_mode_changeHandler); typeChangeHandler(); //project_mode_changeHandler(); } private function buttonOverHandler(event:MouseEvent):void { switch (event.target) { case _exitButton: Hint.getInstance().show(this.stage.nativeWindow, _model.languageModel.getText(TextKeyEnum.CLOSE)); break; case _settingButton: Hint.getInstance().show(this.stage.nativeWindow, _model.languageModel.getText(TextKeyEnum.SETTINGS)); break; } } private function buttonOutHandler(event:MouseEvent):void { Hint.getInstance().hide(); } private function clickHandler(event:MouseEvent):void { switch (event.target) { case _settingButton: if (!_settingWindow.visible) { _settingWindow.showSetting(); } else { _settingWindow.hide(); } break; case _exitButton: _model.applicationManager.minimizeToTray(); break; } } private function toggleClickHandler(event:MouseEvent):void { if (_project.isAuto) { return; } switch (event.target) { case _restButton: _model.currentType = TypeEnum.REST; break; case _workButton: _model.currentType = TypeEnum.WORK; break; case _pauseButton: _model.currentType = TypeEnum.IDLE; break; } } private function typeChangeHandler(event:ModelEvent = null):void { enabledIdleButton(false); switch (_model.currentType) { case TypeEnum.WORK: if (!_project.isAuto) { enabledIdleButton(true); _restButton.selected = false; } else { _restButton.enabled = false; selectedIdleButton(true); } _workButton.selected = true; break; case TypeEnum.REST: if (!_project.isAuto) { enabledIdleButton(true); _workButton.selected = false; } else { _workButton.enabled = false; selectedIdleButton(true); } _restButton.selected = true; break; case TypeEnum.IDLE: if (!_project.isAuto) { _workButton.selected = false; _restButton.selected = false; } else { _workButton.enabled = false; _restButton.enabled = false; } enabledIdleButton(false); break; } } private function project_mode_changeHandler(event:ModelEvent = null):void { typeChangeHandler(); } } }
/** * This class is based on the PriorityQueue class from as3ds, and as such * must include this notice: * * DATA STRUCTURES FOR GAME PROGRAMMERS * Copyright (c) 2007 Michael Baczynski, http://www.polygonal.de * * 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 engine.framework.util { import flash.utils.Dictionary; /** * A priority queue to manage prioritized data. * The implementation is based on the heap structure. * * <p>This implementation is based on the as3ds PriorityHeap.</p> */ public class SimplePriorityQueue { private var _heap:Array; private var _size:int; private var _count:int; private var _posLookup:Dictionary; /** * Initializes a priority queue with a given size. * * @param size The size of the priority queue. */ public function SimplePriorityQueue(size:int) { _heap = new Array(_size = size + 1); _posLookup = new Dictionary(true); _count = 0; } /** * The front item or null if the heap is empty. */ public function get front():IPrioritizable { return _heap[1]; } /** * The maximum capacity. */ public function get maxSize():int { return _size; } /** * Enqueues a prioritized item. * * @param obj The prioritized data. * @return False if the queue is full, otherwise true. */ public function enqueue(obj:IPrioritizable):Boolean { if (_count + 1 < _size) { _count++; _heap[_count] = obj; _posLookup[obj] = _count; walkUp(_count); return true; } return false; } /** * Dequeues and returns the front item. * This is always the item with the highest priority. * * @return The queue's front item or null if the heap is empty. */ public function dequeue():IPrioritizable { if (_count >= 1) { var o:* = _heap[1]; delete _posLookup[o]; _heap[1] = _heap[_count]; walkDown(1); delete _heap[_count]; _count--; return o; } return null; } /** * Reprioritizes an item. * * @param obj The object whose priority is changed. * @param newPriority The new priority. * @return True if the repriorization succeeded, otherwise false. */ public function reprioritize(obj:IPrioritizable, newPriority:int):Boolean { if (!_posLookup[obj]) return false; var oldPriority:int = obj.priority; obj.priority = newPriority; var pos:int = _posLookup[obj]; newPriority > oldPriority ? walkUp(pos) : walkDown(pos); return true; } /** * Removes an item. * * @param obj The item to remove. * @return True if removal succeeded, otherwise false. */ public function remove(obj:IPrioritizable):Boolean { if (_count >= 1) { var pos:int = _posLookup[obj]; var o:* = _heap[pos]; delete _posLookup[o]; _heap[pos] = _heap[_count]; walkDown(pos); delete _heap[_count]; delete _posLookup[_count]; _count--; return true; } return false; } /** * @inheritDoc */ public function contains(obj:*):Boolean { return _posLookup[obj] != null; } /** * @inheritDoc */ public function clear():void { _heap = new Array(_size); _posLookup = new Dictionary(true); _count = 0; } /** * @inheritDoc */ public function get size():int { return _count; } /** * @inheritDoc */ public function isEmpty():Boolean { return _count == 0; } /** * @inheritDoc */ public function toArray():Array { return _heap.slice(1, _count + 1); } /** * Prints out a string representing the current object. * * @return A string representing the current object. */ public function toString():String { return "[SimplePriorityQueue, size=" + _size +"]"; } /** * Prints all elements (for debug/demo purposes only). */ public function dump():String { if (_count == 0) return "SimplePriorityQueue (empty)"; var s:String = "SimplePriorityQueue\n{\n"; var k:int = _count + 1; for (var i:int = 1; i < k; i++) { s += "\t" + _heap[i] + "\n"; } s += "\n}"; return s; } private function walkUp(index:int):void { var parent:int = index >> 1; var parentObj:IPrioritizable; var tmp:IPrioritizable = _heap[index]; var p:int = tmp.priority; while (parent > 0) { parentObj = _heap[parent]; if (p - parentObj.priority > 0) { _heap[index] = parentObj; _posLookup[parentObj] = index; index = parent; parent >>= 1; } else break; } _heap[index] = tmp; _posLookup[tmp] = index; } private function walkDown(index:int):void { var child:int = index << 1; var childObj:IPrioritizable; var tmp:IPrioritizable = _heap[index]; var p:int = tmp.priority; while (child < _count) { if (child < _count - 1) { if (_heap[child].priority - _heap[int(child + 1)].priority < 0) child++; } childObj = _heap[child]; if (p - childObj.priority < 0) { _heap[index] = childObj; _posLookup[childObj] = index; _posLookup[tmp] = child; index = child; child <<= 1; } else break; } _heap[index] = tmp; _posLookup[tmp] = index; } } }
package feathers.examples.componentsExplorer.screens { import feathers.controls.Button; import feathers.controls.PanelScreen; import feathers.controls.TextInput; import feathers.events.FeathersEventType; import feathers.examples.componentsExplorer.data.TextInputSettings; import feathers.layout.AnchorLayout; import feathers.layout.AnchorLayoutData; import feathers.system.DeviceCapabilities; import starling.core.Starling; import starling.display.DisplayObject; import starling.events.Event; [Event(name="complete",type="starling.events.Event")] [Event(name="showSettings",type="starling.events.Event")] public class TextInputScreen extends PanelScreen { public static const SHOW_SETTINGS:String = "showSettings"; public function TextInputScreen() { this.addEventListener(FeathersEventType.INITIALIZE, initializeHandler); } public var settings:TextInputSettings; private var _backButton:Button; private var _settingsButton:Button; private var _input:TextInput; protected function initializeHandler(event:Event):void { this.layout = new AnchorLayout(); this._input = new TextInput(); this._input.textEditorProperties.displayAsPassword = this.settings.displayAsPassword; const inputLayoutData:AnchorLayoutData = new AnchorLayoutData(); inputLayoutData.horizontalCenter = 0; inputLayoutData.verticalCenter = 0; this._input.layoutData = inputLayoutData; this.addChild(this._input); this.headerProperties.title = "Text Input"; if(!DeviceCapabilities.isTablet(Starling.current.nativeStage)) { this._backButton = new Button(); this._backButton.label = "Back"; this._backButton.addEventListener(Event.TRIGGERED, backButton_triggeredHandler); this.headerProperties.leftItems = new <DisplayObject> [ this._backButton ]; } this._settingsButton = new Button(); this._settingsButton.label = "Settings"; this._settingsButton.addEventListener(Event.TRIGGERED, settingsButton_triggeredHandler); this.headerProperties.rightItems = new <DisplayObject> [ this._settingsButton ]; // handles the back hardware key on android this.backButtonHandler = this.onBackButton; } private function onBackButton():void { this.dispatchEventWith(Event.COMPLETE); } private function backButton_triggeredHandler(event:Event):void { this.onBackButton(); } private function settingsButton_triggeredHandler(event:Event):void { this.dispatchEventWith(SHOW_SETTINGS); } } }
package com.noteflight.standingwave3.modulation { public class VibratoModulation implements IPerformableModulation { public var startTime:Number; public var endTime:Number; public var frequency:Number; public var maxValue:Number; public var minValue:Number; public function VibratoModulation(startTime:Number, endTime:Number, frequency:Number, minValue:Number, maxValue:Number) { this.startTime = startTime; this.endTime = endTime; this.frequency = frequency; this.maxValue = maxValue; this.minValue = minValue; } public function realize(data:IModulationData):void { var position:Number = Math.floor( startTime * data.rate ); var framesPerHalfCycle:Number = Math.floor( 0.5 * data.rate / frequency ); var endPosition:Number = endTime * data.rate; while (position <= endPosition) { // Add the new keyframes to create a triangle shaped modulation // The realization will always complete a cycle of vibrato beyond the end time data.addKeyframe( new ModulationKeyframe(position-1, minValue) ); data.addKeyframe( new ModulationKeyframe(position, minValue) ); position += framesPerHalfCycle; data.addKeyframe( new ModulationKeyframe( position, maxValue ) ); data.addKeyframe( new ModulationKeyframe( position+1, maxValue ) ); position += framesPerHalfCycle; } } } }
package com.indiestream.sceens { import com.confluence.core.managers.ManagerStage; import com.greensock.TweenMax; import com.indiestream.common.Constants; import com.indiestream.controls.playcontrols.ControlBar; import com.indiestream.controls.videoplayer.VideoPlayer; import com.indiestream.events.ControlEvent; import com.indiestream.model.Model; import com.indiestream.model.VOVideo; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.geom.Point; import flash.ui.Mouse; import flash.utils.Timer; import mx.binding.utils.BindingUtils; import mx.binding.utils.ChangeWatcher; import org.mangui.hls.constant.HLSPlayStates; public class ScreenPlayer extends Sprite { public static const CONTROL_BAR_HIDE : String = "control_bar_hide"; public static const CONTROL_BAR_SHOW : String = "control_bar_show"; public static const DURATION : Number = 0.5; public function ScreenPlayer() { super(); this._model = Model.getInstance(); this._createChildren(); this.addEventListener(Event.ADDED_TO_STAGE, _onStageAdd); } private var _controls : ControlBar; private var _grcBackground : Sprite; private var _mngStage : ManagerStage; private var _model : Model; private var _scrVideoPlayer: VideoPlayer; private var _controlBarTimeout : Timer; private var _watcherPlayState : ChangeWatcher; private var _watcherVideo : ChangeWatcher; private var _watcherVolume : ChangeWatcher; private var _stateControlBar : String = CONTROL_BAR_SHOW; public function get stateControlBar() : String { return this._stateControlBar; } public function set stateControlBar( state : String ) : void { if(this._stateControlBar != state) { switch(state) { case CONTROL_BAR_HIDE: Mouse.hide(); TweenMax.killTweensOf(this._controls); TweenMax.to(this._controls, DURATION, { autoAlpha : 0 } ); this._stateControlBar = state; break; case CONTROL_BAR_SHOW: Mouse.show(); TweenMax.killTweensOf(this._controls); TweenMax.to(this._controls, DURATION, { autoAlpha : 1 } ); this._stateControlBar = state; break; default: throw new Error("ScreenPlayer:stateControlBar:ERROR state " + state + " not found"); break; } } } private var _stateTimer : Boolean = false; public function get stateTimer() : Boolean { return this._stateTimer; } public function set stateTimer( state : Boolean ) : void { //ExternalInterface.call("playerEvent", "stateTimer:" + state); if(this._controlBarTimeout.running) { //trace("ScreenPlayer:RESTART"); this._controlBarTimeout.reset(); this._controlBarTimeout.start(); } if(state != this._stateTimer) { if(state) { //ExternalInterface.call("playerEvent", "stateTimer:STARTING"); //trace("ScreenPlayer:START"); this._controlBarTimeout.start(); } else { //trace("ScreenPlayer:STOP"); this._controlBarTimeout.stop(); this.stateControlBar = CONTROL_BAR_SHOW; } this._stateTimer = state; } } public function resize() : void { this._updateDisplayList(); } private function _createChildren() : void { this._mngStage = ManagerStage.getInstance(); this._controlBarTimeout = new Timer(Constants.CONTROL_BAR_TIMEOUT); this._controlBarTimeout.addEventListener(TimerEvent.TIMER, _onControlBarTimeout); this._grcBackground = new Sprite(); this._grcBackground.width = this._model.interfaceStage.stageDim.x; this._grcBackground.height = this._model.interfaceStage.stageDim.y; this.addChild(this._grcBackground); this._scrVideoPlayer = new VideoPlayer(); this.addChild(this._scrVideoPlayer); this._controls = new ControlBar(); this._controls.x = 0; this.addChild(this._controls); this._updateDisplayList(); } private function _updateDisplayList() : void { //trace("ScreenPlayer:_updateDisplayList:" + this._model.interfaceStage.stageDim.y); this.x = 0; this.y = 0; this._scrVideoPlayer.dimentions = new Point(this._model.interfaceStage.stageDim.x, this._model.interfaceStage.stageDim.y); this._controls.resize(this._model.interfaceStage.stageDim.x); this._controls.x = 0; this._controls.y = this._model.interfaceStage.stageDim.y - this._controls.height; } private function _onChangePlayState( state : String ) : void { //ExternalInterface.call("playerEvent", "ScreenPlayer:_onChangePlayState:" + state); if( state == HLSPlayStates.PLAYING || state == HLSPlayStates.PLAYING_BUFFERING) { this.stateTimer = true; this._mngStage.addEventListener(MouseEvent.MOUSE_MOVE, _onMouseMove); } else { this.stateTimer = false; this._mngStage.removeEventListener(MouseEvent.MOUSE_MOVE, _onMouseMove); } } private function _onChangeVideo( video : VOVideo ) : void { //ExternalInterface.call("playerEvent", "ScreenPlayer:_onChangeVideo"); if(this._watcherPlayState != null) { this._watcherPlayState.unwatch(); this._watcherPlayState = null; } if(this._watcherVolume != null) { this._watcherVolume.unwatch(); this._watcherVolume = null; } if(video != null) { this._controls.addEventListener(ControlEvent.CONTROL_NEXT, _onControlNext); this._controls.addEventListener(ControlEvent.CONTROL_PLAY, _onControlEvent); this._controls.addEventListener(ControlEvent.CONTROL_PAUSE, _onControlEvent); this._controls.addEventListener(ControlEvent.CONTROL_SEEK, _onControlEvent); this._controls.addEventListener(ControlEvent.CONTROL_STOP, _onControlEvent); this._watcherPlayState = BindingUtils.bindSetter(_onChangePlayState, this._model.video, "playState"); this._watcherVolume = BindingUtils.bindSetter(_onChangeVolume, this._model.video, "audioLevel"); this._scrVideoPlayer.loadMedia(); } else { this._controls.removeEventListener(ControlEvent.CONTROL_NEXT, _onControlNext); this._controls.removeEventListener(ControlEvent.CONTROL_PLAY, _onControlEvent); this._controls.removeEventListener(ControlEvent.CONTROL_PAUSE, _onControlEvent); this._controls.removeEventListener(ControlEvent.CONTROL_SEEK, _onControlEvent); this._controls.removeEventListener(ControlEvent.CONTROL_STOP, _onControlEvent); } } private function _onChangeVolume( volume : Number ) : void { this._scrVideoPlayer.volume(volume); } private function _onControlBarTimeout( e : TimerEvent ) : void { //ExternalInterface.call("playerEvent", "_onControlBarTimeout"); this.stateControlBar = CONTROL_BAR_HIDE; } private function _onControlEvent( e : ControlEvent ) : void { //trace("ScreenPlayer:_onControlEvent:" + e.type); this._scrVideoPlayer.controlPlayer(e); } private function _onControlNext( e: ControlEvent ) : void { //trace("ScreenPlayer:_onControlEvent:" + e.type); this._controls.reset(); this._scrVideoPlayer.stop(); } private function _onMouseMove( e : MouseEvent ) : void { //trace("ScreenPlayer:_onMouseMove"); this.stateControlBar = CONTROL_BAR_SHOW; if(this._controls.hitTestPoint(this.mouseX, this.mouseY)) { this.stateTimer = false; } else { this.stateTimer = true; } } private function _onStageAdd( e : Event ) : void { //trace("ScreenPlayer:_onStageAdd"); this.removeEventListener(Event.ADDED_TO_STAGE, _onStageAdd); this.addEventListener(Event.REMOVED_FROM_STAGE, _onStageRemove); this._watcherVideo = BindingUtils.bindSetter(_onChangeVideo, this._model, "video"); } private function _onStageRemove( e : Event ) : void { //trace("ScreenPlayer:_onStageRemove"); this.stateTimer = false; this._controls.removeEventListener(ControlEvent.CONTROL_NEXT, _onControlNext); this._controls.removeEventListener(ControlEvent.CONTROL_PLAY, _onControlEvent); this._controls.removeEventListener(ControlEvent.CONTROL_PAUSE, _onControlEvent); this._controls.removeEventListener(ControlEvent.CONTROL_SEEK, _onControlEvent); this._controls.removeEventListener(ControlEvent.CONTROL_STOP, _onControlEvent); this.addEventListener(Event.ADDED_TO_STAGE, _onStageAdd); this.removeEventListener(Event.REMOVED_FROM_STAGE, _onStageRemove); if(this._watcherPlayState != null) { this._watcherPlayState.unwatch(); this._watcherPlayState = null; } if(this._watcherVideo != null) { this._watcherVideo.unwatch(); this._watcherVideo = null; } if(this._watcherVolume != null) { this._watcherVolume.unwatch(); this._watcherVolume = null; } } } }
/***************************************************** * * Copyright 2009 Adobe Systems Incorporated. All Rights Reserved. * ***************************************************** * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * * The Initial Developer of the Original Code is Adobe Systems Incorporated. * Portions created by Adobe Systems Incorporated are Copyright (C) 2009 Adobe Systems * Incorporated. All Rights Reserved. * *****************************************************/ package org.osmf.elements.compositeClasses { import flash.errors.IllegalOperationError; import org.osmf.events.MediaElementEvent; import org.osmf.events.SeekEvent; import org.osmf.media.MediaElement; import org.osmf.traits.MediaTraitBase; import org.osmf.traits.MediaTraitType; import org.osmf.traits.SeekTrait; import org.osmf.traits.TimeTrait; import org.osmf.utils.OSMFStrings; /** * Implementation of SeekTrait which can be a composite media trait. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ internal class CompositeSeekTrait extends SeekTrait implements IReusable { public function CompositeSeekTrait(traitAggregator:TraitAggregator, mode:String, owner:MediaElement) { super(owner.getTrait(MediaTraitType.TIME) as TimeTrait); // Add listener for traitAdd/remove, in case TimeTrait changes (or // doesn't exist yet). owner.addEventListener(MediaElementEvent.TRAIT_ADD, onTraitAdd); owner.addEventListener(MediaElementEvent.TRAIT_REMOVE, onTraitRemove); _traitAggregator = traitAggregator; this.mode = mode; traitAggregationHelper = new TraitAggregationHelper ( traitType , traitAggregator , processAggregatedChild , processUnaggregatedChild ); } /** * @private */ public function attach():void { traitAggregationHelper.attach(); } /** * @private */ public function detach():void { traitAggregationHelper.detach(); } /** * @private */ override protected function seekingChangeEnd(time:Number):void { super.seekingChangeEnd(time); if (seeking) { // Calls prepareSeekOperationInfo methods of the derived classes, ParallelSeekTrait // and SerialSeekTrait. The prepareSeekOperationInfo returns whether the composite // trait can seek to the position. If yes, it also returns a "description" of how // to carry out the seek operation for the composite, depending on the concrete type // of the composite seek trait. var seekOp:CompositeSeekOperationInfo = prepareSeekOperationInfo(time); if (seekOp.canSeekTo) { doSeek(seekOp); } } } /** * @private */ override public function canSeekTo(time:Number):Boolean { // Similar to the seek function, here we call the prepareSeekOperation of the derived // composite seek trait. Only this time the returned operation is only used to // determine whether a seek is possible. return super.canSeekTo(time) && prepareSeekOperationInfo(time).canSeekTo; } // Internals // private function onTraitAdd(event:MediaElementEvent):void { if (event.traitType == MediaTraitType.TIME) { super.timeTrait = MediaElement(event.target).getTrait(MediaTraitType.TIME) as TimeTrait; } } private function onTraitRemove(event:MediaElementEvent):void { if (event.traitType == MediaTraitType.TIME) { super.timeTrait = null; } } private function processAggregatedChild(child:MediaTraitBase):void { child.addEventListener(SeekEvent.SEEKING_CHANGE, onSeekingChanged, false, 0, true); } private function processUnaggregatedChild(child:MediaTraitBase):void { child.removeEventListener(SeekEvent.SEEKING_CHANGE, onSeekingChanged); } /** * This is event handler for SeekEvent, typically dispatched from the SeekTrait * of a child/children. This must be overridden by derived classes. * * @param event The SeekEvent. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ protected function onSeekingChanged(event:SeekEvent):void { throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.FUNCTION_MUST_BE_OVERRIDDEN)); } /** * This function carries out the actual seeking operation. Derived classes must override this * function. * * @param seekOp The object that contains the complete information of how to carry out this * particular seek operation. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ protected function doSeek(seekOp:CompositeSeekOperationInfo):void { throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.FUNCTION_MUST_BE_OVERRIDDEN)); } /** * This function carries out the operation to check whether a seek operation is feasible * as well as coming up with a complete plan of how to do the actual seek. The derived * classes must override this function. * * @param time The time the seek operation will seek to. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ protected function prepareSeekOperationInfo(time:Number):CompositeSeekOperationInfo { throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.FUNCTION_MUST_BE_OVERRIDDEN)); } /** * This function checks whether the composite seek trait is currently seeking. The derived * classes must override this function. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion OSMF 1.0 */ protected function checkSeeking():Boolean { throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.FUNCTION_MUST_BE_OVERRIDDEN)); } protected final function get traitAggregator():TraitAggregator { return _traitAggregator; } // Internals // private var mode:String; private var _traitAggregator:TraitAggregator; private var traitAggregationHelper:TraitAggregationHelper; } }
package integration.extensionChecking { import integration.aGenericExtension.fake.GenericFakeExtensionModule; import integration.aGenericExtension.fake.core.FakeExtensionCommandMap; import integration.aGenericExtension.fake.core.FakeExtensionMediatorMap; import integration.aGenericExtension.fake.core.FakeExtensionMessenger; import integration.aGenericExtension.fake.core.FakeExtensionProxyMap; import integration.aGenericExtension.fake.module.FakeExtensionModule; import integration.aGenericExtension.fake.mvc.FakeExtensionTestCommand; import integration.aGenericExtension.fake.mvc.FakeExtensionTestMediator; import integration.aGenericExtension.fake.mvc.FakeExtensionTestProxy; import mvcexpress.core.ExtensionManager; import mvcexpress.core.namespace.pureLegsCore; /** * COMMENT * @author */ public class ExtensionCheckingTestsGeneral extends ExtensionCheckingTestsBase { public function ExtensionCheckingTestsGeneral() { use namespace pureLegsCore; CONFIG::debug { FakeExtensionModule.EXTENSION_TEST_ID = ExtensionManager.getExtensionIdByName(FakeExtensionModule.EXTENSION_TEST_NAME); } extensionModuleClass = GenericFakeExtensionModule; // FAKE extensionCommandMapClass = FakeExtensionCommandMap; // FAKE extensionProxyMapClass = FakeExtensionProxyMap; // FAKE extensionMediatorMapClass = FakeExtensionMediatorMap; // FAKE extensionMessendegClass = FakeExtensionMessenger; // FAKE extensionCommandClass = FakeExtensionTestCommand; // FAKE extensionProxyClass = FakeExtensionTestProxy; // FAKE extensionMediatorClass = FakeExtensionTestMediator; // FAKE } } }
package cmodule.decry { import avm2.intrinsics.memory.li32; import avm2.intrinsics.memory.li8; import avm2.intrinsics.memory.si32; public final class FSM_getenv extends Machine { public function FSM_getenv() { super(); } public static function start() : void { var _loc1_:int = 0; var _loc2_:int = 0; var _loc3_:int = 0; var _loc4_:int = 0; var _loc5_:int = 0; var _loc6_:int = 0; var _loc7_:int = 0; var _loc8_:int = 0; var _loc9_:int = 0; FSM_getenv.esp = FSM_getenv.esp - 4; si32(FSM_getenv.ebp,FSM_getenv.esp); FSM_getenv.ebp = FSM_getenv.esp; FSM_getenv.esp = FSM_getenv.esp - 0; _loc1_ = li32(FSM_getenv.ebp + 8); _loc2_ = _loc1_; if(_loc1_ != 0) { _loc3_ = li32(FSM_getenv); _loc4_ = _loc3_; if(_loc3_ != 0) { _loc5_ = li8(_loc1_); if(_loc5_ != 0) { _loc5_ = _loc5_ & 255; if(_loc5_ != 61) { _loc1_ = _loc2_; while(true) { _loc5_ = li8(_loc1_ + 1); _loc1_ = _loc1_ + 1; _loc6_ = _loc1_; if(_loc5_ != 0) { _loc5_ = _loc5_ & 255; if(_loc5_ == 61) { break; } _loc1_ = _loc6_; continue; } break; } } addr173: _loc4_ = li32(_loc4_); if(_loc4_ != 0) { _loc3_ = _loc3_ + 4; _loc1_ = _loc1_ - _loc2_; loop1: while(true) { _loc5_ = 0; _loc6_ = _loc3_; while(true) { _loc8_ = _loc2_ + _loc5_; _loc7_ = _loc4_ + _loc5_; if(_loc1_ != _loc5_) { _loc7_ = li8(_loc7_); if(_loc7_ != 0) { _loc8_ = li8(_loc8_); _loc9_ = _loc5_ + 1; _loc7_ = _loc7_ & 255; if(_loc7_ == _loc8_) { _loc5_ = _loc9_; continue; } _loc4_ = _loc4_ + _loc9_; break; } addr254: _loc4_ = _loc4_ + _loc5_; if(_loc1_ == _loc5_) { _loc5_ = li8(_loc4_); _loc4_ = _loc4_ + 1; if(_loc5_ == 61) { _loc1_ = _loc4_; addr74: FSM_getenv.eax = _loc1_; FSM_getenv.esp = FSM_getenv.ebp; FSM_getenv.ebp = li32(FSM_getenv.esp); FSM_getenv.esp = FSM_getenv.esp + 4; FSM_getenv.esp = FSM_getenv.esp + 4; return; } } _loc4_ = li32(_loc6_); _loc3_ = _loc3_ + 4; if(_loc4_ != 0) { continue loop1; } break loop1; } _loc4_ = _loc4_ + _loc5_; break; } §§goto(addr254); } } } §§goto(addr173); } } _loc1_ = 0; §§goto(addr74); } } }
/******************************************************************************* * PushButton Engine * Copyright (C) 2009 PushButton Labs, LLC * For more information see http://www.pushbuttonengine.com * * This file is licensed under the terms of the MIT license, which is included * in the License.html file at the root directory of this SDK. ******************************************************************************/ package com.pblabs.box2D { import Box2D.Collision.Shapes.b2PolygonDef; import Box2D.Collision.Shapes.b2ShapeDef; import flash.geom.Point; public class PolygonCollisionShape extends CollisionShape { [TypeHint(type="flash.geom.Point")] public function get vertices():Array { return _vertices; } public function set vertices(value:Array):void { _vertices = value; if (_parent) _parent.buildCollisionShapes(); } override protected function doCreateShape():b2ShapeDef { var halfSize:Point = new Point(_parent.size.x * 0.5, _parent.size.y * 0.5); var scale:Number = _parent.spatialManager.inverseScale; var shape:b2PolygonDef = new b2PolygonDef(); shape.vertexCount = _vertices.length; for (var i:int = 0; i < shape.vertexCount; i++) shape.vertices[i].Set(_vertices[i].x * halfSize.x * scale, _vertices[i].y * halfSize.y * scale); return shape; } private var _vertices:Array = null; } }
package tests.com.probertson.data.sqlRunnerClasses { import com.probertson.data.sqlRunnerClasses.ConnectionPool; import com.probertson.data.sqlRunnerClasses.PendingBatch; import com.probertson.data.sqlRunnerClasses.PendingStatement; import com.probertson.data.sqlRunnerClasses.StatementCache; import flash.data.SQLResult; import flash.data.SQLStatement; import flash.errors.SQLError; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.TimerEvent; import flash.filesystem.File; import flash.utils.Timer; import flexunit.framework.Assert; import org.flexunit.async.Async; import utils.CreateDatabase; public class ConnectionPoolTest extends EventDispatcher { // Reference declaration for class to test private var _connectionPool:ConnectionPool; // ------- Instance vars ------- private var _dbFile:File; private var _testCompleteTimer:Timer; // ------- Setup/cleanup ------- [Before] public function setUp():void { _dbFile = File.createTempDirectory().resolvePath("test.db"); var createDB:CreateDatabase = new CreateDatabase(_dbFile); createDB.createPopulatedDatabase(); } [After(async, timeout="250")] public function tearDown():void { _connectionPool.close(_connectionPool_close, null); } private function _connectionPool_close():void { _connectionPool = null; var tempDir:File = _dbFile.parent; tempDir.deleteDirectory(true); } // ------- Tests ------- [Test(async, timeout="3000")] public function testAddBlockingBatchThenPendingStatement():void { addEventListener(Event.COMPLETE, Async.asyncHandler(this, testAddBlockingBatchThenPendingStatement_complete, 3000)); _connectionPool = new ConnectionPool(_dbFile, 5, null); _testCompleteTimer = new Timer(2000); _testCompleteTimer.addEventListener(TimerEvent.TIMER, testAddBlockingBatchThenPendingStatement_timer); _testCompleteTimer.start(); var stmt:SQLStatement = new SQLStatement(); stmt.text = ADD_ROW_SQL; var stmts:Vector.<SQLStatement> = Vector.<SQLStatement>([stmt, stmt, stmt]); var params:Vector.<Object> = Vector.<Object>([{colString:"Hello", colInt:7}, {colString:"World", colInt:17}, {colString:"Hello", colInt:7}]); var pendingBatch:PendingBatch = new PendingBatch(stmts, params, testAddBlockingBatchThenPendingStatement_batchResult, testAddBlockingBatchThenPendingStatement_batchError, null); _connectionPool.addBlockingBatch(pendingBatch); var pendingStatement:PendingStatement = new PendingStatement(new StatementCache(LOAD_ROWS_LIMIT_SQL), null, testAddBlockingBatchThenPendingStatement_executeResult, null, testAddBlockingBatchThenPendingStatement_executeError); _connectionPool.addPendingStatement(pendingStatement); } // handlers private var _executeModifyComplete:Boolean = false; private function testAddBlockingBatchThenPendingStatement_batchResult(results:Vector.<SQLResult>):void { _executeModifyComplete = true; Assert.assertFalse(_executeComplete); } private function testAddBlockingBatchThenPendingStatement_batchError(error:SQLError):void { Assert.fail("Error during batch statement"); } private var _executeComplete:Boolean = false; private function testAddBlockingBatchThenPendingStatement_executeResult(result:SQLResult):void { _executeComplete = true; Assert.assertTrue(_executeModifyComplete); } private function testAddBlockingBatchThenPendingStatement_executeError(error:SQLError):void { Assert.fail("Error during pending statement call"); } private function testAddBlockingBatchThenPendingStatement_timer(event:TimerEvent):void { _testCompleteTimer.removeEventListener(TimerEvent.TIMER, testAddBlockingBatchThenPendingStatement_timer); _testCompleteTimer.stop(); dispatchEvent(new Event(Event.COMPLETE)); } private function testAddBlockingBatchThenPendingStatement_complete(event:Event, passThroughData:Object):void { Assert.assertTrue(_executeModifyComplete && _executeComplete); } // ------- SQL statements ------- [Embed(source="/sql/LoadRowsLimit.sql", mimeType="application/octet-stream")] private static const LoadRowsLimitStatementText:Class; private static const LOAD_ROWS_LIMIT_SQL:String = new LoadRowsLimitStatementText(); [Embed(source="/sql/AddRow.sql", mimeType="application/octet-stream")] private static const AddRowStatementText:Class; private static const ADD_ROW_SQL:String = new AddRowStatementText(); } }
/* 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 FinalClassImpDefIntInt.*; import com.adobe.test.Assert; // var SECTION = "Definitions"; // provide a document reference (ie, Actionscript section) // var VERSION = "AS3"; // Version of ECMAScript or ActionScript // var TITLE = "Final class implements default interface"; // Provide ECMA section title or a description var BUGNUMBER = ""; /////////////////////////////////////////////////////////////// // add your tests here var obj = new ClassGet(); //Final class implements two default interfaces with a public method Assert.expectEq("Final class implements two default interfaces with a public method", "PASSED", obj.accdeffunc()); //////////////////////////////////////////////////////////////// // displays results.
/** * 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.sql { import com.maclema.mysql.Connection; import com.maclema.mysql.events.MySqlErrorEvent; import com.maclema.mysql.events.MySqlEvent; import com.maclema.mysql.MySqlToken; import com.maclema.mysql.Statement; import egg82.events.mysql.MySQLEvent; import egg82.patterns.Observer; import egg82.utils.NetUtil; import flash.events.Event; import flash.events.IOErrorEvent; /** * ... * @author egg82 */ public class MySQL { //vars public static const OBSERVERS:Vector.<Observer> = new Vector.<Observer>(); private var connection:Connection; private var backlog:Vector.<String>; private var backlogData:Vector.<Object>; private var host:String; //constructor public function MySQL() { } //public public function connect(host:String, user:String, pass:String, db:String, port:uint = 3306, policyPort:uint = 80):void { if (!host || host == "" || !user || user == "" || !pass || !db || db == "" || port > 65535 || !connection || !connection.connected) { return; } this.host = host + ":" + port; NetUtil.loadPolicyFile(host, policyPort); connection = new Connection(host, port, user, pass, db); backlog = new Vector.<String>(); backlogData = new Vector.<Object>(); connection.addEventListener(IOErrorEvent.IO_ERROR, onIOError); connection.addEventListener(MySqlErrorEvent.SQL_ERROR, onSQLError); connection.addEventListener(Event.CONNECT, onConnect); connection.addEventListener(Event.CLOSE, onClose); connection.connect(); } public function disconnect():void { if (!connection || !connection.connected) { return; } connection.disconnect(); connection = null; backlog = null; backlogData = null; } public function query(q:String, data:Object = null):void { if (!connection || !connection.connected || !q || q == "") { return; } if (connection.busy || backlog.length > 0) { backlog.push(query); backlogData.push(data); } else { queryInternal(q, data); } } public function get connected():Boolean { return (connection) ? connection.connected : false; } //private private function queryInternal(q:String, data:Object):void { backlogData.unshift(data); var statement:Statement = connection.createStatement(); var token:MySqlToken = statement.executeQuery(q); token.addEventListener(MySqlErrorEvent.SQL_ERROR, onSQLError); token.addEventListener(MySqlEvent.RESULT, onResponse); token.addEventListener(MySqlEvent.RESPONSE, onResponse); } private function onIOError(e:IOErrorEvent):void { if (!connection) { return; } dispatch(MySQLEvent.ERROR, { "error": e.text, "data": (backlogData.length > 0) ? backlogData.splice(0, 1)[0] : null }); } private function onSQLError(e:MySqlErrorEvent):void { if (!connection) { return; } dispatch(MySQLEvent.ERROR, { "error": e.msg, "data": (backlogData.length > 0) ? backlogData.splice(0, 1)[0] : null }); } private function onConnect(e:Event):void { dispatch(MySQLEvent.CONNECTED, host); sendNext(); } private function onClose(e:Event):void { connection = null; backlog = null; backlogData = null; dispatch(MySQLEvent.DISCONNECTED, host); } private function onResponse(e:MySqlEvent):void { if (!connection) { return; } var resultSet:Array = e.resultSet.getRows() as Array; dispatch(MySQLEvent.RESULT, { "result": new MySQLResult((resultSet.length > 0) ? resultSet : null, e.insertID, e.affectedRows), "data": (backlogData.length > 0) ? backlogData.splice(0, 1)[0] : null }); sendNext(); } private function sendNext():void { if (!connection || !connection.connected || backlog.length == 0) { return; } dispatch(MySQLEvent.SEND_NEXT); queryInternal(backlog.splice(0, 1)[0], backlogData.splice(0, 1)[0]); } protected function dispatch(event:String, data:Object = null):void { Observer.dispatch(OBSERVERS, this, event, data); } } }
package goplayer { public interface SkinBackend { function get skinWidth() : Number function get skinHeight() : Number function get skinScale() : Number function get enableChrome() : Boolean function get showChrome() : Boolean function get showTitle() : Boolean function get showShareButton() : Boolean function get showEmbedButton() : Boolean function get showPlayPauseButton() : Boolean function get showElapsedTime() : Boolean function get showSeekBar() : Boolean function get showTotalTime() : Boolean function get showVolumeControl() : Boolean function get showFullscreenButton() : Boolean function get title() : String function get shareURL() : String function get embedCode() : String function get volume() : Number function get running() : Boolean function get playing() : Boolean function get duration() : Number function get playheadRatio() : Number function get bufferRatio() : Number function get bufferFillRatio() : Number function get bufferingUnexpectedly() : Boolean function handleSkinPartMissing(name : String) : void function handleUserSeek(ratio : Number) : void function handleUserPlay() : void function handleUserPause() : void function handleUserMute() : void function handleUserUnmute() : void function handleUserSetVolume(volume : Number) : void function handleUserToggleFullscreen() : void function handleUserCopyShareURL() : void function handleUserShareViaTwitter() : void function handleUserShareViaFacebook() : void function handleUserCopyEmbedCode() : void } }
package serverProto.immolation { import com.netease.protobuf.Message; import com.netease.protobuf.fieldDescriptors.FieldDescriptor$TYPE_UINT32; import com.netease.protobuf.WireType; import com.netease.protobuf.WritingBuffer; import com.netease.protobuf.WriteUtils; import flash.utils.IDataInput; import com.netease.protobuf.ReadUtils; import flash.errors.IOError; public final class ChaKeLaItemInfo extends Message { public static const CHA_KE_LA_KEY:FieldDescriptor$TYPE_UINT32 = new FieldDescriptor$TYPE_UINT32("serverProto.immolation.ChaKeLaItemInfo.cha_ke_la_key","chaKeLaKey",1 << 3 | WireType.VARINT); public static const CHA_KE_LA_NUM:FieldDescriptor$TYPE_UINT32 = new FieldDescriptor$TYPE_UINT32("serverProto.immolation.ChaKeLaItemInfo.cha_ke_la_num","chaKeLaNum",2 << 3 | WireType.VARINT); private var cha_ke_la_key$field:uint; private var hasField$0:uint = 0; private var cha_ke_la_num$field:uint; public function ChaKeLaItemInfo() { super(); } public function clearChaKeLaKey() : void { this.hasField$0 = this.hasField$0 & 4.294967294E9; this.cha_ke_la_key$field = new uint(); } public function get hasChaKeLaKey() : Boolean { return (this.hasField$0 & 1) != 0; } public function set chaKeLaKey(param1:uint) : void { this.hasField$0 = this.hasField$0 | 1; this.cha_ke_la_key$field = param1; } public function get chaKeLaKey() : uint { return this.cha_ke_la_key$field; } public function clearChaKeLaNum() : void { this.hasField$0 = this.hasField$0 & 4.294967293E9; this.cha_ke_la_num$field = new uint(); } public function get hasChaKeLaNum() : Boolean { return (this.hasField$0 & 2) != 0; } public function set chaKeLaNum(param1:uint) : void { this.hasField$0 = this.hasField$0 | 2; this.cha_ke_la_num$field = param1; } public function get chaKeLaNum() : uint { return this.cha_ke_la_num$field; } override final function writeToBuffer(param1:WritingBuffer) : void { var _loc2_:* = undefined; if(this.hasChaKeLaKey) { WriteUtils.writeTag(param1,WireType.VARINT,1); WriteUtils.write$TYPE_UINT32(param1,this.cha_ke_la_key$field); } if(this.hasChaKeLaNum) { WriteUtils.writeTag(param1,WireType.VARINT,2); WriteUtils.write$TYPE_UINT32(param1,this.cha_ke_la_num$field); } for(_loc2_ in this) { super.writeUnknown(param1,_loc2_); } } override final function readFromSlice(param1:IDataInput, param2:uint) : void { /* * Decompilation error * Code may be obfuscated * Tip: You can try enabling "Automatic deobfuscation" in Settings * Error type: IndexOutOfBoundsException (Index: 2, Size: 2) */ throw new flash.errors.IllegalOperationError("Not decompiled due to error"); } } }
intrinsic class NetStream { var time:Number; var currentFps:Number; var bufferTime:Number; var bufferLength:Number; var liveDelay:Number; var bytesLoaded:Number; var bytesTotal:Number; function NetStream(connection:NetConnection); function onMetaData(info:Object):Void; function onStatus(info:Object):Void; function publish(name:Object, type:String):Void; function play(name:Object, start:Number, len:Number, reset:Object); function receiveAudio(flag:Boolean):Void; function receiveVideo(flag:Object):Void; function pause(flag:Boolean):Void; function seek(offset:Number):Void; function close():Void; function attachAudio(theMicrophone:Microphone):Void; function attachVideo(theCamera:Camera,snapshotMilliseconds:Number):Void; function send(handlerName:String):Void; function setBufferTime(bufferTime:Number):Void; }
package com.playata.application.ui.dialogs { import com.playata.application.data.user.User; import com.playata.application.messaging.Message; import com.playata.application.messaging.MessageRouter; import com.playata.application.ui.ViewManager; import com.playata.application.ui.elements.generic.button.UiButton; import com.playata.application.ui.elements.generic.dialog.UiDialog; import com.playata.application.ui.elements.generic.dialog.UiInfoDialog; import com.playata.application.ui.elements.guild.UiGuildBattleAutoJoinPackage; import com.playata.application.ui.elements.guild.UiGuildChatTab; import com.playata.framework.application.Environment; import com.playata.framework.application.request.ActionRequestResponse; import com.playata.framework.core.Runtime; import com.playata.framework.data.constants.Constants; import com.playata.framework.input.InteractionEvent; import com.playata.framework.localization.LocText; import visuals.ui.dialogs.SymbolDialogGuildRechargeGuildBattleAutoJoinsGeneric; public class DialogGuildRechargeGuildBattleAutoJoins extends UiDialog { private var _btnClose:UiButton = null; private var _packageIndex:int; private var _package1:UiGuildBattleAutoJoinPackage; private var _package2:UiGuildBattleAutoJoinPackage; private var _package3:UiGuildBattleAutoJoinPackage; public function DialogGuildRechargeGuildBattleAutoJoins() { var _loc1_:SymbolDialogGuildRechargeGuildBattleAutoJoinsGeneric = new SymbolDialogGuildRechargeGuildBattleAutoJoinsGeneric(); super(_loc1_); _queued = false; _loc1_.txtDialogTitle.text = LocText.current.text("dialog/guild_recharge_auto_joins/title"); _loc1_.txtInfo.text = LocText.current.text("dialog/guild_recharge_auto_joins/info_text"); _btnClose = new UiButton(_loc1_.btnClose,"",onClickClose); _package1 = new UiGuildBattleAutoJoinPackage(_loc1_.package1,1,onPackageSelected); _package2 = new UiGuildBattleAutoJoinPackage(_loc1_.package2,2,onPackageSelected); _package3 = new UiGuildBattleAutoJoinPackage(_loc1_.package3,3,onPackageSelected); MessageRouter.addListener("ViewMessage.notifyNeededGuildDonationMade",handleMessages); } override public function dispose() : void { MessageRouter.removeAllListeners(handleMessages); if(_btnClose == null) { return; } _btnClose.dispose(); _btnClose = null; _package1.dispose(); _package2.dispose(); _package3.dispose(); super.dispose(); } private function get minAmount() : int { return User.current.character.guild.autoJoins; } private function onClickClose(param1:InteractionEvent) : void { close(); } private function onPackageSelected(param1:int) : void { _packageIndex = param1; rechargeAutoJoins(); } private function rechargeAutoJoins() : void { Environment.application.sendActionRequest("rechargeGuildAutoJoins",{"package":_packageIndex},handleRequests); } private function closeDialog() : void { close(); } private function handleRequests(param1:ActionRequestResponse) : void { var _loc2_:* = param1.action; if("rechargeGuildAutoJoins" !== _loc2_) { throw new Error("Unsupported request action \'" + param1.action + "\'!"); } if(param1.error == "") { Environment.application.updateData(param1.data); Environment.audio.playFX("guild_missiles_recharged.mp3"); close(); UiGuildChatTab.instance.refreshGuildLog(); } else if(param1.error == "errRemoveGameCurrencyNotEnough" || param1.error == "errRemovePremiumCurrencyNotEnough") { ViewManager.instance.showGuildNotEnoughGameCurrencyPremiumCurrencyDialog(0,Constants.current.getInt("guild_auto_joins_premium_currency_amount_package" + _packageIndex),closeDialog); } else if(param1.error == "errProcessingGuildBattle") { Environment.panelManager.showDialog(new UiInfoDialog(LocText.current.text("dialog/processing_guild_battle/title"),LocText.current.text("dialog/processing_guild_battle/text"),LocText.current.text("general/button_ok"))); } else { Environment.reportError(param1.error,param1.request); } } private function handleMessages(param1:Message) : void { var _loc2_:* = param1.type; if("ViewMessage.notifyNeededGuildDonationMade" !== _loc2_) { throw new Error("Encountered unknown message type! type=" + param1.type); } Runtime.delayFunction(rechargeAutoJoins,0.3); } override public function onEscape() : void { close(); } } }
package io.swagger.client.model { [XmlRootNode(name="Tag")] public class Tag { [XmlElement(name="id")] public var id: Number = 0; [XmlElement(name="name")] public var name: String = null; public function toString(): String { var str: String = "Tag: "; str += " (id: " + id + ")"; str += " (name: " + name + ")"; return str; } } }
/** * * AXL Library * Copyright 2014-2016 Denis Aleksandrowicz. 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 axl.utils.binAgent { import flash.display.DisplayObject; import flash.display.Sprite; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.ui.Keyboard; import flash.utils.describeType; /** Extends Console class by adding two main functionalites: * <ul> * <li>Parses / evaluates input text from input window and prints out result of this parsing </li> * <li>Evauluates input "as you type" and gives IDE-style code-completion hints </li> * </ul> * @see axl.utils.binAgent.Console */ public class BinAgent extends Console { public static const version:String = '0.0.18'; /** Static alternative for <code>trrace</code> method @see axl.utils.binAgent.Console#trrace() */ public static function log(...args):void {(instance != null) ? instance.trrace.apply(null, args) : trace("BinAgent not set"); } private static var _instance:BinAgent; private var hintContainer:Sprite; private var selectedHint:Hint private var numHints:int=0; private var hintIndex:int; private var hHeight:int=20; private var curRoot:Object; private var curRootProps:Vector.<XMLList>; private var curRootCarete:int=0; private var rootDesc:XML; private var rootFinder:RootFinder; private var inputHeight:Number; private var inputWidth:Number; private var userRoot:DisplayObject; private var assist:Asist; private var maxHints:int = 10; private var prevText:String; public var hints:Boolean=true; private var consoleSearched:Boolean; private var lines:Array; /**@see axl.utils.binAgent.BinAgent */ public function BinAgent(rootObject:DisplayObject) { _instance = this; super(rootObject); } override protected function build():void { super.build(); hintContainer = new Sprite(); hintContainer.addEventListener(MouseEvent.MOUSE_MOVE, hintTouchMove); hintContainer.addEventListener(MouseEvent.MOUSE_UP, hintTouchSelect); userRoot = rootObject; this.addChild(hintContainer); curRootProps = new Vector.<XMLList>(); hintIndex = 0; Hint.hintWidth = 100;//input.width; Hint.hintHeight = 15;//hHeight; rootFinder =new RootFinder(rootObject, this); assist = new Asist(); curRoot = userRoot; } /** The only active instance of this class */ public static function get instance():BinAgent { return _instance } override protected function setInstance(v:Object):void { _instance = v as BinAgent } override protected function destroy():void { super.destroy(); this.removeChildren(); hintContainer = null; selectedHint = null; curRoot = null; if(curRootProps) curRootProps.length = 0; curRootProps = null; rootDesc = null; rootFinder = null; userRoot = null; assist = null; } /** Instance of RootFinder which is the actual parser of input text. * @see axl.utils.binAgent.RootFinder#parseInput() */ public function get parser():RootFinder { return rootFinder } /** @private */ protected function hintTouchMove(e:MouseEvent):void { if(numHints == 0 || !e.buttonDown) return; var mh:Hint = e.target as Hint; if(mh == null) return; if(selectedHint != null) { if(selectedHint == mh) return; else selectedHint.selected = false; } selectedHint = mh; selectedHint.selected = true; } protected function hintTouchSelect(e:MouseEvent):void { if(selectedHint !=null) chooseHighlightedHint(); else selectedHint = e.target as Hint; if(selectedHint != null) selectedHint.selected = true; } private function addHint(v:XML):void { hintContainer.addChild(Hint.getHint(v)); } private function removeHints():void { hintContainer.removeChildren(); Hint.removeHints(); } private function alignHints():void { Hint.alignHints(); if(hintContainer) hintContainer.y = input.y - hintContainer.height; } override protected function align():void { super.align(); inputWidth = input.width, inputHeight = input.height; Hint.hintWidth = inputWidth; maxHints = Math.floor((console.height / Hint.hintHeight) *.75); alignHints(); } override protected function KEY_UP(e:KeyboardEvent):void { switch(e.keyCode) { case Keyboard.UP: case Keyboard.DOWN: if(Hint.numHints > 0) selectHint(e.keyCode == Keyboard.UP ? -1 : 1); else super.showPast(e.keyCode); break; case Keyboard.ENTER: if(Hint.numHints > 0 && selectedHint != null) chooseHighlightedHint(); else super.enterConsoleText(); removeHints(); break; case Keyboard.TAB: if(Hint.numHints > 0) { if(selectedHint == null) selectHint(-1); else chooseHighlightedHint(); } break; case Keyboard.ESCAPE: this.removeHints(); break; default : asYouType(); } } override protected function PARSE_INPUT(s:String):Object { return rootFinder.parseInput(s); } private function chooseHighlightedHint():void { //input.text += selectedHint.text; var lastDot:int = input.caretIndex; while(lastDot-->0) if(input.text.charAt(lastDot) == '.') break; var LEFT:String = input.text.substr(0, lastDot+1); var MID:String = selectedHint.text; var RIGHT:String = input.text.substr(input.caretIndex); input.text = LEFT + MID + RIGHT; var itl:int = LEFT.length + MID.length; input.setSelection( itl, itl); removeHints(); asYouType(); } private function selectHint(dir:int):void { if(Hint.numHints == 0) return; hintIndex += dir; if(hintIndex < 0) hintIndex = Hint.numHints-1; if((hintIndex >= Hint.numHints) || (hintIndex < 0)) hintIndex = 0; if(selectedHint != null) { if(selectedHint == Hint.atIndex(hintIndex))return; else selectedHint.selected = false; } selectedHint = Hint.atIndex(hintIndex); selectedHint.selected = true; } /** @private */ protected function asYouType():void { if(input.text.length > 0 && input.text.charAt(0) == ':') return consoleSearch(input.text.substr(1)); else if(consoleSearched) { consoleSearched = false; console.text = totalString; } if(!hints) return //////// ---------------- prev ------------- ///////// if(selectedHint != null) selectedHint.selected = false; selectedHint = null; var t:String = input.text; //if(prevText == t) return; var tl:int = t.length; removeHints(); numHints = 0; if(tl < 1) return; //trace('=========== as you type ==========='); ///////// ------------- define -------------------- /////// var result:Object = findCurRoot(); var newRoot:Object = result.r; var key:String = result.k; if(key == null || newRoot == null) return rootDesc = describeType(newRoot); //trace(rootDesc.toXMLString()); var additions:XMLList = assist.check(newRoot); if(additions is XMLList) for each (var x:XML in additions) rootDesc.appendChild(x); curRootProps[0] = rootDesc.accessor; curRootProps[1] = rootDesc.method; curRootProps[2] = rootDesc.variable; var n:String, i:int, l:int; tl = key.length; var keyLow:String = key.toLowerCase(); for(var a:int = 0; a < curRootProps.length; a++) { l = curRootProps[a].length(); for(i = 0; i < l; i++) { n = curRootProps[a][i].@name; if(n.substr(0,tl).toLowerCase() == keyLow) { addHint(curRootProps[a][i]); if(++numHints > maxHints)break; } } } alignHints(); if(Hint.numHints > 0) { selectHint(-1); this.setChildIndex(hintContainer, this.numChildren-1); } prevText = input.text; } /** @private */ protected function consoleSearch(v:String):void { lines = totalString.split('\n'); var out:String ='', s:String, i:int=0, l:int=lines.length, r:RegExp = new RegExp(v,'i'); while(i<l) { s = lines[i++] out += (s.match(r)) ? s + '\n' : ''; } console.text = out; consoleSearched = true; } /** @private */ private function findCurRoot():Object { return rootFinder.findCareteContext(input.text, input.caretIndex); } } } import flash.system.System; import flash.text.TextField; import flash.text.TextFormat; import flash.utils.getQualifiedClassName; internal class Asist { private var dict:Object = { String : abstractString, Object : abstractObject } private var abstractString:Astring; private var abstractObject:Aobject; public function Asist() { abstractObject = new Aobject(); abstractString = new Astring(); } public function check(v:*):XMLList { if(v is String) return abstractString.all.children().copy(); else if(v is Object) return abstractObject.all.children().copy(); return null } public static function method(name:String, args:Array, returnType:Class, declaredBy:Class):XML { var xml:XML = <method/>; xml.@name = name; xml.@declaredBy = getQualifiedClassName(declaredBy); xml.@returnType = getQualifiedClassName(returnType); var i:int = 0, l:int = args.length; for(;i<l;i++) xml.appendChild(XML('<parameter type="'+getQualifiedClassName(args[i])+'"/>')); return xml; } } internal class Aobject { public var am:Function = Asist.method; public var all:XML; private var objectGeneric:Vector.<XML> = new Vector.<XML>(); private var inherited:Vector.<XML>= new <XML> [ am('hasOwnProperty', [String], Boolean, Object), am('isPrototypeOf', [Object], Object, Object), am('propertyIsEnumerable', [String], Boolean, Object), am('setPropertyIsEnumerable', [String, Boolean], null, Object), am('toLocaleString', [], String, Object), am('toString', [], String, Object), am('valueOf', [], Object, Object) ]; public function Aobject() { all = <additions/>; for(var i:int = 0, j:int = inherited.length; i<j;i++) all.appendChild(inherited[i]) for(i= 0, j= generic.length; i<j;i++) all.appendChild(generic[i]); } public function get generic():Vector.<XML> { return objectGeneric} } internal class Astring extends Aobject { private var stringGeneric:Vector.<XML>= new <XML> [ Asist.method('charAt', [Number], String, String), Asist.method('charCodeAt', [Number],String,String) ]; public function Astring() { super(); } override public function get generic():Vector.<XML> { return stringGeneric} } internal class Hint extends TextField { private static var tfSelected:TextFormat = new TextFormat('Lucida Console', 11, 0xEECD8C); private static var tfIdle:TextFormat = new TextFormat('Lucida Console', 11, 0x333333); private static var liveHints:Vector.<Hint>= new Vector.<Hint>(); private static var spareHints:Vector.<Hint> = new Vector.<Hint>(); private static var nHints:int=0; private static var hWidth:Number = 30; private static var hHeight:int = 18; public static var maxPool:int =10; public static function get numHints():int { return nHints }; public static function get hintWidth():Number { return hWidth } public static function set hintWidth(v:Number):void { if(hWidth == v) return; hWidth = v; for(var i:int = nHints; i-->0;) liveHints[i].width = v; } public static function get hintHeight():Number { return hHeight } public static function set hintHeight(v:Number):void { if(hHeight == v) return; hHeight = v; for(var i:int = nHints; i-->0;) liveHints[i].height = v; } public static function atIndex(v:int):Hint { return liveHints[v] } public static function getHint(v:XML):Hint { var spareAvailable:Boolean = (spareHints.length > 0); if(spareAvailable) liveHints[nHints++] = spareHints.pop(); else new Hint(); liveHints[nHints-1].parse(v); return liveHints[nHints-1]; } public static function removeHints():void { spareHints = spareHints.concat(liveHints); while(spareHints.length > maxPool) spareHints.pop().destroy(); liveHints.length = nHints = 0; } public static function alignHints():void { for(var i:int = numHints; i-->0;) liveHints[i].y = i * hHeight; } /// instance private var isSelected:Boolean; private var xdef:XML; private var parameters:XMLList; private var hname:String; private var htype:String; private var hvalue:String; private var fulltext:String; public function Hint() { reset(); liveHints[nHints++] = this; } private function reset():void { var tf:TextField = this; tf.border = true; tf.height = hHeight; tf.width = hWidth; tf.wordWrap = true; tf.multiline = false; tf.type = 'dynamic'; tf.background = true; tf.backgroundColor = 0xbbbbbb; tf.defaultTextFormat = tfIdle; tf.selectable =false; } private function parse(v:XML):void { xdef = v; hname = v.@name; htype = v.name(); fulltext = hname; switch(htype) { case 'accessor': parseAccesor(v); break; case 'method': parseMethod(v); hname += '('; break; case 'variable': parseVariable(v); break; } text = fulltext; } private function parseVariable(v:XML):void { fulltext += ' : ' + typeInfo(v); } private function parseMethod(v:XML):void { fulltext += '('; parameters = v.parameter; var l:int = parameters.length(); var ptype:String; for(var i:int = 0; i < l; i++) fulltext += typeInfo(parameters[i]) + ', '; if(l > 0) fulltext = fulltext.substr(0,-2); fulltext += '):' + returnType(v); } private function classInfo(v:String):String { return v.replace(/.*::/,'') } private function typeInfo(v:XML):String { return classInfo(v.@type) }; private function returnType(v:XML):String { return classInfo(v.@returnType) } private function parseAccesor(v:XML):void { fulltext += ' : ' + typeInfo(v) + ' (' + v.@access+')'; } // /public function set text(v:String):void { maintf.text =v } override public function get text():String { return hname } public function get selected():Boolean {return isSelected } public function set selected(v:Boolean):void { if(isSelected == v) return; isSelected = v; if(hname == null) return; // might be destroyed setTextFormat(v?tfSelected:tfIdle, 0, text.length); backgroundColor = v ? 0x888888 : 0xbbbbbb; } private function destroy():void{ //maintf = null;//there will be more fulltext = hname = htype = hvalue = null, text = ''; System.disposeXML(xdef); } }
/* 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 DESC = "Closure creation, no free variables"; include "driver.as" function allocloop():uint { var v; for ( var i:uint=0 ; i < 100000 ; i++ ) v = function (x) { return x } return i; } TEST(allocloop, "alloc-8");
package com.videojs.events{ import flash.events.Event; public class VideoPlaybackEvent extends Event{ public static const ON_CUE_POINT:String = "VideoPlaybackEvent.ON_CUE_POINT"; public static const ON_META_DATA:String = "VideoPlaybackEvent.ON_META_DATA"; public static const ON_XMP_DATA:String = "VideoPlaybackEvent.ON_XMP_DATA"; public static const ON_NETSTREAM_STATUS:String = "VideoPlaybackEvent.ON_NETSTREAM_STATUS"; public static const ON_NETCONNECTION_STATUS:String = "VideoPlaybackEvent.ON_NETCONNECTION_STATUS"; public static const ON_STREAM_READY:String = "VideoPlaybackEvent.ON_STREAM_READY"; public static const ON_STREAM_NOT_READY:String = "VideoPlaybackEvent.ON_STREAM_NOT_READY"; public static const ON_STREAM_START:String = "VideoPlaybackEvent.ON_STREAM_START"; public static const ON_STREAM_CLOSE:String = "VideoPlaybackEvent.ON_STREAM_CLOSE"; public static const ON_STREAM_METRICS_UPDATE:String = "VideoPlaybackEvent.ON_STREAM_METRICS_UPDATE"; public static const ON_STREAM_PAUSE:String = "VideoPlaybackEvent.ON_STREAM_PAUSE"; public static const ON_STREAM_RESUME:String = "VideoPlaybackEvent.ON_STREAM_RESUME"; public static const ON_STREAM_SEEK_COMPLETE:String = "VideoPlaybackEvent.ON_STREAM_SEEK_COMPLETE"; public static const ON_STREAM_REBUFFER_START:String = "VideoPlaybackEvent.ON_STREAM_REBUFFER_START"; public static const ON_STREAM_REBUFFER_END:String = "VideoPlaybackEvent.ON_STREAM_REBUFFER_END"; public static const ON_ERROR:String = "VideoPlaybackEvent.ON_ERROR"; public static const ON_UPDATE:String = "VideoPlaybackEvent.ON_UPDATE"; // a flexible container object for whatever data needs to be attached to any of these events private var _data:Object; public function VideoPlaybackEvent(pType:String, pData:Object = null){ super(pType, true, false); _data = pData; } public function get data():Object { return _data; } } }
package feathers.tests { import feathers.controls.text.TextBlockTextRenderer; import feathers.tests.supportClasses.CustomStateContext; import feathers.text.FontStylesSet; import flash.text.engine.ElementFormat; import flash.text.engine.FontDescription; import org.flexunit.Assert; import starling.text.TextFormat; public class TextBlockTextRendererTests { private static const STATE_DISABLED:String = "disabled"; private static const DEFAULT_FONT_NAME:String = "DefaultFont"; private static const DEFAULT_FONT_SIZE:Number = 16; private static const DEFAULT_COLOR:uint = 0xff00ff; private static const DISABLED_FONT_NAME:String = "DisabledFont"; private static const DISABLED_FONT_SIZE:Number = 15; private static const DISABLED_COLOR:uint = 0x999999; private static const SELECTED_FONT_NAME:String = "SelectedFont"; private static const SELECTED_FONT_SIZE:Number = 17; private static const SELECTED_COLOR:uint = 0xff0000; private static const STATE_FONT_NAME:String = "StateFont"; private static const STATE_FONT_SIZE:Number = 18; private static const STATE_COLOR:uint = 0xffffff; private var _textRenderer:TextBlockTextRenderer; [Before] public function prepare():void { this._textRenderer = new TextBlockTextRenderer(); TestFeathers.starlingRoot.addChild(this._textRenderer); } [After] public function cleanup():void { this._textRenderer.removeFromParent(true); this._textRenderer = null; Assert.assertStrictlyEquals("Child not removed from Starling root on cleanup.", 0, TestFeathers.starlingRoot.numChildren); } [Test] public function testOneLineWithEmptyString():void { this._textRenderer.text = ""; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer numLines must be 1 with empty string", 1, this._textRenderer.numLines); } [Test] public function testOneLine():void { this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer numLines must be 1", 1, this._textRenderer.numLines); } [Test] public function testNumLinesWithLineBreak():void { this._textRenderer.text = "Hello\nWorld"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer numLines must be 2 when line break is in text", 2, this._textRenderer.numLines); } [Test] public function testNumLinesWithCarriageReturn():void { this._textRenderer.text = "Hello\rWorld"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer numLines must be 2 when carriage return is in text", 2, this._textRenderer.numLines); } [Test] public function testValidateWithoutTextThenSetText():void { var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.validate(); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DEFAULT_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DEFAULT_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DEFAULT_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testGetElementFormatForStateWithoutSetElementFormatForState():void { Assert.assertNull("TextBlockTextRenderer getElementFormatForState() must return null if ElementFormat not provided with setElementFormatForState()", this._textRenderer.getElementFormatForState(STATE_DISABLED)); } [Test] public function testGetElementFormatForStateAfterSetElementFormatForState():void { var elementFormat:ElementFormat = new ElementFormat(); this._textRenderer.setElementFormatForState(STATE_DISABLED, elementFormat); Assert.assertStrictlyEquals("TextBlockTextRenderer getElementFormatForState() must return value passed to setElementFormatForState() with same state", elementFormat, this._textRenderer.getElementFormatForState(STATE_DISABLED)); } [Test] public function testCurrentElementFormatWithElementFormat():void { var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to elementFormat when no other element formats are specified", this._textRenderer.elementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithElementFormatAndDisabled():void { var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.isEnabled = false; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to elementFormat when isEnabled is false, but no other element formats are specified", this._textRenderer.elementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithDisabledElementFormatAndDisabled():void { var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.disabledElementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.isEnabled = false; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to disabledElementFormat when isEnabled is false and disabledElementFormat is not null", this._textRenderer.disabledElementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithElementFormatAndStateContextDisabled():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isEnabled = false; this._textRenderer.stateContext = stateContext; var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to elementFormat when stateContext isEnabled is false, but no other element formats are specified", this._textRenderer.elementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithDisabledElementFormatAndStateContextDisabled():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isEnabled = false; this._textRenderer.stateContext = stateContext; var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.disabledElementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to disabledElementFormat when isEnabled is false and disabledElementFormat is not null", this._textRenderer.disabledElementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithElementFormatAndStateContextSelected():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isSelected = true; this._textRenderer.stateContext = stateContext; var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to elementFormat when stateContext isSelected is true, but no other element formats are specified", this._textRenderer.elementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithSelectedElementFormatAndStateContextSelected():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isSelected = true; this._textRenderer.stateContext = stateContext; var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.selectedElementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to selectedElementFormat when isSelected is true and selectedElementFormat is not null", this._textRenderer.selectedElementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithSelectedAndDisabledElementFormatAndStateContextSelectedAndDisabled():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isSelected = true; stateContext.isEnabled = false; this._textRenderer.stateContext = stateContext; var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.disabledElementFormat = new ElementFormat(font); this._textRenderer.selectedElementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); //disabled should get priority over selected Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to disabledElementFormat when isSelected is true and isEnabled is false and both selectedElementFormat and disabledElementFormat are not null", this._textRenderer.disabledElementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithOnlyElementFormatAndStateContextCurrentState():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.currentState = STATE_DISABLED; this._textRenderer.stateContext = stateContext; var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to elementFormat when no other element formats are specified", this._textRenderer.elementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithDisabledElementFormatAndStateElementFormatWithStateContextDisabledAndCurrentState():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isEnabled = false; stateContext.isSelected = true; stateContext.currentState = STATE_DISABLED; this._textRenderer.stateContext = stateContext; var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.disabledElementFormat = new ElementFormat(font); this._textRenderer.selectedElementFormat = new ElementFormat(font); var disabledStateElementFormat:ElementFormat = new ElementFormat(font); this._textRenderer.setElementFormatForState(STATE_DISABLED, disabledStateElementFormat); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); //exact states always get priority over default/disabled/selected Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to ElementFormat passed into setElementFormatForState() when isEnabled is false and disabledElementFormat are not null", disabledStateElementFormat, this._textRenderer.currentElementFormat); } [Test] public function testFontStylesIgnoredIfAdvancedElementFormatExists():void { var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(); this._textRenderer.fontStyles = fontStyles; var font:FontDescription = new FontDescription("_sans"); this._textRenderer.elementFormat = new ElementFormat(font); this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat must be equal to elementFormat and not a format from font styles", this._textRenderer.elementFormat, this._textRenderer.currentElementFormat); } [Test] public function testCurrentElementFormatWithFontStyles():void { var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DEFAULT_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DEFAULT_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DEFAULT_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatFallBackToDefaultFontStylesWhenDisabled():void { var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.isEnabled = false; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DEFAULT_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DEFAULT_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DEFAULT_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatUseDisabledFontStylesWhenDisabled():void { var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); fontStyles.disabledFormat = new TextFormat(DISABLED_FONT_NAME, DISABLED_FONT_SIZE, DISABLED_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.isEnabled = false; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DISABLED_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DISABLED_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DISABLED_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatFallBackToDefaultFontStylesWithStateContextDisabled():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isEnabled = false; this._textRenderer.stateContext = stateContext; var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DEFAULT_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DEFAULT_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DEFAULT_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatUseDisabledFontStylesWithStateContextDisabled():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isEnabled = false; this._textRenderer.stateContext = stateContext; var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); fontStyles.disabledFormat = new TextFormat(DISABLED_FONT_NAME, DISABLED_FONT_SIZE, DISABLED_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DISABLED_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DISABLED_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DISABLED_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatFallBackToDefaultFontStylesWithStateContextSelected():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isSelected = true; this._textRenderer.stateContext = stateContext; var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DEFAULT_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DEFAULT_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DEFAULT_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatUseSelectedFontStylesWithStateContextSelected():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isSelected = true; this._textRenderer.stateContext = stateContext; var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); fontStyles.selectedFormat = new TextFormat(SELECTED_FONT_NAME, SELECTED_FONT_SIZE, SELECTED_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", SELECTED_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", SELECTED_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", SELECTED_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatUseDisabledFontStylesWithStateContextSelectedAndDisabled():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.isSelected = true; stateContext.isEnabled = false; this._textRenderer.stateContext = stateContext; var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); fontStyles.selectedFormat = new TextFormat(SELECTED_FONT_NAME, SELECTED_FONT_SIZE, SELECTED_COLOR); fontStyles.disabledFormat = new TextFormat(DISABLED_FONT_NAME, DISABLED_FONT_SIZE, DISABLED_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); //disabled should get priority over selected Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DISABLED_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DISABLED_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DISABLED_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatFallBackToDefaultFontStylesWithStateContextCurrentState():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.currentState = STATE_DISABLED; this._textRenderer.stateContext = stateContext; var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", DEFAULT_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", DEFAULT_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", DEFAULT_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testCurrentElementFormatUseStateFontStylesWithStateContextCurrentState():void { var stateContext:CustomStateContext = new CustomStateContext(); stateContext.currentState = STATE_DISABLED; stateContext.isSelected = true; stateContext.isEnabled = false; this._textRenderer.stateContext = stateContext; var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); fontStyles.selectedFormat = new TextFormat(SELECTED_FONT_NAME, SELECTED_FONT_SIZE, SELECTED_COLOR); fontStyles.disabledFormat = new TextFormat(DISABLED_FONT_NAME, DISABLED_FONT_SIZE, DISABLED_COLOR); fontStyles.setFormatForState(STATE_DISABLED, new TextFormat(STATE_FONT_NAME, STATE_FONT_SIZE, STATE_COLOR)); this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); //exact states always get priority over default/disabled/selected Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontDescription.fontName must be equal to starling.text.TextFormat font", STATE_FONT_NAME, this._textRenderer.currentElementFormat.fontDescription.fontName); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.fontSize must be equal to starling.text.TextFormat size", STATE_FONT_SIZE, this._textRenderer.currentElementFormat.fontSize); Assert.assertStrictlyEquals("TextBlockTextRenderer currentElementFormat.color must be equal to starling.text.TextFormat color", STATE_COLOR, this._textRenderer.currentElementFormat.color); } [Test] public function testInvalidAfterChangePropertyOfFontStyles():void { var format:TextFormat = new TextFormat(DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_COLOR); var fontStyles:FontStylesSet = new FontStylesSet(); fontStyles.format = format this._textRenderer.fontStyles = fontStyles; this._textRenderer.text = "Hello World"; this._textRenderer.validate(); format.color = SELECTED_COLOR; Assert.assertTrue("TextBlockTextRenderer: must be invalid after changing property of font styles.", this._textRenderer.isInvalid()); } } }