hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
588 values
lang
stringclasses
305 values
max_stars_repo_path
stringlengths
3
363
max_stars_repo_name
stringlengths
5
118
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
10
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringdate
2015-01-01 00:00:35
2022-03-31 23:43:49
max_stars_repo_stars_event_max_datetime
stringdate
2015-01-01 12:37:38
2022-03-31 23:59:52
max_issues_repo_path
stringlengths
3
363
max_issues_repo_name
stringlengths
5
118
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
10
max_issues_count
float64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
363
max_forks_repo_name
stringlengths
5
135
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
10
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringdate
2015-01-01 00:01:02
2022-03-31 23:27:27
max_forks_repo_forks_event_max_datetime
stringdate
2015-01-03 08:55:07
2022-03-31 23:59:24
content
stringlengths
5
1.05M
avg_line_length
float64
1.13
1.04M
max_line_length
int64
1
1.05M
alphanum_fraction
float64
0
1
ecb76e9124d8bdbb6bf9aec9f7430cc79b2f819a
681
as
ActionScript
duckstazy-p2p/d2-sources/src/com/ek/duckstazy/utils/XRandom.as
highduck/duckstazy-archive
6ef609fe87943d58e27181b4cdfaf13ca366f8d6
[ "MIT" ]
null
null
null
duckstazy-p2p/d2-sources/src/com/ek/duckstazy/utils/XRandom.as
highduck/duckstazy-archive
6ef609fe87943d58e27181b4cdfaf13ca366f8d6
[ "MIT" ]
null
null
null
duckstazy-p2p/d2-sources/src/com/ek/duckstazy/utils/XRandom.as
highduck/duckstazy-archive
6ef609fe87943d58e27181b4cdfaf13ca366f8d6
[ "MIT" ]
null
null
null
package com.ek.duckstazy.utils { /** * @author eliasku */ public class XRandom { private static var _seed:int; private static const A:uint = 16807; private static const C:uint = 12345; private static const MASK:uint = 0x7fffffff; public static function shuffle():void { _seed = int((new Date()).time); } public static function set seed(value:Number):void { _seed = value & 0x7fffffff; } public static function random(min:Number = 0.0, max:Number = 1.0):Number { _seed = (A * _seed + C) & MASK; return min + (max - min) * Number(_seed / 0x7fffffff); } static public function get seed():Number { return _seed; } } }
19.457143
75
0.638767
b482efbb30a67200de0b6e4d739be7869497786f
292
as
ActionScript
Data/Interface/Source/Bethesda/UI/LevelUpMenu/PerkClipe9453.as
clayne/FO4_Interface
8e6872c7daffa44a2e2cdf77ad84d5d3991d7942
[ "RSA-MD" ]
14
2016-08-11T04:15:53.000Z
2020-04-04T18:22:41.000Z
Data/Interface/Source/Bethesda/UI/LevelUpMenu/PerkClipe9453.as
clayne/FO4_Interface
8e6872c7daffa44a2e2cdf77ad84d5d3991d7942
[ "RSA-MD" ]
3
2016-08-16T00:34:41.000Z
2017-09-23T19:22:11.000Z
Data/Interface/Source/Bethesda/UI/LevelUpMenu/PerkClipe9453.as
clayne/FO4_Interface
8e6872c7daffa44a2e2cdf77ad84d5d3991d7942
[ "RSA-MD" ]
3
2020-05-01T00:00:36.000Z
2022-01-15T00:21:09.000Z
package { public dynamic class PerkClipe9453 extends PerkAnimHolder { public function PerkClipe9453() { super(); addFrameScript(0,this.frame1,151,this.frame152); } function frame1() : * { stop(); } function frame152() : * { gotoAndPlay(2); } } }
12.166667
58
0.606164
31adf851a07ca95d2301f312d46bee2f60fe3279
1,291
as
ActionScript
AIR/src/feathers/layout/HorizontalAlign.as
Dimensionscape/OpenFL-Tile-Packer
fb9b45d7116ee94659b59cceb3c3865a666eb3c0
[ "MIT" ]
2
2020-08-24T14:17:38.000Z
2020-11-12T21:12:58.000Z
AIR/src/feathers/layout/HorizontalAlign.as
Dimensionscape/OpenFL-Tile-Packer
fb9b45d7116ee94659b59cceb3c3865a666eb3c0
[ "MIT" ]
null
null
null
AIR/src/feathers/layout/HorizontalAlign.as
Dimensionscape/OpenFL-Tile-Packer
fb9b45d7116ee94659b59cceb3c3865a666eb3c0
[ "MIT" ]
null
null
null
/* Feathers Copyright 2012-2019 Bowler Hat LLC. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.layout { /** * Constants for horizontal alignment of items in a layout. * * <p>Note: Some constants may not be valid for certain properties. Please * see the description of the property in the API reference for full * details.</p> * * @productversion Feathers 3.0.0 */ public class HorizontalAlign { /** * The items in the layout will be horizontally aligned to the left of * the bounds. * * @productversion Feathers 3.0.0 */ public static const LEFT:String = "left"; /** * The items in the layout will be horizontally aligned to the center of * the bounds. * * @productversion Feathers 3.0.0 */ public static const CENTER:String = "center"; /** * The items in the layout will be horizontally aligned to the right of * the bounds. * * @productversion Feathers 3.0.0 */ public static const RIGHT:String = "right"; /** * The items in the layout will fill the width of the bounds. * * @productversion Feathers 3.0.0 */ public static const JUSTIFY:String = "justify"; } }
24.358491
75
0.683191
3ad9c7c96dc14db0d5b885b6baa139c4c89dc043
9,331
as
ActionScript
samples/client/petstore/flash/flash/src/org/openapitools/client/api/PetApi.as
MalcolmScoffable/openapi-generator
73605a0c0e0c825286c95123c63678ba75b44d5c
[ "Apache-2.0" ]
5
2019-12-03T13:50:09.000Z
2021-11-14T12:59:48.000Z
samples/client/petstore/flash/flash/src/org/openapitools/client/api/PetApi.as
MalcolmScoffable/openapi-generator
73605a0c0e0c825286c95123c63678ba75b44d5c
[ "Apache-2.0" ]
10
2019-06-28T09:01:45.000Z
2022-02-26T12:19:16.000Z
samples/client/petstore/flash/flash/src/org/openapitools/client/api/PetApi.as
MalcolmScoffable/openapi-generator
73605a0c0e0c825286c95123c63678ba75b44d5c
[ "Apache-2.0" ]
5
2020-11-26T05:13:41.000Z
2021-04-09T15:58:18.000Z
package org.openapitools.client.api { import org.openapitools.common.ApiInvoker; import org.openapitools.exception.ApiErrorCodes; import org.openapitools.exception.ApiError; import org.openapitools.common.ApiUserCredentials; import org.openapitools.event.Response; import org.openapitools.common.OpenApi; import org.openapitools.client.model.ApiResponse; import flash.filesystem.File; import org.openapitools.client.model.Pet; import mx.rpc.AsyncToken; import mx.utils.UIDUtil; import flash.utils.Dictionary; import flash.events.EventDispatcher; public class PetApi extends OpenApi { /** * Constructor for the PetApi api client * @param apiCredentials Wrapper object for tokens and hostName required towards authentication * @param eventDispatcher Optional event dispatcher that when provided is used by the SDK to dispatch any Response */ public function PetApi(apiCredentials: ApiUserCredentials, eventDispatcher: EventDispatcher = null) { super(apiCredentials, eventDispatcher); } public static const event_add_pet: String = "add_pet"; public static const event_delete_pet: String = "delete_pet"; public static const event_find_pets_by_status: String = "find_pets_by_status"; public static const event_find_pets_by_tags: String = "find_pets_by_tags"; public static const event_get_pet_by_id: String = "get_pet_by_id"; public static const event_update_pet: String = "update_pet"; public static const event_update_pet_with_form: String = "update_pet_with_form"; public static const event_upload_file: String = "upload_file"; /* * Returns void */ public function add_pet (pet: Pet): String { // create path and map variables var path: String = "/pet".replace(/{format}/g,"xml"); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); // verify required params are set if() { throw new ApiError(400, "missing required params"); } var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, pet, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; token.completionEventType = "add_pet"; token.returnType = null ; return requestId; } /* * Returns void */ public function delete_pet (petId: Number, apiKey: String): String { // create path and map variables var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); // verify required params are set if( // verify required params are set if() { throw new ApiError(400, "missing required params"); } ) { throw new ApiError(400, "missing required params"); } headerParams["api_key"] = toPathValue(apiKey); var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; token.completionEventType = "delete_pet"; token.returnType = null ; return requestId; } /* * Returns Array */ public function find_pets_by_status (status: Array): String { // create path and map variables var path: String = "/pet/findByStatus".replace(/{format}/g,"xml"); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); // verify required params are set if() { throw new ApiError(400, "missing required params"); } if("null" != String(status)) queryParams["status"] = toPathValue(status); var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; token.completionEventType = "find_pets_by_status"; token.returnType = Array; return requestId; } /* * Returns Array */ public function find_pets_by_tags (tags: Array): String { // create path and map variables var path: String = "/pet/findByTags".replace(/{format}/g,"xml"); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); // verify required params are set if() { throw new ApiError(400, "missing required params"); } if("null" != String(tags)) queryParams["tags"] = toPathValue(tags); var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; token.completionEventType = "find_pets_by_tags"; token.returnType = Array; return requestId; } /* * Returns Pet */ public function get_pet_by_id (petId: Number): String { // create path and map variables var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); // verify required params are set if() { throw new ApiError(400, "missing required params"); } var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; token.completionEventType = "get_pet_by_id"; token.returnType = Pet; return requestId; } /* * Returns void */ public function update_pet (pet: Pet): String { // create path and map variables var path: String = "/pet".replace(/{format}/g,"xml"); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); // verify required params are set if() { throw new ApiError(400, "missing required params"); } var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, pet, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; token.completionEventType = "update_pet"; token.returnType = null ; return requestId; } /* * Returns void */ public function update_pet_with_form (petId: Number, name: String, status: String): String { // create path and map variables var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); // verify required params are set if( // verify required params are set if( // verify required params are set if() { throw new ApiError(400, "missing required params"); } ) { throw new ApiError(400, "missing required params"); } ) { throw new ApiError(400, "missing required params"); } var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; token.completionEventType = "update_pet_with_form"; token.returnType = null ; return requestId; } /* * Returns ApiResponse */ public function upload_file (petId: Number, additionalMetadata: String, file: File): String { // create path and map variables var path: String = "/pet/{petId}/uploadImage".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); // verify required params are set if( // verify required params are set if( // verify required params are set if() { throw new ApiError(400, "missing required params"); } ) { throw new ApiError(400, "missing required params"); } ) { throw new ApiError(400, "missing required params"); } var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; token.completionEventType = "upload_file"; token.returnType = ApiResponse; return requestId; } } }
30.694079
147
0.616761
b89305a4ae65a2cf8ddb39e05772345cadd9299c
1,236
as
ActionScript
src/sabelas/graphics/DummyQuadView.as
abiyasa/they-were-11-clones
3e14d5583cac044748bb00b5a2094eca050b1255
[ "MIT" ]
3
2015-06-19T07:10:07.000Z
2021-06-11T14:56:39.000Z
src/sabelas/graphics/DummyQuadView.as
abiyasa/they-were-11-clones
3e14d5583cac044748bb00b5a2094eca050b1255
[ "MIT" ]
null
null
null
src/sabelas/graphics/DummyQuadView.as
abiyasa/they-were-11-clones
3e14d5583cac044748bb00b5a2094eca050b1255
[ "MIT" ]
1
2016-02-10T14:56:53.000Z
2016-02-10T14:56:53.000Z
package sabelas.graphics { import starling.display.Sprite; import starling.display.Quad; /** * A dummy Starling sprite, rendering a quad * @author Abiyasa */ public class DummyQuadView extends Sprite { protected var _q:Quad; /** * Dummy view (a quad) * * @param size The width of the quad * @param quadColors Quad colors, array of 4 colors representing the corner's colors * @param rotation Initial rotation if you want the quad to be tilted (in radian) */ public function DummyQuadView(size:int = 0, quadColors:Array = null) { super(); // default size if (size <= 0) { size = 10; } // default colors if (quadColors == null) { quadColors = [ 0x000000, 0xAA0000, 0x00FF00, 0x0000FF ]; } while (quadColors.length < 4) { // fill it with the first color quadColors.push(quadColors[0]); } // create a lovely quad _q = new Quad(size, size); _q.setVertexColor(0, quadColors[0]); _q.setVertexColor(1, quadColors[1]); _q.setVertexColor(2, quadColors[2]); _q.setVertexColor(3, quadColors[3]); addChild(_q); // adjust rotation pivot to the center this.pivotX = size / 2; this.pivotY = size / 2; } } }
21.684211
86
0.635113
1a8a9877b5979393b2e9ab6235eab4ffe4c3986e
1,909
as
ActionScript
rockdot/source/flash/lib/org/springextensions/actionscript/ioc/factory/IReferenceResolver.as
blockforest/rockdot-actionscript
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
1
2016-07-14T23:17:30.000Z
2016-07-14T23:17:30.000Z
rockdot/source/flash/lib/org/springextensions/actionscript/ioc/factory/IReferenceResolver.as
acanvas/acanvas-actionscript-framework
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
null
null
null
rockdot/source/flash/lib/org/springextensions/actionscript/ioc/factory/IReferenceResolver.as
acanvas/acanvas-actionscript-framework
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
null
null
null
/* * Copyright 2007-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springextensions.actionscript.ioc.factory { /** * The interface definting a reference resolver. Reference resolvers are used to find references * to IObjectReference implementations and resolve them. * * <p> * <b>Author:</b> Christophe Herreman<br/> * <b>Version:</b> $Revision: 21 $, $Date: 2008-11-01 22:58:42 +0100 (za, 01 nov 2008) $, $Author: dmurat $<br/> * <b>Since:</b> 0.1 * </p> * * @see org.springextensions.actionscript.ioc.factory.IObjectFactory * @see org.springextensions.actionscript.ioc.factory.config.IObjectReference */ public interface IReferenceResolver { /** * Indicates if the given property can be resolved by this reference resolver * * @param property The property to check * * @return true if this reference resolver can process the given property */ function canResolve(property:Object):Boolean; /** * Resolves all references of IObjectReference contained within the given property. * * @param property The property to resolve * * @return The property with all references resolved * * @see org.springextensions.actionscript.ioc.factory.config.IObjectReference */ function resolve(property:Object):Object; } }
35.351852
114
0.698795
09b244f34116014438dca172332300061f13c7af
1,257
as
ActionScript
audioapi/AudioNode.as
Korilakkuma/Action-Audio-API
7878341e1f44a35159493718391565a2ecc858bb
[ "MIT" ]
3
2015-02-03T14:21:42.000Z
2017-11-15T21:57:10.000Z
audioapi/AudioNode.as
Korilakkuma/ActionAudioAPI
7878341e1f44a35159493718391565a2ecc858bb
[ "MIT" ]
null
null
null
audioapi/AudioNode.as
Korilakkuma/ActionAudioAPI
7878341e1f44a35159493718391565a2ecc858bb
[ "MIT" ]
null
null
null
package audioapi { import flash.events.SampleDataEvent; public class AudioNode { public static const BUFFER_SIZE:uint = 4096; protected var inputs:Array = []; protected var outputs:Array = []; protected var numberOfConnections = 0; protected var numberOfOutputs = 0; public function AudioNode() { } public function connect(node:AudioNode, channel:uint = 0):void { if (channel >= 0) { this.outputs.push(node); node.numberOfConnections++; } } public function disconnect(channel:uint = 0):void { if (channel >= 0) { this.outputs = []; } } public function input(event:SampleDataEvent, inputL:Number = 0.0, inputR:Number = 0.0):void { this.output(event, inputL, inputR); } public function output(event:SampleDataEvent, outputL:Number = 0.0, outputR:Number = 0.0):void { for (var i:uint = 0, len = this.outputs.length; i < len; i++) { if (this.outputs[i] is AudioNode) { this.outputs[i].input(event, outputL, outputR); } } } } }
27.326087
104
0.529833
3b24d101a3a97af411bc8d23f9e7f376622ddcf3
5,274
as
ActionScript
ageb/src/ageb/modules/avatar/timelineClasses/FrameLayerList.as
nexttouches/age_client
c2c9b0f95aa2bd2c95afc20ddcf38ac33b92a5c9
[ "MIT" ]
3
2019-08-17T04:42:42.000Z
2021-04-07T19:10:31.000Z
ageb/src/ageb/modules/avatar/timelineClasses/FrameLayerList.as
nexttouches/age_client
c2c9b0f95aa2bd2c95afc20ddcf38ac33b92a5c9
[ "MIT" ]
null
null
null
ageb/src/ageb/modules/avatar/timelineClasses/FrameLayerList.as
nexttouches/age_client
c2c9b0f95aa2bd2c95afc20ddcf38ac33b92a5c9
[ "MIT" ]
1
2015-07-03T03:29:48.000Z
2015-07-03T03:29:48.000Z
package ageb.modules.avatar.timelineClasses { import flash.events.MouseEvent; import flash.geom.Point; import mx.core.ClassFactory; import mx.core.DragSource; import mx.core.IUIComponent; import mx.core.mx_internal; import mx.events.DragEvent; import mx.managers.DragManager; import spark.components.List; import spark.layouts.supportClasses.DropLocation; import ageb.modules.Modules; import ageb.modules.avatar.op.DragReorderFrameLayerOP; import ageb.utils.FlashTip; import nt.lib.util.clone; import org.osflash.signals.Signal; /** * 帧图层列表 * @author zhanghaocong * */ public class FrameLayerList extends List { /** * 创建一个新的图层列表 * */ public function FrameLayerList() { super(); setStyle("selectionColor", 0x3399ff); setStyle("horizontalScrollPolicy", "off"); setStyle("verticalScrollPolicy", "on"); allowMultipleSelection = true; dragEnabled = true; dragMoveEnabled = true; dropEnabled = true; itemRenderer = new ClassFactory(FrameLayerListItemRenderer); percentWidth = 100; percentHeight = 100; } public var onMouseWheel:Signal = new Signal(); /** * 禁用滚轮事件 * @param event * */ protected function scroller_onMouseWheel(event:MouseEvent):void { onMouseWheel.dispatch(); } /** * @inheritDoc * */ override protected function attachSkin():void { super.attachSkin(); scroller.addEventListener(MouseEvent.MOUSE_WHEEL, scroller_onMouseWheel, false, int.MIN_VALUE); } /** * @inheritDoc * */ override protected function detachSkin():void { scroller.removeEventListener(MouseEvent.MOUSE_WHEEL, scroller_onMouseWheel); super.detachSkin(); } /** * @private * @param a * @param b * @return * */ private function compareValues(a:int, b:int):int { return a - b; } /** * 覆盖 dragDropHandler,实现基于 OP 的拖放操作 * @param event * */ override protected function dragDropHandler(event:DragEvent):void { if (event.isDefaultPrevented()) { return; } // 隐藏 drop 图形 layout.hideDropIndicator(); destroyDropIndicator(); // 隐藏焦点 drawFocus(false); mx_internal::drawFocusAnyway = false; // 验证拖拽数据 if (!enabled || !event.dragSource.hasFormat("itemsByIndex")) { return } // 下落位置 const dropLocation:DropLocation = layout.calculateDropLocation(event); // 索引 const dropIndex:int = dropLocation.dropIndex; // 更新反馈(复制 / 移动) DragManager.showFeedback(event.ctrlKey ? DragManager.COPY : DragManager.MOVE); // 调用封装后的重新排序方法 var dragSource:DragSource = event.dragSource; // 插入位置 var caretIndex:int = -1; if (dragSource.hasFormat("caretIndex")) caretIndex = event.dragSource.dataForFormat("caretIndex") as int; var items:Vector.<Object> = dragSource.dataForFormat("itemsByIndex") as Vector.<Object>; // 创建一个 OP,之后的事情全部在 OP 里做 var op:DragReorderFrameLayerOP = new DragReorderFrameLayerOP(Modules.getInstance().document.currentDoc, dropIndex, caretIndex, items, event.action, this); op.execute(); } public function reorder(dropIndex:int, caretIndex:int, items:Vector.<Object>, action:String, dragInitiator:IUIComponent = null):void { var indices:Vector.<int> = selectedIndices; // 在修改 dataProvider 前,先取消所有选中状态 // 等到全部弄完了再设置回来 mx_internal::setSelectedIndices(new Vector.<int>(), false); validateProperties(); // 要求立即刷新 // 重新排序就是先删除项 // 同时再根据 dropIndex 重新添加项 // // 如果项被拖到其他列表(容器)中 // 将在 ''对方'' 的 dragCompleteHandler 中处理以下删除操作 // 此时 event.dragInitiator != this if (dragMoveEnabled && (action == DragManager.MOVE || action == DragManager.COPY) && (dragInitiator == null || dragInitiator == this)) { // Remove the previously selected items indices.sort(compareValues); for (var i:int = indices.length - 1; i >= 0; i--) { if (indices[i] < dropIndex) dropIndex--; dataProvider.removeItemAt(indices[i]); } } // 新的选中区域数组 var newSelection:Vector.<int> = new Vector.<int>(); // 根据插入位置更新新的选择索引 if (caretIndex != -1) newSelection.push(dropIndex + caretIndex); // 是否要复制? var copyItems:Boolean = action == DragManager.COPY; if (copyItems) { FlashTip.show("暂不支持复制"); copyItems = false; } for (i = 0; i < items.length; i++) { // Get the item, clone if needed var item:Object = items[i]; if (copyItems) item = clone(item); // Copy the data dataProvider.addItemAt(item, dropIndex + i); // Update the selection if (i != caretIndex) newSelection.push(dropIndex + i); } // 重新选择(刚刚移动 / 复制了的)项 mx_internal::setSelectedIndices(newSelection, true); } public function scrollTo(index:int):void { // Sometimes we may need to scroll several times as for virtual layouts // this is not guaranteed to bring in the element in view the first try // as some items in between may not be loaded yet and their size is only // estimated. var delta:Point; var loopCount:int = 0; while (loopCount++ < 10) { validateNow(); delta = layout.getScrollPositionDeltaToElement(index); if (!delta || (delta.x == 0 && delta.y == 0)) break; layout.horizontalScrollPosition += delta.x; layout.verticalScrollPosition += delta.y; } } } }
24.877358
157
0.673303
5c2bf943ecd2b07b7a9f86e33e9036825567310c
2,601
as
ActionScript
SJGame/src/GameConsole/ConsoleApplication.as
liu-jack/SJGame
2ade3f9d4ec3cf6a6589301d77dd980cfa2500d5
[ "MIT" ]
1
2021-06-09T23:39:11.000Z
2021-06-09T23:39:11.000Z
SJGame/src/GameConsole/ConsoleApplication.as
liu-jack/SJGame
2ade3f9d4ec3cf6a6589301d77dd980cfa2500d5
[ "MIT" ]
null
null
null
SJGame/src/GameConsole/ConsoleApplication.as
liu-jack/SJGame
2ade3f9d4ec3cf6a6589301d77dd980cfa2500d5
[ "MIT" ]
null
null
null
package GameConsole { import GameConsole.core.ConsoleLog; import GameConsole.core.IConsole; import engine_starling.display.SNode; import flash.display.Sprite; import flash.events.MouseEvent; import flash.utils.Dictionary; import starling.core.Starling; import starling.display.Stage; import starling.events.Event; import starling.events.KeyboardEvent; /** * 控制台程序 * @author caihua * */ public class ConsoleApplication { private var _rootNode:SNode; private var _stage:Stage; private static var _ins:ConsoleApplication; private var _consoledict:Dictionary = new Dictionary(); public function ConsoleApplication(rootNode:SNode) { _rootNode = rootNode; _stage = _rootNode.stage; var iconsole:ConsoleLog = new ConsoleLog(); // _rootNode.addChild(iconsole); var activeButton:Sprite = new Sprite(); activeButton.graphics.lineStyle(1); activeButton.graphics.beginFill(0xFF0000); activeButton.graphics.drawRect(0,0,40,40); activeButton.graphics.lineTo(40,40); activeButton.graphics.moveTo(40,0); activeButton.graphics.lineTo(0,40); activeButton.graphics.endFill(); activeButton.x = 0; activeButton.y = 240; activeButton.addEventListener(MouseEvent.CLICK,function _e(e:MouseEvent):void{ var ne:Event = new KeyboardEvent(KeyboardEvent.KEY_UP,0,113,0,false,true); Starling.current.stage.dispatchEvent(ne); }); Starling.current.nativeStage.addChild(activeButton); Starling.current.nativeStage.addChild(iconsole); _registerConsole(iconsole); } private function _registerhotkey():void { _stage.addEventListener(KeyboardEvent.KEY_UP,_onKeyDown); } private function _unregisterhotkey():void { _stage.removeEventListener(KeyboardEvent.KEY_UP,_onKeyDown); } private function _onKeyDown(e:KeyboardEvent):void { if(e.altKey) { if(_consoledict.hasOwnProperty(e.keyCode)) { var iconsole:IConsole = _consoledict[e.keyCode]; iconsole.isOpened = !iconsole.isOpened; } } } private function _registerConsole(console:IConsole):void { _consoledict[console.hotkeyId()] = console; } /** * 注册控制台 * @param rootNode * */ public static function registerConsole(rootNode:SNode):void { if(ConsoleApplication._ins == null) ConsoleApplication._ins = new ConsoleApplication(rootNode); ConsoleApplication._ins._registerhotkey(); } public static function unregisterConsole():void { if(ConsoleApplication._ins == null) return; ConsoleApplication._ins._unregisterhotkey(); } } }
23.862385
81
0.723183
55e97ee74072c6abd7161dcb4ff76b8046e1d233
476
as
ActionScript
tests/swf/trace/movieclip-version.as
lieff/lvg
d8f8f77ba42c714532c40380ce6b013a82ffb43b
[ "CC0-1.0" ]
100
2016-08-02T07:26:37.000Z
2022-03-27T15:15:28.000Z
tests/swf/trace/movieclip-version.as
lieff/lvg
d8f8f77ba42c714532c40380ce6b013a82ffb43b
[ "CC0-1.0" ]
4
2018-08-12T18:28:29.000Z
2022-02-28T03:06:16.000Z
tests/swf/trace/movieclip-version.as
lieff/lvg
d8f8f77ba42c714532c40380ce6b013a82ffb43b
[ "CC0-1.0" ]
9
2018-01-11T13:35:00.000Z
2021-08-09T07:15:25.000Z
// makeswf -v 7 -s 200x150 -r 1 -o movieclip-version.swf movieclip-version.as trace (this); trace ($version.substr (0, 3)); trace (this.$version.substr (0, 3)); if (this == _root) { for (i = 5; i <= 8; i++) { createEmptyMovieClip ("m" + i, i); loadMovie ("movieclip-version-" + i + ".swf", "m" + i); loadMovie ("movieclip-version-" + i + ".swf", "_level" + i); } } else { delete this.$version; trace (this.$version); loadMovie ("fscommand:quit", ""); }
28
77
0.584034
65a3f053cc7e4414a4438eecb870a5a99a877d72
264
as
ActionScript
src/utils/validation/isValidEmailAddress.as
wpsmith/as3-utils
838aad249f53afcfb88c2cdbba7004b07b1637e7
[ "MIT" ]
55
2015-01-13T10:20:25.000Z
2021-07-27T21:14:19.000Z
src/utils/validation/isValidEmailAddress.as
wpsmith/as3-utils
838aad249f53afcfb88c2cdbba7004b07b1637e7
[ "MIT" ]
null
null
null
src/utils/validation/isValidEmailAddress.as
wpsmith/as3-utils
838aad249f53afcfb88c2cdbba7004b07b1637e7
[ "MIT" ]
19
2015-01-13T10:18:40.000Z
2021-04-06T01:38:56.000Z
package utils.validation { /** * Validate a string as a valid email address. */ public function isValidEmailAddress(str:String):Boolean { var emailExpression:RegExp = /^[a-z][\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$/i; return emailExpression.test(str); } }
24
78
0.640152
3bbbbe3d406a68a7c9d59de43a0659ae546ce519
7,547
as
ActionScript
bin/as/LayaAirFlash/flash/src/laya/flash/FlashContext.as
ly774508966/layaair
9009e0d114c826dee1ff0e981bc9a172a826b87b
[ "MIT" ]
2
2016-10-26T20:06:03.000Z
2021-01-21T13:00:58.000Z
bin/as/LayaAirFlash/flash/src/laya/flash/FlashContext.as
ly774508966/layaair
9009e0d114c826dee1ff0e981bc9a172a826b87b
[ "MIT" ]
null
null
null
bin/as/LayaAirFlash/flash/src/laya/flash/FlashContext.as
ly774508966/layaair
9009e0d114c826dee1ff0e981bc9a172a826b87b
[ "MIT" ]
null
null
null
/*[IF-FLASH]*/package laya.flash { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Sprite; import flash.geom.Matrix; import flash.geom.Rectangle; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import flash.utils.Dictionary; import laya.resource.Context; import laya.resource.HTMLCanvas; import laya.utils.Color; import laya.utils.Stat; /** * ... * @author laya */ public class FlashContext extends Context { private static var _textField:TextField = new TextField(); private static var _dfontStr : String = ""; private static var _thisPtr : FlashContext = null; private var _bitmapdata:BitmapData; private var _rectangle:Rectangle = new Rectangle(); private var _flashCanvas:FlashCanvas; private var _fillColor:uint = 0; private var _textFormat:TextFormat; //@{ 以下为FlashContext的状态数据.目前用到的加入,还有没有加入的部分. private var _transx : Number = 0; private var _transy : Number = 0; private var _scalex : Number = 1; private var _scaley : Number = 1; private var _vecStateSave : Vector.<contextContent> = null; private var _curSSId : int = 0; //@} public function get bitmapdata():BitmapData { return _bitmapdata; } public function FlashContext(c:FlashCanvas,w:Number,h:Number) { super(); _flashCanvas = c; w > 0 || (w = 800); h > 0 || (h = 800); size(w, h); _vecStateSave = new Vector.<contextContent>( 12 ); for ( var ti :int = 0; ti < 12; ti ++ ) { _vecStateSave[ti] = new contextContent(); } _thisPtr = this; } public function size(w:Number, h:Number):void { if (w == 0 && h == 0) { return; } if (w < 0) w = _bitmapdata.width; if (h < 0) h = _bitmapdata.height; _bitmapdata = new BitmapData(w, h,true,0x00000000); (_flashCanvas.getDisplayObject() as Bitmap).bitmapData = _bitmapdata; } /*** @private */ public override function translate(x:Number, y:Number):void { _transx = x; _transy = y; } /*** @private */ public override function scale(scaleX:Number, scaleY:Number):void { _scalex = scaleX; _scaley = scaleY; } /*** @private */ public override function save():void { _curSSId ++; if ( _vecStateSave.length <= _curSSId ) _vecStateSave.push( new contextContent() ); var tc : contextContent = _vecStateSave[_curSSId]; tc.scaleX = _scalex; tc.scaleY = _scaley; tc.transX = _transx; tc.transY = _transy; } /*** @private */ public override function restore():void { _curSSId --; if ( _curSSId < 0 ) _curSSId = 0; var tc : contextContent = _vecStateSave[_curSSId]; _scalex = tc.scaleX; _scaley = tc.scaleY; _transx = tc.transX; _transy = tc.transY; } public override function fillRect(x:Number, y:Number, width:Number, height:Number, style:*):void { Stat.drawCall++; style && (this.fillStyle = style); _rectangle.x = x; _rectangle.y = y; _rectangle.width = width; _rectangle.height = height; _bitmapdata.fillRect(_rectangle, _fillColor); } public override function clearRect(x:Number, y:Number, width:Number, height:Number):void { _rectangle.x = x; _rectangle.y = y; _rectangle.width = width; _rectangle.height = height; _bitmapdata.fillRect(_rectangle, 0x00000000); } /** * 得到类似于"rgba( 50,50,30,0.8 )" 返回了ARGB的32位UINT * @param color * @return */ private static function _getRGBA( color: String ) : uint { if (color.indexOf("rgba") != 0) { return Color.create(color).numColor; } var arr : Array = color.substring( color.indexOf("(") + 1, color.indexOf(")") ).split( "," ); if ( arr.length != 4 ) return 0; return ((int(Number(arr[3]) * 0xff))<<24) + (int(arr[0]) << 16) + (int(arr[1]) << 8) + int(arr[2]); } /*** @private */ public override function set fillStyle(value:*):void { _fillColor = _getRGBA(value as String); } /*** @private */ public override function set font(str:String):void { if ( str == _dfontStr ) return; _dfontStr = str; var textFormat:TextFormat = _textFormatMap[str]; if (!textFormat) { //textFormat = _textFormatMap[font] = new TextFormat(font); // var ctxFont:String = (italic ? "italic " : "") + (bold ? "bold " : "") + fontSize + "px " + font; // 总共有4种格式需要处理: var ta : Array = str.split( "px " ); var size : int = 14; var fname : String = "Verdana"; var bbold : Boolean = false; var italic : Boolean = false; if ( ta.length > 1 ) { fname = ta[1]; var a1 : Array = (ta[0] as String).split( " " ); if( a1.length == 1 ) size = parseInt( ta[0] ); else if( a1.length == 2 ){ if ( a1[0] == "bold" ) bbold = true; if ( a1[0] == "italic" ) italic = true; size = parseInt( a1[1] as String ); }else if ( a1.length == 3 ) { if ( a1[0] == "italic" ) italic = true; if ( a1[1] == "bold" ) bbold = true; size = parseInt( a1[2] as String ); } } textFormat = _textFormatMap[str] = new TextFormat(fname,size,null,bbold,italic ); } _textField.defaultTextFormat = textFormat; _textField.setTextFormat(textFormat); } public static function __measureText(txt:String, _font:String):* { if ( _font == "" ) _font = _dfontStr; _thisPtr.font = _font; _textField.text = txt; //trace( "The font name & text:" + textFormat.font + "," + txt + "," + textFormat.size ); var rect : Rectangle = _textField.getCharBoundaries( 0 ); if( rect ){ rect.width = _textField.textWidth; rect.height = _textField.textHeight; } if( rect ) return { width: rect.width, height: rect.height }; else return { width : 0, height : 0 }; } /*** @private */ public override function measureText(text:String):* { return __measureText( text,"" ); } /*** @private */ private static var _textFormatMap:Dictionary = new Dictionary(); private var _drawMatrix : Matrix = new Matrix( 1, 0, 0, 1 ); //private static var xoff : int = 600; public override function fillText(text:*, x:Number, y:Number, font:String, color:String, textAlign:String):void { Stat.drawCall++; var txtColor:uint = _fillColor; if (color) txtColor = _getRGBA(color); _textField.textColor = txtColor; /*if (font) { var textFormat:TextFormat = _textFormatMap[font]; _textField.setTextFormat(new TextFormat(font)); }*/ var t_rect : Rectangle = _textField.getCharBoundaries( 0 ); _textField.text = text; // River:这个_textField不设宽高,不设置AutoSize是个大坑。 // 先调试画字顶点的数据和UV,再调试大图合集,最后才调到sourceCanvas,调了一天. _textField.autoSize = TextFieldAutoSize.LEFT; //_bitmapdata.draw( _textField, new Matrix(1, 0, 0, 1, x, y ) ); _drawMatrix.identity(); _drawMatrix.scale( _scalex, _scaley ); _drawMatrix.tx = x + _transx; _drawMatrix.ty = y + _transy - 3; _bitmapdata.floodFill( 0, 0, 0 ); _bitmapdata.draw( _textField, _drawMatrix ); /* River: 以下为测试文字的代码: if( text == "级" ){ var spi : Sprite = new Sprite(); spi.addChild( new Bitmap( _bitmapdata ) ); FlashMain.sta.addChild( spi ); spi.x = xoff; spi.y = 50; xoff += 50; } */ } } } /** * 用于FlashContext的Save和Restore */ class contextContent { public var scaleX : Number = 1.0; public var scaleY : Number = 1.0; public var transX : Number = 0.0; public var transY : Number = 0.0; public function contextContent() { } }
28.055762
115
0.625149
a860161783e46e3e8b728e8b2801bba6d2af1784
845
as
ActionScript
Source/Helpers/Utils.as
ZayshaaCodes/tm-dashboard
3f4241f8596133e58f2f7c9c50e0fb7d05b8020c
[ "MIT" ]
1
2021-12-27T21:56:02.000Z
2021-12-27T21:56:02.000Z
Source/Helpers/Utils.as
ZayshaaCodes/tm-dashboard
3f4241f8596133e58f2f7c9c50e0fb7d05b8020c
[ "MIT" ]
null
null
null
Source/Helpers/Utils.as
ZayshaaCodes/tm-dashboard
3f4241f8596133e58f2f7c9c50e0fb7d05b8020c
[ "MIT" ]
null
null
null
namespace Util { #if TMNEXT CSmPlayer@ GetViewingPlayer() { auto playground = GetApp().CurrentPlayground; if (playground is null || playground.GameTerminals.Length != 1) { return null; } return cast<CSmPlayer>(playground.GameTerminals[0].GUIPlayer); } #elif TURBO CGameMobil@ GetViewingPlayer() { auto playground = cast<CTrackManiaRace>(GetApp().CurrentPlayground); if (playground is null) { return null; } return playground.LocalPlayerMobil; } #elif MP4 CGamePlayer@ GetViewingPlayer() { auto playground = GetApp().CurrentPlayground; if (playground is null || playground.GameTerminals.Length != 1) { return null; } return playground.GameTerminals[0].GUIPlayer; } #endif }
25.606061
76
0.611834
89b16a94571256b5b25edc513944ce3400aa7523
2,952
as
ActionScript
Entry/src/com/tencent/morefun/naruto/plugin/exui/tooltip/UserTitleTips.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
6
2016-10-13T18:08:03.000Z
2021-05-30T20:46:51.000Z
Entry/src/com/tencent/morefun/naruto/plugin/exui/tooltip/UserTitleTips.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
null
null
null
Entry/src/com/tencent/morefun/naruto/plugin/exui/tooltip/UserTitleTips.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
1
2016-10-13T18:17:38.000Z
2016-10-13T18:17:38.000Z
package com.tencent.morefun.naruto.plugin.exui.tooltip { import com.tencent.morefun.naruto.plugin.ui.tips.BaseTipsView; import ui.plugin.tooltip.crew.UserTitleTipsUI; import rank.model.data.RankTitleCfgInfo; import com.greensock.TweenLite; import com.tencent.morefun.naruto.plugin.exui.base.Image; public class UserTitleTips extends BaseTipsView { private var _view:UserTitleTipsUI; private var _info:RankTitleCfgInfo; private var _lite:TweenLite; private var _image:Image; public function UserTitleTips(param1:Object = null) { super(null); mouseChildren = false; addChild(this._view = new UserTitleTipsUI()); this._image = new Image(160,60,false,true,true); this._image.moveLoadingMovie(80,30); this._view.icon.addChild(this._image); this._image.smoothing = false; this._image.visible = false; } public function dispose() : void { this._lite && this._lite.kill(); this._lite = null; this._image.dispose(); this._image.parent && this._image.parent.removeChild(this._image); this._image = null; this._view.parent && this._view.parent.removeChild(this._view); this._view = null; this._info = null; } override public function get data() : Object { return this._info; } override public function set data(param1:Object) : void { var _loc2_:uint = 0; this._info = param1 as RankTitleCfgInfo; if(this._info) { _loc2_ = 4; if(this._info.image) { this._image.dispose(); this._image.load(this._info.image); this._image.visible = true; this._view.title.visible = false; } else { this._view.title.htmlText = "<b>" + this._info.formattedName + "</b>"; this._view.title.visible = true; this._image.visible = false; } this._view.tips1.text = this._info.obtainTips; this._view.tips1.height = this._view.tips1.textHeight + (this._view.tips1.numLines - 1) * _loc2_; this._lite && this._lite.kill(); this._lite = TweenLite.to(this._view.label2,0.15,{ "y":this._view.tips1.y + this._view.tips1.height + 5, "onUpdate":this.update }); this._view.tips2.text = this._info.expireTips; this._view.tips2.height = this._view.tips2.textHeight + (this._view.tips2.numLines - 1) * _loc2_; } } private function update() : void { this._view.tips2.y = this._view.label2.y; this._view.background.height = this._view.tips2.y + this._view.tips2.height + 30; } } }
33.545455
109
0.570799
96a4d6acd400b451cebe08180d1115ce57413acb
4,275
as
ActionScript
frameworks/projects/Text/src/main/royale/TextClasses.as
jmegonzalez/royale-asjs
bd5cbefc187fd9d650b93e89f684ce13f986729b
[ "ECL-2.0", "Apache-2.0" ]
306
2017-10-05T14:28:14.000Z
2022-01-25T09:30:45.000Z
frameworks/projects/Text/src/main/royale/TextClasses.as
joseRamonLeon/royale-asjs
4dfa86ec6907da834fb5df7e5dc28e48ba65cbeb
[ "Apache-2.0", "MIT" ]
995
2017-09-29T16:42:20.000Z
2022-03-30T11:06:36.000Z
frameworks/projects/Text/src/main/royale/TextClasses.as
joseRamonLeon/royale-asjs
4dfa86ec6907da834fb5df7e5dc28e48ba65cbeb
[ "Apache-2.0", "MIT" ]
132
2017-11-02T00:07:24.000Z
2022-01-31T11:53:31.000Z
//////////////////////////////////////////////////////////////////////////////// // // 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 { /** * @private * This class is used to link additional classes into Text.swc * beyond those that are found by dependency analysis starting * from the classes specified in manifest.xml. */ internal class TextClasses { import org.apache.royale.text.html.TextLine; TextLine; import org.apache.royale.text.html.TextBlock; TextBlock; import org.apache.royale.text.html.HTMLTextFactory; HTMLTextFactory; import org.apache.royale.text.engine.BreakOpportunity;BreakOpportunity; import org.apache.royale.text.engine.CFFHinting;CFFHinting; import org.apache.royale.text.engine.ContentElement;ContentElement; import org.apache.royale.text.engine.Constants;Constants; import org.apache.royale.text.engine.DigitCase;DigitCase; import org.apache.royale.text.engine.DigitWidth;DigitWidth; import org.apache.royale.text.engine.EastAsianJustifier;EastAsianJustifier; import org.apache.royale.text.engine.ElementFormat;ElementFormat; import org.apache.royale.text.engine.Fonts;Fonts; import org.apache.royale.text.engine.FontDescription;FontDescription; import org.apache.royale.text.engine.FontLookup;FontLookup; import org.apache.royale.text.engine.FontMetrics;FontMetrics; import org.apache.royale.text.engine.FontPosture;FontPosture; import org.apache.royale.text.engine.FontWeight;FontWeight; import org.apache.royale.text.engine.GraphicElement;GraphicElement; import org.apache.royale.text.engine.GroupElement;GroupElement; import org.apache.royale.text.engine.GlyphMetrics; GlyphMetrics; import org.apache.royale.text.engine.ITextBlock;ITextBlock; import org.apache.royale.text.engine.ITextLine;ITextLine; import org.apache.royale.text.engine.JustificationStyle;JustificationStyle; import org.apache.royale.text.engine.Kerning;Kerning; import org.apache.royale.text.engine.LigatureLevel;LigatureLevel; import org.apache.royale.text.engine.LineJustification;LineJustification; import org.apache.royale.text.engine.RenderingMode;RenderingMode; import org.apache.royale.text.engine.SpaceJustifier;SpaceJustifier; import org.apache.royale.text.engine.TabAlignment;TabAlignment; import org.apache.royale.text.engine.TabStop;TabStop; import org.apache.royale.text.engine.TextBaseline;TextBaseline; import org.apache.royale.text.engine.TextElement;TextElement; import org.apache.royale.text.engine.TextJustifier;TextJustifier; import org.apache.royale.text.engine.TextLineCreationResult;TextLineCreationResult; import org.apache.royale.text.engine.TextLineMirrorRegion;TextLineMirrorRegion; import org.apache.royale.text.engine.TextLineValidity;TextLineValidity; import org.apache.royale.text.engine.TextRotation; TextRotation; import org.apache.royale.text.engine.TypographicCase; TypographicCase; import org.apache.royale.text.events.IMEEvent; IMEEvent; import org.apache.royale.text.events.TextEvent; TextEvent; import org.apache.royale.text.engine.TextEngine;TextEngine; import org.apache.royale.text.ime.IME; IME; import org.apache.royale.text.ime.IIMEClient; IIMEClient; import org.apache.royale.text.ime.IIMESupport; IIMESupport; import org.apache.royale.text.ime.IMEConversionMode; IMEConversionMode; import org.apache.royale.text.ime.CompositionAttributeRange; CompositionAttributeRange; } }
54.113924
89
0.775673
7f978d24bf8a31c0aecc83a5b3090920bf6b3dd6
8,546
as
ActionScript
flash-toy-sync-as3/src/core/TPDisplayObject.as
shogunsho2/flash-toy-sync-v3
503a27a52b36dc488d10f8ea06dc15a78ea2733c
[ "MIT" ]
5
2022-01-03T02:01:04.000Z
2022-02-20T12:19:28.000Z
flash-toy-sync-as3/src/core/TPDisplayObject.as
shogunsho2/flash-toy-sync-v3
503a27a52b36dc488d10f8ea06dc15a78ea2733c
[ "MIT" ]
null
null
null
flash-toy-sync-as3/src/core/TPDisplayObject.as
shogunsho2/flash-toy-sync-v3
503a27a52b36dc488d10f8ea06dc15a78ea2733c
[ "MIT" ]
2
2022-01-26T01:49:43.000Z
2022-03-07T22:16:20.000Z
package core { import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.display.Graphics; import flash.display.Shape; import flash.events.Event; import flash.geom.ColorTransform; import flash.geom.Point; import flash.geom.Rectangle; /** * Provides an interface for display objects so that we can access information the same way in both Actionscript 3.0 and 2.0 * * @author notSafeForDev */ public class TPDisplayObject { private var enterFrameHandlers : Array; public var sourceDisplayObject : DisplayObject; public function TPDisplayObject(_object : DisplayObject) { if (_object == null) { throw new Error("Unable to create a tsDisplayObject, the supplied object is null"); } sourceDisplayObject = _object; } public function get x() : Number { return sourceDisplayObject.x; } public function set x(_value : Number) : void { sourceDisplayObject.x = _value; } public function get y() : Number { return sourceDisplayObject.y; } public function set y(_value : Number) : void { sourceDisplayObject.y = _value; } public function get width() : Number { return sourceDisplayObject.width; } public function set width(_value : Number) : void { sourceDisplayObject.width = _value; } public function get height() : Number { return sourceDisplayObject.height; } public function set height(_value : Number) : void { sourceDisplayObject.height = _value; } public function get scaleX() : Number { return sourceDisplayObject.scaleX; } public function set scaleX(_value : Number) : void { sourceDisplayObject.scaleX = _value; } public function get scaleY() : Number { return sourceDisplayObject.scaleY; } public function set scaleY(_value : Number) : void { sourceDisplayObject.scaleY = _value; } public function get alpha() : Number { return sourceDisplayObject.alpha; } public function set alpha(_value : Number) : void { sourceDisplayObject.alpha = _value; } public function get visible() : Boolean { return sourceDisplayObject.visible; } public function set visible(_value : Boolean) : void { sourceDisplayObject.visible = _value; } public function get name() : String { return sourceDisplayObject.name; } public function set name(_value : String) : void { sourceDisplayObject.name = _value; } public function get parent() : DisplayObjectContainer { return sourceDisplayObject.parent; } public function get children() : Vector.<DisplayObject> { if (sourceDisplayObject is DisplayObjectContainer == false) { return null; } var children : Vector.<DisplayObject> = new Vector.<DisplayObject>(); var container : DisplayObjectContainer = (sourceDisplayObject as DisplayObjectContainer); for (var i : Number = 0; i < container.numChildren; i++) { if (container.getChildAt(i) != null) { children.push(container.getChildAt(i)); } } return children; } public function get filters() : Array { return sourceDisplayObject.filters; } public function set filters(_value : Array) : void { sourceDisplayObject.filters = _value; } public function get colorTransform() : ColorTransform { return sourceDisplayObject.transform.colorTransform; } public function set colorTransform(_value : ColorTransform) : void { sourceDisplayObject.transform.colorTransform = _value; } public function setMask(_object : TPDisplayObject) : void { sourceDisplayObject.mask = _object.sourceDisplayObject; } public function addEnterFrameListener(_scope : * , _handler : Function) : void { if (enterFrameHandlers == null) { enterFrameHandlers = []; } var handler : Function = function(e : Event) : void { _handler.apply(_scope); } sourceDisplayObject.addEventListener(Event.ENTER_FRAME, handler); enterFrameHandlers.push({scope: _scope, originalHandler: _handler, handler: handler}); } public function removeEnterFrameListener(_scope : * , _handler : Function) : void { throw new Error("Unable to remove enterFrame listener, it's not yet implemented in the AS2 version"); if (enterFrameHandlers == null) { return; } var handler : Function = null; for (var i : Number = 0; i < enterFrameHandlers.length; i++) { if (enterFrameHandlers[i].scope == _scope && enterFrameHandlers[i].originalHandler == _handler) { handler = enterFrameHandlers[i].handler; break; } } sourceDisplayObject.removeEventListener(Event.ENTER_FRAME, handler); } public function localToGlobal(_point : Point) : Point { return sourceDisplayObject.localToGlobal(_point); } public function globalToLocal(_point : Point) : Point { return sourceDisplayObject.globalToLocal(_point); } public function getBounds(_targetCoordinateSpace : TPDisplayObject) : Rectangle { return sourceDisplayObject.getBounds(_targetCoordinateSpace.sourceDisplayObject); } public function hitTest(_stageX : Number, _stageY : Number, _shapeFlag : Boolean) : Boolean { return sourceDisplayObject.hitTestPoint(_stageX, _stageY, _shapeFlag); } public function isRemoved() : Boolean { return sourceDisplayObject.stage == null; } public static function getParent(_object : DisplayObject) : DisplayObjectContainer { return _object.parent; } public static function getParents(_object : DisplayObject) : Vector.<DisplayObjectContainer> { var parents : Vector.<DisplayObjectContainer> = new Vector.<DisplayObjectContainer>(); var parent : DisplayObjectContainer = _object.parent; while (parent != null) { parents.push(parent); parent = parent.parent; } return parents; } public static function getNestedChildren(_topParent : DisplayObjectContainer) : Vector.<DisplayObject> { var children : Vector.<DisplayObject> = new Vector.<DisplayObject>(); for (var i : int = 0; i < _topParent.numChildren; i++) { var child : * = _topParent.getChildAt(i); if (child != null) { children.push(child); } if (child is DisplayObjectContainer) { children = children.concat(getNestedChildren(DisplayObjectContainer(child))); } } return children; } public static function getChildIndex(_child : DisplayObject) : Number { return _child.parent.getChildIndex(_child); } public static function getChildAtIndex(_parent : DisplayObjectContainer, _index : Number) : DisplayObject { if (_parent.numChildren <= _index) { return null; } return _parent.getChildAt(_index); } public static function create(_parent : TPMovieClip, _name : String) : TPDisplayObject { var displayObject : DisplayObject = new DisplayObject(); displayObject.name = _name; _parent.sourceMovieClip.addChild(displayObject); return new TPDisplayObject(displayObject); } public static function isDisplayObjectContainer(_object : *) : Boolean { return _object is DisplayObjectContainer; } public static function isShape(_object : * ) : Boolean { return _object is Shape; } public static function asDisplayObjectContainer(_object : *) : DisplayObjectContainer { return _object; } /** * Takes the same transform from one object and applies it to the other, so that the other appears to have the same position, scale, rotation, etc * @param _fromObject The object to read the transform from * @param _toObject The object to apply the transform to */ public static function applyTransformMatrixFromOtherObject(_fromObject : TPDisplayObject, _toObject : TPDisplayObject) : void { var fromObject : DisplayObject = _fromObject.sourceDisplayObject; var toObject : DisplayObject = _toObject.sourceDisplayObject; var fromBounds : Rectangle = fromObject.getBounds(toObject.parent); toObject.transform.matrix = fromObject.transform.matrix.clone(); var toBounds : Rectangle = toObject.getBounds(toObject.parent); toObject.scaleX = fromBounds.width / toBounds.width; toObject.scaleY = fromBounds.height / toBounds.height; toBounds = toObject.getBounds(toObject.parent); toObject.x += fromBounds.x - toBounds.x; toObject.y += fromBounds.y - toBounds.y; } public static function remove(_object : TPDisplayObject) : void { if (_object.parent != null) { _object.parent.removeChild(_object.sourceDisplayObject); } } } }
29.673611
148
0.707582
b5ecb744acaf8108c35eb06ab2dd16a9d15b6870
1,076
as
ActionScript
trf/trf.as
juklucas/HPRC_Assembly_Hub
3c88cf90058a3bd4735b45ad1a7399da4ad105d8
[ "MIT" ]
null
null
null
trf/trf.as
juklucas/HPRC_Assembly_Hub
3c88cf90058a3bd4735b45ad1a7399da4ad105d8
[ "MIT" ]
null
null
null
trf/trf.as
juklucas/HPRC_Assembly_Hub
3c88cf90058a3bd4735b45ad1a7399da4ad105d8
[ "MIT" ]
null
null
null
table TRF "Tandem Repeats Finder" ( string chrom; "Genomic sequence name" uint chromStart; "Start in genomic sequence" uint chromEnd; "End in genomic sequence" uint PeriodSize; "Period size of the repeat" float CopyNumber; "Number of copies aligned with the consensus pattern" uint ConsensusSize; "Size of consensus pattern (may differ slightly from the period size)" float PercentMatches; "Percent of matches between adjacent copies overall" float PercentIndels; "Percent of indels between adjacent copies overall" uint Score; "Alignment Score = 2*match-7*mismatch-7*indel; minscore=50" char[1] A; "Percent composition of A nucleotide" char[1] C; "Percent composition of C nucleotide" char[1] G; "Percent composition of G nucleotide" char[1] T; "Percent composition of T nucleotide" float Entropy; "Entropy measure based on percent composition" string Motif; "Motif of repeat" lstring Sequence; "Sequence of repeat unit element" )
51.238095
98
0.683086
b6b30549037e676e92b89f9e75de0b0ef92b9d64
3,519
as
ActionScript
Source Client/By Name/dofus/graphics/gapi/controls/jobviewer/JobViewerSkillItem.as
AXeL-dev/Dofus-client-1.29
e09c7e5fec1fff0d542a16985868fc561aeca02b
[ "MIT" ]
1
2021-01-18T15:19:16.000Z
2021-01-18T15:19:16.000Z
Source Client/By Name/dofus/graphics/gapi/controls/jobviewer/JobViewerSkillItem.as
Guardian820/Dofus-client-1.29
e09c7e5fec1fff0d542a16985868fc561aeca02b
[ "MIT" ]
null
null
null
Source Client/By Name/dofus/graphics/gapi/controls/jobviewer/JobViewerSkillItem.as
Guardian820/Dofus-client-1.29
e09c7e5fec1fff0d542a16985868fc561aeca02b
[ "MIT" ]
1
2020-10-07T20:03:49.000Z
2020-10-07T20:03:49.000Z
// Action script... // [Initial MovieClip Action of sprite 20715] #initclip 236 if (!dofus.graphics.gapi.controls.jobviewer.JobViewerSkillItem) { if (!dofus) { _global.dofus = new Object(); } // end if if (!dofus.graphics) { _global.dofus.graphics = new Object(); } // end if if (!dofus.graphics.gapi) { _global.dofus.graphics.gapi = new Object(); } // end if if (!dofus.graphics.gapi.controls) { _global.dofus.graphics.gapi.controls = new Object(); } // end if if (!dofus.graphics.gapi.controls.jobviewer) { _global.dofus.graphics.gapi.controls.jobviewer = new Object(); } // end if var _loc1 = (_global.dofus.graphics.gapi.controls.jobviewer.JobViewerSkillItem = function () { super(); }).prototype; _loc1.__set__list = function (mcList) { this._mcList = mcList; //return (this.list()); }; _loc1.setValue = function (bUsed, sSuggested, oItem) { if (bUsed) { this._mcArrow._visible = true; this._lblSkill.text = oItem.description; this._lblSource.text = oItem.interactiveObject == undefined ? ("") : (oItem.interactiveObject); this._lblSkill.setSize(this._lblSource.width - this._lblSource.textWidth - 15, this.__height); if (oItem.item != undefined) { if (oItem.param1 == oItem.param2) { var _loc5 = "(#4s) #1"; } else { _loc5 = "(#4s) #1{~2 " + this._mcList.gapi.api.lang.getText("TO_RANGE") + " }#2"; } // end else if this._lblQuantity.text = ank.utils.PatternDecoder.getDescription(_loc5, new Array(oItem.param1, oItem.param2, oItem.param3, Math.round(oItem.param4 / 100) / 10)); this._ctrIcon.contentData = oItem.item; } else { var _loc6 = this._parent._parent._parent._parent; var _loc7 = ank.utils.PatternDecoder.combine(this._mcList.gapi.api.lang.getText("SLOT"), "n", oItem.param1 < 2); var _loc8 = "#1 " + _loc7 + " (#2%)"; this._lblQuantity.text = ank.utils.PatternDecoder.getDescription(_loc8, new Array(oItem.param1, oItem.param4)); this._ctrIcon.contentData = undefined; } // end else if } else if (this._lblSource.text != undefined) { this._mcArrow._visible = false; this._lblSource.text = ""; this._lblSkill.text = ""; this._lblQuantity.text = ""; this._ctrIcon.contentData = undefined; } // end else if }; _loc1.init = function () { super.init(false); this._mcArrow._visible = false; this.addToQueue({object: this, method: this.addListeners}); }; _loc1.addListeners = function () { this._ctrIcon.addEventListener("over", this); this._ctrIcon.addEventListener("out", this); }; _loc1.over = function (oEvent) { var _loc3 = oEvent.target.contentData; this._mcList._parent._parent.gapi.showTooltip(_loc3.name, oEvent.target, -20); }; _loc1.out = function (oEvent) { this._mcList._parent._parent.gapi.hideTooltip(); }; _loc1.addProperty("list", function () { }, _loc1.__set__list); ASSetPropFlags(_loc1, null, 1); } // end if #endinitclip
34.841584
178
0.56266
6198987efd66b8f0171c33edaea6b501e22d37af
42,213
as
ActionScript
src/Box2D/Dynamics/b2World.as
ZaaLabs/PushButtonEngine
64ff958d0375de5e7d7ca8f7f1bcb0f88bbe7b04
[ "MIT-0", "MIT" ]
3
2016-01-06T08:59:27.000Z
2021-09-02T03:18:34.000Z
src/Box2D/Dynamics/b2World.as
zerojuan/PushButtonEngine
26130a4bbf578131d4dd94d6c7692d7ccdf0999c
[ "MIT-0", "MIT" ]
null
null
null
src/Box2D/Dynamics/b2World.as
zerojuan/PushButtonEngine
26130a4bbf578131d4dd94d6c7692d7ccdf0999c
[ "MIT-0", "MIT" ]
5
2016-02-19T02:50:54.000Z
2019-07-22T13:58:06.000Z
/* * Copyright (c) 2006-2007 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. */ package Box2D.Dynamics{ import Box2D.Common.Math.*; import Box2D.Common.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Dynamics.Contacts.*; import Box2D.Dynamics.Joints.*; public class b2World { // Construct a world object. /// @param worldAABB a bounding box that completely encompasses all your shapes. /// @param gravity the world gravity vector. /// @param doSleep improve performance by not simulating inactive bodies. public function b2World(worldAABB:b2AABB, gravity:b2Vec2, doSleep:Boolean){ m_destructionListener = null; m_boundaryListener = null; m_contactFilter = b2ContactFilter.b2_defaultFilter; m_contactListener = null; m_debugDraw = null; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_positionCorrection = true; m_warmStarting = true; m_continuousPhysics = true; m_allowSleep = doSleep; m_gravity = gravity; m_lock = false; m_inv_dt0 = 0.0; m_contactManager.m_world = this; //void* mem = b2Alloc(sizeof(b2BroadPhase)); m_broadPhase = new b2BroadPhase(worldAABB, m_contactManager); var bd:b2BodyDef = new b2BodyDef(); m_groundBody = CreateBody(bd); } /// Destruct the world. All physics entities are destroyed and all heap memory is released. //~b2World(); /// Register a destruction listener. public function SetDestructionListener(listener:b2DestructionListener) : void{ m_destructionListener = listener; } /// Register a broad-phase boundary listener. public function SetBoundaryListener(listener:b2BoundaryListener) : void{ m_boundaryListener = listener; } /// Register a contact filter to provide specific control over collision. /// Otherwise the default filter is used (b2_defaultFilter). public function SetContactFilter(filter:b2ContactFilter) : void{ m_contactFilter = filter; } /// Register a contact event listener public function SetContactListener(listener:b2ContactListener) : void{ m_contactListener = listener; } /// Register a routine for debug drawing. The debug draw functions are called /// inside the b2World::Step method, so make sure your renderer is ready to /// consume draw commands when you call Step(). public function SetDebugDraw(debugDraw:b2DebugDraw) : void{ m_debugDraw = debugDraw; } /// Perform validation of internal data structures. public function Validate() : void { m_broadPhase.Validate(); } /// Get the number of broad-phase proxies. public function GetProxyCount() : int { return m_broadPhase.m_proxyCount; } /// Get the number of broad-phase pairs. public function GetPairCount() : int { return m_broadPhase.m_pairManager.m_pairCount; } /// Create a rigid body given a definition. No reference to the definition /// is retained. /// @warning This function is locked during callbacks. public function CreateBody(def:b2BodyDef) : b2Body{ //b2Settings.b2Assert(m_lock == false); if (m_lock == true) { return null; } //void* mem = m_blockAllocator.Allocate(sizeof(b2Body)); var b:b2Body = new b2Body(def, this); // Add to world doubly linked list. b.m_prev = null; b.m_next = m_bodyList; if (m_bodyList) { m_bodyList.m_prev = b; } m_bodyList = b; ++m_bodyCount; return b; } /// Destroy a rigid body given a definition. No reference to the definition /// is retained. This function is locked during callbacks. /// @warning This automatically deletes all associated shapes and joints. /// @warning This function is locked during callbacks. public function DestroyBody(b:b2Body) : void{ //b2Settings.b2Assert(m_bodyCount > 0); //b2Settings.b2Assert(m_lock == false); if (m_lock == true) { return; } // Delete the attached joints. var jn:b2JointEdge = b.m_jointList; while (jn) { var jn0:b2JointEdge = jn; jn = jn.next; if (m_destructionListener) { m_destructionListener.SayGoodbyeJoint(jn0.joint); } DestroyJoint(jn0.joint); } // Delete the attached shapes. This destroys broad-phase // proxies and pairs, leading to the destruction of contacts. var s:b2Shape = b.m_shapeList; while (s) { var s0:b2Shape = s; s = s.m_next; if (m_destructionListener) { m_destructionListener.SayGoodbyeShape(s0); } s0.DestroyProxy(m_broadPhase); b2Shape.Destroy(s0, m_blockAllocator); } // Remove world body list. if (b.m_prev) { b.m_prev.m_next = b.m_next; } if (b.m_next) { b.m_next.m_prev = b.m_prev; } if (b == m_bodyList) { m_bodyList = b.m_next; } --m_bodyCount; //b->~b2Body(); //m_blockAllocator.Free(b, sizeof(b2Body)); } /// Create a joint to constrain bodies together. No reference to the definition /// is retained. This may cause the connected bodies to cease colliding. /// @warning This function is locked during callbacks. public function CreateJoint(def:b2JointDef) : b2Joint{ //b2Settings.b2Assert(m_lock == false); var j:b2Joint = b2Joint.Create(def, m_blockAllocator); // Connect to the world list. j.m_prev = null; j.m_next = m_jointList; if (m_jointList) { m_jointList.m_prev = j; } m_jointList = j; ++m_jointCount; // Connect to the bodies' doubly linked lists. j.m_node1.joint = j; j.m_node1.other = j.m_body2; j.m_node1.prev = null; j.m_node1.next = j.m_body1.m_jointList; if (j.m_body1.m_jointList) j.m_body1.m_jointList.prev = j.m_node1; j.m_body1.m_jointList = j.m_node1; j.m_node2.joint = j; j.m_node2.other = j.m_body1; j.m_node2.prev = null; j.m_node2.next = j.m_body2.m_jointList; if (j.m_body2.m_jointList) j.m_body2.m_jointList.prev = j.m_node2; j.m_body2.m_jointList = j.m_node2; // If the joint prevents collisions, then reset collision filtering. if (def.collideConnected == false) { // Reset the proxies on the body with the minimum number of shapes. var b:b2Body = def.body1.m_shapeCount < def.body2.m_shapeCount ? def.body1 : def.body2; for (var s:b2Shape = b.m_shapeList; s; s = s.m_next) { s.RefilterProxy(m_broadPhase, b.m_xf); } } return j; } /// Destroy a joint. This may cause the connected bodies to begin colliding. /// @warning This function is locked during callbacks. public function DestroyJoint(j:b2Joint) : void{ //b2Settings.b2Assert(m_lock == false); var collideConnected:Boolean = j.m_collideConnected; // Remove from the doubly linked list. if (j.m_prev) { j.m_prev.m_next = j.m_next; } if (j.m_next) { j.m_next.m_prev = j.m_prev; } if (j == m_jointList) { m_jointList = j.m_next; } // Disconnect from island graph. var body1:b2Body = j.m_body1; var body2:b2Body = j.m_body2; // Wake up connected bodies. body1.WakeUp(); body2.WakeUp(); // Remove from body 1. if (j.m_node1.prev) { j.m_node1.prev.next = j.m_node1.next; } if (j.m_node1.next) { j.m_node1.next.prev = j.m_node1.prev; } if (j.m_node1 == body1.m_jointList) { body1.m_jointList = j.m_node1.next; } j.m_node1.prev = null; j.m_node1.next = null; // Remove from body 2 if (j.m_node2.prev) { j.m_node2.prev.next = j.m_node2.next; } if (j.m_node2.next) { j.m_node2.next.prev = j.m_node2.prev; } if (j.m_node2 == body2.m_jointList) { body2.m_jointList = j.m_node2.next; } j.m_node2.prev = null; j.m_node2.next = null; b2Joint.Destroy(j, m_blockAllocator); //b2Settings.b2Assert(m_jointCount > 0); --m_jointCount; // If the joint prevents collisions, then reset collision filtering. if (collideConnected == false) { // Reset the proxies on the body with the minimum number of shapes. var b:b2Body = body1.m_shapeCount < body2.m_shapeCount ? body1 : body2; for (var s:b2Shape = b.m_shapeList; s; s = s.m_next) { s.RefilterProxy(m_broadPhase, b.m_xf); } } } /// Re-filter a shape. This re-runs contact filtering on a shape. public function Refilter(shape:b2Shape) : void { shape.RefilterProxy(m_broadPhase, shape.m_body.m_xf); } /// Enable/disable warm starting. For testing. public function SetWarmStarting(flag: Boolean) : void { m_warmStarting = flag; } /// Enable/disable position correction. For testing. public function SetPositionCorrection(flag: Boolean) : void { m_positionCorrection = flag; } /// Enable/disable continuous physics. For testing. public function SetContinuousPhysics(flag: Boolean) : void { m_continuousPhysics = flag; } /// Get the number of bodies. public function GetBodyCount() : int { return m_bodyCount; } /// Get the number of joints. public function GetJointCount() : int { return m_jointCount; } /// Get the number of contacts (each may have 0 or more contact points). public function GetContactCount() : int { return m_contactCount; } /// Change the global gravity vector. public function SetGravity(gravity: b2Vec2): void { m_gravity = gravity; } /// The world provides a single static ground body with no collision shapes. /// You can use this to simplify the creation of joints and static shapes. public function GetGroundBody() : b2Body{ return m_groundBody; } /// Take a time step. This performs collision detection, integration, /// and constraint solution. /// @param timeStep the amount of time to simulate, this should not vary. /// @param iterations the number of iterations to be used by the constraint solver. public function Step(dt:Number, iterations:int) : void{ m_lock = true; var step:b2TimeStep = new b2TimeStep(); step.dt = dt; step.maxIterations = iterations; if (dt > 0.0) { step.inv_dt = 1.0 / dt; } else { step.inv_dt = 0.0; } step.dtRatio = m_inv_dt0 * dt; step.positionCorrection = m_positionCorrection; step.warmStarting = m_warmStarting; // Update contacts. m_contactManager.Collide(); // Integrate velocities, solve velocity constraints, and integrate positions. if (step.dt > 0.0) { Solve(step); } // Handle TOI events. if (m_continuousPhysics && step.dt > 0.0) { SolveTOI(step); } // Draw debug information. DrawDebugData(); m_inv_dt0 = step.inv_dt; m_lock = false; } /// Query the world for all shapes that potentially overlap the /// provided AABB. You provide a shape pointer buffer of specified /// size. The number of shapes found is returned. /// @param aabb the query box. /// @param shapes a user allocated shape pointer array of size maxCount (or greater). /// @param maxCount the capacity of the shapes array. /// @return the number of shapes found in aabb. public function Query(aabb:b2AABB, shapes:Array, maxCount:int) : int{ //void** results = (void**)m_stackAllocator.Allocate(maxCount * sizeof(void*)); var results:Array = new Array(maxCount); var count:int = m_broadPhase.QueryAABB(aabb, results, maxCount); for (var i:int = 0; i < count; ++i) { shapes[i] = results[i]; } //m_stackAllocator.Free(results); return count; } /// Get the world body list. With the returned body, use b2Body::GetNext to get /// the next body in the world list. A NULL body indicates the end of the list. /// @return the head of the world body list. public function GetBodyList() : b2Body{ return m_bodyList; } /// Get the world joint list. With the returned joint, use b2Joint::GetNext to get /// the next joint in the world list. A NULL joint indicates the end of the list. /// @return the head of the world joint list. public function GetJointList() : b2Joint{ return m_jointList; } //--------------- Internals Below ------------------- // Internal yet public to make life easier. // Find islands, integrate and solve constraints, solve position constraints public function Solve(step:b2TimeStep) : void{ var b:b2Body; m_positionIterationCount = 0; // Size the island for the worst case. var island:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener); // Clear all the island flags. for (b = m_bodyList; b; b = b.m_next) { b.m_flags &= ~b2Body.e_islandFlag; } for (var c:b2Contact = m_contactList; c; c = c.m_next) { c.m_flags &= ~b2Contact.e_islandFlag; } for (var j:b2Joint = m_jointList; j; j = j.m_next) { j.m_islandFlag = false; } // Build and simulate all awake islands. var stackSize:int = m_bodyCount; //b2Body** stack = (b2Body**)m_stackAllocator.Allocate(stackSize * sizeof(b2Body*)); var stack:Array = new Array(stackSize); for (var seed:b2Body = m_bodyList; seed; seed = seed.m_next) { if (seed.m_flags & (b2Body.e_islandFlag | b2Body.e_sleepFlag | b2Body.e_frozenFlag)) { continue; } if (seed.IsStatic()) { continue; } // Reset island and stack. island.Clear(); var stackCount:int = 0; stack[stackCount++] = seed; seed.m_flags |= b2Body.e_islandFlag; // Perform a depth first search (DFS) on the constraint graph. while (stackCount > 0) { // Grab the next body off the stack and add it to the island. b = stack[--stackCount]; island.AddBody(b); // Make sure the body is awake. b.m_flags &= ~b2Body.e_sleepFlag; // To keep islands as small as possible, we don't // propagate islands across static bodies. if (b.IsStatic()) { continue; } var other:b2Body; // Search all contacts connected to this body. for (var cn:b2ContactEdge = b.m_contactList; cn; cn = cn.next) { // Has this contact already been added to an island? if (cn.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag)) { continue; } // Is this contact touching? if (cn.contact.m_manifoldCount == 0) { continue; } island.AddContact(cn.contact); cn.contact.m_flags |= b2Contact.e_islandFlag; //var other:b2Body = cn.other; other = cn.other; // Was the other body already added to this island? if (other.m_flags & b2Body.e_islandFlag) { continue; } //b2Settings.b2Assert(stackCount < stackSize); stack[stackCount++] = other; other.m_flags |= b2Body.e_islandFlag; } // Search all joints connect to this body. for (var jn:b2JointEdge = b.m_jointList; jn; jn = jn.next) { if (jn.joint.m_islandFlag == true) { continue; } island.AddJoint(jn.joint); jn.joint.m_islandFlag = true; //var other:b2Body = jn.other; other = jn.other; if (other.m_flags & b2Body.e_islandFlag) { continue; } //b2Settings.b2Assert(stackCount < stackSize); stack[stackCount++] = other; other.m_flags |= b2Body.e_islandFlag; } } island.Solve(step, m_gravity, m_positionCorrection, m_allowSleep); //m_positionIterationCount = Math.max(m_positionIterationCount, island.m_positionIterationCount); if (island.m_positionIterationCount > m_positionIterationCount) { m_positionIterationCount = island.m_positionIterationCount; } // Post solve cleanup. for (var i:int = 0; i < island.m_bodyCount; ++i) { // Allow static bodies to participate in other islands. b = island.m_bodies[i]; if (b.IsStatic()) { b.m_flags &= ~b2Body.e_islandFlag; } } } //m_stackAllocator.Free(stack); // Synchronize shapes, check for out of range bodies. for (b = m_bodyList; b; b = b.m_next) { if (b.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag)) { continue; } if (b.IsStatic()) { continue; } // Update shapes (for broad-phase). If the shapes go out of // the world AABB then shapes and contacts may be destroyed, // including contacts that are var inRange:Boolean = b.SynchronizeShapes(); // Did the body's shapes leave the world? if (inRange == false && m_boundaryListener != null) { m_boundaryListener.Violation(b); } } // Commit shape proxy movements to the broad-phase so that new contacts are created. // Also, some contacts can be destroyed. m_broadPhase.Commit(); } // Find TOI contacts and solve them. public function SolveTOI(step:b2TimeStep) : void{ var b:b2Body; var s1:b2Shape; var s2:b2Shape; var b1:b2Body; var b2:b2Body; var cn:b2ContactEdge; // Reserve an island and a stack for TOI island solution. var island:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener); var stackSize:int = m_bodyCount; //b2Body** stack = (b2Body**)m_stackAllocator.Allocate(stackSize * sizeof(b2Body*)); var stack:Array = new Array(stackSize); for (b = m_bodyList; b; b = b.m_next) { b.m_flags &= ~b2Body.e_islandFlag; b.m_sweep.t0 = 0.0; } var c:b2Contact; for (c = m_contactList; c; c = c.m_next) { // Invalidate TOI c.m_flags &= ~(b2Contact.e_toiFlag | b2Contact.e_islandFlag); } // Find TOI events and solve them. for (;;) { // Find the first TOI. var minContact:b2Contact = null; var minTOI:Number = 1.0; for (c = m_contactList; c; c = c.m_next) { if (c.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag)) { continue; } // TODO_ERIN keep a counter on the contact, only respond to M TOIs per contact. var toi:Number = 1.0; if (c.m_flags & b2Contact.e_toiFlag) { // This contact has a valid cached TOI. toi = c.m_toi; } else { // Compute the TOI for this contact. s1 = c.m_shape1; s2 = c.m_shape2; b1 = s1.m_body; b2 = s2.m_body; if ((b1.IsStatic() || b1.IsSleeping()) && (b2.IsStatic() || b2.IsSleeping())) { continue; } // Put the sweeps onto the same time interval. var t0:Number = b1.m_sweep.t0; if (b1.m_sweep.t0 < b2.m_sweep.t0) { t0 = b2.m_sweep.t0; b1.m_sweep.Advance(t0); } else if (b2.m_sweep.t0 < b1.m_sweep.t0) { t0 = b1.m_sweep.t0; b2.m_sweep.Advance(t0); } //b2Settings.b2Assert(t0 < 1.0f); // Compute the time of impact. toi = b2TimeOfImpact.TimeOfImpact(c.m_shape1, b1.m_sweep, c.m_shape2, b2.m_sweep); //b2Settings.b2Assert(0.0 <= toi && toi <= 1.0); if (toi > 0.0 && toi < 1.0) { //toi = Math.min((1.0 - toi) * t0 + toi, 1.0); toi = (1.0 - toi) * t0 + toi; if (toi > 1) toi = 1; } c.m_toi = toi; c.m_flags |= b2Contact.e_toiFlag; } if (Number.MIN_VALUE < toi && toi < minTOI) { // This is the minimum TOI found so far. minContact = c; minTOI = toi; } } if (minContact == null || 1.0 - 100.0 * Number.MIN_VALUE < minTOI) { // No more TOI events. Done! break; } // Advance the bodies to the TOI. s1 = minContact.m_shape1; s2 = minContact.m_shape2; b1 = s1.m_body; b2 = s2.m_body; b1.Advance(minTOI); b2.Advance(minTOI); // The TOI contact likely has some new contact points. minContact.Update(m_contactListener); minContact.m_flags &= ~b2Contact.e_toiFlag; if (minContact.m_manifoldCount == 0) { // This shouldn't happen. Numerical error? //b2Assert(false); continue; } // Build the TOI island. We need a dynamic seed. var seed:b2Body = b1; if (seed.IsStatic()) { seed = b2; } // Reset island and stack. island.Clear(); var stackCount:int = 0; stack[stackCount++] = seed; seed.m_flags |= b2Body.e_islandFlag; // Perform a depth first search (DFS) on the contact graph. while (stackCount > 0) { // Grab the next body off the stack and add it to the island. b = stack[--stackCount]; island.AddBody(b); // Make sure the body is awake. b.m_flags &= ~b2Body.e_sleepFlag; // To keep islands as small as possible, we don't // propagate islands across static bodies. if (b.IsStatic()) { continue; } // Search all contacts connected to this body. for (cn = b.m_contactList; cn; cn = cn.next) { // Does the TOI island still have space for contacts? if (island.m_contactCount == island.m_contactCapacity) { continue; } // Has this contact already been added to an island? Skip slow or non-solid contacts. if (cn.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag)) { continue; } // Is this contact touching? For performance we are not updating this contact. if (cn.contact.m_manifoldCount == 0) { continue; } island.AddContact(cn.contact); cn.contact.m_flags |= b2Contact.e_islandFlag; // Update other body. var other:b2Body = cn.other; // Was the other body already added to this island? if (other.m_flags & b2Body.e_islandFlag) { continue; } // March forward, this can do no harm since this is the min TOI. if (other.IsStatic() == false) { other.Advance(minTOI); other.WakeUp(); } //b2Settings.b2Assert(stackCount < stackSize); stack[stackCount++] = other; other.m_flags |= b2Body.e_islandFlag; } } var subStep:b2TimeStep = new b2TimeStep(); subStep.dt = (1.0 - minTOI) * step.dt; //b2Settings.b2Assert(subStep.dt > Number.MIN_VALUE); subStep.inv_dt = 1.0 / subStep.dt; subStep.maxIterations = step.maxIterations; island.SolveTOI(subStep); var i:int; // Post solve cleanup. for (i = 0; i < island.m_bodyCount; ++i) { // Allow bodies to participate in future TOI islands. b = island.m_bodies[i]; b.m_flags &= ~b2Body.e_islandFlag; if (b.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag)) { continue; } if (b.IsStatic()) { continue; } // Update shapes (for broad-phase). If the shapes go out of // the world AABB then shapes and contacts may be destroyed, // including contacts that are var inRange:Boolean = b.SynchronizeShapes(); // Did the body's shapes leave the world? if (inRange == false && m_boundaryListener != null) { m_boundaryListener.Violation(b); } // Invalidate all contact TOIs associated with this body. Some of these // may not be in the island because they were not touching. for (cn = b.m_contactList; cn; cn = cn.next) { cn.contact.m_flags &= ~b2Contact.e_toiFlag; } } for (i = 0; i < island.m_contactCount; ++i) { // Allow contacts to participate in future TOI islands. c = island.m_contacts[i]; c.m_flags &= ~(b2Contact.e_toiFlag | b2Contact.e_islandFlag); } // Commit shape proxy movements to the broad-phase so that new contacts are created. // Also, some contacts can be destroyed. m_broadPhase.Commit(); } //m_stackAllocator.Free(stack); } static private var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8); // public function DrawJoint(joint:b2Joint) : void{ var b1:b2Body = joint.m_body1; var b2:b2Body = joint.m_body2; var xf1:b2XForm = b1.m_xf; var xf2:b2XForm = b2.m_xf; var x1:b2Vec2 = xf1.position; var x2:b2Vec2 = xf2.position; var p1:b2Vec2 = joint.GetAnchor1(); var p2:b2Vec2 = joint.GetAnchor2(); //b2Color color(0.5f, 0.8f, 0.8f); var color:b2Color = s_jointColor; switch (joint.m_type) { case b2Joint.e_distanceJoint: m_debugDraw.DrawSegment(p1, p2, color); break; case b2Joint.e_pulleyJoint: { var pulley:b2PulleyJoint = (joint as b2PulleyJoint); var s1:b2Vec2 = pulley.GetGroundAnchor1(); var s2:b2Vec2 = pulley.GetGroundAnchor2(); m_debugDraw.DrawSegment(s1, p1, color); m_debugDraw.DrawSegment(s2, p2, color); m_debugDraw.DrawSegment(s1, s2, color); } break; case b2Joint.e_mouseJoint: m_debugDraw.DrawSegment(p1, p2, color); break; default: if (b1 != m_groundBody) m_debugDraw.DrawSegment(x1, p1, color); m_debugDraw.DrawSegment(p1, p2, color); if (b2 != m_groundBody) m_debugDraw.DrawSegment(x2, p2, color); } } static private var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6); public function DrawShape(shape:b2Shape, xf:b2XForm, color:b2Color, core:Boolean) : void{ var coreColor:b2Color = s_coreColor; switch (shape.m_type) { case b2Shape.e_circleShape: { var circle:b2CircleShape = (shape as b2CircleShape); var center:b2Vec2 = b2Math.b2MulX(xf, circle.m_localPosition); var radius:Number = circle.m_radius; var axis:b2Vec2 = xf.R.col1; m_debugDraw.DrawSolidCircle(center, radius, axis, color); if (core) { m_debugDraw.DrawCircle(center, radius - b2Settings.b2_toiSlop, coreColor); } } break; case b2Shape.e_polygonShape: { var i:int; var poly:b2PolygonShape = (shape as b2PolygonShape); var vertexCount:int = poly.GetVertexCount(); var localVertices:Array = poly.GetVertices(); //b2Assert(vertexCount <= b2_maxPolygonVertices); var vertices:Array = new Array(b2Settings.b2_maxPolygonVertices); for (i = 0; i < vertexCount; ++i) { vertices[i] = b2Math.b2MulX(xf, localVertices[i]); } m_debugDraw.DrawSolidPolygon(vertices, vertexCount, color); if (core) { var localCoreVertices:Array = poly.GetCoreVertices(); for (i = 0; i < vertexCount; ++i) { vertices[i] = b2Math.b2MulX(xf, localCoreVertices[i]); } m_debugDraw.DrawPolygon(vertices, vertexCount, coreColor); } } break; } } static private var s_xf:b2XForm = new b2XForm(); public function DrawDebugData() : void{ if (m_debugDraw == null) { return; } m_debugDraw.m_sprite.graphics.clear(); var flags:uint = m_debugDraw.GetFlags(); var i:int; var b:b2Body; var s:b2Shape; var j:b2Joint; var bp:b2BroadPhase; var invQ:b2Vec2 = new b2Vec2; var x1:b2Vec2 = new b2Vec2; var x2:b2Vec2 = new b2Vec2; var color:b2Color = new b2Color(0,0,0); var xf:b2XForm; var b1:b2AABB = new b2AABB(); var b2:b2AABB = new b2AABB(); var vs:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()]; if (flags & b2DebugDraw.e_shapeBit) { var core:Boolean = (flags & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit; for (b = m_bodyList; b; b = b.m_next) { xf = b.m_xf; for (s = b.GetShapeList(); s; s = s.m_next) { if (b.IsStatic()) { DrawShape(s, xf, new b2Color(0.5, 0.9, 0.5), core); } else if (b.IsSleeping()) { DrawShape(s, xf, new b2Color(0.5, 0.5, 0.9), core); } else { DrawShape(s, xf, new b2Color(0.9, 0.9, 0.9), core); } } } } if (flags & b2DebugDraw.e_jointBit) { for (j = m_jointList; j; j = j.m_next) { //if (j.m_type != b2Joint.e_mouseJoint) //{ DrawJoint(j); //} } } if (flags & b2DebugDraw.e_pairBit) { bp = m_broadPhase; //b2Vec2 invQ; invQ.Set(1.0 / bp.m_quantizationFactor.x, 1.0 / bp.m_quantizationFactor.y); //b2Color color(0.9f, 0.9f, 0.3f); color.Set(0.9, 0.9, 0.3); for (i = 0; i < b2Pair.b2_tableCapacity; ++i) { var index:uint = bp.m_pairManager.m_hashTable[i]; while (index != b2Pair.b2_nullPair) { var pair:b2Pair = bp.m_pairManager.m_pairs[ index ]; var p1:b2Proxy = bp.m_proxyPool[ pair.proxyId1 ]; var p2:b2Proxy = bp.m_proxyPool[ pair.proxyId2 ]; //b2AABB b1, b2; b1.lowerBound.x = bp.m_worldAABB.lowerBound.x + invQ.x * bp.m_bounds[0][p1.lowerBounds[0]].value; b1.lowerBound.y = bp.m_worldAABB.lowerBound.y + invQ.y * bp.m_bounds[1][p1.lowerBounds[1]].value; b1.upperBound.x = bp.m_worldAABB.lowerBound.x + invQ.x * bp.m_bounds[0][p1.upperBounds[0]].value; b1.upperBound.y = bp.m_worldAABB.lowerBound.y + invQ.y * bp.m_bounds[1][p1.upperBounds[1]].value; b2.lowerBound.x = bp.m_worldAABB.lowerBound.x + invQ.x * bp.m_bounds[0][p2.lowerBounds[0]].value; b2.lowerBound.y = bp.m_worldAABB.lowerBound.y + invQ.y * bp.m_bounds[1][p2.lowerBounds[1]].value; b2.upperBound.x = bp.m_worldAABB.lowerBound.x + invQ.x * bp.m_bounds[0][p2.upperBounds[0]].value; b2.upperBound.y = bp.m_worldAABB.lowerBound.y + invQ.y * bp.m_bounds[1][p2.upperBounds[1]].value; //b2Vec2 x1 = 0.5f * (b1.lowerBound + b1.upperBound); x1.x = 0.5 * (b1.lowerBound.x + b1.upperBound.x); x1.y = 0.5 * (b1.lowerBound.y + b1.upperBound.y); //b2Vec2 x2 = 0.5f * (b2.lowerBound + b2.upperBound); x2.x = 0.5 * (b2.lowerBound.x + b2.upperBound.x); x2.y = 0.5 * (b2.lowerBound.y + b2.upperBound.y); m_debugDraw.DrawSegment(x1, x2, color); index = pair.next; } } } if (flags & b2DebugDraw.e_aabbBit) { bp = m_broadPhase; var worldLower:b2Vec2 = bp.m_worldAABB.lowerBound; var worldUpper:b2Vec2 = bp.m_worldAABB.upperBound; //b2Vec2 invQ; invQ.Set(1.0 / bp.m_quantizationFactor.x, 1.0 / bp.m_quantizationFactor.y); //b2Color color(0.9f, 0.3f, 0.9f); color.Set(0.9, 0.3, 0.9); for (i = 0; i < b2Settings.b2_maxProxies; ++i) { var p:b2Proxy = bp.m_proxyPool[ i]; if (p.IsValid() == false) { continue; } //b2AABB b1; b1.lowerBound.x = worldLower.x + invQ.x * bp.m_bounds[0][p.lowerBounds[0]].value; b1.lowerBound.y = worldLower.y + invQ.y * bp.m_bounds[1][p.lowerBounds[1]].value; b1.upperBound.x = worldLower.x + invQ.x * bp.m_bounds[0][p.upperBounds[0]].value; b1.upperBound.y = worldLower.y + invQ.y * bp.m_bounds[1][p.upperBounds[1]].value; //b2Vec2 vs[4]; vs[0].Set(b1.lowerBound.x, b1.lowerBound.y); vs[1].Set(b1.upperBound.x, b1.lowerBound.y); vs[2].Set(b1.upperBound.x, b1.upperBound.y); vs[3].Set(b1.lowerBound.x, b1.upperBound.y); m_debugDraw.DrawPolygon(vs, 4, color); } //b2Vec2 vs[4]; vs[0].Set(worldLower.x, worldLower.y); vs[1].Set(worldUpper.x, worldLower.y); vs[2].Set(worldUpper.x, worldUpper.y); vs[3].Set(worldLower.x, worldUpper.y); m_debugDraw.DrawPolygon(vs, 4, new b2Color(0.3, 0.9, 0.9)); } if (flags & b2DebugDraw.e_obbBit) { //b2Color color(0.5f, 0.3f, 0.5f); color.Set(0.5, 0.3, 0.5); for (b = m_bodyList; b; b = b.m_next) { xf = b.m_xf; for (s = b.GetShapeList(); s; s = s.m_next) { if (s.m_type != b2Shape.e_polygonShape) { continue; } var poly:b2PolygonShape = (s as b2PolygonShape); var obb:b2OBB = poly.GetOBB(); var h:b2Vec2 = obb.extents; //b2Vec2 vs[4]; vs[0].Set(-h.x, -h.y); vs[1].Set( h.x, -h.y); vs[2].Set( h.x, h.y); vs[3].Set(-h.x, h.y); for (i = 0; i < 4; ++i) { //vs[i] = obb.center + b2Mul(obb.R, vs[i]); var tMat:b2Mat22 = obb.R; var tVec:b2Vec2 = vs[i]; var tX:Number; tX = obb.center.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y); vs[i].y = obb.center.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y); vs[i].x = tX; //vs[i] = b2Mul(xf, vs[i]); tMat = xf.R; tX = xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y); vs[i].y = xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y); vs[i].x = tX; } m_debugDraw.DrawPolygon(vs, 4, color); } } } if (flags & b2DebugDraw.e_centerOfMassBit) { for (b = m_bodyList; b; b = b.m_next) { xf = s_xf; xf.R = b.m_xf.R; xf.position = b.GetWorldCenter(); m_debugDraw.DrawXForm(xf); } } } public var m_blockAllocator:*; public var m_stackAllocator:*; public var m_lock:Boolean; public var m_broadPhase:b2BroadPhase; public var m_contactManager:b2ContactManager = new b2ContactManager(); public var m_bodyList:b2Body; public var m_jointList:b2Joint; // Do not access public var m_contactList:b2Contact; public var m_bodyCount:int; public var m_contactCount:int; public var m_jointCount:int; public var m_gravity:b2Vec2; public var m_allowSleep:Boolean; public var m_groundBody:b2Body; public var m_destructionListener:b2DestructionListener; public var m_boundaryListener:b2BoundaryListener; public var m_contactFilter:b2ContactFilter; public var m_contactListener:b2ContactListener; public var m_debugDraw:b2DebugDraw; public var m_inv_dt0:Number; public var m_positionIterationCount:int; // This is for debugging the solver. static public var m_positionCorrection:Boolean; // This is for debugging the solver. static public var m_warmStarting:Boolean; // This is for debugging the solver. static public var m_continuousPhysics:Boolean; }; }
33.108235
134
0.521474
f9ab9920839cc3ff34d55f54ad1696914322992a
8,477
as
ActionScript
bin/Data/AngelScript/Ingame/LocalSceneManager.as
frobino/urho3d-simple-multiplayer-shooter
4397c58dfce15dff7d182787f0b2415e746405b7
[ "MIT" ]
4
2016-11-05T12:59:20.000Z
2021-01-17T00:03:09.000Z
bin/Data/AngelScript/Ingame/LocalSceneManager.as
frobino/urho3d-simple-multiplayer-shooter
4397c58dfce15dff7d182787f0b2415e746405b7
[ "MIT" ]
null
null
null
bin/Data/AngelScript/Ingame/LocalSceneManager.as
frobino/urho3d-simple-multiplayer-shooter
4397c58dfce15dff7d182787f0b2415e746405b7
[ "MIT" ]
2
2020-07-06T09:00:13.000Z
2021-10-01T17:14:13.000Z
namespace Ingame { class LocalSceneManager { protected Node @cameraNode_; protected Node @playerNode_; protected Array <Node @> otherPlayersNodes_; protected void CreateLocals () { Array <Node @> nodes = SharedGlobals::syncedGameScene.GetChildren (true); for (int index = 0; index < nodes.length; index++) { Node @childNode = nodes [index]; if (childNode.id < FIRST_LOCAL_ID and childNode.GetChild ("local") is null) CreateLocalFor (childNode); } } protected void CreateLocalFor (Node @replicatedNode) { int nodeLocalType = replicatedNode.vars [SerializationConstants__OBJECT_TYPE_VAR_HASH].GetInt (); Node @localNode = replicatedNode.CreateChild ("local", LOCAL); if (nodeLocalType == SerializationConstants__OBJECT_TYPE_TERRAIN) localNode.LoadXML ((cast <XMLFile> (cache.GetResource ("XMLFile", SceneConstants__TERRAIN_LOCAL_PREFAB))). GetRoot ()); else if (nodeLocalType == SerializationConstants__OBJECT_TYPE_OBSTACLE) localNode.LoadXML ((cast <XMLFile> (cache.GetResource ("XMLFile", SceneConstants__OBSTACLE_LOCAL_PREFAB))). GetRoot ()); else if (nodeLocalType == SerializationConstants__OBJECT_TYPE_PLAYER) localNode.LoadXML ((cast <XMLFile> (cache.GetResource ("XMLFile", SceneConstants__PLAYER_LOCAL_PREFAB))). GetRoot ()); else if (nodeLocalType == SerializationConstants__OBJECT_TYPE_SHELL) localNode.LoadXML ((cast <XMLFile> (cache.GetResource ("XMLFile", SceneConstants__SHELL_LOCAL_PREFAB))). GetRoot ()); else if (nodeLocalType == SerializationConstants__OBJECT_TYPE_EXPLOSSION) localNode.LoadXML ((cast <XMLFile> (cache.GetResource ("XMLFile", SceneConstants__EXPLOSSION_LOCAL_PREFAB))). GetRoot ());; // Physics will be calculated on server localNode.RemoveComponents ("RigidBody"); localNode.RemoveComponents ("CollsionShape"); // Scripts are server-only too! localNode.RemoveComponents ("ScriptInstance"); localNode.name = "local"; } protected void CreateCamera () { cameraNode_ = SharedGlobals::syncedGameScene.CreateChild ("camera", LOCAL); cameraNode_.CreateComponent ("SoundListener", LOCAL); Camera @camera = cameraNode_.CreateComponent ("Camera", LOCAL); camera.farClip = 75.0f; }; protected void CreateZone () { Node @zoneNode = SharedGlobals::syncedGameScene.CreateChild ("zone", LOCAL); zoneNode.LoadXML (cast <XMLFile> ( cache.GetResource ("XMLFile", "Objects/zone_for_players.xml")). GetRoot ()); } protected void SetupViewport () { Viewport @viewport = Viewport (SharedGlobals::syncedGameScene, cameraNode_.GetComponent ("Camera")); renderer.viewports [0] = viewport; } protected void ScanForOtherPlayers () { otherPlayersNodes_.Clear (); Array <Node @> nodes = SharedGlobals::syncedGameScene.GetChildren (true); for (int index = 0; index < nodes.length; index++) { Node @otherPlayerNode = nodes [index]; // Is it node of any player? Isn't it node of our player? if (otherPlayerNode.id < FIRST_LOCAL_ID and otherPlayerNode.vars [SerializationConstants__OBJECT_TYPE_VAR_HASH].GetInt () == SerializationConstants__OBJECT_TYPE_PLAYER and otherPlayerNode !is playerNode_) { Camera @camera = cameraNode_.GetComponent ("Camera"); // It's not too far? if ((otherPlayerNode.position - cameraNode_.position).length < camera.farClip) { Vector2 screenPosition = camera.WorldToScreenPoint (otherPlayerNode.position); // Is it inside screen? if (screenPosition.x > 0.0f and screenPosition.x < 1.0f and screenPosition.y > 0.0f and screenPosition.y < 1.0f) { Octree @octree = SharedGlobals::syncedGameScene.GetComponent ("Octree"); Ray ray = camera.GetScreenRay (screenPosition.x, screenPosition.y); RayQueryResult result = octree.RaycastSingle (ray, RAY_TRIANGLE, camera.farClip, DRAWABLE_GEOMETRY); // Is other player visible? if (result.node.parent.parent is otherPlayerNode) otherPlayersNodes_.Push (otherPlayerNode); } } } } } LocalSceneManager () { } ~LocalSceneManager () { } void Setup () { CreateLocals (); CreateZone (); CreateCamera (); SetupViewport (); cameraNode_.position = Vector3 (0, 40, 0); cameraNode_.rotation = Quaternion (90, 0, 0); } void Update (float timeStep) { // Creates locals for new objects (old have "local" child and will not be affected). CreateLocals (); ScanForOtherPlayers (); if (playerNode_ !is null) { cameraNode_.position = playerNode_.LocalToWorld (Vector3 (0, 2.5f, -8)); cameraNode_.LookAt (playerNode_.position); } if (playerNode_ !is null and get_playerLives () < 0.0f) { playerNode_ = null; stateUi.isSpawned_ = false; } } void Clear () { } Node @get_playerNode () { return playerNode_; } uint get_playerNodeId () { if (playerNode_ !is null) return playerNode_.id; else return 0; } void set_playerNodeId (uint id) { Array <Node @>nodes = SharedGlobals::syncedGameScene.GetChildren (true); for (int index = 0; index < nodes.length; index++) { Node @scanningNode = nodes [index]; if (scanningNode.id == id) { playerNode_ = scanningNode; return; } } } float get_playerLives () { if (playerNode_ !is null) return playerNode_.vars [SerializationConstants__HEALTH_VAR_HASH].GetFloat (); else return -1; } int get_playerExp () { if (playerNode_ !is null) return playerNode_.vars [SerializationConstants__EXP_VAR_HASH].GetInt (); else return 0; } Node @get_cameraNode () { return cameraNode_; } Array <Node @> get_otherPlayersNodes () { return otherPlayersNodes_; } }; }
39.24537
114
0.473045
d454b0dcd40d9e9a42cdefb6d735801423eaa14b
6,470
as
ActionScript
src/otlib/utils/FrameDurationsOptimizer.as
EPuncker/ObjectBuilder
9590bb2f808be5f748b1cc7c8ad2296d124aa647
[ "MIT" ]
null
null
null
src/otlib/utils/FrameDurationsOptimizer.as
EPuncker/ObjectBuilder
9590bb2f808be5f748b1cc7c8ad2296d124aa647
[ "MIT" ]
null
null
null
src/otlib/utils/FrameDurationsOptimizer.as
EPuncker/ObjectBuilder
9590bb2f808be5f748b1cc7c8ad2296d124aa647
[ "MIT" ]
1
2018-08-14T00:55:49.000Z
2018-08-14T00:55:49.000Z
/* * Copyright (c) 2014-2022 Object Builder <https://github.com/ottools/ObjectBuilder> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package otlib.utils { import flash.events.Event; import flash.events.EventDispatcher; import flash.utils.Dictionary; import nail.errors.NullArgumentError; import ob.commands.ProgressBarID; import otlib.core.otlib_internal; import otlib.events.ProgressEvent; import otlib.resources.Resources; import otlib.sprites.Sprite; import otlib.sprites.SpriteStorage; import otlib.things.ThingType; import otlib.things.ThingTypeStorage; import otlib.animation.FrameGroup; import otlib.things.FrameGroupType; import otlib.animation.FrameDuration; use namespace otlib_internal; [Event(name="progress", type="otlib.events.ProgressEvent")] [Event(name="complete", type="flash.events.Event")] public class FrameDurationsOptimizer extends EventDispatcher { //-------------------------------------------------------------------------- // PROPERTIES //-------------------------------------------------------------------------- private var m_objects:ThingTypeStorage; private var m_finished:Boolean; private var m_itemsEnabled:Boolean; private var m_itemsMinimumDuration:uint; private var m_itemsMaximumDuration:uint; private var m_outfitsEnabled:Boolean; private var m_outfitsMinimumDuration:uint; private var m_outfitsMaximumDuration:uint; private var m_effectsEnabled:Boolean; private var m_effectsMinimumDuration:uint; private var m_effectsMaximumDuration:uint; //-------------------------------------------------------------------------- // CONSTRUCTOR //-------------------------------------------------------------------------- public function FrameDurationsOptimizer(objects:ThingTypeStorage, items:Boolean, itemsMinimumDuration:uint, itemsMaximumDuration:uint, outfits:Boolean, outfitsMinimumDuration:uint, outfitsMaximumDuration:uint, effects:Boolean, effectsMinimumDuration:uint, effectsMaximumDuration:uint) { if (!objects) throw new NullArgumentError("objects"); m_objects = objects; m_itemsEnabled = items; m_itemsMinimumDuration = itemsMinimumDuration; m_itemsMaximumDuration = itemsMaximumDuration; m_outfitsEnabled = outfits; m_outfitsMinimumDuration = outfitsMinimumDuration; m_outfitsMaximumDuration = outfitsMaximumDuration; m_effectsEnabled = effects; m_effectsMinimumDuration = effectsMinimumDuration; m_effectsMaximumDuration = effectsMaximumDuration; } //-------------------------------------------------------------------------- // METHODS //-------------------------------------------------------------------------- //-------------------------------------- // Public //-------------------------------------- public function start():void { if (m_finished) return; var steps:uint = 5; var step:uint = 0; dispatchProgress(step++, steps, Resources.getString("startingTheOptimization")); dispatchProgress(step++, steps, Resources.getString("changingDurationsInItems")); if (m_itemsEnabled) changeFrameDurations(m_objects.items, m_itemsMinimumDuration, m_itemsMaximumDuration) dispatchProgress(step++, steps, Resources.getString("changingDurationsInOutfits")); if (m_outfitsEnabled) changeFrameDurations(m_objects.outfits, m_outfitsMinimumDuration, m_outfitsMaximumDuration) dispatchProgress(step++, steps, Resources.getString("changingDurationsInEffects")); if (m_effectsEnabled) changeFrameDurations(m_objects.effects, m_effectsMinimumDuration, m_effectsMaximumDuration) m_finished = true; dispatchEvent(new Event(Event.COMPLETE)); } private function changeFrameDurations(list:Dictionary, minimum:uint, maximum:uint):void { for each (var thing:ThingType in list) { for (var groupType:uint = FrameGroupType.DEFAULT; groupType <= FrameGroupType.WALKING; groupType++) { var frameGroup:FrameGroup = thing.getFrameGroup(groupType); if(!frameGroup || !frameGroup.frameDurations) continue; for (var frame:uint = 0; frame < frameGroup.frames; frame++) { var duration:FrameDuration = frameGroup.getFrameDuration(frame); if (duration) { duration.minimum = minimum; duration.maximum = maximum; frameGroup.frameDurations[frame] = duration.clone(); } } } } } private function dispatchProgress(current:uint, target:uint, label:String):void { dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, ProgressBarID.FIND, current, target, label)); } } }
41.741935
146
0.598918
b2a8983b3208346525062e4c0c7548c5130225c8
1,031
as
ActionScript
kag2d/Mods/ZFM+1.6.7f/Rules/SpawnMigrants.as
agalera/kag2d_zfm-
3c3e81e24d7d6de229df994110fc044e05758411
[ "curl" ]
null
null
null
kag2d/Mods/ZFM+1.6.7f/Rules/SpawnMigrants.as
agalera/kag2d_zfm-
3c3e81e24d7d6de229df994110fc044e05758411
[ "curl" ]
null
null
null
kag2d/Mods/ZFM+1.6.7f/Rules/SpawnMigrants.as
agalera/kag2d_zfm-
3c3e81e24d7d6de229df994110fc044e05758411
[ "curl" ]
null
null
null
#define SERVER_ONLY const string migrant_name = "migrantbot"; void onTick(CRules@ this) { if (getGameTime() %29 != 0) return; //if (XORRandom(512) < 256) return; //50% chance of actually doing anything CMap@ map = getMap(); if (map is null || map.tilemapwidth < 2) return; //failed to load map? CBlob@[] migrant; int max_migrantbots = this.get_s32("max_migrantbots"); getBlobsByTag("migrantbot", @migrant ); if (migrant.length < max_migrantbots && map.getDayTime()>0.4 && map.getDayTime()<0.6) { f32 x = XORRandom(2) == 0 ? 32.0f : map.tilemapwidth * map.tilesize - 32.0f; Vec2f top = Vec2f(x, map.tilesize); Vec2f bottom = Vec2f(x, map.tilemapheight * map.tilesize); Vec2f end; if (map.rayCastSolid(top, bottom, end)) { f32 y = end.y; int i = 0; while (i ++ < 3) { Vec2f pos = Vec2f(x, y - i * map.tilesize); //if (!map.isInWater(pos)) { server_CreateBlob("migrantbot", 0, pos); // Sound::Play("MigrantSayHello.ogg", pos, 1.0f, 1.5f); break; } } } } }
24.547619
86
0.624636
7a0b24d159687aa2520441dfd0b3361ae8b37f96
7,396
as
ActionScript
common-snapshot/src/com/neopets/games/inhouse/SuperSearch/SuperSearch_GameScreen.as
vikiana/ShenkuuWarriorII
cd734d339b6237675f20ac0ab0b3726967bb0a49
[ "MIT" ]
1
2021-06-23T08:53:53.000Z
2021-06-23T08:53:53.000Z
common-snapshot/src/com/neopets/games/inhouse/SuperSearch/SuperSearch_GameScreen.as
vikiana/ShenkuuWarriorII
cd734d339b6237675f20ac0ab0b3726967bb0a49
[ "MIT" ]
null
null
null
common-snapshot/src/com/neopets/games/inhouse/SuperSearch/SuperSearch_GameScreen.as
vikiana/ShenkuuWarriorII
cd734d339b6237675f20ac0ab0b3726967bb0a49
[ "MIT" ]
null
null
null
 /* AS3 Copyright 2008 */ package com.neopets.games.inhouse.SuperSearch { import flash.display.MovieClip; import flash.text.TextField; import flash.events.Event; import com.neopets.projects.gameEngine.gui.Interface.GameScreen; import com.neopets.projects.gameEngine.gui.MenuManager; import com.neopets.util.events.CustomEvent; import com.neopets.util.managers.ScoreManager; import com.neopets.projects.np9.system.NP9_Evar; import com.neopets.games.inhouse.SuperSearch.classes.SuperSearchPlayer; import com.neopets.games.inhouse.SuperSearch.classes.EndOfLevelPrompt; import com.neopets.games.inhouse.SuperSearch.classes.util.keyboard.KeyboardManager; /** * This class is an extension of the basic game screen to allow for dispatcher variables. * * @langversion ActionScript 3.0 * @playerversion Flash 9.0 * @NP9 Game System * * @author David Cary * @since 3.10.2010 */ public class SuperSearch_GameScreen extends GameScreen { //-------------------------------------- // CLASS CONSTANTS //-------------------------------------- public static const GAME_STARTED:String = "game_started"; public static const RESTART_LEVEL:String = "restart_level"; public static const GAME_OVER:String = "game_over"; public static const ITEM_NEEDED:String = "GameScreen_requests_item"; public static const LEVEL_CLEARED:String = "level_cleared"; public static const CLEAR_PROMPT:String = "clear_prompt"; public static const NEXT_LEVEL:String = "next_level"; public static const SCORE_CHANGED:String = "score_changed"; //-------------------------------------- // VARIABLES //-------------------------------------- protected var _livesVar:NP9_Evar; protected var _levelVar:NP9_Evar; protected var _itemsVar:NP9_Evar; protected var _levelDeathsVar:NP9_Evar; // player deaths this level //-------------------------------------- // CONSTRUCTOR //-------------------------------------- /** * @Constructor */ public function SuperSearch_GameScreen():void { super(); // initialize variables _livesVar = new NP9_Evar(0); _levelVar = new NP9_Evar(0); _itemsVar = new NP9_Evar(0); _levelDeathsVar = new NP9_Evar(0); // add listeners to menu manager var menus:MenuManager = MenuManager.instance; menus.addEventListener(menus.MENU_NAVIGATION_EVENT,onMenuNavigation); // set up the keyboard listeners when we're added to the stage addEventListener(Event.ADDED_TO_STAGE,onAdded); addEventListener(Event.REMOVED_FROM_STAGE,onRemoved); addEventListener(SuperSearchPlayer.LIFE_LOST,onPlayerDeath); addEventListener(SuperSearchPlayer.ITEM_COLLECTED,onItemCollected); addEventListener(EndOfLevelPrompt.PROMPT_CLEARED,onLevelPromptDone); } //-------------------------------------- // GETTER/SETTERS //-------------------------------------- public function get itemsNeeded():int { return int(Number(_itemsVar.show())); } public function get levelNumber():int { return int(Number(_levelVar.show())); } public function get livesNumber():int { return int(Number(_livesVar.show())); } public function get perfectBonus():int { // only return a "perfect game" bonus if there are no deaths. if(Number(_levelDeathsVar.show()) <= 0) { return 5 * numItemsForLevel(levelNumber); } return 0; } //-------------------------------------- // PUBLIC METHODS //-------------------------------------- // Use these functions to change the score and let listeners know. public function changeScoreBy(val:Number):void { var score_manager:ScoreManager = ScoreManager.instance; score_manager.changeScore(val); dispatchEvent(new Event(SCORE_CHANGED)); } public function changeScoreTo(val:Number):void { var score_manager:ScoreManager = ScoreManager.instance; score_manager.changeScoreTo(val); dispatchEvent(new Event(SCORE_CHANGED)); } // Use this function to calculate the number of items needed to complete the target level. public function numItemsForLevel(lvl_num:int):int { return 4 * lvl_num; } //-------------------------------------- // EVENT HANDLERS //-------------------------------------- // When added to stage, set up our keyboard listener. protected function onAdded(ev:Event) { if(ev.target == this) { // set up keyboard manager var keys:KeyboardManager = KeyboardManager.instance; keys.eventSource = stage; // remove listeners removeEventListener(Event.ADDED_TO_STAGE,onAdded); } } // When an item is collected, update the number of items still needed. protected function onItemCollected(ev:Event) { // update our score changeScoreBy(25); // check if we still have items needed _itemsVar.changeBy(-1); var items_left:Number = Number(_itemsVar.show()); if(items_left > 0) { dispatchEvent(new Event(ITEM_NEEDED)); } else { // apply "perfect" bonus, if any changeScoreBy(perfectBonus); // let listeners know the level was cleared dispatchEvent(new Event(LEVEL_CLEARED)); } } // When the level prompt clears, start up the next level. protected function onLevelPromptDone(ev:Event) { trace("ON LEVEL PROMPT DONE"); // update level number _levelVar.changeBy(1); // update items needed to clear the level var level_num:int = int(Number(_levelVar.show())); _itemsVar.changeTo(numItemsForLevel(level_num)); // reset deaths this level _levelDeathsVar.changeTo(0); // let listeners know the new level is ready dispatchEvent(new Event(NEXT_LEVEL)); } // When menu navigation happens check if we've moved to this menu. protected function onMenuNavigation(ev:CustomEvent) { var nav_id:String = ev.oData.MENU; if(nav_id == mID) { trace("NAV TO GAME SCREEN?"); changeScoreTo(0); _livesVar.changeTo(3); _levelVar.changeTo(1); _itemsVar.changeTo(numItemsForLevel(1)); _levelDeathsVar.changeTo(0); dispatchEvent(new Event(GAME_STARTED)); } else { dispatchEvent(new Event(CLEAR_PROMPT)); dispatchEvent(new Event(GAME_OVER)); } } // When the player loses a life, check for game over. protected function onPlayerDeath(ev:Event) { _livesVar.changeBy(-1); _levelDeathsVar.changeBy(1); if(_livesVar.show() > 0) { dispatchEvent(new Event(RESTART_LEVEL)); } else gameOver(); } // When taken off stage, clear all listeners. protected function onRemoved(ev:Event) { trace("ON REMOVED"); if(ev.target == this) { // remove listeners var menus:MenuManager = MenuManager.instance; menus.removeEventListener(menus.MENU_NAVIGATION_EVENT,onMenuNavigation); removeEventListener(Event.ADDED_TO_STAGE,onAdded); removeEventListener(Event.REMOVED_FROM_STAGE,onRemoved); removeEventListener(SuperSearchPlayer.LIFE_LOST,onPlayerDeath); removeEventListener(SuperSearchPlayer.ITEM_COLLECTED,onItemCollected); } } //-------------------------------------- // PRIVATE & PROTECTED INSTANCE METHODS //-------------------------------------- // Uwe this function to end the game. protected function gameOver():void { dispatchEvent(new Event(GAME_OVER)); // navigate to game over screen var menus:MenuManager = MenuManager.instance; menus.menuNavigation(MenuManager.MENU_GAMEOVER_SCR); } } }
31.606838
92
0.666577
54c55822ff34c985d3bf55482155b887d133f8a4
2,978
as
ActionScript
lib/se/lnu/stickossdk/input/InputKey.as
paontuus/RacingForFreedom
b1fca650e3ac44dfcda49f59c1cb8f968a3c7374
[ "Apache-2.0" ]
null
null
null
lib/se/lnu/stickossdk/input/InputKey.as
paontuus/RacingForFreedom
b1fca650e3ac44dfcda49f59c1cb8f968a3c7374
[ "Apache-2.0" ]
null
null
null
lib/se/lnu/stickossdk/input/InputKey.as
paontuus/RacingForFreedom
b1fca650e3ac44dfcda49f59c1cb8f968a3c7374
[ "Apache-2.0" ]
null
null
null
package se.lnu.stickossdk.input { //----------------------------------------------------------- // Public class //----------------------------------------------------------- /** * Representerar en inmatningstangent, exempelvis en tangent * på ett tangentbord. * * @version 1.0 * @copyright Copyright (c) 2012-2014. * @license Creative Commons (BY-NC-SA) * @since 2013-01-22 * @author Henrik Andersen <henrik.andersen@lnu.se> */ public class InputKey { //------------------------------------------------------- // Public constants //------------------------------------------------------- /** * Standardnamnet för alla input-tangenter. * * @default "undefined" */ public static const UNDEFINED:String = "undefined"; //------------------------------------------------------ /** * Definierar värdet av en tangents inaktiva tillstånd. * * @default 0 */ public static const INACTIVE:int = 0; /** * Definierar värdet av en tangents aktiva tillstånd. * * @default 1 */ public static const PRESSED:int = 1; /** * Definierar värdet av en tangents nyligen aktiva * tillstånd. Detta innebär att tangenten var aktiv vid * en föregående bildruta (frame). * * @default 2 */ public static const JUST_PRESSED:int = 2; /** * Definierar värdet av en tangents nyligen inaktiva * tillstånd. Detta innebär att tangenten var aktiv vid * en föregående bildruta (frame). * * @default -1 */ public static const RELEASED:int = -1; //------------------------------------------------------- // Public properties //------------------------------------------------------- /** * Tangentinstansens namn. * * @default null */ public var name:String; /** * Tangentens aktuella tillstånd. * * @default null */ public var current:int; /** * Tangentens föregående tillstånd. * * @default null */ public var last:int; //------------------------------------------------------- // Constructor method //------------------------------------------------------- /** * Skapar en ny instans av InputKey. * * @param name Tangentens namn. * @param current Tangentens aktuella tillstånd. * @param last Tangentens föregående tillstånd. */ public function InputKey(name:String = UNDEFINED, current:int = 0, last:int = 0) { this.name = name; this.current = current; this.last = last; } /** * Uppdaterar tangentens tillstånd. * * @return void */ public function update():void { if (last == RELEASED && current == RELEASED) { current = INACTIVE; } else if (last == JUST_PRESSED && current == JUST_PRESSED) { current = PRESSED; } last = current; } /** * Nollställer tangentens tillstånd. * * @return void */ public function reset():void { last = INACTIVE; current = INACTIVE; } } }
22.732824
84
0.502686
121e33fe7a86817375cd7fc6b013013d9e968400
7,346
as
ActionScript
src/main/actionscript/hu/vpmedia/utils/DateUtil.as
vpmedia/vpmedia-as3
7bf2f410181b8c59e9b5dd3fdf6e62cdd9f9ae18
[ "MIT" ]
1
2019-03-06T03:18:23.000Z
2019-03-06T03:18:23.000Z
src/main/actionscript/hu/vpmedia/utils/DateUtil.as
vpmedia/vpmedia-as3
7bf2f410181b8c59e9b5dd3fdf6e62cdd9f9ae18
[ "MIT" ]
null
null
null
src/main/actionscript/hu/vpmedia/utils/DateUtil.as
vpmedia/vpmedia-as3
7bf2f410181b8c59e9b5dd3fdf6e62cdd9f9ae18
[ "MIT" ]
null
null
null
/* * =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 { import hu.vpmedia.errors.StaticClassError; /** * Contains reusable methods for Date manipulation * * @see Date */ public final class DateUtil { /** * TBD */ public static const current:Date = new Date(); /** * TBD */ public function DateUtil():void { throw new StaticClassError(); } /** * Parses string date to object * @param source The source string (example: 19700101T000000) */ public static function parseCDate(source:String):Date { const yy:int = int(source.substr(0, 4)); const mm:int = int(source.substr(4, 2)) - 1; const dd:int = int(source.substr(6, 2)); const hh:int = int(source.substr(9, 2)); const mn:int = int(source.substr(11, 2)); const ss:int = int(source.substr(13, 2)); const mss:int = 0; const result:Date = new Date(yy, mm, dd, hh, mn, ss, mss); return result; } /** * TBD */ public static function timeCode(sec:Number):String { var h:Number = Math.floor(sec / 3600); var m:Number = Math.floor((sec % 3600) / 60); var s:Number = Math.floor((sec % 3600) % 60); return (h == 0 ? "" : (h < 10 ? "0" + String(h) + ":" : String(h) + ":")) + (m < 10 ? "0" + String(m) : String(m)) + ":" + (s < 10 ? "0" + String(s) : String(s)); } /** * TBD */ public static function timeCodeShort(sec:Number):String { var h:Number = Math.floor(sec / 3600); var m:Number = Math.floor((sec % 3600) / 60); return ((h < 10 ? "0" + String(h) + ":" : String(h) + ":")) + (m < 10 ? "0" + String(m) : String(m)); } /** * TBD */ public static function getUnixTimestamp():String { return String(Math.floor(new Date().time / 1000)); } /** * TBD */ public static function getDateByString(value:String):Date { var result:Date; var cDate:Date = new Date(); var dateArray:Array; if (value && value.indexOf(" ") > -1 && value.indexOf("-") > -1 && value.indexOf(":") > -1) { // 2013-10-24 16:36:55 var dateTimePair:Array = value.split(" "); dateArray = dateTimePair[0].split("-"); var timeArray:Array = dateTimePair[1].split(":"); result = new Date(int(dateArray[0]), int(dateArray[1]) - 1, int(dateArray[2]), int(timeArray[0]), int(timeArray[1]), int(timeArray[2])); } else if (value.indexOf("-") > -1) { // 2013-10-24 dateArray = value.split("-"); result = new Date(int(dateArray[0]), int(dateArray[1]) - 1, int(dateArray[2]), cDate.hours, cDate.minutes, cDate.seconds, cDate.milliseconds); } else if (value.indexOf(".") > -1) { // 2013.10.24. dateArray = value.split("."); result = new Date(int(dateArray[0]), int(dateArray[1]) - 1, int(dateArray[2]), cDate.hours, cDate.minutes, cDate.seconds, cDate.milliseconds); } if (!result) result = cDate; return result; } /** * TBD */ public static function millisecondsToWallclock(milliseconds:Number):String { var result:Array = []; var seconds:int = millisecondsToSeconds(milliseconds); var minutes:int = millisecondsToMinutes(milliseconds); var hours:int = millisecondsToHours(milliseconds); seconds = seconds % 60; minutes = minutes % 60; if (hours != 0) { result.push(zeroPad(hours, 2)); } result.push(zeroPad(minutes, 2)); if (hours == 0) { result.push(zeroPad(seconds, 2)); } return result.join(":"); } /** * TBD */ public static function zeroPad(number:int, length:int):String { var ret:String = "" + number.toString(); while (ret.length < length) { ret = "0" + ret; } return ret; } /** * TBD */ public static function millisecondsToHours(milliseconds:Number):int { return int(millisecondsToMinutes(milliseconds) / 60); } /** * TBD */ public static function millisecondsToMinutes(milliseconds:Number):int { return int(millisecondsToSeconds(milliseconds) / 60); } /** * TBD */ public static function millisecondsToSeconds(milliseconds:Number):int { return int(milliseconds / 1000); } /** * TBD */ public static function smilTimeToMilliseconds(timeString:String):int { var milliseconds:int = 0; if (timeString == null || timeString == "") { milliseconds = -100; } // parse clock values else if (timeString.indexOf(":") != -1) { var split:Array = timeString.split(":"); var hours:uint = 0; var minutes:uint = 0; var seconds:uint = 0; // half clock if (split.length < 3) { minutes = uint(split[0]); seconds = uint(split[1]); } // full wall clock else { hours = uint(split[0]); minutes = uint(split[1]); seconds = uint(split[2]); } milliseconds = ((hours * 60 * 60 * 1000) + (minutes * 60 * 1000) + (seconds * 1000)); } else { // hours if (timeString.indexOf("h") != -1) { milliseconds = parseFloat(timeString.substring(0, timeString.indexOf("h"))) * 60 * 60 * 1000; } // minutes else if (timeString.indexOf("min") != -1) { milliseconds = parseFloat(timeString.substring(0, timeString.indexOf("min"))) * 60 * 1000; } // milliseconds value else if (timeString.indexOf("ms") != -1) { milliseconds = parseFloat(timeString.substring(0, timeString.indexOf("ms"))); } // seconds else if (timeString.indexOf("s") != -1) { milliseconds = parseFloat(timeString.substring(0, timeString.indexOf("s"))) * 1000; } // minutes (similar to .at) else if (timeString.indexOf("m") != -1) { milliseconds = parseFloat(timeString.substring(0, timeString.indexOf("m"))) * 60 * 1000; } // assume the time is declared in seconds else { milliseconds = parseFloat(timeString) * 1000; } } return milliseconds; } } }
31.800866
170
0.542744
46bde2dc6f43e2895551f99765f4b7677c422b43
412
as
ActionScript
swf/com/playata/application/data/stream/ServerSystemMessage.as
Zweer/BigBangEmpireBot
d0fd04118822bf0eb6fffd271ce944f0475c5998
[ "MIT" ]
1
2019-10-31T13:49:58.000Z
2019-10-31T13:49:58.000Z
swf/com/playata/application/data/stream/ServerSystemMessage.as
Zweer/BigBangEmpireBot
d0fd04118822bf0eb6fffd271ce944f0475c5998
[ "MIT" ]
11
2018-09-30T15:17:00.000Z
2022-02-13T11:52:26.000Z
swf/com/playata/application/data/stream/ServerSystemMessage.as
Zweer/BigBangEmpireBot
d0fd04118822bf0eb6fffd271ce944f0475c5998
[ "MIT" ]
6
2018-06-18T18:43:46.000Z
2021-03-03T21:48:43.000Z
package com.playata.application.data.stream { import com.playata.framework.display.ui.IListItem; public class ServerSystemMessage extends SystemMessage implements IListItem { public function ServerSystemMessage(param1:Object = null) { super(param1); } public function get itemId() : String { return id.toString(); } } }
20.6
78
0.618932
fecbf856ff272dce48ca4a88d39b4891284b4ac0
466
as
ActionScript
Zcup/src/com/zcup/manager/SingletonFactory.as
mldongs/ZCup
6f848ee624c3d08c8fd19f982cecb8072cf00a79
[ "MIT" ]
2
2015-01-13T12:53:44.000Z
2015-01-13T12:53:47.000Z
Zcup/src/com/zcup/manager/SingletonFactory.as
mldongs/ZCup
6f848ee624c3d08c8fd19f982cecb8072cf00a79
[ "MIT" ]
null
null
null
Zcup/src/com/zcup/manager/SingletonFactory.as
mldongs/ZCup
6f848ee624c3d08c8fd19f982cecb8072cf00a79
[ "MIT" ]
null
null
null
package com.zcup.manager { import com.zcup.utils.HashMap; /** * 单例工厂 * @author pvsp * */ public class SingletonFactory { private static var objectCache:HashMap=new HashMap(); /** * 创建对象 * @param clz 对象类型 * @return * */ public static function createObject(clz:Class):* { var result:Object=objectCache.get(clz); if (result == null) { result=new clz(); objectCache.put(clz, result); } return result; } } }
15.032258
55
0.609442
4be76a09e9b83ce834104317ed742f349a59bb98
2,164
as
ActionScript
frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/IEEventAdapterBead.as
raudjcholo/royale-asjs
41bf846b97b2f712ae7999d0a18d05d0a20594a6
[ "ECL-2.0", "Apache-2.0" ]
1
2020-07-18T16:49:41.000Z
2020-07-18T16:49:41.000Z
frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/IEEventAdapterBead.as
raudjcholo/royale-asjs
41bf846b97b2f712ae7999d0a18d05d0a20594a6
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/IEEventAdapterBead.as
raudjcholo/royale-asjs
41bf846b97b2f712ae7999d0a18d05d0a20594a6
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// // // 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 "Licens"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.html.beads { import org.apache.royale.core.IBead; import org.apache.royale.core.IStrand; COMPILE::JS { import org.apache.royale.utils.object.defineSimpleGetter; } /** * The IEEventAdapterBead is used to enable correct handling of MouseEvents and KeyboardEvents in IE. * This is needed because IE does not support the <code>name</code> property. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9.2 */ public class IEEventAdapterBead implements IBead { public function IEEventAdapterBead() { } /** * @copy org.apache.royale.core.IBead#strand * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9.3 */ public function set strand(value:IStrand):void { COMPILE::JS { if(typeof window["KeyboardEvent"]["name"] == "undefined") {// IE does not have a prototype name property defineSimpleGetter(window["KeyboardEvent"],"name","KeyboardEvent"); defineSimpleGetter(window["MouseEvent"],"name","MouseEvent"); } } } } }
33.292308
103
0.640018
3994b18701e903efeb9c63271f2ec47072892ff8
795
as
ActionScript
client/src/kabam/rotmg/ui/view/PotionInventoryView.as
xoxobby/LoE-Realm-NC-2
ebfb8681a13f85f451739d575c8174b47072b211
[ "MIT" ]
3
2017-10-03T13:16:24.000Z
2017-10-14T19:54:22.000Z
client/src/kabam/rotmg/ui/view/PotionInventoryView.as
xoxobby/LoE-Realm-NC-2
ebfb8681a13f85f451739d575c8174b47072b211
[ "MIT" ]
null
null
null
client/src/kabam/rotmg/ui/view/PotionInventoryView.as
xoxobby/LoE-Realm-NC-2
ebfb8681a13f85f451739d575c8174b47072b211
[ "MIT" ]
12
2018-11-08T14:35:04.000Z
2019-11-08T15:03:04.000Z
package kabam.rotmg.ui.view { import flash.display.Sprite; import kabam.rotmg.ui.view.components.PotionSlotView; public class PotionInventoryView extends Sprite { private static const LEFT_BUTTON_CUTS:Array = [1, 0, 0, 1]; private static const RIGHT_BUTTON_CUTS:Array = [0, 1, 1, 0]; private static const BUTTON_SPACE:int = 4; private const cuts:Array = [LEFT_BUTTON_CUTS, RIGHT_BUTTON_CUTS]; public function PotionInventoryView() { var _local2:PotionSlotView; super(); var _local1:int; while (_local1 < 2) { _local2 = new PotionSlotView(this.cuts[_local1], _local1); _local2.x = (_local1 * (PotionSlotView.BUTTON_WIDTH + BUTTON_SPACE)); addChild(_local2); _local1++; } } } }
28.392857
81
0.654088
9e2e1a2a90179e1767a4ad31f6978a397f3dac04
3,466
as
ActionScript
swf/starling/utils/MathUtil.as
lukastechhonda/BigBangEmpireBot
5d5666c9d06111dc079f61b6038e2338d21fc8a7
[ "MIT" ]
1
2019-10-31T13:49:58.000Z
2019-10-31T13:49:58.000Z
swf/starling/utils/MathUtil.as
lukastechhonda/BigBangEmpireBot
5d5666c9d06111dc079f61b6038e2338d21fc8a7
[ "MIT" ]
11
2018-09-30T15:17:00.000Z
2022-02-13T11:52:26.000Z
swf/starling/utils/MathUtil.as
Zweer/BigBangEmpireBot
d0fd04118822bf0eb6fffd271ce944f0475c5998
[ "MIT" ]
6
2018-06-18T18:43:46.000Z
2021-03-03T21:48:43.000Z
package starling.utils { import flash.geom.Point; import flash.geom.Vector3D; import starling.errors.AbstractClassError; public class MathUtil { private static const TWO_PI:Number = 6.283185307179586; public function MathUtil() { super(); throw new AbstractClassError(); } public static function intersectLineWithXYPlane(param1:Vector3D, param2:Vector3D, param3:Point = null) : Point { if(param3 == null) { param3 = new Point(); } var _loc7_:Number = param2.x - param1.x; var _loc5_:Number = param2.y - param1.y; var _loc6_:Number = param2.z - param1.z; var _loc4_:Number = -param1.z / _loc6_; param3.x = param1.x + _loc4_ * _loc7_; param3.y = param1.y + _loc4_ * _loc5_; return param3; } public static function isPointInTriangle(param1:Point, param2:Point, param3:Point, param4:Point) : Boolean { var _loc15_:Number = param4.x - param2.x; var _loc13_:Number = param4.y - param2.y; var _loc8_:Number = param3.x - param2.x; var _loc16_:Number = param3.y - param2.y; var _loc12_:Number = param1.x - param2.x; var _loc9_:Number = param1.y - param2.y; var _loc10_:Number = _loc15_ * _loc15_ + _loc13_ * _loc13_; var _loc17_:Number = _loc15_ * _loc8_ + _loc13_ * _loc16_; var _loc14_:Number = _loc15_ * _loc12_ + _loc13_ * _loc9_; var _loc11_:Number = _loc8_ * _loc8_ + _loc16_ * _loc16_; var _loc18_:Number = _loc8_ * _loc12_ + _loc16_ * _loc9_; var _loc5_:Number = 1 / (_loc10_ * _loc11_ - _loc17_ * _loc17_); var _loc6_:Number = (_loc11_ * _loc14_ - _loc17_ * _loc18_) * _loc5_; var _loc7_:Number = (_loc10_ * _loc18_ - _loc17_ * _loc14_) * _loc5_; return _loc6_ >= 0 && _loc7_ >= 0 && _loc6_ + _loc7_ < 1; } public static function normalizeAngle(param1:Number) : Number { param1 = param1 % 6.28318530717959; if(param1 < -3.14159265358979) { param1 = param1 + 6.28318530717959; } if(param1 > 3.14159265358979) { param1 = param1 - 6.28318530717959; } return param1; } public static function getNextPowerOfTwo(param1:Number) : int { var _loc2_:* = 0; if(param1 is int && param1 > 0 && (param1 & param1 - 1) == 0) { return param1; } _loc2_ = 1; param1 = param1 - 1.0e-9; while(_loc2_ < param1) { _loc2_ = _loc2_ << 1; } return _loc2_; } public static function isEquivalent(param1:Number, param2:Number, param3:Number = 1.0E-4) : Boolean { return param1 - param3 < param2 && param1 + param3 > param2; } public static function max(param1:Number, param2:Number) : Number { return param1 > param2?param1:Number(param2); } public static function min(param1:Number, param2:Number) : Number { return param1 < param2?param1:Number(param2); } public static function clamp(param1:Number, param2:Number, param3:Number) : Number { return param1 < param2?param2:Number(param1 > param3?param3:Number(param1)); } } }
33.326923
116
0.565782
52f9357ee6ae28a0f93dce75c3dde2f39db60fc8
769
as
ActionScript
src/com/company/assembleegameclient/objects/MysteryBoxGround.as
Zolmex/RotMG-Flash-Client
1859de2f628ffb68a20005d651d9c4d8c7ff6de6
[ "MIT" ]
1
2022-01-18T17:30:38.000Z
2022-01-18T17:30:38.000Z
src/com/company/assembleegameclient/objects/MysteryBoxGround.as
Zolmex/RotMG-Flash-Client
1859de2f628ffb68a20005d651d9c4d8c7ff6de6
[ "MIT" ]
null
null
null
src/com/company/assembleegameclient/objects/MysteryBoxGround.as
Zolmex/RotMG-Flash-Client
1859de2f628ffb68a20005d651d9c4d8c7ff6de6
[ "MIT" ]
2
2021-08-07T07:37:45.000Z
2021-08-08T02:15:51.000Z
// Decompiled by AS3 Sorcerer 6.08 // www.as3sorcerer.com //com.company.assembleegameclient.objects.MysteryBoxGround package com.company.assembleegameclient.objects { import kabam.rotmg.game.view.MysteryBoxPanel; import com.company.assembleegameclient.game.GameSprite; import com.company.assembleegameclient.ui.panels.Panel; public class MysteryBoxGround extends GameObject implements IInteractiveObject { public function MysteryBoxGround(_arg_1:XML) { super(_arg_1); isInteractive_ = true; } public function getPanel(_arg_1:GameSprite):Panel { return (new MysteryBoxPanel(_arg_1, objectType_)); } } }//package com.company.assembleegameclient.objects
25.633333
83
0.703511
23a9ab026be0f46444df3f84601cae56de3f2886
15,771
as
ActionScript
frameworks/projects/MXRoyale/src/main/royale/mx/containers/Form.as
pashminakazi/royale-asjs
912f8a91f88d2c192d63a5a032d2deccbafd37b6
[ "Apache-2.0", "MIT" ]
1
2021-01-20T21:46:41.000Z
2021-01-20T21:46:41.000Z
frameworks/projects/MXRoyale/src/main/royale/mx/containers/Form.as
joseRamonLeon/royale-asjs
4dfa86ec6907da834fb5df7e5dc28e48ba65cbeb
[ "Apache-2.0", "MIT" ]
null
null
null
frameworks/projects/MXRoyale/src/main/royale/mx/containers/Form.as
joseRamonLeon/royale-asjs
4dfa86ec6907da834fb5df7e5dc28e48ba65cbeb
[ "Apache-2.0", "MIT" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// // // 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.containers { COMPILE::SWF { import flash.display.DisplayObject; } import mx.containers.beads.BoxLayout; import mx.controls.Label; import mx.core.Container; import mx.core.IFlexModuleFactory; import mx.core.IInvalidating; import mx.core.IUIComponent; import mx.core.mx_internal; import mx.styles.IStyleManager2; //import mx.styles.StyleManager; use namespace mx_internal; //include "../styles/metadata/GapStyles.as"; //-------------------------------------- // Styles //-------------------------------------- /** * Number of pixels between the label and child components. * The default value is 14. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ //[Style(name="indicatorGap", type="Number", format="Length", inherit="yes")] /** * Width of the form labels. * The default is the length of the longest label in the form. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ //[Style(name="labelWidth", type="Number", format="Length", inherit="yes")] /** * Number of pixels between the container's bottom border * and the bottom edge of its content area. * The default value is 16. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ //[Style(name="paddingBottom", type="Number", format="Length", inherit="no")] /** * Number of pixels between the container's top border * and the top edge of its content area. * The default value is 16. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ //[Style(name="paddingTop", type="Number", format="Length", inherit="no")] //-------------------------------------- // Excluded APIs //-------------------------------------- [Exclude(name="focusIn", kind="event")] [Exclude(name="focusOut", kind="event")] [Exclude(name="focusBlendMode", kind="style")] [Exclude(name="focusSkin", kind="style")] [Exclude(name="focusThickness", kind="style")] [Exclude(name="focusInEffect", kind="effect")] [Exclude(name="focusOutEffect", kind="effect")] //-------------------------------------- // Other metadata //-------------------------------------- //[IconFile("Form.png")] //[Alternative(replacement="spark.components.Form", since="4.5")] /** * The Form container lets you control the layout of a form, * mark form fields as required or optional, handle error messages, * and bind your form data to the Flex data model to perform * data checking and validation. * It also lets you use style sheets to configure the appearance * of your forms. * * <p>The following table describes the components you use to create forms in Flex:</p> * <table class="innertable"> * <tr> * <th>Component</th> * <th>Tag</th> * <th>Description</th> * </tr> * <tr> * <td>Form</td> * <td><code>&lt;mx:Form&gt;</code></td> * <td>Defines the container for the entire form, including the overall form layout. * Use the FormHeading control and FormItem container to define content. * You can also insert other types of components in a Form container.</td> * </tr> * <tr> * <td>FormHeading</td> * <td><code>&lt;mx:FormHeading&gt;</code></td> * <td>Defines a heading within your form. You can have multiple FormHeading controls within a single Form container.</td> * </tr> * <tr> * <td>FormItem</td> * <td><code>&lt;mx:FormItem&gt;</code></td> * <td>Contains one or more form children arranged horizontally or vertically. Children can be controls or other containers. * A single Form container can hold multiple FormItem containers.</td> * </tr> * </table> * * @mxml * * <p>The <code>&lt;mx:Form&gt;</code> tag inherits all the tag * attributes of its superclass and adds the following tag attributes:</p> * * <pre> * &lt;mx:Form * <strong>Styles</strong> * horizontalGap="8" * indicatorGap="14" * labelWidth="<i>Calculated</i>" * paddingBottom="16" * paddingTop="16" * verticalGap="6" * &gt; * ... * <i>child tags</i> * ... * &lt;/mx:Form&gt; * </pre> * * @includeExample examples/FormExample.mxml * * @see mx.containers.FormHeading * @see mx.containers.FormItem * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class Form extends Container { // include "../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function Form() { super(); //showInAutomationHierarchy = true; layoutObject.target = this; layoutObject.direction = BoxDirection.VERTICAL; } //-------------------------------------------------------------------------- // // Variables // //-------------------------------------------------------------------------- /** * @private */ mx_internal var layoutObject:BoxLayout = new BoxLayout(); /** * @private */ private var measuredLabelWidth:Number; //-------------------------------------------------------------------------- // // Overridden Properties // //-------------------------------------------------------------------------- /** * @private */ override public function set moduleFactory(moduleFactory:IFlexModuleFactory):void { super.moduleFactory = moduleFactory; /* styleManager.registerInheritingStyle("labelWidth"); styleManager.registerSizeInvalidatingStyle("labelWidth"); styleManager.registerInheritingStyle("indicatorGap"); styleManager.registerSizeInvalidatingStyle("indicatorGap"); */ } //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // maxLabelWidth //---------------------------------- [Bindable("updateComplete")] /** * The maximum width, in pixels, of the labels of the FormItems containers in this Form. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get maxLabelWidth():Number { var n:int = numChildren; for (var i:int = 0; i < n; i++) { var child:FormItem = getChildAt(i) as FormItem; if (child != null) { var itemLabel:Label = child.itemLabel; if (itemLabel) return itemLabel.width; } } return 0; } //-------------------------------------------------------------------------- // // Overridden methods: DisplayObjectContainer // //-------------------------------------------------------------------------- /** * @private * Discard the cached measuredLabelWidth if a child * is added or removed. */ override public function addChild(child:IUIComponent):IUIComponent { invalidateLabelWidth(); return super.addChild(child); } /** * @private */ override public function addChildAt(child:IUIComponent, index:int):IUIComponent { invalidateLabelWidth(); return super.addChildAt(child, index); } /** * @private */ override public function removeChild(child:IUIComponent):IUIComponent { invalidateLabelWidth(); return super.removeChild(child); } /** * @private */ override public function removeChildAt(index:int):IUIComponent { invalidateLabelWidth(); return super.removeChildAt(index); } //-------------------------------------------------------------------------- // // Overridden methods: UIComponent // //-------------------------------------------------------------------------- /** * Calculates the preferred, minimum and maximum sizes of the Form. * For more information about the <code>measure</code> method, * see the <code>UIComponent.measure()</code> method. * <p>The <code>Form.measure()</code> method sets the * <code>measuredWidth</code> property to the width of the * largest child, plus the values of the <code>paddingLeft</code> * and <code>paddingRight</code> style properties and the * width of the border.</p> * * <p>The <code>measuredHeight</code> property is set to the sum * of the <code>measuredHeight</code>S of all children, * plus <code>verticalGap</code> space between each child. * The <code>paddingTop</code> and <code>paddingBottom</code> * style properties and the height of the border are also added.</p> * * <p>The <code>measuredMinWidth</code> property is set to the largest * minimum width of the children. * If the child has a percentage value for <code>width</code>, * the <code>minWidth</code> property is used, otherwise the * <code>measuredWidth</code> property is used. * The values of the <code>paddingLeft</code> and * <code>paddingRight</code> style properties and the width * of the border are also added.</p> * * <p>The <code>measuredMinHeight</code> property is set to the same value * as that of the <code>measuredHeight</code> property.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ override protected function measure():void { super.measure(); layoutObject.measure(); calculateLabelWidth(); } /** * Responds to size changes by setting the positions * and sizes of this container's children. * For more information about the <code>updateDisplayList()</code> method, * see the <code>UIComponent.updateDisplayList()</code> method. * * <p>The <code>Form.updateDisplayList()</code> method * positions the children in a vertical column, * spaced by the <code>verticalGap</code> style property. * The <code>paddingLeft</code>, <code>paddingRight</code>, * <code>paddingTop</code> and <code>paddingBottom</code> * style properties are applied.</p> * * <p>If a child has a percentage width, * it is stretched horizontally to the specified * percentage of the Form container; otherwise, it is set * to its <code>measuredWidth</code> property. * Each child is set to its <code>measuredHeight</code> property.</p> * * <p>This method calls the <code>super.updateDisplayList()</code> * method before doing anything else.</p> * * @param unscaledWidth Specifies the width of the component, in pixels, * in the component's coordinates, regardless of the value of the * <code>scaleX</code> property of the component. * * @param unscaledHeight Specifies the height of the component, in pixels, * in the component's coordinates, regardless of the value of the * <code>scaleY</code> property of the component. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); layoutObject.updateDisplayList(unscaledWidth, unscaledHeight); } /** * @private override public function styleChanged(styleProp:String):void { // Check to see if this is one of the style properties // that is known to affect layout. if (!styleProp || styleProp == "styleName" || styleManager.isSizeInvalidatingStyle(styleProp)) { invalidateLabelWidth(); } super.styleChanged(styleProp); } */ /** * @private * */ override public function invalidateSize():void { super.invalidateSize(); invalidateLabelWidth(); } //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * @private */ internal function invalidateLabelWidth():void { // We only need to invalidate the label width // after we've been initialized. if (!isNaN(measuredLabelWidth) && initialized) { measuredLabelWidth = NaN; // Need to invalidate the size of all children // to make sure they respond to the label width change. var n:int = numChildren; for (var i:int = 0; i < n; i++) { var child:IUIComponent = IUIComponent(getChildAt(i)); if (child is IInvalidating) IInvalidating(child).invalidateSize(); } } } /** * @private */ internal function calculateLabelWidth():Number { // See if we've already calculated it. if (!isNaN(measuredLabelWidth)) return measuredLabelWidth; var labelWidth:Number = 0; var labelWidthSet:Boolean = false; // Determine best label width. var n:int = numChildren; for (var i:int = 0; i < n; i++) { var child:IUIComponent = getChildAt(i) as IUIComponent; if (child is FormItem && FormItem(child).includeInLayout) { labelWidth = Math.max(labelWidth, FormItem(child).getPreferredLabelWidth()); // only set measuredLabelWidth yet if we have at least one FormItem child labelWidthSet = true; } } if (labelWidthSet) measuredLabelWidth = labelWidth; return labelWidth; } } }
30.863014
135
0.545875
c279a4685bba53e2f2bc8c90ff0e4138fef42c62
1,706
as
ActionScript
src/com/ctyeung/Targa/TGATypeEnum.as
Abarrowman/Color
2d9995d780d4bc2341a7d2f8bffee29628d4b294
[ "MIT" ]
null
null
null
src/com/ctyeung/Targa/TGATypeEnum.as
Abarrowman/Color
2d9995d780d4bc2341a7d2f8bffee29628d4b294
[ "MIT" ]
null
null
null
src/com/ctyeung/Targa/TGATypeEnum.as
Abarrowman/Color
2d9995d780d4bc2341a7d2f8bffee29628d4b294
[ "MIT" ]
1
2018-10-30T07:47:05.000Z
2018-10-30T07:47:05.000Z
package com.ctyeung.Targa { public class TGATypeEnum { public static const HEADER_LEN:int = 18; // screen origin public static const ORIG_LOW_LEFT:int = 0; public static const ORIG_LOW_RIGHT:int = 1; public static const ORIG_UP_LEFT:int = 10; public static const ORIG_UP_RIGHT:int = 11; // data storage interleave public static const INTERLEAVE_NONE:int = 0; public static const INTERLEAVE_2WAY:int = 1; public static const INTERLEAVE_4WAY:int = 10; public static const INTERLEAVE_RESERVED:int = 11; // image types public static const IMG_TYPE_CLR_MAP_NO_CMP:int = 1; public static const IMG_TYPE_RGB_NO_CMP:int = 2; public static const IMG_TYPE_MONO_NO_CMP:int = 3; public static const IMG_TYPE_CLR_RMAP_RLE:int = 9; public static const IMG_TYPE_RGB_RLE:int = 10; public static const IMG_TYPE_MONO_RLE:int = 11; public static const IMG_TYPE_CLR_MAP_HUFF:int = 32; public static const IMG_TYPE_CLR_MAP_HUFFQUAD:int= 33; // color map entry size public static const CLR_MAP_SIZE_16:int = 16; public static const CLR_MAP_SIZE_24:int = 24; public static const CLR_MAP_SIZE_32:int = 32; // bits per pixel public static const BPP_1:int = 1; // binary public static const BPP_8:int = 8; // grayscale or palette public static const BPP_24:int = 24; // RGB public static const BPP_32:int = 32; // RGB+alpha // Alpha setting public static const ATTR_NONE_16bpp:int = 0; // 16bpp opaque public static const ATTR_TRUE_16bpp:int = 1; // 16bpp alpha public static const ATTR_NONE_24bpp:int = 0; // 24bpp opaque public static const ATTR_DEPTH_32bpp:int = 8; // 32bpp alpha } }
37.911111
64
0.716882
aaf117328ffc906920c2f03f24e2b287cfa6980b
208
as
ActionScript
src/com/logicom/geom/ExPolygons.as
ChrisDenham/PolygonClipper.AS3
7f0d36896729cd337b194ad5ca257962336d8f12
[ "BSL-1.0" ]
7
2015-01-09T07:25:32.000Z
2021-12-10T08:02:35.000Z
src/com/logicom/geom/ExPolygons.as
ChrisDenham/PolygonClipper.AS3
7f0d36896729cd337b194ad5ca257962336d8f12
[ "BSL-1.0" ]
1
2016-01-29T18:22:31.000Z
2016-01-29T19:37:59.000Z
src/com/logicom/geom/ExPolygons.as
ChrisDenham/PolygonClipper.AS3
7f0d36896729cd337b194ad5ca257962336d8f12
[ "BSL-1.0" ]
4
2017-03-06T21:32:15.000Z
2021-12-10T08:02:36.000Z
package com.logicom.geom { public class ExPolygons extends Array { public function ExPolygons() { } public function addExPolygon(exPolygon:ExPolygon):void { push(exPolygon); } } }
14.857143
56
0.668269
87e4d7f9cb6a761eee0e6777bba8939972c2b27c
6,165
as
ActionScript
dicecode/away3d/materials/shaders/DiffusePhongShader.as
HKMOpen/AS3MonoPoly
ebfb1473a68a3fd3a008bdf66432f5646a6e75b3
[ "MIT" ]
null
null
null
dicecode/away3d/materials/shaders/DiffusePhongShader.as
HKMOpen/AS3MonoPoly
ebfb1473a68a3fd3a008bdf66432f5646a6e75b3
[ "MIT" ]
null
null
null
dicecode/away3d/materials/shaders/DiffusePhongShader.as
HKMOpen/AS3MonoPoly
ebfb1473a68a3fd3a008bdf66432f5646a6e75b3
[ "MIT" ]
null
null
null
package away3d.materials.shaders { import away3d.core.light.DirectionalLight; import away3d.containers.*; import away3d.arcane; import away3d.core.base.*; import away3d.core.draw.*; import away3d.core.math.*; import away3d.core.render.*; import away3d.core.utils.*; import flash.display.*; import flash.geom.*; use namespace arcane; /** * Diffuse shader class for directional lighting. * * @see away3d.lights.DirectionalLight3D */ public class DiffusePhongShader extends AbstractShader { //private var eTriVal:Number = 512/Math.PI; private var _diffuseTransform:Matrix3D; private var _szx:Number; private var _szy:Number; private var _szz:Number; private var _normal0z:Number; private var _normal1z:Number; private var _normal2z:Number; private var eTriConst:Number = 512/Math.PI; /** * @inheritDoc */ protected function clearFaces(source:Object3D, view:View3D):void { view;//TODO : FDT Warning notifyMaterialUpdate(); for each (var _faceMaterialVO:FaceMaterialVO in _faceDictionary) { if (source == _faceMaterialVO.source) { if (!_faceMaterialVO.cleared) _faceMaterialVO.clear(); _faceMaterialVO.invalidated = true; } } } /** * @inheritDoc */ protected override function renderShader(tri:DrawTriangle):void { _faceVO = tri.faceVO; _n0 = _source.geometry.getVertexNormal(_face.v0); _n1 = _source.geometry.getVertexNormal(_face.v1); _n2 = _source.geometry.getVertexNormal(_face.v2); var _source_lightarray_directionals:Array = _source.lightarray.directionals; for each (var directional:DirectionalLight in _source_lightarray_directionals) { _diffuseTransform = directional.diffuseTransform[_source]; _szx = _diffuseTransform.szx; _szy = _diffuseTransform.szy; _szz = _diffuseTransform.szz; _normal0z = _n0.x * _szx + _n0.y * _szy + _n0.z * _szz; _normal1z = _n1.x * _szx + _n1.y * _szy + _n1.z * _szz; _normal2z = _n2.x * _szx + _n2.y * _szy + _n2.z * _szz; //check to see if the uv triangle lies inside the bitmap area if (_normal0z > 0 || _normal1z > 0 || _normal2z > 0) { eTri0x = eTriConst*Math.acos(_normal0z); //store a clone if (_faceMaterialVO.cleared && !_parentFaceMaterialVO.updated) { _faceMaterialVO.bitmap = _parentFaceMaterialVO.bitmap.clone(); _faceMaterialVO.bitmap.lock(); } _faceMaterialVO.cleared = false; _faceMaterialVO.updated = true; //calulate mapping _mapping.a = eTriConst*Math.acos(_normal1z) - eTri0x; _mapping.b = 127; _mapping.c = eTriConst*Math.acos(_normal2z) - eTri0x; _mapping.d = 255; _mapping.tx = eTri0x; _mapping.ty = 0; _mapping.invert(); _mapping.concat(_faceMaterialVO.invtexturemapping); //draw into faceBitmap _graphics = _s.graphics; _graphics.clear(); _graphics.beginBitmapFill(directional.diffuseBitmap, _mapping, false, smooth); _graphics.drawRect(0, 0, _bitmapRect.width, _bitmapRect.height); _graphics.endFill(); _faceMaterialVO.bitmap.draw(_s, null, null, blendMode); //_faceMaterialVO.bitmap.draw(directional.diffuseBitmap, _mapping, null, blendMode, _faceMaterialVO.bitmap.rect, smooth); } } } /** * Creates a new <code>DiffusePhongShader</code> object. * * @param init [optional] An initialisation object for specifying default instance properties. */ public function DiffusePhongShader(init:Object = null) { super(init); } /** * @inheritDoc */ public override function updateMaterial(source:Object3D, view:View3D):void { var _source_lightarray_directionals:Array = source.lightarray.directionals; for each (var directional:DirectionalLight in _source_lightarray_directionals) { if (!directional.diffuseTransform[source] || view.scene.updatedObjects[source]) { directional.setDiffuseTransform(source); clearFaces(source, view); } } } /** * @inheritDoc */ public override function renderLayer(tri:DrawTriangle, layer:Sprite, level:int):int { super.renderLayer(tri, layer, level); var _lights_directionals:Array = _lights.directionals; for each (var directional:DirectionalLight in _lights_directionals) { if (_lights.numLights > 1) { _shape = _session.getLightShape(this, level++, layer, directional); _shape.blendMode = blendMode; _graphics = _shape.graphics; } else { _graphics = layer.graphics; } _diffuseTransform = directional.diffuseTransform[_source]; _n0 = _source.geometry.getVertexNormal(_face.v0); _n1 = _source.geometry.getVertexNormal(_face.v1); _n2 = _source.geometry.getVertexNormal(_face.v2); _szx = _diffuseTransform.szx; _szy = _diffuseTransform.szy; _szz = _diffuseTransform.szz; _normal0z = _n0.x * _szx + _n0.y * _szy + _n0.z * _szz; _normal1z = _n1.x * _szx + _n1.y * _szy + _n1.z * _szz; _normal2z = _n2.x * _szx + _n2.y * _szy + _n2.z * _szz; eTri0x = eTriConst*Math.acos(_normal0z); _mapping.a = eTriConst*Math.acos(_normal1z) - eTri0x; _mapping.b = 127; _mapping.c = eTriConst*Math.acos(_normal2z) - eTri0x; _mapping.d = 255; _mapping.tx = eTri0x; _mapping.ty = 0; _mapping.invert(); _source.session.renderTriangleBitmap(directional.ambientDiffuseBitmap, _mapping, tri.screenVertices, tri.screenIndices, tri.startIndex, tri.endIndex, smooth, false, _graphics); } if (debug) _source.session.renderTriangleLine(0, 0x0000FF, 1, tri.screenVertices, tri.screenCommands, tri.screenIndices, tri.startIndex, tri.endIndex); return level; } } }
6,165
6,165
0.642011
8f9fe872f6197ba98f9534b9f5d893bae1efc46e
2,457
as
ActionScript
src/Malon.as
UnknownGuardian/Mirror-Maze
19f699e45463efb1a6866d2fdd3b1d88e80d05c6
[ "Unlicense" ]
null
null
null
src/Malon.as
UnknownGuardian/Mirror-Maze
19f699e45463efb1a6866d2fdd3b1d88e80d05c6
[ "Unlicense" ]
null
null
null
src/Malon.as
UnknownGuardian/Mirror-Maze
19f699e45463efb1a6866d2fdd3b1d88e80d05c6
[ "Unlicense" ]
null
null
null
package { import flash.display.Sprite; import flash.events.Event; import net.profusiondev.graphics.SpriteSheetAnimation; /** * ... * @author UnknownGuardian */ public class Malon extends SpriteSheetAnimation { private var directionFacing:uint = 0; public var isMoving:Boolean = false; public var delay:int = 0; public const MALON_ALPHA:Number = 0.75; public function Malon() { super(Content.shadow, 32, 48, 16, true, false); getChildAt(0).x = -width - 4; getChildAt(0).y = -height; alpha = MALON_ALPHA; trace("derp"); if (LevelData.currentLevel == 0) { alpha = 0; } } public function setDirection(num:uint):void { if (directionFacing != num) { directionFacing = num; if (directionFacing == 0)//down { frameNumber = 0; } else if (directionFacing == 1)//left { frameNumber = 5; } else if (directionFacing == 2)//right { frameNumber = 9; } else if (directionFacing == 3)//up { frameNumber = 13; } } } override public function drawTile(num:int):void { super.drawTile(num); if (LevelData.currentLevel == 0) { if (alpha != 0) { alpha = 0; } } else { if (alpha != MALON_ALPHA) { alpha = MALON_ALPHA; } } } public function getFacingRotation():Number { if (directionFacing == 0)//down { return 90; } else if (directionFacing == 1)//left { return 180; } else if (directionFacing == 2)//right { return 0; } else if (directionFacing == 3)//up { return 270; } return 0; } override public function animate(e:Event):void { if (!isMoving) return; if (delay != 2) { delay++; return; } delay = 0; drawTile(frameNumber); frameNumber++; if (directionFacing == 0)//down { if (frameNumber >= 4) frameNumber = 0; } else if (directionFacing == 1)//left { if (frameNumber >= 8) frameNumber = 5; } else if (directionFacing == 2)//right { if (frameNumber >= 12) frameNumber = 9; } else if (directionFacing == 3)//up { if (frameNumber >= 16) frameNumber = 13; } } public function changeImage(type:String):void { if (type == "sister") { //tileSheetBitmapData = Content.sister.bitmapData; } if (type == "wizard") { tileSheetBitmapData = Content.wizard.bitmapData; } drawTile(frameNumber); } } }
18.473684
55
0.582011
2a548cb5d4f1dab169293fee7d41164f64cf8e0e
2,321
as
ActionScript
data/DofusInvoker/scripts/com/ankamagames/dofus/logic/common/managers/HyperlinkShowTitleManager.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
10
2019-11-10T21:24:38.000Z
2021-05-24T23:56:36.000Z
data/DofusInvoker/scripts/com/ankamagames/dofus/logic/common/managers/HyperlinkShowTitleManager.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
15
2021-01-27T21:41:58.000Z
2021-03-03T16:47:19.000Z
data/DofusInvoker/scripts/com/ankamagames/dofus/logic/common/managers/HyperlinkShowTitleManager.as
bot4dofus/Datafus
126838a84b0e41d5486d735aa38d78deeb8d6681
[ "MIT" ]
3
2021-11-08T22:58:20.000Z
2022-02-09T22:22:33.000Z
package com.ankamagames.dofus.logic.common.managers { import com.ankamagames.berilia.enums.StrataEnum; import com.ankamagames.berilia.managers.KernelEventsManager; import com.ankamagames.berilia.managers.TooltipManager; import com.ankamagames.berilia.managers.UiModuleManager; import com.ankamagames.berilia.types.data.TextTooltipInfo; import com.ankamagames.dofus.datacenter.appearance.Title; import com.ankamagames.dofus.misc.lists.HookList; import com.ankamagames.jerakine.data.I18n; import com.ankamagames.jerakine.logger.Log; import com.ankamagames.jerakine.logger.Logger; import flash.geom.Rectangle; import flash.utils.getQualifiedClassName; public class HyperlinkShowTitleManager { protected static const _log:Logger = Log.getLogger(getQualifiedClassName(HyperlinkShowTitleManager)); private static var _titleList:Array = new Array(); private static var _titleId:uint = 0; public function HyperlinkShowTitleManager() { super(); } public static function showTitle(titleId:uint) : void { var data:Object = new Object(); data.id = _titleList[titleId].id; data.idIsTitle = true; data.forceOpen = true; KernelEventsManager.getInstance().processCallback(HookList.OpenBook,"titleTab",data); } public static function addTitle(titleId:uint) : String { var code:* = null; var title:Title = Title.getTitleById(titleId); if(title) { _titleList[_titleId] = title; code = "{chattitle," + _titleId + "::[" + title.name + "]}"; ++_titleId; return code; } return "[null]"; } public static function rollOver(pX:int, pY:int, objectGID:uint, titleId:uint = 0) : void { var target:Rectangle = new Rectangle(pX,pY,10,10); var info:TextTooltipInfo = new TextTooltipInfo(I18n.getUiText("ui.tooltip.chat.title")); TooltipManager.show(info,target,UiModuleManager.getInstance().getModule("Ankama_GameUiCore"),false,"HyperLink",6,2,3,true,null,null,null,null,false,StrataEnum.STRATA_TOOLTIP,1); } } }
37.435484
187
0.644119
46c9c3ddffdc43d35aa828324d8eaeb1a2f1a671
95
as
ActionScript
data/DofusInvoker/scripts/cmodule/lua_wrapper/_ebuf_2E_1986.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
10
2019-11-10T21:24:38.000Z
2021-05-24T23:56:36.000Z
data/DofusInvoker/scripts/cmodule/lua_wrapper/_ebuf_2E_1986.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
15
2021-01-27T21:41:58.000Z
2021-03-03T16:47:19.000Z
data/DofusInvoker/scripts/cmodule/lua_wrapper/_ebuf_2E_1986.as
bot4dofus/Datafus
126838a84b0e41d5486d735aa38d78deeb8d6681
[ "MIT" ]
3
2021-11-08T22:58:20.000Z
2022-02-09T22:22:33.000Z
package cmodule.lua_wrapper { const _ebuf_2E_1986:int = gstaticInitter.alloc(2048,1); }
19
59
0.736842
64ff51f03e0019ebac5f8abb029c33cd1ae485ef
2,470
as
ActionScript
src/egg82/utils/CookieUtil.as
CyberFlameGO/Comfort-2
4ba603eb869554343178c5fda12ccae716c41f21
[ "Unlicense" ]
1
2021-06-30T22:23:00.000Z
2021-06-30T22:23:00.000Z
src/egg82/utils/CookieUtil.as
CyberFlameGO/Comfort-2
4ba603eb869554343178c5fda12ccae716c41f21
[ "Unlicense" ]
null
null
null
src/egg82/utils/CookieUtil.as
CyberFlameGO/Comfort-2
4ba603eb869554343178c5fda12ccae716c41f21
[ "Unlicense" ]
1
2021-08-14T13:00:10.000Z
2021-08-14T13:00:10.000Z
/** * 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.utils { import flash.net.SharedObject; /** * ... * @author egg82 */ public class CookieUtil { //vars private static var _cookieCache:Array = new Array(); //constructor public function CookieUtil() { } //public public static function getAllData(name:String):Object { var cookie:SharedObject; cookie = _cookieCache[name]; if (!cookie) { cookie = SharedObject.getLocal(name); _cookieCache[name] = cookie; } return cookie.data; } public static function getData(name:String, type:String):* { var cookie:SharedObject; cookie = _cookieCache[name]; if (!cookie) { cookie = SharedObject.getLocal(name); _cookieCache[name] = cookie; } return cookie.data[type]; } public static function setData(name:String, type:String, data:*):void { var cookie:SharedObject; cookie = _cookieCache[name]; if (!cookie) { cookie = SharedObject.getLocal(name); _cookieCache[name] = cookie; } cookie.data[type] = data; cookie.flush(); } public static function deleteCookie(name:String):void { var cookie:SharedObject; cookie = _cookieCache[name]; if (!cookie) { cookie = SharedObject.getLocal(name); } cookie.clear(); _cookieCache[name] = null; } //private } }
26.847826
80
0.691093
950b4602b8c6aa1b68b3790fdbed20d421935ba1
697
as
ActionScript
dicecode/away3d/cameras/lenses/ILens.as
HKMOpen/AS3MonoPoly
ebfb1473a68a3fd3a008bdf66432f5646a6e75b3
[ "MIT" ]
null
null
null
dicecode/away3d/cameras/lenses/ILens.as
HKMOpen/AS3MonoPoly
ebfb1473a68a3fd3a008bdf66432f5646a6e75b3
[ "MIT" ]
null
null
null
dicecode/away3d/cameras/lenses/ILens.as
HKMOpen/AS3MonoPoly
ebfb1473a68a3fd3a008bdf66432f5646a6e75b3
[ "MIT" ]
null
null
null
package away3d.cameras.lenses { import away3d.containers.*; import away3d.core.base.*; import away3d.core.draw.*; import away3d.core.geom.*; import away3d.core.math.*; public interface ILens { function get near():Number; function get far():Number; function setView(val:View3D):void function getFrustum(node:Object3D, viewTransform:Matrix3D):Frustum; function getFOV():Number; function getZoom():Number; function getPerspective(screenZ:Number):Number; /** * Projects the vertices to the screen space of the view. */ function project(viewTransform:Matrix3D, vertices:Array, screenVertices:Array):void; } }
23.233333
92
0.678623
74036dd4c45eab62d18b8a635feea20369d59d3a
31,487
as
ActionScript
src/me/rainssong/tools/SimpleGUI.as
rainssong/RainsAsLib
7b9bf0e10f051259cb541d9007d6f34e3cfa43f2
[ "MIT" ]
7
2015-01-13T08:34:30.000Z
2020-12-28T01:52:36.000Z
src/me/rainssong/tools/SimpleGUI.as
rainssong/RainsAsLib
7b9bf0e10f051259cb541d9007d6f34e3cfa43f2
[ "MIT" ]
null
null
null
src/me/rainssong/tools/SimpleGUI.as
rainssong/RainsAsLib
7b9bf0e10f051259cb541d9007d6f34e3cfa43f2
[ "MIT" ]
5
2015-07-10T03:11:54.000Z
2021-02-18T10:30:11.000Z
/** * * uk.co.soulwire.gui.SimpleGUI * * @version 1.00 | Jan 13, 2011 * @author Justin Windle * * SimpleGUI is a single Class utility designed for AS3 projects where a developer needs to * quickly add UI controls for variables or functions to a sketch. Properties can be controlled * with just one line of code using a variety of components from the fantastic Minimal Comps set * by Keith Peters, as well as custom components written for SimpleGUI such as the FileChooser * * Credit to Keith Peters for creating Minimal Comps which this class uses * http://www.minimalcomps.com/ * http://www.bit-101.com/ * **/ package me.rainssong.tools { import com.bit101.components.CheckBox; import com.bit101.components.ColorChooser; import com.bit101.components.ComboBox; import com.bit101.components.Component; import com.bit101.components.HUISlider; import com.bit101.components.Label; import com.bit101.components.NumericStepper; import com.bit101.components.PushButton; import com.bit101.components.RangeSlider; import com.bit101.components.Style; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.DisplayObjectContainer; import flash.display.Sprite; import flash.display.Stage; import flash.events.ContextMenuEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.geom.Rectangle; import flash.net.FileReference; import flash.system.System; import flash.ui.ContextMenu; import flash.ui.ContextMenuItem; import flash.utils.Dictionary; import flash.utils.getQualifiedClassName; /** * SimpleGUI */ public class SimpleGUI extends EventDispatcher { // ---------------------------------------------------------------- // CONSTANTS // ---------------------------------------------------------------- public static const VERSION : Number = 1.02; private static const TOOLBAR_HEIGHT : int = 13; private static const COMPONENT_MARGIN : int = 8; private static const COLUMN_MARGIN : int = 1; private static const GROUP_MARGIN : int = 1; private static const PADDING : int = 4; private static const MARGIN : int = 1; // ---------------------------------------------------------------- // PRIVATE MEMBERS // ---------------------------------------------------------------- private var _components : Vector.<Component> = new Vector.<Component>(); private var _parameters : Dictionary = new Dictionary(); private var _container : Sprite = new Sprite(); private var _target : DisplayObjectContainer; private var _active : Component; private var _stage : Stage; private var _toolbar : Sprite = new Sprite(); private var _message : Label = new Label(); private var _version : Label = new Label(); private var _toggle : Sprite = new Sprite(); private var _lineH : Bitmap = new Bitmap(); private var _lineV : Bitmap = new Bitmap(); private var _tween : Number = 0.0; private var _width : Number = 0.0; private var _hotKey : String; private var _column : Sprite; private var _group : Sprite; private var _dirty : Boolean; private var _hidden : Boolean; private var _showToggle : Boolean = true; // ---------------------------------------------------------------- // CONSTRUCTOR // ---------------------------------------------------------------- public function SimpleGUI(target : DisplayObjectContainer, title : String = null, hotKey : * = null) { _target = target; _toggle.x = MARGIN; _toggle.y = MARGIN; _toolbar.x = MARGIN; _toolbar.y = MARGIN; _container.x = MARGIN; _container.y = TOOLBAR_HEIGHT + (MARGIN * 2); initStyles(); initToolbar(); initContextMenu(); if (_target.stage) onAddedToStage(null); else _target.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); _target.addEventListener(Event.ADDED, onTargetAdded); if(hotKey) this.hotKey = hotKey; addColumn(title); addGroup(); hide(); } // ---------------------------------------------------------------- // PUBLIC METHODS // ---------------------------------------------------------------- /** * Shows the GUI */ public function show() : void { _lineV.visible = false; _target.addChild(_container); _target.addChild(_toolbar); _target.addChild(_toggle); _hidden = false; } /** * Hides the GUI */ public function hide() : void { _lineV.visible = true; if (!_showToggle && _target.contains(_toggle)) _target.removeChild(_toggle); if (_target.contains(_container)) _target.removeChild(_container); if (_target.contains(_toolbar)) _target.removeChild(_toolbar); _hidden = true; } /** * Populates the system clipboard with Actionscript code, setting all * controlled properties to their current values */ public function save() : void { var path : String; var prop : Object; var target : Object; var targets : Array; var options : Object; var component : Component; var output : String = ''; for (var i : int = 0; i < _components.length; i++) { component = _components[i]; options = _parameters[component]; if (options.hasOwnProperty("target")) { targets = [].concat(options.target); for (var j : int = 0; j < targets.length; ++j) { path = targets[j]; prop = getProp(path); target = getTarget(path); output += path + " = " + target[prop] + ';\n'; } } } message = "Settings copied to clipboard"; System.setClipboard(output); } /** * Generic method for adding controls. This is called internally by * specific control methods. It is best to use explicit methods for * adding controls (such as addSlider and addToggle), however this * method has been exposed for flexibility * * @param type The class definition of the component to add * @param options The options to configure the component with */ public function addControl(type : Class, options : Object) : Component { var component : Component = new type(); // apply settings for (var option : String in options) { if (component.hasOwnProperty(option)) { component[option] = options[option]; } } // subscribe to component events if (component is PushButton || component is CheckBox) { component.addEventListener(MouseEvent.CLICK, onComponentClicked); } else if (component is ComboBox) { component.addEventListener(Event.SELECT, onComponentChanged); } else { component.addEventListener(Event.CHANGE, onComponentChanged); } // listen for first draw component.addEventListener(Component.DRAW, onComponentDraw); // add a label if necessary if (!component.hasOwnProperty("label") && options.hasOwnProperty("label") && type !== Label) { var container : Sprite = new Sprite(); var label : Label = new Label(); label.text = options.label; label.draw(); component.x = label.width + 5; container.addChild(label); container.addChild(component); _group.addChild(container); } else { _group.addChild(component); } _parameters[component] = options; _components.push(component); update(); //component.width = 200; return component; } /** * Adds a column to the GUI * * @param title An optional title to display at the top of the column */ public function addColumn(title : String = null) : void { _column = new Sprite(); _container.addChild(_column); addGroup(title); } /** * Creates a separator with an optional title to help segment groups * of controls * * @param title An optional title to display at the top of the group */ public function addGroup(title : String = null) : void { if (_group && _group.numChildren == 0) { _group.parent.removeChild(_group); } _group = new Sprite(); _column.addChild(_group); if (title) { addLabel(title.toUpperCase()); } } /** * Adds a label * * @param text The text content of the label */ public function addLabel(text : String) : void { addControl(Label, {text : text.toUpperCase()}); } /** * Adds a toggle control for a boolean value * * @param target The name of the property to be controlled * @param options An optional object containing initialisation parameters * for the control, the keys of which should correspond to properties on * the control. Additional values can also be placed within this object, * such as a callback function. If a String is passed as this parameter, * it will be used as the control's label, though it is recommended that * you instead pass the label as a property within the options object */ public function addToggle(target : String, options : Object = null) : void { options = parseOptions(target, options); var params : Object = {}; params.target = target; addControl(CheckBox, merge(params, options)); } public function addButton(label : String, options : Object = null) : void { options = parseOptions(label, options); var params : Object = {}; params.label = label; addControl(PushButton, merge(params, options)); } /** * Adds a slider control for a numerical value * * @param target The name of the property to be controlled * @param minimum The minimum slider value * @param maximum The maximum slider value * @param options An optional object containing initialisation parameters * for the control, the keys of which should correspond to properties on * the control. Additional values can also be placed within this object, * such as a callback function. If a String is passed as this parameter, * it will be used as the control's label, though it is recommended that * you instead pass the label as a property within the options object */ public function addSlider(target : String, minimum : Number, maximum : Number, options : Object = null) : void { options = parseOptions(target, options); var params : Object = {}; params.target = target; params.minimum = minimum; params.maximum = maximum; addControl(HUISlider, merge(params, options)); } /** * Adds a range slider control for a numerical value * * @param target The name of the property to be controlled * @param minimum The minimum slider value * @param maximum The maximum slider value * @param options An optional object containing initialisation parameters * for the control, the keys of which should correspond to properties on * the control. Additional values can also be placed within this object, * such as a callback function. If a String is passed as this parameter, * it will be used as the control's label, though it is recommended that * you instead pass the label as a property within the options object */ public function addRange(target1 : String, target2 : String, minimum : Number, maximum : Number, options : Object = null) : void { var target : Array = [target1, target2]; options = parseOptions(target.join(" / "), options); var params : Object = {}; params.target = target; params.minimum = minimum; params.maximum = maximum; addControl(HUIRangeSlider, merge(params, options)); } /** * Adds a numeric stepper control for a numerical value * * @param target The name of the property to be controlled * @param minimum The minimum stepper value * @param maximum The maximum stepper value * @param options An optional object containing initialisation parameters * for the control, the keys of which should correspond to properties on * the control. Additional values can also be placed within this object, * such as a callback function. If a String is passed as this parameter, * it will be used as the control's label, though it is recommended that * you instead pass the label as a property within the options object */ public function addStepper(target : String, minimum : Number, maximum : Number, options : Object = null) : void { options = parseOptions(target, options); var params : Object = {}; params.target = target; params.minimum = minimum; params.maximum = maximum; addControl(NumericStepper, merge(params, options)); } /** * Adds a colour picker * * @param target The name of the property to be controlled * @param options An optional object containing initialisation parameters * for the control, the keys of which should correspond to properties on * the control. Additional values can also be placed within this object, * such as a callback function. If a String is passed as this parameter, * it will be used as the control's label, though it is recommended that * you instead pass the label as a property within the options object */ public function addColour(target : String, options : Object = null) : void { options = parseOptions(target, options); var params : Object = {}; params.target = target; params.usePopup = true; addControl(ColorChooser, merge(params, options)); } /** * Adds a combo box of values for a property * * @param target The name of the property to be controlled * @param items A list of selectable items for the combo box in the form * or [{label:"The Label", data:anObject},...] * @param options An optional object containing initialisation parameters * for the control, the keys of which should correspond to properties on * the control. Additional values can also be placed within this object, * such as a callback function. If a String is passed as this parameter, * it will be used as the control's label, though it is recommended that * you instead pass the label as a property within the options object */ public function addComboBox(target : String, items : Array, options : Object = null) : void { options = parseOptions(target, options); var params : Object = {}; var prop : String = getProp(target); var targ : Object = getTarget(target); params.target = target; params.items = items; params.defaultLabel = targ[prop]; params.numVisibleItems = Math.min(items.length, 5); addControl(StyledCombo, merge(params, options)); } /** * Adds a file chooser for a File object * * @param label The label for the file * @param file The File object to control * @param onComplete A callback function to trigger when the file's data is loaded * @param filter An optional list of FileFilters to apply when selecting the file * @param options An optional object containing initialisation parameters * for the control, the keys of which should correspond to properties on * the control. Additional values can also be placed within this object, * such as a callback function. If a String is passed as this parameter, * it will be used as the control's label, though it is recommended that * you instead pass the label as a property within the options object */ public function addFileChooser(label : String, file : FileReference, onComplete : Function, filter : Array = null, options : Object = null) : void { options = parseOptions(label, options); var params : Object = {}; params.file = file; params.label = label; params.width = 220; params.filter = filter; params.onComplete = onComplete; addControl(FileChooser, merge(params, options)); } /** * Adds a save button to the controls. The save method can also be called * manually or by pressing the 's' key. Saving populates the system clipboard * with Actionscript code, setting all controlled properties to their current values * * @param label The label for the save button * @param options An optional object containing initialisation parameters * for the control, the keys of which should correspond to properties on * the control. Additional values can also be placed within this object, * such as a callback function. If a String is passed as this parameter, * it will be used as the control's label, though it is recommended that * you instead pass the label as a property within the options object */ public function addSaveButton(label : String = "Save", options : Object = null) : void { addGroup("Save Current Settings (S)"); options = parseOptions(label, options); var params : Object = {}; params.label = label; var button : PushButton = addControl(PushButton, merge(params, options)) as PushButton; button.addEventListener(MouseEvent.CLICK, onSaveButtonClicked); } // ---------------------------------------------------------------- // PRIVATE METHODS // ---------------------------------------------------------------- private function initStyles() : void { Style.PANEL = 0x333333; Style.BACKGROUND = 0x333333; Style.INPUT_TEXT = 0xEEEEEE; Style.LABEL_TEXT = 0xEEEEEE; Style.BUTTON_FACE = 0x555555; Style.DROPSHADOW = 0x000000; } private function initToolbar() : void { _toolbar.x += TOOLBAR_HEIGHT + 1; _version = new Label(); _version.text = "SimpelGUI v" + VERSION; _version.alpha = 0.5; _message = new Label(); _message.alpha = 0.6; _message.x = 2; _version.y = _message.y = -3; _toggle.graphics.beginFill(0x333333, 0.9); _toggle.graphics.drawRect(0, 0, TOOLBAR_HEIGHT, TOOLBAR_HEIGHT); _toggle.graphics.endFill(); _toolbar.addChild(_version); _toolbar.addChild(_message); _toggle.addEventListener(MouseEvent.CLICK, onToggleClicked); _toggle.buttonMode = true; // _lineH.bitmapData = new BitmapData(5, 1, false, 0xFFFFFF); _lineV.bitmapData = new BitmapData(1, 5, false, 0xFFFFFF); _lineH.x = (TOOLBAR_HEIGHT * 0.5) - 3; _lineH.y = (TOOLBAR_HEIGHT * 0.5) - 1; _lineV.x = (TOOLBAR_HEIGHT * 0.5) - 1; _lineV.y = (TOOLBAR_HEIGHT * 0.5) - 3; _toggle.addChild(_lineH); _toggle.addChild(_lineV); } private function initContextMenu() : void { var menu : * = _target.contextMenu || new ContextMenu(); var item : ContextMenuItem = new ContextMenuItem("Toggle Controls", true); item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenuItemSelected); if(menu.customItems) menu.customItems.push(item); _target.contextMenu = menu; } private function commit(component : Component = null) : void { if (component) { _active = component; apply(component, true); } else { for (var i : int = 0; i < _components.length; i++) { component = _components[i]; apply(component, false); } } update(); } private function apply(component : Component, extended : Boolean = false) : void { var i : int; var path : String; var prop : Object; var target : Object; var targets : Array; var options : Object = _parameters[component]; if (options.hasOwnProperty("target")) { targets = [].concat(options.target); for (i = 0; i < targets.length; i++) { path = targets[i]; prop = getProp(path); target = getTarget(path); if (component is CheckBox) { target[prop] = component["selected"]; } else if (component is RangeSlider) { target[prop] = component[i == 0 ? "lowValue" : "highValue"]; } else if (component is ComboBox) { if(component["selectedItem"]) { target[prop] = component["selectedItem"].data; } } else if(component.hasOwnProperty("value")) { target[prop] = component["value"]; } } } if (extended && options.hasOwnProperty("callback")) { options.callback.apply(_target, options.callbackParams || []); } } private function update() : void { var i : int; var j : int; var path : String; var prop : Object; var target : Object; var targets : Array; var options : Object; var component : Component; for (i = 0; i < _components.length; i++) { component = _components[i]; if (component == _active) continue; options = _parameters[component]; if (options.hasOwnProperty("target")) { targets = [].concat(options.target); for (j = 0; j < targets.length; j++) { path = targets[j]; prop = getProp(path); target = getTarget(path); if (component is CheckBox) { component["selected"] = target[prop]; } else if (component is RangeSlider) { component[j == 0 ? "lowValue" : "highValue"] = target[prop]; } else if ( component is ComboBox) { var items : Array = component["items"]; for (var k : int = 0; k < items.length; k++) { if(items[k].data == target[prop]) { if(component["selectedIndex"] != k) { component["selectedIndex"] = k; break; } } } } else if(component.hasOwnProperty("value")) { component["value"] = target[prop]; } } } } } private function invalidate() : void { _container.addEventListener(Event.ENTER_FRAME, onEnterFrame); _dirty = true; } private function draw() : void { var i : int; var j : int; var k : int; var ghs : Array; var gw : int = 0; var gh : int = 0; var gy : int = 0; var cx : int = 0; var cw : int = 0; var group : Sprite; var column : Sprite; var component : Sprite; var bounds : Rectangle; for (i = 0; i < _container.numChildren; i++) { column = _container.getChildAt(i) as Sprite; column.x = cx; gy = cw = 0; ghs = []; for (j = 0; j < column.numChildren; j++) { group = column.getChildAt(j) as Sprite; group.y = gy; gw = 0; gh = PADDING; for (k = 0; k < group.numChildren; k++) { component = group.getChildAt(k) as Sprite; bounds = component.getBounds(component); component.x = PADDING - bounds.x; component.y = gh - bounds.y; gw = Math.max(gw, bounds.width); gh += bounds.height + (k < group.numChildren - 1 ? COMPONENT_MARGIN : 0); } gh += PADDING; ghs[j] = gh; gy += gh + GROUP_MARGIN; cw = Math.max(cw, gw); } cw += (PADDING * 2); for (j = 0; j < column.numChildren; j++) { group = column.getChildAt(j) as Sprite; for (k = 0; k < group.numChildren - 1; k++) { component = group.getChildAt(k) as Sprite; bounds = component.getBounds(component); bounds.bottom += COMPONENT_MARGIN / 2; component.graphics.clear(); component.graphics.lineStyle(0, 0x000000, 0.1); component.graphics.moveTo(bounds.left, bounds.bottom); component.graphics.lineTo(bounds.x + cw - (PADDING * 2), bounds.bottom); } group.graphics.clear(); group.graphics.beginFill(0x333333, 0.9); group.graphics.drawRect(0, 0, cw, ghs[j]); group.graphics.endFill(); } cx += cw + COLUMN_MARGIN; } _width = cx - COLUMN_MARGIN; _version.x = _width - _toolbar.x -_version.width - 2; _toolbar.graphics.clear(); _toolbar.graphics.beginFill(0x333333, 0.9); _toolbar.graphics.drawRect(0, 0, _width - _toolbar.x, TOOLBAR_HEIGHT); _toolbar.graphics.endFill(); } private function parseOptions(target : String, options : Object) : Object { options = clone(options); var type : String = getQualifiedClassName(options); switch(type) { case "String" : return {label: options}; case "Object" : options.label = options.label || propToLabel(target); return options; default : return {label: propToLabel(target)}; } } private function getTarget(path : String) : Object { var target : Object = _target; var hierarchy : Array = path.split('.'); if (hierarchy.length == 1) return _target; for (var i : int = 0; i < hierarchy.length - 1; i++) { target = target[hierarchy[i]]; } return target; } private function getProp(path : String) : String { return /[_a-z0-9]+$/i.exec(path)[0]; } private function merge(source : Object, destination : Object) : Object { var combined : Object = clone(destination); for (var prop : String in source) { if (!destination.hasOwnProperty(prop)) { combined[prop] = source[prop]; } } return combined; } private function clone(source : Object) : Object { var copy : Object = {}; for (var prop : String in source) { copy[prop] = source[prop]; } return copy; } private function propToLabel(prop : String) : String { return prop .replace(/[_]+([a-zA-Z0-9]+)|([0-9]+)/g, " $1$2 ") .replace(/(?<=[a-z0-9])([A-Z])|(?<=[a-z])([0-9])/g, " $1$2") .replace(/^(\w)|\s+(\w)|\.+(\w)/g, capitalise) .replace(/^\s|\s$|(?<=\s)\s+/g, ''); } private function capitalise(...args) : String { return String(' ' + args[1] + args[2] + args[3]).toUpperCase(); } // ---------------------------------------------------------------- // EVENT HANDLERS // ---------------------------------------------------------------- private function onAddedToStage(event : Event) : void { _stage = _target.stage; _target.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); _target.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed); } private function onTargetAdded(event : Event) : void { if (!_hidden) show(); } private function onSaveButtonClicked(event : MouseEvent) : void { save(); } private function onToggleClicked(event : MouseEvent) : void { _hidden ? show() : hide(); } private function onContextMenuItemSelected(event : ContextMenuEvent) : void { _hidden ? show() : hide(); } private function onComponentClicked(event : MouseEvent) : void { commit(event.target as Component); } private function onComponentChanged(event : Event) : void { commit(event.target as Component); } private function onComponentDraw(event : Event) : void { var component : Component = event.target as Component; component.removeEventListener(Component.DRAW, onComponentDraw); invalidate(); } private function onEnterFrame(event : Event) : void { _container.removeEventListener(Event.ENTER_FRAME, onEnterFrame); if(_dirty) { _dirty = false; draw(); } } private function onKeyPressed(event : KeyboardEvent) : void { if(hotKey && event.keyCode == hotKey.toUpperCase().charCodeAt(0)) { _hidden ? show() : hide(); } if(event.keyCode == 83) { save(); } } private function onMessageEnterFrame(event : Event) : void { _tween += 0.01; _message.alpha = 1.0 - (-0.5 * (Math.cos(Math.PI * _tween) - 1)); if (_message.alpha < 0.0001) { _message.removeEventListener(Event.ENTER_FRAME, onMessageEnterFrame); _message.text = ''; } } // ---------------------------------------------------------------- // PUBLIC ACCESSORS // ---------------------------------------------------------------- public function get showToggle() : Boolean { return _showToggle; } public function set showToggle( value : Boolean ) : void { _showToggle = value; if (_hidden) hide(); } public function set message(value : String) : void { _tween = 0.0; _message.alpha = 1.0; _message.text = value.toUpperCase(); _message.addEventListener(Event.ENTER_FRAME, onMessageEnterFrame); } public function get hotKey() : * { return _hotKey; } public function set hotKey( value : * ) : void { if (value is String) { _hotKey = value; } else if (value is int) { _hotKey = String.fromCharCode(value); } else { throw new Error("HotKey must be a String or an integer"); } message = "Hotkey set to '" + _hotKey + "'"; } } } import com.bit101.components.ComboBox; import com.bit101.components.Component; import com.bit101.components.HRangeSlider; import com.bit101.components.InputText; import com.bit101.components.Label; import com.bit101.components.PushButton; import flash.events.Event; import flash.events.MouseEvent; import flash.net.FileReference; internal class HUIRangeSlider extends HRangeSlider { private var _label : Label = new Label(); private var _offset : Number = 0.0; override protected function addChildren() : void { super.addChildren(); _label.y = -5; addChild(_label); } override public function draw() : void { _offset = x = _label.width + 5; _width = Math.min(200 - _offset, 200); _label.x = -_offset; super.draw(); } public function get label() : String { return _label.text; } public function set label(value : String) : void { _label.text = value; _label.draw(); } } internal class FileChooser extends Component { public var filter : Array = []; public var onComplete : Function; private var _label : Label = new Label(); private var _file : FileReference; private var _filePath : InputText = new InputText(); private var _button : PushButton = new PushButton(); override protected function addChildren() : void { super.addChildren(); _button.x = 125; _button.width = 75; _button.label = "Browse"; _button.addEventListener(MouseEvent.CLICK, onButtonClicked); _filePath.enabled = false; _filePath.width = 120; _filePath.height = _button.height; _button.y = _filePath.y = 20; addChild(_filePath); addChild(_button); addChild(_label); } private function onButtonClicked(event : MouseEvent) : void { if (_file) _file.browse(filter); } private function onFileSelected(event : Event) : void { _filePath.text = _file.name; _file.addEventListener(Event.COMPLETE, onFileComplete); _file.load(); } private function onFileComplete(event : Event) : void { if (onComplete != null) onComplete(); } override public function set width(w : Number) : void { super.width = w; _button.x = w - _button.width; _filePath.width = w - _button.width - 5; } public function get label() : String { return _label.text; } public function set label( value : String ) : void { _label.text = value; } public function get file() : FileReference { return _file; } public function set file( value : FileReference ) : void { if (_file) { _file.removeEventListener(Event.SELECT, onFileSelected); } _file = value; _file.addEventListener(Event.SELECT, onFileSelected); if(_file.data) { _filePath.text = _file.name; } } } internal class StyledCombo extends ComboBox { override protected function addChildren() : void { super.addChildren(); _list.defaultColor = 0x333333; _list.alternateColor = 0x444444; _list.selectedColor = 0x111111; _list.rolloverColor = 0x555555; } }
26.173732
148
0.630864
125868e85be8299cafc6e5f94bd2a81b507e450a
1,836
as
ActionScript
swf/visuals/ui/elements/buttons/SymbolButtonVideoAdvertismentGeneric.as
lukastechhonda/BigBangEmpireBot
5d5666c9d06111dc079f61b6038e2338d21fc8a7
[ "MIT" ]
1
2019-10-31T13:49:58.000Z
2019-10-31T13:49:58.000Z
swf/visuals/ui/elements/buttons/SymbolButtonVideoAdvertismentGeneric.as
lukastechhonda/BigBangEmpireBot
5d5666c9d06111dc079f61b6038e2338d21fc8a7
[ "MIT" ]
11
2018-09-30T15:17:00.000Z
2022-02-13T11:52:26.000Z
swf/visuals/ui/elements/buttons/SymbolButtonVideoAdvertismentGeneric.as
Zweer/BigBangEmpireBot
d0fd04118822bf0eb6fffd271ce944f0475c5998
[ "MIT" ]
6
2018-06-18T18:43:46.000Z
2021-03-03T21:48:43.000Z
package visuals.ui.elements.buttons { import com.playata.framework.display.Sprite; import com.playata.framework.display.lib.flash.FlashDisplayObjectContainer; import com.playata.framework.display.lib.flash.FlashSprite; import flash.display.MovieClip; import visuals.ui.base.SymbolDummyGeneric; import visuals.ui.elements.icons.SymbolIconVideoAdvertismentGeneric; public class SymbolButtonVideoAdvertismentGeneric extends Sprite { private var _nativeObject:SymbolButtonVideoAdvertisment = null; public var icon:SymbolIconVideoAdvertismentGeneric = null; public var symbolDummy:SymbolDummyGeneric = null; public function SymbolButtonVideoAdvertismentGeneric(param1:MovieClip = null) { if(param1) { _nativeObject = param1 as SymbolButtonVideoAdvertisment; } else { _nativeObject = new SymbolButtonVideoAdvertisment(); } super(null,FlashSprite.fromNative(_nativeObject)); var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer; icon = new SymbolIconVideoAdvertismentGeneric(_nativeObject.icon); symbolDummy = new SymbolDummyGeneric(_nativeObject.symbolDummy); } public function setNativeInstance(param1:SymbolButtonVideoAdvertisment) : void { FlashSprite.setNativeInstance(_sprite,param1); _nativeObject = param1; syncInstances(); } public function syncInstances() : void { if(_nativeObject.icon) { icon.setNativeInstance(_nativeObject.icon); } if(_nativeObject.symbolDummy) { symbolDummy.setNativeInstance(_nativeObject.symbolDummy); } } } }
32.785714
89
0.673203
959615372c3d68a4eaf92151fd0a1998c6709665
3,895
as
ActionScript
client/src/org/as3commons/file/PropertiesFile.as
airsdk/apm
b52f84cb228ea9dcfe5e47b581b250af2e5b5254
[ "MIT" ]
27
2021-03-02T09:41:11.000Z
2022-03-13T04:17:11.000Z
client/src/org/as3commons/file/PropertiesFile.as
airnativeextensions/apm
b52f84cb228ea9dcfe5e47b581b250af2e5b5254
[ "MIT" ]
59
2021-07-23T11:55:52.000Z
2022-03-29T19:05:05.000Z
client/src/org/as3commons/file/PropertiesFile.as
airsdk/apm
b52f84cb228ea9dcfe5e47b581b250af2e5b5254
[ "MIT" ]
6
2021-04-14T02:00:04.000Z
2021-11-10T21:41:27.000Z
/** * __ __ __ * ____/ /_ ____/ /______ _ ___ / /_ * / __ / / ___/ __/ ___/ / __ `/ __/ * / /_/ / (__ ) / / / / / /_/ / / * \__,_/_/____/_/ /_/ /_/\__, /_/ * / / * \/ * http://distriqt.com * * @author Michael (https://github.com/marchbold) * @created 5/10/21 */ package org.as3commons.file { import org.as3commons.lang.StringUtils; /** * This class gives the ability to load "properties" files in which configuration * properties are listed as a series of "VariableName=Value" lines. * <br/> * <listing> * PropertyA=SomeValue * AnotherProperty=SomeOtherValue * </listing> */ public class PropertiesFile { //////////////////////////////////////////////////////// // CONSTANTS // private static const TAG:String = "PropertiesFile"; private static const HASH_CHARCODE:uint = 35; //= "#"; private static const EXCLAMATION_MARK_CHARCODE:uint = 33; //= "!"; private static const DOUBLE_BACKWARD_SLASH:String = '\\'; private static const NEWLINE_CHAR:String = "\n"; private static const NEWLINE_REGEX:RegExp = /\\n/gm; private static const SINGLE_QUOTE_CHARCODE:uint = 39; // = "'"; private static const COLON_CHARCODE:uint = 58; //: private static const EQUALS_CHARCODE:uint = 61; //= private static const TAB_CHARCODE:uint = 9; //////////////////////////////////////////////////////// // VARIABLES // private var _properties:Object; /** * Properties loaded from the file */ public function get properties():Object { return _properties; } public function set properties( value:Object ):void { _properties = value; } //////////////////////////////////////////////////////// // FUNCTIONALITY // public function PropertiesFile() { } public function parse( source:String ):Object { _properties = {}; try { var lines:Array = source.split( NEWLINE_CHAR ); var key:String; var value:String; var formerKey:String; var formerValue:String; var useNextLine:Boolean = false; for (var i:int = 0; i < lines.length; i++) { var line:String = StringUtils.trim( lines[ i ] ); if (isPropertyLine( line )) { // Line break processing if (useNextLine) { key = formerKey; value = formerValue + line; useNextLine = false; } else { var sep:int = getSeparation( line ); key = StringUtils.rightTrim( line.substr( 0, sep ) ); value = line.substring( sep + 1 ); formerKey = key; formerValue = value; } // Trim the content value = StringUtils.leftTrim( value ); // Allow normal lines var end:String = value.substring( value.length - 1 ); if (end == DOUBLE_BACKWARD_SLASH) { formerValue = value = value.substr( 0, value.length - 1 ); useNextLine = true; } else { // restore newlines since these were escaped when loaded value = value.replace( NEWLINE_REGEX, NEWLINE_CHAR ); _properties[ key ] = value; } } } } catch (e:Error) { trace( e ); } return _properties; } public function isPropertyLine( line:String ):Boolean { return (line.charCodeAt( 0 ) != HASH_CHARCODE && line.charCodeAt( 0 ) != EXCLAMATION_MARK_CHARCODE && line.length != 0); } protected function getSeparation( line:String ):int { var len:int = line.length; for (var i:int = 0; i < len; i++) { var char:uint = line.charCodeAt( i ); if (char == SINGLE_QUOTE_CHARCODE) { i++; } else { if (char == COLON_CHARCODE || char == EQUALS_CHARCODE || char == TAB_CHARCODE) { break; } } } return ((i == len) ? line.length : i); } } }
23.895706
83
0.547625
9190de6d999a7d491a624e232eb61163265ec639
683
as
ActionScript
src/classes/api/events/GetProjectInfoEvent.as
shavenzov/music3000-vk
5a47baedc59271c14bf57bd158767be198e6c41a
[ "MIT" ]
null
null
null
src/classes/api/events/GetProjectInfoEvent.as
shavenzov/music3000-vk
5a47baedc59271c14bf57bd158767be198e6c41a
[ "MIT" ]
null
null
null
src/classes/api/events/GetProjectInfoEvent.as
shavenzov/music3000-vk
5a47baedc59271c14bf57bd158767be198e6c41a
[ "MIT" ]
1
2020-01-03T16:24:03.000Z
2020-01-03T16:24:03.000Z
package classes.api.events { import flash.events.Event; import classes.api.data.ProjectInfo; import classes.api.errors.APIError; public class GetProjectInfoEvent extends Event { public static const GET_PROJECT_INFO : String = 'GET_PROJECT_INFO'; public var info : ProjectInfo; public var error : int; public function GetProjectInfoEvent( type : String, info : ProjectInfo, error : int ) { super( type ); this.info = info; this.error = error; } public function get isError() : Boolean { return error != APIError.OK; } override public function clone():Event { return new GetProjectInfoEvent( type, info, error ); } } }
20.69697
87
0.688141
e8328d69d366129d67517c0e4f88fba4a770c905
841
as
ActionScript
src/test/org/spicefactory/parsley/context/scope/model/OrderedMixedScopeReceivers.as
teramura/Parsley-Core
3252fbc4eb9e3dcafa43ef4ba1745cbd5757ded2
[ "Apache-2.0" ]
7
2015-01-28T05:00:27.000Z
2021-06-14T21:22:42.000Z
src/test/org/spicefactory/parsley/context/scope/model/OrderedMixedScopeReceivers.as
huang-x-h/Parsley-Core
6f52d0d31394d7cf4c4c35e7643fee78f15c5a53
[ "Apache-2.0" ]
null
null
null
src/test/org/spicefactory/parsley/context/scope/model/OrderedMixedScopeReceivers.as
huang-x-h/Parsley-Core
6f52d0d31394d7cf4c4c35e7643fee78f15c5a53
[ "Apache-2.0" ]
10
2015-03-12T20:46:45.000Z
2018-09-08T17:29:36.000Z
package org.spicefactory.parsley.context.scope.model { import org.spicefactory.parsley.util.MessageCounter; /** * @author Jens Halm */ public class OrderedMixedScopeReceivers extends MessageCounter { public var order:String = ""; [MessageHandler(scope="local", order="1")] public function handleLocalMessage2 (message:String) : void { order += (message == "response") ? "1" : "A"; } [MessageHandler(order="2")] public function handleGlobalMessage2 (message:Object) : void { order += (message == "response") ? "2" : "B"; } [MessageHandler(scope="local", order="3")] public function handleLocalMessage (message:Object) : void { order += (message == "response") ? "3" : "C"; } [MessageHandler] public function handleGlobalMessage (message:String) : void { order += (message == "response") ? "4" : "D"; } } }
25.484848
64
0.673008
1b5dce1f19fb86f0c76ebbfd9a512b3243b0ce6d
519
as
ActionScript
src/hg/lib/ensemblXref3.as
andypohl/kent
af7a004c8f3fa909cd8c2cfc2e5bea60e3421cd1
[ "MIT" ]
171
2015-04-22T15:16:02.000Z
2022-03-18T20:21:53.000Z
src/hg/lib/ensemblXref3.as
andypohl/kent
af7a004c8f3fa909cd8c2cfc2e5bea60e3421cd1
[ "MIT" ]
60
2016-10-03T15:15:06.000Z
2022-03-30T15:21:52.000Z
src/hg/lib/ensemblXref3.as
andypohl/kent
af7a004c8f3fa909cd8c2cfc2e5bea60e3421cd1
[ "MIT" ]
80
2015-04-16T10:39:48.000Z
2022-03-29T16:36:30.000Z
table ensemblXref3 "A cross-reference table for Ensembl Genes." ( string gene; "Ensembl gene ID" string geneVer; "Ensembl gene ID version number" string transcript; "Ensembl transcript ID" string transcriptVer; "Ensembl transcript ID version number" string protein; "Ensembl protein ID" string proteinVer; "Ensembl protein version number" string tremblAcc; "TrEMBL protein accession number" string swissDisplayId; "Swiss-Prot protein display ID" string swissAcc; "Swiss-Prot protein accession number" )
37.071429
61
0.780347
08d7268ac0d16e202db78206e9624e05bea2b9d4
4,740
as
ActionScript
com/tinyspeck/engine/animatedbitmap/AnimatedBitmap.as
tinyspeck/glitch-client
2ad533a82370694eddd16ec225e518115a9690b1
[ "CC0-1.0" ]
66
2015-01-19T03:03:00.000Z
2022-01-05T03:27:32.000Z
com/tinyspeck/engine/animatedbitmap/AnimatedBitmap.as
Kiichi77/glitch-client
2ad533a82370694eddd16ec225e518115a9690b1
[ "CC0-1.0" ]
null
null
null
com/tinyspeck/engine/animatedbitmap/AnimatedBitmap.as
Kiichi77/glitch-client
2ad533a82370694eddd16ec225e518115a9690b1
[ "CC0-1.0" ]
49
2015-01-13T20:20:50.000Z
2021-05-12T14:49:35.000Z
package com.tinyspeck.engine.animatedbitmap { import flash.display.Bitmap; import flash.display.BitmapData; import flash.events.Event; import flash.geom.Point; import flash.geom.Rectangle; /** * Bitmap which achieves animation by using copyPixels to draw pre-defined frames within a "sprite sheet" to a canvas. */ public class AnimatedBitmap extends Bitmap { private const helperPoint:Point = new Point(); private const clearRect:Rectangle = new Rectangle(); private var frames:Vector.<AnimatedBitmapFrame>; private var _totalFrames:uint; private var loop:Boolean; private var currentFrameIndex:uint = 0; private var currentFrame:AnimatedBitmapFrame; private var displayListX:Number = 0; // this DisplayObject's x coordinate without considering animation frame offset private var displayListY:Number = 0; // this DisplayObject's y coordinate without considering animation frame offset private var maxFrameWidth:Number; // used to determine the animation's width private var maxFrameHeight:Number; // used to determine the animation's height private var spriteSheet:BitmapData; private var canvas:BitmapData; private var disposed:Boolean = false; private var isPlaying:Boolean = false; public function AnimatedBitmap(bitmapAtlas:BitmapAtlas, loop:Boolean = true, pixelSnapping:String="auto", smoothing:Boolean=false) { super(null, pixelSnapping, smoothing); spriteSheet = bitmapAtlas.sheetBMD; frames = bitmapAtlas.frames; _totalFrames = frames.length; this.loop = loop; maxFrameWidth = bitmapAtlas.maxFrameWidth; maxFrameHeight = bitmapAtlas.maxFrameHeight; canvas = new BitmapData(maxFrameWidth, maxFrameHeight, true, 0); bitmapData = canvas; clearRect.width = maxFrameWidth; clearRect.height = maxFrameHeight; showCurrentFrame(); } public function play():void { if (_totalFrames == 1) return; isPlaying = true; addEventListener(Event.ENTER_FRAME, onFrameEntered, false, 0, true); } public function stop():void { if (_totalFrames == 1) return; isPlaying = false; removeEventListener(Event.ENTER_FRAME, onFrameEntered); } private function onFrameEntered(e:Event):void { if (disposed) return; if (visible) showCurrentFrame(); currentFrameIndex++; if (currentFrameIndex == _totalFrames) { if (!loop) { stop(); return; } currentFrameIndex = 0; } } /** Draw the current animation frame from the sprite sheet to the canvas */ private function showCurrentFrame():void { currentFrame = frames[currentFrameIndex]; canvas.fillRect(clearRect, 0); canvas.copyPixels(spriteSheet, currentFrame.scrollRect, helperPoint); updateX(); updateY(); } /** The actual X coordinate must consider the left offset of the current frame */ private function updateX():void { super.x = displayListX + currentFrame.displayListX * scaleX; } /** The actual Y coordinate must consider the top offset of the current frame */ private function updateY():void { super.y = displayListY + currentFrame.displayListY * scaleY; } /** Return the unmodified x coord */ override public function get x():Number { return displayListX; } /** Keep track of unmodified x, and update the actual x with consideration of frame offset */ override public function set x(value:Number):void { displayListX = value; updateX(); } /** Return unmodified y coord */ override public function get y():Number { return displayListY; } /** Keep track of unmodified y, and update the actual y with consideration of frame offset */ override public function set y(value:Number):void { displayListY = value; updateY(); } /** Don't return the width of the entire sprite sheet, instead return the animation's dimensions */ override public function get width():Number { return maxFrameWidth * scaleX; } /** Make sure the animation's width changes, not the width of the entire sprite sheet */ override public function set width(value:Number):void { scaleX = value / maxFrameWidth; } /** Dont't return the height of the entire sprite sheet, instead return the animation's dimensions */ override public function get height():Number { return maxFrameHeight * scaleY; } /** Make sure the animation's height changes, not the height of the entire sprite sheet */ override public function set height(value:Number):void { scaleY = value / maxFrameHeight; } public function dispose():void { if (isPlaying) stop(); canvas.dispose(); disposed = true; } public function get totalFrames():uint { return _totalFrames; } } }
31.390728
134
0.71097
fc463ed013831bbd82cefb9b63fa8e7847275266
2,883
as
ActionScript
core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/PromiseUtil.as
isabella232/core-redirects
a0d4ebb2360990e2e551c36a3f53a0af2d3b9ed9
[ "Apache-2.0" ]
null
null
null
core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/PromiseUtil.as
isabella232/core-redirects
a0d4ebb2360990e2e551c36a3f53a0af2d3b9ed9
[ "Apache-2.0" ]
1
2021-06-17T17:53:55.000Z
2021-06-17T17:53:55.000Z
core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/PromiseUtil.as
isabella232/core-redirects
a0d4ebb2360990e2e551c36a3f53a0af2d3b9ed9
[ "Apache-2.0" ]
null
null
null
package com.tallence.core.redirects.studio.util { import com.coremedia.ui.data.RemoteBean; import com.coremedia.ui.data.impl.RemoteServiceMethod; import com.coremedia.ui.data.impl.RemoteServiceMethodResponse; import ext.Deferred; import ext.IPromise; import ext.JSON; import ext.Promise; /** * Utility class for creating promises. */ public class PromiseUtil { /** * Creates a promise that loads a list of remote beans. * * @param remoteBeans The beans to be loaded * @return The promise. Resolve method signature: <code>function(loaded:Array):void</code> */ public static function loadRemoteBeans(remoteBeans:Array):IPromise { return Promise.all(remoteBeans.map(function (content:RemoteBean):IPromise { return loadRemoteBean(content); })); } /** * Creates a promise that invalidates the given remote bean. * * @param remoteBean the bean to be invalidated. * @return The promise. Resolve method signature: <code>function(bean:RemoteBean):void</code> */ public static function invalidateRemoteBean(remoteBean:RemoteBean):IPromise { var deferred:Deferred = new Deferred(); remoteBean.invalidate(function (result:RemoteBean):void { deferred.resolve(result); }); return deferred.promise; } /** * Creates a promise that loads the given remote bean. * * @param remoteBean the bean to be loaded * @return The promise. Resolve method signature: <code>function(bean:RemoteBean):void</code> */ public static function loadRemoteBean(remoteBean:RemoteBean):IPromise { var deferred:Deferred = new Deferred(); remoteBean.load(function (loaded:RemoteBean):void { deferred.resolve(loaded); }); return deferred.promise; } /** * Creates a promise that performs a get request. The response text of the request is parsed to a json object. This * json object is used to create the given class. * * @param path the request path * @param params the params for the get request * @param responseClass the class to which the json response should be parsed * @return The promise. Resolve method signature: <code>function(responseClass:Class):void</code> */ public static function getRequest(path:String, params:Object, responseClass:Class):IPromise { var deferred:Deferred = new Deferred(); var rsm:RemoteServiceMethod = new RemoteServiceMethod(path, "GET", true); rsm.request( params, function success(rsmr:RemoteServiceMethodResponse):void { var jsonResponse:Object = JSON.decode(rsmr.text); var constructor:Function = responseClass.bind.apply(responseClass, [null, jsonResponse]); deferred.resolve(new constructor()); }, function failure(rsmr:RemoteServiceMethodResponse):void { deferred.reject(rsmr.getError()); }); return deferred.promise; } } }
33.523256
117
0.710371
585d4c4572b829ad6a7f6b1b0c4f4736144c4251
1,407
as
ActionScript
swf/com/playata/application/ui/elements/application/UiLetterbox.as
lukastechhonda/BigBangEmpireBot
5d5666c9d06111dc079f61b6038e2338d21fc8a7
[ "MIT" ]
1
2019-10-31T13:49:58.000Z
2019-10-31T13:49:58.000Z
swf/com/playata/application/ui/elements/application/UiLetterbox.as
lukastechhonda/BigBangEmpireBot
5d5666c9d06111dc079f61b6038e2338d21fc8a7
[ "MIT" ]
11
2018-09-30T15:17:00.000Z
2022-02-13T11:52:26.000Z
swf/com/playata/application/ui/elements/application/UiLetterbox.as
Zweer/BigBangEmpireBot
d0fd04118822bf0eb6fffd271ce944f0475c5998
[ "MIT" ]
6
2018-06-18T18:43:46.000Z
2021-03-03T21:48:43.000Z
package com.playata.application.ui.elements.application { import com.greensock.easing.Power1; import com.playata.framework.application.Environment; import visuals.ui.elements.quest.SymbolLetterboxGeneric; public class UiLetterbox { private var _content:SymbolLetterboxGeneric = null; public function UiLetterbox(param1:SymbolLetterboxGeneric) { super(); _content = param1; } public function fadeIn() : void { if(_content.top.isTweening) { return; } _content.top.tweenFromTo(1,{"y":-60},{ "y":0, "ease":Power1.easeInOut }); _content.bottom.tweenFromTo(1,{"y":Environment.layout.appHeight},{ "y":Environment.layout.appHeight - 60, "ease":Power1.easeInOut }); } public function fadeOut() : void { if(_content.top.y == -60) { return; } if(_content.top.isTweening) { return; } _content.top.tweenFromTo(1,{"y":0},{ "y":-60, "ease":Power1.easeInOut }); _content.bottom.tweenFromTo(1,{"y":Environment.layout.appHeight - 60},{ "y":Environment.layout.appHeight, "ease":Power1.easeInOut }); } } }
25.125
80
0.525231
9a1ddc746dd61c5f034e9617a8375634e1a1b916
4,646
as
ActionScript
src/axl/xdef/types/xScript.as
axldns/AXLX-framework
fc11e7c4a9d76065ba67137312a078c287f5d7c7
[ "BSD-2-Clause-FreeBSD" ]
4
2016-08-10T13:32:09.000Z
2022-01-29T23:13:27.000Z
src/axl/xdef/types/xScript.as
axldns/AXLX-framework
fc11e7c4a9d76065ba67137312a078c287f5d7c7
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
src/axl/xdef/types/xScript.as
axldns/AXLX-framework
fc11e7c4a9d76065ba67137312a078c287f5d7c7
[ "BSD-2-Clause-FreeBSD" ]
2
2016-08-10T13:32:10.000Z
2016-08-11T02:36:33.000Z
/** * * AXLX Framework * 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.xdef.types { import axl.utils.U; import axl.xdef.XSupport; import axl.xdef.types.display.xRoot; /** Lightweight class for loading external config definitions. Instantiated from: <code>&lt;script/&gt;</code><br> * Externalizing portions of code / definitions allows to keep projects more structured, share elements between them, speeds * up development process by providing re-usable, modular components.<br> * This instance (unlike others) modifies original root XML config by including XML children contained in additions node of this instance * to additions node of root config's addition node - pool of definitions. <br> * <h4>Script Structure</h4> * Defining script with src attribute in root XML config allows to load external XML. Make use of cacheBust attribute if your template is * updated frequently. Sample use * * <pre> * &lt;root&gt;<br> * &lt;script src='../shared/templates/videoPlayer.xml' cacheBust='true' /&gt;<br> * &lt;/root&gt;<br> * </pre> * Loaded XML is expected to contain <b>additions</b> node only. All children of that node will be injected to root config additions node.<br> * There is no instantiation involved - just XML definitions are added and made available to use from top level. * <pre> * &lt;config&gt;<br> * &lt;additions onInclude='log("onInclude")' onIncluded='log("onIncluded")' &gt;<br> * &lt;btn name="magicButton"&gt;<br> * &lt;img name='over' src='../shared/mbover.png'/&gt;<br> * &lt;img name='out' src='../shared/mbout.png'/&gt;<br> * &lt;/btn&gt;<br> * &lt;/additions&gt;<br> * &lt;/config&gt;<br> * </pre> */ public class xScript extends xObject { /** Determines logging @default false*/ public var debug:Boolean = false; /** Determines if script is included at instantiation (true) or waits for manual call of <code>includeScript</code> method (false). * @see #includeScript() */ public var autoInclude:Boolean = true; /** Function or portion of uncompiled code to execute when object is set up but right before modifying original root config XML. * br>This field must be defined within loaded XML additions attributes and not in root XML.<br> * An argument for binCommand. @see axl.xdef.types.display.xRoot#binCommand() */ public var onInclude:Object; /** Function or portion of uncompiled code to execute right after inclusion of loaded additions to original root config XML. * From this moment, all loaded definitions are available in root additions.<br>This field must be defined within loaded XML * additions attributes and not in root XML.<br> * An argument for binCommand. @see axl.xdef.types.display.xRoot#binCommand() */ public var onIncluded:Object; /** Allows to load and include external XML objects definitions to root config. Instantiated from <code>&lt;script/&gt;</code><br> * @param definition - xml definition * @param xroot - reference to parent xRoot object * @see axl.xdef.types.xScript * @see axl.xdef.interfaces.ixDef#xroot * @see axl.xdef.XSupport#getReadyType2() */ public function xScript(definition:XML, xroot:xRoot) { super(definition, xroot); } /** Allows to include script manually, on demand. Should be used along with <code>autoInclude=false</code>, otherwise (simmilarly to subsequent * calls to this method) root config will be modified multiple times and object definitons will be duplicated. */ public function includeScript():void { if(!(data is XML) || !data.hasOwnProperty("additions")) throw new Error("Elements loaded from <script/> tag must contain valid XML which contains <additions/> node: " + this.name); var additions:XML = data.additions[0]; XSupport.applyAttributes(additions,this); if(debug) U.log("script", this.name, "has defined actions onInclude: ", onInclude!=null, "onIncluded: ", onIncluded!=null); if(onInclude is String) xroot.binCommand(onInclude,this); if(onInclude is Function) onInclude(); var xl:XMLList = additions.children() as XMLList; var len:int = xl.length(); var target:XML = xroot.config.additions[0]; for(var i:int=0; i<len;i++) target.appendChild(xl[i]); if(debug) U.log(len,"elements included to additions from script: " + this.name); if(onIncluded is String) xroot.binCommand(onIncluded,this); if(onIncluded is Function) onIncluded(); } } }
48.395833
145
0.713302
072d93d8779273148a6292f56c5603dc2aa91b25
5,406
as
ActionScript
node_modules/flex-sdk/lib/flex_sdk/frameworks/projects/charts/src/mx/charts/chartClasses/DataDescription.as
guidoalloatti/zype_player
3ace80e8122cf09c22bc7971e48f360ce691f628
[ "Apache-2.0" ]
null
null
null
node_modules/flex-sdk/lib/flex_sdk/frameworks/projects/charts/src/mx/charts/chartClasses/DataDescription.as
guidoalloatti/zype_player
3ace80e8122cf09c22bc7971e48f360ce691f628
[ "Apache-2.0" ]
null
null
null
node_modules/flex-sdk/lib/flex_sdk/frameworks/projects/charts/src/mx/charts/chartClasses/DataDescription.as
guidoalloatti/zype_player
3ace80e8122cf09c22bc7971e48f360ce691f628
[ "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// // // ADOBE SYSTEMS INCORPORATED // Copyright 2009 Adobe Systems Incorporated // All Rights Reserved. // // NOTICE: Adobe permits you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// package mx.charts.chartClasses { /** * The DataDescription structure is used by ChartElements to describe * the characteristics of the data they represent to Axis objects * that auto-generate values from the data represented in the chart. * ChartElements displaying data should construct and return DataDescriptions * from their <code>describeData()</code> method when invoked. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class DataDescription { include "../../core/Version.as"; //-------------------------------------------------------------------------- // // Class constants // //-------------------------------------------------------------------------- /** * A bitflag passed by the axis to an element's <code>describeData()</code> method. * If this flag is set, the element sets the * <code>boundedValues</code> property. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const REQUIRED_BOUNDED_VALUES:uint = 0x2; /** * A bitflag passed by the axis to an element's <code>describeData()</code> method. * If this flag is set, the element sets the * <code>minInterval</code> property. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const REQUIRED_MIN_INTERVAL:uint = 0x1; /** * A bitflag passed by the axis to an element's <code>describeData()</code> method. * If this flag is set, the element sets the * <code>DescribeData.min</code> and <code>DescribeData.max</code> properties. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const REQUIRED_MIN_MAX:uint = 0x4; /** * A bitflag passed by the axis to an element's <code>describeData()</code> method. * If this flag is set, the element sets the * <code>DescribeData.padding</code> property. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const REQUIRED_PADDING:uint = 0x8; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function DataDescription() { super(); } //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // boundedValues //---------------------------------- [Inspectable(environment="none")] /** * An Array of BoundedValue objects describing the data in the element. * BoundedValues are data points that have extra space reserved * around the datapoint in the chart's data area. * If requested, a chart element fills this property * with whatever BoundedValues are necessary * to ensure enough space is visible in the chart data area. * For example, a ColumnSeries that needs 20 pixels * above each column to display a data label. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public var boundedValues:Array /* of BoundedValue */; //---------------------------------- // max //---------------------------------- [Inspectable(environment="none")] /** * The maximum data value displayed by the element. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public var max:Number; //---------------------------------- // min //---------------------------------- [Inspectable(environment="none")] /** * The minimum data value displayed by the element. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public var min:Number; //---------------------------------- // minInterval //---------------------------------- [Inspectable(environment="none")] /** * The minimum interval, in data units, * between any two values displayed by the element. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public var minInterval:Number; //---------------------------------- // padding //---------------------------------- [Inspectable(environment="none")] /** * The amount of padding, in data units, that the element requires * beyond its min/max values to display its full values correctly . * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public var padding:Number; } }
26.895522
85
0.54791
0df18a4202fdd24c9af2fc6c813951732804c7f8
364
as
ActionScript
test/issues/Issue213.as
prominic/as3hx-forked-for-moonshine-ide
902c7c13571ee901f70af97073e01abe9bbc0629
[ "MIT" ]
132
2015-01-12T17:23:45.000Z
2022-03-20T20:41:08.000Z
test/issues/Issue213.as
prominic/as3hx-forked-for-moonshine-ide
902c7c13571ee901f70af97073e01abe9bbc0629
[ "MIT" ]
197
2015-01-12T17:11:47.000Z
2021-11-08T23:10:05.000Z
test/issues/Issue213.as
prominic/as3hx-forked-for-moonshine-ide
902c7c13571ee901f70af97073e01abe9bbc0629
[ "MIT" ]
48
2015-01-26T10:16:40.000Z
2022-03-16T11:28:35.000Z
package { import starling.utils.StringUtil; public class Issue213 { public function Issue213() { StringUtil.format("[VertexData format=\"{0}\" numVertices={1}]", "", 1); } } } import mx.utils.StringUtil; class Foo { public function Foo() { StringUtil.trim(" abc "); StringUtil.isWhitespace(""); } }
21.411765
84
0.576923
fe7da7a4484d7faaf37fe5269f1873e3dc2972ef
8,177
as
ActionScript
app/client/src/view/scene/quest/QuestDataClip.as
yamatoyaryuta/Unlight
37a5080e477a6bf6c03f671d1f8229502a6437e9
[ "MIT" ]
171
2019-07-30T10:02:59.000Z
2022-02-07T12:50:07.000Z
app/client/src/view/scene/quest/QuestDataClip.as
outshaker/Unlight
015d92e4493f81a8e7975f60f7473e156322187b
[ "MIT" ]
11
2019-08-01T14:39:17.000Z
2019-08-17T05:17:50.000Z
app/client/src/view/scene/quest/QuestDataClip.as
outshaker/Unlight
015d92e4493f81a8e7975f60f7473e156322187b
[ "MIT" ]
82
2019-08-03T12:45:48.000Z
2022-03-03T01:28:24.000Z
package view.scene.quest { import flash.display.*; import flash.events.Event; import flash.events.MouseEvent; import flash.events.EventDispatcher; import flash.geom.*; import mx.core.UIComponent; import mx.controls.Label; import mx.controls.Text; import org.libspark.thread.Thread; import org.libspark.thread.utils.ParallelExecutor; import org.libspark.thread.threads.between.BeTweenAS3Thread; import model.*; import model.events.*; import view.utils.*; import view.image.quest.*; import view.scene.*; import controller.*; /** * クエストマップ表示クラス * */ public class QuestDataClip extends BaseScene { // 翻訳データ CONFIG::LOCALE_JP private static const _TRANS_MSG :String = "地形の詳細です。"; CONFIG::LOCALE_EN private static const _TRANS_MSG :String = "Information about the area."; CONFIG::LOCALE_TCN private static const _TRANS_MSG :String = "地形的詳細資訊。"; CONFIG::LOCALE_SCN private static const _TRANS_MSG :String = "地形的详细信息。"; CONFIG::LOCALE_KR private static const _TRANS_MSG :String = "지형의 상세 정보 입니다."; CONFIG::LOCALE_FR private static const _TRANS_MSG :String = "Informations concernant la région"; CONFIG::LOCALE_ID private static const _TRANS_MSG :String = "地形の詳細です。"; CONFIG::LOCALE_TH private static const _TRANS_MSG :String = "รายละเอียดของแผนที่"; protected var _container:UIComponent = new UIComponent(); // 表示コンテナ private var _mapData:MapDataImage = new MapDataImage(); private var _commanData:QuestCommandImage = new QuestCommandImage(); private var _ctrl:QuestCtrl = QuestCtrl.instance; private var _questLandClip:QuestLandClip; // キャプション private var _nameText:Label = new Label(); // 名前 private var _dataText:Text = new Text(); // キャプション private var _stageText:Label = new Label(); // キャプション // private var _eventText:Label = new Label(); // キャプション // 位置定数 private static const _LAND_X:int = 472; // X位置 private static const _LAND_Y:int = 347; // X位置 private static const _NAME_TEXT_X:int = 468; // X位置 private static const _NAME_TEXT_Y:int = 335; // X位置 private static const _NAME_TEXT_WIDTH:int = 90; // 横幅 private static const _NAME_TEXT_HEIGHT:int = 20; // 縦幅 private static const _DATA_TEXT_X:int = 473; // X位置 private static const _DATA_TEXT_Y:int = 412; // X位置 private static const _DATA_TEXT_WIDTH:int = 80; // 横幅 private static const _DATA_TEXT_HEIGHT:int = 70; // 縦幅 private static const _STAGE_TEXT_X:int = 468; // X位置 private static const _STAGE_TEXT_Y:int = 412; // X位置 private static const _STAGE_TEXT_WIDTH:int = 90; // 横幅 private static const _STAGE_TEXT_HEIGHT:int = 20; // 縦幅 private static const _EVENT_TEXT_X:int = 468; // X位置 private static const _EVENT_TEXT_Y:int = 430; // X位置 private static const _EVENT_TEXT_WIDTH:int = 90; // 横幅 private static const _EVENT_TEXT_HEIGHT:int = 20; // 縦幅 // チップヘルプの設定(上記HELPステート分必要) private var _helpTextArray:Array = [ // ["地形の詳細です。"], [_TRANS_MSG], ]; // チップヘルプを設定される側のUIComponetオブジェクト private var _toolTipOwnerArray:Array = []; // チップヘルプのステート private const _QUEST_HELP:int = 0; /** * コンストラクタ * */ public function QuestDataClip() { } // ツールチップが必要なオブジェクトをすべて追加する private function initilizeToolTipOwners():void { toolTipOwnerArray.push([0,_mapData]); // } protected override function get helpTextArray():Array /* of String or Null */ { return _helpTextArray; } protected override function get toolTipOwnerArray():Array /* of String or Null */ { return _toolTipOwnerArray; } public override function init():void { _nameText.x = _NAME_TEXT_X; _nameText.y = _NAME_TEXT_Y; _nameText.width = _NAME_TEXT_WIDTH; _nameText.height = _NAME_TEXT_HEIGHT; _nameText.styleName = "QuestLandDataLabel"; _dataText.x = _DATA_TEXT_X; _dataText.y = _DATA_TEXT_Y; _dataText.width = _DATA_TEXT_WIDTH; _dataText.height = _DATA_TEXT_HEIGHT; _dataText.styleName = "QuestLandDataLabel"; // _eventText.x = _EVENT_TEXT_X; // _eventText.y = _EVENT_TEXT_Y; // _eventText.width = _EVENT_TEXT_WIDTH; // _eventText.height = _EVENT_TEXT_HEIGHT; // _eventText.styleName = "QuestLandDataLabel"; _stageText.x = _STAGE_TEXT_X; _stageText.y = _STAGE_TEXT_Y; _stageText.width = _STAGE_TEXT_WIDTH; _stageText.height = _STAGE_TEXT_HEIGHT; _stageText.styleName = "QuestLandDataLabel"; _mapData.getShowThread(this,0).start(); _commanData.getShowThread(this,2).start(); addChild(_nameText); addChild(_dataText); // addChild(_eventText); // addChild(_stageText); initilizeToolTipOwners(); updateHelp(_QUEST_HELP); _ctrl.addEventListener(QuestCtrl.QUEST_LAND_UPDATE, updateHandler); // _mapData.drop.addEventListener(MouseEvent.CLICK, pushDropHandler); } // 後始末処理 public override function final():void { _mapData.getHideThread().start(); _commanData.getHideThread().start(); RemoveChild.apply(_nameText); RemoveChild.apply(_dataText); // removeChild(_eventText); // removeChild(_stageText); // ここでハンドラを取り除く _ctrl.removeEventListener(QuestCtrl.QUEST_LAND_UPDATE, updateHandler); // _mapData.drop.removeEventListener(MouseEvent.CLICK, pushDropHandler); } // private function pushDropHandler(e:MouseEvent):void // { // _ctrl.deleteQuest(_ctrl.currentQuestInventory.inventoryID); // _ctrl.currentMap = Quest.ID(0); // } private function updateHandler(e:Event):void { if(_ctrl.currentLand.id != 0) { _questLandClip = new QuestLandClip(_ctrl.currentLand, 0, 0, false, true); _questLandClip.x = _LAND_X; _questLandClip.y = _LAND_Y; _questLandClip.getShowThread(this).start(); _nameText.text = _ctrl.currentLand.name; _dataText.text = _ctrl.currentLand.caption; // _eventText.text = _ctrl.currentLand.eventString; _stageText.text = _ctrl.currentLand.stageString; // By_K2 (무한의 탑 층 표시) if (_ctrl.currentLand.id >= 99991 && _ctrl.currentLand.id <= 99996) { _dataText.text = Player.instance.avatar.floorCount + " 층"; } else { _dataText.text = _ctrl.currentLand.caption; } } else { if(_questLandClip) { _questLandClip.getHideThread().start(); _questLandClip = null; } _nameText.text = ""; _dataText.text = ""; // _eventText.text = ""; _stageText.text = ""; } } } }
34.213389
89
0.553015
406a08904fb87de653c469e9f0a38b8b2c03117a
297
as
ActionScript
data/DofusInvoker/scripts/flashx/textLayout/formats/ITabStopFormat.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
10
2019-11-10T21:24:38.000Z
2021-05-24T23:56:36.000Z
data/DofusInvoker/scripts/flashx/textLayout/formats/ITabStopFormat.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
15
2021-01-27T21:41:58.000Z
2021-03-03T16:47:19.000Z
data/DofusInvoker/scripts/flashx/textLayout/formats/ITabStopFormat.as
bot4dofus/Datafus
126838a84b0e41d5486d735aa38d78deeb8d6681
[ "MIT" ]
3
2021-11-08T22:58:20.000Z
2022-02-09T22:22:33.000Z
package flashx.textLayout.formats { public interface ITabStopFormat { function getStyle(param1:String) : *; function get position() : *; function get alignment() : *; function get decimalAlignmentToken() : *; } }
18.5625
48
0.531987
270fd67778d8098f8b4de6feac6f7b6f91d8f6fb
207
as
ActionScript
ResourceHelper4eiyaEngine/external/com/hurlant/eval/ast/LiteralExpr.as
wJsJwr/eiya
5d437f9f659362cc04d3a24d5bdfd5f30f52c6f4
[ "MIT" ]
3
2019-01-06T10:11:00.000Z
2019-04-26T07:03:51.000Z
ResourceHelper4eiyaEngine/external/com/hurlant/eval/ast/LiteralExpr.as
wJsJwr/eiya
5d437f9f659362cc04d3a24d5bdfd5f30f52c6f4
[ "MIT" ]
null
null
null
ResourceHelper4eiyaEngine/external/com/hurlant/eval/ast/LiteralExpr.as
wJsJwr/eiya
5d437f9f659362cc04d3a24d5bdfd5f30f52c6f4
[ "MIT" ]
null
null
null
package com.hurlant.eval.ast { public class LiteralExpr implements IAstExpr { public var literal : IAstLiteral; public function LiteralExpr(literal) { this.literal = literal; } } }
20.7
45
0.681159
cf94dc24d3f05f5b86e24e1084314d2d6ab5b655
1,476
as
ActionScript
native_extension/VisionCloudLabelANE/src/com/tuarua/firebase/ml/vision/label/VisionImageLabel.as
mrchnk/Firebase-ANE
2dd635c5186e423aa09b313eb91e8e331426b0b6
[ "Apache-2.0" ]
30
2018-06-10T15:59:55.000Z
2021-07-28T08:18:21.000Z
native_extension/VisionCloudLabelANE/src/com/tuarua/firebase/ml/vision/label/VisionImageLabel.as
mrchnk/Firebase-ANE
2dd635c5186e423aa09b313eb91e8e331426b0b6
[ "Apache-2.0" ]
29
2018-09-04T19:09:04.000Z
2021-05-03T16:05:02.000Z
native_extension/VisionCloudLabelANE/src/com/tuarua/firebase/ml/vision/label/VisionImageLabel.as
mrchnk/Firebase-ANE
2dd635c5186e423aa09b313eb91e8e331426b0b6
[ "Apache-2.0" ]
5
2019-01-25T10:42:03.000Z
2021-04-16T17:56:58.000Z
/* * Copyright 2019 Tua Rua Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tuarua.firebase.ml.vision.label { [RemoteClass(alias="com.tuarua.firebase.ml.vision.label.VisionImageLabel")] /** * Represents a label for an image. */ public class VisionImageLabel { /** * Confidence for the label in range [0, 1]. */ public var confidence:Number; /** * Opaque entity ID. Some IDs may be available in [Google Knowledge Graph Search API]. * (https://developers.google.com/knowledge-graph/). */ public var entityId:String; /** * <p>The human readable label string in American English. For example: "Balloon".</p> * * <p>Note: this is not fit for display purposes, as it is not localized. Use the <code>entityId</code> and query<br> * the Knowledge Graph to get a localized description of the label.</p> */ public var text:String; public function VisionImageLabel() { } } }
35.142857
121
0.693089
6acd8f0e998c339a949969b524b4cd4502dfe29c
4,368
as
ActionScript
com/adobe/cairngorm/business/Consumers.as
peter517/Cairngorm
72d29d7efa23b9537a928bf32b9dbde63f824447
[ "BSD-3-Clause" ]
1
2020-04-26T05:22:30.000Z
2020-04-26T05:22:30.000Z
com/adobe/cairngorm/business/Consumers.as
peter517/Cairngorm
72d29d7efa23b9537a928bf32b9dbde63f824447
[ "BSD-3-Clause" ]
null
null
null
com/adobe/cairngorm/business/Consumers.as
peter517/Cairngorm
72d29d7efa23b9537a928bf32b9dbde63f824447
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Adobe Systems Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @ignore */ package com.adobe.cairngorm.business { import com.adobe.cairngorm.CairngormError; import com.adobe.cairngorm.CairngormMessageCodes; import flash.utils.Dictionary; import mx.messaging.Consumer; /** * Used to manage all Consumer's defined on the IServiceLocator instance. */ internal class Consumers extends AbstractServices { private var services : Dictionary = new Dictionary(); /** * Register the services. * @param serviceLocator the IServiceLocator instance. */ public override function register( serviceLocator : IServiceLocator ) : void { var accessors : XMLList = getAccessors( serviceLocator ); for ( var i : uint = 0; i < accessors.length(); i++ ) { var name : String = accessors[ i ]; var obj : Object = serviceLocator[ name ]; if ( obj is Consumer ) { services[ name ] = obj; } } } /** * Return the service with the given name. * @param name the name of the service. * @return the service. */ public override function getService( name : String ) : Object { var service : Consumer = services[ name ]; if ( service == null ) { throw new CairngormError( CairngormMessageCodes.CONSUMER_NOT_FOUND, name ); } return service; } /** * Set the credentials for all registered services. * @param username the username to set. * @param password the password to set. */ public override function setCredentials( username : String, password : String ) : void { for ( var name : String in services ) { var service : Consumer = services[ name ]; service.logout(); service.setCredentials( username, password ); } } /** * Set the remote credentials for all registered services. * @param username the username to set. * @param password the password to set. */ public override function setRemoteCredentials( username : String, password : String ) : void { for ( var name : String in services ) { var service : Consumer = services[ name ]; service.setRemoteCredentials( username, password ); } } /** * Log the user out of all registered services. */ public override function logout() : void { for ( var name : String in services ) { var service : Consumer = services[ name ]; service.logout(); } } } }
33.860465
98
0.631639
a5a6493ebfa8e4f1e7710b4713166d18bd2e620d
845
as
ActionScript
example/test/asproj/src/human/Human.as
Halliwood/as2ts
4f32e019e10eb9c873f0fc29ecee392b7d9b2d7c
[ "Apache-2.0" ]
21
2020-08-15T16:17:09.000Z
2022-02-28T16:22:13.000Z
example/test/asproj/src/human/Human.as
Halliwood/as2ts
4f32e019e10eb9c873f0fc29ecee392b7d9b2d7c
[ "Apache-2.0" ]
null
null
null
example/test/asproj/src/human/Human.as
Halliwood/as2ts
4f32e019e10eb9c873f0fc29ecee392b7d9b2d7c
[ "Apache-2.0" ]
3
2020-09-23T06:41:57.000Z
2020-12-07T07:12:11.000Z
package human { public class Human { // 变量类型将被替换 protected var _name: String; protected var _age: int; protected var _gender: int; public function Human() { super(); } public function set age(value: int): void { // 这里缺省了this指针 if(value < _age) { // trace将被替换为console.log trace("I become younger"); } else if(value > _age) { trace("I become oldder"); } _age = value; } public function hello(): void { trace("I'm " + _name + "."); } public function howOldAreYou(): void { trace("I'm " + _age); } public function passToDo(callback: Function): void { callback(); } } }
24.142857
60
0.455621
b8bc41acd590b02bf99f043f665592c94fee774b
1,280
as
ActionScript
GeneticAlgorithmFlash/src/com/wg/ga/missile/map/MapObject.as
refracta/genetic-algorithm
12f72d4d95a9f24a011a2d61861ad05616b8d59a
[ "MIT" ]
null
null
null
GeneticAlgorithmFlash/src/com/wg/ga/missile/map/MapObject.as
refracta/genetic-algorithm
12f72d4d95a9f24a011a2d61861ad05616b8d59a
[ "MIT" ]
null
null
null
GeneticAlgorithmFlash/src/com/wg/ga/missile/map/MapObject.as
refracta/genetic-algorithm
12f72d4d95a9f24a011a2d61861ad05616b8d59a
[ "MIT" ]
null
null
null
/** * 개발자 : refracta * 날짜 : 2014-08-15 오전 12:40 */ package com.wg.ga.missile.map { import com.wg.ga.missile.*; import flash.display.MovieClip; public class MapObject { private var _missileMap:MissileMap; private var _expressionObject:MovieClip; public function get missileMap():MissileMap { return _missileMap; } public function set missileMap(value:MissileMap):void { _missileMap = value; } public function set expressionObject(value:MovieClip):void { _expressionObject = value; } public function get expressionObject():MovieClip { return _expressionObject; } public function MapObject(missileMap:MissileMap, initExpressionBoolean:Boolean = false) { this._missileMap = missileMap; if (initExpressionBoolean) { initExpression(); } } public function initExpression() { this._expressionObject = new MovieClip(); this._expressionObject.graphics.beginFill(0xff0000, 1.0); this._expressionObject.graphics.drawRect(0, 0, _missileMap.objectSize, _missileMap.objectSize); } public function getLocation():MapLocation { for (var x:int = 0; x < _missileMap.mapData.length; x++) { var indexOf:int = _missileMap.mapData[x].indexOf(this); if (indexOf != -1) { return new MapLocation(x, indexOf); } } return null; } } }
22.45614
97
0.727344
74596f12c75534391902144895f1febc51681b82
9,001
as
ActionScript
src/org/osflash/ui/components/themes/graphic/analog/UIAnalogRotaryKnobView.as
SimonRichardson/as3-uicomponents
6c15368384662e375d69796b7ef91921766c9243
[ "MIT" ]
null
null
null
src/org/osflash/ui/components/themes/graphic/analog/UIAnalogRotaryKnobView.as
SimonRichardson/as3-uicomponents
6c15368384662e375d69796b7ef91921766c9243
[ "MIT" ]
null
null
null
src/org/osflash/ui/components/themes/graphic/analog/UIAnalogRotaryKnobView.as
SimonRichardson/as3-uicomponents
6c15368384662e375d69796b7ef91921766c9243
[ "MIT" ]
null
null
null
package org.osflash.ui.components.themes.graphic.analog { import org.osflash.signals.ISignal; import org.osflash.signals.natives.NativeSignal; import org.osflash.ui.components.analog.IUIAnalogRotaryKnobView; import org.osflash.ui.components.analog.UIAnalogRotaryKnob; import org.osflash.ui.components.analog.UIAnalogRotaryKnobModel; import org.osflash.ui.components.analog.UIAnalogRotaryKnobSignalProxy; import org.osflash.ui.components.component.IUIComponent; import org.osflash.ui.components.component.UIComponentStateAction; import org.osflash.ui.components.themes.graphic.component.IUIComponentViewConfig; import org.osflash.ui.components.themes.graphic.component.UIGraphicComponentView; import org.osflash.ui.components.themes.graphic.component.UIGraphicsData; import org.osflash.ui.signals.ISignalTarget; import flash.display.DisplayObjectContainer; import flash.display.Shape; import flash.events.Event; import flash.geom.Point; /** * @author Simon Richardson - simon@ustwo.co.uk */ public class UIAnalogRotaryKnobView extends UIGraphicComponentView implements IUIAnalogRotaryKnobView { private static const ANGLE_MIN : Number = Math.PI / 4 * 3; private static const ANGLE_MAX : Number = Math.PI / 4 * 6; /** * @private */ private var _component : UIAnalogRotaryKnob; /** * @private */ private var _container : DisplayObjectContainer; /** * @private */ private var _model : UIAnalogRotaryKnobModel; /** * @private */ private var _signalProxy : UIAnalogRotaryKnobSignalProxy; /** * @private */ private var _background : Shape; /** * @private */ private var _knob : Shape; /** * @private */ private var _config : IUIAnalogRotaryKnobViewConfig; /** * @private */ private var _colourScheme : IUIAnalogRotaryKnobColourScheme; /** * @private */ private var _backgroundGraphicsData : UIGraphicsData; /** * @private */ private var _knobGraphicsData : UIGraphicsData; /** * @private */ private var _radius : int; /** * @private */ private var _lastMousePos : Point; /** * @private */ private var _mouseDown : Boolean; /** * @private */ private var _position : Number; /** * @private */ private var _positionTarget : Number; /** * @private */ private var _animating : Boolean; /** * @private */ private var _positionStoredValue : Boolean; /** * @private */ private var _nativeEnterFrameSignal : ISignal; public function UIAnalogRotaryKnobView(config : IUIAnalogRotaryKnobViewConfig) { super(); _config = config; } /** * @inheritDoc */ override public function bind(component : IUIComponent) : void { super.bind(component); _component = UIAnalogRotaryKnob(component); _container = _component.displayObjectContainer; _container.addChild(_background = new Shape()); _container.addChild(_knob = new Shape()); _model = UIAnalogRotaryKnobModel(_component.model); _signalProxy = UIAnalogRotaryKnobSignalProxy(_component.signalProxy); _signalProxy.action.add(handleActionSignal); _signalProxy.position.add(handlePositionSignal); initConfig(_config); _lastMousePos = new Point(); _position = 0; _positionTarget = 0; _positionStoredValue = false; _mouseDown = false; _animating = false; _nativeEnterFrameSignal = new NativeSignal(_container, Event.ENTER_FRAME); } /** * @inheritDoc */ override public function unbind() : void { _component = null; _container = null; if(null != _background) { if(null != _background.parent) _background.parent.removeChild(_background); _background = null; } if(null != _signalProxy) { _signalProxy.action.remove(handleActionSignal); _signalProxy = null; } super.unbind(); } /** * @inheritDoc */ override public function captureTarget(point : Point) : ISignalTarget { if(!_container.visible || !_component.enabled) return null; const local : Point = _container.globalToLocal(point); const dx : Number = local.x - _radius; const dy : Number = local.y - _radius; const distance : Number = Math.sqrt((dx * dx) + (dy * dy)); return (distance <= _radius) ? _component : null; } /** * @inheritDoc */ override public function resizeTo(width : int, height : int) : void { super.resizeTo(width, height); _radius = width * 0.5; repaint(); updateKnob(); } /** * @private */ override protected function initConfig(config : IUIComponentViewConfig) : void { super.initConfig(config); _colourScheme = _config.colourScheme; _knobGraphicsData = _colourScheme.knobUp; _backgroundGraphicsData = _colourScheme.backgroundUp; } /** * @private */ protected function repaint() : void { graphics.context(_background.graphics); graphics.clear(); graphics.style(_backgroundGraphicsData); graphics.drawCircle(innerBounds.x + _radius, innerBounds.y + _radius, _radius); graphics.endFill(); } /** * @private */ protected function repaintKnob() : void { const angle: Number = ( Math.PI / 4 * 3 ) + _model.position * ( Math.PI / 4 * 6 ); const cs: Number = Math.cos( angle ); const sn: Number = Math.sin( angle ); const r1: Number = _radius - (_radius * 0.25); graphics.context(_knob.graphics); graphics.clear(); graphics.style(_knobGraphicsData); graphics.drawCircle((cs * r1) + _radius, (sn * r1) + _radius, _radius * 0.1); graphics.endFill(); _positionStoredValue = false; } /** * @private */ protected function updateKnob() : void { if(_mouseDown) return; if(_animating) _positionStoredValue = true; else repaintKnob(); } /** * @private */ protected function handleActionSignal(value : int) : void { if((value & UIComponentStateAction.PRESSED) != 0) { _knobGraphicsData = _colourScheme.knobDown; _backgroundGraphicsData = _colourScheme.backgroundDown; } else { if((value & UIComponentStateAction.HOVERED) != 0) { _knobGraphicsData = _colourScheme.knobOver; _backgroundGraphicsData = _colourScheme.backgroundOver; } else { _knobGraphicsData = _colourScheme.knobUp; _backgroundGraphicsData = _colourScheme.backgroundUp; } } repaint(); updateKnob(); } /** * @private */ protected function handlePositionSignal(value : Number) : void { updateKnob(); value; } /** * @inheritDoc */ override protected function handleMouseDownSignal( target : ISignalTarget, mousePos : Point ) : void { super.handleMouseDownSignal(target, mousePos); _mouseDown = true; _nativeEnterFrameSignal.add(handleEnterFrameSignal); } /** * @private */ protected function handleEnterFrameSignal(event : Event) : void { var speed : Number; // Handle mouse down if(_mouseDown) { speed = 0.4; _position -= (_container.mouseY - _lastMousePos.y) / 100; if(_position < 0) _position = 0; else if(_position > 1) _position = 1; } else { speed = 0.25; const diff : Number = _position - _positionTarget; const abs : Number = diff < 0 ? -diff : diff; if(abs < 0.005) { _animating = false; _nativeEnterFrameSignal.remove(handleEnterFrameSignal); if(_positionStoredValue) repaintKnob(); return; } } _animating = true; _positionTarget += (_position - _positionTarget) * speed; if(_positionTarget < 0) _positionTarget = 0; else if(_positionTarget > 1) _positionTarget = 1; _lastMousePos.x = _container.mouseX; _lastMousePos.y = _container.mouseY; const angle: Number = ANGLE_MIN + _positionTarget * ANGLE_MAX; const cos1: Number = Math.cos( angle ); const sin1: Number = Math.sin( angle ); const radius: Number = _radius - (_radius * 0.25); graphics.context(_knob.graphics); graphics.clear(); graphics.style(_knobGraphicsData); graphics.drawCircle((cos1 * radius) + _radius, (sin1 * radius) + _radius, _radius * 0.1); graphics.endFill(); _model.position = _position; } /** * @inheritDoc */ override protected function handleMouseUpSignal( target : ISignalTarget, mousePos : Point ) : void { super.handleMouseUpSignal(target, mousePos); _mouseDown = false; } } }
22.615578
92
0.629597
59d8382e66d1acea209053cf7eabc2af63ad3aa7
6,986
as
ActionScript
src/pl/onthemoon/starEngine/camera/Camera.as
N0N4M3pl/StarEngine
4e75b3c0b3f372ca053f06a3dbf17ef01bfd9aa9
[ "MIT" ]
1
2015-12-25T18:38:58.000Z
2015-12-25T18:38:58.000Z
src/pl/onthemoon/starEngine/camera/Camera.as
N0N4M3pl/StarEngine
4e75b3c0b3f372ca053f06a3dbf17ef01bfd9aa9
[ "MIT" ]
null
null
null
src/pl/onthemoon/starEngine/camera/Camera.as
N0N4M3pl/StarEngine
4e75b3c0b3f372ca053f06a3dbf17ef01bfd9aa9
[ "MIT" ]
null
null
null
package pl.onthemoon.starEngine.camera { import flash.geom.Rectangle; import flash.utils.Dictionary; import pl.onthemoon.starEngine.StarEngine; import pl.onthemoon.starEngine.layer.Layer; import starling.animation.Transitions; import starling.animation.Tween; public class Camera { //-------------------------------------------------------------------------- // PROPERTIES //-------------------------------------------------------------------------- // public static const TRANSITION_SHAKE:String = "shake"; // private static const _TRANSITION_FACTOR_6:Number = Math.PI * 6; //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- protected var _engine:StarEngine; protected var _layers:Dictionary; protected var _frameWidth:int; protected var _frameHeight:int; protected var _frameWidthHalf:int; protected var _frameHeightHalf:int; protected var _border:Rectangle; protected var _borderRightNoFrame:int; protected var _borderBottomNoFrame:int; protected var _centeredX:int; protected var _centeredY:int; protected var _zoom:Number; protected var _zoomFrameWidth:int; protected var _zoomFrameHeight:int; protected var _zoomFrameWidthHalf:int; protected var _zoomFrameHeightHalf:int; protected var _zoomBorderRightNoFrame:int; protected var _zoomBorderBottomNoFrame:int; public var _posX:int; public var _posY:int; protected var _fixedX:int; protected var _fixedY:int; protected var _tweenPos:Tween; protected var _tweenMod:Tween; //-------------------------------------------------------------------------- // CONSTRUCTOR //-------------------------------------------------------------------------- public function Camera() { _border = new Rectangle(); _centeredX = -1; _centeredY = -1; _posX = 0; _posY = 0; _zoom = 1; _tweenPos = new Tween(this, 1); _tweenMod = new Tween(this, 1); // Transitions.register(TRANSITION_SHAKE, transitionShake); } //-------------------------------------------------------------------------- // METHODS - private static //-------------------------------------------------------------------------- /*private static function transitionShake(ratio:Number):Number { return Math.sin(ratio * _TRANSITION_FACTOR_6) * (1 - (ratio * ratio)); }*/ //-------------------------------------------------------------------------- // METHODS - public //-------------------------------------------------------------------------- public function get border():Rectangle { return _border; } public function get zoom():Number { return _zoom; } //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- public function initialize(engine:StarEngine):void { _engine = engine; _layers = _engine.layerGetAll(); } public function destroy():void { _engine = null; _layers = null; } //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- public function setupFrame(width:int, height:int):void { _frameWidth = width; _frameHeight = height; _frameWidthHalf = width >> 1; _frameHeightHalf = height >> 1; calculateHelpValues(); } public function setupBorder(left:int, top:int, right:int, bottom:int):void { _border.left = left; _border.top = top; _border.right = right; _border.bottom = bottom; calculateHelpValues(); } //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- public function setPosition(x:int, y:int):void { _posX = x; _posY = y; fixPosition(); } public function setPositionSmooth(x:int, y:int, time:Number = 1):void { _engine.juggler.remove(_tweenPos); _tweenPos.reset(this, time, Transitions.EASE_OUT); _tweenPos.animate("_posX", x); _tweenPos.animate("_posY", y); _tweenPos.onUpdate = fixPosition; _engine.juggler.add(_tweenPos); } //-------------------------------------------------------------------------- public function setZoom(value:Number = 1):void { _zoom = value; _engine.scaleX = _zoom; _engine.scaleY = _zoom; calculateHelpValues(); fixPosition(); } public function calculateZoomShowAll():Number { var factorWidth:Number = _frameWidth / _border.width; var factorHeight:Number = _frameHeight / _border.height; if (factorWidth < 1 || factorHeight < 1) { return Math.min(factorWidth, factorHeight); } return 1; } //-------------------------------------------------------------------------- /*public function shake(forceX:Number, forceY:Number, time:Number = 0.6):void { xMod = 0; yMod = 0; _engine.juggler.remove(_tweenMod); _tweenMod.reset(this, time, transitionShake); if (forceX != 0) { _tweenMod.animate("xMod", forceX); } if (forceY != 0) { _tweenMod.animate("yMod", forceY); } _tweenMod.onUpdate = updatePosition; _engine.juggler.add(_tweenMod); }*/ //-------------------------------------------------------------------------- // METHODS - protected //-------------------------------------------------------------------------- protected function calculateHelpValues():void { _zoomFrameWidth = _frameWidth / _zoom; _zoomFrameHeight = _frameHeight / _zoom; _zoomFrameWidthHalf = _zoomFrameWidth >> 1; _zoomFrameHeightHalf = _zoomFrameHeight >> 1; _borderRightNoFrame = _border.right - _frameWidth; _borderBottomNoFrame = _border.bottom - _frameHeight; _zoomBorderRightNoFrame = _border.right - _zoomFrameWidth; _zoomBorderBottomNoFrame = _border.bottom - _zoomFrameHeight; _centeredX = (_zoomFrameWidth - _border.width) * 0.5; _centeredY = (_zoomFrameHeight - _border.height) * 0.5; } protected function fixPosition():void { if (_centeredX >= 0) { _fixedX = _centeredX - _border.left; } else { _fixedX = _posX - _zoomFrameWidthHalf; if (_fixedX < _border.left) { _fixedX = _border.left; } else if (_fixedX > _zoomBorderRightNoFrame) { _fixedX = _zoomBorderRightNoFrame; } _fixedX = -_fixedX; } if (_centeredY >= 0) { _fixedY = _centeredY - _border.top; } else { _fixedY = _posY - _zoomFrameHeightHalf; if (_fixedY < _border.top) { _fixedY = _border.top; } else if (_fixedY > _zoomBorderBottomNoFrame) { _fixedY = _zoomBorderBottomNoFrame; } _fixedY = -_fixedY; } updatePosition(); } protected function updatePosition():void { var layer:Layer; for each (layer in _layers) { layer.xScaled = _fixedX; layer.yScaled = _fixedY; } } //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- } }
28.056225
80
0.528915
c8e72a749c537a67f7e9d0c9077e8d42ad4ab6ea
2,267
as
ActionScript
src/net/sfmultimedia/argonaut/type/ClassMapFactory.as
alecmce/Argonaut
2a1e9b5c563db6118de5080e2136048b558c556c
[ "MIT" ]
1
2021-01-04T12:13:23.000Z
2021-01-04T12:13:23.000Z
src/net/sfmultimedia/argonaut/type/ClassMapFactory.as
alecmce/Argonaut
2a1e9b5c563db6118de5080e2136048b558c556c
[ "MIT" ]
null
null
null
src/net/sfmultimedia/argonaut/type/ClassMapFactory.as
alecmce/Argonaut
2a1e9b5c563db6118de5080e2136048b558c556c
[ "MIT" ]
null
null
null
package net.sfmultimedia.argonaut.type { import flash.utils.describeType; import flash.utils.getDefinitionByName; public class ClassMapFactory { private const DONT_SERIALIZE:String = "DontSerialize"; public var typeFactory:DataTypeFactory; private var cached:Object; public function ClassMapFactory(typeFactory:DataTypeFactory) { this.typeFactory = typeFactory; cached = {}; } public function makeClassMap(definition:String):ClassTypeMap { return cached[definition] || generateClassMap(definition); } private function generateClassMap(definition:String):ClassTypeMap { var map:ClassTypeMap = new ClassTypeMap(); cached[definition] = map; populateClassMap(definition, map); return map; } private function populateClassMap(definition:String, map:ClassTypeMap):void { var klass:Class = getDefinitionByName(definition) as Class; var xmlDescriptionOfClass:XML = describeType(klass); addMappings(xmlDescriptionOfClass.factory.variable, map); addMappings(xmlDescriptionOfClass.factory.accessor, map); addMappings(xmlDescriptionOfClass.factory.constant, map); } private function addMappings(xmlList:XMLList, map:ClassTypeMap):void { for each (var node:XML in xmlList) { addMapping(node, map); } } private function addMapping(node:XML, map:ClassTypeMap):void { if (isSerializable(node) && isReadable(node)) { var name:String = node.@name; var type:String = node.@type; var dataType:DataType = typeFactory.getTypeFromDefinition(type); map.setType(name, dataType); } } private function isSerializable(node:XML):Boolean { return node..metadata.(@name == DONT_SERIALIZE).length() == 0; } private function isReadable(node:XML):Boolean { return node.localName() != "accessor" || node.@access != "writeonly"; } } }
31.054795
83
0.59506
817879f69e23b54e18e39def7903b93d104a2c91
2,420
as
ActionScript
src/org/vancura/vaclav/widgets/interfaces/IGlyphLabelButton.as
vancura/vancura-as3-libs
9c93462ac4586e00b9a13b531456acd7d94f636b
[ "Unlicense" ]
1
2016-05-19T14:44:21.000Z
2016-05-19T14:44:21.000Z
src/org/vancura/vaclav/widgets/interfaces/IGlyphLabelButton.as
vancura/vancura-as3-libs
9c93462ac4586e00b9a13b531456acd7d94f636b
[ "Unlicense" ]
null
null
null
src/org/vancura/vaclav/widgets/interfaces/IGlyphLabelButton.as
vancura/vancura-as3-libs
9c93462ac4586e00b9a13b531456acd7d94f636b
[ "Unlicense" ]
null
null
null
/*********************************************************************************************************************** * Copyright (c) 2010. Vaclav Vancura. * Contact me at vaclav@vancura.org or see my homepage at vaclav.vancura.org * Project's GIT repo: http://github.com/vancura/vancura-as3-libs * Documentation: http://doc.vaclav.vancura.org/vancura-as3-libs * * 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.vancura.vaclav.widgets.interfaces { public interface IGlyphLabelButton extends IWidget { function forceRelease():void; function autoWidth(padding:Number, max:Number = 500):void function get skin():IGlyphLabelButtonSkin; function set skin(skin:IGlyphLabelButtonSkin):void; function set areEventsEnabled(value:Boolean):void; function get areEventsEnabled():Boolean; function get mouseStatus():String; function set mouseStatus(value:String):void; function get text():String; function set text(value:String):void; function get glyph():IImage; function get glyphOut():IImage; function get glyphHover():IImage; function get glyphFocus():IImage; function get label():ILabel; function get labelOut():ILabel; function get labelHover():ILabel; function get labelFocus():ILabel; function get button():IButton; } }
42.45614
120
0.688843
bc3707312442e89825f7339287c35ed4c4bc3039
463
as
ActionScript
Entry/src/ninjaStorage/command/OpenNinjaStorageCommand.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
6
2016-10-13T18:08:03.000Z
2021-05-30T20:46:51.000Z
Entry/src/ninjaStorage/command/OpenNinjaStorageCommand.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
null
null
null
Entry/src/ninjaStorage/command/OpenNinjaStorageCommand.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
1
2016-10-13T18:17:38.000Z
2016-10-13T18:17:38.000Z
package ninjaStorage.command { import com.tencent.morefun.framework.base.Command; import def.PluginDef; public class OpenNinjaStorageCommand extends Command { public var tab:int; public function OpenNinjaStorageCommand(param1:int) { super(); this.tab = param1; } override public function getPluginName() : String { return PluginDef.NINJA_STORAGE; } } }
20.130435
57
0.611231
e2104efb98446ea9870a0a9085dc5da63e412b96
613
as
ActionScript
MAIN/Code/LibWSClient/src/wsForm/CommandNativeMenuItem.as
neurospeech/wsclient-plus-plus
f0d34bb53f4a8267ef078b1a60377f54af2db75d
[ "MIT" ]
null
null
null
MAIN/Code/LibWSClient/src/wsForm/CommandNativeMenuItem.as
neurospeech/wsclient-plus-plus
f0d34bb53f4a8267ef078b1a60377f54af2db75d
[ "MIT" ]
1
2020-12-30T15:49:37.000Z
2021-09-04T05:58:20.000Z
MAIN/Code/LibWSClient/src/wsForm/CommandNativeMenuItem.as
neurospeech/wsclient-plus-plus
f0d34bb53f4a8267ef078b1a60377f54af2db75d
[ "MIT" ]
null
null
null
package wsForm { import com.neuro.command.GenericCommand; import flash.display.NativeMenuItem; import flash.events.Event; public class CommandNativeMenuItem extends NativeMenuItem { public function CommandNativeMenuItem(label:String="", isSeparator:Boolean=false, cmd:GenericCommand = null) { super(label, isSeparator); command = cmd; this.addEventListener(Event.SELECT, onMenuClicked, false, 0 , true); } private function onMenuClicked(e:Event):void { if(command!=null) command.invokeCommand(); } public var command:GenericCommand = null; } }
24.52
111
0.709625
7adbf924bd2dc166a5fcf84ccb0d7b8ec5ad4223
2,800
as
ActionScript
data/DofusInvoker/scripts/damageCalculation/tools/MathUtils.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
10
2019-11-10T21:24:38.000Z
2021-05-24T23:56:36.000Z
data/DofusInvoker/scripts/damageCalculation/tools/MathUtils.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
15
2021-01-27T21:41:58.000Z
2021-03-03T16:47:19.000Z
data/DofusInvoker/scripts/damageCalculation/tools/MathUtils.as
bot4dofus/Datafus
126838a84b0e41d5486d735aa38d78deeb8d6681
[ "MIT" ]
3
2021-11-08T22:58:20.000Z
2022-02-09T22:22:33.000Z
package damageCalculation.tools { import mapTools.Point; public class MathUtils { public function MathUtils() { } public static function computeVector(param1:Point, param2:Point) : Point { return new Point(param2.x - param1.x,param2.y - param1.y); } public static function getDeterminant(param1:Point, param2:Point) : int { return param1.x * param2.y - param1.y * param2.x; } public static function getPositiveOrientedAngle(param1:Point, param2:Point, param3:Point) : Number { switch(MathUtils.compareAngles(param1,param2,param3).index) { case 0: return 0; case 1: return Math.PI; case 2: return Number(MathUtils.getAngle(param1,param2,param3)); case 3: return 2 * Math.PI - MathUtils.getAngle(param1,param2,param3); default: return; } } public static function getAngle(param1:Point, param2:Point, param3:Point) : Number { var _loc4_:Number = Number(MathUtils.getDistanceBetweenPoints(param2,param3)); var _loc5_:Number = Number(MathUtils.getDistanceBetweenPoints(param1,param2)); var _loc6_:Number = Number(MathUtils.getDistanceBetweenPoints(param1,param3)); return Number(Math.acos((_loc5_ * _loc5_ + _loc6_ * _loc6_ - _loc4_ * _loc4_) / (2 * _loc5_ * _loc6_))); } public static function getDistanceBetweenPoints(param1:Point, param2:Point) : Number { return Number(Math.sqrt(Number(Number(Math.pow(param1.x - param2.x,2)) + Number(Math.pow(param1.y - param2.y,2))))); } public static function compareAngles(param1:Point, param2:Point, param3:Point) : CompareAnglesEnum { var _loc4_:Point = MathUtils.computeVector(param1,param2); var _loc5_:Point = MathUtils.computeVector(param1,param3); var _loc6_:int = MathUtils.getDeterminant(_loc4_,_loc5_); if(_loc6_ != 0) { if(_loc6_ > 0) { return CompareAnglesEnum.CLOCKWISE; } return CompareAnglesEnum.COUNTERCLOCKWISE; } if(_loc4_.x >= 0 == _loc5_.x >= 0 && _loc4_.y >= 0 == _loc5_.y >= 0) { return CompareAnglesEnum.LIKE; } return CompareAnglesEnum.UNLIKE; } public static function roundWithPrecision(param1:Number, param2:Number) : Number { param1 *= Number(Math.pow(10,param2)); return int(Math.round(param1)) / Math.pow(10,param2); } } }
35
126
0.569286
6e49b46f10d7970c5bc565e3d209c62af52a6606
1,940
as
ActionScript
rockdot/source/flash/lib/org/springextensions/actionscript/ioc/config/impl/metadata/customscanner/AbstractCustomConfigurationClassScanner.as
blockforest/rockdot-actionscript
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
1
2016-07-14T23:17:30.000Z
2016-07-14T23:17:30.000Z
rockdot/source/flash/lib/org/springextensions/actionscript/ioc/config/impl/metadata/customscanner/AbstractCustomConfigurationClassScanner.as
acanvas/acanvas-actionscript-framework
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
null
null
null
rockdot/source/flash/lib/org/springextensions/actionscript/ioc/config/impl/metadata/customscanner/AbstractCustomConfigurationClassScanner.as
acanvas/acanvas-actionscript-framework
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
null
null
null
/* * Copyright 2007-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springextensions.actionscript.ioc.config.impl.metadata.customscanner { import org.as3commons.reflect.Metadata; import org.springextensions.actionscript.context.IApplicationContext; import org.springextensions.actionscript.ioc.config.impl.metadata.ICustomConfigurationClassScanner; import org.springextensions.actionscript.ioc.objectdefinition.IObjectDefinition; import org.springextensions.actionscript.ioc.objectdefinition.IObjectDefinitionRegistry; import flash.errors.IllegalOperationError; /** * * @author Roland Zwaga */ public class AbstractCustomConfigurationClassScanner implements ICustomConfigurationClassScanner { private var _metadataNames:Vector.<String>; /** * Creates a new <code>AbstractCustomMetadataConfigurator</code> instance. */ public function AbstractCustomConfigurationClassScanner() { super(); _metadataNames = new Vector.<String>(); } public function get metadataNames():Vector.<String> { return _metadataNames; } public function execute(metadata:Metadata, objectName:String, objectDefinition:IObjectDefinition, objectDefinitionsRegistry:IObjectDefinitionRegistry, applicationContext:IApplicationContext):void { throw new IllegalOperationError("Not implemented in abstract base class"); } } }
39.591837
200
0.775258
4d1f509488d22e2c3dc37ac0de8ac23c3f1e51a1
1,011
as
ActionScript
rockdot/source/flash/src/com/rockdot/plugin/ugc/command/AbstractUGCCommand.as
blockforest/rockdot-actionscript
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
1
2016-07-14T23:17:30.000Z
2016-07-14T23:17:30.000Z
rockdot/source/flash/src/com/rockdot/plugin/ugc/command/AbstractUGCCommand.as
acanvas/acanvas-actionscript-framework
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
null
null
null
rockdot/source/flash/src/com/rockdot/plugin/ugc/command/AbstractUGCCommand.as
acanvas/acanvas-actionscript-framework
9b3028c5007d35e6bbe59ef2e3449054ec85374f
[ "MIT" ]
null
null
null
package com.rockdot.plugin.ugc.command { import com.rockdot.core.mvc.CoreCommand; import com.rockdot.plugin.ugc.command.operation.PersistenceOperation; import com.rockdot.plugin.ugc.inject.IUGCModelAware; import com.rockdot.plugin.ugc.model.UGCModel; import org.as3commons.async.operation.IOperation; import org.as3commons.async.operation.event.OperationEvent; public class AbstractUGCCommand extends CoreCommand implements IUGCModelAware{ protected var _ugcModel : UGCModel; public function set ugcModel(ugcModel : UGCModel) : void { _ugcModel = ugcModel; } protected function amfOperation(string : String, object : Object = null) : void { var operation : IOperation = new PersistenceOperation(_ugcModel.service, string, object); operation.addCompleteListener(dispatchCompleteEvent); operation.addErrorListener(_handleError); } override protected function _handleError(event : OperationEvent) : void { log.error(event.error); dispatchErrorEvent(event.error); } } }
37.444444
92
0.785361
a5e422e5c8f686b9983400d6db74ae88f66de4ad
1,356
as
ActionScript
src/com/pblabs/engine/resource/MP3Resource.as
ZaaLabs/PushButtonEngine
64ff958d0375de5e7d7ca8f7f1bcb0f88bbe7b04
[ "MIT-0", "MIT" ]
3
2016-01-06T08:59:27.000Z
2021-09-02T03:18:34.000Z
src/com/pblabs/engine/resource/MP3Resource.as
zerojuan/PushButtonEngine
26130a4bbf578131d4dd94d6c7692d7ccdf0999c
[ "MIT-0", "MIT" ]
null
null
null
src/com/pblabs/engine/resource/MP3Resource.as
zerojuan/PushButtonEngine
26130a4bbf578131d4dd94d6c7692d7ccdf0999c
[ "MIT-0", "MIT" ]
5
2016-02-19T02:50:54.000Z
2019-07-22T13:58:06.000Z
/******************************************************************************* * 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.engine.resource { import flash.events.Event; import flash.events.IOErrorEvent; import flash.media.Sound; import flash.net.URLRequest; [EditorData(extensions="mp3")] /** * Load Sounds from MP3s using Flash Player's built in MP3 loading code. */ public class MP3Resource extends SoundResource { /** * The loaded sound. */ protected var _soundObject:Sound = null; override public function get soundObject() : Sound { return _soundObject; } override public function initialize(d:*):void { _soundObject = d; onLoadComplete(); } /** * @inheritDoc */ override protected function onContentReady(content:*):Boolean { return soundObject != null; } } }
28.851064
80
0.518437
a6f931a03985fa04f44d5ee10580d55bbb5eed85
2,032
as
ActionScript
spine-starling/spine-starling-example/src/Game.as
gabomdq/spine-runtimes
02a0f9c1c0a4e810e9ac0edd8bd86baaa47ba4c5
[ "BSD-2-Clause" ]
1
2020-05-28T12:12:39.000Z
2020-05-28T12:12:39.000Z
spine-starling/spine-starling-example/src/Game.as
stnguyen/spine-runtimes
bf6eaaae34aa4aa48cadb50520964d2123a6e534
[ "BSD-2-Clause" ]
null
null
null
spine-starling/spine-starling-example/src/Game.as
stnguyen/spine-runtimes
bf6eaaae34aa4aa48cadb50520964d2123a6e534
[ "BSD-2-Clause" ]
2
2016-07-30T05:53:54.000Z
2021-03-19T11:09:25.000Z
package { import spine.AnimationStateData; import spine.SkeletonData; import spine.SkeletonJson; import spine.starling.SkeletonAnimationSprite; import spine.starling.StarlingAtlasAttachmentLoader; import starling.core.Starling; import starling.display.Sprite; import starling.events.Touch; import starling.events.TouchEvent; import starling.events.TouchPhase; import starling.textures.Texture; import starling.textures.TextureAtlas; public class Game extends Sprite { [Embed(source = "spineboy.xml", mimeType = "application/octet-stream")] static public const SpineboyAtlasXml:Class; [Embed(source = "spineboy.png")] static public const SpineboyAtlasTexture:Class; [Embed(source = "spineboy.json", mimeType = "application/octet-stream")] static public const SpineboyJson:Class; private var skeleton:SkeletonAnimationSprite; public function Game () { var texture:Texture = Texture.fromBitmap(new SpineboyAtlasTexture()); var xml:XML = XML(new SpineboyAtlasXml()); var atlas:TextureAtlas = new TextureAtlas(texture, xml); var json:SkeletonJson = new SkeletonJson(new StarlingAtlasAttachmentLoader(atlas)); var skeletonData:SkeletonData = json.readSkeletonData(new SpineboyJson()); var stateData:AnimationStateData = new AnimationStateData(skeletonData); stateData.setMixByName("walk", "jump", 0.2); stateData.setMixByName("jump", "walk", 0.4); stateData.setMixByName("jump", "jump", 0.2); skeleton = new SkeletonAnimationSprite(skeletonData); skeleton.setAnimationStateData(stateData); skeleton.x = 320; skeleton.y = 420; skeleton.setAnimation("walk", true); skeleton.addAnimation("jump", false, 3); skeleton.addAnimation("walk", true); addChild(skeleton); Starling.juggler.add(skeleton); addEventListener(TouchEvent.TOUCH, onClick); } private function onClick (event:TouchEvent) : void { var touch:Touch = event.getTouch(this); if (touch && touch.phase == TouchPhase.BEGAN) { skeleton.setAnimation("jump", false); skeleton.addAnimation("walk", true); } } } }
31.261538
85
0.76624
8d7bce4c01cc34fbccbb0a41cf54e7eea8ed45ad
2,652
as
ActionScript
PLANTILLA_FLASH/TM_24369.ARENAWAREZ/sources/flash/mx/effects/Tween.as
zayro/templates-free
0eb86764d295f8a5c75e0152443df19f0b312139
[ "MIT" ]
null
null
null
PLANTILLA_FLASH/TM_24369.ARENAWAREZ/sources/flash/mx/effects/Tween.as
zayro/templates-free
0eb86764d295f8a5c75e0152443df19f0b312139
[ "MIT" ]
null
null
null
PLANTILLA_FLASH/TM_24369.ARENAWAREZ/sources/flash/mx/effects/Tween.as
zayro/templates-free
0eb86764d295f8a5c75e0152443df19f0b312139
[ "MIT" ]
null
null
null
class mx.effects.Tween extends Object { static var IntervalToken; var arrayMode, listener, initVal, endVal, startTime, updateFunc, endFunc, ID; function Tween (listenerObj, init, end, dur) { super(); if (listenerObj == undefined) { return; } if (typeof(init) != "number") { arrayMode = true; } listener = listenerObj; initVal = init; endVal = end; if (dur != undefined) { duration = dur; } startTime = getTimer(); if (duration == 0) { endTween(); } else { AddTween(this); } } static function AddTween(tween) { tween.ID = ActiveTweens.length; ActiveTweens.push(tween); if (IntervalToken == undefined) { Dispatcher.DispatchTweens = DispatchTweens; IntervalToken = setInterval(Dispatcher, "DispatchTweens", Interval); } } static function RemoveTweenAt(index) { var _local2 = ActiveTweens; if (((index >= _local2.length) || (index < 0)) || (index == undefined)) { return(undefined); } _local2.splice(index, 1); var _local4 = _local2.length; var _local1 = index; while (_local1 < _local4) { _local2[_local1].ID--; _local1++; } if (_local4 == 0) { clearInterval(IntervalToken); delete IntervalToken; } } static function DispatchTweens(Void) { var _local2 = ActiveTweens; var _local3 = _local2.length; var _local1 = 0; while (_local1 < _local3) { _local2[_local1].doInterval(); _local1++; } updateAfterEvent(); } function doInterval() { var _local2 = getTimer() - startTime; var _local3 = getCurVal(_local2); if (_local2 >= duration) { endTween(); } else if (updateFunc != undefined) { listener[updateFunc](_local3); } else { listener.onTweenUpdate(_local3); } } function getCurVal(curTime) { if (arrayMode) { var _local3 = new Array(); var _local2 = 0; while (_local2 < initVal.length) { _local3[_local2] = easingEquation(curTime, initVal[_local2], endVal[_local2] - initVal[_local2], duration); _local2++; } return(_local3); } return(easingEquation(curTime, initVal, endVal - initVal, duration)); } function endTween() { if (endFunc != undefined) { listener[endFunc](endVal); } else { listener.onTweenEnd(endVal); } RemoveTweenAt(ID); } function setTweenHandlers(update, end) { updateFunc = update; endFunc = end; } function easingEquation(t, b, c, d) { return(((c / 2) * (Math.sin(Math.PI * ((t / d) - 0.5)) + 1)) + b); } static var ActiveTweens = new Array(); static var Interval = 10; static var Dispatcher = new Object(); var duration = 3000; }
25.5
112
0.627451
796485ce29011c9ccf8ffaadd9c0e584ca4a6827
3,515
as
ActionScript
flashclient/views/panel_util/Data_Grid_2.as
lbouma/Cyclopath
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
[ "Apache-2.0" ]
15
2015-05-06T05:11:48.000Z
2021-12-03T14:56:58.000Z
flashclient/views/panel_util/Data_Grid_2.as
landonb/Cyclopath
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
[ "Apache-2.0" ]
null
null
null
flashclient/views/panel_util/Data_Grid_2.as
landonb/Cyclopath
d09d927a1e6f9e07924007fd39e8e807cd9c0f8c
[ "Apache-2.0" ]
8
2015-05-06T05:11:36.000Z
2020-11-04T05:11:22.000Z
/* Copyright (c) 2006-2013 Regents of the University of Minnesota. For licensing terms, see the file LICENSE. */ // http://cookbooks.adobe.com/post_How_to_change_datagrid_s_row_background_color_-12548.html package views.panel_util { import mx.controls.DataGrid; import mx.controls.listClasses.ListBaseContentHolder; import mx.core.FlexShape; import flash.display.Graphics; import flash.display.Shape; import flash.display.Sprite; import utils.misc.Logging; import views.panel_discussions.Widget_Post_Renderer; public class Data_Grid_2 extends DataGrid { // *** Class attributes protected static var log:Logging = Logging.get_logger('DtGrid_2'); // *** Constructor public function Data_Grid_2() { super(); } // *** /* // override protected function measure() :void { m4_DEBUG('measure: this.height: old:', this.height); super.measure(); m4_DEBUG('measure: this.height: new:', this.height); } */ /* // override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) :void { m4_DEBUG('updateDisplayList: unscaledHeight: old:', unscaledHeight); super.updateDisplayList(unscaledWidth, unscaledHeight); m4_DEBUG('updateDisplayList: unscaledHeight: new:', unscaledHeight); } */ // public function hack_height_reset(do_apply:Boolean=false) :int { var height_hack:int = 0; var num_rows:int = 0; var not_seen_holder:Boolean = true; m4_DEBUG('hack_height_reset: this.height:', this.height); for (var i:int = this.numChildren - 1; i >= 0; i--) { var contentHolder:ListBaseContentHolder = (this.getChildAt(i) as ListBaseContentHolder); if (contentHolder !== null) { m4_DEBUG('hack_height_reset: list base: i:', i); m4_DEBUG(' .. contentHolder:', contentHolder); m4_DEBUG(' .. height:', contentHolder.height); height_hack = 0; for (var j:int = contentHolder.numChildren - 1; j >= 0; j--) { var wpr:Widget_Post_Renderer = (contentHolder.getChildAt(j) as Widget_Post_Renderer); if (wpr !== null) { m4_DEBUG(' .. wpr.height:', wpr.height); if (!isNaN(wpr.height)) { height_hack += wpr.height; num_rows += 1; } } } m4_DEBUG2('hack_height_reset: i:', i, '/ pre-height_hack:', height_hack); if (height_hack > 0) { // Usually this.height is set, but the rows are not // populated. if (num_rows > 1) { height_hack += (4 * (num_rows - 1)); } height_hack += 1; if (do_apply) { this.height = height_hack; contentHolder.height = height_hack; } not_seen_holder = false; } } // else, may or may not_seen_holder, but no child's height is set. } // return height_hack; } } }
33.160377
92
0.521479
a26484f85187d45e6c2d9a4895496143edd66914
4,182
as
ActionScript
src/js/classes/singularity/demos/src/Singularity/Numeric/SimpleRoot.as
nnukem/spectrumCombiner
12b976eb9042ce4bb1f73f51dcd99ebcf6c888fe
[ "MIT" ]
null
null
null
src/js/classes/singularity/demos/src/Singularity/Numeric/SimpleRoot.as
nnukem/spectrumCombiner
12b976eb9042ce4bb1f73f51dcd99ebcf6c888fe
[ "MIT" ]
null
null
null
src/js/classes/singularity/demos/src/Singularity/Numeric/SimpleRoot.as
nnukem/spectrumCombiner
12b976eb9042ce4bb1f73f51dcd99ebcf6c888fe
[ "MIT" ]
null
null
null
/** * <p>SimpleRoot.js - A straight port of Jack Crenshaw's TWBRF method for simple roots in an interval. To use, identify an interval in which * the function whose zero is desired has a sign change (via bisection, for example). Call the <code>findRoot</code> method.</p> * * Copyright (c) 2008, Jim Armstrong. All rights reserved. * * This software program is supplied 'as is' without any warranty, express, * implied, or otherwise, including without limitation all warranties of * merchantability or fitness for a particular purpose. Jim Armstrong shall not * be liable for any special incidental, or consequential damages, including, * witout limitation, lost revenues, lost profits, or loss of prospective * economic advantage, resulting from the use or misuse of this software program. * * @author Jim Armstrong, singularity (www.algorithmist.net) * * @version 1.0 */ package Singularity.Numeric { import flash.events.Event; import flash.events.EventDispatcher; public class SimpleRoot extends EventDispatcher { private static const TOL:Number = 0.000001; private static const MAX_ITER:uint = 100; private var __iter:uint; public function SimpleRoot() { super(); __iter = 0; } public function get iterations():uint { return __iter; } /** * <code>findRoot</code> finds a single root given an interval * * @param _x0:Number root isolated in interval [_x0, _x2] * @param _x2:Number root isolated in interval [_x0, _x2] * @param _f:Function reference to function whose root in the interval is desired. Function accepts a single <code>Number</code> argument. * @param _imax:uint maximum number of iterations * @default MAX_ITER * @param _eps:Number tolerance value for root * @default TOL * * @since 1.0 * * @return Number: Approximation of desired root within specified tolerance and iteration limit. In addition to too small * an iteration limit or too tight a tolerance, some patholotical numerical conditions exist under which the method may * incorrectly report a root. * */ public function findRoot(_x0:Number, _x2:Number, _f:Function, _imax:uint=MAX_ITER, _eps:Number=TOL):Number { var x0:Number; var x1:Number; var x2:Number; var y0:Number; var y1:Number; var y2:Number; var b:Number; var c:Number; var y10:Number; var y20:Number; var y21:Number; var xm:Number; var ym:Number; var temp:Number; var xmlast:Number = _x0; y0 = _f(_x0); if( y0 == 0.0 ) return _x0; y2 = _f(_x2); if( y2 == 0.0 ) return _x2; if( y2*y0 > 0.0 ) { dispatchEvent( new Event("Invalid interval - no sign change - no root") ); return _x0; } __iter = 0; x0 = _x0; x2 = _x2; for( var i:uint=0; i<_imax; ++i) { __iter++; x1 = 0.5 * (x2 + x0); y1 = _f(x1); if( y1 == 0.0 ) return x1; if( Math.abs(x1 - x0) < _eps) return x1; if( y1*y0 > 0.0 ) { temp = x0; x0 = x2; x2 = temp; temp = y0; y0 = y2; y2 = temp; } y10 = y1 - y0; y21 = y2 - y1; y20 = y2 - y0; if( y2*y20 < 2.0*y1*y10 ) { x2 = x1; y2 = y1; } else { b = (x1 - x0 ) / y10; c = (y10 - y21) / (y21 * y20); xm = x0 - b*y0*(1.0 - c*y1); ym = _f(xm); if( ym == 0.0 ) return xm; if( Math.abs(xm - xmlast) < _eps ) return xm; xmlast = xm; if( ym*y0 < 0.0 ) { x2 = xm; y2 = ym; } else { x0 = xm; y0 = ym; x2 = x1; y2 = y1; } } } dispatchEvent( new Event( "failed to converge after maximim iterations of" + __iter ) ); return x1; } } }
26.636943
140
0.545672
880f42f13c3f7ba9ccc81178a3f02b9b85710a1a
2,383
as
ActionScript
boggle_flash/src/ui/PushButton.as
adamayogo/BoggleSolver
f09e700ff250ac0ccb2c1e4aac9c37fcfe581d92
[ "MIT" ]
null
null
null
boggle_flash/src/ui/PushButton.as
adamayogo/BoggleSolver
f09e700ff250ac0ccb2c1e4aac9c37fcfe581d92
[ "MIT" ]
1
2020-11-02T00:43:20.000Z
2021-05-14T05:48:50.000Z
boggle_flash/src/ui/PushButton.as
adamayogo/BoggleSolver
f09e700ff250ac0ccb2c1e4aac9c37fcfe581d92
[ "MIT" ]
null
null
null
package ui { import flash.display.MovieClip; import flash.display.Sprite; import com.greensock.TweenMax; import flash.events.MouseEvent; import flash.text.TextField; /** * ... * @author Adam Vernon */ public class PushButton extends Sprite { //--In FLA--// public var over:Sprite; public var down:Sprite; public var labelTF:TextField; //----------// private var _buttonEnabled:Boolean = true; private var _toggledOn:Boolean = false; private const _tTime:Number = 0.25; public function PushButton() { ui_init(); } private function ui_init():void { TweenMax.allTo([over, down], 0, { autoAlpha:0 } ); this.mouseChildren = false; this.buttonMode = true; this.addEventListener(MouseEvent.ROLL_OVER, mouseEvent); this.addEventListener(MouseEvent.ROLL_OUT, mouseEvent); this.addEventListener(MouseEvent.MOUSE_DOWN, mouseEvent); this.addEventListener(MouseEvent.MOUSE_UP, mouseEvent); } private function mouseEvent(evt:MouseEvent):void { if (! _toggledOn) { switch(evt.type) { case MouseEvent.ROLL_OVER: TweenMax.to(over, _tTime, { autoAlpha:1 } ); break; case MouseEvent.ROLL_OUT: TweenMax.allTo([over, down], _tTime, { autoAlpha:0 } ); break; case MouseEvent.MOUSE_DOWN: TweenMax.to(down, _tTime, { autoAlpha:1 } ); break; case MouseEvent.MOUSE_UP: TweenMax.to(down, _tTime, { autoAlpha:0 } ); break; } } } public function set toggledOn(value:Boolean):void { if (value != _toggledOn) { _toggledOn = value; if (_toggledOn) { this.mouseEnabled = false; TweenMax.to(down, _tTime, { autoAlpha:1 } ); TweenMax.to(over, _tTime, { autoAlpha:0 } ); } else { this.mouseEnabled = true; TweenMax.allTo([over, down], _tTime, { autoAlpha:0 } ); } } } public function get buttonEnabled():Boolean { return _buttonEnabled; } public function set buttonEnabled(value:Boolean):void { if (value == _buttonEnabled) return; _buttonEnabled = value; if (_buttonEnabled) { this.mouseEnabled = true; this.buttonMode = true; TweenMax.to(this, _tTime, { alpha:1 } ); } else { this.mouseEnabled = false; this.buttonMode = false; TweenMax.allTo([over, down], _tTime, { autoAlpha:0 } ); TweenMax.to(this, _tTime, { alpha:0.5 } ); } } } }
25.902174
72
0.647503
526e0e2dd49d356dc4d77fb1baf22fc32383e981
185
as
ActionScript
src/net/fpp/pandastory/game/events/GameMainEvent.as
NewKrok/PandaStory
fdfae5484317328847b14910da22f75c4e65d17e
[ "Apache-2.0" ]
null
null
null
src/net/fpp/pandastory/game/events/GameMainEvent.as
NewKrok/PandaStory
fdfae5484317328847b14910da22f75c4e65d17e
[ "Apache-2.0" ]
null
null
null
src/net/fpp/pandastory/game/events/GameMainEvent.as
NewKrok/PandaStory
fdfae5484317328847b14910da22f75c4e65d17e
[ "Apache-2.0" ]
null
null
null
/** * Created by newkrok on 16/08/16. */ package net.fpp.pandastory.game.events { public class GameMainEvent { public static const DISPOSED:String = 'GameMainEvent.DISPOSED'; } }
18.5
65
0.718919
adb0e326e550cb8e00d366a68687699f5b57357a
2,884
as
ActionScript
Entry/src/serverProto/chipRecycle/ProtoChipRefineryConf.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
6
2016-10-13T18:08:03.000Z
2021-05-30T20:46:51.000Z
Entry/src/serverProto/chipRecycle/ProtoChipRefineryConf.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
null
null
null
Entry/src/serverProto/chipRecycle/ProtoChipRefineryConf.as
w2h/SomeTool
5f4df7bd6e226ce984bf6bd7264e9e790dd1e8ac
[ "MIT" ]
1
2016-10-13T18:17:38.000Z
2016-10-13T18:17:38.000Z
package serverProto.chipRecycle { import com.netease.protobuf.Message; import com.netease.protobuf.fieldDescriptors.FieldDescriptor$TYPE_INT32; import com.netease.protobuf.fieldDescriptors.RepeatedFieldDescriptor$TYPE_INT32; 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 ProtoChipRefineryConf extends Message { public static const NEED_EXP:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("serverProto.chipRecycle.ProtoChipRefineryConf.need_exp","needExp",1 << 3 | WireType.VARINT); public static const PACKAGE_ID:RepeatedFieldDescriptor$TYPE_INT32 = new RepeatedFieldDescriptor$TYPE_INT32("serverProto.chipRecycle.ProtoChipRefineryConf.package_id","packageId",2 << 3 | WireType.VARINT); private var need_exp$field:int; private var hasField$0:uint = 0; [ArrayElementType("int")] public var packageId:Array; public function ProtoChipRefineryConf() { this.packageId = []; super(); } public function clearNeedExp() : void { this.hasField$0 = this.hasField$0 & 4.294967294E9; this.need_exp$field = new int(); } public function get hasNeedExp() : Boolean { return (this.hasField$0 & 1) != 0; } public function set needExp(param1:int) : void { this.hasField$0 = this.hasField$0 | 1; this.need_exp$field = param1; } public function get needExp() : int { return this.need_exp$field; } override final function writeToBuffer(param1:WritingBuffer) : void { var _loc3_:* = undefined; if(this.hasNeedExp) { WriteUtils.writeTag(param1,WireType.VARINT,1); WriteUtils.write$TYPE_INT32(param1,this.need_exp$field); } var _loc2_:uint = 0; while(_loc2_ < this.packageId.length) { WriteUtils.writeTag(param1,WireType.VARINT,2); WriteUtils.write$TYPE_INT32(param1,this.packageId[_loc2_]); _loc2_++; } for(_loc3_ in this) { super.writeUnknown(param1,_loc3_); } } 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"); } } }
32.772727
210
0.627947
5caa482c52206abf576ababd157d97102980c8a1
951
as
ActionScript
mcs/psc_tests/tamarin-redux/tests/performance/asmicro/switch-3.as
sushihangover/PlayScript
a2b7c04e176ddb0ddbc16999e5a5902a1e15b563
[ "Apache-2.0" ]
20
2015-07-14T07:30:28.000Z
2021-11-12T07:41:34.000Z
avmplus/test/performance/asmicro/switch-3.as
vidkidz/crossbridge
ba0bf94aee0ce6cf7eb5be882382e52bc57ba396
[ "MIT" ]
83
2015-07-16T01:31:41.000Z
2016-01-13T02:15:47.000Z
avmplus/test/performance/asmicro/switch-3.as
vidkidz/crossbridge
ba0bf94aee0ce6cf7eb5be882382e52bc57ba396
[ "MIT" ]
10
2015-06-14T14:39:59.000Z
2021-11-12T07:41:35.000Z
/* 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 = "Switch on string value, var-length string keys"; include "driver.as" function switchloop():uint { return switchloop2("10"); } function switchloop2(k:String):uint { var i:uint=0; var v:uint=0; while (i < 100000) { i++; switch (k) { case "0": v += 1; break; case "1": v += 1; break; case "2": v += 2; break; case "3": v += 3; break; case "4": v += 5; break; case "5": v += 8; break; case "6": v += 13; break; case "7": v += 21; break; case "8": v += 34; break; case "9": v += 55; break; case "10": v += 89; break; case "11": v += 144; break; } } return v; } TEST(switchloop, "switch-3");
26.416667
70
0.520505
da5865304dff78f04c66a8ccd398b0aaf8482cf0
1,310
as
ActionScript
src/com/rockmatch/screenstates/preloader/views/PreloaderView.as
Dreams0911/rock_match
de0f537069cdcbbf0c2bcd23f793b40a4e1ded11
[ "MIT" ]
1
2021-06-22T22:28:33.000Z
2021-06-22T22:28:33.000Z
src/com/rockmatch/screenstates/preloader/views/PreloaderView.as
Dreams0911/rock_match
de0f537069cdcbbf0c2bcd23f793b40a4e1ded11
[ "MIT" ]
null
null
null
src/com/rockmatch/screenstates/preloader/views/PreloaderView.as
Dreams0911/rock_match
de0f537069cdcbbf0c2bcd23f793b40a4e1ded11
[ "MIT" ]
null
null
null
package com.rockmatch.screenstates.preloader.views { import com.rockmatch.core.base.views.BaseView; import flash.display.MovieClip; import flash.text.TextField; /** * * @author dkoloskov * */ public class PreloaderView extends BaseView { private var _percents_tf:TextField; //============================================================================== //{region PUBLIC METHODS public function PreloaderView() { } public function addResource(resource:MovieClip):void { _percents_tf = resource["percents_tf"]; this.addChild(resource); } public function updateProgress(progressPercent:int):void { _percents_tf.text = progressPercent.toString() + "%"; } override public function destroy():void { _percents_tf = null; super.destroy(); } //} endregion PUBLIC METHODS =================================================== //============================================================================== //{region PRIVATE\PROTECTED METHODS //} endregion PRIVATE\PROTECTED METHODS ======================================== //============================================================================== //{region EVENTS HANDLERS //} endregion EVENTS HANDLERS ================================================== } }
23.818182
82
0.487786
925c13b9b1bd38b7955492adf91d38fbf08bae74
1,077
as
ActionScript
project_tmpl/src/utils/text/createDynamicTextField.as
pesh1983/as3_libs
4deb882f6ddb1150e35c8c77b5b40e2482880ffa
[ "MIT" ]
null
null
null
project_tmpl/src/utils/text/createDynamicTextField.as
pesh1983/as3_libs
4deb882f6ddb1150e35c8c77b5b40e2482880ffa
[ "MIT" ]
null
null
null
project_tmpl/src/utils/text/createDynamicTextField.as
pesh1983/as3_libs
4deb882f6ddb1150e35c8c77b5b40e2482880ffa
[ "MIT" ]
null
null
null
package utils.text { import flash.text.AntiAliasType; import flash.text.GridFitType; import flash.text.TextField; import flash.text.TextFieldType; import flash.text.TextFormat; /** * @author Павел Гольцев */ public function createDynamicTextField(fontName:String, multiline:Boolean = true, autoSize:String = "left", fontSize:Number = 12, fontColor:Number = 0x0, wordWrap:Boolean = false, leading:Object = null, letterSpacing:Object = null):TextField { var _textTf:TextField = new TextField(); _textTf.mouseEnabled = false; var tf:TextFormat = new TextFormat(fontName, fontSize, fontColor); tf.leading = leading; tf.letterSpacing = letterSpacing; _textTf.defaultTextFormat = tf; _textTf.embedFonts = true; _textTf.type = TextFieldType.DYNAMIC; _textTf.selectable = false; _textTf.autoSize = autoSize; _textTf.wordWrap = wordWrap; _textTf.multiline = multiline; _textTf.gridFitType = GridFitType.PIXEL; _textTf.antiAliasType = AntiAliasType.ADVANCED; return _textTf; } }
30.771429
102
0.712163
62207b7c214bccc3ba578cb47178c36adb8c83e3
208
as
ActionScript
src/com/epolyakov/async/IAsync.as
evgeniy-polyakov/as3-async
9652bbd3ec63140518450dd491c87e471f8eb19e
[ "MIT" ]
2
2020-03-11T19:05:57.000Z
2020-08-17T21:42:43.000Z
src/com/epolyakov/async/IAsync.as
evgeniy-polyakov/as3-async
9652bbd3ec63140518450dd491c87e471f8eb19e
[ "MIT" ]
null
null
null
src/com/epolyakov/async/IAsync.as
evgeniy-polyakov/as3-async
9652bbd3ec63140518450dd491c87e471f8eb19e
[ "MIT" ]
null
null
null
package com.epolyakov.async { /** * @author epolyakov */ public interface IAsync extends ITask { function then(task:Object, onError:Object = null):IAsync; function except(task:Object):IAsync; } }
17.333333
59
0.706731
d5518fe7996af26af6e3f301bd0e119e57a602c4
5,109
as
ActionScript
src/starling/extensions/window/StarlingWindowsManager.as
Dimensionscape/Starling-Windows-Manager
bfb8a7be8b48052de16497ea16bf589dc44c9588
[ "MIT" ]
2
2020-09-13T06:33:05.000Z
2020-09-13T20:34:28.000Z
src/starling/extensions/window/StarlingWindowsManager.as
Dimensionscape/Starling-Windows-Manager
bfb8a7be8b48052de16497ea16bf589dc44c9588
[ "MIT" ]
null
null
null
src/starling/extensions/window/StarlingWindowsManager.as
Dimensionscape/Starling-Windows-Manager
bfb8a7be8b48052de16497ea16bf589dc44c9588
[ "MIT" ]
null
null
null
package starling.extensions.window { import starling.events.Event; import flash.geom.Rectangle; import flash.display.Sprite; import starling.core.Starling; import flash.display.Stage; import flash.events.Event; import flash.display.NativeWindow; public class StarlingWindowsManager { private static var __starlingMap: Object = new Object(); private static var __starlingCollection: Array = []; public static function createStaringWindow(starlingWindowConfiguration:StarlingWindowConfiguration, overwrite:Boolean = false):Starling{ var starlingWindow:StarlingWindow = new StarlingWindow(starlingWindowConfiguration); if(__starlingMap[starlingWindow.id] == undefined || overwrite){ if (overwrite) removeStarlingWindow(starlingWindow.id); __starlingMap[starlingWindow.id] = starlingWindow; __starlingCollection.push(starlingWindow.starling); //if (starlingWindowConfiguration.starlingConfiguration.onRootCreated != null) starlingWindow.starling.addEventListener(starling.events.Event.ROOT_CREATED, onRootCreated) //if (onContextCreated != null) starlingWindow.starling.addEventListener(starling.events.Event.CONTEXT3D_CREATE, onContextCreated); if (__starlingCollection.length == 0) starlingWindow.starling.nativeStage.addEventListener(flash.events.Event.EXIT_FRAME, __onExitFrame); } else throw("Duplicate Starling id is not allowed. Pass true as the overwrite argument in order to bypass this error."); return starlingWindow.starling; } public static function createStarlingFromWindow(id:String, rootClass:Class, nativeWindow:NativeWindow, viewPort:Rectangle = null, onContextCreated:Function = null, onRootCreated:Function = null, overwrite:Boolean = false):Starling{ var starlingWindow:StarlingWindow = StarlingWindow.fromNativeWindow(id, nativeWindow); if(__starlingMap[id] == undefined || overwrite){ if (overwrite) removeStarlingWindow(starlingWindow.id); starlingWindow._starling = new Starling(rootClass, nativeWindow.stage, viewPort); __starlingCollection.push((__starlingMap[id] = starlingWindow)._starling); if (onRootCreated != null) starlingWindow.starling.addEventListener(starling.events.Event.ROOT_CREATED, onRootCreated) if (onContextCreated != null) starlingWindow.starling.addEventListener(starling.events.Event.CONTEXT3D_CREATE, onContextCreated); if (__starlingCollection.length == 0) starlingWindow.starling.nativeStage.addEventListener(flash.events.Event.EXIT_FRAME, __onExitFrame); } else throw ("Duplicate Starling id is not allowed. Pass true as the overwrite argument to bypass."); return starlingWindow.starling; } public static function removeStarlingWindow(id: String): void { if(StarlingWindow(__starlingMap[id])._starling.nativeStage.hasEventListener(flash.events.Event.EXIT_FRAME)) __starlingMap[id]._starling.nativeStage.removeEventListener(flash.events.Event.EXIT_FRAME, __onExitFrame); __starlingCollection.removeAt(__starlingCollection.indexOf(__starlingMap[id]._starling)); __starlingMap[id] = null; delete __starlingMap[id]; if (__starlingCollection.length == 0) __starlingCollection[0].addEventListener(flash.events.Event.EXIT_FRAME, __onExitFrame); } public static function getStarlingWindow(id:String):StarlingWindow{ return __starlingMap[id]; } public static function getStarlingWindowByStarling(starling:Starling):StarlingWindow{ for each(var starlingWindow:StarlingWindow in __starlingMap){ if(starlingWindow.starling === starling) return starlingWindow; } return null; } public static function setViewPort(id: String, rect: Rectangle): void { __starlingMap[id].staring.viewPort = rect; } public static function setStageDimensions(id:String, stageWidth: int, stageHeight: int): void { __starlingMap[id].starling.stage.stageWidth = stageWidth; __starlingMap[id].starling.stage.stageHeight = stageHeight; } public static function makeCurrent(id: String): void { if (__starlingMap[id] != undefined) __starlingMap[id].starling.makeCurrent(); } private static function __onRootCreated(onRootCreated: Function, onRootCreatedFunction: Function = null): Function { return onRootCreatedFunction = function (e: starling.events.Event): void { e.currentTarget.removeEventListener(starling.events.Event.ROOT_CREATED, onRootCreatedFunction); e.currentTarget.removeEventListener(starling.events.Event.ROOT_CREATED, onRootCreated); } } private static function __onContextCreated(onRootCreated: Function, onContextCreatedFunction: Function = null): Function { return onContextCreatedFunction = function (e: starling.events.Event): void { e.currentTarget.removeEventListener(starling.events.Event.CONTEXT3D_CREATE, onContextCreatedFunction); e.currentTarget.removeEventListener(starling.events.Event.CONTEXT3D_CREATE, onRootCreated); } } private static function __onExitFrame(e: flash.events.Event) { var length:int = __starlingCollection.length; for(var i:int = 0; i< length; i++){ __starlingCollection[i].makeCurrent(); } } } }
51.606061
217
0.786651
1511d0533bcec19846521859448d1e5f8cef5806
1,649
as
ActionScript
lib/goplayer/PackerSpecification.as
dbrock/goplayer
de5552c7e6dbd84970e8da52bf40739ab46e63ae
[ "MIT" ]
5
2015-01-14T06:55:30.000Z
2018-01-06T03:35:43.000Z
lib/goplayer/PackerSpecification.as
dbrock/goplayer
de5552c7e6dbd84970e8da52bf40739ab46e63ae
[ "MIT" ]
null
null
null
lib/goplayer/PackerSpecification.as
dbrock/goplayer
de5552c7e6dbd84970e8da52bf40739ab46e63ae
[ "MIT" ]
null
null
null
package goplayer { import org.asspec.specification.AbstractSpecification import flash.display.Sprite public class PackerSpecification extends AbstractSpecification { override protected function execute() : void { it("should allow packing nothing", function () : void { specify(function () : void { Packer.packLeft(NaN) }) .should.not.throw_error }) const a : Sprite = getSquare(1) const b : Sprite = getSquare(1) a.x = 2 b.x = 1 it("should pack using internal widths", function () : void { Packer.packLeft(NaN, a, b) specify(b.x).should.equal(1) }) it("should honor explicit widths", function () : void { Packer.packLeft(NaN, [a, 2], b) specify(b.x).should.equal(2) }) it("should ignore null items", function () : void { Packer.packLeft(5, null, [a], null, b, null) specify(b.x).should.equal(4) }) it("should give free space to flexible element", function () : void { Packer.packLeft(5, [a], b) specify(b.x).should.equal(4) }) it("should call back with width of flexible element", function () : void { var width : Number function callback(value : Number) : void { width = value } Packer.packLeft(2, [a, callback]) specify(width).should.equal(2) }) } private static function getSquare(side : Number) : Sprite { const result : Sprite = new Sprite result.graphics.beginFill(0) result.graphics.drawRect(0, 0, side, side) result.graphics.endFill() return result } } }
26.596774
80
0.594906
c4fcc997f7b4ddd47823c4133de323c42fa35b6d
6,365
as
ActionScript
common-snapshot/src/com/neopets/games/inhouse/shenkuuSideScroller/characters/Helper.as
vikiana/ShenkuuWarriorII
cd734d339b6237675f20ac0ab0b3726967bb0a49
[ "MIT" ]
1
2021-06-23T08:53:53.000Z
2021-06-23T08:53:53.000Z
common-snapshot/src/com/neopets/games/inhouse/shenkuuSideScroller/characters/Helper.as
vikiana/ShenkuuWarriorII
cd734d339b6237675f20ac0ab0b3726967bb0a49
[ "MIT" ]
null
null
null
common-snapshot/src/com/neopets/games/inhouse/shenkuuSideScroller/characters/Helper.as
vikiana/ShenkuuWarriorII
cd734d339b6237675f20ac0ab0b3726967bb0a49
[ "MIT" ]
null
null
null
/** *enemy Character * *@langversion ActionScript 3.0 *@playerversion Flash 9.0 *@author Abraham Lee *@since aug.2009 */ package com.neopets.games.inhouse.shenkuuSideScroller.characters{ //---------------------------------------- //IMPORTS //---------------------------------------- import flash.geom.Point; import flash.display.DisplayObject; import flash.display.MovieClip; import com.neopets.util.events.CustomEvent; import com.neopets.games.inhouse.shenkuuSideScroller.dataObj.GameDataManager; import com.neopets.games.inhouse.shenkuuSideScroller.dataObj.GameData; //---------------------------------------- //CUSTOM IMPORTS //---------------------------------------- public class Helper extends AbsCharacter { //---------------------------------------- //CONSTANTS //---------------------------------------- public static const SCORE:String = "add_score"; public static const HEAL:String = "restore_life"; public static const DOUBLE:String = "double_point"; public static const INVINCIBLE:String = "make_player_invincible"; public static const KILL:String = "kill_all_enemies_on_screen"; public static const MORPH:String = "morph_all_enemies_to_item"; public static const SPEED_UP:String = "make_timer_faster"; public static const SPEED_DOWN:String = "make_timer_slower"; //---------------------------------------- //VARIABLES //---------------------------------------- protected var mTarget:MainCharacter; protected var mBehavior:Function = behaviorPatterA; protected var mType:String; protected var mHeal:int;//Life restoration amount protected var mScore:int; protected var mMultiplier:Number;//score multiplier, if set to 2, all scores are doubled protected var mKill:Boolean;//kill all enemies protected var mMorph:Boolean;//morph all enemies to points protected var mInvincible:int;//make main character invincible protected var mTime:int;//duration of the effects that has to do with time ex) invincible //---------------------------------------- //CONSTRUCTOR //---------------------------------------- public function Helper():void { super(); } //---------------------------------------- //GETTERS AND SETTORS //---------------------------------------- public function set myTarget(pTarget:MainCharacter):void { mTarget = pTarget; } public function get myTarget():MainCharacter { return mTarget; } /** * set behavior and properties **/ public function set behavior(pType:String):void { mType = pType; switch (pType) { case Helper.SCORE : setProperties(10, 0); break; case Helper.HEAL : setProperties(2, 5, 1); break; case Helper.DOUBLE : setProperties(3, 0, 2, false, false, 0, 300); break; case Helper.INVINCIBLE : setProperties(3, 0, 1, false, false, 0, 300); break; case Helper.KILL : setProperties(15, 0, 1, true, false, 0, 0); break; case Helper.MORPH : setProperties(15, 0, 1, false, true, 0, 0); break; case Helper.SPEED_UP : setProperties(3, 0, 1, false, false, 0, 500); break; case Helper.SPEED_DOWN : setProperties(3, 0, 1, false, false, 0, 200); break; default : break; } } public function get score ():int { return mScore; } //---------------------------------------- //PUBLIC METHODS //---------------------------------------- /** * runs the helpers **/ override public function run():void { mBehavior(); checkHit(); } /** * reset helper properties **/ public function resetCharacter():void { GameDataManager.removeImage(mImage, GameData.objsSprite) GameDataManager.toReserve(this, GameData.activeHelpers, GameData.helpers) mTarget = null; mType = null; mHeal = 0; mScore = 0; mMultiplier = 1; mKill = false; mMorph = false; mInvincible = 0; mTime = 0; charcterReset() } //---------------------------------------- //PROTECTED METHODS //---------------------------------------- /** * Based on the type of the helper/item, set the properties accodingly * @PARAM pScore int helper's score value * @PARAM pHeal int helper's heal value * @PARAM pMul int Score multiplier... * @PARAM pKill Boolean Kills all enemies on screen * @PARAM pMorph Boolean morph all enemies on screen into score helpers * @PARAM pInv int duration player will stay invincible * @PARAM pTime int duration of time driven effects should last **/ protected function setProperties(pScore:int = 0, pHeal:int = 0, pMul:Number = 1, pKill:Boolean = false, pMorph:Boolean = false, pInv:int = 0, pTime:int = 0):void { mHeal = pHeal; mScore = pScore; mMultiplier = pMul; mKill = pKill; mMorph = pMorph; mInvincible = pInv; mTime = pTime; } /** * baiscally move according ot velocity, friction and gravity **/ protected function basicMovement():void { var currpx:Number = mpx; var currpy:Number = mpy; var currvx:Number = mvx; var currvy:Number = mvy; var nextvx:Number = (currvx + mgx) * mFric; var nextvy:Number = (currvy + mgy) * mFric; mvx = nextvx; mvy = nextvy; mpx += mvx * GameData.speedFactor; mpy += mvy * GameData.speedFactor; mImage.x = mpx; mImage.y = mpy; if (mpx < -60 || mpy > 650) { resetCharacter(); } } /** * basic behavior patters, ther is only one for now **/ protected function behaviorPatterA():void { basicMovement() } /** * check if it came to contact with the player **/ protected function checkHit():void { if (mTarget != null) { if (MovieClip(mImage).objHitArea.hitTestObject (MovieClip(mTarget.image).core)) { if (mMainGame != null) { mMainGame.dispatchEvent(new CustomEvent ( { TYPE:mType, POS:new Point (mpx, mpy), HEAL:mHeal, SCORE:mScore, TIME:mTime }, mMainGame.OBJECT_CONTACT ) ); } resetCharacter(); } } } //---------------------------------------- //PRIVATE METHODS //---------------------------------------- //---------------------------------------- //EVENT LISTENERS //---------------------------------------- } }
25.358566
164
0.563079
58253f7b899982f711e8131663c973d875b8b753
178
as
ActionScript
src/com/hurrygames/grabber/IRenders/ITowerRender.as
zhjzhjxzhl/LandGrabbers
f1b9f0ae694e17ae039e6f722fbeacf9521df0cc
[ "Apache-2.0" ]
1
2018-03-29T08:21:39.000Z
2018-03-29T08:21:39.000Z
src/com/hurrygames/grabber/IRenders/ITowerRender.as
zhjzhjxzhl/LandGrabbers
f1b9f0ae694e17ae039e6f722fbeacf9521df0cc
[ "Apache-2.0" ]
null
null
null
src/com/hurrygames/grabber/IRenders/ITowerRender.as
zhjzhjxzhl/LandGrabbers
f1b9f0ae694e17ae039e6f722fbeacf9521df0cc
[ "Apache-2.0" ]
2
2019-12-10T09:52:30.000Z
2019-12-10T09:52:37.000Z
package com.hurrygames.grabber.IRenders { import flash.geom.Point; public interface ITowerRender extends ICityRender { function attackOnePosition(position:Point):void; } }
19.777778
50
0.797753
10bf4843a303db0997488e260cf564800c980abd
309
as
ActionScript
cadetEditor/src/cadetEditor/tools/ITool.as
CadetEditor/CadetEditor-as
bed6beb5046881d70058fc0523a5a618d21c0511
[ "BSD-2-Clause-FreeBSD" ]
6
2015-05-20T04:51:56.000Z
2021-08-19T03:01:58.000Z
cadetEditor/src/cadetEditor/tools/ITool.as
CadetEditor/CadetEditor-as
bed6beb5046881d70058fc0523a5a618d21c0511
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
cadetEditor/src/cadetEditor/tools/ITool.as
CadetEditor/CadetEditor-as
bed6beb5046881d70058fc0523a5a618d21c0511
[ "BSD-2-Clause-FreeBSD" ]
3
2018-06-29T06:46:27.000Z
2021-08-19T03:01:58.000Z
// Copyright (c) 2012, Unwrong Ltd. http://www.unwrong.com // All rights reserved. package cadetEditor.tools { import core.appEx.core.contexts.IContext; public interface ITool { function init(context:IContext):void; function dispose():void; function enable():void; function disable():void; } }
20.6
58
0.721683
5d08c4e0920d8a0ddf57f24fd5c87d6a0fee51e5
36,857
as
ActionScript
webconsole-systembuilder-flex/src/main/flex/com/deleidos/rtws/systemcfg/models/SystemPropertiesModel.as
deleidos/digitaledge-platform
1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9
[ "Apache-2.0" ]
4
2015-07-09T14:57:07.000Z
2022-02-23T17:48:24.000Z
webconsole-systembuilder-flex/src/main/flex/com/deleidos/rtws/systemcfg/models/SystemPropertiesModel.as
deleidos/digitaledge-platform
1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9
[ "Apache-2.0" ]
1
2016-04-20T01:13:29.000Z
2016-04-20T01:13:29.000Z
webconsole-systembuilder-flex/src/main/flex/com/deleidos/rtws/systemcfg/models/SystemPropertiesModel.as
deleidos/digitaledge-platform
1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9
[ "Apache-2.0" ]
4
2016-03-10T00:23:17.000Z
2022-03-02T11:17:02.000Z
/** * 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.systemcfg.models { import com.adobe.serialization.json.JSON; import com.deleidos.rtws.commons.model.status.StatusMessage; import com.deleidos.rtws.commons.model.status.StatusType; import com.deleidos.rtws.commons.tenantutils.model.system.SystemState; import com.deleidos.rtws.commons.util.DynaObjectUtils; import com.deleidos.rtws.commons.util.StringUtils; import com.deleidos.rtws.systemcfg.dao.AvailabilityZones; import com.deleidos.rtws.systemcfg.dao.CurrentDefaults; import com.deleidos.rtws.systemcfg.dao.IaasAccounts; import com.deleidos.rtws.systemcfg.dao.SoftwareReleases; import com.deleidos.rtws.systemcfg.dao.SystemSizing; import com.deleidos.rtws.systemcfg.events.EditEvent; import com.deleidos.rtws.systemcfg.events.PopupEvent; import com.deleidos.rtws.systemcfg.utils.ValidationUtils; import flash.events.Event; import flashx.textLayout.formats.Float; import mx.collections.ArrayCollection; import mx.collections.ArrayList; import mx.collections.Sort; import mx.collections.SortField; import mx.controls.Alert; import org.robotlegs.mvcs.Actor; public class SystemPropertiesModel extends Actor { [Inject] public var availZonesTable:AvailabilityZones; [Inject] public var systemSizingTable:SystemSizing; [Inject] public var swReleasesTable:SoftwareReleases; [Inject] public var processGroupModel:ProcessGroupModel; [Inject] public var currentDefaultsTable:CurrentDefaults; [Inject] public var iaasAccountsTable:IaasAccounts; [Inject] public var systemListModel:SystemListModel; [Inject] public var systemPropertiesModel:SystemBuilderPropertiesModel; [Inject] public var vpcNetwork:VpcNetworkModel; public static const CONFIG_PREFIX:String = "config_v"; private var _accountId:String; private var _currentDefaults:Object = null; private var _domainNamePrefix:String; private var _domainNameSuffix:String; private var _applianceDomain:String; private var _domainIsDuplicate:Boolean; private var _autoScale:Boolean; private var _vpcEnabled:Boolean; private var _vpcOnly:String; private var _applianceEnabled:Boolean; private var _iaasServiceName:String; private var _configMajorVersion:int; private var _configMinorVersion:int; private var _allSystemSizes:ArrayCollection; private var _selectedSize:String; private var _originalSize:String; private var _allSoftwareVersions:ArrayCollection; private var _selectedSoftwareVersion:String; private var _allServiceProviders:ArrayCollection private var _selectedServiceProvider:String; private var _allServiceRegions:ArrayCollection; private var _selectedServiceRegion:String; private var _allAvailZones:ArrayCollection; private var _selectedAvailZone:String; private var _defaultRtwsPubDnsAvailability:DnsAvailability; private var _selectedRtwsPubDnsAvailability:DnsAvailability; private var _keypairName:String; private var _lastSystemState:SystemState; private var _longestProcessGroupNameLen:int; /** * Return an index that represents the relative size of a system. * It is expected that the size contain "small", "medium", or "large", * and that "small" and "large" could be prefixed with a number of "x" * characters indicating increasing degrees of smaller or larger. */ private function getSizeIndex(size:String):Number { var result:Number = 0.0; // Count the number of leading x'es var xcount:Number = 1.0; for(var i:int=0; i<size.length; i++) { if (size.charAt(i) == 'x') xcount += 1.0; else break; } if (size.indexOf("small") >= 0) result = 1.0 / xcount; else if (size.indexOf("medium") >= 0) result = 2.0; else if (size.indexOf("large") >= 0) result = 3.0 * xcount; return result; } private function compareSystemSizes(a:Object, b:Object, fields:Array = null):int { var sizeA:String = a as String; var sizeB:String = b as String; var result:int = 0; var indexA:Number = getSizeIndex(sizeA); var indexB:Number = getSizeIndex(sizeB); // trace("a=" + sizeA + "("+indexA+")" + ", b=" + sizeB + "("+indexB+")" ); if (indexA < indexB) result = -1; else if (indexA > indexB) result = 1; return result; } public function SystemPropertiesModel() { _allSystemSizes = new ArrayCollection(); _selectedSize = ""; _originalSize = null; _allSoftwareVersions = new ArrayCollection(); _selectedSoftwareVersion = ""; _allServiceProviders = new ArrayCollection(); _selectedServiceProvider = ""; _allServiceRegions = new ArrayCollection(); _selectedServiceRegion = ""; _allAvailZones = new ArrayCollection(); _selectedAvailZone = ""; _defaultRtwsPubDnsAvailability = DnsAvailability.UNKNOWN; _selectedRtwsPubDnsAvailability = null; _applianceDomain = ""; _domainNamePrefix = ""; _domainNameSuffix = ".rtsaic.com"; _domainIsDuplicate = false; _autoScale = false; _vpcEnabled = false; _vpcOnly = "N"; _applianceEnabled = false; _iaasServiceName = "AWS"; _selectedSize = ""; _selectedSoftwareVersion = ""; _selectedServiceRegion = ""; _keypairName = ""; _configMajorVersion = 1; _configMinorVersion = 0; _lastSystemState = SystemState.UNKNOWN; } public function clear():void { this.domainNamePrefix = ""; this.applianceDomain = ""; this.autoScale = false; _configMajorVersion = 1; _configMinorVersion = 0; this.selectedSize = "small"; this.originalSize = null; this.lastSystemState = SystemState.UNKNOWN; this.selectedSoftwareVersion = _currentDefaults[CurrentDefaults.SW_VERSION_ID]; this.selectedServiceRegion = _currentDefaults[CurrentDefaults.IAAS_REGION]; this.selectedAvailZone = _currentDefaults[CurrentDefaults.IAAS_AZONE]; _selectedRtwsPubDnsAvailability = null; _vpcEnabled = false; _applianceEnabled = false; processGroupModel.adjustSystemSize(_selectedSize, _autoScale); dispatch(new EditEvent(EditEvent.SYS_PROP_SELECTIONS_CHANGED, null, null)); } private function getDefaultArrayItem(arr:ArrayCollection):String { if (arr.length == 0) return ""; else return arr.getItemAt(0) as String; } public function setup(accountId:String, selectedService:String, keypairName:String):void { var account:Object = iaasAccountsTable.lookupByAccountId(accountId); _domainNameSuffix = "." + account[IaasAccounts.DOMAIN_NAME_SUFFIX]; var sort:Sort = new Sort(); _allSystemSizes = new ArrayCollection( systemSizingTable.simpleSelect(SystemSizing.SYSTEM_SIZE).source); sort = new Sort(); sort.compareFunction = compareSystemSizes; _allSystemSizes.sort = sort; _allSystemSizes.refresh(); _allSoftwareVersions = new ArrayCollection( swReleasesTable.simpleSelect(SoftwareReleases.SW_VERSION_ID).source); sort = new Sort(); sort.fields = [new SortField(null,true,true)]; _allSoftwareVersions.sort = sort; _allSoftwareVersions.refresh(); _allServiceProviders = new ArrayCollection( availZonesTable.simpleSelectDistinct(AvailabilityZones.IAAS_SERVICE_NAME).source); selectedServiceProvider = selectedService; _currentDefaults = currentDefaultsTable.lookupDefaultsByService(selectedService); if (_currentDefaults == null) { _currentDefaults = new Object(); _currentDefaults[CurrentDefaults.IAAS_SERVICE_NAME] = selectedServiceProvider _currentDefaults[CurrentDefaults.IAAS_REGION] = getDefaultArrayItem(_allServiceRegions); _currentDefaults[CurrentDefaults.IAAS_AZONE] = getDefaultArrayItem(_allAvailZones); _currentDefaults[CurrentDefaults.SW_VERSION_ID] = getDefaultArrayItem(_allSoftwareVersions); } else { // The current defaults are set, lets check to make sure the tenant has access to // the region and availability zone and if not get default from the in memory array. var azones:ArrayList = availZonesTable.lookupAzonesByRegion(_currentDefaults[CurrentDefaults.IAAS_REGION]); var azoneExist:Boolean = false; for (var i:int = 0; i < azones.length; i++) { if (_currentDefaults[CurrentDefaults.IAAS_AZONE] == azones.getItemAt(i)) { azoneExist = true; } } if (! azoneExist) { _currentDefaults[CurrentDefaults.IAAS_REGION] = getDefaultArrayItem(_allServiceRegions); _currentDefaults[CurrentDefaults.IAAS_AZONE] = getDefaultArrayItem(_allAvailZones); } } _currentDefaults[CurrentDefaults.SW_VERSION_ID] = ""; _selectedServiceRegion = _currentDefaults[CurrentDefaults.IAAS_REGION]; _selectedAvailZone = _currentDefaults[CurrentDefaults.IAAS_AZONE]; _selectedSoftwareVersion = _currentDefaults[CurrentDefaults.SW_VERSION_ID]; _selectedSize = "small"; // _allSystemSizes.getItemAt(0) as String; _keypairName = keypairName; _accountId = accountId; _vpcOnly = account[IaasAccounts.VPC_ONLY]; _iaasServiceName = account[IaasAccounts.IAAS_SERVICE_NAME]; processGroupModel.adjustSystemSize(_selectedSize, _autoScale); var processGroups:ArrayCollection = processGroupModel.processGroups; _longestProcessGroupNameLen = 0; for each (var pg:ProcessGroup in processGroups.source) { _longestProcessGroupNameLen = Math.max(pg.processGroupName.length, _longestProcessGroupNameLen); } } public function get maxDomainNameLength():int { return systemPropertiesModel.maxDomainLength - _longestProcessGroupNameLen - _domainNameSuffix.length; } public function get accountId():String { return _accountId; } public function get applianceDomain():String { return _applianceDomain; } public function set applianceDomain(value:String):void { _applianceDomain = value; } public function get domainNamePrefix():String { return _domainNamePrefix; } public function set domainNamePrefix(value:String):void { _domainNamePrefix = value; } public function get domainNameSuffix():String { return _domainNameSuffix; } public function set domainNameSuffix(value:String):void { _domainNameSuffix = value; } public function get fullDomainName():String { return _domainNamePrefix + _domainNameSuffix; } public function get domainIsDuplicate():Boolean { return _domainIsDuplicate; } public function setDomainDuplicate(response:String):void { var fullDomainName:String = this.fullDomainName; if ((response == "true") || (response == "false")) { // A domain is a duplicate if its not part of the current user's list of domains AND // and a query of ALL systems returns a count greater than zero. This way a user can // overwrite their own systems, but not stomp on anybody elses. _domainIsDuplicate = (response == "true") && (systemListModel.findSystem(fullDomainName) == null); } else { Alert.show("Error in response string: " + response, "Error"); _domainIsDuplicate = true; } } public function get autoScale():Boolean { return _autoScale; } public function set autoScale(value:Boolean):void { _autoScale = value; processGroupModel.setAutoscaleAll(value, _selectedSize, _autoScale); } public function get vpcEnabled():Boolean { return _vpcEnabled; } public function set vpcEnabled(value:Boolean):void { _vpcEnabled = value; } public function get vpcOnly():String { return _vpcOnly; } public function set vpcOnly(value:String):void { _vpcOnly = value; } public function get applianceEnabled():Boolean { return _applianceEnabled; } public function set applianceEnabled(value:Boolean):void { _applianceEnabled = value; } public function get iaasServiceName():String { return _iaasServiceName; } public function set iaasServiceName(value:String):void { _iaasServiceName = value; } public function get configMinorVersion():int { return _configMinorVersion; } public function set configMinorVersion(value:int):void { _configMinorVersion = value; } public function get configMajorVersion():int { return _configMajorVersion; } public function set configMajorVersion(value:int):void { _configMajorVersion = value; } public function get configVersion():String { return CONFIG_PREFIX + _configMajorVersion + "." + _configMinorVersion; } public function set configVersion(value:String):void { var versionString:String = StringUtils.remove(value,CONFIG_PREFIX); versionString = versionString.replace("v",""); var numbers:Array = versionString.split(/\./); if (numbers.length == 2) { _configMajorVersion = parseInt(numbers[0]); _configMinorVersion = parseInt(numbers[1]); } else { _configMajorVersion = 0; _configMinorVersion = 0; } } public function get selectedSize():String { return _selectedSize; } public function set selectedSize(value:String):void { if (_allSystemSizes.getItemIndex(value) < 0) { throw Error("Runtime error: system size '" + value + "' is not valid."); } _selectedSize = value; processGroupModel.adjustSystemSize(_selectedSize, _autoScale); } public function get originalSize():String { return _originalSize; } public function set originalSize(value:String):void { _originalSize = value; } public function get selectedSoftwareVersion():String { return _selectedSoftwareVersion; } public function set selectedSoftwareVersion(value:String):void { if (_allSoftwareVersions.getItemIndex(value) < 0) { // Software version does not exist - set it to a null string _selectedSoftwareVersion = ""; } else { _selectedSoftwareVersion = value; } } public function softwareVersionExists(value:String):Boolean { return (_allSoftwareVersions.getItemIndex(value) >= 0); } public function get selectedServiceProvider():String { return _selectedServiceProvider; } public function set selectedServiceProvider(value:String):void { if (_allServiceProviders.getItemIndex(value) < 0) { throw Error("Runtime error: service provider '" + value + "' is not valid."); } _selectedServiceProvider = value; _allServiceRegions.removeAll(); _allServiceRegions.addAll( availZonesTable.simpleSelectDistinct( AvailabilityZones.IAAS_REGION, AvailabilityZones.IAAS_SERVICE_NAME, value)); _selectedServiceRegion = ""; if (_allServiceRegions.length > 0) { var item:Object = _allServiceRegions.getItemAt(0); selectedServiceRegion = item as String; } if(_selectedServiceProvider == "AWS") { _defaultRtwsPubDnsAvailability = DnsAvailability.AVAILABLE; _selectedRtwsPubDnsAvailability = null; } else { _defaultRtwsPubDnsAvailability = DnsAvailability.UNKNOWN; _selectedRtwsPubDnsAvailability = null; } } public function get selectedServiceRegion():String { return _selectedServiceRegion; } public function set selectedServiceRegion(value:String):void { if (_allServiceRegions.getItemIndex(value) < 0) { throw Error("Runtime error: service region '" + value + "' is not valid."); } _selectedServiceRegion = value; updateAvailZones(); } public function get selectedAvailZone():String { return _selectedAvailZone; } public function set selectedAvailZone(value:String):void { if (_allAvailZones.getItemIndex(value) < 0) { throw Error("Runtime error: service zone '" + value + "' is not valid."); } _selectedAvailZone = value; } public function get defaultRtwsPubDnsAvailability():DnsAvailability { return _defaultRtwsPubDnsAvailability; } public function set defaultRtwsPubDnsAvailability(value:DnsAvailability):void { _defaultRtwsPubDnsAvailability = value; } public function get selectedRtwsPubDnsAvailability():DnsAvailability { return _selectedRtwsPubDnsAvailability; } public function set selectedRtwsPubDnsAvailability(value:DnsAvailability):void { _selectedRtwsPubDnsAvailability = value; } public function get allSystemSizes():ArrayCollection { return _allSystemSizes; } public function get allSoftwareVersions():ArrayCollection { return _allSoftwareVersions; } public function get allServiceRegions():ArrayCollection { return _allServiceRegions; } public function get allAvailZones():ArrayCollection { return _allAvailZones; } public function get lastSystemState():SystemState { return _lastSystemState; } public function set lastSystemState(value:SystemState):void { _lastSystemState = value; } /** Returns true if the system size was downsized from its original size */ public function get systemDownsized():Boolean { var result:Boolean = false; if (_originalSize != null) { result = (getSizeIndex(_selectedSize) < getSizeIndex(_originalSize)); } return result; } private function updateAvailZones():void { _allAvailZones.removeAll(); _allAvailZones.addAll( availZonesTable.simpleSelect( AvailabilityZones.IAAS_AZONE, AvailabilityZones.IAAS_REGION, _selectedServiceRegion)); var item:Object = _allAvailZones.getItemAt(0); _selectedAvailZone = item as String; dispatch(new EditEvent(EditEvent.SYS_PROP_SELECTIONS_CHANGED, null, null)); } public function validate():Boolean { var errMsg:String; var nestedEvent:Event = null; errMsg = ValidationUtils.domainNameCheck(_domainNamePrefix); if (errMsg == null) { if (_applianceEnabled) { errMsg = ValidationUtils.applianceDomainNameCheck(_applianceDomain); } } if (errMsg == null) { if (_domainNamePrefix.length > this.maxDomainNameLength) { errMsg = "Domain name is too long; maximum allowed is " + this.maxDomainNameLength + " characters."; } } if (errMsg == null) { if (_domainNamePrefix.toLowerCase() == "gateway") { errMsg = "Domain name cannot be 'gateway', this is reserved by DigitalEdge."; } } if (errMsg == null) { if (_domainIsDuplicate) { errMsg = "Domain name " + this.fullDomainName + " is in use by somebody else; please choose another one."; } } if (errMsg == null) { if (_selectedSize.length == 0) { errMsg = "No system size has been selected."; } } if (errMsg == null) { if (_selectedSoftwareVersion.length == 0) { errMsg = "No software version has been selected."; } } if (errMsg == null) { if (_allServiceProviders.length == 0) { errMsg = "No service provider has been selected."; } } if (errMsg == null) { if (_allServiceRegions.length == 0) { errMsg = "No region has been selected."; } } if (errMsg == null) { if (_allAvailZones.length == 0) { errMsg = "No zone has been selected."; } } if (errMsg == null) { if (_defaultRtwsPubDnsAvailability == null) { // This is a developer error. This should not be null, but this fact is assumed below errMsg = "Cloud Environment DNS Availability is null"; } else if ( _defaultRtwsPubDnsAvailability == DnsAvailability.UNKNOWN && ( _selectedRtwsPubDnsAvailability == null || _selectedRtwsPubDnsAvailability == DnsAvailability.UNKNOWN ) ) { errMsg = "No DigitalEdge DNS Entry is selected."; } } if (errMsg == null) { var pgList:Array = processGroupModel.findProcessGroupsWithPersistentIP(); if ((pgList.length > 0) && _vpcEnabled) { errMsg = "Process groups should not have any persistent, public IPs assigned when VPC is enabled. " + "Go to the details tab and clear them."; } } if (errMsg == null) { // Force a persistant IP on the webapp.default node if no DNS is available. var pg:ProcessGroup = processGroupModel.findProcessGroup(ProcessGroupModel.WEBAPPS_DEFAULT); if( pg != null && (pg.persistentIPAddress == null || pg.persistentIPAddress == ProcessGroup.NO_PUBLIC_IP) && _vpcEnabled == false && ( _defaultRtwsPubDnsAvailability == DnsAvailability.UNAVAILABLE || ( _defaultRtwsPubDnsAvailability == DnsAvailability.UNKNOWN && _selectedRtwsPubDnsAvailability == DnsAvailability.UNAVAILABLE ) ) ) { errMsg = "Since DigitalEdge DNS entries are unavailable, you must setup a persistent, public IP address for the " + ProcessGroupModel.WEBAPPS_DEFAULT + " instance. Click OK to continue."; var rowIndex:int = processGroupModel.processGroups.getItemIndex(pg); var params:Object = new Object(); params = {row:rowIndex, value:pg.configPersistentIPAddress}; nestedEvent = new PopupEvent(PopupEvent.SELECT_PERSISTENT_IP_BEGIN, params, null); } } if (errMsg != null) { var msg:StatusMessage = new StatusMessage(StatusType.ERROR,errMsg); dispatch(new PopupEvent(PopupEvent.MESSAGE_BEGIN, msg, nestedEvent)); return false; } return true; } public function get transferObject():Object { /* "applianceDomain" : "string", "systemDomain" : "string", "serviceProvider" : "string", "region" : "string", "availZone" : "string", "sshKey" : "string", "softwareVersion" : "string", "configVersion" : "string", "systemSize" : "string", "autoscale" : "boolean", "vpcEnabled" : "boolean", "applianceEnabled": "boolean", */ var obj:Object = new Object(); obj.applianceDomain = this.applianceDomain obj.systemDomain = this.fullDomainName; obj.serviceProvider = _selectedServiceProvider; obj.region = _selectedServiceRegion; obj.availZone = _selectedAvailZone; obj.sshKey = _keypairName; obj.softwareVersion = _selectedSoftwareVersion; obj.configVersion = this.configVersion; obj.systemSize = _selectedSize; obj.autoScale = (_autoScale) ? "true" : "false"; obj.vpcEnabled = (_vpcEnabled) ? "true" : "false"; obj.applianceEnabled = (_applianceEnabled) ? "true" : "false"; if(_defaultRtwsPubDnsAvailability == DnsAvailability.UNKNOWN && _selectedRtwsPubDnsAvailability != null) { if(_selectedRtwsPubDnsAvailability == DnsAvailability.AVAILABLE) { obj["externalDnsEnabled"] = true; } else if(_selectedRtwsPubDnsAvailability == DnsAvailability.UNAVAILABLE) { obj["externalDnsEnabled"] = false; } } return obj; } private function loadBoolean(x:Object):Boolean { var result:Boolean = false; if (x != null) { if (x is Boolean) { result = x as Boolean; } else if (x is String) { result = ((x as String) == "true"); } } return result; } public function load(transferObject:Object):String { var errMsg:String = ""; try { this._applianceDomain = transferObject.applianceDomain; this._domainNamePrefix = StringUtils.beforeFirst(transferObject.systemDomain,"."); this._domainNameSuffix = "." + StringUtils.afterFirst(transferObject.systemDomain,"."); this.selectedServiceRegion = transferObject.region; this.selectedAvailZone = transferObject.availZone; this._keypairName = transferObject.sshKey; this.selectedSoftwareVersion = transferObject.softwareVersion; if (this.selectedSoftwareVersion.length == 0) { errMsg += "Software version " + transferObject.softwareVersion + " does not exist." + "\n"; } this.configVersion = transferObject.configVersion; this.selectedSize = transferObject.systemSize; this.originalSize = this.selectedSize; this.lastSystemState = SystemState.UNKNOWN; _autoScale = loadBoolean(transferObject.autoScale); _vpcEnabled = loadBoolean(transferObject.vpcEnabled); _applianceEnabled = loadBoolean(transferObject.applianceEnabled); if (this._applianceDomain == null) { this._applianceDomain = ""; } try { var userSpecifiedExtDnsValue:Object = DynaObjectUtils.getReqObject(transferObject, "externalDnsEnabled"); if(userSpecifiedExtDnsValue == null) { _selectedRtwsPubDnsAvailability = null; } else if(userSpecifiedExtDnsValue is Boolean) { _selectedRtwsPubDnsAvailability = ((userSpecifiedExtDnsValue as Boolean) ? DnsAvailability.AVAILABLE : DnsAvailability.UNAVAILABLE); } else { errMsg += "Invalid DigitalEdge DNS Entry value. Please re-set this value.\n"; _selectedRtwsPubDnsAvailability = null; } } catch(refError:ReferenceError) { // external DNS field not found ... could be a valid case (was not required by user in the environment) or an old version _selectedRtwsPubDnsAvailability = null; } } catch (exception:Error) { errMsg = exception.message + "\n"; } return errMsg; } } }
37.840862
138
0.706243
a7f976f0ee6ec7927b2d14ceeabbf3e730c75ea8
770
as
ActionScript
3XMobile/src/com/game/consts/ConstIcon.as
602147629/3xGame
dbee66de2a3d50ab8165b6d1c18d37051de396ec
[ "MIT" ]
1
2021-01-08T05:12:52.000Z
2021-01-08T05:12:52.000Z
3XMobile/src/com/game/consts/ConstIcon.as
602147629/3xGame
dbee66de2a3d50ab8165b6d1c18d37051de396ec
[ "MIT" ]
null
null
null
3XMobile/src/com/game/consts/ConstIcon.as
602147629/3xGame
dbee66de2a3d50ab8165b6d1c18d37051de396ec
[ "MIT" ]
1
2022-03-15T10:05:00.000Z
2022-03-15T10:05:00.000Z
package com.game.consts { /** * @author caihua * @comment 小图标 * 创建时间:2014-7-21 上午11:42:54 */ public class ConstIcon { //体力 public static const ICON_TYPE_ENERTY:int = 0; //银豆 public static const ICON_TYPE_SILVER:int = 1; //金豆 public static const ICON_TYPE_GOLD:int = 2; //星星 public static const ICON_TYPE_STAR:int = 12; //混合 public static const ICON_TYPE_MIXTURE:int = 13; //消除体icon列表 public static const ICON_OBSTACLES:Array = [51,52,53,54, 104 ,103,102, 101, 151, 105,106,107,108, 56,69,152 , 55]; //获取消除体的icon public static function getOBSIconById(itemid:int):int { for(var i:int = 0 ;i < ICON_OBSTACLES.length ; i++) { if(ICON_OBSTACLES[i] == itemid) { return i; } } return -1; } } }
20.810811
120
0.636364
51d00ccf5bfcc570ca88e2fc9aab9654013abcba
35,176
as
ActionScript
com/tinyspeck/engine/port/GetInfoDialog.as
tinyspeck/glitch-client
2ad533a82370694eddd16ec225e518115a9690b1
[ "CC0-1.0" ]
66
2015-01-19T03:03:00.000Z
2022-01-05T03:27:32.000Z
com/tinyspeck/engine/port/GetInfoDialog.as
Kiichi77/glitch-client
2ad533a82370694eddd16ec225e518115a9690b1
[ "CC0-1.0" ]
null
null
null
com/tinyspeck/engine/port/GetInfoDialog.as
Kiichi77/glitch-client
2ad533a82370694eddd16ec225e518115a9690b1
[ "CC0-1.0" ]
49
2015-01-13T20:20:50.000Z
2021-05-12T14:49:35.000Z
package com.tinyspeck.engine.port { import com.tinyspeck.debug.Console; import com.tinyspeck.engine.api.APICall; import com.tinyspeck.engine.control.TSFrontController; import com.tinyspeck.engine.data.SDBItemInfo; import com.tinyspeck.engine.data.client.Activity; import com.tinyspeck.engine.data.item.Item; import com.tinyspeck.engine.data.itemstack.Itemstack; import com.tinyspeck.engine.data.location.Location; import com.tinyspeck.engine.data.pc.PCSkill; import com.tinyspeck.engine.data.pc.PCStats; import com.tinyspeck.engine.data.reward.Reward; import com.tinyspeck.engine.data.skill.SkillDetails; import com.tinyspeck.engine.event.TSEvent; import com.tinyspeck.engine.net.NetOutgoingGenericMsgVO; import com.tinyspeck.engine.net.NetOutgoingGetPathToLocationVO; import com.tinyspeck.engine.net.NetOutgoingLocalChatVO; import com.tinyspeck.engine.sound.SoundMaster; import com.tinyspeck.engine.util.GetInfoVO; import com.tinyspeck.engine.util.SpriteUtil; import com.tinyspeck.engine.util.StringUtil; import com.tinyspeck.engine.util.TFUtil; import com.tinyspeck.engine.util.URLUtil; import com.tinyspeck.engine.view.gameoverlay.AchievementView; import com.tinyspeck.engine.view.gameoverlay.maps.MiniMapView; import com.tinyspeck.engine.view.itemstack.ItemIconView; import com.tinyspeck.engine.view.ui.BigDialog; import com.tinyspeck.engine.view.ui.Button; import com.tinyspeck.engine.view.ui.ItemSellersUI; import com.tinyspeck.engine.view.ui.SkillIcon; import com.tinyspeck.engine.view.ui.Slug; import com.tinyspeck.engine.view.ui.TSLinkedTextField; import com.tinyspeck.engine.view.ui.chat.ChatArea; import com.tinyspeck.engine.view.util.StaticFilters; import flash.display.Bitmap; import flash.display.DisplayObject; import flash.display.Graphics; import flash.display.Loader; import flash.display.MovieClip; import flash.display.Shape; import flash.display.Sprite; import flash.events.Event; import flash.events.KeyboardEvent; import flash.net.URLRequest; import flash.net.navigateToURL; import flash.text.TextField; import flash.utils.getTimer; public class GetInfoDialog extends BigDialog implements IMoveListener { /* singleton boilerplate */ public static const instance:GetInfoDialog = new GetInfoDialog(); private const ICON_WH:uint = 100; private const INFO_X:int = 200; private var reward_slug:Slug; private var item_info_ui:ItemInfoUI; private var skill_info_ui:SkillInfoUI; private var item_sellers_ui:ItemSellersUI; private var icon_view:ItemIconView; private var skill_icon:SkillIcon; private var share_bt:Button; private var chat_bt:Button; private var ok_bt:Button; private var auction_bt:Button; private var find_bt:Button; private var back_bt:Button; private var info_bt:Button; private var seller_bt:Button; private var info_url:URLRequest = new URLRequest(); private var economy_api_call:APICall; private var find_icon:DisplayObject; private var find_icon_disabled:DisplayObject; private var burst_holder:Sprite = new Sprite(); private var header_mask:Sprite = new Sprite(); private var find_holder:Sprite = new Sprite(); private var button_holder:Sprite = new Sprite(); private var seller_divider:Shape = new Shape(); private var button_cover:Shape = new Shape(); private var button_shadow:Shape = new Shape(); private var new_tf:TextField = new TextField(); private var skill_time_tf:TextField = new TextField(); private var find_tf:TSLinkedTextField = new TSLinkedTextField(); private var no_sellers_tf:TextField = new TextField(); private var item_class:String; private var skill_class:String; private var itemstack_tsid:String; private var routing_class:String; private var is_built:Boolean; private var is_item:Boolean; public function GetInfoDialog() { CONFIG::god { if(instance) throw new Error('Singleton'); } close_on_move = false; _close_bt_padd_right = 8; _close_bt_padd_top = 8; _base_padd = 15; _w = 540; _title_padd_left = INFO_X; _head_min_h = 60; _body_min_h = 165; _body_max_h = 350; _draggable = true; _construct(); item_info_ui = new ItemInfoUI(_w - INFO_X - _base_padd*2); TSFrontController.instance.registerMoveListener(this); } public function init():void { //listen for player changes model.worldModel.registerCBProp(onSkillComplete, "pc", "skill_training_complete"); model.worldModel.registerCBProp(onSkillChange, "pc", "skill_training"); model.worldModel.registerCBProp(onStatsChanged, "pc", "stats"); QuestManager.instance.addEventListener(TSEvent.QUEST_COMPLETE, onQuestComplete, false, 0, true); AchievementView.instance.addEventListener(TSEvent.COMPLETE, onAchievementComplete, false, 0, true); } private function buildBase():void { //title _title_tf.wordWrap = true; _title_tf.multiline = true; //set the header mask _head_sp.addChild(header_mask); _head_sp.mask = header_mask; //share button share_bt = new Button({ name: 'share', label: 'See in Encyclopedia', label_face: 'Arial', label_size: 11, label_bold: true, label_c: 0x005c73, label_hover_c: 0xd79035, label_offset: 1, text_align: 'left', graphic: new AssetManager.instance.assets.encyclopedia_link(), graphic_placement: 'left', graphic_padd_l: 1, draw_alpha: 0, tip: { txt: 'Opens in a new window', pointer: WindowBorder.POINTER_BOTTOM_CENTER } }); share_bt.x = _base_padd; share_bt.addEventListener(TSEvent.CHANGED, onEncyclopediaClick, false, 0, true); _body_sp.addChild(share_bt); chat_bt = new Button({ name: 'chat', label: 'Create link for chat', label_face: 'Arial', label_size: 11, label_bold: true, label_c: 0x005c73, label_hover_c: 0xd79035, label_offset: 1, text_align: 'left', graphic: new AssetManager.instance.assets.encyclopedia_link(), graphic_placement: 'left', graphic_padd_l: 1, draw_alpha: 0 }); chat_bt.x = _base_padd; chat_bt.addEventListener(TSEvent.CHANGED, onChatClick, false, 0, true); _body_sp.addChild(chat_bt); //auction button const auction_DO:DisplayObject = new AssetManager.instance.assets.info_auction(); auction_bt = new Button({ name: 'auction', label: 'Find auctions', value: -1, label_face: 'Arial', label_size: 11, label_bold: true, label_c: 0x005c73, label_hover_c: 0xd79035, label_offset: 1, text_align: 'left', graphic: auction_DO, graphic_placement: 'left', graphic_padd_l: 3, draw_alpha: 0, tip: { txt: 'Opens in a new window', pointer: WindowBorder.POINTER_BOTTOM_CENTER } }); auction_bt.x = _base_padd; auction_bt.addEventListener(TSEvent.CHANGED, onAuctionClick, false, 0, true); _body_sp.addChild(auction_bt); //find nearest find_icon = new AssetManager.instance.assets.find_nearest(); find_icon.y = 3; find_holder.addChild(find_icon); find_icon_disabled = new AssetManager.instance.assets.find_nearest_disabled(); find_icon_disabled.y = find_icon.y; find_holder.addChild(find_icon_disabled); TFUtil.prepTF(find_tf); find_tf.embedFonts = false; find_tf.x = find_icon.width + 2; find_tf.width = INFO_X - _base_padd*2 - find_tf.x; find_holder.addChild(find_tf); find_holder.x = int(_base_padd + auction_DO.width/2 - 2); _body_sp.addChild(find_holder); find_bt = new Button({ name: 'find_action', label: 'Set as destination', label_face: 'Arial', label_size: 11, label_bold: true, label_c: 0x005c73, label_hover_c: 0xd79035, text_align: 'left', graphic: buildArrow(false), graphic_hover: buildArrow(true), graphic_placement: 'left', graphic_padd_l: 4, graphic_padd_r: -2, graphic_padd_t: 6, draw_alpha: 0, h: 12 }); find_bt.addEventListener(TSEvent.CHANGED, onFindClick, false, 0, true); find_bt.x = find_tf.x; find_holder.addChild(find_bt); //back button var back_DO:DisplayObject = new AssetManager.instance.assets.back_circle(); back_bt = new Button({ label: '', name: 'back', graphic: back_DO, graphic_hover: new AssetManager.instance.assets.back_circle_hover(), graphic_disabled: new AssetManager.instance.assets.back_circle_disabled(), w: back_DO.width, h: back_DO.height, draw_alpha: 0 }); back_bt.x = -back_DO.width/2 + 1; back_bt.y = 12; back_bt.addEventListener(TSEvent.CHANGED, onBackClick, false, 0, true); //ok button ok_bt = new Button({ name: 'ok', label: 'OK!', size: Button.SIZE_DEFAULT, type: Button.TYPE_DEFAULT }); ok_bt.x = _w-ok_bt.width-15; ok_bt.addEventListener(TSEvent.CHANGED, onOKClick, false, 0, true); button_holder.addChild(ok_bt); //new item text TFUtil.prepTF(new_tf, false); new_tf.htmlText = '<p class="get_info_new">You discover a useful new item!</p>'; new_tf.mouseEnabled = false; new_tf.x = INFO_X; new_tf.y = 18; new_tf.visible = false; _head_sp.addChild(new_tf); //reward slug var reward:Reward = new Reward(Reward.IMAGINATION); reward.type = Reward.IMAGINATION; reward.amount = 5; reward_slug = new Slug(reward); reward_slug.x = int(INFO_X + new_tf.width + 5); reward_slug.visible = false; _head_sp.addChild(reward_slug); //handle the burst burst_holder.mouseEnabled = false; burst_holder.mouseChildren = false; burst_holder.visible = false; _head_sp.addChild(burst_holder); var burst_loader:MovieClip = new AssetManager.instance.assets.item_info_burst(); burst_loader.addEventListener(Event.COMPLETE, placeBurst, false, 0, true); //the item info ui item_info_ui.x = INFO_X; item_info_ui.y = _base_padd/2; item_info_ui.addEventListener(TSEvent.CHANGED, onItemInfoChanged, false, 0, true); //the skill info ui skill_info_ui = new SkillInfoUI(_w - INFO_X - _base_padd*2, this); skill_info_ui.x = INFO_X; skill_info_ui.y = _base_padd/2; skill_info_ui.addEventListener(TSEvent.CHANGED, onSkillInfoChanged, false, 0, true); //time to learn skill TFUtil.prepTF(skill_time_tf); skill_time_tf.wordWrap = false; _body_sp.addChild(skill_time_tf); addChild(_close_bt); // make sure it stays on top if(model.flashVarModel.use_economy_info){ const bt_h:uint = 23; //api call to view recent sellings of an item economy_api_call = new APICall(); economy_api_call.addEventListener(TSEvent.COMPLETE, onEconomyComplete, false, 0, true); info_bt = new Button({ name: 'info', label: 'Info', size: Button.SIZE_VERB, type: Button.TYPE_INFO_TAB, use_hand_cursor_always: true, h: bt_h }); info_bt.x = 15; info_bt.y = -11; info_bt.addEventListener(TSEvent.CHANGED, onInfoClick, false, 0, true); button_holder.addChild(info_bt); seller_bt = new Button({ name: 'sale', label: 'Find Sellers', size: Button.SIZE_VERB, type: Button.TYPE_INFO_TAB, use_hand_cursor_always: true, disabled: true, h: bt_h }); seller_bt.x = int(info_bt.x + info_bt.width + 5); seller_bt.y = info_bt.y; seller_bt.addEventListener(TSEvent.CHANGED, onSellerClick, false, 0, true); button_holder.addChild(seller_bt); item_sellers_ui = new ItemSellersUI(_w - INFO_X); item_sellers_ui.x = INFO_X; seller_divider.x = INFO_X+1; seller_divider.y = _head_min_h; seller_divider.visible = false; addChild(seller_divider); //setup the button covers addChild(button_cover); button_shadow.filters = StaticFilters.copyFilterArrayFromObject({knockout:true}, StaticFilters.black3px90DegreesInner_DropShadowA); addChild(button_shadow); //the text field for selling things TFUtil.prepTF(no_sellers_tf); no_sellers_tf.width = 200; no_sellers_tf.htmlText = '<p class="get_info_no_sellers">Darn!<br>It seems that no one is selling these.<br><br>Maybe you should jump on this untapped market!</p>'; no_sellers_tf.x = int(INFO_X + (_w - INFO_X)/2 - no_sellers_tf.width/2); } is_built = true; } private function buildArrow(is_hover:Boolean):Sprite { const arrow_bm:Bitmap = new AssetManager.instance.assets['solid_arrow'+(is_hover ? '_hover' : '')](); const arrow:Sprite = new Sprite(); arrow_bm.smoothing = true; SpriteUtil.setRegistrationPoint(arrow_bm); arrow.addChild(arrow_bm); arrow.rotation = 180; arrow.scaleX = arrow.scaleY = .6; return arrow; } private function placeBurst(event:Event):void { var burst:MovieClip = Loader(event.target.getChildAt(0)).content as MovieClip; if(burst){ SpriteUtil.setRegistrationPoint(burst); burst_holder.addChild(burst); } else { ; // satisfy compiler CONFIG::debugging { Console.warn('SOMETHING WRONG WITH ADDING THE BURST!'); } } burst_holder.x = int(INFO_X/2); _jigger(); } public function showInfo(giVO:GetInfoVO):void { if (giVO.type == GetInfoVO.TYPE_ITEM) { showItemInfo(giVO.item_class, giVO.itemstack_tsid); } else if (giVO.type == GetInfoVO.TYPE_SKILL) { showSkillInfo(giVO.skill_class); } else { ; CONFIG::debugging { Console.error('WTF type:'+giVO.type); } } } private function showItemInfo(item_class:String, itemstack_tsid:String):void { this.skill_class = null; this.routing_class = null; this.item_class = item_class; this.itemstack_tsid = itemstack_tsid; var item:Item = model.worldModel.getItemByTsid(item_class); var itemstack:Itemstack = model.worldModel.getItemstackByTsid(itemstack_tsid); if (itemstack) { routing_class = itemstack.routing_class; } else { routing_class = item.routing_class; } CONFIG::debugging { Console.info('routing_class:'+routing_class); } //build the base stuff if(!is_built) buildBase(); new_tf.visible = burst_holder.visible = reward_slug.visible = false; start(); } private function showSkillInfo(skill_class:String):void { this.item_class = null; this.skill_class = skill_class; //build the base stuff if(!is_built) buildBase(); new_tf.visible = burst_holder.visible = reward_slug.visible = false; start(); } private var callback_msg_when_closed:String; public function startFromServer(payload:Object):void { if(payload.class_tsid){ if (payload.callback_msg_when_closed) { callback_msg_when_closed = payload.callback_msg_when_closed; } TSFrontController.instance.showItemInfo(payload.class_tsid); new_tf.visible = burst_holder.visible = payload.is_new; if ('xp' in payload && int(payload.xp) > 0) { reward_slug.visible = true; reward_slug.amount = payload.xp; } else { reward_slug.visible = false; } _jigger(); } else { ; // satisfy compiler CONFIG::debugging { Console.warn('Can\'t view an item without a class_tsid!'); } } } override public function start():void { if(!canStart(model.flashVarModel.ok_on_info)) return; //build the base stuff if(!is_built) buildBase(); auction_bt.visible = false; find_holder.visible = false; if(model.flashVarModel.use_economy_info){ info_bt.visible = false; info_bt.disabled = false; seller_bt.visible = false; seller_bt.disabled = true; button_cover.visible = false; button_shadow.visible = false; if(no_sellers_tf.parent) no_sellers_tf.parent.removeChild(no_sellers_tf); } //see what we need to show if(item_class){ showItem(); } else if(skill_class){ showSkill(); } else { CONFIG::debugging { Console.warn('Missing item_class AND skill_class'); } return; } //handle the back button if(model.stateModel.get_info_history.length > 1){ var giVO:GetInfoVO = model.stateModel.get_info_history[model.stateModel.get_info_history.length-2]; var bt_tip:Object = { pointer: WindowBorder.POINTER_BOTTOM_CENTER }; switch(giVO.type){ case GetInfoVO.TYPE_ITEM: var item:Item = model.worldModel.getItemByTsid(giVO.item_class); if(item) bt_tip.txt = item.label; break; case GetInfoVO.TYPE_SKILL: var skill_details:SkillDetails = model.worldModel.getSkillDetailsByTsid(giVO.skill_class); if(skill_details) bt_tip.txt = skill_details.name; break; default: bt_tip = null; break; } addChild(back_bt); back_bt.tip = bt_tip; } else if(back_bt.parent){ back_bt.parent.removeChild(back_bt); } if (model.flashVarModel.ok_on_info && item_class) { _setFootContents(button_holder); } else { _setFootContents(null); } //only recall start if there isn't a parent if(!parent) { super.start(); } else { // pop it to the top TSFrontController.instance.getMainView().addView(this); } //set the last_x and last_y so this thing doesn't go all over the place last_x = x; last_y = y; } override public function end(release:Boolean):void { super.end(release); last_x = 0; last_y = 0; //only once the window is closed do we wipe the item history model.stateModel.get_info_history.length = 0; if (callback_msg_when_closed) { TSFrontController.instance.genericSend(new NetOutgoingGenericMsgVO(callback_msg_when_closed)); callback_msg_when_closed = null; } } public function preloadItems(item_tsids:Array):void { item_info_ui.preloadItems(item_tsids); } private function showItem():void { if (!item_class) { CONFIG::debugging { Console.warn('no item_class') } return; } var item:Item = model.worldModel.getItemByTsid(item_class); if (!item) { CONFIG::debugging { Console.warn('invalid item_class: '+item_class) } return; } is_item = true; share_bt.visible = false; if(_scroller.body.contains(skill_info_ui)) _scroller.body.removeChild(skill_info_ui); if(item_sellers_ui && _scroller.body.contains(item_sellers_ui)) { _scroller.body.removeChild(item_sellers_ui); seller_divider.visible = false; button_cover.visible = false; button_shadow.visible = false; } if(no_sellers_tf.parent) no_sellers_tf.parent.removeChild(no_sellers_tf); if(!_scroller.body.contains(item_info_ui)) _scroller.body.addChild(item_info_ui); //no longer caching information as it is per player (red box showing why they can't use an item for example _setTitle('<p class="get_info_title">'+item.label+'</p>'); //load the item data var itemstack:Itemstack = (itemstack_tsid) ? model.worldModel.getItemstackByTsid(itemstack_tsid) : null; var item_state:String = (!itemstack || !itemstack.itemstack_state || !Item.shouldUseCurrentStateForIconView(itemstack.class_tsid)) ? null : itemstack.itemstack_state.value; item_info_ui.visible = true; var force_reload:Boolean = !item.details || item.details.warnings.length != 0 || item.details.tips.length != 0; if (force_reload && item.details) { if (getTimer() - item.details_retrieved_ms < 5000) { force_reload = false; } } item_info_ui.show(item_class, force_reload, routing_class); // if we hve a stack, use its class for the icon, because it might be different than item_class due to Item.proxy_item var icon_item_class:String = (itemstack) ? itemstack.class_tsid : item_class; //set the url for when the encyclopedia link is clicked (starts with a / so we cut that off) info_url.url = item.details && item.details.info_url != null ? model.flashVarModel.root_url+item.details.info_url.substr(1) : null; //load the icon if(icon_view && icon_view.name == icon_item_class && (!icon_view || icon_view.s == item_state)) { //nuffin' } else { if(icon_view && icon_view.parent){ icon_view.parent.removeChild(icon_view); icon_view.dispose(); icon_view = null; } /* CONFIG::debugging { Console.warn(item_state); } */ icon_view = new ItemIconView(icon_item_class, ICON_WH, item_state, 'default', false, true, false, true); icon_view.visible = false; icon_view.x = int(INFO_X/2 - ICON_WH/2); if (icon_view.loaded) { onIconLoad(); } else { icon_view.addEventListener(TSEvent.COMPLETE, onIconLoad, false, 0, true); } icon_view.name = icon_item_class; icon_view.mouseEnabled = false; addChild(icon_view); } //kill the skill icon if(skill_icon && skill_icon.parent){ skill_icon.parent.removeChild(skill_icon); skill_icon = null; } skill_info_ui.visible = false; skill_time_tf.visible = false; } private function onIconLoad(e:TSEvent=null):void { _jigger(); if (icon_view) icon_view.visible = true; } private function showSkill():void { if (!skill_class) { CONFIG::debugging { Console.warn('no skill_class') } return; } is_item = false; if(_scroller.body.contains(item_info_ui)) _scroller.body.removeChild(item_info_ui); if(item_sellers_ui && _scroller.body.contains(item_sellers_ui)) { _scroller.body.removeChild(item_sellers_ui); seller_divider.visible = false; button_cover.visible = false; button_shadow.visible = false; } if(no_sellers_tf.parent) no_sellers_tf.parent.removeChild(no_sellers_tf); if(!_scroller.body.contains(skill_info_ui)) _scroller.body.addChild(skill_info_ui); _setTitle('<p class="get_info_title">&nbsp;</p>'); skill_info_ui.visible = true; skill_info_ui.show(skill_class, true); share_bt.visible = false; skill_time_tf.visible = false; //load the icon if(skill_icon && skill_icon.name == skill_class) { //nuffin' } else { if(skill_icon && skill_icon.parent){ skill_icon.parent.removeChild(skill_icon); skill_icon = null; } skill_icon = new SkillIcon(skill_class, SkillIcon.SIZE_100); skill_icon.mouseEnabled = false; skill_icon.x = int(INFO_X/2 - skill_icon.width/2); addChild(skill_icon); } //kill the item icon if(icon_view && icon_view.parent){ icon_view.parent.removeChild(icon_view); icon_view.dispose(); icon_view = null; } item_info_ui.visible = false; } private function onItemInfoChanged(event:TSEvent):void { _jigger(); } private function onSkillInfoChanged(event:TSEvent):void { //becuase we don't know things until the API sends them to us, we populate them here _setTitle('<p class="get_info_title">'+skill_info_ui.current_details.name+'</p>'); //set the url for when the encyclopedia link is clicked info_url.url = skill_info_ui.current_details.url; share_bt.visible = true; if(skill_info_ui.current_details.got){ skill_time_tf.htmlText = '<p class="get_info_skill_time"><span class="get_info_skill_learn">You know this skill</span></p>'; skill_time_tf.visible = true; } else if(skill_info_ui.current_details.seconds){ skill_time_tf.htmlText = '<p class="get_info_skill_time">'+StringUtil.formatTime(skill_info_ui.current_details.seconds, true, true, 2) + '<br><span class="get_info_skill_learn">to learn</span></p>'; skill_time_tf.visible = true; } _jigger(); } private function onEncyclopediaClick(event:TSEvent):void { //what happens when we click a link navigateToURL(info_url, URLUtil.getTarget("iteminfo")); } private function onOKClick(event:TSEvent):void { SoundMaster.instance.playSound('CLICK_SUCCESS'); end(true); } private function onFindClick(event:TSEvent):void { //depending on what we are showing, do different things if(find_bt.value == 'return'){ //head back to the real world TSFrontController.instance.sendLocalChat(new NetOutgoingLocalChatVO('/leave')); //end(true); } else { //set the location if(MiniMapView.instance.visible){ //tsid is in the find_bt.value TSFrontController.instance.genericSend(new NetOutgoingGetPathToLocationVO(find_bt.value)); end(true); } else { //no dice, throw a message in local activity model.activityModel.activity_message = Activity.createFromCurrentPlayer('Your mini map must be visible in order to set a destination'); } } } private function onInfoClick(event:TSEvent = null):void { if(!info_bt.disabled) return; //show the base item info if(item_sellers_ui.parent) { item_sellers_ui.parent.removeChild(item_sellers_ui); } if(!_scroller.body.contains(item_info_ui)) _scroller.body.addChild(item_info_ui); if(model.flashVarModel.use_economy_info){ seller_bt.disabled = true; info_bt.disabled = false; seller_divider.visible = false; if(no_sellers_tf.parent) no_sellers_tf.parent.removeChild(no_sellers_tf); } _jigger(); } private function onSellerClick(event:TSEvent = null):void { if(!seller_bt.disabled) return; //display the api data about recent sales if(item_info_ui.parent) item_info_ui.parent.removeChild(item_info_ui); //get the sales info for this bad boy if(model.flashVarModel.use_economy_info && item_class){ economy_api_call.economyBestSDBs(item_class); seller_bt.disabled = false; info_bt.disabled = true; } _jigger(); } override protected function enterKeyHandler(e:KeyboardEvent):void { if (button_holder.parent) { // item info SoundMaster.instance.playSound('CLICK_SUCCESS'); end(true); } else if (skill_info_ui.parent) { // skill info SoundMaster.instance.playSound('CLICK_SUCCESS'); skill_info_ui.dialogEnterKeyHandler(e); } } override protected function leftArrowKeyHandler(e:KeyboardEvent):void { if (back_bt.parent && model.stateModel.get_info_history.length > 1) { SoundMaster.instance.playSound('CLICK_SUCCESS'); goBack(); } } private function onBackClick(event:TSEvent):void { SoundMaster.instance.playSound('CLICK_SUCCESS'); goBack(); } private function goBack():void { //remove the last element and then view the one before that model.stateModel.get_info_history.pop(); var giVO:GetInfoVO = model.stateModel.get_info_history[model.stateModel.get_info_history.length-1]; showInfo(giVO); } private function onAuctionClick(event:TSEvent):void { TSFrontController.instance.openAuctionsPage(null, auction_bt.value); } private function onSkillComplete(pc_skill:PCSkill):void { //player has changed! reload(); } private function onSkillChange(pc_skill:PCSkill):void { //player is doing something with skill, reload if(!is_item) reload(); } private function onStatsChanged(pc_stats:PCStats):void { //new stats, let's reload the data -- commented out for now as this could get nuts //reload(); } private function onQuestComplete(event:TSEvent):void { if(parent) reload(); } private function onAchievementComplete(event:TSEvent):void { if(parent) reload(); } private function onChatClick(event:TSEvent):void { //puts the link in the chat window const chat_area:ChatArea = RightSideManager.instance.right_view.getChatToFocus(); var label:String; var link_txt:String; if(is_item){ const item:Item = model.worldModel.getItemByTsid(item_class); if(item){ label = item.label; link_txt = TSLinkedTextField.LINK_ITEM+'|'+item_class; } } else { const skill:SkillDetails = model.worldModel.getSkillDetailsByTsid(skill_class); if(skill){ label = skill.name; link_txt = TSLinkedTextField.LINK_SKILL+'|'+skill_class; } } //toss it in the chat area if(chat_area && label){ chat_area.input_field.setLinkText(label, link_txt); chat_area.focus(); } } private function onEconomyComplete(event:TSEvent):void { //enable us to click things if(item_sellers_ui && event && event.data) { if(!_scroller.body.contains(item_sellers_ui)) _scroller.body.addChild(item_sellers_ui); seller_divider.visible = true; const item_infos:Vector.<SDBItemInfo> = event.data as Vector.<SDBItemInfo>; item_sellers_ui.show(item_infos); if(item_infos && !item_infos.length){ //no sellers! addChild(no_sellers_tf); } else if(item_infos && item_infos.length && no_sellers_tf.parent){ //get outta here no_sellers_tf.parent.removeChild(no_sellers_tf); } _jigger(); } } private function reload():void { //if we are open, let's reload the data if(parent) start(); } override protected function _jigger():void { super._jigger(); //setup the title so it wraps nice _title_tf.width = _close_bt.x - _title_tf.x - 5; //slug reward_slug.y = int(new_tf.y + (new_tf.height/2 - reward_slug.height/2)); _head_h = Math.max(_head_padd_top + _title_tf.height + _head_padd_bottom, _head_min_h); if(new_tf.visible){ _title_tf.y = new_tf.y + new_tf.height; _head_h = _title_tf.y + _title_tf.height + _head_padd_bottom; } else { _title_tf.y = int(_head_h/2 - _title_tf.height/2) + _border_w; } _body_sp.y = _head_h; //draw stuff var g:Graphics = header_mask.graphics; g.clear(); g.beginFill(0); g.drawRect(0, 0, _head_sp.width, _head_h); _body_h = Math.max(_body_min_h, (is_item ? item_info_ui.height : skill_info_ui.height) + _base_padd*2); _body_h = Math.min(_body_max_h, _body_h); //draw the divider g = seller_divider.graphics; g.clear(); g.beginFill(_body_border_c); g.drawRect(0, 0, 1, _body_h); //move the burst burst_holder.y = _head_h + 8; //icon moving if(icon_view){ icon_view.y = _head_h-ICON_WH/2 + 10; } if(skill_icon){ skill_icon.y = _head_h-ICON_WH/2 + 10; //skill time skill_time_tf.x = int(INFO_X/2 - skill_time_tf.width/2); skill_time_tf.y = ICON_WH - _head_h + 22; //put the chat button below the time chat_bt.y = int(skill_time_tf.y + skill_time_tf.height + 23); } else { chat_bt.y = ICON_WH - 25; } share_bt.y = int(chat_bt.y + chat_bt.height + 5); //if this item is good for auctions, let's show it const item:Item = model.worldModel.getItemByTsid(item_class); if(item && item.details) { if(item.is_auctionable){ auction_bt.value = item.details.item_url_part; auction_bt.visible = true; } if(item.details.is_sdbable && model.flashVarModel.use_economy_info){ info_bt.visible = true; seller_bt.visible = true; button_cover.visible = true; button_shadow.visible = true; } info_url.url = item.details && item.details.info_url ? model.flashVarModel.root_url+item.details.info_url.substr(1) : null; share_bt.visible = item.details.info_url != null; //set the auction button auction_bt.y = int((share_bt.visible ? share_bt.y + share_bt.height : chat_bt.y + chat_bt.height) + 5); //show the find nearest find_holder.visible = routing_class && item_info_ui.retrieved_routing; if (routing_class && item_info_ui.retrieved_routing) { const bt_padd:uint = 7; setFindNearest(); if (auction_bt.visible) { find_holder.y = auction_bt.y + auction_bt.height + bt_padd; } else if (share_bt.visible) { find_holder.y = share_bt.y + share_bt.height + bt_padd; } else { find_holder.y = chat_bt.y + chat_bt.height + bt_padd; } //if the body height is the min and we are showing this, let's bump it up const body_padd:uint = 25; if(_body_h <= _body_min_h + body_padd){ _body_h = _body_min_h + body_padd; } } } //set the ok button if (button_holder.parent) { _foot_h = 60; _foot_max_h = _foot_h; if(!model.flashVarModel.use_economy_info){ button_holder.y = Math.round((_foot_h-button_holder.height-4)/2); } else { button_holder.y = int(_foot_h/2 - ok_bt.height/2 - 1); } _foot_sp.y = _head_h + _body_h; } else { // I am not sure why all these calcs, I think it should always be zero _foot_h = _scroller.body_h > _scroller.h ? _foot_min_h : 0; } //draw the button covers (-2, +2 account for the borders) if(model.flashVarModel.use_economy_info){ g = button_cover.graphics; g.clear(); g.beginFill(_body_fill_c); g.drawRect(0, 0, int(info_bt.disabled ? seller_bt.width : info_bt.width) - 2, 2); button_cover.y = int(_foot_sp.y + button_holder.y + info_bt.y); button_cover.x = button_holder.x + (info_bt.disabled ? seller_bt.x : info_bt.x) + 2; g = button_shadow.graphics; g.clear(); g.beginFill(0); g.drawRect(0, 0, int(info_bt.disabled ? info_bt.width : seller_bt.width), 6); button_shadow.y = int(_foot_sp.y + button_holder.y + info_bt.y + 1); button_shadow.x = button_holder.x + (info_bt.disabled ? info_bt.x : seller_bt.x) + 1; //mode the no seller text if(no_sellers_tf.parent){ no_sellers_tf.y = int(_head_h + _body_h/2 - no_sellers_tf.height/2); } } _scroller.h = _body_h - _divider_h*2; _scroller.refreshAfterBodySizeChange(); //draw it up _h = _head_h + _body_h + _foot_h; _draw(); } private function setFindNearest():void { const item:Item = model.worldModel.getItemByTsid(item_class); find_icon.visible = item_info_ui.routing_location != null; find_icon_disabled.visible = !find_icon.visible; find_bt.visible = true; var txt:String = '<p class="get_info_near">'; if (item_info_ui.routing_location) { const loc:Location = item_info_ui.routing_location; if (loc == model.worldModel.location) { txt += 'The nearest '+item.label+' is right here in your location!'; find_bt.visible = false; } else { txt += 'The nearest '+item.label+ ' is in <a href="event:'+TSLinkedTextField.LINK_LOCATION+'|'+loc.hub_id+'#'+loc.tsid+'"><b>'+loc.label+'</b></a>'; find_bt.label = 'Set as destination'; find_bt.value = loc.tsid; } } else { txt += 'Can’t find any '+item.label_plural+' where you are now'; find_bt.label = 'Return to the Real World'; find_bt.value = 'return'; find_bt.visible = model.worldModel.location.is_pol; } txt += '</p>'; find_tf.htmlText = txt; find_bt.y = find_bt.visible ? int(find_tf.y + find_tf.height + 1) : 0; } // IMoveListener funcs // ----------------------------------------------------------------- public function moveLocationHasChanged():void { } public function moveLocationAssetsAreReady():void { } public function moveMoveStarted():void { this.visible = false; } public function moveMoveEnded():void { this.visible = true; if (!parent) return; // make it refresh if(item_class){ showItem(); } } } }
30.775153
175
0.688538
4e4c0350378fbd9d0f35a81c45b7ec6931ffef96
1,741
as
ActionScript
app/client/src/view/image/shop/ShopItemButton.as
yamatoyaryuta/Unlight
37a5080e477a6bf6c03f671d1f8229502a6437e9
[ "MIT" ]
171
2019-07-30T10:02:59.000Z
2022-02-07T12:50:07.000Z
app/client/src/view/image/shop/ShopItemButton.as
outshaker/Unlight
015d92e4493f81a8e7975f60f7473e156322187b
[ "MIT" ]
11
2019-08-01T14:39:17.000Z
2019-08-17T05:17:50.000Z
app/client/src/view/image/shop/ShopItemButton.as
outshaker/Unlight
015d92e4493f81a8e7975f60f7473e156322187b
[ "MIT" ]
82
2019-08-03T12:45:48.000Z
2022-03-03T01:28:24.000Z
package view.image.shop { import flash.display.*; import flash.events.Event; import view.image.BaseImage; /** * ShopItemButton表示クラス * */ public class ShopItemButton extends BaseImage { // HP表示元SWF [Embed(source="../../../../data/image/shop/btn_item.swf")] private var _Source:Class; private static const X:int = 96; private static const Y:int = 32; private static const BUTTON:String = "btn_a"; private var _chAButton :SimpleButton; protected var _button:SimpleButton; private var _index:int = 0; /** * コンストラクタ * */ public function ShopItemButton(index:int =0 ) { super(); _index = index; } override protected function swfinit(event: Event): void { super.swfinit(event); initializePos(); _button = SimpleButton(_root.getChildByName(buttonName)); } override protected function get Source():Class { return _Source; } protected function get buttonName():String { return BUTTON; } public function initializePos():void { x = X*_index; y = Y; } public function onButton():void { waitComplete(setOnButton); } public function offButton():void { waitComplete(setOffButton); } private function setOnButton():void { _button.visible = false; } private function setOffButton():void { _button.visible = true; } } }
20.72619
69
0.515796
d7a9e61766db8cded5e5634c05a75291a414e3a7
503
as
ActionScript
src/game/beach/WaterCover.as
JordanMagnuson/The-Killer
b002fb5fca50df69a43c460c604c17faca298f5a
[ "AAL" ]
6
2015-11-20T05:09:49.000Z
2020-11-05T01:10:39.000Z
src/game/beach/WaterCover.as
JordanMagnuson/The-Killer
b002fb5fca50df69a43c460c604c17faca298f5a
[ "AAL" ]
null
null
null
src/game/beach/WaterCover.as
JordanMagnuson/The-Killer
b002fb5fca50df69a43c460c604c17faca298f5a
[ "AAL" ]
9
2015-02-04T17:05:31.000Z
2022-03-28T16:07:54.000Z
package game.beach { import net.flashpunk.Entity; import net.flashpunk.graphics.Backdrop; import net.flashpunk.FP; /** * ... * @author Jordan Magnuson */ public class WaterCover extends Entity { public var backdrop:Backdrop = new Backdrop(Assets.WATER_COVER, false, false); public function WaterCover() { graphic = backdrop; x = 0; y = FP.height; // layer = 9998; // y = FP.height; // layer = -999; //graphic.scrollX = 0; //graphic.scrollY = 0; } } }
17.344828
80
0.630219
b5da7d6e9d9a40e5d38e7910c48bdb88fd8ac846
8,985
as
ActionScript
src/jwplayer-6.7-free/src/flash/com/longtailvideo/jwplayer/model/PlaylistItem.as
mrwii/mockup-skin-for-jw6
bb5311b4a48c70b1bd253abb0f1f8b6253a7f962
[ "MIT" ]
1
2016-02-01T01:49:13.000Z
2016-02-01T01:49:13.000Z
src/jwplayer-6.7-free/src/flash/com/longtailvideo/jwplayer/model/PlaylistItem.as
mrwii/mockup-skin-for-jw6
bb5311b4a48c70b1bd253abb0f1f8b6253a7f962
[ "MIT" ]
null
null
null
src/jwplayer-6.7-free/src/flash/com/longtailvideo/jwplayer/model/PlaylistItem.as
mrwii/mockup-skin-for-jw6
bb5311b4a48c70b1bd253abb0f1f8b6253a7f962
[ "MIT" ]
null
null
null
package com.longtailvideo.jwplayer.model { import com.longtailvideo.jwplayer.utils.Logger; import com.longtailvideo.jwplayer.utils.Strings; /** * Playlist item data. The class is dynamic; any items parsed from the jwplayer XML namespace are added to the item. * * @author Pablo Schklowsky */ public dynamic class PlaylistItem { public var description:String = ""; public var image:String = ""; public var mediaid:String = ""; public var title:String = ""; protected var _duration:Number = -1; protected var _provider:String = ""; protected var _start:Number = 0; protected var _streamer:String = ""; protected var _type:String = null; protected var _currentLevel:Number = 0; protected var _levels:Array = []; protected var _tracks:Array = []; public function PlaylistItem(obj:Object = null) { if (!obj) obj = {}; if (obj.sources is Array) { obj.levels = obj.sources; delete obj.sources; } if (!obj.levels && obj.file) { var singleLevel:Object = { file: obj.file, type: obj.type, label: obj.label }; obj.levels = [singleLevel]; } delete obj.file; delete obj.type; delete obj.label; delete obj.duration; for (var itm:String in obj) { if (itm == "levels") { if (!(obj[itm] is Array)) { continue; } var levels:Array = obj[itm] as Array; for (var i:Number = 0; i < levels.length; i++) { var level:Object = levels[i]; if (level['file']) { var newLevel:PlaylistItemLevel = new PlaylistItemLevel(level['file'], level['type'], level['default'], level['streamer']); for (var otherProp:String in level) { switch(otherProp) { case "file": case "type": case "default": case "streamer": break; default: newLevel[otherProp] = level[otherProp]; break; } } if (!newLevel.type || !newLevel.type.length) { newLevel.type = levelType(level); } addLevel(newLevel); } } } else if (itm == "tracks") { if (!(obj[itm] is Array)) { continue; } this[itm] = []; var tracks:Array = obj[itm] as Array; for (i = 0; i < tracks.length; i++) { var track:Object = tracks[i]; if (track['file']) { var newTrack:PlaylistItemTrack = new PlaylistItemTrack(track['file'], track['kind'], track['default'], track['label']); if (!newTrack.kind || !newTrack.kind.length) { newTrack.kind = "captions"; } this[itm].push(newTrack); } } } else { try { this[itm] = obj[itm]; } catch(e:Error) { Logger.log("Could not set playlist item property " + itm + " (" + e.message+")"); } } } for (i = 0; i < this["levels"].length; i++) { level = this["levels"][i]; if (!level.hasOwnProperty("label")) { level.label = i.toString(); } } var captionsCount:Number = 0; for (i = 0; i < this["tracks"].length; i++) { track = this["tracks"][i]; if (track.kind == "captions") { if (!track.hasOwnProperty("label")) { track.label = captionsCount.toString(); } captionsCount++; } } } /** File property is now a getter, to take levels into account **/ public function get file():String { var getFile:String = ""; if (_levels.length > 0 && _currentLevel > -1 && _currentLevel < _levels.length) { getFile = (_levels[_currentLevel] as PlaylistItemLevel).file; } return getFile.replace(/(feed|data):/g, ""); } /** File setter. Note, if levels are defined, this will be ignored. **/ public function set file(f:String):void { _levels = []; addLevel(new PlaylistItemLevel(f)) } /** Streamer property is now a getter, to take levels into account **/ public function get streamer():String { if (_levels.length > 0 && _currentLevel > -1 && _currentLevel < _levels.length) { var level:PlaylistItemLevel = _levels[_currentLevel] as PlaylistItemLevel; return level.streamer ? level.streamer : _streamer; } else { return _streamer; } } /** Streamer setter. Note, if levels are defined, this will be ignored. **/ public function set streamer(s:String):void { _streamer = s; } /** The quality levels associated with this playlist item **/ public function get levels():Array { return _levels; } /** Insert an additional bitrate level, keeping the array sorted from highest to lowest. **/ public function addLevel(newLevel:PlaylistItemLevel):void { if (validExtension(newLevel)) { // Removing playlist level sorting /* if (_currentLevel < 0) _currentLevel = 0; for (var i:Number = 0; i < _levels.length; i++) { var level:PlaylistItemLevel = _levels[i] as PlaylistItemLevel; if (newLevel.bitrate > level.bitrate) { _levels.splice(i, 0, newLevel); return; } else if ( (isNaN(newLevel.bitrate) || newLevel.bitrate == level.bitrate) && newLevel.width > level.width) { _levels.splice(i, 0, newLevel); return; } } */ _levels.push(newLevel); } } /** Levels need to be cleared e.g. for reloading a multibitrate SMIL. **/ public function clearLevels():void { _levels = new Array(); }; /** * Determines whether this file extension can be played in the Flash player. If not, ignore the level. * This is useful for unified HTML5 / Flash failover setups. **/ protected function validExtension(level:Object):Boolean { if (_type) { return (typeMap(levelType(level)) == typeMap(_type)); } else { var lType:String = levelType(level); if (lType) { if (typeMap(lType)) { _type = lType; return true; } } else { // No valid extension, but if provider is set manually, try to play using that provider. if (_provider) return true; } } return false; } public function get currentLevel():Number { return _currentLevel; } /** Set this PlaylistItem's level to match the given bitrate and height. **/ public function setLevel(newLevel:Number):void { if (newLevel >= 0 && newLevel < _levels.length) { _currentLevel = newLevel; } else { throw(new Error("Level index out of bounds")); } } public function toString():String { return "[PlaylistItem" + (this.file ? " file=" + this.file : "") + (this.streamer ? " streamer=" + this.streamer : "") + (this.provider ? " provider=" + this.provider : "") + (this.levels.length ? " level=" + this.currentLevel.toString() : "") + "]"; } public function get start():Number { return _start; } public function set start(s:*):void { _start = Strings.seconds(String(s)); if (_start > _duration && _duration > 0) { _duration += _start; } } public function get duration():Number { return _duration; } public function set duration(d:*):void { _duration = Strings.seconds(String(d)); if (_start > _duration && _duration > 0) { _duration += _start; } } private function levelType(level:Object):String { if (level) { if (level.type) return level.type; else { if (level.streamer || level.file.substr(0,4) == 'rtmp') return "rtmp"; else if (level.file) { if (Strings.isYouTube(level.file)) return "youtube"; else { return extensionMap(Strings.extension(level.file)); } } } } return null; } private function extensionMap(extension:String):String { switch (extension) { case "flv": return "flv"; case "mov": case "f4v": case "m4v": case "mp4": return "mp4"; case "m4a": case "aac": case "f4a": return "aac"; break; case "mp3": return "mp3"; break; case "smil": return "rtmp"; break; case "webm": return "webm"; break; case "ogg": case "oga": return "vorbis"; break; } return null; } private function typeMap(type:String):String { switch (type) { case "flv": case "mp4": case "aac": case "video": return "video"; break; case "mp3": case "sound": return "sound"; break; case "rtmp": return "rtmp"; break; case "youtube": return "youtube"; break; } return null; } public function get provider():String { if (_provider) { return _provider; } else if (_levels.length > 0) { return typeMap(levelType(_levels[_currentLevel])); } return null; } public function set provider(p:*):void { _provider = (p == "audio") ? "sound" : p; } public function get type():String { return _type; } public function get tracks():Array { return _tracks; } public function set tracks(t:Array):void { _tracks = t; } } }
25.744986
118
0.587869
b22afb502b2a2be6ebf12234f6d799b3df95766a
8,278
as
ActionScript
SJGame/src/SJ/Game/transferAbility/CJTransferAbilityHeroHeadItem.as
liu-jack/SJGame
2ade3f9d4ec3cf6a6589301d77dd980cfa2500d5
[ "MIT" ]
1
2021-06-09T23:39:11.000Z
2021-06-09T23:39:11.000Z
SJGame/src/SJ/Game/transferAbility/CJTransferAbilityHeroHeadItem.as
liu-jack/SJGame
2ade3f9d4ec3cf6a6589301d77dd980cfa2500d5
[ "MIT" ]
null
null
null
SJGame/src/SJ/Game/transferAbility/CJTransferAbilityHeroHeadItem.as
liu-jack/SJGame
2ade3f9d4ec3cf6a6589301d77dd980cfa2500d5
[ "MIT" ]
null
null
null
package SJ.Game.transferAbility { import SJ.Common.Constants.ConstHero; import SJ.Game.data.CJDataManager; import SJ.Game.data.CJDataOfRole; import SJ.Game.data.CJDataOfTransferAbility; import SJ.Game.data.config.CJDataHeroProperty; import SJ.Game.data.config.CJDataOfHeroPropertyList; import SJ.Game.formation.CJItemTurnPageBase; import SJ.Game.lang.CJLang; import SJ.Game.layer.CJLayerManager; import SJ.Game.player.CJPlayerData; import SJ.Game.player.CJPlayerNpc; import engine_starling.SApplication; import engine_starling.display.SLayer; import feathers.controls.ImageLoader; import flash.filters.ConvolutionFilter; import flash.filters.GlowFilter; import flash.geom.Point; import lib.engine.utils.functions.Assert; import starling.events.Touch; import starling.events.TouchEvent; import starling.events.TouchPhase; import starling.text.TextField; /** * 传功武将头像单元 * @author zhengzheng * */ public class CJTransferAbilityHeroHeadItem extends CJItemTurnPageBase { /** 控件宽度 **/ private const CONST_WIDTH:int = 66; /** 控件高度 **/ private const CONST_HEIGHT:int = 70; /** 武将头像背景X坐标 **/ private const CONST_HEAD_BG_X:int = 0; /** 武将头像背景Y坐标 **/ private const CONST_HEAD_BG_Y:int = 10; /** 武将头像X坐标 **/ private const CONST_HEAD_X:int = 35; /** 武将头像Y坐标 **/ private const CONST_HEAD_Y:int = 62; /** 武将头像中心点X **/ private const CONST_HEAD_PIVOT_X:int = 47; /** 武将头像中心点Y **/ private const CONST_HEAD_PIVOT_Y:int = 73; private var _templateId:int; private var _heroId:String; // 武将头像底框 private var _imgHeroIconBG:ImageLoader; // 武将头像 private var _imgHeroIcon:ImageLoader; // 出战标志 private var _imgInFormation:ImageLoader; // 武将名称 private var _heroName:TextField; //角色数据 private var _dataRole:CJDataOfRole; /** 拖动武将的虚影 **/ private var _shadow:CJPlayerNpc = null; /*虚影层,防止引起重绘*/ private var _shadowLayer:SLayer; //传功阵型信息 private var _transferAbilityData:CJDataOfTransferAbility; public function CJTransferAbilityHeroHeadItem() { super("CJTransferAbilityHeroHeadItem"); } override protected function initialize():void { super.initialize(); this._initData(); this._initControls(); _addListeners(); } /** * 添加监听 * */ private function _addListeners():void { //增加拖拽监听事件 this.addEventListener(TouchEvent.TOUCH , this._startDrag); } /** * 选中武将拖拽处理 * @comment : 1.初始选中显示方块 2.结束检测是否可以放置武将 */ private function _startDrag(e:TouchEvent):void { var touch:Touch = e.getTouch(this); if(touch != null) { e.stopPropagation(); if(touch.target.parent is CJTransferAbilityHeroHeadItem) { //开始拖拽显示虚影 if(touch.phase == TouchPhase.BEGAN) { this._createShadow(touch); } //拖拽显示虚影 else if(touch.phase == TouchPhase.MOVED) { this._showShadow(touch); } //控制拖拽武将放置 else if(touch.phase == TouchPhase.ENDED) { this._placeHero(touch); } } } } /** * 创建武将虚影 * @param touch * */ private function _createShadow(touch:Touch):void { this._shadow = this._transferAbilityData.getNpc(this._heroId); if(this._shadow == null) { var playerData:CJPlayerData = new CJPlayerData(); playerData.heroId = this._heroId; playerData.templateId = this._templateId; _shadow = new CJPlayerNpc(playerData , null); _shadow.scaleX = 1.2; _shadow.scaleY = 1.2; _shadow.lodlevel = CJPlayerNpc.LEVEL_LOD_1; // _shadow.lodlevel = CJPlayerNpc.LEVEL_LOD_1 | CJPlayerNpc.LEVEL_LOD_2; _transferAbilityData.addNpc(this._heroId , _shadow); } _shadow.alpha = 0.7; this._shadowLayer = new SLayer(); this._shadowLayer.width = this.stage.width; this._shadowLayer.height = this.stage.height; this._shadowLayer.touchable = false; CJLayerManager.o.tipsLayer.addChild(this._shadowLayer); var localPoint:Point = this._shadowLayer.globalToLocal(new Point(touch.globalX , touch.globalY)); this._shadowLayer.addChildTo(this._shadow , localPoint.x , localPoint.y); _shadow.hidebattleInfo(); } /** * 显示拖拽虚影 * @param touch * */ private function _showShadow(touch:Touch):void { if(this._shadow) { var localPoint:Point = this._shadowLayer.globalToLocal(new Point(touch.globalX , touch.globalY)); this._shadow.x = localPoint.x; this._shadow.y = localPoint.y; } } /** * 放置武将 */ private function _placeHero(touch:Touch):void { //移除虚影 this._removeShadow(); //找出可放置的方块 var touchedSquare:CJTransferAbilityHeroItemLayer = this._getPlaceSquare(touch); //保存阵型信息 修改Model的数据 if(_transferAbilityData && this._shadow != null && touchedSquare != null) { _transferAbilityData.saveFormation(this._shadow.playerData.heroId,touchedSquare.id); } } /** * 找出可放置武将的方块 * @param touch * @return */ private function _getPlaceSquare(touch:Touch):CJTransferAbilityHeroItemLayer { var transferAbilityLayer:CJTransferAbilityLayer = this.owner.parent.parent as CJTransferAbilityLayer; var list:Array = transferAbilityLayer.arrayHero; for each(var square:CJTransferAbilityHeroItemLayer in list) { if(square.checkHitMe(touch.getLocation(square))) { return square; } } return null; } /** * 移除虚影 * */ private function _removeShadow():void { if(this._shadowLayer && this._shadowLayer.parent) { this._shadowLayer.removeFromParent(); } } /** * 初始化数据 * */ private function _initData():void { this._dataRole = CJDataManager.o.getData("CJDataOfRole") as CJDataOfRole; _transferAbilityData = CJDataOfTransferAbility.o; } /** * 初始化控件 * */ private function _initControls():void { width = CONST_WIDTH; height = CONST_HEIGHT; // 武将头像底框 _imgHeroIconBG = new ImageLoader(); _imgHeroIconBG.source = SApplication.assets.getTexture("common_wujiangkuang"); _imgHeroIconBG.x = CONST_HEAD_BG_X; _imgHeroIconBG.y = CONST_HEAD_BG_Y; addChild(_imgHeroIconBG); // 武将头像 _imgHeroIcon = new ImageLoader(); _imgHeroIcon.x = CONST_HEAD_X; _imgHeroIcon.y = CONST_HEAD_Y; _imgHeroIcon.pivotX = CONST_HEAD_PIVOT_X; _imgHeroIcon.pivotY = CONST_HEAD_PIVOT_Y; addChild(_imgHeroIcon); // 出战标志 _imgInFormation = new ImageLoader(); _imgInFormation.x = 6; _imgInFormation.y = 55; addChild(_imgInFormation); // 武将名称 _heroName = new TextField(15, 75, ""); _heroName.x = 46; _heroName.y = 5; _textStroke(_heroName); addChild(_heroName); } override protected function draw():void { super.draw(); const isSelectInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_DATA); if(isSelectInvalid) // 判断是否应该刷新 { _heroId = this.data["heroid"]; _templateId = this.data["templateid"]; var heroProperty:CJDataHeroProperty = CJDataOfHeroPropertyList.o.getProperty(int(_templateId)); Assert( heroProperty!=null, "CJItemRecastHeroHeadItem--> heroProperty==null" ); if (heroProperty) { // 武将头像 _imgHeroIcon.source = SApplication.assets.getTexture(heroProperty.headicon); // 武将名字 _heroName.text = CJLang(heroProperty.name); _heroName.color = ConstHero.ConstHeroNameColor[int(heroProperty.quality)]; _imgHeroIconBG.source = SApplication.assets.getTexture("common_wujiangkuang"); var isInFormation:Boolean = CJDataManager.o.DataOfFormation.isHeroPlaced(_heroId); if (isInFormation) { _imgInFormation.source = SApplication.assets.getTexture("chuangong_chuzhan"); } else { _imgInFormation.source = null; } } } } /** * 点击事件 * @param selectedIndex * @param item * */ override protected function onSelected():void { } private function _textStroke(tf:TextField):void { var matrix:Array = [0,1,0, 1,1,1, 0,1,0]; tf.nativeFilters = [new ConvolutionFilter(3,3,matrix,3), new GlowFilter(0x000000,1.0,2.0,2.0,5,2)]; } public function get templateId():int { return _templateId; } public function get heroId():String { return _heroId; } override public function set isSelected(value:Boolean):void { } } }
24.710448
104
0.683982
892db5a75c7ad9ae93c1cd19c8ded5768cc94bb8
91
as
ActionScript
Source Flash/scripts/cmodule/decry/AS3_NOP.as
itspaiva/DDTank4.1
99d67ca8ad15851b8a37e9dddf2f3f9018c770e4
[ "MIT" ]
4
2021-11-13T07:22:26.000Z
2022-02-21T20:38:53.000Z
Source Flash/scripts/cmodule/decry/AS3_NOP.as
itspaiva/DDTank4.1
99d67ca8ad15851b8a37e9dddf2f3f9018c770e4
[ "MIT" ]
null
null
null
Source Flash/scripts/cmodule/decry/AS3_NOP.as
itspaiva/DDTank4.1
99d67ca8ad15851b8a37e9dddf2f3f9018c770e4
[ "MIT" ]
7
2021-11-13T07:22:31.000Z
2022-02-15T07:08:09.000Z
package cmodule.decry { function AS3_NOP(param1:*) : * { return param1; } }
11.375
33
0.571429
0e2b1f2300353e19a76c40facb4ea69a8326eea3
1,969
as
ActionScript
Source Flash/scripts/im/info/PresentRecordInfo.as
itspaiva/DDTank4.1
99d67ca8ad15851b8a37e9dddf2f3f9018c770e4
[ "MIT" ]
4
2021-11-13T07:22:26.000Z
2022-02-21T20:38:53.000Z
Source Flash/scripts/im/info/PresentRecordInfo.as
itspaiva/DDTank4.1
99d67ca8ad15851b8a37e9dddf2f3f9018c770e4
[ "MIT" ]
null
null
null
Source Flash/scripts/im/info/PresentRecordInfo.as
itspaiva/DDTank4.1
99d67ca8ad15851b8a37e9dddf2f3f9018c770e4
[ "MIT" ]
7
2021-11-13T07:22:31.000Z
2022-02-15T07:08:09.000Z
package im.info { import ddt.manager.PlayerManager; import road7th.utils.DateUtils; public class PresentRecordInfo { public static const SHOW:int = 0; public static const HIDE:int = 1; public static const UNREAD:int = 2; public var id:int; public var exist:int = 2; public var messages:Vector.<String>; public var recordMessage:Vector.<Object>; public function PresentRecordInfo() { super(); this.messages = new Vector.<String>(); this.recordMessage = new Vector.<Object>(); } public function addMessage(param1:String, param2:Date, param3:String) : void { var _loc4_:String = DateUtils.dateFormat(param2); var _loc5_:String = ""; if(param1 == PlayerManager.Instance.Self.NickName) { _loc5_ = _loc5_ + ("<FONT COLOR=\'#06f710\'>" + param1 + " " + _loc4_.split(" ")[1] + "</FONT>\n"); } else { _loc5_ = _loc5_ + ("<FONT COLOR=\'#ffff01\'>" + param1 + " " + _loc4_.split(" ")[1] + "</FONT>\n"); } _loc5_ = _loc5_ + param3; this.messages.push(_loc5_); var _loc6_:String = ""; if(param1 == PlayerManager.Instance.Self.NickName) { _loc6_ = _loc6_ + ("<FONT COLOR=\'#06f710\'>" + param1 + " " + _loc4_ + "</FONT>\n"); } else { _loc6_ = _loc6_ + ("<FONT COLOR=\'#ffff01\'>" + param1 + " " + _loc4_ + "</FONT>\n"); } _loc6_ = _loc6_ + param3; this.recordMessage.push(_loc6_); } public function get lastMessage() : String { return this.messages[this.messages.length - 1]; } public function get lastRecordMessage() : Object { return this.recordMessage[this.recordMessage.length - 1]; } } }
28.536232
113
0.516506
c5af1b38c01dd7d0431648792f41f4af37c88bc7
4,408
as
ActionScript
data/DofusInvoker/scripts/com/ankamagames/dofus/network/messages/game/prism/PrismSettingsRequestMessage.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
10
2019-11-10T21:24:38.000Z
2021-05-24T23:56:36.000Z
data/DofusInvoker/scripts/com/ankamagames/dofus/network/messages/game/prism/PrismSettingsRequestMessage.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
15
2021-01-27T21:41:58.000Z
2021-03-03T16:47:19.000Z
data/DofusInvoker/scripts/com/ankamagames/dofus/network/messages/game/prism/PrismSettingsRequestMessage.as
LucBerge/Datafus
6ff545662c99f5f727c5a8522da853fbbd99782a
[ "MIT" ]
1
2021-04-05T23:22:53.000Z
2021-04-05T23:22:53.000Z
package com.ankamagames.dofus.network.messages.game.prism { import com.ankamagames.jerakine.network.CustomDataWrapper; import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkMessage; import com.ankamagames.jerakine.network.NetworkMessage; import com.ankamagames.jerakine.network.utils.FuncTree; import flash.utils.ByteArray; public class PrismSettingsRequestMessage extends NetworkMessage implements INetworkMessage { public static const protocolId:uint = 4995; private var _isInitialized:Boolean = false; public var subAreaId:uint = 0; public var startDefenseTime:uint = 0; public function PrismSettingsRequestMessage() { super(); } override public function get isInitialized() : Boolean { return this._isInitialized; } override public function getMessageId() : uint { return 4995; } public function initPrismSettingsRequestMessage(subAreaId:uint = 0, startDefenseTime:uint = 0) : PrismSettingsRequestMessage { this.subAreaId = subAreaId; this.startDefenseTime = startDefenseTime; this._isInitialized = true; return this; } override public function reset() : void { this.subAreaId = 0; this.startDefenseTime = 0; this._isInitialized = false; } override public function pack(output:ICustomDataOutput) : void { var data:ByteArray = new ByteArray(); this.serialize(new CustomDataWrapper(data)); writePacket(output,this.getMessageId(),data); } override public function unpack(input:ICustomDataInput, length:uint) : void { this.deserialize(input); } override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree { var tree:FuncTree = new FuncTree(); tree.setRoot(input); this.deserializeAsync(tree); return tree; } public function serialize(output:ICustomDataOutput) : void { this.serializeAs_PrismSettingsRequestMessage(output); } public function serializeAs_PrismSettingsRequestMessage(output:ICustomDataOutput) : void { if(this.subAreaId < 0) { throw new Error("Forbidden value (" + this.subAreaId + ") on element subAreaId."); } output.writeVarShort(this.subAreaId); if(this.startDefenseTime < 0) { throw new Error("Forbidden value (" + this.startDefenseTime + ") on element startDefenseTime."); } output.writeByte(this.startDefenseTime); } public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_PrismSettingsRequestMessage(input); } public function deserializeAs_PrismSettingsRequestMessage(input:ICustomDataInput) : void { this._subAreaIdFunc(input); this._startDefenseTimeFunc(input); } public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_PrismSettingsRequestMessage(tree); } public function deserializeAsyncAs_PrismSettingsRequestMessage(tree:FuncTree) : void { tree.addChild(this._subAreaIdFunc); tree.addChild(this._startDefenseTimeFunc); } private function _subAreaIdFunc(input:ICustomDataInput) : void { this.subAreaId = input.readVarUhShort(); if(this.subAreaId < 0) { throw new Error("Forbidden value (" + this.subAreaId + ") on element of PrismSettingsRequestMessage.subAreaId."); } } private function _startDefenseTimeFunc(input:ICustomDataInput) : void { this.startDefenseTime = input.readByte(); if(this.startDefenseTime < 0) { throw new Error("Forbidden value (" + this.startDefenseTime + ") on element of PrismSettingsRequestMessage.startDefenseTime."); } } } }
33.142857
140
0.616606
d5e4fd98150af77502a57dfbbb82421f889a3a52
1,701
as
ActionScript
src/comun/Check/CheckBoxList.as
CHQGIT/gisredext
3c7ff60d5df764bdd334922e9cc763fde0623c8e
[ "Apache-2.0" ]
1
2017-06-07T14:29:20.000Z
2017-06-07T14:29:20.000Z
src/comun/Check/CheckBoxList.as
CHQGIT/gisredext
3c7ff60d5df764bdd334922e9cc763fde0623c8e
[ "Apache-2.0" ]
null
null
null
src/comun/Check/CheckBoxList.as
CHQGIT/gisredext
3c7ff60d5df764bdd334922e9cc763fde0623c8e
[ "Apache-2.0" ]
null
null
null
package comun.Check { import flash.display.Sprite; import flash.events.KeyboardEvent; import mx.controls.List; import mx.controls.listClasses.IListItemRenderer; import mx.controls.CheckBox; /** * List that uses checkboxes for multiple selection */ public class CheckBoxList extends List { // fake all mouse interaction as if it had the ctrl key down override protected function selectItem(item:IListItemRenderer, shiftKey:Boolean, ctrlKey:Boolean, transition:Boolean = true):Boolean { return super.selectItem(item, false, true, transition); } // turn off selection indicator override protected function drawSelectionIndicator( indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void { } // whenever we draw the renderer, make sure we re-eval the checked state override protected function drawItem(item:IListItemRenderer, selected:Boolean = false, highlighted:Boolean = false, caret:Boolean = false, transition:Boolean = false):void { CheckBox(item).invalidateProperties(); super.drawItem(item, selected, highlighted, caret, transition); } // fake all keyboard interaction as if it had the ctrl key down override protected function keyDownHandler(event:KeyboardEvent):void { // this is technically illegal, but works event.ctrlKey = true; event.shiftKey = false; super.keyDownHandler(event); } } }
32.711538
73
0.636684
e0a5192f563fcc3858333e5373d2c01955bc5193
558
as
ActionScript
src/org/osflash/stream/IStreamInput.as
SimonRichardson/as3-stream
1d6b6ed7167d10f238624dd8d300e2c4ebaf0489
[ "MIT" ]
null
null
null
src/org/osflash/stream/IStreamInput.as
SimonRichardson/as3-stream
1d6b6ed7167d10f238624dd8d300e2c4ebaf0489
[ "MIT" ]
null
null
null
src/org/osflash/stream/IStreamInput.as
SimonRichardson/as3-stream
1d6b6ed7167d10f238624dd8d300e2c4ebaf0489
[ "MIT" ]
null
null
null
package org.osflash.stream { /** * @author Simon Richardson - simon@ustwo.co.uk */ public interface IStreamInput { function readInt() : int; function readUnsignedInt() : uint; function readFloat() : Number; function readUTF() : String; function readBoolean() : Boolean; function readXML() : XML; function readObject() : Object; function clear() : void; function get nextType() : int; function get position() : uint; function set position(value : uint) : void; function toString() : String; } }
17.4375
48
0.641577
cb8dfdaccb248e42cc83fa14fc76483c7696a19b
831
as
ActionScript
Zcup/src/com/zcup/display/IMovie.as
mldongs/ZCup
6f848ee624c3d08c8fd19f982cecb8072cf00a79
[ "MIT" ]
2
2015-01-13T12:53:44.000Z
2015-01-13T12:53:47.000Z
Zcup/src/com/zcup/display/IMovie.as
mldongs/ZCup
6f848ee624c3d08c8fd19f982cecb8072cf00a79
[ "MIT" ]
null
null
null
Zcup/src/com/zcup/display/IMovie.as
mldongs/ZCup
6f848ee624c3d08c8fd19f982cecb8072cf00a79
[ "MIT" ]
null
null
null
package com.zcup.display { /** * * @atuhor: mldongs * @qq: 25772076 * @time: 2011-9-19 下午12:18:06 **/ public interface IMovie { function removeAllFrameScript():void; function removeFrameScript(frame:int):void; function addFrameScript(frame:int,func:Function = null):void; function play(delay:int=0):void; function stop():void; function gotoAndPlay(frame:int,scene:String=null):void; function gotoAndStop(frame:int,scene:String=null):void; function nextFrame():void; function prevFrame():void; function destroy():void; function get currentFrame():int; function set currentFrame(value:int):void; function get totalFrames():int; function set totalFrames(value:int):void; function set endFrameAction(value:Function):void; function set defaultFrameAction(value:Function):void } }
25.96875
63
0.728039
202eeaae5d02877db82ab8ea747a05d30233715b
3,850
as
ActionScript
frameworks/projects/MXRoyale/src/main/royale/mx/containers/HBox.as
jmegonzalez/royale-asjs
bd5cbefc187fd9d650b93e89f684ce13f986729b
[ "ECL-2.0", "Apache-2.0" ]
306
2017-10-05T14:28:14.000Z
2022-01-25T09:30:45.000Z
frameworks/projects/MXRoyale/src/main/royale/mx/containers/HBox.as
joseRamonLeon/royale-asjs
4dfa86ec6907da834fb5df7e5dc28e48ba65cbeb
[ "Apache-2.0", "MIT" ]
995
2017-09-29T16:42:20.000Z
2022-03-30T11:06:36.000Z
frameworks/projects/MXRoyale/src/main/royale/mx/containers/HBox.as
joseRamonLeon/royale-asjs
4dfa86ec6907da834fb5df7e5dc28e48ba65cbeb
[ "Apache-2.0", "MIT" ]
132
2017-11-02T00:07:24.000Z
2022-01-31T11:53:31.000Z
//////////////////////////////////////////////////////////////////////////////// // // 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.containers { /* import mx.core.mx_internal; use namespace mx_internal; */ /** * The Halo HBox container lays out its children in a single horizontal row. * You use the <code>&lt;mx:HBox&gt;</code> tag instead of the * <code>&lt;mx:Box&gt;</code> tag as a shortcut to avoid having to * set the <code>direction</code> property to * <code>"horizontal"</code>. * * <p><b>Note:</b> Adobe recommends that, when possible, you use the Spark containers * with HorizontalLayout instead of the Halo HBox container.</p> * * <p>An HBox container has the following default sizing characteristics:</p> * <table class="innertable"> * <tr> * <th>Characteristic</th> * <th>Description</th> * </tr> * <tr> * <td>Default size</td> * <td>The width is large enough to hold all its children at the default or explicit width of the children, * plus any horizontal gap between the children, plus the left and right padding of the container. * The height is the default or explicit height of the tallest child, * plus the top and bottom padding for the container. * </td> * </tr> * <tr> * <td>Default padding</td> * <td>0 pixels for the top, bottom, left, and right values.</td> * </tr> * </table> * * @mxml * * <p>The <code>&lt;mx:HBox&gt;</code> tag inherits all of the tag * attributes of its superclass, except <code>direction</code>, and adds * no new tag attributes.</p> * * @includeExample examples/HBoxExample.mxml * * @see mx.core.Container * @see mx.containers.Box * @see mx.containers.VBox * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class HBox extends Box { //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function HBox() { super(); typeNames = "HBox"; super.direction = BoxDirection.HORIZONTAL; } //-------------------------------------------------------------------------- // // Overridden properties // //-------------------------------------------------------------------------- //---------------------------------- // direction //---------------------------------- [Inspectable(environment="none")] /** * @private * Don't allow user to change the direction */ override public function set direction(value:String):void { } } }
31.557377
118
0.535844
bba11f911c402dfa69661dd47e305f6ef4c6e620
2,658
as
ActionScript
src/com/relivethefuture/go/LiveRepeater.as
marvotron/gobox
22f3f110637ae0eba7057fb37d5230c2647fcd02
[ "MIT" ]
1
2016-05-08T19:16:29.000Z
2016-05-08T19:16:29.000Z
src/com/relivethefuture/go/LiveRepeater.as
marvotron/gobox
22f3f110637ae0eba7057fb37d5230c2647fcd02
[ "MIT" ]
null
null
null
src/com/relivethefuture/go/LiveRepeater.as
marvotron/gobox
22f3f110637ae0eba7057fb37d5230c2647fcd02
[ "MIT" ]
null
null
null
/** * Copyright (c) 2008 Martin Wood-Mitrovski * * 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 com.relivethefuture.go { import org.goasap.PlayStates; import org.goasap.managers.LinearGoRepeater; import org.goasap.managers.Repeater; public class LiveRepeater extends LinearGoRepeater { /** @private */ protected var _nolock : Boolean = true; public function LiveRepeater(cycles:uint=Repeater.INFINITE, reverseOnCycle:Boolean=false, easingOnCycle:Function=null, extraEasingParams:Array=null) { super(cycles, reverseOnCycle, easingOnCycle, extraEasingParams); } /** * True if cycles is not infinite and currentCycle has reached or passed cycles. * * This is different from the Repeater implementation in that it checks if the currentCycle * is greater than cycles. This is to allow the cycles property to be updated whilst running, * rather than having to call stop. */ override public function get done():Boolean { return (_currentCycle >= _cycles && _cycles!=INFINITE); } /** * Allow client code to prevent repeater from being locked so repeater * parameters can be altered while tween is running, e.g. reverseOnCycle. */ public function get noLock():Boolean { return _nolock; } public function set noLock(noLock:Boolean):void { _nolock = noLock; } /** * Same as Repeater except we check for the _nolock setting. */ override protected function unlocked() : Boolean { return (!_item || _nolock || (_item && _item.state == PlayStates.STOPPED)); } } }
39.088235
151
0.718585