CombinedText
stringlengths
4
3.42M
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package flashx.textLayout.compose { import flash.text.engine.TextBlock; import flash.text.engine.TextLine; import flash.text.engine.TextLineValidity; import flash.utils.Dictionary; CONFIG::debug { import flashx.textLayout.debug.assert; } import flashx.textLayout.tlf_internal; use namespace tlf_internal; /** * The TextLineRecycler class provides support for recycling of TextLines. Some player versions support a recreateTextLine. Passing TextLines * to the recycler makes them available for reuse. This improves Player performance. * * @playerversion Flash 10 * @playerversion AIR 1.5 * @langversion 3.0 */ public class TextLineRecycler { static private const _textLineRecyclerCanBeEnabled:Boolean = (new TextBlock).hasOwnProperty("recreateTextLine"); static private var _textLineRecyclerEnabled:Boolean = _textLineRecyclerCanBeEnabled; /** Controls if the TLF recycler enabled. It can only be enabled in 10.1 or later players. * @playerversion Flash 10 * @playerversion AIR 1.5 * @langversion 3.0 */ static public function get textLineRecyclerEnabled():Boolean { return _textLineRecyclerEnabled; } static public function set textLineRecyclerEnabled(value:Boolean):void { _textLineRecyclerEnabled = value ? _textLineRecyclerCanBeEnabled : false; } // manage a cache of TextLine's that can be reused // This version uses a dictionary that holds the TextLines as weak references static private var reusableLineCache:Dictionary = new Dictionary(true); /** * Add a TextLine to the pool for reuse. TextLines for reuse should have null userData and null parent. * @playerversion Flash 10 * @playerversion AIR 1.5 * @langversion 3.0 */ static public function addLineForReuse(textLine:TextLine):void { CONFIG::debug { assert(textLine.parent == null && textLine.userData == null && (textLine.validity == TextLineValidity.INVALID || textLine.validity == TextLineValidity.STATIC),"textLine not ready for reuse"); } if (_textLineRecyclerEnabled) { CONFIG::debug { for each (var line:TextLine in reusableLineCache) { assert(line != textLine,"READDING LINE TO CACHE"); } } CONFIG::debug { cacheTotal++; } reusableLineCache[textLine] = null; } } CONFIG::debug { /** @private */ static tlf_internal var cacheTotal:int = 0; /** @private */ static tlf_internal var fetchTotal:int = 0; /** @private */ static tlf_internal var hitTotal:int = 0; static private function recordFetch(hit:int):void { fetchTotal++; hitTotal += hit; /*if ((fetchTotal%100) == 0) trace(fetchTotal,hitTotal,cacheTotal);*/ } } /** * Return a TextLine from the pool for reuse. * @playerversion Flash 10 * @playerversion AIR 1.5 * @langversion 3.0 */ static public function getLineForReuse():TextLine { if (_textLineRecyclerEnabled) { for (var obj:Object in reusableLineCache) { // remove from the cache delete reusableLineCache[obj]; CONFIG::debug { assert(reusableLineCache[obj] === undefined,"Bad delete"); } CONFIG::debug { recordFetch(1); } return obj as TextLine; } CONFIG::debug { recordFetch(0); } } return null; } /** @private empty the reusableLineCache */ static tlf_internal function emptyReusableLineCache():void { reusableLineCache = new Dictionary(true); } } }
package com.tinyspeck.engine.port { public interface IFurnUpgradeUI { function onSave(changed:Boolean):void; } }
/* Copyright (c) 2006, 2007 Alec Cove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* TODO: */ package org.cove.ape { internal final class MathUtil { internal static var ONE_EIGHTY_OVER_PI:Number = 180 / Math.PI; internal static var PI_OVER_ONE_EIGHTY:Number = Math.PI / 180; /** * Returns n clamped between min and max */ internal static function clamp(n:Number, min:Number, max:Number):Number { if (n < min) return min; if (n > max) return max; return n; } /** * Returns 1 if the value is >= 0. Returns -1 if the value is < 0. */ internal static function sign(val:Number):int { if (val < 0) return -1 return 1; } } }
package com.ankamagames.dofus.network.types.game.interactive { import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkType; import com.ankamagames.jerakine.network.utils.FuncTree; public class InteractiveElementSkill implements INetworkType { public static const protocolId:uint = 7588; public var skillId:uint = 0; public var skillInstanceUid:uint = 0; public function InteractiveElementSkill() { super(); } public function getTypeId() : uint { return 7588; } public function initInteractiveElementSkill(skillId:uint = 0, skillInstanceUid:uint = 0) : InteractiveElementSkill { this.skillId = skillId; this.skillInstanceUid = skillInstanceUid; return this; } public function reset() : void { this.skillId = 0; this.skillInstanceUid = 0; } public function serialize(output:ICustomDataOutput) : void { this.serializeAs_InteractiveElementSkill(output); } public function serializeAs_InteractiveElementSkill(output:ICustomDataOutput) : void { if(this.skillId < 0) { throw new Error("Forbidden value (" + this.skillId + ") on element skillId."); } output.writeVarInt(this.skillId); if(this.skillInstanceUid < 0) { throw new Error("Forbidden value (" + this.skillInstanceUid + ") on element skillInstanceUid."); } output.writeInt(this.skillInstanceUid); } public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_InteractiveElementSkill(input); } public function deserializeAs_InteractiveElementSkill(input:ICustomDataInput) : void { this._skillIdFunc(input); this._skillInstanceUidFunc(input); } public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_InteractiveElementSkill(tree); } public function deserializeAsyncAs_InteractiveElementSkill(tree:FuncTree) : void { tree.addChild(this._skillIdFunc); tree.addChild(this._skillInstanceUidFunc); } private function _skillIdFunc(input:ICustomDataInput) : void { this.skillId = input.readVarUhInt(); if(this.skillId < 0) { throw new Error("Forbidden value (" + this.skillId + ") on element of InteractiveElementSkill.skillId."); } } private function _skillInstanceUidFunc(input:ICustomDataInput) : void { this.skillInstanceUid = input.readInt(); if(this.skillInstanceUid < 0) { throw new Error("Forbidden value (" + this.skillInstanceUid + ") on element of InteractiveElementSkill.skillInstanceUid."); } } } }
/* Copyright (C) 2012 John Nesky 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 beepbox.editor { import beepbox.synth.*; public class ChangeNoteAdded extends Change { private var document: Document; private var bar: BarPattern; private var note: Note; private var index: int; public function ChangeNoteAdded(document: Document, bar: BarPattern, note: Note, index: int, deletion: Boolean = false) { super(deletion); this.document = document; this.bar = bar; this.note = note; this.index = index; didSomething(); redo(); } protected override function doForwards(): void { bar.notes.splice(index, 0, note); document.changed(); } protected override function doBackwards(): void { bar.notes.splice(index, 1); document.changed(); } } }
#include "VirtualEnvironments/VRSetup.as" class Arena : ScriptObject { // Keep the class name ("Arena") as it is used to call the initializer float turningGain = 1.0f; // Gain parameters for turning float walkingGain = 1.0f; // And walking motion Vector3 initialPosition = Vector3(0.0f, 0.5f, 0.0f); // initial position Quaternion initialOrientation = Quaternion( // and orientation 0.0f, Vector3(0.0f, 1.0f, 0.0f) // in the virtual ); // environment. Node@ _subjectNode; // Keeping a reference to the subject to access // its location etc... void Start() { /* This function is called on the startup of the arena. All arena objects are to be created here, events subscribed, etc. */ Print("Creating stripe arena"); scene.CreateComponent("DebugRenderer"); // The zone setting illumination/fog properties // You can have multiple zones if needed Node@ zoneNode = scene.CreateChild("Zone"); Zone@ zone = zoneNode.CreateComponent("Zone"); zone.boundingBox = BoundingBox(-1000.0f, 1000.0f); zone.fogColor = Color(1.0f,1.0f,1.0f); //0.0f,0.0f,0.0f zone.ambientColor = Color(1.0f, 1.0f, 1.0f); zone.fogStart = 1000.0f; zone.fogEnd = 1000.0f; Node@ node; //References to a node and a static model StaticModel@ object; //to be recycled creating all the arena CollisionShape@ collider; RigidBody@ rigidBody; node = scene.CreateChild("Pole1"); node.scale = Vector3(14.0f, 500.0f, 14.0f); node.position = Vector3(0.0f, 0.0f, 20.0f); node.Rotate(Quaternion(45.0f, Vector3(1.0f, 1.0f, 0.0f))); object = node.CreateComponent("StaticModel"); object.model = cache.GetResource("Model", "Models/Cylinder.mdl"); object.material = cache.GetResource("Material", "Materials/Black.xml"); //White.xml rigidBody = node.CreateComponent("RigidBody"); // Rigid body and rigidBody.collisionLayer = 1; // Collision shape collider = node.CreateComponent("CollisionShape"); // are both needed collider.SetCylinder(1.1, 1); // for physics simulation // by Urho3D // Call this function common for all the arenas in the same VR setting // to configure screens. _subjectNode = SetupViewports( scene, // reference to the scene, initialPosition, // initial position and initialOrientation // orientation in the VR. ); // Subscribe to collision events of the subject node. SubscribeToEvent(_subjectNode, "NodeCollision", "HandleNodeCollision"); } void HandleNodeCollision(StringHash eventType, VariantMap& eventData) { Print("collision"); /* VectorBuffer contacts = eventData["Contacts"].GetBuffer(); while (!contacts.eof) { Vector3 contactPosition = contacts.ReadVector3(); Vector3 contactNormal = contacts.ReadVector3(); float contactDistance = contacts.ReadFloat(); float contactImpulse = contacts.ReadFloat(); // If contact is below node center and mostly vertical, assume it's a ground contact if (contactPosition.y < (node.position.y + 1.0f)) { float level = Abs(contactNormal.y); if (level > 0.75) onGround = true; } }*/ } void PostUpdate(float timeStep) { //Conditions, etc... physicsWorld.DrawDebugGeometry(true); } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package flashx.textLayout.elements { import flash.display.Sprite; public class CellContainer extends Sprite { public var userData:Object=null; public function CellContainer() { super(); } } }
package org.fatlib.utils { import flash.events.TimerEvent; import flash.utils.Dictionary; import flash.utils.Timer; import org.fatlib.interfaces.IDestroyable; import org.fatlib.process.Callback; /** * Provides delays / timeouts. * * Use it like this: * * var d:Delay=new Delay(); * d.create(1000, showText, ['hello']); * * function showText(text:String) * { * trace(text); * } * * */ public class Delay implements IDestroyable { /** * A dictionary of active delay instances */ private var _index:Dictionary; /** * Creates a new instance */ public function Delay() { _index=new Dictionary(true);//uses weak keys } /** * Creates a new delay object * * @param ms The numbed of milliseconds to wait * @param onComplete The methed to call when finished * @param onCompleteParams An array of parameters to pass to the onComplete method */ public function create(ms:int, onComplete:Function, onCompleteParams:Array = null):void { var callback:Callback=new Callback(onComplete, onCompleteParams); var t:Timer=new Timer(ms,1); t.addEventListener(TimerEvent.TIMER_COMPLETE,onTimerFinished); _index[t] = callback; t.start(); } /** * Cancels all active delays */ public function cancelAll():void { for (var t:* in _index) cancel(t); } /** * Destroys the object. Call this when you've finished using it. */ public function destroy():void { for (var t:Object in _index) { (t as Timer).stop(); delete _index[t]; } } ////////// PRIVATE METHODS private function cancel(t:Timer):void { if (!t || !_index[t]) return; t.stop(); t.removeEventListener(TimerEvent.TIMER_COMPLETE, onTimerFinished); _index[t] = null; delete _index[t]; t = null; } private function onTimerFinished(e:TimerEvent):void { var t:Timer=e.currentTarget as Timer; var callback:Callback=_index[t] as Callback; callback.execute(); t.removeEventListener(TimerEvent.TIMER_COMPLETE, onTimerFinished); _index[t] = null; delete _index[t]; t=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 org.apache.royale.graphics.utils.shaderClasses { import flash.display.Shader; /** * Creates a blend shader that is equivalent to * the 'Luminosity' blend mode for RGB premultiplied colors available * in Adobe Creative Suite tools. This blend mode is not native to Flash, * but is available in tools like Adobe Illustrator and Adobe Photoshop. * * <p>The 'luminosity' blend mode can be set on Flex groups and graphic * elements. The visual appearance in tools like Adobe Illustrator and * Adobe Photoshop will be mimicked through this blend shader.</p> * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Royale 1.0.0 * * @includeExample examples/LuminosityShaderExample.mxml */ public class LuminosityShader extends flash.display.Shader { [Embed(source="Luminosity.pbj", mimeType="application/octet-stream")] private static var ShaderClass:Class; /** * Constructor. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Royale 1.0.0 */ public function LuminosityShader() { super(new ShaderClass()); } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License // // No warranty of merchantability or fitness of any kind. // Use this software at your own risk. // //////////////////////////////////////////////////////////////////////////////// package components.popup.newFile { import flash.events.Event; import flash.events.EventDispatcher; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.geom.Point; import flash.ui.Keyboard; import mx.collections.ArrayCollection; import mx.events.CloseEvent; import mx.managers.PopUpManager; import spark.components.TitleWindow; import actionScripts.events.GlobalEventDispatcher; import actionScripts.ui.codeCompletionList.CodeCompletionList; import actionScripts.utils.symbolKindToCompletionItemKind; import actionScripts.valueObjects.ProjectVO; import actionScripts.valueObjects.SymbolKind; import moonshine.lsp.CompletionItem; import moonshine.lsp.DocumentSymbol; import moonshine.lsp.SymbolInformation; import actionScripts.languageServer.LanguageServerProjectVO; [Event(name="itemSelected", type="flash.events.Event")] public class NewASFileCompletionManager extends EventDispatcher { private static const CLASSES_LIST:String = "classesList"; private static const INTERFACES_LIST:String = "interfacesList"; private static const NO_PACKAGE:String = "No Package"; protected var dispatcher:EventDispatcher = GlobalEventDispatcher.getInstance(); private var view:TitleWindow; private var project:ProjectVO; private var completionList:CodeCompletionList; private var menuCollection:ArrayCollection; private var completionListType:String; public function NewASFileCompletionManager(view:TitleWindow, project:ProjectVO) { this.view = view; this.project = project; completionList = new CodeCompletionList(); completionList.requireSelection = true; completionList.width = 574; menuCollection = new ArrayCollection(); completionList.dataProvider = menuCollection; view.addEventListener(MouseEvent.CLICK, onViewClick); view.addEventListener(CloseEvent.CLOSE, onViewClose); view.addEventListener(KeyboardEvent.KEY_DOWN, onViewKeyDown); } [Bindable] public var superClassName:String; [Bindable] public var interfaceName:String; private var _classesImports:Array = []; public function get classesImports():Array { return _classesImports; } private var _interfacesImports:Array = []; public function get interfacesImports():Array { return _interfacesImports; } public function showCompletionListClasses(text:String, position:Point):void { this.completionListType = CLASSES_LIST; this.internalShowCompletionList(text, position); } public function showCompletionListInterfaces(text:String, position:Point):void { this.completionListType = INTERFACES_LIST; this.internalShowCompletionList(text, position); } private function handleShowWorkspaceSymbols(symbols:Array):void { menuCollection.source.splice(0, menuCollection.length); if (symbols.length == 0) { if (this.completionListType == CLASSES_LIST) { _classesImports.splice(0, _classesImports.length); } else { _interfacesImports.splice(0, _interfacesImports.length); } return; } if (this.completionListType == CLASSES_LIST) { symbols = symbols.filter(filterClasses); } else { symbols = symbols.filter(filterInterfaces); } if (symbols.length == 0) { return; } var symbolsCount:int = symbols.length; for (var i:int = 0; i < symbolsCount; i++) { var symbolInformation:SymbolInformation = symbols[i] as SymbolInformation; if(!symbolInformation) { continue; } var packageName:String = symbolInformation.containerName ? symbolInformation.containerName + "." + symbolInformation.name : ""; var completionItemKind:int = symbolKindToCompletionItemKind(symbolInformation.kind); var completionItem:CompletionItem = new CompletionItem(); completionItem.label = symbolInformation.name; completionItem.detail = packageName; completionItem.kind = completionItemKind; menuCollection.source.push(completionItem); } menuCollection.refresh(); this.showCompletionList(); } private function onViewClose(event:Event):void { view.removeEventListener(MouseEvent.CLICK, onViewClick); view.removeEventListener(CloseEvent.CLOSE, onViewClose); view.removeEventListener(KeyboardEvent.KEY_DOWN, onViewKeyDown); this.closeCompletionList(); } private function onViewClick(event:MouseEvent):void { this.closeCompletionList(); } private function onViewKeyDown(event:KeyboardEvent):void { if (!completionList.isPopUp) return; if (event.keyCode == Keyboard.ENTER) { this.completeItem(completionList.selectedItem as CompletionItem); } if (event.keyCode == Keyboard.DOWN || event.keyCode == Keyboard.UP) { this.completionList.setFocus(); } } private function onCompletionListDoubleClick(event:MouseEvent):void { this.completeItem(completionList.selectedItem as CompletionItem); } private function onCompletionListRemovedFromStage(event:Event):void { menuCollection.removeAll(); } private function completeItem(completionItem:CompletionItem):void { var isDetailValid:Boolean = completionItem.detail && completionItem.detail.indexOf("No Package") == -1; if (this.completionListType == CLASSES_LIST) { this.superClassName = completionItem.label; if (isDetailValid) { this._classesImports.push(completionItem.detail); } } else if (this.completionListType == INTERFACES_LIST) { this.interfaceName = completionItem.label; if (isDetailValid) { this._interfacesImports.push(completionItem.detail); } } dispatchEvent(new Event("itemSelected")); this.closeCompletionList(); } private function internalShowCompletionList(text:String, position:Point):void { var lspProject:LanguageServerProjectVO = project as LanguageServerProjectVO; if(!lspProject || !lspProject.languageClient) { return; } lspProject.languageClient.workspaceSymbols({ query: text }, handleShowWorkspaceSymbols); completionList.x = position.x; completionList.y = position.y; } private function showCompletionList():void { if (completionList.isPopUp) return; PopUpManager.addPopUp(completionList, this.view, false); completionList.addEventListener(KeyboardEvent.KEY_DOWN, onViewKeyDown); completionList.addEventListener(MouseEvent.DOUBLE_CLICK, onCompletionListDoubleClick); completionList.addEventListener(Event.REMOVED_FROM_STAGE, onCompletionListRemovedFromStage); } private function closeCompletionList():void { if(!completionList.isPopUp) return; PopUpManager.removePopUp(completionList); completionList.removeEventListener(KeyboardEvent.KEY_DOWN, onViewKeyDown); completionList.removeEventListener(Event.REMOVED_FROM_STAGE, onCompletionListRemovedFromStage); completionList.removeEventListener(MouseEvent.DOUBLE_CLICK, onCompletionListDoubleClick); completionList.closeDocumentation(); } private function filterClasses(item:Object, index:int, vector:Array):Boolean { if(item is SymbolInformation) { var symbolInfo:SymbolInformation = SymbolInformation(item); return symbolInfo.kind == SymbolKind.CLASS; } if(item is DocumentSymbol) { var documentSymbol:DocumentSymbol = DocumentSymbol(item); return documentSymbol.kind == SymbolKind.CLASS; } return false; } private function filterInterfaces(item:Object, index:int, vector:Array):Boolean { if(item is SymbolInformation) { var symbolInfo:SymbolInformation = SymbolInformation(item); return symbolInfo.kind == SymbolKind.INTERFACE; } if(item is DocumentSymbol) { var documentSymbol:DocumentSymbol = DocumentSymbol(item); return documentSymbol.kind == SymbolKind.INTERFACE; } return false; } } }
; IFDEF/IFNDEF conditional test abc equ 1 global def ifdef abc db 1 ; yes endif ifdef def db 1 ; no endif ifdef ghi db 1 ; no endif ifndef abc db 1 ; no endif ifndef def db 1 ; yes endif ifndef ghi db 1 ; yes endif ifdef abc db 1 ; yes else db 1 ; no endif ifdef def db 1 ; no else db 1 ; yes endif ifdef ghi db 1 ; no else db 1 ; yes endif ifndef abc db 1 ; no else db 1 ; yes endif ifndef def db 1 ; yes else db 1 ; no endif ifndef ghi db 1 ; yes else db 1 ; no endif end
/* * Copyright 2010 Swiz Framework Contributors * * 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. 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.swizframework.utils { import flash.system.ApplicationDomain; import mx.modules.ModuleManager; public class DomainUtil { /** * Returns the domain used to load an object. Because of significant * issues in the Flex Framework, we will either use the ModuleManager or fall * back on ApplicationDomain.currentDomain. This is because an object's loaderInfo * may very well not have the correct domain associated with it when Swiz initializes. */ public static function getDomain( object:Object ):ApplicationDomain { var domain:ApplicationDomain = getModuleDomain( object ); if( domain == null ) domain = ApplicationDomain.currentDomain; return domain; } /** * Returns the domain used to load an a module, only if the object supplied is a module. * Uses the ModuleManager to find the ApplicationDomain in the associated factory, which is a loader. * Unfortunately this appears to be the only trustable method for finding a module's domain. */ public static function getModuleDomain( object:Object ):ApplicationDomain { if( object is ModuleTypeUtil.MODULE_TYPE ) { var moduleInfo:Object = ModuleManager.getAssociatedFactory( object ).info(); return moduleInfo.currentDomain; } return null; } } }
package { import flash.display.MovieClip; public class Test extends MovieClip{ } } import flash.utils.getQualifiedSuperclassName; import com.very.long.namespace.example; import flash.utils.ByteArray; trace(getQualifiedSuperclassName(Test)); trace(getQualifiedSuperclassName(flash.utils.ByteArray)); trace(getQualifiedSuperclassName(example)); trace(getQualifiedSuperclassName(int)); trace(getQualifiedSuperclassName(String)); trace(getQualifiedSuperclassName(flash.display.Sprite));
/** * VERSION: 0.95 * DATE: 9/22/2009 * AS3 * UPDATES AND DOCUMENTATION AT: http://blog.greensock.com/ **/ package com.greensock { import flash.display.DisplayObject; import flash.events.Event; import flash.geom.Matrix3D; import flash.geom.Vector3D; import flash.utils.Dictionary; import flash.utils.Proxy; import flash.utils.flash_proxy; /** * TweenProxy3D essentially "stands in" for a DisplayObject, so you set the various properties of * the TweenProxy3D and in turn, it handles setting the corresponding properties of the DisplayObject * which it controls, adding three important capabilities:<br /> * <ol> * <li> Dynamically define a custom registration point (actually a Vector3D) around which all transformations (like rotation, * scale, and skew) occur. It is compatible with 3D transformations, so your registration point can be offset on any * axis including the z-axis. </li> * * <li> Easily skew a DisplayObject using skewX, skewY, skewX2, or skewY2 properties. These are completely tweenable. </li> * * <li> Avoids a bug in Flash that renders certain scale tweens incorrectly. To see the Flash bug, just set the z property * of a DisplayObject to any value, then tween scaleX to a negative value using any tweening engine (including the Adobe * Tween class). Once it goes below zero, the DisplayObject will keep flipping and often rotate in strange ways.</li> * </ol> * * The <code>registration</code> point is based on the DisplayObject's parent's coordinate space whereas the <code>localRegistration</code> corresponds * to the DisplayObject's inner coordinates, so it's very simple to define the registration point whichever way you prefer.<br /><br /> * * Tween the skewX and/or skewY for normal skews (which visually adjust scale to compensate), or skewX2 and/or skewY2 in order to * skew without visually adjusting scale. Either way, the actual scaleX/scaleY/scaleZ values are not altered as far as the proxy * is concerned.<br /><br /> * * Once you create a TweenProxy3D, it is best to always control your DisplayObject's properties through the * TweenProxy3D so that the values don't become out of sync. You can set ANY DisplayObject property through the TweenProxy3D, * and you can call DisplayObject methods as well. If you directly change the properties of the target (without going through the proxy), * you'll need to call the calibrate() method on the proxy. It's usually best to create only ONE proxy for each target, but if * you create more than one, they will communicate with each other to keep the transformations and registration position in sync * (unless you set ignoreSiblingUpdates to true).<br /><br /> * * For example:<br /><br /><code> * * var myProxy:TweenProxy3D = TweenProxy3D.create(mySprite);<br /> * myProxy.registration = new Vector3D(100, 100, 100); //sets a custom registration point at x:100, y:100, and z:100<br /> * myProxy.rotationY = 30; //sets mySprite.rotationY to 30, rotating around the custom registration point<br /> * myProxy.skewX = 45; <br /> * TweenLite.to(myProxy, 3, {rotationX:50}); //tweens the rotationX around the custom registration point.<br /><br /></code> * * * <b>PROPERTIES ADDED WITH TweenProxy3D:</b><br /> * <ul> * <li> scale : Number (sets scaleX, scaleY, and scaleZ with a single call) </li> * <li> skewX : Number (visually adjusts scale to compensate) </li> * <li> skewY : Number (visually adjusts scale to compensate) </li> * <li> skewX2 : Number (does NOT visually adjust scale to compensate) </li> * <li> skewY2 : Number (does NOT visually adjust scale to compensate) </li> * <li> registration : Vector3D </li> * <li> registrationX : Number </li> * <li> registrationY : Number </li> * <li> registrationZ : Number </li> * <li> localRegistration : Vector3D </li> * <li> localRegistrationX : Number </li> * <li> localRegistrationY : Number </li> * <li> localRegistrationZ : Number </li> * <li> skewXRadians : Number </li> * <li> skewYRadians : Number </li> * <li> skewX2Radians : Number </li> * <li> skewY2Radians : Number </li> * <li>- ignoreSiblingUpdates : Boolean (normally TweenProxy3D updates all proxies of the same object as the registation point moves so that it appears "pinned" to the object itself. However, if you want to avoid this behavior, set ignoreSiblingUpdates to true so that the registration point will NOT be affected by sibling updates, thus "pinning" the registration point wherever it is in the parent's coordinate space.) </li> * </ul><br /><br /> * * <b>EXAMPLE:</b><br /><br /> * * To set a custom registration piont of x:100, y:100, z:100, and tween the skew of a MovieClip named "my_mc" 30 degrees * on the x-axis and scale to half-size over the course of 3 seconds using an Elastic ease, do:<br /><br /><code> * * import com.greensock.TweenProxy3D;<br /> * import com.greensock.TweenLite;<br /> * import com.greensock.easing.Elastic;<br /> * import flash.geom.Vector3D;<br /><br /> * * var myProxy:TweenProxy3D = TweenProxy3D.create(my_mc);<br /> * myProxy.registration = new Vector3D(100, 100, 100);<br /> * TweenLite.to(myProxy, 3, {skewX:30, scale:0.5, ease:Elastic.easeOut});<br /><br /></code> * * <b>Copyright 2011, GreenSock. All rights reserved.</b> This work is subject to the terms in <a href="http://www.greensock.com/terms_of_use.html">http://www.greensock.com/terms_of_use.html</a> or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. * * @author Jack Doyle, jack@greensock.com */ dynamic public class TweenProxy3D extends Proxy { /** @private **/ public static const VERSION:Number = 0.94; /** @private **/ private static const _DEG2RAD:Number = Math.PI / 180; //precompute for speed /** @private **/ private static const _RAD2DEG:Number = 180 / Math.PI; //precompute for speed /** @private **/ private static var _dict:Dictionary = new Dictionary(false); /** @private **/ private static var _addedProps:String = " tint tintPercent scale skewX skewY skewX2 skewY2 target registration registrationX registrationY localRegistration localRegistrationX localRegistrationY "; //used in hasProperty /** @private **/ private var _target:DisplayObject; /** @private **/ private var _root:DisplayObject; /** @private **/ private var _scaleX:Number; /** @private **/ private var _scaleY:Number; /** @private **/ private var _scaleZ:Number; /** @private **/ private var _rotationX:Number; /** @private **/ private var _rotationY:Number; /** @private **/ private var _rotationZ:Number; /** @private **/ private var _skewX:Number; //in radians! /** @private **/ private var _skewY:Number; //in radians! /** @private **/ private var _skewX2Mode:Boolean; /** @private **/ private var _skewY2Mode:Boolean; /** @private **/ private var _proxies:Array; //populated with all TweenProxy3D instances with the same _target (basically a faster way to access _dict[_target]) /** @private **/ private var _localRegistration:Vector3D; //according to the local coordinates of _target (not _target.parent) /** @private **/ private var _registration:Vector3D; //according to _target.parent coordinates /** @private **/ private var _regAt0:Boolean; //If the localRegistration point is at 0, 0, this is true. We just use it to speed up processing in getters/setters. /** @private **/ public var ignoreSiblingUpdates:Boolean = false; public function TweenProxy3D($target:DisplayObject, $ignoreSiblingUpdates:Boolean=false) { _target = $target; if (_dict[_target] == undefined) { _dict[_target] = []; } if (_target.root != null) { _root = _target.root; } else { _target.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true); } _proxies = _dict[_target]; _proxies[_proxies.length] = this; _localRegistration = new Vector3D(); _registration = new Vector3D(); if (_target.transform.matrix3D == null) { _target.z = 0; } this.ignoreSiblingUpdates = $ignoreSiblingUpdates; calibrate(); } public static function create($target:DisplayObject, $allowRecycle:Boolean=true):TweenProxy3D { if (_dict[$target] != null && $allowRecycle) { return _dict[$target][0]; } else { return new TweenProxy3D($target); } } /** @private **/ protected function onAddedToStage($e:Event):void { _root = _target.root; _target.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); } public function calibrate():void { _rotationX = _target.rotationX; _rotationY = _target.rotationY; _rotationZ = _target.rotationZ; _target.rotationX = _rotationX; //just forces the skew to be zero. _skewX = _skewY = 0; _scaleX = _target.scaleX; _scaleY = _target.scaleY; _scaleZ = _target.scaleZ; calibrateRegistration(); } public function get target():DisplayObject { return _target; } public function destroy():void { var a:Array = _dict[_target], i:int; for (i = a.length - 1; i > -1; i--) { if (a[i] == this) { a.splice(i, 1); } } if (a.length == 0) { delete _dict[_target]; } _target = null; _localRegistration = null; _registration = null; _proxies = null; } //---- PROXY FUNCTIONS ------------------------------------------------------------------------------------------ /** @private **/ flash_proxy override function callProperty($name:*, ...$args:Array):* { return _target[$name].apply(null, $args); } /** @private **/ flash_proxy override function getProperty($prop:*):* { return _target[$prop]; } /** @private **/ flash_proxy override function setProperty($prop:*, $value:*):void { _target[$prop] = $value; } /** @private **/ flash_proxy override function hasProperty($name:*):Boolean { if (_target.hasOwnProperty($name)) { return true; } else if (_addedProps.indexOf(" " + $name + " ") != -1) { return true; } else { return false; } } //---- GENERAL REGISTRATION ----------------------------------------------------------------------- /** @private **/ public function moveRegX($n:Number):void { _registration.x += $n; } /** @private **/ public function moveRegY($n:Number):void { _registration.y += $n; } /** @private **/ public function moveRegZ($n:Number):void { _registration.z += $n; } /** @private **/ private function reposition():void { if (_root != null) { var v:Vector3D = _target.transform.getRelativeMatrix3D(_root).deltaTransformVector(_localRegistration); _target.x = _registration.x - v.x; _target.y = _registration.y - v.y; _target.z = _registration.z - v.z; } } /** @private **/ private function updateSiblingProxies():void { for (var i:int = _proxies.length - 1; i > -1; i--) { if (_proxies[i] != this) { _proxies[i].onSiblingUpdate(_scaleX, _scaleY, _scaleZ, _rotationX, _rotationY, _rotationZ, _skewX, _skewY); } } } /** @private **/ private function calibrateLocal():void { if (_target.parent != null) { var m:Matrix3D = _target.transform.getRelativeMatrix3D(_target.parent); m.invert(); var v:Vector3D = m.deltaTransformVector(new Vector3D(_registration.x - _target.x, _registration.y - _target.y, _registration.z - _target.z)); _localRegistration.x = v.x; _localRegistration.y = v.y; _localRegistration.z = v.z; _regAt0 = (_localRegistration.x == 0 && _localRegistration.y == 0 && _localRegistration.z == 0); } } /** @private **/ private function calibrateRegistration():void { if (_root != null) { var v:Vector3D = _target.transform.getRelativeMatrix3D(_root).deltaTransformVector(_localRegistration); _registration.x = _target.x + v.x; _registration.y = _target.y + v.y; _registration.z = _target.z + v.z; } } /** @private **/ public function onSiblingUpdate($scaleX:Number, $scaleY:Number, $scaleZ:Number, $rotationX:Number, $rotationY:Number, $rotationZ:Number, $skewX:Number, $skewY:Number):void { _scaleX = $scaleX; _scaleY = $scaleY; _scaleZ = $scaleZ; _rotationX = $rotationX; _rotationY = $rotationY; _rotationZ = $rotationZ; _skewX = $skewX; _skewY = $skewY; if (this.ignoreSiblingUpdates) { calibrateLocal(); } else { calibrateRegistration(); } } //---- LOCAL REGISTRATION --------------------------------------------------------------------------- public function get localRegistration():Vector3D { return _localRegistration; } public function set localRegistration($v:Vector3D):void { _localRegistration = $v; calibrateRegistration(); } public function get localRegistrationX():Number { return _localRegistration.x; } public function set localRegistrationX($n:Number):void { _localRegistration.x = $n; calibrateRegistration(); } public function get localRegistrationY():Number { return _localRegistration.y; } public function set localRegistrationY($n:Number):void { _localRegistration.y = $n; calibrateRegistration(); } public function get localRegistrationZ():Number { return _localRegistration.z; } public function set localRegistrationZ($n:Number):void { _localRegistration.z = $n; calibrateRegistration(); } //---- REGISTRATION (OUTER) ---------------------------------------------------------------------- public function get registration():Vector3D { return _registration } public function set registration($v:Vector3D):void { _registration = $v; calibrateLocal(); } public function get registrationX():Number { return _registration.x; } public function set registrationX($n:Number):void { _registration.x = $n; calibrateLocal(); } public function get registrationY():Number { return _registration.y; } public function set registrationY($n:Number):void { _registration.y = $n; calibrateLocal(); } public function get registrationZ():Number { return _registration.z; } public function set registrationZ($n:Number):void { _registration.z = $n; calibrateLocal(); } //---- X/Y MOVEMENT --------------------------------------------------------------------------------- public function get x():Number { return _registration.x; } public function set x($n:Number):void { var tx:Number = ($n - _registration.x); _target.x += tx; for (var i:int = _proxies.length - 1; i > -1; i--) { if (_proxies[i] == this || !_proxies[i].ignoreSiblingUpdates) { _proxies[i].moveRegX(tx); } } } public function get y():Number { return _registration.y; } public function set y($n:Number):void { var ty:Number = ($n - _registration.y); _target.y += ty; for (var i:int = _proxies.length - 1; i > -1; i--) { if (_proxies[i] == this || !_proxies[i].ignoreSiblingUpdates) { _proxies[i].moveRegY(ty); } } } public function get z():Number { return _registration.z; } public function set z($n:Number):void { var tz:Number = ($n - _registration.z); _target.z += tz; for (var i:int = _proxies.length - 1; i > -1; i--) { if (_proxies[i] == this || !_proxies[i].ignoreSiblingUpdates) { _proxies[i].moveRegZ(tz); } } } //---- ROTATION ---------------------------------------------------------------------------- public function get rotationX():Number { return _rotationX; } public function set rotationX($n:Number):void { _rotationX = $n; if (_skewX != 0 || _skewY != 0) { updateWithSkew(); } else { _target.rotationX = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } } public function get rotationY():Number { return _rotationY; } public function set rotationY($n:Number):void { _rotationY = $n; if (_skewX != 0 || _skewY != 0) { updateWithSkew(); } else { _target.rotationY = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } } public function get rotationZ():Number { return _rotationZ; } public function set rotationZ($n:Number):void { _rotationZ = $n; if (_skewX != 0 || _skewY != 0) { updateWithSkew(); } else { _target.rotationZ = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } } public function get rotation():Number { return _rotationZ; } public function set rotation($n:Number):void { this.rotationZ = $n; } //---- SKEW ------------------------------------------------------------------------------- /** @private **/ private function updateWithSkew():void { var sm:Matrix3D, v:Vector.<Number>; var m:Matrix3D = new Matrix3D(); var sx:Number = _scaleX, sy:Number = _scaleY, rz:Number = _rotationZ * _DEG2RAD; if (_scaleX < 0) { //get around a bug in Flash which causes negative scaleX values to report as negative scaleY with 180 degrees added to the rotation! sx = -sx; m.appendRotation(180, Vector3D.Z_AXIS); sy = -sy; } if (sx != 1 || sy != 1 || _scaleZ != 1) { m.appendScale(sx, sy, _scaleZ); } if (_skewX != 0) { sm = new Matrix3D(); v = sm.rawData; if (_skewX2Mode) { v[4] = Math.tan(-_skewX + rz); } else { v[4] = -Math.sin(_skewX + rz); v[5] = Math.cos(_skewX + rz); } sm.rawData = v; m.prepend(sm); } if (_skewY != 0) { sm = new Matrix3D(); v = sm.rawData; if (_skewY2Mode) { v[1] = Math.tan(_skewY + rz); } else { v[0] = Math.cos(_skewY + rz); v[1] = Math.sin(_skewY + rz); } sm.rawData = v; m.prepend(sm); } if (_rotationX != 0) { m.appendRotation(_rotationX, Vector3D.X_AXIS); } if (_rotationY != 0) { m.appendRotation(_rotationY, Vector3D.Y_AXIS); } if (_rotationZ != 0) { m.appendRotation(_rotationZ, Vector3D.Z_AXIS); } _target.transform.matrix3D = m; reposition(); if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } public function get skewX():Number { return _skewX * _RAD2DEG; } public function set skewX($n:Number):void { _skewX2Mode = false; _skewX = $n * _DEG2RAD; updateWithSkew(); } public function get skewY():Number { return _skewY * _RAD2DEG; } public function set skewY($n:Number):void { _skewY2Mode = false; _skewY = $n * _DEG2RAD; updateWithSkew(); } //---- SKEW2 ---------------------------------------------------------------------------------- public function get skewX2():Number { return _skewX * _RAD2DEG; } public function set skewX2($n:Number):void { _skewX2Mode = true; _skewX = $n * _DEG2RAD; updateWithSkew(); } public function get skewY2():Number { return _skewY * _RAD2DEG; } public function set skewY2($n:Number):void { _skewY2Mode = true; _skewY = $n * _DEG2RAD; updateWithSkew(); } //---- SCALE -------------------------------------------------------------------------------------- public function get scaleX():Number { return _scaleX; } public function set scaleX($n:Number):void { if ($n == 0) { $n = 0.0001; } if (_skewX != 0 || _skewY != 0 || $n < 0 || _scaleX < 0) { _scaleX = $n; updateWithSkew(); } else { _scaleX = _target.scaleX = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } } public function get scaleY():Number { return _scaleY; } public function set scaleY($n:Number):void { if ($n == 0) { $n = 0.0001; } if (_skewX != 0 || _skewY != 0 || $n < 0 || _scaleY < 0) { _scaleY = $n; updateWithSkew(); } else { _scaleY = _target.scaleY = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } } public function get scaleZ():Number { return _scaleZ; } public function set scaleZ($n:Number):void { if ($n == 0) { $n = 0.0001; } if (_skewX != 0 || _skewY != 0 || $n < 0 || _scaleZ < 0) { _scaleZ = $n; updateWithSkew(); } else { _scaleZ = _target.scaleZ = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } } public function get scale():Number { return (_scaleX + _scaleY + _scaleZ) / 3; } public function set scale($n:Number):void { if ($n == 0) { $n = 0.0001; } if (_skewX != 0 || _skewY != 0 || $n < 0 || _scaleX < 0 || _scaleY < 0 || _scaleZ < 0) { _scaleX = _scaleY = _scaleZ = $n; updateWithSkew(); } else { _scaleX = _scaleY = _scaleZ = _target.scaleX = _target.scaleY = _target.scaleZ = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } } //---- OTHER PROPERTIES --------------------------------------------------------------------------------- public function get alpha():Number { return _target.alpha; } public function set alpha($n:Number):void { _target.alpha = $n; } public function get width():Number { return _target.width; } public function set width($n:Number):void { _target.width = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } public function get height():Number { return _target.height; } public function set height($n:Number):void { _target.height = $n; if (!_regAt0) { reposition(); } if (_proxies.length > 1) { //if there are other proxies controlling the same _target, make sure their _registration variable is updated updateSiblingProxies(); } } } }
package com.swfdiy.data { import flash.net.FileReference; import flash.utils.ByteArray; import flash.utils.Endian; public class ABCStream { private var _data:ByteArray; private var _cacheByte:int; private var _cacheByteUsedBits:int; public function ABCStream(data:ByteArray) : void { _data = data; _data.endian = Endian.LITTLE_ENDIAN; _cacheByteUsedBits = 8; _cacheByte = 0; } public function set pos(p:int): void { _data.position = p; } public function get rawdata():ByteArray { return _data; } public function get pos(): int { return _data.position; } public function read_u8():int { return _data.readUnsignedByte(); } public function write_u8(n:int):void { _data.writeByte(n); } public function read_u16():int { return _data.readUnsignedShort(); } public function write_u16(n:int):void { _data.writeShort(n); } public function read_string():String { var len:int = this.read_u32(); var str:String = _data.readUTFBytes(len); return str; } public function write_string(s:String):void { var p:int = _data.position; _data.writeUTFBytes(s); var real_len:int = _data.position - p; _data.position = p; this.write_u32(real_len); _data.writeUTFBytes(s); } public function read_bytes(len:int):ByteArray { var dest:ByteArray = new ByteArray(); dest.endian = Endian.LITTLE_ENDIAN; if (len ==0) { return dest; } try { _data.readBytes(dest,0, len); } catch (e:*) { return null; } return dest; } public function write_bytes(b:ByteArray):void { if (!b) { return; } _data.writeBytes(b, 0); } public function read_s24():int { var b:int = _data.readUnsignedByte(); b |= _data.readUnsignedByte()<<8; b |= _data.readByte()<<16; return b } public function write_s24(n:int):void { _data.writeByte(n & 0x000000ff); _data.writeByte((n & 0x0000ff00)>>8); _data.writeByte((n & 0x00ff0000)>>16); } /* public function read_s24():int { } public function read_u30():int { return 0; } public function read_s32():int { } public function read_d32():Number { } */ public function read_u32():int { /* from avm overview: The variable-length encoding for u30, u32, and s32 uses one to five bytes, depending on the magnitude of the value encoded. Each byte contributes its low seven bits to the value. If the high (eighth) bit of a byte is set, then the next byte of the abcFile is also part of the value. In the case of s32, sign extension is applied: the seventh bit of the last byte of the encoding is propagated to fill out the 32 bits of the decoded value. */ var result:int = _data.readUnsignedByte(); if (!(result & 0x00000080)) { // 1000 0000 8th bit return result; } result = (result & 0x0000007f) | (_data.readUnsignedByte()<<7); // 0111 1111 if (!(result & 0x00004000)) { //0100 0000 0000 0000 15th bit return result; } result = (result & 0x00003fff) | (_data.readUnsignedByte()<<14); //0011 1111 1111 if (!(result & 0x00200000)) { //0010 0000 0000 0000 0000 0000 22th bit return result; } result = (result & 0x001fffff) | (_data.readUnsignedByte()<<21); /// 0001 1111 1111 1111 1111 1111 if (!(result & 0x10000000)) { // 29th bit return result; } return (result & 0x0fffffff) | (_data.readUnsignedByte()<<28); } public function write_u32(n:int):void { //0000 0000 ,1 0000000 ,1 0000000 ,1 0000000 ,1 0000000 var b:int = 0; if (n & 0xf0000000) { //have 5 bytes b = 5; } else if (n & 0xfe00000) { b = 4; } else if (n & 0x001fc000) { b = 3; } else if (n & 0x00003f80) { b = 2; } else { b = 1; } var t:int = (n & 0x0000007f) | (( b > 1? 1 : 0)<<7 ); _data.writeByte( t ); if (b >1) { t = (n & 0x00003f80)>>7 | (( b > 2 ? 1 : 0)<<7 ); _data.writeByte( t ); } if (b >2) { t = (n & 0x001fc000)>>14 | (( b > 3 ? 1 : 0)<< 7 ); _data.writeByte( t ); } if (b >3) { t = (n & 0xfe00000)>>21 | (( b > 4 ? 1 : 0)<< 7 ) ; _data.writeByte( t ); } if (b >4) { t = (n & 0xf0000000)>>28; _data.writeByte( t ); } } public function readDouble():Number { return _data.readDouble(); } public function writeDouble(n:Number):void { return _data.writeDouble(n); } public function get bytesAvailable():int { return _data.bytesAvailable; } /* public function read_bytes(len:int=0):SWFStream { var dest:ByteArray = new ByteArray(); if (len ==0) { return new SWFStream(dest); } try { _data.readBytes(dest,0, len); } catch (e:*) { return null; } var destStream:SWFStream = new SWFStream(dest); return destStream; } public function read_UI8() : int { return _data.readUnsignedByte(); } public function read_UI16() : int { return _data.readUnsignedShort(); } public function read_UI32() : int { return _data.readUnsignedInt(); } public function read_SI8() : int { return _data.readByte(); } public function read_SI16() : int { return _data.readShort(); } public function read_SI32() : int { return _data.readInt(); } public function uncompress() :Boolean { var unData:ByteArray = new ByteArray(); _data.position = 8; _data.readBytes(unData); unData.uncompress(); _data.position = 8; _data.writeBytes(unData); return true; } public function set pos(p:int): void { _data.position = p; } public function get pos(): int { return _data.position; } public function get length(): int { return _data.length; } public function get bytesAvailable() :int { return _data.bytesAvailable; } public function get rawdata():ByteArray { return _data; } private function _get_mask(bit_start:int):int { var mask:int = 0; if (bit_start == 0) { mask = 0x80; } else if (bit_start == 1) { mask = 0x40; }else if (bit_start == 2) { mask = 0x20; }else if (bit_start == 3) { mask = 0x10; }else if (bit_start == 4) { mask = 0x08; }else if (bit_start == 5) { mask = 0x04; }else if (bit_start == 6) { mask = 0x02; }else if (bit_start == 7) { mask = 0x01; } return mask; } private function _get_short_mask(bit_start:int):int { var mask:int = 0; if (bit_start == 0) { mask = 0x8000; } else if (bit_start == 1) { mask = 0x4000; }else if (bit_start == 2) { mask = 0x2000; }else if (bit_start == 3) { mask = 0x1000; }else if (bit_start == 4) { mask = 0x0800; }else if (bit_start == 5) { mask = 0x0400; }else if (bit_start == 6) { mask = 0x0200; }else if (bit_start == 7) { mask = 0x0100; } else if (bit_start == 8) { mask = 0x0080; } else if (bit_start == 9) { mask = 0x0040; }else if (bit_start == 10) { mask = 0x0020; }else if (bit_start == 11) { mask = 0x0010; }else if (bit_start == 12) { mask = 0x0008; }else if (bit_start == 13) { mask = 0x0004; }else if (bit_start == 14) { mask = 0x0002; }else if (bit_start == 15) { mask = 0x0001; } return mask; } public function read_bits( nbits:int):int { //private var _cacheByte:int; //private var _cacheByteUsedBits:int; //read from pre bits var readingBits:Array = new Array(); //int real_use = 0; var nbits_left:int = nbits; var i:int; var j:int; var k:int; var mask:int; var bytes_tmp:Array ; if (_cacheByteUsedBits < 8) { var nbits_cache_left :int = 8 - _cacheByteUsedBits; var should_read:int = nbits_left; if (should_read > nbits_cache_left) { should_read = nbits_cache_left; } var bit_start :int = _cacheByteUsedBits; for (i=0;i<should_read;i++){ mask = _get_mask(bit_start+i); readingBits.push( _cacheByte & mask ? 1: 0); } _cacheByteUsedBits += should_read; nbits_left -= should_read; } //read from bytes var bytes:int = int(nbits_left / 8); if (bytes) { bytes_tmp = new Array(); for ( j=0;j<bytes;j++) { var b:int = _data.readByte(); bytes_tmp.push(b); } for ( i=0;i<bytes;i++){ for ( j=0;j<8;j++) { mask = _get_mask(j); readingBits.push( bytes_tmp[i] & mask ? 1: 0); } } nbits_left -= bytes*8; } if (nbits_left) { bytes_tmp = new Array(); bytes_tmp.push(_data.readByte()); _cacheByteUsedBits= 0; _cacheByte = bytes_tmp[0]; for ( j=0;j<nbits_left;j++) { mask = _get_mask(j); readingBits.push( _cacheByte & mask ? 1: 0); _cacheByteUsedBits++; } nbits_left = 0; } //finish var result:int = 0; for ( i=nbits-1;i>=0;i--) { if (readingBits[i]) { //1 result |= _get_short_mask(15 - (nbits -1 -i)); } else { //0 } } return result; } public function read_string():String { //find the string len at first var oldPos:int = _data.position; var len:int = 0; var finded:Boolean = false; while (_data.position < _data.length) { var val:int = _data.readByte(); len++; if (val == 0) { finded = true; break; } } if (!finded) { //error.... return ""; } else { _data.position = oldPos; var str:String = _data.readUTFBytes(len-1); _data.readByte(); return str; } } */ } }
/** * Copyright (c) 2009 apdevblog.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.apdevblog.ui.video.controls { import com.apdevblog.ui.video.style.ApdevVideoPlayerDefaultStyle; import com.apdevblog.utils.Draw; import flash.display.Graphics; import flash.display.Shape; import flash.display.Sprite; /** * Play icon (displayed on the preview image). * * @playerversion Flash 9 * @langversion 3.0 * * @package com.apdevblog.ui.video * @author Philipp Kyeck / phil[at]apdevblog.com * @copyright 2009 apdevblog.com * @version SVN: $Id: IconPlay.as 7 2009-10-13 16:46:31Z p.kyeck $ * * @see com.apdevblog.ui.video.ApdevVideoPlayer ApdevVideoPlayer */ public class IconPlay extends Sprite { /** * creates a play icon ("o" and draws a ">" in the middle). */ public function IconPlay(_style:ApdevVideoPlayerDefaultStyle) { mouseEnabled = false; mouseChildren = false; var circle:Shape = Draw.circle(0, 0, 60, _style.playIconBg, _style.playIconBgAlpha); addChild(circle); var play:Shape = new Shape(); var g:Graphics = play.graphics; g.beginFill(_style.playIcon, _style.playIconAlpha); g.moveTo(-12, -22); g.lineTo(20, 0); g.lineTo(-12, 22); g.lineTo(-12, -22); g.endFill(); addChild(play); } } }
package { import authoring.authObject; import flash.display.*; import flash.events.*; import flash.utils.getDefinitionByName; public class Background extends MovieClip { var bg_1:MovieClip; var bg_2:MovieClip; var yLowerLimit:uint = 448; public var speed:uint; public var speedIncrease:uint; public function Background() { var myLibraryGraphic:Class; speed = 2; speedIncrease = 4; //Get the class (specifically movieclip) from my lib fla. myLibraryGraphic = getDefinitionByName("bg_mc") as Class; //Create the new movieclips. bg_1 = new myLibraryGraphic() as MovieClip; bg_2 = new myLibraryGraphic() as MovieClip; bg_1.x =bg_1.width/2; bg_1.y = 0; bg_2.x = bg_1.width/2; bg_2.y = -448; addChild(bg_1); addChild(bg_2); addEventListener(Event.ENTER_FRAME, movingBG); } public function fullSPEED() { speed = speedIncrease; } private function movingBG(event:Event) { bg_1.y +=speed; bg_2.y +=speed; if(bg_1.y > yLowerLimit) { bg_1.y = -yLowerLimit; } if(bg_2.y > yLowerLimit) { bg_2.y = -yLowerLimit; } }//end of moving function }//end class }//end of package
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mangui.hls.event { import org.mangui.hls.model.Level; import flash.events.Event; /** Event fired when an error prevents playback. **/ public class HLSEvent extends Event { /** Identifier for a manifest loading event, triggered after a call to hls.load(url) **/ public static const MANIFEST_LOADING : String = "hlsEventManifestLoading"; /** Identifier for a manifest parsed event, * triggered after main manifest has been retrieved and parsed. * hls playlist may not be playable yet, in case of adaptive streaming, start level playlist is not downloaded yet at that stage */ public static const MANIFEST_PARSED : String = "hlsEventManifestParsed"; /** Identifier for a manifest loaded event, when this event is received, main manifest and start level has been retrieved */ public static const MANIFEST_LOADED : String = "hlsEventManifestLoaded"; /** Identifier for a level loading event **/ public static const LEVEL_LOADING : String = "hlsEventLevelLoading"; /** Identifier for a level loading aborted event **/ public static const LEVEL_LOADING_ABORTED : String = "hlsEventLevelLoadingAborted"; /** Identifier for a level loaded event **/ public static const LEVEL_LOADED : String = "hlsEventLevelLoaded"; /** Identifier for a level switch event. **/ public static const LEVEL_SWITCH : String = "hlsEventLevelSwitch"; /** Identifier for a level ENDLIST event. **/ public static const LEVEL_ENDLIST : String = "hlsEventLevelEndList"; /** Identifier for a fragment loading event. **/ public static const FRAGMENT_LOADING : String = "hlsEventFragmentLoading"; /** Identifier for a fragment loaded event. **/ public static const FRAGMENT_LOADED : String = "hlsEventFragmentLoaded"; /* Identifier for fragment load aborting for emergency switch down */ public static const FRAGMENT_LOAD_EMERGENCY_ABORTED : String = "hlsEventFragmentLoadEmergencyAborted"; /** Identifier for a fragment playing event. **/ public static const FRAGMENT_PLAYING : String = "hlsEventFragmentPlaying"; /** Identifier for a fragment skipping event. **/ public static const FRAGMENT_SKIPPED : String = "hlsEventFragmentSkipped"; /** Identifier for a audio tracks list change **/ public static const AUDIO_TRACKS_LIST_CHANGE : String = "audioTracksListChange"; /** Identifier for a audio track switch **/ public static const AUDIO_TRACK_SWITCH : String = "audioTrackSwitch"; /** Identifier for a audio level loading event **/ public static const AUDIO_LEVEL_LOADING : String = "hlsEventAudioLevelLoading"; /** Identifier for a audio level loaded event **/ public static const AUDIO_LEVEL_LOADED : String = "hlsEventAudioLevelLoaded"; /** Identifier for audio/video TAGS loaded event. **/ public static const TAGS_LOADED : String = "hlsEventTagsLoaded"; /** Identifier when last fragment of playlist has been loaded **/ public static const LAST_VOD_FRAGMENT_LOADED : String = "hlsEventLastFragmentLoaded"; /** Identifier for a playback warning event. **/ public static const WARNING : String = "hlsEventWarning"; /** Identifier for a playback error event. **/ public static const ERROR : String = "hlsEventError"; /** Identifier for a playback media time change event. **/ public static const MEDIA_TIME : String = "hlsEventMediaTime"; /** Identifier for a playback state switch event. **/ public static const PLAYBACK_STATE : String = "hlsPlaybackState"; /** Identifier for a seek state switch event. **/ public static const SEEK_STATE : String = "hlsSeekState"; /** Identifier for stream type changes: VoD or Live, type will be stored in 'streamType' field **/ public static const STREAM_TYPE_DID_CHANGE:String = "hlsEventStreamTypeDidChange"; /** Identifier for a playback complete event. **/ public static const PLAYBACK_COMPLETE : String = "hlsEventPlayBackComplete"; /** Identifier for a Playlist Duration updated event **/ public static const PLAYLIST_DURATION_UPDATED : String = "hlsPlayListDurationUpdated"; /** Identifier for a ID3 updated event **/ public static const ID3_UPDATED : String = "hlsID3Updated"; /** Identifier for a fps drop event **/ public static const FPS_DROP : String = "hlsFPSDrop"; /** Identifier for a fps drop level capping event **/ public static const FPS_DROP_LEVEL_CAPPING : String = "hlsFPSDropLevelCapping"; /** Identifier for a fps drop smooth level switch event **/ public static const FPS_DROP_SMOOTH_LEVEL_SWITCH : String = "hlsFPSDropSmoothLevelSwitch"; /** Identifier for a live loading stalled event **/ public static const LIVE_LOADING_STALLED : String = "hlsLiveLoadingStalled"; /** Identifier for a Stage set event **/ public static const STAGE_SET : String = "hlsStageSet"; /**ckplayer-m3u8 about m3u8 list**/ public static const M3U8_LIST : String = "hlsM3u8List"; /** The current url **/ public var url : String; /** The current quality level. **/ public var level : int; /** The current playlist duration. **/ public var duration : Number; /** The list with quality levels. **/ public var levels : Vector.<Level>; /** The error message. **/ public var error : HLSError; /** Load Metrics. **/ public var loadMetrics : HLSLoadMetrics; /** Play Metrics. **/ public var playMetrics : HLSPlayMetrics; /** The time position. **/ public var mediatime : HLSMediatime; /** The new playback state. **/ public var state : String; /** The new stream type value **/ public var streamType: String; /** The current audio track **/ public var audioTrack : int; /** a complete ID3 payload from PES, as a hex dump **/ public var ID3Data : String; /**ckplayer-m3u8 about m3u8 list**/ public var m3u8list :Array; /** Assign event parameter and dispatch. **/ public function HLSEvent(type : String, parameter : *=null, parameter2 : *=null) { switch(type) { case MANIFEST_LOADING: case FRAGMENT_LOADING: url = parameter as String; break; case ERROR: case WARNING: error = parameter as HLSError; break; case TAGS_LOADED: case FRAGMENT_LOADED: case FRAGMENT_LOAD_EMERGENCY_ABORTED: case LEVEL_LOADED: case AUDIO_LEVEL_LOADED: loadMetrics = parameter as HLSLoadMetrics; break; case MANIFEST_PARSED: case MANIFEST_LOADED: levels = parameter as Vector.<Level>; if(parameter2) { loadMetrics = parameter2 as HLSLoadMetrics; } break; case MEDIA_TIME: mediatime = parameter as HLSMediatime; break; case PLAYBACK_STATE: case SEEK_STATE: state = parameter as String; break; case LEVEL_LOADING: case LEVEL_LOADING_ABORTED: case LEVEL_SWITCH: case LEVEL_ENDLIST: case AUDIO_LEVEL_LOADING: case FPS_DROP: case FPS_DROP_LEVEL_CAPPING: level = parameter as int; break; case PLAYLIST_DURATION_UPDATED: case FRAGMENT_SKIPPED: duration = parameter as Number; break; case ID3_UPDATED: ID3Data = parameter as String; break; case FRAGMENT_PLAYING: playMetrics = parameter as HLSPlayMetrics; break; case HLSEvent.STREAM_TYPE_DID_CHANGE: // Stream Type is required streamType = String(parameter); break; case M3U8_LIST: m3u8list = parameter as Array; break; default: break; } super(type, false, false); } } }
package im.siver.logger.v1 { import flash.display.DisplayObject; public class Logger { private static var _enabled:Boolean = true; private static var _initialized:Boolean = false; internal static const VERSION:String = '1.0.0'; /** * This will initialize the Monster Debugger, the client will start a socket connection * to the Monster Debugger desktop application and initialize the core functions like * memory- and fpsmonitor. From this point on you can use other functions like trace, * snapshot, inspect, etc. * * @example * <code> * Logger.initialize(this);<br> * Logger.initialize(stage);<br> * </code> * * @param base: The root of your application. We suggest you use the document class * or stage property for this. In PureMVC projects this could also * be your main view or application façade, but in this you won't be able * to see the display tree or use the highlight functions. * @param address: (Optional) An IP address where the Monster Debugger will * try to connect to. By default it will connect to you local IP address * (127.0.0.1) but you can also supply another IP address like a remote * machine. */ public static function initialize(base:Object, address:String = "127.0.0.1"):void { if (!_initialized) { _initialized = true; // Start engines Core.base = base; Core.initialize(); Connection.initialize(); Connection.address = address; Connection.connect(); } } /** * Enables or disables the Monster Debugger. You can set this property before calling initialize * to disable even the core functions and socket connection to keep the memory footprint at * a minimum. We advise you to always disable the Monster Debugger on a final build. */ public static function get enabled():Boolean { return _enabled; } public static function set enabled(value:Boolean):void { _enabled = value; } /** * The trace function of the Monster Debugger can be used to display standard objects like * Strings, Numbers, Arrays, etc. But it can also be used to display more complex objects like * custom classes, XML or even multidimensional arrays containing XML nodes for that matter. * It will send a snapshot of those objects to the desktop application where you can inspect them. * * @example * <code> * Logger.trace(this, "error");<br> * Logger.trace(this, myObject);<br> * Logger.trace(this, myObject, 0xFF0000, 5);<br> * Logger.trace("myStaticClass", myObject);<br> * </code> * * @param caller: The caller of the trace. We suggest you always use the keyword "this". * The caller is displayed in the desktop application to easily identify * your traces on instance level. Note: if you use this function within a * static class, use a string as caller like: "MyStaticClass". * @param object: The object to trace, this can be anything. For instance a String, * Number or Array but also complex items like a custom class, * multidimensional arrays. * @param color: (Optional) The color of the trace. This can be useful if you want * to color code your traces; red for errors, green for status updates, etc. * @param depth: (Optional) The level of depth for this trace. By default the Monster Debugger * will trace a tree structure of five levels deep to preserve CPU power. * In some occasions 5 could not be enough to see the whole object, for * instance if you’re tracing a large XML document with many sub nodes. * In those situations you can use a higher number to see the complete object. * If you set the depth to -1 it will not limit the levels at all and will * trace the entire tree. Be careful with this setting though as it can * dramatically slow down your application. */ public static function trace(caller:*, object:*, color:uint = 0x000000, depth:int = 5):void { if (_initialized && _enabled) { Core.trace(caller, object, color, depth); } } /** * Makes a snapshot of a DisplayObject and sends it to the desktop application. This can be useful * if you need to compare visual states or display a hidden interface item. Snapshot will return * an un-rotated, completely visible (100% alpha) representation of the supplied DisplayObject. * * @example * <code> * Logger.snapshot(this, myMovieClip);<br> * Logger.snapshot(this, myBitmap, "joe", "interface");<br> * </code> * * @param caller: The caller of the snapshot. We suggest you always use the keyword "this". * The caller is displayed in the desktop application to easily identify your * snapshots on instance level. Note: if you use this function within a static * class use a string as caller like: "MyStaticClass". * @param object: The object to create the snapshot from. This object should extend a DisplayObject * (like a Sprite, MovieClip or UIComponent). * @param person: (Optional) The person of interest. You can use this label to easily work with * a team of programmers on one project. The desktop application has a filter for * persons so each member can see their own snapshots. * @param label: (Optional) Label to identify the snapshot. Within the desktop application * you can filter on this label. */ public static function snapshot(caller:*, object:DisplayObject, person:String = "", label:String = ""):void { if (_initialized && _enabled) { Core.snapshot(caller, object, person, label); } } /** * This will clear all traces in the connected Monster Debugger desktop application. * * @example * <code> * Logger.clear();<br> * </code> * */ public static function clear():void { if (_initialized && _enabled) { Core.clear(); } } } }
package com.rockdot.project.view.element.editor { import com.greensock.TweenLite; import com.rockdot.bootstrap.BootstrapConstants; import com.rockdot.core.model.RockdotConstants; import com.rockdot.library.view.component.common.form.ComponentDropdown; import com.rockdot.plugin.io.inject.IIOModelAware; import com.rockdot.plugin.io.model.IOModel; import com.rockdot.plugin.screen.displaylist.view.RockdotSpriteComponent; import com.rockdot.project.inject.IModelAware; import com.rockdot.project.model.Colors; import com.rockdot.project.model.Model; import com.rockdot.project.view.element.button.YellowButton; import flash.display.Bitmap; import flash.display.GradientType; import flash.display.Shape; import flash.geom.Matrix; public class EditorMain extends RockdotSpriteComponent implements IIOModelAware, IModelAware { private var _cmpPhotoEditor : IAMPhotoEditor; private var _mask : Shape; private var _btnSave : YellowButton; private var _btnClear : YellowButton; private var _quoteEditor : IAMLogoEditor; private var _bg : Shape; private var _appModel : Model; public function set appModel(appModel : Model) : void { _appModel = appModel; } private var _ioModel : IOModel; public function set ioModel(ioModel : IOModel) : void { _ioModel = ioModel; } public function set nikonModel(nikonModel : Model) : void { _appModel = nikonModel; } /** * Holds the image, move/zoom functionality, quote editor */ public function EditorMain(id:String) { super(); name = id; // bg _bg = new Shape(); addChild(_bg); // holder _cmpPhotoEditor = new IAMPhotoEditor(id + ".editor"); _cmpPhotoEditor.visible = false; _cmpPhotoEditor.alpha = 0; addChild(_cmpPhotoEditor); // mask _mask = new Shape(); addChild(_mask); _cmpPhotoEditor.mask = _mask; // quote editor _quoteEditor = new IAMLogoEditor(name + ".quotes"); _quoteEditor.submitCallback = _onRolloutChange; addChild(_quoteEditor); // buttons clear/save _btnSave = new YellowButton(getProperty("button.save")); _btnSave.submitCallback = _save; addChild(_btnSave); _btnClear = new YellowButton(getProperty("button.clear")); _btnClear.submitCallback = _clearImage; addChild(_btnClear); _hideGui(); } override public function render() : void { super.render(); // buttons clear/save - below the image!!!! _btnClear.x = 0; _btnClear.y = _height - BootstrapConstants.HEIGHT_RASTER - BootstrapConstants.SPACER; _btnClear.setWidth( _width/2 - BootstrapConstants.SPACER/2 ); _btnSave.x = _width/2 + BootstrapConstants.SPACER/2; _btnSave.y = _height - BootstrapConstants.HEIGHT_RASTER - BootstrapConstants.SPACER; _btnSave.setWidth( _width/2 - BootstrapConstants.SPACER/2 ); // IMAGE AREA SIZE !!! var contentWidth : int = _width; var contentHeight : Number = _btnSave.y - BootstrapConstants.SPACER; // bg - within the image! var fillType : String = GradientType.RADIAL; var colors : Array = [0x606060, 0x363636]; var alphas : Array = [1, 1]; var ratios : Array = [0x00, 0xFF]; var matr : Matrix = new Matrix(); matr.createGradientBox(contentWidth, contentHeight - 2*BootstrapConstants.SPACER, 0, 0, 0); _bg.graphics.clear(); _bg.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr); _bg.graphics.drawRoundRect(0, BootstrapConstants.SPACER, contentWidth, contentHeight - 2*BootstrapConstants.SPACER, 8, 8); _bg.graphics.endFill(); //buttons _cmpPhotoEditor.setSize(contentWidth, contentHeight); _cmpPhotoEditor.y = BootstrapConstants.SPACER; // quote editor _quoteEditor.setSize(contentWidth, contentHeight); _quoteEditor.y = BootstrapConstants.SPACER; _mask.graphics.clear(); _mask.graphics.beginFill(Colors.BACKGROUND_COLOR, 1); _mask.graphics.drawRoundRect(0, BootstrapConstants.SPACER, contentWidth, contentHeight - 2*BootstrapConstants.SPACER, 8, 8); _mask.graphics.endFill(); } /** * Callback for Rollout Button Click and Rollout Entry Click */ private function _onRolloutChange(text : String) : void { switch(text){ case IAMLogoEditor.DRAG_START: _cmpPhotoEditor.disappear(); break; case IAMLogoEditor.DRAG_STOP: _cmpPhotoEditor.appear(); break; case ComponentDropdown.ROLLOUT_CLOSE: _cmpPhotoEditor.appear(); TweenLite.to(_cmpPhotoEditor.getPhoto(), 0.5, {alpha:1}); break; case ComponentDropdown.ROLLOUT_OPEN: _cmpPhotoEditor.disappear(); TweenLite.to(_cmpPhotoEditor.getPhoto(), 0.5, {alpha:0}); break; } } private function _save() : void { hideControls(); _appModel.iamline = _quoteEditor.iamInputText; _appModel.iamtype = _quoteEditor.getQuoteType(); _appModel.image = _cmpPhotoEditor.getPhoto(); _appModel.quote = _quoteEditor; _submitCallback.call(null); } public function setBitmap(image : Bitmap) : void { _cmpPhotoEditor.setPhoto(image); // show GUI TweenLite.to(_cmpPhotoEditor, 0.5, {autoAlpha:1}); _showGui(); } /*********************************************************************** * open confirmation layer ***********************************************************************/ public function hideControls() : void { _hideGui(); _quoteEditor.hideArrows(); } public function showControls() : void { _showGui(); _quoteEditor.showArrows(); } /*********************************************************************** * clear image ***********************************************************************/ private function _clearImage() : void { _hideGui(); TweenLite.to(_cmpPhotoEditor, 0.5, {autoAlpha:0, onComplete:_clearImageTotal}); _quoteEditor.minimize(); } private function _clearImageTotal() : void { _cmpPhotoEditor.reset(); } /*********************************************************************** * show/hide gui ***********************************************************************/ private function _hideGui() : void { _btnSave.visible = false; _btnClear.visible = false; } private function _showGui() : void { _btnSave.visible = true; _btnClear.visible = true; } } }
/* * Copyright 2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.spicefactory.parsley.messaging.receiver { import org.spicefactory.parsley.core.context.provider.ObjectProvider; /** * Abstract base class for all types of message receivers that use an ObjectProvider for determining * the target instance handling the message. * An object provider is a convenient way to register lazy intializing message receivers where * the instantiation of the actual instance handling the message may be deferred until the first * matching message is dispatched. * * @author Jens Halm */ public class AbstractObjectProviderReceiver extends AbstractMessageReceiver { /** * Creates a new instance. * * @param info the mapping information for this receiver */ function AbstractObjectProviderReceiver (info: MessageReceiverInfo) { super(info); } private var _provider:ObjectProvider; /** * Sets the provider for target instances for this receiver. * * @param provider the provider for target instances for this receiver */ protected function setProvider (provider: ObjectProvider): void { _provider = provider; } /** * The provider for the actual instance handling the message. * Accessing the instance property of the provider may lead to initialization of the target instance in case * it is lazy-intializing. */ public function get provider () : ObjectProvider { return _provider; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package spark.automation.delegates.components.supportClasses { import flash.display.DisplayObject; import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import mx.automation.Automation; import mx.automation.IAutomationObject; import mx.automation.IAutomationObjectHelper; import mx.automation.delegates.core.UIComponentAutomationImpl; import mx.automation.tabularData.ContainerTabularData; import mx.core.EventPriority; import mx.core.mx_internal; import spark.components.Scroller; import spark.components.supportClasses.GroupBase; import spark.core.IViewport; use namespace mx_internal; [Mixin] /** * * Defines methods and properties required to perform instrumentation for the * GroupBase control. * * @see spark.components.supportClasses.GroupBase * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.5 * @productversion Flex 4 * */ public class SparkGroupBaseAutomationImpl extends UIComponentAutomationImpl { include "../../../../core/Version.as"; //-------------------------------------------------------------------------- // // Class methods // //-------------------------------------------------------------------------- /** * Registers the delegate class for a component class with automation manager. * * @param root The SystemManger of the application. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.5 * @productversion Flex 4 */ public static function init(root:DisplayObject):void { Automation.registerDelegateClass(spark.components.supportClasses.GroupBase, SparkGroupBaseAutomationImpl); } /** * Constructor. * @param obj GroupBase object to be automated. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function SparkGroupBaseAutomationImpl(obj:spark.components.supportClasses.GroupBase) { super(obj); obj.$addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler, false, EventPriority.DEFAULT+1, true ); } override protected function addMouseEvent(obj:DisplayObject, event:String, handler:Function , useCapture:Boolean = false , priority:int = 0, useWeekRef:Boolean = false):void { grpBase.$addEventListener(event, handler, useCapture,priority, useWeekRef); // special addevent listener on the container, which does not add the mouse shield. } /** * @private * storage for the owner component */ protected function get grpBase():GroupBase { return uiComponent as GroupBase; } //---------------------------------- // automationName //---------------------------------- /** * @private */ override public function get automationName():String { return super.automationName; } //---------------------------------- // automationValue //---------------------------------- /** * @private */ override public function get automationValue():Array { return super.automationValue; } //-------------------------------------------------------------------------- // // Overridden methods // //-------------------------------------------------------------------------- /** * @private * Replays click interactions on the button. * If the interaction was from the mouse, * dispatches MOUSE_DOWN, MOUSE_UP, and CLICK. * If interaction was from the keyboard, * dispatches KEY_DOWN, KEY_UP. * Button's KEY_UP handler then dispatches CLICK. * * @param event ReplayableClickEvent to replay. */ override public function replayAutomatableEvent(event:Event):Boolean { var help:IAutomationObjectHelper = Automation.automationObjectHelper; if (event is MouseEvent && event.type == MouseEvent.CLICK) return help.replayClick(uiComponent, MouseEvent(event)); else if (event is MouseEvent && event.type == MouseEvent.MOUSE_WHEEL) return help.replayMouseEvent(uiComponent, event as MouseEvent); else if (event is KeyboardEvent) return help.replayKeyboardEvent(uiComponent, KeyboardEvent(event)); else return super.replayAutomatableEvent(event); } /** * @private */ override public function createAutomationIDPart(child:IAutomationObject):Object { var help:IAutomationObjectHelper = Automation.automationObjectHelper; return help.helpCreateIDPart(uiAutomationObject, child); } /** * @private */ override public function resolveAutomationIDPart(part:Object):Array { var help:IAutomationObjectHelper = Automation.automationObjectHelper; return help.helpResolveIDPart(uiAutomationObject, part); } /** * @private */ override public function createAutomationIDPartWithRequiredProperties(child:IAutomationObject, properties:Array):Object { var help:IAutomationObjectHelper = Automation.automationObjectHelper; return help.helpCreateIDPartWithRequiredProperties(uiAutomationObject, child,properties); } /** * @private */ override public function getAutomationChildren():Array { var n:int = grpBase.numChildren; var childArray:Array = new Array(); for ( var i:int = 0; i<n ; i++) { var obj:Object = grpBase.getChildAt(i); // here if are getting scrollers, we need to add the viewport's children as the actual children // instead of the scroller if(obj is spark.components.Scroller) { var scroller:spark.components.Scroller = obj as spark.components.Scroller; var viewPort:IViewport = scroller.viewport; if(viewPort is IAutomationObject) childArray.push(viewPort); if(scroller.horizontalScrollBar) childArray.push(scroller.horizontalScrollBar); if(scroller.verticalScrollBar) childArray.push(scroller.verticalScrollBar); } else childArray.push(obj as IAutomationObject); } return childArray; } /** * @private */ protected function getInternalScroller():spark.components.Scroller { var n:int = grpBase.numChildren; var childArray:Array = new Array(); for ( var i:int = 0; i<n ; i++) { var obj:Object = grpBase.getChildAt(i); // here if are getting scrollers, we need to add the viewport's children as the actual children // instead of the scroller if(obj is spark.components.Scroller) return obj as spark.components.Scroller; } return null; } /** * @private */ override public function get automationTabularData():Object { return new ContainerTabularData(uiAutomationObject); } /** * @private */ private function mouseWheelHandler(event:MouseEvent):void { if(event.target == uiComponent) { recordAutomatableEvent(event, true); } } /** * @private */ override protected function keyDownHandler(event:KeyboardEvent):void { if( event.target == getInternalScroller()) recordAutomatableEvent(event); } } }
/* Copyright 2012 Hewlett-Packard Development Company, L.P. */ package com.hp.asi.hpic4vc.ui.model { import mx.collections.ArrayCollection; [Bindable] [RemoteClass(alias="com.hp.asi.hpic4vc.provider.model.FirmwareModel")] /** * A data model of datagrid properties to display. * This Flex class maps to the FirmwareModel java type returned by * the property provider in hpic4vc-provider. */ public class FirmwareModel extends BaseModel { public var softwareTable:TableModel; public var softwareTableTitle:String; public var firmwareTable:TableModel; public var firmwareTableTitle:String; } }
package kabam.rotmg.characters.deletion.control { import com.company.assembleegameclient.appengine.SavedCharacter; import org.osflash.signals.Signal; public class DeleteCharacterSignal extends Signal { public function DeleteCharacterSignal() { super(SavedCharacter); } } }
/* The MIT License Copyright (c) 2010 Mike Chambers 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.mikechambers.pewpew.ui.events { import flash.events.Event; /* Class that represents event broadcast when screen views need to be changed / updated */ public class ScreenControlEvent extends Event { //game is over public static const GAME_OVER:String = "onGameOver"; //request to play game public static const PLAY:String = "onPlay"; //request to view high scores (not implimented) public static const HIGH_SCORES:String = "onHighScores"; //request to view stats (not implimented) public static const STATS:String = "onStats"; //request to view profile (not implimented) public static const PROFILE_SELECTED:String = "onProfileSelected"; //profile name being requested (not implimented) public var profileName:String; public function ScreenControlEvent( type:String, bubbles:Boolean=true, cancelable:Boolean=false ) { super(type, bubbles, cancelable); } override public function clone():Event { return new ScreenControlEvent(type, bubbles, cancelable); } } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.thrift { import org.apache.thrift.protocol.TField; import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.protocol.TProtocolUtil; import org.apache.thrift.protocol.TStruct; import org.apache.thrift.protocol.TType; /** * Application level exception */ public class TApplicationError extends TError { private static const TAPPLICATION_EXCEPTION_STRUCT:TStruct = new TStruct("TApplicationException"); private static const MESSAGE_FIELD:TField = new TField("message", TType.STRING, 1); private static const TYPE_FIELD:TField = new TField("type", TType.I32, 2); public static const UNKNOWN:int = 0; public static const UNKNOWN_METHOD:int = 1; public static const INVALID_MESSAGE_TYPE:int = 2; public static const WRONG_METHOD_NAME:int = 3; public static const BAD_SEQUENCE_ID:int = 4; public static const MISSING_RESULT:int = 5; public static const INTERNAL_ERROR:int = 6; public function TApplicationError(type:int = UNKNOWN, message:String = "") { super(message, type); } public static function read(iprot:TProtocol):TApplicationError { var field:TField; iprot.readStructBegin(); var message:String = null; var type:int = UNKNOWN; while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: if (field.type == TType.STRING) { message = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: if (field.type == TType.I32) { type = iprot.readI32(); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); return new TApplicationError(type, message); } public function write(oprot:TProtocol):void { oprot.writeStructBegin(TAPPLICATION_EXCEPTION_STRUCT); if (message != null) { oprot.writeFieldBegin(MESSAGE_FIELD); oprot.writeString(message); oprot.writeFieldEnd(); } oprot.writeFieldBegin(TYPE_FIELD); oprot.writeI32(errorID); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } } }
/** * View for an actionscript-drawn equalizer (thanks to Brewer). * The eq. is fake, but it considers playstate and volume. * * @author Jeroen Wijering * @version 1.1 **/ import com.jeroenwijering.players.*; class com.jeroenwijering.players.EqualizerView extends AbstractView { /** EQ movieclip reference **/ private var eqClip:MovieClip; /** current volume **/ private var currentVolume:Number; /** number of stripes to display in the EQ **/ private var eqStripes:Number; /** Constructor; just inheriting. **/ function EqualizerView(ctr:AbstractController,cfg:Object,fed:Object) { super(ctr,cfg,fed); setupEQ(); Stage.addListener(this); }; /** setup EQ **/ private function setupEQ() { eqClip = config["clip"].equalizer; eqClip._y = config["displayheight"] - 50; eqStripes = Math.floor((config['displaywidth'] - 20)/6); eqClip.stripes.duplicateMovieClip("stripes2",1); eqClip.mask.duplicateMovieClip("mask2",3); eqClip.stripes._width = eqClip.stripes2._width = config['displaywidth']-20; eqClip.stripes.top.col = new Color(eqClip.stripes.top); eqClip.stripes.top.col.setRGB(config['lightcolor']); eqClip.stripes.bottom.col = new Color(eqClip.stripes.bottom); eqClip.stripes.bottom.col.setRGB(0xFFFFFF); eqClip.stripes2.top.col = new Color(eqClip.stripes2.top); eqClip.stripes2.top.col.setRGB(config['lightcolor']); eqClip.stripes2.bottom.col = new Color(eqClip.stripes2.bottom); eqClip.stripes2.bottom.col.setRGB(0xFFFFFF); eqClip.stripes.setMask(eqClip.mask); eqClip.stripes2.setMask(eqClip.mask2); eqClip.stripes._alpha = eqClip.stripes2._alpha = 50; setInterval(this,"drawEqualizer",100,eqClip.mask); setInterval(this,"drawEqualizer",100,eqClip.mask2); }; /** Draw a rondom frame for the equalizer **/ private function drawEqualizer(tgt:MovieClip) { tgt.clear(); tgt.beginFill(0x000000, 100); tgt.moveTo(0,0); var h = Math.round(currentVolume/4); for (var j=0; j< eqStripes; j++) { var z = random(h)+h/2 + 2; if(j == Math.floor(eqStripes/2)) { z = 0; } tgt.lineTo(j*6,-1); tgt.lineTo(j*6,-z); tgt.lineTo(j*6+4,-z); tgt.lineTo(j*6+4,-1); tgt.lineTo(j*6,-1); } tgt.lineTo(j*6,0); tgt.lineTo(0,0); tgt.endFill(); }; /** Change the height to reflect the volume **/ private function setVolume(vol:Number) { currentVolume = vol; }; /** Only display the eq if a song is playing **/ private function setState(stt:Number) { stt == 2 ? eqClip._visible = true: eqClip._visible = false; }; /** Hide the EQ on fullscreen view **/ public function onFullScreen(fs:Boolean) { if(fs == true) { eqClip._visible = false; } else { eqClip._visible = true; } }; }
package devoron.sdk.server.clients.controller { import devoron.sdk.runtime.RuntimeClient; import org.aswing.util.HashMap; /** * RuntimeClientsController * @author Devoron */ public class RuntimeClientsController { private var modelsHash:HashMap public function RuntimeClientsController() { } public function setSelectedClient(client:RuntimeClient):void { } public function setSelectedClients(clients:Array):void { } public function appendClient(client:RuntimeClient):void { } public function removeClient():void { } public function appendModel():void { } public function setMaximumClietnsCount(value:uint):void { } } }
package asx.string { import org.flexunit.runners.Parameterized; import org.hamcrest.assertThat; import org.hamcrest.object.equalTo; Parameterized; [RunWith("org.flexunit.runners.Parameterized")] public class CamelizeTest { public static function camelizeWithLowerCaseFirstWordData():Array { return [ ["should camelize each word", "shouldCamelizeEachWord"], ["should remove spaces", "shouldRemoveSpaces"], ["should_remove_underscores", "shouldRemoveUnderscores"], ["should-remove-hyphens", "shouldRemoveHyphens"] ]; } [Test(dataProvider="camelizeWithLowerCaseFirstWordData")] public function camelizeWithLowerCaseFirstWord(value:String, expected:String):void { assertThat(camelize(value, true), equalTo(expected)); } public static function camelizeWithUpperCaseFirstWordData():Array { return [ ["should camelize each word", "ShouldCamelizeEachWord"], ["should remove spaces", "ShouldRemoveSpaces"], ["should_remove_underscores", "ShouldRemoveUnderscores"], ["should-remove-hyphens", "ShouldRemoveHyphens"] ]; } [Test(dataProvider="camelizeWithUpperCaseFirstWordData")] public function camelizeWithUpperCaseFirstWord(value:String, expected:String):void { assertThat(camelize(value), equalTo(expected)); } } }
/* * Copyright 2010 The Closure Compiler 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. */ /* * This file was generated from Google's Externs for the Google Maps v3.11 API. */ package google.maps { /** * @see [google_maps_api_v3_11] * @constructor */ public class KmlFeatureData { /** * @see [google_maps_api_v3_11] */ public function KmlFeatureData() { super(); } /** * @see JSType - [string] * @see [google_maps_api_v3_11] */ public var id:String; /** * @see JSType - [(google.maps.KmlAuthor|null)] * @see [google_maps_api_v3_11] */ public var author:google.maps.KmlAuthor; /** * @see JSType - [string] * @see [google_maps_api_v3_11] */ public var description:String; /** * @see JSType - [string] * @see [google_maps_api_v3_11] */ public var name:String; /** * @see JSType - [string] * @see [google_maps_api_v3_11] */ public var infoWindowHtml:String; /** * @see JSType - [string] * @see [google_maps_api_v3_11] */ public var snippet:String; } }
package org.ranapat.resourceloader.examples { import com.greensock.TweenLite; import flash.display.Sprite; import flash.events.Event; import org.ranapat.resourceloader.events.ResourceLoaderAllRequiredLoadedEvent; import org.ranapat.resourceloader.events.ResourceLoaderBundleCompleteEvent; import org.ranapat.resourceloader.events.ResourceLoaderClassLoadedEvent; import org.ranapat.resourceloader.events.ResourceLoaderCompleteEvent; import org.ranapat.resourceloader.events.ResourceLoaderFailEvent; import org.ranapat.resourceloader.events.ResourceLoaderProgressEvent; import org.ranapat.resourceloader.ResourceClasses; import org.ranapat.resourceloader.ResourceLoader; import org.ranapat.resourceloader.ResourceLoaderHelper; public class Main extends Sprite { private var loader:ResourceLoader; public function Main() { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point this.loader = ResourceLoader.instance; this.loader.addEventListener(ResourceLoaderProgressEvent.TYPE, this.handleProgress); this.loader.addEventListener(ResourceLoaderFailEvent.TYPE, this.handleFail); this.loader.addEventListener(ResourceLoaderCompleteEvent.TYPE, this.handleComplete); this.loader.addEventListener(ResourceLoaderClassLoadedEvent.TYPE, this.handleClassLoaded); this.loader.addEventListener(ResourceLoaderBundleCompleteEvent.TYPE, this.handleBundleLoaded); this.loader.addEventListener(ResourceLoaderAllRequiredLoadedEvent.TYPE, this.handleAllRequiredLoaded); trace("try to get the class :: " + ResourceClasses.instance.getClass("example.package.SomeTestClassA")); trace("try to load asset :: " + this.loader.load("../assets/assetsA.swf", 1, "b1", true)); trace("try to load asset :: " + this.loader.load("../assets/preloader.png", 1, "b2", true)); trace("try to load asset :: " + this.loader.load("../assets/assetsB.swf", 2, "b3")); TweenLite.delayedCall(5, this.handleDelayToObserve); } private function handleDelayToObserve():void { trace("we are here...") } private function handleProgress(e:ResourceLoaderProgressEvent):void { trace("progress.... " + e.uid + " .. " + e.progress + " .. " + e.bundle) } private function handleFail(e:ResourceLoaderFailEvent):void { trace("fail.... " + e.uid + " .. " + e.reason) } private function handleComplete(e:ResourceLoaderCompleteEvent):void { trace("complete...." + e.uid + " .. " + e.loaderTarget + " .. " + e.applicationDomain) if (e.uid == 2) { this.addChild(ResourceLoaderHelper.getDispalyObject(e.loaderTarget)); } } private function handleClassLoaded(e:ResourceLoaderClassLoadedEvent):void { trace("class loaded..." + e.name + " .. " + e._class) trace("try to get the class again :: " + ResourceClasses.instance.getClass("example.package.SomeTestClassA")); } private function handleBundleLoaded(e:ResourceLoaderBundleCompleteEvent):void { trace("bundle loaded..." + e.bundle) } private function handleAllRequiredLoaded(e:ResourceLoaderAllRequiredLoadedEvent):void { trace("all required loaded..." + e.bundle) } } }
// Copyright 2007. Adobe Systems Incorporated. All Rights Reserved. package com.sanbeetle.data{ import com.sanbeetle.events.DataChangeEvent; import com.sanbeetle.events.DataChangeType; import flash.events.EventDispatcher; //-------------------------------------- // Events //-------------------------------------- /** * Dispatched before the data is changed. * * @see #event:dataChange dataChange event * * @eventType fl.events.DataChangeEvent.PRE_DATA_CHANGE * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ [Event(name="preDataChange", type="com.sanbeetle.events.DataChangeEvent")] /** * Dispatched after the data is changed. * * @see #event:preDataChange preDataChange event * * @eventType fl.events.DataChangeEvent.DATA_CHANGE * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ [Event(name="dataChange", type="com.sanbeetle.events.DataChangeEvent")] //-------------------------------------- // Class description //-------------------------------------- /** * The DataProvider class provides methods and properties that allow you to query and modify * the data in any list-based component--for example, in a List, DataGrid, TileList, or ComboBox * component. * * <p>A <em>data provider</em> is a linear collection of items that serve as a data source--for * example, an array. Each item in a data provider is an object or XML object that contains one or * more fields of data. You can access the items that are contained in a data provider by index, by * using the <code>DataProvider.getItemAt()</code> method.</p> * * @includeExample examples/DataProviderExample.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public class DataProvider extends EventDispatcher { /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var data:Array; /** * Creates a new DataProvider object using a list, XML instance or an array of data objects * as the data source. * * @param data The data that is used to create the DataProvider. * * @includeExample examples/DataProvider.constructor.1.as -noswf * @includeExample examples/DataProvider.constructor.2.as -noswf * @includeExample examples/DataProvider.constructor.3.as -noswf * @includeExample examples/DataProvider.constructor.4.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function DataProvider(value:Object=null) { if (value == null) { data = []; } else { data = getDataFromObject(value); } } /** * The number of items that the data provider contains. * * @includeExample examples/DataProvider.length.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function get length():uint { return data.length; } /** * Invalidates the item at the specified index. An item is invalidated after it is * changed; the DataProvider automatically redraws the invalidated item. * * @param index Index of the item to be invalidated. * * @throws RangeError The specified index is less than 0 or greater than * or equal to the length of the data provider. * * @see #invalidate() * @see #invalidateItem() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function invalidateItemAt(index:int):void { checkIndex(index,data.length-1) dispatchChangeEvent(DataChangeType.INVALIDATE,[data[index]],index,index); } /** * Invalidates the specified item. An item is invalidated after it is * changed; the DataProvider automatically redraws the invalidated item. * * @param item Item to be invalidated. * * @see #invalidate() * @see #invalidateItemAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function invalidateItem(item:Object):void { var index:uint = getItemIndex(item); if (index == -1) { return; } invalidateItemAt(index); } /** * Invalidates all the data items that the DataProvider contains and dispatches a * <code>DataChangeEvent.INVALIDATE_ALL</code> event. Items are invalidated after they * are changed; the DataProvider automatically redraws the invalidated items. * * @see #invalidateItem() * @see #invalidateItemAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function invalidate():void { dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, DataChangeType.INVALIDATE_ALL,data.concat(),0,data.length)); } /** * Adds a new item to the data provider at the specified index. * If the index that is specified exceeds the length of the data provider, * the index is ignored. * * @param item An object that contains the data for the item to be added. * * @param index The index at which the item is to be added. * * @throws RangeError The specified index is less than 0 or greater than or equal * to the length of the data provider. * * @see #addItem() * @see #addItems() * @see #addItemsAt() * @see #getItemAt() * @see #removeItemAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function addItemAt(item:Object,index:uint):void { checkIndex(index,data.length); dispatchPreChangeEvent(DataChangeType.ADD,[item],index,index); data.splice(index,0,item); dispatchChangeEvent(DataChangeType.ADD,[item],index,index); } /** * Appends an item to the end of the data provider. * * @param item The item to be appended to the end of the current data provider. * * @includeExample examples/DataProvider.constructor.1.as -noswf * * @see #addItemAt() * @see #addItems() * @see #addItemsAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function addItem(item:Object):void { dispatchPreChangeEvent(DataChangeType.ADD,[item],data.length-1,data.length-1); data.push(item); dispatchChangeEvent(DataChangeType.ADD,[item],data.length-1,data.length-1); } /** * Adds several items to the data provider at the specified index and dispatches * a <code>DataChangeType.ADD</code> event. * * @param items The items to be added to the data provider. * * @param index The index at which the items are to be inserted. * * @throws RangeError The specified index is less than 0 or greater than or equal * to the length of the data provider. * * @see #addItem() * @see #addItemAt() * @see #addItems() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function addItemsAt(items:Object,index:uint):void { checkIndex(index,data.length); var arr:Array = getDataFromObject(items); dispatchPreChangeEvent(DataChangeType.ADD,arr,index,index+arr.length-1); data.splice.apply(data, [index,0].concat(arr)); dispatchChangeEvent(DataChangeType.ADD,arr,index,index+arr.length-1); } /** * Appends multiple items to the end of the DataProvider and dispatches * a <code>DataChangeType.ADD</code> event. The items are added in the order * in which they are specified. * * @param items The items to be appended to the data provider. * * @includeExample examples/DataProvider.addItems.1.as -noswf * * @see #addItem() * @see #addItemAt() * @see #addItemsAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function addItems(items:Object):void { addItemsAt(items,data.length); } /** * Concatenates the specified items to the end of the current data provider. * This method dispatches a <code>DataChangeType.ADD</code> event. * * @param items The items to be added to the data provider. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @see #addItems() * @see #merge() * * @internal Is this method any different than addItems()? It's not clear. * I also thing "concatenates the items *to*" sounds odd. Perhaps * the concatenated items are added to the end of the data provider? * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function concat(items:Object):void { addItems(items); } /** * Appends the specified data into the data that the data provider * contains and removes any duplicate items. This method dispatches * a <code>DataChangeType.ADD</code> event. * * @param data Data to be merged into the data provider. * * @see #concat() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function merge(newData:Object):void { var arr:Array = getDataFromObject(newData); var l:uint = arr.length; var startLength:uint = data.length; dispatchPreChangeEvent(DataChangeType.ADD,data.slice(startLength,data.length),startLength,this.data.length-1); for (var i:uint=0; i<l; i++) { var item:Object = arr[i]; if (getItemIndex(item) == -1) { data.push(item); } } if (data.length > startLength) { dispatchChangeEvent(DataChangeType.ADD,data.slice(startLength,data.length),startLength,this.data.length-1); } else { dispatchChangeEvent(DataChangeType.ADD,[],-1,-1); } } /** * Returns the item at the specified index. * * @param index Location of the item to be returned. * * @return The item at the specified index. * * @throws RangeError The specified index is less than 0 or greater than * or equal to the length of the data provider. * * @see #getItemIndex() * @see #removeItemAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function getItemAt(index:uint):Object { checkIndex(index,data.length-1); return data[index]; } /** * Returns the index of the specified item. * * @param item The item to be located. * * @return The index of the specified item, or -1 if the specified item is not found. * * @see #getItemAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function getItemIndex(item:Object):int { return data.indexOf(item);; } /** * Removes the item at the specified index and dispatches a <code>DataChangeType.REMOVE</code> * event. * * @param index Index of the item to be removed. * * @return The item that was removed. * * @throws RangeError The specified index is less than 0 or greater than * or equal to the length of the data provider. * * @see #removeAll() * @see #removeItem() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function removeItemAt(index:uint):Object { checkIndex(index,data.length-1); dispatchPreChangeEvent(DataChangeType.REMOVE, data.slice(index,index+1), index, index); var arr:Array = data.splice(index,1); dispatchChangeEvent(DataChangeType.REMOVE,arr,index,index); return arr[0]; } /** * Removes the specified item from the data provider and dispatches a <code>DataChangeType.REMOVE</code> * event. * * @param item Item to be removed. * * @return The item that was removed. * * @see #removeAll() * @see #removeItemAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function removeItem(item:Object):Object { var index:int = getItemIndex(item); if (index != -1) { return removeItemAt(index); } return null; } /** * Removes all items from the data provider and dispatches a <code>DataChangeType.REMOVE_ALL</code> * event. * * @see #removeItem() * @see #removeItemAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function removeAll():void { var arr:Array = data.concat(); dispatchPreChangeEvent(DataChangeType.REMOVE_ALL,arr,0,arr.length); data = []; dispatchChangeEvent(DataChangeType.REMOVE_ALL,arr,0,arr.length); } /** * Replaces an existing item with a new item and dispatches a <code>DataChangeType.REPLACE</code> * event. * * @param oldItem The item to be replaced. * * @param newItem The replacement item. * * @return The item that was replaced. * * @throws RangeError The item could not be found in the data provider. * * @see #replaceItemAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function replaceItem(newItem:Object,oldItem:Object):Object { var index:int = getItemIndex(oldItem); if (index != -1) { return replaceItemAt(newItem,index); } return null; } /** * Replaces the item at the specified index and dispatches a <code>DataChangeType.REPLACE</code> * event. * * @param newItem The replacement item. * * @param index The index of the item to be replaced. * * @return The item that was replaced. * * @throws RangeError The specified index is less than 0 or greater than * or equal to the length of the data provider. * * @see #replaceItem() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function replaceItemAt(newItem:Object,index:uint):Object { checkIndex(index,data.length-1); var arr:Array = [data[index]]; dispatchPreChangeEvent(DataChangeType.REPLACE,arr,index,index); data[index] = newItem; dispatchChangeEvent(DataChangeType.REPLACE,arr,index,index); return arr[0]; } /** * Sorts the items that the data provider contains and dispatches a <code>DataChangeType.SORT</code> * event. * * @param sortArg The arguments to use for sorting. * * @return The return value depends on whether the method receives any arguments. * See the <code>Array.sort()</code> method for more information. * This method returns 0 when the <code>sortOption</code> property * is set to <code>Array.UNIQUESORT</code>. * * @see #sortOn() * @see Array#sort() Array.sort() * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function sort(...sortArgs:Array):* { dispatchPreChangeEvent(DataChangeType.SORT,data.concat(),0,data.length-1); var returnValue:Array = data.sort.apply(data,sortArgs); dispatchChangeEvent(DataChangeType.SORT,data.concat(),0,data.length-1); return returnValue; } /** * Sorts the items that the data provider contains by the specified * field and dispatches a <code>DataChangeType.SORT</code> event. * The specified field can be a string, or an array of string values that * designate multiple fields to sort on in order of precedence. * * @param fieldName The item field by which to sort. This value can be a string * or an array of string values. * * @param options Options for sorting. * * @return The return value depends on whether the method receives any arguments. * For more information, see the <code>Array.sortOn()</code> method. * If the <code>sortOption</code> property is set to <code>Array.UNIQUESORT</code>, * this method returns 0. * * @see #sort() * @see Array#sortOn() Array.sortOn() * * @internal If an array of string values is passed, does the sort take place in * the order that the string values are specified? Also, it might be helpful if "options * for sorting" was more explicit. I wondered if that meant sort type, like merge sort * or bubble sort, for example, but when I looked up "uniquesort" it seemed like not. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function sortOn(fieldName:Object,options:Object=null):* { dispatchPreChangeEvent(DataChangeType.SORT,data.concat(),0,data.length-1); var returnValue:Array = data.sortOn(fieldName,options); dispatchChangeEvent(DataChangeType.SORT,data.concat(),0,data.length-1); return returnValue; } /** * Creates a copy of the current DataProvider object. * * @return A new instance of this DataProvider object. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function clone():DataProvider { return new DataProvider(data); } /** * Creates an Array object representation of the data that the data provider contains. * * @return An Array object representation of the data that the data provider contains. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ public function toArray():Array { return data.concat(); } /** * Creates a string representation of the data that the data provider contains. * * @return A string representation of the data that the data provider contains. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 * * @playerversion AIR 1.0 * @productversion Flash CS3 */ override public function toString():String { return "DataProvider ["+data.join(" , ")+"]"; } /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function getDataFromObject(obj:Object):Array { var retArr:Array; if (obj is Array) { var arr:Array = obj as Array; if (arr.length > 0) { if (arr[0] is String || arr[0] is Number) { retArr = []; // convert to object array. for (var i:uint = 0; i < arr.length; i++) { var o:Object = {label:String(arr[i]),data:arr[i]} retArr.push(o); } return retArr; } } return obj.concat(); } else if (obj is DataProvider) { return obj.toArray(); } else if (obj is XML) { var xml:XML = obj as XML; retArr = []; var nodes:XMLList = xml.*; for each (var node:XML in nodes) { obj = {}; var attrs:XMLList = node.attributes(); for each (var attr:XML in attrs) { obj[attr.localName()] = attr.toString(); } var propNodes:XMLList = node.*; for each (var propNode:XML in propNodes) { if (propNode.hasSimpleContent()) { obj[propNode.localName()] = propNode.toString(); } } retArr.push(obj); } return retArr; } else { throw new TypeError("Error: Type Coercion failed: cannot convert "+obj+" to Array or DataProvider."); return null; } } /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function checkIndex(index:int,maximum:int):void { if (index > maximum || index < 0) { throw new RangeError("DataProvider index ("+index+") is not in acceptable range (0 - "+maximum+")"); } } /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function dispatchChangeEvent(evtType:String,items:Array,startIndex:int,endIndex:int):void { dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE,evtType,items,startIndex,endIndex)); } /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function dispatchPreChangeEvent(evtType:String, items:Array, startIndex:int, endIndex:int):void { dispatchEvent(new DataChangeEvent(DataChangeEvent.PRE_DATA_CHANGE, evtType, items, startIndex, endIndex)); } } }
package portrayal.symbol { import dataTypes.spatialGeometry.Coordinate2; import flash.display.Sprite; public class Cross extends Sprite { /* This class is uesd at GeometryWindow as a marker of the mouse cursor. */ public var center:Coordinate2; public var size:Number; public var color:uint; public function Cross(_crd:Coordinate2, _size:Number, _color:uint = 0x000000) { super(); center = _crd; size = _size; color = _color; var p0:Coordinate2 = new Coordinate2(); var p1:Coordinate2 = new Coordinate2(); p0.x = center.x - size * 0.5; p0.y = center.y - size * 0.5; p1.x = center.x + size * 0.5; p1.y = center.y + size * 0.5; this.graphics.lineStyle(1,color); this.graphics.moveTo(p0.x, center.y); this.graphics.lineTo(p1.x, center.y); this.graphics.moveTo(center.x, p0.y); this.graphics.lineTo(center.x, p1.y); this.name = "cross"; } } }
//////////////////////////////////////////////////////////////////////////////// // // 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.rpc.xml { [ExcludeClass] /** * This internal utility class is used by XMLDecoder, to store some properties * relevant to the current context, such as which is the current element from * an XMLList of values, which elements were deserialized by <any> definitions, etc. * * @private */ public class DecodingContext { public function DecodingContext() {} public var index:int = 0; public var hasContextSiblings:Boolean = false; public var anyIndex:int = -1; public var laxSequence:Boolean = false; } }
package kabam.rotmg.classes.control { import org.osflash.signals.Signal; public class ParseClassesXMLSignal extends Signal { public function ParseClassesXMLSignal() { super(XML); } } }
/* Copyright aswing.org, see the LICENCE.txt. */ package devoron.aswing3d.plaf.basic.icon{ import devoron.aswing3d.*; import org.aswing.geom.*; import org.aswing.graphics.*; /** * The icon for frame maximize. * @author iiley * @private */ public class FrameMaximizeIcon extends FrameIcon{ public function FrameMaximizeIcon(){ super(); } override public function updateIconImp(c:StyleResult, g:Graphics2D, x:int, y:int):void{ var gap:int = 4; x = x+gap; y = y+gap; var w:int = width -1 - gap*2; var h:int = height - 1 - gap*2 - 2; g.fillRectangle(new SolidBrush(c.bdark), x, y, w, 1); var darkBrush:SolidBrush = new SolidBrush(c.bdark); g.fillRectangle(darkBrush, x, y+1, w, 1); g.fillRectangleRingWithThickness(darkBrush, x, y+2, w, h, 1); } } }
/** * --------------------------------------------------------------------------- * Copyright (C) 2008 0x6e6562 * * 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.amqp.error { import flash.events.ErrorEvent; public class ConnectionError extends ErrorEvent { public static const CONNECTION_ERROR:String = "connectionError"; public const message:String = "Connection failed"; public function ConnectionError() { super(CONNECTION_ERROR, false, false, message); } } }
/** * DATA STRUCTURES FOR GAME PROGRAMMERS * Copyright (c) 2007 Michael Baczynski, http://www.polygonal.de * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package de.polygonal.ds.sort.compare { public function compareStringCaseInSensitive(a:String, b:String):int { a = a.toLowerCase(); b = b.toLowerCase(); if (a.length + b.length > 2) { var r:int = 0; var k:int = a.length > b.length ? a.length : b.length; for (var i:int = 0; i < k; i++) { r = a.charCodeAt(i) - b.charCodeAt(i); if (r != 0) break; } return r; } else return a.charCodeAt(0) - b.charCodeAt(0); } }
package utils.conversion { /** Converts minutes to days. @param minutes: The number of minutes. @return Returns the number of days. */ public function minutesToDays(minutes:Number):Number { return hoursToDays(minutesToHours(minutes)); } }
package away3d.filters { import away3d.cameras.Camera3D; import away3d.core.managers.Stage3DProxy; import away3d.filters.tasks.Filter3DTaskBase; import flash.display3D.textures.Texture; public class Filter3DBase { private var _tasks:Vector.<Filter3DTaskBase>; private var _requireDepthRender:Boolean; private var _textureWidth:int; private var _textureHeight:int; public function Filter3DBase() { _tasks = new Vector.<Filter3DTaskBase>(); } public function get requireDepthRender():Boolean { return _requireDepthRender; } protected function addTask(filter:Filter3DTaskBase):void { _tasks.push(filter); _requireDepthRender ||= filter.requireDepthRender; } public function get tasks():Vector.<Filter3DTaskBase> { return _tasks; } public function getMainInputTexture(stage3DProxy:Stage3DProxy):Texture { return _tasks[0].getMainInputTexture(stage3DProxy); } public function get textureWidth():int { return _textureWidth; } public function set textureWidth(value:int):void { _textureWidth = value; for (var i:int = 0; i < _tasks.length; ++i) _tasks[i].textureWidth = value; } public function get textureHeight():int { return _textureHeight; } public function set textureHeight(value:int):void { _textureHeight = value; for (var i:int = 0; i < _tasks.length; ++i) _tasks[i].textureHeight = value; } // link up the filters correctly with the next filter public function setRenderTargets(mainTarget:Texture, stage3DProxy:Stage3DProxy):void { _tasks[_tasks.length - 1].target = mainTarget; } public function dispose():void { for (var i:int = 0; i < _tasks.length; ++i) _tasks[i].dispose(); } public function update(stage:Stage3DProxy, camera:Camera3D):void { } } }
// Include the shared code #include 'shared.as' // This script implements the logic for the zombie class CZombie : IController { // The constructor must take a CGameObj handle as input, // this is the object that the script will control CZombie(CGameObj @obj) { // Keep the owner for later reference @self = obj; direction = UP; } void OnThink() { // Check if we already have a reference to the player const CGameObj @player = playerRef; if( player is null ) { @player = game.FindObjByName('player'); // Keep a weak ref to the player so we don't keep the object alive unnecessarily @playerRef = player; } // The zombie can either turn, move forward, or hit. // It cannot do more than one of these, otherwise the // player will not have any advantage. int dx = 0, dy = 0; switch( direction ) { case UP: if( player.y < self.y ) dy--; else if( player.x < self.x ) direction--; else direction++; break; case RIGHT: if( player.x > self.x ) dx++; else if( player.y < self.y ) direction--; else direction++; break; case DOWN: if( player.y > self.y ) dy++; else if( player.x > self.x ) direction--; else direction++; break; case LEFT: if( player.x < self.x ) dx--; else if( player.y > self.y ) direction--; else direction++; break; } if( direction < 0 ) direction += 4; if( direction > 3 ) direction -= 4; if( dx != 0 || dy != 0 ) { if( !self.Move(dx,dy) ) { // It wasn't possible to move there. // Was the player in front of us? if( player.x == self.x + dx && player.y == self.y + dy ) { // Hit the player self.Send(CMessage('Attack'), player); } else { // It was a stone. Turn towards the player switch( direction ) { case UP: if( player.x < self.x ) direction--; else direction++; break; case RIGHT: if( player.y < self.y ) direction--; else direction++; break; case DOWN: if( player.x > self.x ) direction--; else direction++; break; case LEFT: if( player.y > self.y ) direction--; else direction++; break; } if( direction < 0 ) direction += 4; if( direction > 3 ) direction -= 4; } } } } CGameObj @self; const_weakref<CGameObj> playerRef; int direction; } enum EDirection { UP, RIGHT, DOWN, LEFT }
package avmplus { import flash.utils.ByteArray [native(cls="SystemClass")] public class System { // private native static function getArgv():Array; // public static const argv:Array = getArgv(); public native static function get swfVersion():int; public native static function get apiVersion():int; public native static function getRunmode():String } }
package com.illuzor.otherside { import com.illuzor.otherside.controllers.AppController; import starling.display.Sprite; import starling.events.Event; /** * ... * @author illuzor // illuzor.com */ public final class Game extends Sprite { public function Game() { addEventListener(Event.ADDED_TO_STAGE, onAdded); } private function onAdded(e:Event):void { removeEventListener(Event.ADDED_TO_STAGE, onAdded); AppController.setContainer(this); } } }
package flare.vis.operator.distortion { import flash.geom.Rectangle; /** * Computes a bifocal distortion of space, magnifying a focus region of space * and uniformly demagnifying the rest of the space. The affect is akin to * passing a magnifying glass over the data. * * <p> * For more details on this form of transformation, see Y. K. Leung and * M. D. Apperley, "A Review and Taxonomy of Distortion-Oriented Presentation * Techniques", in Transactions of Computer-Human Interaction (TOCHI), * 1(2): 126-160 (1994). Available online at * <a href="portal.acm.org/citation.cfm?id=180173&dl=ACM"> * portal.acm.org/citation.cfm?id=180173&dl=ACM</a>. * </p> */ public class BifocalDistortion extends Distortion { private var _rx:Number; private var _mx:Number; private var _ry:Number; private var _my:Number; /** * <p>Create a new BifocalDistortion with the specified range and * magnification along both axes.</p> * * <p><strong>NOTE:</strong>if the range value times the magnification * value is greater than 1, the resulting distortion can exceed the * display bounds.</p> * * @param xrange the range around the focus that should be magnified along * the x direction. This specifies the horizontal size of the magnified * focus region, and should be a value between 0 and 1, 0 indicating no * focus region and 1 indicating the whole display. * @param xmag how much magnification along the x direction should be used * in the focal area * @param yrange the range around the focus that should be magnified along * the y direction. This specifies the vertical size of the magnified * focus region, and should be a value between 0 and 1, 0 indicating no * focus region and 1 indicating the whole display. * @param ymag how much magnification along the y direction should be used * in the focal area */ public function BifocalDistortion(xRange:Number=0.1, xMagnify:Number=3, yRange:Number=0.1, yMagnify:Number=3) { _rx = xRange; _mx = xMagnify; _ry = yRange; _my = yMagnify; distortX = !(_rx == 0 || _mx == 1.0); distortY = !(_ry == 0 || _my == 1.0); } /** @inheritDoc */ protected override function xDistort(x:Number):Number { return bifocal(x, layoutAnchor.x, _rx, _mx, _b.left, _b.right); } /** @inheritDoc */ protected override function yDistort(y:Number):Number { return bifocal(y, layoutAnchor.y, _ry, _my, _b.top, _b.bottom); } /** @inheritDoc */ protected override function sizeDistort(bb:Rectangle, x:Number, y:Number):Number { var xmag:Boolean = false, ymag:Boolean = false; var m:Number, c:Number, a:Number, min:Number, max:Number; if (distortX) { c = (bb.left+bb.right)/2; a = layoutAnchor.x; min = _b.left; max = _b.right; m = c<a ? a-min : max-a; if (m == 0) m = max-min; xmag = (Math.abs(c-a) <= _rx*m ) } if (distortY) { c = (bb.top+bb.bottom)/2; a = layoutAnchor.y; min = _b.top; max = _b.bottom; m = c<a ? a-min : max-a; if (m == 0) m = max-min; ymag = (Math.abs(c-a) <= _ry*m); } if (xmag && !distortY) { return _mx; } else if (ymag && !distortX) { return _my; } else if (xmag && ymag) { return Math.min(_mx, _my); } else { return Math.min((1-_rx*_mx)/(1-_rx), (1-_ry*_my)/(1-_ry)); } } private function bifocal(x:Number, a:Number, r:Number, mag:Number, min:Number, max:Number):Number { var m:Number, v:Number, s:Number, bx:Number; m = (x<a ? a-min : max-a); if ( m == 0 ) m = max-min; v = x - a, s = m*r; if ( Math.abs(v) <= s ) { // in focus return v*mag + a; } else { // out of focus bx = r*mag; x = ((Math.abs(v)-s) / m) * ((1-bx)/(1-r)); return (v<0?-1:1)*m*(x + bx) + a; } } } // end of class BifocalDistortion }
package { import feathers.examples.displayObjects.Main; import flash.display.Loader; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageOrientation; import flash.display.StageScaleMode; import flash.display3D.Context3DProfile; import flash.display3D.Context3DRenderMode; import flash.events.Event; import flash.filesystem.File; import flash.filesystem.FileMode; import flash.filesystem.FileStream; import flash.geom.Rectangle; import flash.system.Capabilities; import flash.utils.ByteArray; import starling.core.Starling; [SWF(width="640",height="960",frameRate="60",backgroundColor="#4a4137")] public class DisplayObjectExplorer extends Sprite { public function DisplayObjectExplorer() { if(this.stage) { this.stage.scaleMode = StageScaleMode.NO_SCALE; this.stage.align = StageAlign.TOP_LEFT; } this.mouseEnabled = this.mouseChildren = false; this.showLaunchImage(); this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfo_completeHandler); } private var _starling:Starling; private var _launchImage:Loader; private var _savedAutoOrients:Boolean; private function showLaunchImage():void { var filePath:String; var isPortraitOnly:Boolean = false; if(Capabilities.manufacturer.indexOf("iOS") >= 0) { var isCurrentlyPortrait:Boolean = this.stage.orientation == StageOrientation.DEFAULT || this.stage.orientation == StageOrientation.UPSIDE_DOWN; if(Capabilities.screenResolutionX == 1242 && Capabilities.screenResolutionY == 2208) { //iphone 6 plus filePath = isCurrentlyPortrait ? "Default-414w-736h@3x.png" : "Default-414w-736h-Landscape@3x.png"; } else if(Capabilities.screenResolutionX == 1536 && Capabilities.screenResolutionY == 2048) { //ipad retina filePath = isCurrentlyPortrait ? "Default-Portrait@2x.png" : "Default-Landscape@2x.png"; } else if(Capabilities.screenResolutionX == 768 && Capabilities.screenResolutionY == 1024) { //ipad classic filePath = isCurrentlyPortrait ? "Default-Portrait.png" : "Default-Landscape.png"; } else if(Capabilities.screenResolutionX == 750) { //iphone 6 isPortraitOnly = true; filePath = "Default-375w-667h@2x.png"; } else if(Capabilities.screenResolutionX == 640) { //iphone retina isPortraitOnly = true; if(Capabilities.screenResolutionY == 1136) { filePath = "Default-568h@2x.png"; } else { filePath = "Default@2x.png"; } } else if(Capabilities.screenResolutionX == 320) { //iphone classic isPortraitOnly = true; filePath = "Default.png"; } } if(filePath) { var file:File = File.applicationDirectory.resolvePath(filePath); if(file.exists) { var bytes:ByteArray = new ByteArray(); var stream:FileStream = new FileStream(); stream.open(file, FileMode.READ); stream.readBytes(bytes, 0, stream.bytesAvailable); stream.close(); this._launchImage = new Loader(); this._launchImage.loadBytes(bytes); this.addChild(this._launchImage); this._savedAutoOrients = this.stage.autoOrients; this.stage.autoOrients = false; if(isPortraitOnly) { this.stage.setOrientation(StageOrientation.DEFAULT); } } } } private function loaderInfo_completeHandler(event:Event):void { Starling.handleLostContext = true; Starling.multitouchEnabled = true; this._starling = new Starling(Main, this.stage, null, null, Context3DRenderMode.AUTO, Context3DProfile.BASELINE); this._starling.enableErrorChecking = false; //this._starling.showStats = true; this._starling.start(); if(this._launchImage) { this._starling.addEventListener("rootCreated", starling_rootCreatedHandler); } this.stage.addEventListener(Event.RESIZE, stage_resizeHandler, false, int.MAX_VALUE, true); this.stage.addEventListener(Event.DEACTIVATE, stage_deactivateHandler, false, 0, true); } private function starling_rootCreatedHandler(event:Object):void { if(this._launchImage) { this.removeChild(this._launchImage); this._launchImage.unloadAndStop(true); this._launchImage = null; this.stage.autoOrients = this._savedAutoOrients; } } private function stage_resizeHandler(event:Event):void { this._starling.stage.stageWidth = this.stage.stageWidth; this._starling.stage.stageHeight = this.stage.stageHeight; var viewPort:Rectangle = this._starling.viewPort; viewPort.width = this.stage.stageWidth; viewPort.height = this.stage.stageHeight; try { this._starling.viewPort = viewPort; } catch(error:Error) {} } private function stage_deactivateHandler(event:Event):void { this._starling.stop(true); this.stage.addEventListener(Event.ACTIVATE, stage_activateHandler, false, 0, true); } private function stage_activateHandler(event:Event):void { this.stage.removeEventListener(Event.ACTIVATE, stage_activateHandler); this._starling.start(); } } }
package com.d5power.net.httpd { import flash.net.Socket; import flash.utils.ByteArray; public class HttpResponse extends ByteArray { private var socket:Socket; public var header:Object={}; public var statusCode:int=200; public var contentType:String="text/html"; public function HttpResponse(socket:Socket) { this.socket=socket; } /** * get status code * @param code */ private function get_status_name(code:uint):String{ var text:String="OK"; switch(code){ case 200: text="OK"; break; case 403: text="Forbidden"; break; case 404: text="Not Found"; break; case 500: default: text="Internal Server Error"; break; } return code+" "+text; } /** * get contentType by request file extendsion. * @param extension File extension,WITHOUT '.' * @return */ public function set_content_type(extension:String=""):String{ extension=extension ? extension.toLowerCase() : 'html'; switch(extension){ case "xml": case "xquery": case "xq": case "xsl": case "xql": case "xsd": case "xslt": extension="text/xml"; break; case "xls": extension="application/x-xls"; break; case "css": extension="text/css"; break; case "js": extension="text/javascript"; break; case "txt": case "log": extension="text/plain"; break; case "html": case "htm": case "htx": case "jsp": case "php": case "stm": case "xhtml": extension="text/html"; break; case "tif": extension="image/tiff"; break; case "gif": extension="image/gif"; break; case "png": extension="image/png"; break; case "jpg": case "jpeg": case "jfif": case "jpe": extension="image/jpeg"; break; default: extension="application/octet-stream"; break; } contentType = extension; return extension; } /** * Output content */ public function flush():void{ if(socket.connected){ socket.writeUTFBytes("HTTP/1.1 "+get_status_name(statusCode)+"\r\n"); socket.writeUTFBytes("Content-Type: "+contentType+"\r\n"); socket.writeUTFBytes("Content-Length:"+this.length+"\r\n"); for(var i:Object in header) socket.writeUTFBytes(i+": "+String(header[i])+"\r\n"); socket.writeUTFBytes("\r\n"); socket.writeBytes(this,0,this.length); socket.flush(); socket.close(); this.clear(); } } } }
package zenith.commons { import robotlegs.bender.extensions.contextView.ContextView; import robotlegs.bender.extensions.eventCommandMap.api.IEventCommandMap; import robotlegs.bender.extensions.mediatorMap.api.IMediatorMap; import robotlegs.bender.extensions.signalCommandMap.api.ISignalCommandMap; import robotlegs.bender.framework.api.IConfig; import robotlegs.bender.framework.api.IInjector; import starling.core.Starling; public class Config implements IConfig { [Inject] public var injector:IInjector; [Inject] public var mediatorMap:IMediatorMap; [Inject] public var commandMap:IEventCommandMap; [Inject] public var contextView:ContextView; [Inject] public var signalCommandMap:ISignalCommandMap; [Inject] public var starling:Starling; public function configure():void { } } }
package com.rails2u.utils { import flash.external.ExternalInterface; import flash.utils.describeType; import com.rails2u.bridge.JSProxy; public class JSUtil { public static function attachCallbacks(target:*):void { if (!ExternalInterface.available) return; var res:XMLList = describeType(target).method. (String(attribute('uri')) == js_callback.uri); for each (var n:* in res) { var method:String = n.@name.toString(); ExternalInterface.addCallback(method, target.js_callback::[method]); } } public static function getObjectID():String { return ExternalInterface.objectID; } public static function selfCallJS(cmd:String, ...args):* { cmd = "return document.getElementById('" + getObjectID() + "')." + cmd; return callJS.apply(null, [cmd].concat(args)); } public static function callJS(cmd:String, ...args):* { if (!ExternalInterface.available) return null; if (args.length > 0) { cmd = "(function() {" + cmd + ".apply(null, arguments);})"; return ExternalInterface.call.apply(null, [cmd].concat(args)); } else { cmd = "(function() {" + cmd + ".call(null);})"; return ExternalInterface.call(cmd); } } public static function bindCallJS(bindName:String):Function { return function(cmd:String):* { return callJS(bindName + cmd); }; } public static function loadJS(src:String):void { var cmd:String = 'var s=document.createElement("script");s.charset="UTF-8";s.src="' + src + '";document.body.appendChild(s);'; cmd = "(function() {" + cmd + "})"; ExternalInterface.call(cmd); } public static function buildQueryString(hash:Object):String { var res:Array = []; for (var key:String in hash) { res.push(encodeURIComponent(key) + '=' + encodeURIComponent(hash[key])); } return res.join('&'); } public static function restoreQueryString(str:String):Object { var hash:Object = {}; var res:Array = str.replace(/^[#?]/, '').split('&'); for each(var s:String in res) { if (s.indexOf('=') > 0 && s.length >= 2) { var keyval:Array = s.split('=', 2); hash[keyval[0]] = keyval[1]; } } return hash; } } }
/* Copyright aswing.org, see the LICENCE.txt. */ import GUI.fox.aswing.AbstractButton; import GUI.fox.aswing.DefaultButtonModel; import GUI.fox.aswing.Icon; import GUI.fox.aswing.plaf.ButtonUI; import GUI.fox.aswing.UIManager; /** * An implementation of a "push" button. * @author iiley */ class GUI.fox.aswing.JButton extends AbstractButton{ /** * JButton(text:String, icon:Icon)<br> * JButton(text:String)<br> * JButton(icon:Icon) * <p> */ public function JButton(text, icon:Icon){ super(text, icon); setName("JButton"); setModel(new DefaultButtonModel()); updateUI(); } public function updateUI():Void{ setUI(ButtonUI(UIManager.getUI(this))); } public function getUIClassID():String{ return "ButtonUI"; } public function getDefaultBasicUIClass():Function{ return GUI.fox.aswing.plaf.asw.ASWingButtonUI; } }
package { import flash.events.Event; import flash.events.IOErrorEvent; import flash.net.*; import flash.external.ExternalInterface; import flash.system.fscommand; public class xmlLoaderCls { private var xmlLoader:URLLoader; private var xmlData:XML; private var requestUrl:URLRequest; private var returnObject:Object; public function xmlLoaderCls():void { this.xmlLoader = new URLLoader(); this.xmlData = new XML(); this.xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded); xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, onError); } public function loadXML(url:String, rObj:Object):void { this.returnObject = rObj; try { this.requestUrl = new URLRequest(url); this.xmlLoader.load(this.requestUrl); } catch (e:Error) { trace("XML loader could not load " + url) try { ExternalInterface.call("showAlert", "XML loader could not load " + url); } catch (e:Error) { } } } private function onError(e:IOErrorEvent):void { fscommand("quit"); } private function xmlLoaded(e:Event):void { this.xmlData = new XML(e.target.data); this.returnObject.xmlLoaded(this.xmlData); } } }
package com.wordnik.client.model { [XmlRootNode(name="Tag")] public class Tag { /* Unique identifier for the tag */ [XmlElement(name="id")] public var id: Number = 0.0; /* Friendly name for the tag */ [XmlElement(name="name")] public var name: String = null; public function toString(): String { var str: String = "Tag: "; str += " (id: " + id + ")"; str += " (name: " + name + ")"; return str; } } }
package utils.type { [ExcludeClass] const PACKAGE_CLASS_SEPARATOR:String = "::"; }
package kabam.rotmg.tooltips { import kabam.rotmg.core.signals.HideTooltipsSignal; import kabam.rotmg.core.signals.ShowTooltipSignal; public interface TooltipAble { function setShowToolTipSignal(_arg_1:ShowTooltipSignal):void; function getShowToolTip():ShowTooltipSignal; function setHideToolTipsSignal(_arg_1:HideTooltipsSignal):void; function getHideToolTips():HideTooltipsSignal; } }
package pl.brun.lib.managers { import flash.utils.getTimer; import pl.brun.lib.debugger.GlobalDbg; /** * @author Marek Brun */ public class CurrentTime { static private var instance:CurrentTime; private var currentTime:Number; private var lastGetTimer:Number; private var dateTmp:Date; public function CurrentTime(currentTime:Number) { setTime(currentTime) dateTmp = new Date() } public function setTime(currentTime:Number):void { this.currentTime = currentTime lastGetTimer = getTimer() } public static function time():Number { return instance.time_() } private function time_():Number { currentTime += getTimer() - lastGetTimer lastGetTimer = getTimer() dateTmp.time = currentTime GlobalDbg.d.logv(' time', dateTmp) return currentTime } static public function ins():CurrentTime { if (instance) { return instance; } else { throw new Error('Before call ServertimeProvider.getInstance() you should call ServertimeProvider.init()'); } } /** * @param currenttime - unixtime */ static public function init(currentTime:Number, updateToSys:Boolean = false):void { if (instance) { instance.setTime(currentTime) } else { instance = new CurrentTime(currentTime); } } } } internal class Private { }
/* * VERSION:3.0 * DATE:2014-10-15 * ACTIONSCRIPT VERSION: 3.0 * UPDATES AND DOCUMENTATION AT: http://www.wdmir.net * MAIL:mir3@163.com */ package net.wdqipai.client.extmodel { import net.wdmir.core.data.model.level1.IHallRoomModel; import net.wdmir.core.data.model.level1.IRuleModel; /** * 客户端独有的,根据服务器的xml创建 * * HallRoomModel适用于大量创建 * * 里面很少用 get 或 function 方法, * * 因为 var 比 function快4倍左右,本人亲测 */ public class HallRoomModelByDdz implements IHallRoomModel { /** * */ [Bindable] public var Id:int; /** * */ [Bindable] public var Name:String; /** * */ [Bindable] public var HasPeopleChairCount:int; /** * * */ [Bindable] public var HasPeopleChairCountStr:String; /** * * */ [Bindable] public var HasPeopleLookChairCountStr:String; /** * * */ [Bindable] public var DiFen:int; /** * * */ [Bindable] public var Carry:int; public function HallRoomModelByDdz(id:int, name:String, hasPeopleChairCount:int, hasPeopleLookChairCount:int, difen:int, carry:int) { this.Id = id; if("" == name) { //使用默认值 this.Name = "noname" + this.Id.toString(); } else { this.Name = name; } this.DiFen = difen; this.Carry = carry; this.HasPeopleChairCount = hasPeopleChairCount; this.HasPeopleChairCountStr = hasPeopleChairCount + "/" + rule.ChairCount; this.HasPeopleLookChairCountStr = hasPeopleLookChairCount.toString(); } public function getId():int { return this.Id; } public function getDiFen():int { return this.DiFen; } public function getCarry():int { return this.Carry; } } }
/* * Copyright 2018 Tallence AG * * 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.tallence.formeditor.studio.fields { import com.coremedia.ui.data.ValueExpression; public class CheckboxFieldBase extends FormEditorField { [Bindable] public var defaultValue:Boolean = false; [Bindable] public var boxLabel:String = null; public function CheckboxFieldBase(config:CheckboxField = null) { super(config); } override protected function initWithDefault(ve:ValueExpression):void { ve.setValue(defaultValue); } } }
package com.ankamagames.atouin.types { import com.ankamagames.jerakine.interfaces.ICustomUnicNameGetter; import com.ankamagames.jerakine.logger.Log; import com.ankamagames.jerakine.logger.Logger; import flash.display.Sprite; import flash.utils.getQualifiedClassName; public class GraphicCell extends Sprite implements ICustomUnicNameGetter { protected static const _log:Logger = Log.getLogger(getQualifiedClassName(GraphicCell)); private var _dropValidator:Function; private var _removeDropSource:Function; private var _processDrop:Function; private var _name:String; public var cellId:uint; private var _initialElevation:int = 0; public function GraphicCell(cellId:uint) { this._dropValidator = this.returnTrueFunction; this._removeDropSource = this.returnTrueFunction; this._processDrop = this.returnTrueFunction; super(); this.cellId = cellId; name = cellId.toString(); this._name = "cell::" + cellId; buttonMode = true; mouseChildren = false; cacheAsBitmap = true; } public function get customUnicName() : String { return this._name; } public function set dropValidator(dv:Function) : void { this._dropValidator = dv; } public function get dropValidator() : Function { return this._dropValidator; } public function set removeDropSource(rds:Function) : void { this._removeDropSource = rds; } public function get removeDropSource() : Function { return this._removeDropSource; } public function set processDrop(pd:Function) : void { this._processDrop = pd; } public function get processDrop() : Function { return this._processDrop; } public function set initialElevation(value:int) : void { this._initialElevation = value; } public function get initialElevation() : int { return this._initialElevation; } private function returnTrueFunction(... args) : Boolean { return true; } } }
// AngelCAD code. // Illustrate minkowski rounding of object with hole // resulting in rounding of outside and inside. shape@ main_shape() { double length = 25; double finger_pull_radius = 5; double thickness = 3; // create a hull from a cylinder and a cuboid solid@ h1 = hull3d( translate(length+finger_pull_radius, 0, 0)*cylinder(h:thickness, r:10,center:true) , cuboid(10,5,thickness,center:true) ); // create another cylinder to make the hole shape solid@ c1 = translate(length+finger_pull_radius, 0, 0)*cylinder(h:thickness+0.01,r:5,center:true); // subtract the hole and run minkowski on the result return minkowski3d(h1-c1,sphere(r:1)); } void main() { shape@ obj = main_shape(); obj.write_xcsg(GetInputFullPath(),secant_tolerance:-0.001); }
/* Feathers Copyright 2012-2021 Bowler Hat LLC. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.controls.supportClasses { import feathers.controls.DataGrid; import feathers.controls.Scroller; import feathers.controls.renderers.IDataGridCellRenderer; import feathers.controls.supportClasses.DataGridRowRenderer; import feathers.controls.supportClasses.IViewPort; import feathers.core.FeathersControl; import feathers.core.IFeathersControl; import feathers.core.IValidating; import feathers.data.IListCollection; import feathers.data.ListCollection; import feathers.events.CollectionEventType; import feathers.events.FeathersEventType; import feathers.layout.ILayout; import feathers.layout.IVariableVirtualLayout; import feathers.layout.IVirtualLayout; import feathers.layout.LayoutBoundsResult; import feathers.layout.ViewPortBounds; import flash.errors.IllegalOperationError; import flash.geom.Point; import flash.utils.Dictionary; import starling.display.DisplayObject; import starling.events.Event; import starling.utils.Pool; /** * @private * Used internally by DataGrid. Not meant to be used on its own. * * @see feathers.controls.DataGrid * * @productversion Feathers 3.4.0 */ public class DataGridDataViewPort extends FeathersControl implements IViewPort { private static const INVALIDATION_FLAG_ROW_RENDERER_FACTORY:String = "rowRendererFactory"; private static const HELPER_VECTOR:Vector.<int> = new <int>[]; public function DataGridDataViewPort() { super(); } private var _viewPortBounds:ViewPortBounds = new ViewPortBounds(); private var _layoutResult:LayoutBoundsResult = new LayoutBoundsResult(); private var _typicalRowIsInDataProvider:Boolean = false; private var _typicalRowRenderer:DataGridRowRenderer; private var _rows:Vector.<DisplayObject> = new <DisplayObject>[]; private var _rowRendererMap:Dictionary = new Dictionary(true); private var _unrenderedRows:Vector.<int> = new <int>[]; private var _rowStorage:RowRendererFactoryStorage = new RowRendererFactoryStorage(); private var _minimumRowCount:int = 0; private var _actualMinVisibleWidth:Number = 0; private var _explicitMinVisibleWidth:Number; public function get minVisibleWidth():Number { if(this._explicitMinVisibleWidth !== this._explicitMinVisibleWidth) //isNaN { return this._actualMinVisibleWidth; } return this._explicitMinVisibleWidth; } public function set minVisibleWidth(value:Number):void { if(this._explicitMinVisibleWidth == value) { return; } var valueIsNaN:Boolean = value !== value; //isNaN if(valueIsNaN && this._explicitMinVisibleWidth !== this._explicitMinVisibleWidth) //isNaN { return; } var oldValue:Number = this._explicitMinVisibleWidth; this._explicitMinVisibleWidth = value; if(valueIsNaN) { this._actualMinVisibleWidth = 0; this.invalidate(INVALIDATION_FLAG_SIZE); } else { this._actualMinVisibleWidth = value; if(this._explicitVisibleWidth !== this._explicitVisibleWidth && //isNaN (this._actualVisibleWidth < value || this._actualVisibleWidth == oldValue)) { //only invalidate if this change might affect the visibleWidth this.invalidate(INVALIDATION_FLAG_SIZE); } } } private var _maxVisibleWidth:Number = Number.POSITIVE_INFINITY; public function get maxVisibleWidth():Number { return this._maxVisibleWidth; } public function set maxVisibleWidth(value:Number):void { if(this._maxVisibleWidth == value) { return; } if(value !== value) //isNaN { throw new ArgumentError("maxVisibleWidth cannot be NaN"); } var oldValue:Number = this._maxVisibleWidth; this._maxVisibleWidth = value; if(this._explicitVisibleWidth !== this._explicitVisibleWidth && //isNaN (this._actualVisibleWidth > value || this._actualVisibleWidth == oldValue)) { //only invalidate if this change might affect the visibleWidth this.invalidate(INVALIDATION_FLAG_SIZE); } } private var _actualVisibleWidth:Number = 0; private var _explicitVisibleWidth:Number = NaN; public function get visibleWidth():Number { return this._actualVisibleWidth; } public function set visibleWidth(value:Number):void { if(this._explicitVisibleWidth == value || (value !== value && this._explicitVisibleWidth !== this._explicitVisibleWidth)) //isNaN { return; } this._explicitVisibleWidth = value; if(this._actualVisibleWidth != value) { this.invalidate(INVALIDATION_FLAG_SIZE); } } private var _actualMinVisibleHeight:Number = 0; private var _explicitMinVisibleHeight:Number; public function get minVisibleHeight():Number { if(this._explicitMinVisibleHeight !== this._explicitMinVisibleHeight) //isNaN { return this._actualMinVisibleHeight; } return this._explicitMinVisibleHeight; } public function set minVisibleHeight(value:Number):void { if(this._explicitMinVisibleHeight == value) { return; } var valueIsNaN:Boolean = value !== value; //isNaN if(valueIsNaN && this._explicitMinVisibleHeight !== this._explicitMinVisibleHeight) //isNaN { return; } var oldValue:Number = this._explicitMinVisibleHeight; this._explicitMinVisibleHeight = value; if(valueIsNaN) { this._actualMinVisibleHeight = 0; this.invalidate(INVALIDATION_FLAG_SIZE); } else { this._actualMinVisibleHeight = value; if(this._explicitVisibleHeight !== this._explicitVisibleHeight && //isNaN (this._actualVisibleHeight < value || this._actualVisibleHeight == oldValue)) { //only invalidate if this change might affect the visibleHeight this.invalidate(INVALIDATION_FLAG_SIZE); } } } private var _maxVisibleHeight:Number = Number.POSITIVE_INFINITY; public function get maxVisibleHeight():Number { return this._maxVisibleHeight; } public function set maxVisibleHeight(value:Number):void { if(this._maxVisibleHeight == value) { return; } if(value !== value) //isNaN { throw new ArgumentError("maxVisibleHeight cannot be NaN"); } var oldValue:Number = this._maxVisibleHeight; this._maxVisibleHeight = value; if(this._explicitVisibleHeight !== this._explicitVisibleHeight && //isNaN (this._actualVisibleHeight > value || this._actualVisibleHeight == oldValue)) { //only invalidate if this change might affect the visibleHeight this.invalidate(INVALIDATION_FLAG_SIZE); } } private var _actualVisibleHeight:Number = 0; private var _explicitVisibleHeight:Number = NaN; public function get visibleHeight():Number { return this._actualVisibleHeight; } public function set visibleHeight(value:Number):void { if(this._explicitVisibleHeight == value || (value !== value && this._explicitVisibleHeight !== this._explicitVisibleHeight)) //isNaN { return; } this._explicitVisibleHeight = value; if(this._actualVisibleHeight != value) { this.invalidate(INVALIDATION_FLAG_SIZE); } } protected var _contentX:Number = 0; public function get contentX():Number { return this._contentX; } protected var _contentY:Number = 0; public function get contentY():Number { return this._contentY; } private var _horizontalScrollPosition:Number = 0; public function get horizontalScrollPosition():Number { return this._horizontalScrollPosition; } public function set horizontalScrollPosition(value:Number):void { if(this._horizontalScrollPosition == value) { return; } this._horizontalScrollPosition = value; this.invalidate(INVALIDATION_FLAG_SCROLL); } private var _verticalScrollPosition:Number = 0; public function get verticalScrollPosition():Number { return this._verticalScrollPosition; } public function set verticalScrollPosition(value:Number):void { if(this._verticalScrollPosition == value) { return; } this._verticalScrollPosition = value; this.invalidate(INVALIDATION_FLAG_SCROLL); } public function get horizontalScrollStep():Number { var rowRenderer:DisplayObject = null; var virtualLayout:IVirtualLayout = this._layout as IVirtualLayout; if(virtualLayout === null || !virtualLayout.useVirtualLayout) { if(this._rows.length > 0) { rowRenderer = this._rows[0] as DisplayObject; } } if(rowRenderer === null) { rowRenderer = this._typicalRowRenderer as DisplayObject; } if(rowRenderer === null) { return 0; } var rowRendererWidth:Number = rowRenderer.width; var rowRendererHeight:Number = rowRenderer.height; if(rowRendererWidth < rowRendererHeight) { return rowRendererWidth; } return rowRendererHeight; } public function get verticalScrollStep():Number { var rowRenderer:DisplayObject = null; var virtualLayout:IVirtualLayout = this._layout as IVirtualLayout; if(virtualLayout === null || !virtualLayout.useVirtualLayout) { if(this._rows.length > 0) { rowRenderer = this._rows[0] as DisplayObject; } } if(rowRenderer === null) { rowRenderer = this._typicalRowRenderer as DisplayObject; } if(rowRenderer === null) { return 0; } var rowRendererWidth:Number = rowRenderer.width; var rowRendererHeight:Number = rowRenderer.height; if(rowRendererWidth < rowRendererHeight) { return rowRendererWidth; } return rowRendererHeight; } private var _owner:DataGrid = null; public function get owner():DataGrid { return this._owner; } public function set owner(value:DataGrid):void { this._owner = value; } private var _updateForDataReset:Boolean = false; private var _dataProvider:IListCollection = null; public function get dataProvider():IListCollection { return this._dataProvider; } public function set dataProvider(value:IListCollection):void { if(this._dataProvider == value) { return; } if(this._dataProvider) { this._dataProvider.removeEventListener(Event.CHANGE, dataProvider_changeHandler); this._dataProvider.removeEventListener(CollectionEventType.RESET, dataProvider_resetHandler); this._dataProvider.removeEventListener(CollectionEventType.FILTER_CHANGE, dataProvider_filterChangeHandler); this._dataProvider.removeEventListener(CollectionEventType.ADD_ITEM, dataProvider_addItemHandler); this._dataProvider.removeEventListener(CollectionEventType.REMOVE_ITEM, dataProvider_removeItemHandler); this._dataProvider.removeEventListener(CollectionEventType.REPLACE_ITEM, dataProvider_replaceItemHandler); this._dataProvider.removeEventListener(CollectionEventType.UPDATE_ITEM, dataProvider_updateItemHandler); this._dataProvider.removeEventListener(CollectionEventType.UPDATE_ALL, dataProvider_updateAllHandler); } this._dataProvider = value; if(this._dataProvider) { this._dataProvider.addEventListener(Event.CHANGE, dataProvider_changeHandler); this._dataProvider.addEventListener(CollectionEventType.RESET, dataProvider_resetHandler); this._dataProvider.addEventListener(CollectionEventType.FILTER_CHANGE, dataProvider_filterChangeHandler); this._dataProvider.addEventListener(CollectionEventType.ADD_ITEM, dataProvider_addItemHandler); this._dataProvider.addEventListener(CollectionEventType.REMOVE_ITEM, dataProvider_removeItemHandler); this._dataProvider.addEventListener(CollectionEventType.REPLACE_ITEM, dataProvider_replaceItemHandler); this._dataProvider.addEventListener(CollectionEventType.UPDATE_ITEM, dataProvider_updateItemHandler); this._dataProvider.addEventListener(CollectionEventType.UPDATE_ALL, dataProvider_updateAllHandler); } if(this._layout is IVariableVirtualLayout) { IVariableVirtualLayout(this._layout).resetVariableVirtualCache(); } this._updateForDataReset = true; this.invalidate(INVALIDATION_FLAG_DATA); } protected var _columns:IListCollection = null; public function get columns():IListCollection { return this._columns; } public function set columns(value:IListCollection):void { if(this._columns == value) { return; } if(this._columns) { this._columns.removeEventListener(Event.CHANGE, columns_changeHandler); } this._columns = value; if(this._columns) { this._columns.addEventListener(Event.CHANGE, columns_changeHandler); } this.invalidate(INVALIDATION_FLAG_DATA); } private var _ignoreLayoutChanges:Boolean = false; private var _ignoreRendererResizing:Boolean = false; private var _layout:ILayout = null; public function get layout():ILayout { return this._layout; } public function set layout(value:ILayout):void { if(this._layout == value) { return; } if(this._layout) { this._layout.removeEventListener(Event.CHANGE, layout_changeHandler); } this._layout = value; if(this._layout) { if(this._layout is IVariableVirtualLayout) { IVariableVirtualLayout(this._layout).resetVariableVirtualCache(); } this._layout.addEventListener(Event.CHANGE, layout_changeHandler); } this.invalidate(INVALIDATION_FLAG_LAYOUT); } private var _typicalItem:Object = null; public function get typicalItem():Object { return this._typicalItem; } public function set typicalItem(value:Object):void { if(this._typicalItem == value) { return; } this._typicalItem = value; this.invalidate(INVALIDATION_FLAG_DATA); } private var _customColumnSizes:Vector.<Number> = null; public function get customColumnSizes():Vector.<Number> { return this._customColumnSizes; } public function set customColumnSizes(value:Vector.<Number>):void { if(this._customColumnSizes === value) { return; } this._customColumnSizes = value; this.invalidate(INVALIDATION_FLAG_DATA); } private var _ignoreSelectionChanges:Boolean = false; private var _isSelectable:Boolean = true; public function get isSelectable():Boolean { return this._isSelectable; } public function set isSelectable(value:Boolean):void { if(this._isSelectable == value) { return; } this._isSelectable = value; if(!value) { this.selectedIndices = null; } } private var _allowMultipleSelection:Boolean = false; public function get allowMultipleSelection():Boolean { return this._allowMultipleSelection; } public function set allowMultipleSelection(value:Boolean):void { this._allowMultipleSelection = value; } private var _selectedIndices:ListCollection; public function get selectedIndices():ListCollection { return this._selectedIndices; } public function set selectedIndices(value:ListCollection):void { if(this._selectedIndices == value) { return; } if(this._selectedIndices) { this._selectedIndices.removeEventListener(Event.CHANGE, selectedIndices_changeHandler); } this._selectedIndices = value; if(this._selectedIndices) { this._selectedIndices.addEventListener(Event.CHANGE, selectedIndices_changeHandler); } this.invalidate(INVALIDATION_FLAG_SELECTED); } public function get requiresMeasurementOnScroll():Boolean { return this._layout.requiresLayoutOnScroll && (this._explicitVisibleWidth !== this._explicitVisibleWidth || //isNaN this._explicitVisibleHeight !== this._explicitVisibleHeight); //isNaN } public function calculateNavigationDestination(index:int, keyCode:uint):int { return this._layout.calculateNavigationDestination(this._rows, index, keyCode, this._layoutResult); } public function getScrollPositionForIndex(index:int, result:Point = null):Point { if(!result) { result = new Point(); } return this._layout.getScrollPositionForIndex(index, this._rows, 0, 0, this._actualVisibleWidth, this._actualVisibleHeight, result); } public function getNearestScrollPositionForIndex(index:int, result:Point = null):Point { if(!result) { result = new Point(); } return this._layout.getNearestScrollPositionForIndex(index, this._horizontalScrollPosition, this._verticalScrollPosition, this._rows, 0, 0, this._actualVisibleWidth, this._actualVisibleHeight, result); } public function itemToCellRenderer(item:Object, columnIndex:int):IDataGridCellRenderer { var rowRenderer:DataGridRowRenderer = this._rowRendererMap[item] as DataGridRowRenderer; if(rowRenderer === null) { return null; } return rowRenderer.getCellRendererForColumn(columnIndex); } override public function dispose():void { this.refreshInactiveRowRenderers(true); this.owner = null; this.layout = null; this.dataProvider = null; this.columns = null; super.dispose(); } override protected function draw():void { var dataInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_DATA); var scrollInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_SCROLL); var sizeInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_SIZE); var selectionInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_SELECTED); var rowRendererInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_ROW_RENDERER_FACTORY); var stylesInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_STYLES); var stateInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_STATE); var layoutInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_LAYOUT); //scrolling only affects the layout is requiresLayoutOnScroll is true if(!layoutInvalid && scrollInvalid && this._layout && this._layout.requiresLayoutOnScroll) { layoutInvalid = true; } var basicsInvalid:Boolean = sizeInvalid || dataInvalid || layoutInvalid || rowRendererInvalid; var oldIgnoreRendererResizing:Boolean = this._ignoreRendererResizing; this._ignoreRendererResizing = true; var oldIgnoreLayoutChanges:Boolean = this._ignoreLayoutChanges; this._ignoreLayoutChanges = true; if(scrollInvalid || sizeInvalid) { this.refreshViewPortBounds(); } if(basicsInvalid) { this.refreshInactiveRowRenderers(false); } if(dataInvalid || layoutInvalid || rowRendererInvalid) { this.refreshLayoutTypicalItem(); } if(basicsInvalid) { this.refreshRowRenderers(); } if(selectionInvalid || basicsInvalid) { //unlike resizing renderers and layout changes, we only want to //stop listening for selection changes when we're forcibly //updating selection. other property changes on item renderers //can validly change selection, and we need to detect that. var oldIgnoreSelectionChanges:Boolean = this._ignoreSelectionChanges; this._ignoreSelectionChanges = true; this.refreshSelection(); this._ignoreSelectionChanges = oldIgnoreSelectionChanges; } if(stateInvalid || basicsInvalid) { this.refreshEnabled(); } this._ignoreLayoutChanges = oldIgnoreLayoutChanges; if(stateInvalid || selectionInvalid || stylesInvalid || basicsInvalid) { this._layout.layout(this._rows, this._viewPortBounds, this._layoutResult); } this._ignoreRendererResizing = oldIgnoreRendererResizing; this._contentX = this._layoutResult.contentX; this._contentY = this._layoutResult.contentY; this.saveMeasurements(this._layoutResult.contentWidth, this._layoutResult.contentHeight, this._layoutResult.contentWidth, this._layoutResult.contentHeight); this._actualVisibleWidth = this._layoutResult.viewPortWidth; this._actualVisibleHeight = this._layoutResult.viewPortHeight; this._actualMinVisibleWidth = this._layoutResult.viewPortWidth; this._actualMinVisibleHeight = this._layoutResult.viewPortHeight; //final validation to avoid juggler next frame issues this.validateRowRenderers(); } private function refreshViewPortBounds():void { var needsMinWidth:Boolean = this._explicitMinVisibleWidth !== this._explicitMinVisibleWidth; //isNaN var needsMinHeight:Boolean = this._explicitMinVisibleHeight !== this._explicitMinVisibleHeight; //isNaN this._viewPortBounds.x = 0; this._viewPortBounds.y = 0; this._viewPortBounds.scrollX = this._horizontalScrollPosition; this._viewPortBounds.scrollY = this._verticalScrollPosition; this._viewPortBounds.explicitWidth = this._explicitVisibleWidth; this._viewPortBounds.explicitHeight = this._explicitVisibleHeight; if(needsMinWidth) { this._viewPortBounds.minWidth = 0; } else { this._viewPortBounds.minWidth = this._explicitMinVisibleWidth; } if(needsMinHeight) { this._viewPortBounds.minHeight = 0; } else { this._viewPortBounds.minHeight = this._explicitMinVisibleHeight; } this._viewPortBounds.maxWidth = this._maxVisibleWidth; this._viewPortBounds.maxHeight = this._maxVisibleHeight; } private function refreshInactiveRowRenderers(forceCleanup:Boolean):void { var temp:Vector.<DataGridRowRenderer> = this._rowStorage.inactiveRowRenderers; this._rowStorage.inactiveRowRenderers = this._rowStorage.activeRowRenderers; this._rowStorage.activeRowRenderers = temp; if(this._rowStorage.activeRowRenderers.length > 0) { throw new IllegalOperationError("DataGridDataViewPort: active row renderers should be empty."); } if(forceCleanup) { this.recoverInactiveRowRenderers(); this.freeInactiveRowRenderers(0); if(this._typicalRowRenderer !== null) { if(this._typicalRowIsInDataProvider) { delete this._rowRendererMap[this._typicalRowRenderer.data]; } this.destroyRowRenderer(this._typicalRowRenderer); this._typicalRowRenderer = null; this._typicalRowIsInDataProvider = false; } } this._rows.length = 0; } private function recoverInactiveRowRenderers():void { var inactiveRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.inactiveRowRenderers; var itemCount:int = inactiveRowRenderers.length; for(var i:int = 0; i < itemCount; i++) { var rowRenderer:DataGridRowRenderer = inactiveRowRenderers[i]; if(rowRenderer === null || rowRenderer.data === null) { continue; } this._owner.dispatchEventWith(FeathersEventType.RENDERER_REMOVE, false, rowRenderer); delete this._rowRendererMap[rowRenderer.data]; } } private function freeInactiveRowRenderers(minimumItemCount:int):void { var inactiveRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.inactiveRowRenderers; var activeRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.activeRowRenderers; var activeRowRenderersCount:int = activeRowRenderers.length; //we may keep around some extra renderers to avoid too much //allocation and garbage collection. they'll be hidden. var itemCount:int = inactiveRowRenderers.length; var keepCount:int = minimumItemCount - activeRowRenderersCount; if(keepCount > itemCount) { keepCount = itemCount; } for(var i:int = 0; i < keepCount; i++) { var rowRenderer:DataGridRowRenderer = inactiveRowRenderers.shift(); if(rowRenderer === null) { keepCount++; if(itemCount < keepCount) { keepCount = itemCount; } continue; } rowRenderer.data = null; rowRenderer.columns = null; rowRenderer.index = -1; rowRenderer.visible = false; rowRenderer.customColumnSizes = null; activeRowRenderers[activeRowRenderersCount] = rowRenderer; activeRowRenderersCount++; } itemCount -= keepCount; for(i = 0; i < itemCount; i++) { rowRenderer = inactiveRowRenderers.shift(); if(rowRenderer === null) { continue; } this.destroyRowRenderer(rowRenderer); } } private function createRowRenderer(item:Object, rowIndex:int, useCache:Boolean, isTemporary:Boolean):DataGridRowRenderer { var inactiveRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.inactiveRowRenderers; var activeRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.activeRowRenderers; var rowRenderer:DataGridRowRenderer = null; do { if(!useCache || isTemporary || inactiveRowRenderers.length == 0) { rowRenderer = new DataGridRowRenderer(); this.addChild(DisplayObject(rowRenderer)); } else { rowRenderer = inactiveRowRenderers.shift(); } //wondering why this all is in a loop? //_inactiveRenderers.shift() may return null because we're //storing null values instead of calling splice() to improve //performance. } while(rowRenderer === null); rowRenderer.data = item; rowRenderer.columns = this._columns; rowRenderer.index = rowIndex; rowRenderer.owner = this._owner; rowRenderer.customColumnSizes = this._customColumnSizes; if(!isTemporary) { this._rowRendererMap[item] = rowRenderer; activeRowRenderers[activeRowRenderers.length] = rowRenderer; rowRenderer.addEventListener(Event.TRIGGERED, rowRenderer_triggeredHandler); rowRenderer.addEventListener(Event.CHANGE, rowRenderer_changeHandler); rowRenderer.addEventListener(FeathersEventType.RESIZE, rowRenderer_resizeHandler); this._owner.dispatchEventWith(FeathersEventType.RENDERER_ADD, false, rowRenderer); } return rowRenderer; } private function destroyRowRenderer(rowRenderer:DataGridRowRenderer):void { rowRenderer.removeEventListener(Event.TRIGGERED, rowRenderer_triggeredHandler); rowRenderer.removeEventListener(Event.CHANGE, rowRenderer_changeHandler); rowRenderer.removeEventListener(FeathersEventType.RESIZE, rowRenderer_resizeHandler); rowRenderer.data = null; rowRenderer.columns = null; rowRenderer.index = -1; this.removeChild(DisplayObject(rowRenderer), true); rowRenderer.owner = null; } private function refreshLayoutTypicalItem():void { var virtualLayout:IVirtualLayout = this._layout as IVirtualLayout; if(virtualLayout === null || !virtualLayout.useVirtualLayout) { //the old layout was virtual, but this one isn't if(!this._typicalRowIsInDataProvider && this._typicalRowRenderer !== null) { //it's safe to destroy this renderer this.destroyRowRenderer(this._typicalRowRenderer); this._typicalRowRenderer = null; } return; } var typicalItemIndex:int = 0; var newTypicalItemIsInDataProvider:Boolean = false; var typicalItem:Object = this._typicalItem; if(typicalItem !== null) { if(this._dataProvider !== null) { typicalItemIndex = this._dataProvider.getItemIndex(typicalItem); newTypicalItemIsInDataProvider = typicalItemIndex >= 0; } if(typicalItemIndex < 0) { typicalItemIndex = 0; } } else { if(this._dataProvider !== null && this._dataProvider.length > 0) { newTypicalItemIsInDataProvider = true; typicalItem = this._dataProvider.getItemAt(0); } } //#1645 The typicalItem can be null if the data provider contains //a null value at index 0. this is the only time we allow null. if(typicalItem !== null || newTypicalItemIsInDataProvider) { var typicalRenderer:DataGridRowRenderer = this._rowRendererMap[typicalItem] as DataGridRowRenderer; if(typicalRenderer !== null) { //at this point, the item already has a row renderer. //(this doesn't necessarily mean that the current typical //item was the typical item last time this function was //called) //the index may have changed if items were added, removed or //reordered in the data provider typicalRenderer.index = typicalItemIndex; } if(typicalRenderer === null && this._typicalRowRenderer !== null) { //the typical item has changed, and doesn't have a row //renderer yet. the previous typical item had a row //renderer, so we will try to reuse it. //we can reuse the existing typical row renderer if the old //typical item wasn't in the data provider. otherwise, it //may still be needed for the same item. var canReuse:Boolean = !this._typicalRowIsInDataProvider; var oldTypicalItemRemoved:Boolean = this._typicalRowIsInDataProvider && this._dataProvider && this._dataProvider.getItemIndex(this._typicalRowRenderer.data) < 0; if(!canReuse && oldTypicalItemRemoved) { //special case: if the old typical item was in the data //provider, but it has been removed, it's safe to reuse. canReuse = true; } if(canReuse) { //we can reuse the item renderer used for the old //typical item! //if the old typical item was in the data provider, //remove it from the renderer map. if(this._typicalRowIsInDataProvider) { delete this._rowRendererMap[this._typicalRowRenderer.data]; } typicalRenderer = this._typicalRowRenderer; typicalRenderer.data = typicalItem; typicalRenderer.index = typicalItemIndex; //if the new typical item is in the data provider, add it //to the renderer map. if(newTypicalItemIsInDataProvider) { this._rowRendererMap[typicalItem] = typicalRenderer; } } } if(typicalRenderer === null) { //if we still don't have a typical row renderer, we need to //create a new one. typicalRenderer = this.createRowRenderer(typicalItem, typicalItemIndex, false, !newTypicalItemIsInDataProvider); if(!this._typicalRowIsInDataProvider && this._typicalRowRenderer !== null) { //get rid of the old typical row renderer if it isn't //needed anymore. since it was not in the data //provider, we don't need to mess with the renderer map //dictionary or dispatch any events. this.destroyRowRenderer(this._typicalRowRenderer); this._typicalRowRenderer = null; } } } virtualLayout.typicalItem = DisplayObject(typicalRenderer); this._typicalRowRenderer = typicalRenderer; this._typicalRowIsInDataProvider = newTypicalItemIsInDataProvider; if(this._typicalRowRenderer !== null && !this._typicalRowIsInDataProvider) { //we need to know if this item renderer resizes to adjust the //layout because the layout may use this item renderer to resize //the other item renderers this._typicalRowRenderer.addEventListener(FeathersEventType.RESIZE, rowRenderer_resizeHandler); } } private function refreshRowRenderers():void { if(this._typicalRowRenderer !== null && this._typicalRowIsInDataProvider) { var inactiveRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.inactiveRowRenderers; var activeRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.activeRowRenderers; //this renderer is already is use by the typical item, so we //don't want to allow it to be used by other items. var inactiveIndex:int = inactiveRowRenderers.indexOf(this._typicalRowRenderer); if(inactiveIndex >= 0) { inactiveRowRenderers[inactiveIndex] = null; } //if refreshLayoutTypicalItem() was called, it will have already //added the typical row renderer to the active renderers. if //not, we need to do it here. var activeRendererCount:int = activeRowRenderers.length; if(activeRendererCount == 0) { activeRowRenderers[activeRendererCount] = this._typicalRowRenderer; } } this.findUnrenderedRowData(); this.recoverInactiveRowRenderers(); this.renderUnrenderedRowData(); this.freeInactiveRowRenderers(this._minimumRowCount); } private function findUnrenderedRowData():void { var itemCount:int = 0; if(this._dataProvider !== null) { itemCount = this._dataProvider.length; } var virtualLayout:IVirtualLayout = this._layout as IVirtualLayout; var useVirtualLayout:Boolean = virtualLayout && virtualLayout.useVirtualLayout; if(useVirtualLayout) { var point:Point = Pool.getPoint(); virtualLayout.measureViewPort(itemCount, this._viewPortBounds, point); virtualLayout.getVisibleIndicesAtScrollPosition(this._horizontalScrollPosition, this._verticalScrollPosition, point.x, point.y, itemCount, HELPER_VECTOR); Pool.putPoint(point); } this._rows.length = itemCount; var unrenderedItemCount:int = itemCount; if(useVirtualLayout) { unrenderedItemCount = HELPER_VECTOR.length; } if(useVirtualLayout && this._typicalRowIsInDataProvider && this._typicalRowRenderer && HELPER_VECTOR.indexOf(this._typicalRowRenderer.index) >= 0) { //add an extra item renderer if the typical item is from the //data provider and it is visible. this helps keep the number of //item renderers constant! this._minimumRowCount = unrenderedItemCount + 1; } else { this._minimumRowCount = unrenderedItemCount; } var unrenderedDataLastIndex:int = this._unrenderedRows.length; for(var i:int = 0; i < unrenderedItemCount; i++) { var index:int = i; if(useVirtualLayout) { index = HELPER_VECTOR[i]; } if(index < 0 || index >= itemCount) { continue; } var item:Object = this._dataProvider.getItemAt(index); var rowRenderer:DataGridRowRenderer = this._rowRendererMap[item] as DataGridRowRenderer; if(rowRenderer !== null) { //the index may have changed if items were added, removed or //reordered in the data provider rowRenderer.index = index; //if this row renderer used to be the typical row //renderer, but it isn't anymore, it may have been set invisible! rowRenderer.visible = true; rowRenderer.customColumnSizes = this._customColumnSizes; if(this._updateForDataReset) { //similar to calling updateItemAt(), replacing the data //provider or resetting its source means that we should //trick the item renderer into thinking it has new data. //many developers seem to expect this behavior, so while //it's not the most optimal for performance, it saves on //support time in the forums. thankfully, it's still //somewhat optimized since the same item renderer will //receive the same data, and the children generally //won't have changed much, if at all. rowRenderer.data = null; rowRenderer.data = item; } //the typical row renderer is a special case, and we will //have already put it into the active renderers, so we don't //want to do it again! if(this._typicalRowRenderer !== rowRenderer) { var activeRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.activeRowRenderers; var inactiveRowRenderers:Vector.<DataGridRowRenderer> = this._rowStorage.inactiveRowRenderers; activeRowRenderers[activeRowRenderers.length] = rowRenderer; var inactiveIndex:int = inactiveRowRenderers.indexOf(rowRenderer); if(inactiveIndex >= 0) { inactiveRowRenderers[inactiveIndex] = null; } else { throw new IllegalOperationError("DataGridDataViewPort: row renderer map contains bad data. This may be caused by duplicate items in the data provider, which is not allowed."); } } this._rows[index] = DisplayObject(rowRenderer); } else { this._unrenderedRows[unrenderedDataLastIndex] = index; unrenderedDataLastIndex++; } } //update the typical row renderer's visibility if(this._typicalRowRenderer !== null) { if(useVirtualLayout && this._typicalRowIsInDataProvider) { index = HELPER_VECTOR.indexOf(this._typicalRowRenderer.index); if(index >= 0) { this._typicalRowRenderer.visible = true; } else { this._typicalRowRenderer.visible = false; //uncomment these lines to see a hidden typical row for //debugging purposes... /*this._typicalRowRenderer.visible = true; this._typicalRowRenderer.x = this._horizontalScrollPosition; this._typicalRowRenderer.y = this._verticalScrollPosition;*/ } } else { this._typicalRowRenderer.visible = this._typicalRowIsInDataProvider; } } HELPER_VECTOR.length = 0; } private function renderUnrenderedRowData():void { var rowRendererCount:int = this._unrenderedRows.length; for(var i:int = 0; i < rowRendererCount; i++) { var rowIndex:int = this._unrenderedRows.shift(); var item:Object = this._dataProvider.getItemAt(rowIndex); var rowRenderer:DataGridRowRenderer = this.createRowRenderer( item, rowIndex, true, false); rowRenderer.visible = true; this._rows[rowIndex] = DisplayObject(rowRenderer); } } private function refreshSelection():void { var itemCount:int = this._rows.length; for(var i:int = 0; i < itemCount; i++) { var rowRenderer:DataGridRowRenderer = this._rows[i] as DataGridRowRenderer; if(rowRenderer !== null) { rowRenderer.isSelected = this._selectedIndices.getItemIndex(rowRenderer.index) >= 0; } } } private function refreshEnabled():void { var itemCount:int = this._rows.length; for(var i:int = 0; i < itemCount; i++) { var control:IFeathersControl = this._rows[i] as IFeathersControl; if(control !== null) { control.isEnabled = this._isEnabled; } } } private function validateRowRenderers():void { var itemCount:int = this._rows.length; for(var i:int = 0; i < itemCount; i++) { var item:IValidating = this._rows[i] as IValidating; if(item !== null) { item.validate(); } } } private function invalidateParent(flag:String = INVALIDATION_FLAG_ALL):void { Scroller(this.parent).invalidate(flag); } private function columns_changeHandler(event:Event):void { this.invalidate(INVALIDATION_FLAG_DATA); } private function dataProvider_changeHandler(event:Event):void { this.invalidate(INVALIDATION_FLAG_DATA); } private function dataProvider_addItemHandler(event:Event, index:int):void { var layout:IVariableVirtualLayout = this._layout as IVariableVirtualLayout; if(!layout || !layout.hasVariableItemDimensions) { return; } layout.addToVariableVirtualCacheAtIndex(index); } private function dataProvider_removeItemHandler(event:Event, index:int):void { var layout:IVariableVirtualLayout = this._layout as IVariableVirtualLayout; if(!layout || !layout.hasVariableItemDimensions) { return; } layout.removeFromVariableVirtualCacheAtIndex(index); } private function dataProvider_replaceItemHandler(event:Event, index:int):void { var layout:IVariableVirtualLayout = this._layout as IVariableVirtualLayout; if(!layout || !layout.hasVariableItemDimensions) { return; } layout.resetVariableVirtualCacheAtIndex(index); } private function dataProvider_resetHandler(event:Event):void { this._updateForDataReset = true; var layout:IVariableVirtualLayout = this._layout as IVariableVirtualLayout; if(!layout || !layout.hasVariableItemDimensions) { return; } layout.resetVariableVirtualCache(); } private function dataProvider_filterChangeHandler(event:Event):void { var layout:IVariableVirtualLayout = this._layout as IVariableVirtualLayout; if(!layout || !layout.hasVariableItemDimensions) { return; } //we don't know exactly which indices have changed, so reset the //whole cache. layout.resetVariableVirtualCache(); } private function dataProvider_updateItemHandler(event:Event, index:int):void { var item:Object = this._dataProvider.getItemAt(index); var rowRenderer:DataGridRowRenderer = this._rowRendererMap[item] as DataGridRowRenderer; if(rowRenderer === null) { return; } //in order to display the same item with modified properties, this //hack tricks the item renderer into thinking that it has been given //a different item to render. rowRenderer.data = null; rowRenderer.data = item; if(this._explicitVisibleWidth !== this._explicitVisibleWidth || //isNaN this._explicitVisibleHeight !== this._explicitVisibleHeight) //isNaN { this.invalidate(INVALIDATION_FLAG_SIZE); this.invalidateParent(INVALIDATION_FLAG_SIZE); } } private function dataProvider_updateAllHandler(event:Event):void { //we're treating this similar to the RESET event because enough //users are treating UPDATE_ALL similarly. technically, UPDATE_ALL //is supposed to affect only existing items, but it's confusing when //new items are added and not displayed. this._updateForDataReset = true; this.invalidate(INVALIDATION_FLAG_DATA); var layout:IVariableVirtualLayout = this._layout as IVariableVirtualLayout; if(!layout || !layout.hasVariableItemDimensions) { return; } layout.resetVariableVirtualCache(); } private function rowRenderer_triggeredHandler(event:Event):void { var rowRenderer:DataGridRowRenderer = DataGridRowRenderer(event.currentTarget); this.parent.dispatchEventWith(Event.TRIGGERED, false, rowRenderer.data); } private function rowRenderer_changeHandler(event:Event):void { if(this._ignoreSelectionChanges) { return; } var rowRenderer:DataGridRowRenderer = DataGridRowRenderer(event.currentTarget); if(!this._isSelectable || this._owner.isScrolling) { rowRenderer.isSelected = false; return; } var isSelected:Boolean = rowRenderer.isSelected; var index:int = rowRenderer.index; if(this._allowMultipleSelection) { var indexOfIndex:int = this._selectedIndices.getItemIndex(index); if(isSelected && indexOfIndex < 0) { this._selectedIndices.addItem(index); } else if(!isSelected && indexOfIndex >= 0) { this._selectedIndices.removeItemAt(indexOfIndex); } } else if(isSelected) { this._selectedIndices.data = new <int>[index]; } else { this._selectedIndices.removeAll(); } } private function rowRenderer_resizeHandler(event:Event):void { if(this._ignoreRendererResizing) { return; } this.invalidate(INVALIDATION_FLAG_LAYOUT); this.invalidateParent(INVALIDATION_FLAG_LAYOUT); if(event.currentTarget === this._typicalRowRenderer && !this._typicalRowIsInDataProvider) { return; } var layout:IVariableVirtualLayout = this._layout as IVariableVirtualLayout; if(!layout || !layout.hasVariableItemDimensions) { return; } var rowRenderer:DataGridRowRenderer = DataGridRowRenderer(event.currentTarget); layout.resetVariableVirtualCacheAtIndex(rowRenderer.index, DisplayObject(rowRenderer)); } private function layout_changeHandler(event:Event):void { if(this._ignoreLayoutChanges) { return; } this.invalidate(INVALIDATION_FLAG_LAYOUT); this.invalidateParent(INVALIDATION_FLAG_LAYOUT); } private function selectedIndices_changeHandler(event:Event):void { this.invalidate(INVALIDATION_FLAG_SELECTED); } } } import feathers.controls.supportClasses.DataGridRowRenderer; class RowRendererFactoryStorage { public function RowRendererFactoryStorage() { } public var activeRowRenderers:Vector.<DataGridRowRenderer> = new <DataGridRowRenderer>[]; public var inactiveRowRenderers:Vector.<DataGridRowRenderer> = new <DataGridRowRenderer>[]; }
//////////////////////////////////////////////////////////////////////////////// // Copyright 2016 Prominic.NET, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License // // Author: Prominic.NET, Inc. // No warranty of merchantability or fitness of any kind. // Use this software at your own risk. //////////////////////////////////////////////////////////////////////////////// package actionScripts.interfaces { import actionScripts.factory.FileLocation; [Bindable] public interface IFileBridge { CONFIG::OSX { function getSSBInterface():IScopeBookmarkInterface; } function isPathExists(value:String):Boolean; function getDirectoryListing():Array; function deleteFileOrDirectory():void; function onSuccessDelete(value:Object, message:String=null):void; function onFault(message:String=null):void; function canonicalize():void; function browseForDirectory(title:String, selectListner:Function, cancelListener:Function=null, startFromLocation:String=null):void; function createFile(forceIsDirectory:Boolean=false):void; function createDirectory():void; function copyTo(value:FileLocation, overwrite:Boolean = false):void; function copyInto(locationCopyingTo:FileLocation, copyEmptyFolders:Boolean=true):void function copyFileTemplate(dst:FileLocation, data:Object=null):void; function getRelativePath(ref:FileLocation, useDotDot:Boolean=false):String; function load():void; function save(content:Object):void; function browseForSave(selected:Function, canceled:Function=null, title:String=null, startFromLocation:String=null):void; function moveTo(newLocation:FileLocation, overwrite:Boolean=false):void; function moveToAsync(newLocation:FileLocation, overwrite:Boolean=false):void; function deleteDirectory(deleteDirectoryContents:Boolean=false):void; function deleteDirectoryAsync(deleteDirectoryContents:Boolean=false):void; function resolveUserDirectoryPath(pathWith:String=null):FileLocation; function resolveApplicationStorageDirectoryPath(pathWith:String=null):FileLocation; function resolveApplicationDirectoryPath(pathWith:String=null):FileLocation; function resolveTemporaryDirectoryPath(pathWith:String=null):FileLocation; function resolvePath(path:String, toRelativePath:String=null):FileLocation; function resolveDocumentDirectoryPath(pathWith:String=null):FileLocation; function read():Object; function readAsync(provider:Object, fieldTypeReadObject:*, fieldTypeProvider:*, fieldInProvider:String=null, fieldInReadObject:String=null):void; function readAsyncWithListener(onComplete:Function, onError:Function=null, fileToRead:Object=null):void; function deleteFile():void; function deleteFileAsync():void; function browseForOpen(title:String, selectListner:Function, cancelListener:Function=null, fileFilters:Array=null, startFromLocation:String=null):void; function moveToTrashAsync():void; function openWithDefaultApplication():void; function checkFileExistenceAndReport(showAlert:Boolean=true):Boolean; function getFileByPath(value:String):Object; function get url():String; function set url(value:String):void function get separator():String; function get getFile():Object; function get parent():FileLocation; function get exists():Boolean; function set exists(value:Boolean):void; function get icon():Object; function set icon(value:Object):void; function get isDirectory():Boolean; function set isDirectory(value:Boolean):void; function get isHidden():Boolean; function set isHidden(value:Boolean):void; function get isPackaged():Boolean; function set isPackaged(value:Boolean):void; function get nativePath():String; function set nativePath(value:String):void; function get nativeURL():String; function set nativeURL(value:String):void; function get creator():String; function set creator(value:String):void; function get extension():String; function set extension(value:String):void; function get name():String; function set name(value:String):void; function get type():String; function set type(value:String):void; function get creationDate():Date; function set creationDate(value:Date):void; function get modificationDate():Date; function set modificationDate(value:Date):void; function get data():Object; function set data(value:Object):void; function get userDirectory():Object; function get desktopDirectory():Object; function get documentsDirectory():Object; function get isBrowsed():Boolean; function get nameWithoutExtension():String; } }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import com.adobe.test.Assert; // var SECTION = "15.8.2.9"; // var VERSION = "ECMA_1"; // var TITLE = "Math.floor(x)"; var testcases = getTestCases(); function getTestCases() { var array = new Array(); var item = 0; array[item++] = Assert.expectEq( "Math.floor.length", 1, Math.floor.length ); /*thisError="no error"; try{ Math.floor(); }catch(e:Error){ thisError=(e.toString()).substring(0,26); }finally{//print(thisError); array[item++] = Assert.expectEq( "Math.floor()","ArgumentError: Error #1063",thisError); } array[item++] = Assert.expectEq( "Math.floor()", Number.NaN, Math.floor() );*/ array[item++] = Assert.expectEq( "Math.floor(void 0)", Number.NaN, Math.floor(void 0) ); array[item++] = Assert.expectEq( "Math.floor(null)", 0, Math.floor(null) ); array[item++] = Assert.expectEq( "Math.floor(true)", 1, Math.floor(true) ); array[item++] = Assert.expectEq( "Math.floor(false)", 0, Math.floor(false) ); array[item++] = Assert.expectEq( "Math.floor('1.1')", 1, Math.floor("1.1") ); array[item++] = Assert.expectEq( "Math.floor('-1.1')", -2, Math.floor("-1.1") ); array[item++] = Assert.expectEq( "Math.floor('0.1')", 0, Math.floor("0.1") ); array[item++] = Assert.expectEq( "Math.floor('-0.1')", -1, Math.floor("-0.1") ); array[item++] = Assert.expectEq( "Math.floor(NaN)", Number.NaN, Math.floor(Number.NaN) ); array[item++] = Assert.expectEq( "Math.floor(NaN)==-Math.ceil(-NaN)", false, Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) ); array[item++] = Assert.expectEq( "Math.floor(0)", 0, Math.floor(0) ); array[item++] = Assert.expectEq( "Math.floor(0)==-Math.ceil(-0)", true, Math.floor(0) == -Math.ceil(-0) ); array[item++] = Assert.expectEq( "Math.floor(-0)", -0, Math.floor(-0) ); array[item++] = Assert.expectEq( "Infinity/Math.floor(-0)", -Infinity, Infinity/Math.floor(-0) ); array[item++] = Assert.expectEq( "Math.floor(-0)==-Math.ceil(0)", true, Math.floor(-0)== -Math.ceil(0) ); array[item++] = Assert.expectEq( "Math.floor(Infinity)", Number.POSITIVE_INFINITY, Math.floor(Number.POSITIVE_INFINITY) ); array[item++] = Assert.expectEq( "Math.floor(Infinity)==-Math.ceil(-Infinity)", true, Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) ); array[item++] = Assert.expectEq( "Math.floor(-Infinity)", Number.NEGATIVE_INFINITY, Math.floor(Number.NEGATIVE_INFINITY) ); array[item++] = Assert.expectEq( "Math.floor(-Infinity)==-Math.ceil(Infinity)", true, Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) ); array[item++] = Assert.expectEq( "Math.floor(0.0000001)", 0, Math.floor(0.0000001) ); array[item++] = Assert.expectEq( "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(0.0000001)==-Math.ceil(-0.0000001) ); array[item++] = Assert.expectEq( "Math.floor(-0.0000001)", -1, Math.floor(-0.0000001) ); array[item++] = Assert.expectEq( "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(-0.0000001)==-Math.ceil(0.0000001) ); array[item++] = Assert.expectEq( "Math.floor(1)", 1, Math.floor(1) ); array[item++] = Assert.expectEq( "Math.floor(-1)", -1, Math.floor(-1) ); array[item++] = Assert.expectEq( "Math.floor(-0.9)", -1, Math.floor(-0.9) ); array[item++] = Assert.expectEq( "Infinity/Math.floor(-0.9)", -Infinity, Infinity/Math.floor(-0.9) ); array[item++] = Assert.expectEq( "Math.floor(0.9 )", 0, Math.floor( 0.9) ); array[item++] = Assert.expectEq( "Math.floor(-1.1)", -2, Math.floor( -1.1)); array[item++] = Assert.expectEq( "Math.floor( 1.1)", 1, Math.floor( 1.1)); array[item++] = Assert.expectEq( "Math.floor(Infinity)", -Math.ceil(-Infinity), Math.floor(Number.POSITIVE_INFINITY) ); array[item++] = Assert.expectEq( "Math.floor(-Infinity)", -Math.ceil(Infinity), Math.floor(Number.NEGATIVE_INFINITY) ); array[item++] = Assert.expectEq( "Math.floor(-Number.MIN_VALUE)", -Math.ceil(Number.MIN_VALUE), Math.floor(-Number.MIN_VALUE) ); array[item++] = Assert.expectEq( "Math.floor(1)", -Math.ceil(-1), Math.floor(1) ); array[item++] = Assert.expectEq( "Math.floor(-1)", -Math.ceil(1), Math.floor(-1) ); array[item++] = Assert.expectEq( "Math.floor(-0.9)", -Math.ceil(0.9), Math.floor(-0.9) ); array[item++] = Assert.expectEq( "Math.floor(0.9 )", -Math.ceil(-0.9), Math.floor( 0.9) ); array[item++] = Assert.expectEq( "Math.floor(-1.1)", -Math.ceil(1.1), Math.floor( -1.1)); array[item++] = Assert.expectEq( "Math.floor( 1.1)", -Math.ceil(-1.1), Math.floor( 1.1)); array[item++] = Assert.expectEq( "Math.floor( .012345)", 0, Math.floor( .012345)); array[item++] = Assert.expectEq( "Math.floor( .0012345)", 0, Math.floor(.0012345)); array[item++] = Assert.expectEq( "Math.floor( .00012345)", 0, Math.floor(.00012345)); array[item++] = Assert.expectEq( "Math.floor( .0000012345)", 0, Math.floor( .0000012345)); array[item++] = Assert.expectEq( "Math.floor( .00000012345)", 0, Math.floor( .00000012345)); array[item++] = Assert.expectEq( "Math.floor( 5.01)", 5, Math.floor( 5.01)); array[item++] = Assert.expectEq( "Math.floor( 5.001)", 5, Math.floor( 5.001)); array[item++] = Assert.expectEq( "Math.floor( 5.0001)", 5, Math.floor( 5.0001)); array[item++] = Assert.expectEq( "Math.floor( 5.00001)", 5, Math.floor( 5.00001)); array[item++] = Assert.expectEq( "Math.floor( 5.000001)", 5, Math.floor( 5.000001)); array[item++] = Assert.expectEq( "Math.floor( 5.0000001)", 5, Math.floor(5.0000001)); return ( array ); }
package com.games.candycrush.board { import framework.util.rsv.Rsv; import framework.util.rsv.RsvFile; import luaAlchemy.LuaAlchemy; public class TestLuaScript { private var _board:Board; private var _lua:LuaAlchemy; private var _script:String; public function TestLuaScript(board:Board) { _board = board; _lua = new LuaAlchemy(); _lua.setGlobal("this", this); var rsv:RsvFile = Rsv.inst.getFile("file_lua"); _script = rsv.xml.toString(); trace(_script); // run(_script); } public function startCaculate():void { } public function getResult(score:int, result:Object):void { } private var _score:int; public function result(score:int):void { _score = score; trace(_score); } public function run(scriptText:String):void { runLuaScript(scriptText); } public function runLuaScript(scriptText:String):void { var arr:Array = _lua.doString(scriptText); CONFIG::debug { ASSERT(arr[0], "execute lua script error !"); } trace("运行状态:\n"+arr.join("\n")); trace(1); } } }
#include "AnimalConsts.as"; void onInit(CBlob@ this) { this.set_u16("seat ride time", 90); this.Tag("animal"); this.getCurrentScript().runFlags |= Script::tick_blob_in_proximity; this.getCurrentScript().runProximityTag = "player"; this.getCurrentScript().runProximityRadius = 320.0f; this.getCurrentScript().runFlags |= Script::tick_not_attached; } void onAttach(CBlob@ this, CBlob@ attached, AttachmentPoint @attachedPoint) { if (attachedPoint.socket) { this.set_u32("seat time", getGameTime()); this.Tag("no barrier pass"); } } void onDetach(CBlob@ this, CBlob@ detached, AttachmentPoint @attachedPoint) { if (attachedPoint.socket) { detached.setVelocity(this.getVelocity()); detached.AddForce(Vec2f(0.0f, -300.0f)); this.Untag("no barrier pass"); } } void onTick(CBlob@ this) { // hack to disable seats const u32 seattime = this.get_u32("seat time"); const u32 gametime = getGameTime(); AttachmentPoint@[] aps; if (this.getAttachmentPoints(@aps)) { u16 ridetime = this.get_u16("seat ride time"); for (uint i = 0; i < aps.length; i++) { AttachmentPoint@ ap = aps[i]; if (ap.socket) { CBlob@ occ = ap.getOccupied(); CBlob@ friend = getBlobByNetworkID(this.get_netid(friend_property)); if (occ is null && seattime + ridetime > gametime) ap.SetKeysToTake(0); else { ap.SetKeysToTake(key_left | key_right | key_up | key_down | key_action1 | key_action2 | key_action3); if ((occ !is null && occ is friend) || (XORRandom(3) == 0)) { this.setKeyPressed(key_left, ap.isKeyPressed(key_left)); this.setKeyPressed(key_right, ap.isKeyPressed(key_right)); this.setKeyPressed(key_up, ap.isKeyPressed(key_down)); this.setKeyPressed(key_down, ap.isKeyPressed(key_up)); } } // GET OUT if (occ !is null && (ap.isKeyJustPressed(key_up) || (occ !is friend && (seattime + ridetime <= gametime) && this.getShape().vellen > 0.4f))) { this.server_DetachFrom(occ); // pickup shark after done riding on land if (this.getAttachments().getAttachmentPointByName("PICKUP") !is null && !this.isInWater()) { occ.server_Pickup(this); } } } } } }
package org.w3c.css.sac { import flash.net.URLRequest; // http://www.w3.org/Style/CSS/SAC/doc/org/w3c/css/sac/Parser.html /** * Basic interface for CSS (Simple API for CSS) parsers. * <p>All CSS parsers must implement this basic interface: it allows applications to register handlers for different types of events and to initiate a parse from a URI, or a character stream.</p> * <p>All CSS parsers must also implement a zero-argument constructor (though other constructors are also allowed).</p> * <p>CSS parsers are reusable but not re-entrant: the application may reuse a parser object (possibly with a different input source) once the first parse has completed successfully, but it may not invoke the parse() methods recursively within a parse.</p> * @see IDocumentHandler * @see IErrorHandler */ public interface IParser { /** * Returns a string about which CSS language is supported by this parser. * For CSS Level 1, it returns "http://www.w3.org/TR/REC-CSS1", for CSS Level 2, it returns "http://www.w3.org/TR/REC-CSS2". Note that a "CSSx" parser can return lexical unit other than those allowed by CSS Level x but this usage is not recommended. */ function get parserVersion():String; /** * Parse a CSS priority value (e.g. "!important"). * @throws ICSSException Any CSS exception, possibly wrapping another exception. */ function parsePriority( priority:String ):Boolean; /** * Parse a CSS property value. * @throws ICSSException Any CSS exception, possibly wrapping another exception. */ function parsePropertyValue( value:String ):ILexicalUnit; /** * Parse a CSS rule. * @throws ICSSException Any CSS exception, possibly wrapping another exception. */ function parseRule( rule:String ):void; /** * Parse a comma separated list of selectors. * @throws ICSSException Any CSS exception, possibly wrapping another exception. */ function parseSelectors( selectors:String ):ISelectorList; /** * Parse a CSS style declaration (without '{' and '}'). * @param styleValue The declaration. * @returns ICSSException Any CSS exception, possibly wrapping another exception. */ function parseStyleDeclaration( declaration:String ):void; /** * Parse a CSS document. * <p>The application can use this method to instruct the CSS parser to begin parsing an CSS document from any valid input source (a character stream, a byte stream, or a URI).</p> * <p>Applications may not invoke this method while a parse is in progress (they should create a new Parser instead for each additional CSS document). Once a parse is complete, an application may reuse the same Parser object, possibly with a different input source.</p> * @param source The input source for the top-level of the CSS document. * @throws ICSSException Any CSS exception, possibly wrapping another exception. * @see #parseStyleSheet(String) * @see #setDocumentHandler(IDocumentHandler) * @see #setErrorHandler(IErrorHandler) */ function parseStyleSheet( css:String ):void; /** * Parse a CSS document from a URLRequest. * <p>This method is a shortcut for the common case of reading a document from a URL.</p> * @param request The URLRequest. * @throws ICSSException Any CSS exception, possibly wrapping another exception. * @see #parseStyleSheet(String) */ function loadStyleSheet( request:URLRequest ):void; /** * */ function set conditionFactory( factory:IConditionFactory ):void; /** * Allow an application to register a document event handler. * <p>If the application does not register a document handler, all document events reported by the CSS parser will be silently ignored (this is the default behaviour implemented by HandlerBase).</p> * <p>Applications may register a new or different handler in the middle of a parse, and the CSS parser must begin using the new handler immediately.</p> * @param handler The document handler. * @see IDocumentHandler */ function set documentHandler( handler:IDocumentHandler ):void; /** * Allow an application to register an error event handler. * <p>If the application does not register an error event handler, all error events reported by the CSS parser will be silently ignored, except for fatalError, which will throw a CSSException (this is the default behaviour implemented by HandlerBase).</p> * <p>Applications may register a new or different handler in the middle of a parse, and the CSS parser must begin using the new handler immediately.</p> * @param handler The error handler. * @see IErrorHandler * @see ICSSException */ function set errorHandler( handler:IErrorHandler ):void /** * Allow an application to request a locale for errors and warnings. * <p>CSS parsers are not required to provide localisation for errors and warnings; if they cannot support the requested locale, however, they must throw a CSS exception. Applications may not request a locale change in the middle of a parse.</p> * @param locale A Java Locale object. * @throws ICSSException Throws an exception (using the previous or default locale) if the requested locale is not supported. * @see ICSSException * @see ICSSParseException */ function set locale( locale:* ):void; // ??? /** * */ function set selectorFactory( factory:ISelectorFactory ):void; } }
package serverProto.battleRoyale { public final class ProtoInnerBattleRoyaleSceneType { public static const PROTO_INNER_BATTLE_ROYALE_SCENE_TYPE_ENTER:int = 1; public static const PROTO_INNER_BATTLE_ROYALE_SCENE_TYPE_LEAVE:int = 2; public function ProtoInnerBattleRoyaleSceneType() { super(); } } }
package nid.xfl.compiler.swf.data.actions.swf4 { import nid.xfl.compiler.swf.data.actions.*; public class ActionAnd extends Action implements IAction { public static const CODE:uint = 0x10; public function ActionAnd(code:uint, length:uint) { super(code, length); } override public function toString(indent:uint = 0):String { return "[ActionAnd]"; } } }
/* * 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 tests.org.flexunit.token { [Suite] [RunWith("org.flexunit.runners.Suite")] public class TokenSuite { //public var asyncCoreStartupTokenCase:AsyncCoreStartupTokenCase; //public var asynTestTokenCase:AsyncTestTokenCase; public var childResultCase:ChildResultCase; public var startupToken:AsyncCoreStartupTokenCase; public var testToken:AsyncTestTokenCase; } }
package { import com.Track; import com.component.menu.ArrowCtrl; import com.component.menu.MenuCircle; import com.component.menu.MenuCreate; import com.component.menu.skill.MenuSkill; import com.component.print.Printer; import com.scene.StartScene; import flash.filesystem.File; import starling.display.Sprite; import starling.events.Event; import starling.text.TextField; import starling.utils.AssetManager; public class Game extends Sprite { public static var asset:AssetManager = new AssetManager(); public static const STAGE_WIDTH:Number = 960; public static const STAGE_HEIGHT:Number = 640; private var rootSprite:Sprite = new Sprite(); private var sceneSprite:Sprite = new Sprite(); private var menuSprite:Sprite = new Sprite(); private var m:MenuCircle; private var track:Track; private var arrow:ArrowCtrl; public function Game() { super(); this.addEventListener(Event.ADDED_TO_STAGE,onAddtoStage); } private function onAddtoStage(e:Event):void { this.removeEventListeners(Event.ADDED_TO_STAGE); var file:File = File.applicationDirectory.resolvePath("asset"); asset.enqueue(file); asset.loadQueue(onComplete); } private function onComplete(radio:int):void { if(radio == 1){ init(); } } private function init():void{ rootSprite.addChild(sceneSprite); rootSprite.addChild(menuSprite); addChild(rootSprite); track = new Track(this); UnitManager.getInstance().track = track; UnitManager.getInstance().sceneSprite = sceneSprite; UnitManager.getInstance().menuSprite = menuSprite; UnitManager.getInstance().rootSprite = rootSprite; UnitManager.getInstance().loadStar(); menuCreate(); dataInit(); var start:StartScene = new StartScene(); addChild(start); } private function dataInit():void { } private function menuCreate():void{ m = new MenuCircle(); menuSprite.addChild(m); UnitManager.getInstance().menuCircle = m; var text:TextField = new TextField(100,30,"0"); text.color = 0xffffff; text.x = 20; text.y = 20; menuSprite.addChild(text); UnitManager.getInstance().text = text; var menu:MenuCreate = new MenuCreate(); menuSprite.addChild(menu); UnitManager.getInstance().menuCreate = menu; var skill:MenuSkill = new MenuSkill(); menuSprite.addChild(skill); UnitManager.getInstance().menuSkill = skill; var printer:Printer = new Printer(); menuSprite.addChild(printer); UnitManager.getInstance().printer = printer; menuSprite.visible = false; } } }
/** * Copyright 2010-2012 Singapore Management University * Developed under a grant from the Singapore-MIT GAMBIT Game Lab * This Source Code Form is subject to the terms of the * Mozilla Public License, v. 2.0. If a copy of the MPL was * not distributed with this file, You can obtain one at * http://mozilla.org/MPL/2.0/. */ package sg.edu.smu.ksketch2.canvas.components.timebar { import flash.events.Event; import spark.components.Group; import sg.edu.smu.ksketch2.KSketch2; import sg.edu.smu.ksketch2.KSketchGlobals; import sg.edu.smu.ksketch2.canvas.controls.KInteractionControl; import sg.edu.smu.ksketch2.events.KSketchEvent; import sg.edu.smu.ksketch2.events.KTimeChangedEvent; import sg.edu.smu.ksketch2.model.data_structures.IKeyFrame; import sg.edu.smu.ksketch2.model.data_structures.ISpatialKeyFrame; import sg.edu.smu.ksketch2.model.data_structures.KModelObjectList; import sg.edu.smu.ksketch2.model.data_structures.KSpatialKeyFrame; import sg.edu.smu.ksketch2.model.objects.KGroup; import sg.edu.smu.ksketch2.model.objects.KObject; import sg.edu.smu.ksketch2.utils.SortingFunctions; /** * Tick mark control generates tick marks and handles interactions with the tick marks * It is more like an extension to the time control class. * YOU TECHNICALLY DO NOT INTERACT WITH THE TICK MARKS' VISUAL REPRESENATIONS. * YOU WORK WITH THE TICK MARKS' DATA (ABOVE THE MODEL, ON THE INTERFACE) * THEN THIS CLASS WILL DRAW THE UPDATED STUFFS ON THE SCREEN * KEY FRAME DATA (those that actually matter to the model). */ public class KSketch_TickMark_Control { public static const GRAB_THRESHOLD:Number = 10; private static const CONTROLPOINT:Number = 3; private static const KEYFRAME:Number = 7; public var moveLeft:Boolean = false; private var _KSketch:KSketch2; private var _timeControl:KSketch_TimeControl; private var _interactionControl:KInteractionControl; public var _ticks:Vector.<KSketch_TickMark>; private var _before:Vector.<KSketch_TickMark>; private var _after:Vector.<KSketch_TickMark>; private var _grabbedTick:KSketch_TickMark; private var _startX:Number; private var _changeX:Number; private var _pixelPerFrame:Number; /** * A helper class containing the codes for generating and moving tick marks * Should Probably read the comments within the codes */ public function KSketch_TickMark_Control(KSketchInstance:KSketch2, timeControl:KSketch_TimeControl, interactionControl:KInteractionControl) { _KSketch = KSketchInstance; _timeControl = timeControl; _interactionControl = interactionControl; _KSketch.addEventListener(KSketchEvent.EVENT_MODEL_UPDATED, _updateTicks); _interactionControl.addEventListener(KInteractionControl.EVENT_UNDO_REDO, _updateTicks); _interactionControl.addEventListener(KSketchEvent.EVENT_SELECTION_SET_CHANGED, _updateTicks); _interactionControl.addEventListener(KInteractionControl.EVENT_INTERACTION_END, _updateTicks); _timeControl.addEventListener(KTimeChangedEvent.EVENT_MAX_TIME_CHANGED, _recalibrateTicksAgainstMaxTime); } /** * GrabbedTick is the immediate tickmark that is within touch range when interacting with the time control * If a tick mark has been grabbed, all time control interactions should be routed to the tick mark control */ public function get grabbedTick():KSketch_TickMark { return _grabbedTick; } /** * Update tickmarks should be invoked when * The selection set is modified * - Object composition of the selection set changed, * not including changes the the composition of the selection because of visibility within selection * - Objects are modified by transitions (which changed the timing of the key frames) * - The time control's maximum time changed (Position of the tick marks will be affected by the change) * - Goodness, I need to fill up this list... */ private function _updateTicks(event:Event = null):void { var allObjects:KModelObjectList = _KSketch.root.getAllChildren(); _timeControl.timings = new Vector.<Number>(); _ticks = new Vector.<KSketch_TickMark>(); //Gather the keys from objects and generate chains of markers from the keys var i:int; var j:int; var length:int = allObjects.length(); var currentObject:KObject; var transformKeyHeaders:Vector.<IKeyFrame>; var isSelected:Boolean; var selectedGroup:KGroup; for(i = 0; i<length; i++) { currentObject = allObjects.getObjectAt(i); isSelected = currentObject.selected; transformKeyHeaders = currentObject.transformInterface.getAllKeyFrames(); //Generate markers for each set of transform keys for(j = 0; j < transformKeyHeaders.length; j++) { if(currentObject.selected) { if(_interactionControl.selection) { if(_interactionControl.selection.objects.getObjectAt(0) is KGroup) { selectedGroup = _interactionControl.selection.objects.getObjectAt(0) as KGroup; if(currentObject.parent.id == selectedGroup.id) if(currentObject is KObject) isSelected = false; } } } _generateTicks(transformKeyHeaders[j], currentObject.id, isSelected); } //visibility keys _generateTicks(currentObject.visibilityControl.visibilityKeyHeader, currentObject.id, isSelected); } _ticks.sort(SortingFunctions._compare_x_property); _drawTicks(); //Set timings for time control's jumping function _timeControl.timings.sort(SortingFunctions._sortInt); //calibrate time on timebar with ticks _update_object_model(); } /** * Creates a chain of doubly linked markers * Pushes the set of newly created markers into _markers */ private function _generateTicks(headerKey:IKeyFrame, ownerID:int, objectSelected:Boolean):void { //Make marker objects //As compared to desktop version, these markers will not be displayed on the screen literally //Draw ticks will take these markers and draw representations on the screen. //They will be redrawn whenever their positions are changed. //Done for the sake of saving memory (Just trying, not sure if drawing lines are effective or not) var currentKey:IKeyFrame = headerKey; var newTick:KSketch_TickMark; var prev:KSketch_TickMark; while(currentKey) { newTick = new KSketch_TickMark(); newTick.init(currentKey, _timeControl.timeToX(currentKey.time), ownerID); newTick.selected = objectSelected; _ticks.push(newTick); _timeControl.timings.push(newTick.time); if(prev) { newTick.prev = prev; prev.next = newTick; } prev = newTick; currentKey = currentKey.next; } } //Recompute the xPositions of all available time ticks against the time control's maximum time //Only updates the available time ticks' position //Does not create new time ticks. private function _recalibrateTicksAgainstMaxTime(event:Event = null):void { if(!_ticks || _ticks.length == 0) return; var i:int = 0; var length:int = _ticks.length; var currentTick:KSketch_TickMark; for(i; i<length; i++) { currentTick = _ticks[i]; currentTick.x = _timeControl.timeToX(currentTick.time); } _drawTicks(); } /** * Draws the visual representation of markers and activities on the time control */ private function _drawTicks():void { if(!_ticks) return; //Before we start anything, we should nuke the displays first _timeControl.selectedTickMarkDisplay.graphics.clear(); _timeControl.unselectedTickMarkDisplay.graphics.clear(); _timeControl.activityDisplay.graphics.clear(); var i:int; var drawTarget:Group; var currentMarker:KSketch_TickMark; //Sort the tick marks from smallest x to biggest x //Start drawing from the smallest X //Avoid drawing on the same X again //Increment smallest X after draw //This should cut down on redrawing on the same locations -> less processing //Doing two passes for selected and unselected stuffs //Algo can be improved var currentX:Number = Number.NEGATIVE_INFINITY; //Draw condition //Rigth now it is drawing if and only if there is only 1 object selected if(_interactionControl.selection && _interactionControl.selection.objects.length() == 1) { _timeControl.unselectedTickMarkDisplay.graphics.lineStyle(CONTROLPOINT, KSketchGlobals.COLOR_GREY_LIGHT); drawTarget = _timeControl.activityDisplay; for(i = 0; i<_ticks.length; i++) { currentMarker = _ticks[i]; if(!currentMarker.selected) continue; //Draw the selected stuffs first if(currentX <= currentMarker.x) { currentX = currentMarker.x; if(currentX < 0) continue; var firstFrame:KSpatialKeyFrame = _interactionControl.selection.objects.getObjectAt(0).transformInterface.getActiveKey(currentMarker.key.time) as KSpatialKeyFrame; if(firstFrame) { if(firstFrame.passthrough) _timeControl.selectedTickMarkDisplay.graphics.lineStyle(CONTROLPOINT, KSketchGlobals.COLOR_RED_DARK); else _timeControl.selectedTickMarkDisplay.graphics.lineStyle(KEYFRAME, KSketchGlobals.COLOR_BLACK); } else _timeControl.selectedTickMarkDisplay.graphics.lineStyle(CONTROLPOINT, KSketchGlobals.COLOR_RED_DARK); if(drawTarget.x <= currentX) { _timeControl.selectedTickMarkDisplay.graphics.moveTo( currentX, 0); _timeControl.selectedTickMarkDisplay.graphics.lineTo( currentX, drawTarget.height); //Activity bars if(currentMarker.prev) { if(currentMarker.key is ISpatialKeyFrame) { if((currentMarker.key as ISpatialKeyFrame).hasActivityAtTime()) { drawTarget.graphics.beginFill(KSketchGlobals.COLOR_RED, KSketchGlobals.ALPHA_06); drawTarget.graphics.drawRect(currentMarker.prev.x, 0, currentMarker.x - currentMarker.prev.x, drawTarget.height); drawTarget.graphics.endFill(); } } } } } } } else { _timeControl.unselectedTickMarkDisplay.alpha = KSketchGlobals.ALPHA_1; _timeControl.unselectedTickMarkDisplay.graphics.lineStyle(CONTROLPOINT, KSketchGlobals.COLOR_GREY_LIGHT); } //Draw unselected markers currentX = Number.NEGATIVE_INFINITY; drawTarget = _timeControl.unselectedTickMarkDisplay; for(i = 0; i<_ticks.length; i++) { currentMarker = _ticks[i]; if(_interactionControl.selection && _interactionControl.selection.objects.length() > 1) { currentMarker.selected = false; } if(!currentMarker.selected) { currentX = currentMarker.x; if(currentX < 0 || _timeControl.backgroundFill.width < currentX) continue; if(drawTarget.x <= currentX) { drawTarget.graphics.moveTo(currentX, 0); drawTarget.graphics.lineTo(currentX, drawTarget.height); } } } } /** * Grab tick "tries to grab a tick" on the time tick control */ public function grabTick(locationX:Number):void { var i:int; var length:int = _ticks.length; var currentTick:KSketch_TickMark; _startX = locationX; for(i = 0; i < length; i++) { currentTick = _ticks[i]; if(_interactionControl.selection) if(!currentTick.selected) continue; if(locationX == currentTick.x) { _grabbedTick = currentTick; break; } } //Stop process if there are no grabbed ticks if(!_grabbedTick) return; //Separate ticks into before/after sets //Ticks exactly on the spot are classified as before _before = new Vector.<KSketch_TickMark>(); _after = new Vector.<KSketch_TickMark>(); for(i = 0; i < length; i++) { currentTick = _ticks[i]; currentTick.originalPosition = currentTick.x; if(currentTick.x <= locationX) { if(_grabbedTick.selected == currentTick.selected) _before.push(currentTick); } //After ticks are a bit special //Only add in the first degree ticks //because a tick will be pushed by the marker before itself if(currentTick.x >= locationX) { if(_grabbedTick.selected == currentTick.selected) { if(!currentTick.prev ) _after.push(currentTick); else if(currentTick.prev.x < locationX) _after.push(currentTick) } } } _pixelPerFrame = _timeControl.pixelPerFrame; } public function start_move_markers():void { if(!_interactionControl.currentInteraction) _interactionControl.begin_interaction_operation(); } /** * Update function. Moves the grabbed marker to a rounded value * near locationX. Rounded value is a frame boundary */ public function move_markers(locationX:Number):void { //if(!_interactionControl.currentInteraction) // _interactionControl.begin_interaction_operation(); //On Pan compute how much finger moved (_changeX) var currentX:Number = locationX; var changeX:Number = currentX - _startX; changeX = (changeX/_pixelPerFrame)*_pixelPerFrame; //If _changeX -ve use before //If _changeX +ve use after //If SumOffsetX crosses a marker, it pushes it along the best it could (subject to key frame linking rules) var i:int = 0; var length:int; var tick:KSketch_TickMark; var tickChangeX:Number; //Moving towards the left causes stacking if(changeX <= 0) { moveLeft = true; length = _before.length; for(i = 0; i < length; i++) { tick = _before[i]; tickChangeX = ((currentX - tick.originalPosition)/_pixelPerFrame)*_pixelPerFrame; if(tickChangeX < 0) tick.moveToX(tick.originalPosition + tickChangeX, _pixelPerFrame); else tick.x = tick.originalPosition; } } //Moving towards the right pushes future keys if(changeX >= 0) { length = _after.length; for(i = 0; i < length; i++) { tick = _after[i]; tickChangeX = ((currentX - tick.originalPosition)/_pixelPerFrame)*_pixelPerFrame; if(tickChangeX > 0) tick.moveSelfAndNext(tick.originalPosition + tickChangeX, _pixelPerFrame); else tick.moveSelfAndNext(tick.originalPosition, _pixelPerFrame); } } //Update marker positions length = _ticks.length var currentTick:KSketch_TickMark; var maxTime:Number = 0; for(i = 0; i < length; i++) { currentTick = _ticks[i]; currentTick.time = _timeControl.xToTime(currentTick.x); if(KSketch_TimeControl.MAX_ALLOWED_TIME < currentTick.time) { currentTick.time = KSketch_TimeControl.MAX_ALLOWED_TIME; currentTick.x = _timeControl.timeToX(currentTick.time); } if(maxTime < currentTick.time) maxTime = currentTick.time; } //Redraw markers _drawTicks(); _changeX = changeX; _update_object_model(); } public function _update_object_model():void { //Update the model var i:int; var length:int = _ticks.length; var currentTick:KSketch_TickMark; var allObjects:KModelObjectList = _KSketch.root.getAllChildren(); var maxTime:Number = 0; for(i = 0; i < _ticks.length; i++) { currentTick = _ticks[i]; if(currentTick.time > maxTime) maxTime = currentTick.time; _KSketch.editKeyTime(allObjects.getObjectByID(currentTick.associatedObjectID), currentTick.key, currentTick.time, _interactionControl.currentInteraction); } //Update the time control's maximum time if needed //Happens when a marker has been pushed beyond the max time if(KSketch_TimeControl.DEFAULT_MAX_TIME < maxTime) _timeControl.maximum = maxTime; else _timeControl.maximum = KSketch_TimeControl.DEFAULT_MAX_TIME; } /** * Makes changes to the model * Right now it is very brute force, all key frames * refered in existing markers are being updated regardless of them being * changed or not. */ public function end_move_markers():void { if(_interactionControl.currentInteraction) { if(_interactionControl.currentInteraction.length > 0) _KSketch.dispatchEvent(new KSketchEvent(KSketchEvent.EVENT_MODEL_UPDATED, _KSketch.root)); _interactionControl.end_interaction_operation(); } else _interactionControl.cancel_interaction_operation(); _grabbedTick = null; moveLeft = false; } } }
/* Copyright aswing.org, see the LICENCE.txt. */ import GUI.fox.aswing.AbstractButton; import GUI.fox.aswing.ASColor; import GUI.fox.aswing.border.BevelBorder; import GUI.fox.aswing.BorderLayout; import GUI.fox.aswing.colorchooser.ColorRectIcon; import GUI.fox.aswing.colorchooser.JColorSwatches; import GUI.fox.aswing.colorchooser.NoColorIcon; import GUI.fox.aswing.Component; import GUI.fox.aswing.Container; import GUI.fox.aswing.geom.Dimension; import GUI.fox.aswing.geom.Point; import GUI.fox.aswing.geom.Rectangle; import GUI.fox.aswing.graphics.Graphics; import GUI.fox.aswing.graphics.Pen; import GUI.fox.aswing.graphics.SolidBrush; import GUI.fox.aswing.JAdjuster; import GUI.fox.aswing.JButton; import GUI.fox.aswing.JLabel; import GUI.fox.aswing.JPanel; import GUI.fox.aswing.JTextField; import GUI.fox.aswing.LookAndFeel; import GUI.fox.aswing.MouseManager; import GUI.fox.aswing.plaf.ColorSwatchesUI; import GUI.fox.aswing.SoftBox; import GUI.fox.aswing.SoftBoxLayout; import GUI.fox.aswing.util.Delegate; /** * @author iiley */ class GUI.fox.aswing.plaf.basic.BasicColorSwatchesUI extends ColorSwatchesUI { private var colorSwatches:JColorSwatches; private var selectedColorLabel:JLabel; private var selectedColorIcon:ColorRectIcon; private var colorHexText:JTextField; private var alphaAdjuster:JAdjuster; private var noColorButton:AbstractButton; private var colorTilesPane:JPanel; private var topBar:Container; private var barLeft:Container; private var barRight:Container; private var colorSwatchesListener:Object; private var colorTilesPaneListener:Object; private var selectionRectMC:MovieClip; public function BasicColorSwatchesUI(){ } public function installUI(c:Component):Void{ colorSwatches = JColorSwatches(c); installDefaults(); installComponents(); installListeners(); } public function uninstallUI(c:Component):Void{ colorSwatches = JColorSwatches(c); uninstallDefaults(); uninstallComponents(); uninstallListeners(); } private function installDefaults():Void{ var pp:String = "ColorSwatches."; LookAndFeel.installColorsAndFont(colorSwatches, pp + "background", pp + "foreground", pp + "font"); LookAndFeel.installBasicProperties(colorSwatches, pp); LookAndFeel.installBorder(colorSwatches, pp + "border"); } private function uninstallDefaults():Void{ LookAndFeel.uninstallBorder(colorSwatches); } private function installComponents():Void{ selectedColorLabel = createSelectedColorLabel(); selectedColorIcon = createSelectedColorIcon(); selectedColorLabel.setIcon(selectedColorIcon); colorHexText = createHexText(); alphaAdjuster = createAlphaAdjuster(); noColorButton = createNoColorButton(); colorTilesPane = createColorTilesPane(); topBar = new JPanel(new BorderLayout()); barLeft = SoftBox.createHorizontalBox(2, SoftBoxLayout.LEFT); barRight = SoftBox.createHorizontalBox(2, SoftBoxLayout.RIGHT); topBar.append(barLeft, BorderLayout.WEST); topBar.append(barRight, BorderLayout.EAST); barLeft.append(selectedColorLabel); barLeft.append(colorHexText); barRight.append(alphaAdjuster); barRight.append(noColorButton); colorSwatches.setLayout(new BorderLayout(4, 4)); colorSwatches.append(topBar, BorderLayout.NORTH); colorSwatches.append(colorTilesPane, BorderLayout.CENTER); updateSectionVisibles(); } private function uninstallComponents():Void{ colorSwatches.remove(topBar); colorSwatches.remove(colorTilesPane); } private function installListeners():Void{ noColorButton.addActionListener(__noColorButtonAction, this); colorSwatchesListener = new Object(); colorSwatchesListener[JColorSwatches.ON_STATE_CHANGED] = Delegate.create(this, __colorSelectionChanged); colorSwatchesListener[JColorSwatches.ON_HIDDEN] = Delegate.create(this, __colorSwatchesUnShown); colorSwatchesListener[JColorSwatches.ON_DESTROY] = colorSwatchesListener[JColorSwatches.ON_HIDDEN]; colorSwatches.addEventListener(colorSwatchesListener); colorTilesPaneListener = new Object(); colorTilesPaneListener[JPanel.ON_ROLLOVER] = Delegate.create(this, __colorTilesPaneRollOver); colorTilesPaneListener[JPanel.ON_ROLLOUT] = Delegate.create(this, __colorTilesPaneRollOut); colorTilesPaneListener[JPanel.ON_DRAGOUT] = colorTilesPaneListener[JPanel.ON_ROLLOUT]; colorTilesPaneListener[JPanel.ON_RELEASE] = Delegate.create(this, __colorTilesPaneReleased); colorTilesPane.addEventListener(colorTilesPaneListener); mouseMoveOnTilesPaneListener = new Object(); mouseMoveOnTilesPaneListener[MouseManager.ON_MOUSE_MOVE] = Delegate.create(this, __colorTilesPaneMouseMove); colorHexText.addActionListener(__hexTextAction, this); colorHexText.addChangeListener(__hexTextChanged, this); alphaAdjuster.addChangeListener(__adjusterValueChanged, this); alphaAdjuster.addActionListener(__adjusterAction, this); } private function uninstallListeners():Void{ colorSwatches.removeEventListener(colorSwatchesListener); MouseManager.removeEventListener(mouseMoveOnTilesPaneListener); } //------------------------------------------------------------------------------ private function __adjusterValueChanged():Void{ updateSelectedColorLabelColor(getColorFromHexTextAndAdjuster()); } private function __adjusterAction():Void{ colorSwatches.setSelectedColor(getColorFromHexTextAndAdjuster()); } private function __hexTextChanged():Void{ updateSelectedColorLabelColor(getColorFromHexTextAndAdjuster()); } private function __hexTextAction():Void{ colorSwatches.setSelectedColor(getColorFromHexTextAndAdjuster()); } private var mouseMoveOnTilesPaneListener:Object; private function __colorTilesPaneRollOver():Void{ MouseManager.removeEventListener(mouseMoveOnTilesPaneListener); MouseManager.addEventListener(mouseMoveOnTilesPaneListener); } private function __colorTilesPaneRollOut():Void{ stopMouseMovingSelection(); } private var lastOutMoving:Boolean; private function __colorTilesPaneMouseMove():Void{ var p:Point = colorTilesPane.getMousePosition(); var color:ASColor = getColorWithPosAtColorTilesPane(p); if(color != null){ var sp:Point = getSelectionRectPos(p); selectionRectMC._visible = true; selectionRectMC._x = sp.x; selectionRectMC._y = sp.y; updateSelectedColorLabelColor(color); fillHexTextWithColor(color); lastOutMoving = false; updateAfterEvent(); }else{ color = colorSwatches.getSelectedColor(); selectionRectMC._visible = false; if(lastOutMoving != true){ updateSelectedColorLabelColor(color); fillHexTextWithColor(color); } lastOutMoving = true; } } private function __colorTilesPaneReleased():Void{ var p:Point = colorTilesPane.getMousePosition(); var color:ASColor = getColorWithPosAtColorTilesPane(p); if(color != null){ colorSwatches.setSelectedColor(color); } } private function __noColorButtonAction():Void{ colorSwatches.setSelectedColor(null); } private var colorTilesMC:MovieClip; private function __colorTilesPaneCreated():Void{ colorTilesMC = colorTilesPane.createMovieClip(); selectionRectMC = colorTilesPane.createMovieClip(); paintColorTiles(); paintSelectionRect(); selectionRectMC._visible = false; } private function __colorSelectionChanged():Void{ var color:ASColor = colorSwatches.getSelectedColor(); fillHexTextWithColor(color); fillAlphaAdjusterWithColor(color); updateSelectedColorLabelColor(color); } private function __colorSwatchesUnShown():Void{ stopMouseMovingSelection(); } private function stopMouseMovingSelection():Void{ MouseManager.removeEventListener(mouseMoveOnTilesPaneListener); selectionRectMC._visible = false; var color:ASColor = colorSwatches.getSelectedColor(); updateSelectedColorLabelColor(color); fillHexTextWithColor(color); } //----------------------------------------------------------------------- private function create(c:Component):Void{ super.create(c); updateSectionVisibles(); } private function paint(c:Component, g:Graphics, b:Rectangle):Void{ super.paint(c, g, b); updateSectionVisibles(); updateSelectedColorLabelColor(colorSwatches.getSelectedColor()); fillHexTextWithColor(colorSwatches.getSelectedColor()); } private function updateSectionVisibles():Void{ colorHexText.setVisible(colorSwatches.isHexSectionVisible()); alphaAdjuster.setVisible(colorSwatches.isAlphaSectionVisible()); noColorButton.setVisible(colorSwatches.isNoColorSectionVisible()); } //******************************************************************************* // Data caculating methods //****************************************************************************** private function getColorFromHexTextAndAdjuster():ASColor{ var text:String = colorHexText.getText(); if(text.charAt(0) == "#"){ text = text.substr(1); } var rgb:Number = parseInt("0x" + text); return new ASColor(rgb, alphaAdjuster.getValue()); } private var hexTextColor:ASColor; private function fillHexTextWithColor(color:ASColor):Void{ if(!color.equals(hexTextColor)){ hexTextColor = color; var hex:String; if(color == null){ hex = "000000"; }else{ hex = color.getRGB().toString(16); } for(var i:Number=6-hex.length; i>0; i--){ hex = "0" + hex; } hex = "#" + hex.toUpperCase(); colorHexText.setText(hex); } } private function fillAlphaAdjusterWithColor(color:ASColor):Void{ var alpha:Number = (color == null ? 100 : color.getAlpha()); alphaAdjuster.setValue(alpha); } private function isEqualsToSelectedIconColor(color:ASColor):Boolean{ if(color == null){ return selectedColorIcon.getColor() == null; }else{ return color.equals(selectedColorIcon.getColor()); } } private function updateSelectedColorLabelColor(color:ASColor):Void{ if(!isEqualsToSelectedIconColor(color)){ selectedColorIcon.setColor(color); selectedColorLabel.repaint(); colorSwatches.getModel().fireColorAdjusting(color); } } private function getSelectionRectPos(p:Point):Point{ var L:Number = getTileL(); return new Point(Math.floor(p.x/L)*L, Math.floor(p.y/L)*L); } //if null returned means not in color tiles bounds private function getColorWithPosAtColorTilesPane(p:Point):ASColor{ var L:Number = getTileL(); var size:Dimension = getColorTilesPaneSize(); if(p.x < 0 || p.y < 0 || p.x >= size.width || p.y >= size.height){ return null; } var alpha:Number = alphaAdjuster.getValue(); if(p.x < L){ var index:Number = Math.floor(p.y/L); index = Math.max(0, Math.min(11, index)); return new ASColor(getLeftColumColors()[index], alpha); } if(p.x < L*2){ return new ASColor(0x000000, alpha); } var x:Number = p.x - L*2; var y:Number = p.y; var bigTile:Number = (L*6); var tx:Number = Math.floor(x/bigTile); var ty:Number = Math.floor(y/bigTile); var ti:Number = ty*3 + tx; var xi:Number = Math.floor((x - tx*bigTile)/L); var yi:Number = Math.floor((y - ty*bigTile)/L); return getTileColorByTXY(ti, xi, yi, alpha); } private function getLeftColumColors():Array{ return [0x000000, 0x333333, 0x666666, 0x999999, 0xCCCCCC, 0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0x00FFFF, 0xFF00FF]; } private function getTileColorByTXY(t:Number, x:Number, y:Number, alpha:Number):ASColor{ if(alpha == undefined) alpha = 100; var rr:Number = 0x33*t; var gg:Number = 0x33*x; var bb:Number = 0x33*y; var c:ASColor = ASColor.getASColor(rr, gg, bb, alpha); return c; } private function paintColorTiles():Void{ var g:Graphics = new Graphics(colorTilesMC); var startX:Number = 0; var startY:Number = 0; var L:Number = getTileL(); var leftLine:Array = getLeftColumColors(); for(var y:Number=0; y<6*2; y++){ fillRect(g, startX, startY+y*L, new ASColor(leftLine[y])); } startX += L; for(var y:Number=0; y<6*2; y++){ fillRect(g, startX, startY+y*L, ASColor.BLACK); } startX += L; for(var t:Number=0; t<6; t++){ for(var x:Number=0; x<6; x++){ for(var y:Number=0; y<6; y++){ var c:ASColor = getTileColorByTXY(t, x, y); fillRect(g, startX + (t%3)*(6*L) + x*L, startY + Math.floor(t/3)*(6*L) + y*L, c); } } } } private function paintSelectionRect():Void{ var g:Graphics = new Graphics(selectionRectMC); g.drawRectangle(new Pen(ASColor.WHITE, 0), 0, 0, getTileL(), getTileL()); } private function fillRect(g:Graphics, x:Number, y:Number, c:ASColor):Void{ g.beginDraw(new Pen(ASColor.BLACK, 0)); g.beginFill(new SolidBrush(c)); g.rectangle(x, y, getTileL(), getTileL()); g.endFill(); g.endDraw(); } private function getColorTilesPaneSize():Dimension{ return new Dimension((3*6+2)*getTileL(), (2*6)*getTileL()); } private function getTileL():Number{ return 12; } //******************************************************************************* // Override these methods to easiy implement different look //****************************************************************************** public function addComponentColorSectionBar(com:Component):Void{ barRight.append(com); } private function createSelectedColorLabel():JLabel{ var label:JLabel = new JLabel(); var bb:BevelBorder = new BevelBorder(null, BevelBorder.LOWERED); bb.setThickness(1); label.setBorder(bb); return label; } private function createSelectedColorIcon():ColorRectIcon{ return new ColorRectIcon(38, 18, colorSwatches.getSelectedColor()); } private function createHexText():JTextField{ return new JTextField("#FFFFFF", 6); } private function createAlphaAdjuster():JAdjuster{ var adjuster:JAdjuster = new JAdjuster(4, JAdjuster.VERTICAL); adjuster.setValueTranslator( function(value:Number):String{ return Math.round(value) + "%"; }); adjuster.setValues(100, 0, 0, 100); return adjuster; } private function createNoColorButton():AbstractButton{ return new JButton(new NoColorIcon(16, 16)); } private function createColorTilesPane():JPanel{ var p:JPanel = new JPanel(); p.setBorder(null); //ensure there is no border there var size:Dimension = getColorTilesPaneSize(); size.change(1, 1); p.setPreferredSize(size); p.addEventListener(JPanel.ON_CREATED, __colorTilesPaneCreated, this); return p; } }
package { public class Foo { public function foo() : void { 5 * 1++$(EntryPoint) } } }
package com.pubnub.json { /** * Note: here uses univeral solution for fp 10- versions * try/catch consruction is more slow! * you can choose native or 3d party JSON libs for optimization. * * @author firsoff maxim, firsoffmaxim@gmail.com, icq : 235859730 */ public class PnJSON { static public function parse(text:String, reviver:Function = null):Object { try { return JSONNative.parse(text, reviver); }catch (err:Error) { // native JSON works with error here } return JSON3dParty.parse(text); } static public function stringify(value:Object, replacer:* = null, space:* = null):String { try { return JSONNative.stringify(value, replacer, space); }catch (err:Error) { // native JSON works with error here } return JSON3dParty.stringify(value); } } }
package com.lios.hangman.game.views.board { import com.lios.hangman.Constants; import com.lios.hangman.game.models.GameModel; import com.lios.hangman.game.views.ComponentView; import starling.events.Event; import starling.text.TextField; public class WordView extends ComponentView { private var textField:TextField; public function WordView(aModel:Object, aController:Object=null) { super(aModel, aController); // word text field textField = new TextField(600, 190, "", Constants.CHALK_FONT_NAME, Constants.FONT_SIZE, Constants.COLOR_YELLOW_FONT); textField.autoScale = true; this.addChild(textField); } override public function update(event:Event = null):void { // get data from model and update view textField.text = GameModel(model).wordShown; } } }
import menu_tree.mvctemplate.* import menu_tree.mvc.*; import menu_tree.util.*; import menu_tree.I.* class menu_tree.mvctemplate.BackgroundController extends AbstractItemController { public function BackgroundController (model:Observable) { super(model); } }
package Components { import flash.accessibility.*; import flash.debugger.*; import flash.display.*; import flash.errors.*; import flash.events.*; import flash.external.*; import flash.filters.*; import flash.geom.*; import flash.media.*; import flash.net.*; import flash.printing.*; import flash.profiler.*; import flash.system.*; import flash.text.*; import flash.ui.*; import flash.utils.*; import flash.utils.IExternalizable; import flash.xml.*; import mx.binding.*; import mx.containers.Box; import mx.containers.VBox; import mx.core.ClassFactory; import mx.core.DeferredInstanceFromClass; import mx.core.DeferredInstanceFromFunction; import mx.core.IDeferredInstance; import mx.core.IFactory; import mx.core.IPropertyChangeNotifier; import mx.core.mx_internal; import mx.styles.*; import mx.containers.HBox; import mx.controls.Button; import mx.containers.Box; import mx.controls.Label; import mx.containers.Canvas; public class DAGNode extends mx.containers.Box implements flash.utils.IExternalizable { public function DAGNode() {} [Bindable] public var assVbox : mx.containers.VBox; [Bindable] public var assRep : Array; [Bindable] public var operatorCombo : Array; public var _bindingsByDestination : Object; public var _bindingsBeginWithWord : Object; include "C:/Eclipse/workspace/catissuecore_Merge/flexclient/dag/Components/DAGNode.mxml:7,321"; }}
/* Copyright aswing.org, see the LICENCE.txt. */ package org.aswing.plaf.basic { import flash.events.Event; import flash.events.FocusEvent; import flash.events.MouseEvent; import flash.geom.Matrix; import org.aswing.*; import org.aswing.border.BevelBorder; import org.aswing.border.EmptyBorder; import org.aswing.colorchooser.JColorMixer; import org.aswing.colorchooser.PreviewColorIcon; import org.aswing.colorchooser.VerticalLayout; import org.aswing.event.*; import org.aswing.geom.*; import org.aswing.graphics.*; import org.aswing.plaf.BaseComponentUI; /** * @private */ public class BasicColorMixerUI extends BaseComponentUI { private var colorMixer:JColorMixer; private var mixerPanel:JPanel; private var HSMC:AWSprite; private var HSPosMC:AWSprite; private var LMC:AWSprite; private var LPosMC:AWSprite; private var previewColorLabel:JLabel; private var previewColorIcon:PreviewColorIcon; private var AAdjuster:JAdjuster; private var RAdjuster:JAdjuster; private var GAdjuster:JAdjuster; private var BAdjuster:JAdjuster; private var HAdjuster:JAdjuster; private var SAdjuster:JAdjuster; private var LAdjuster:JAdjuster; private var hexText:JTextField; public function BasicColorMixerUI(){ super(); } protected function getPropertyPrefix():String { return "ColorMixer."; } override public function installUI(c:Component):void{ colorMixer = JColorMixer(c); installDefaults(); installComponents(); installListeners(); } override public function uninstallUI(c:Component):void{ colorMixer = JColorMixer(c); uninstallDefaults(); uninstallComponents(); uninstallListeners(); } private function installDefaults():void{ var pp:String = getPropertyPrefix(); LookAndFeel.installColorsAndFont(colorMixer, pp); LookAndFeel.installBasicProperties(colorMixer, pp); LookAndFeel.installBorderAndBFDecorators(colorMixer, pp); } private function uninstallDefaults():void{ LookAndFeel.uninstallBorderAndBFDecorators(colorMixer); } private function installComponents():void{ mixerPanel = createMixerPanel(); previewColorLabel = createPreviewColorLabel(); previewColorIcon = createPreviewColorIcon(); previewColorLabel.setIcon(previewColorIcon); hexText = createHexTextField(); createAdjusters(); layoutComponents(); createHSAndL(); updateSectionVisibles(); } private function uninstallComponents():void{ colorMixer.removeAll(); } private function installListeners():void{ colorMixer.addEventListener(InteractiveEvent.STATE_CHANGED, __colorSelectionChanged); AAdjuster.addActionListener(__AAdjusterValueAction); AAdjuster.addStateListener(__AAdjusterValueChanged); RAdjuster.addActionListener(__RGBAdjusterValueAction); RAdjuster.addStateListener(__RGBAdjusterValueChanged); GAdjuster.addActionListener(__RGBAdjusterValueAction); GAdjuster.addStateListener(__RGBAdjusterValueChanged); BAdjuster.addActionListener(__RGBAdjusterValueAction); BAdjuster.addStateListener(__RGBAdjusterValueChanged); HAdjuster.addActionListener(__HLSAdjusterValueAction); HAdjuster.addStateListener(__HLSAdjusterValueChanged); LAdjuster.addActionListener(__HLSAdjusterValueAction); LAdjuster.addStateListener(__HLSAdjusterValueChanged); SAdjuster.addActionListener(__HLSAdjusterValueAction); SAdjuster.addStateListener(__HLSAdjusterValueChanged); hexText.addActionListener(__hexTextAction); hexText.getTextField().addEventListener(Event.CHANGE, __hexTextChanged); hexText.getTextField().addEventListener(FocusEvent.FOCUS_OUT, __hexTextAction); } private function uninstallListeners():void{ colorMixer.removeEventListener(InteractiveEvent.STATE_CHANGED, __colorSelectionChanged); } /** * Override this method to change different layout */ private function layoutComponents():void{ colorMixer.setLayout(new BorderLayout(0, 4)); var top:Container = SoftBox.createHorizontalBox(4, SoftBoxLayout.CENTER); top.append(mixerPanel); top.append(previewColorLabel); top.setUIElement(true); colorMixer.append(top, BorderLayout.NORTH); var bottom:Container = SoftBox.createHorizontalBox(4, SoftBoxLayout.CENTER); var p:Container = new JPanel(new VerticalLayout(VerticalLayout.RIGHT, 4)); p.append(createLabelToComponet(getALabel(), AAdjuster)); var cube:Component = new JPanel(); cube.setPreferredSize(p.getComponent(0).getPreferredSize()); p.append(cube); p.append(createLabelToComponet(getHexLabel(), hexText)); bottom.append(p); p = new JPanel(new VerticalLayout(VerticalLayout.RIGHT, 4)); p.append(createLabelToComponet(getRLabel(), RAdjuster)); p.append(createLabelToComponet(getGLabel(), GAdjuster)); p.append(createLabelToComponet(getBLabel(), BAdjuster)); bottom.append(p); p = new JPanel(new VerticalLayout(VerticalLayout.RIGHT, 4)); p.append(createLabelToComponet(getHLabel(), HAdjuster)); p.append(createLabelToComponet(getSLabel(), SAdjuster)); p.append(createLabelToComponet(getLLabel(), LAdjuster)); bottom.append(p); bottom.setUIElement(true); colorMixer.append(bottom, BorderLayout.SOUTH); } private function createLabelToComponet(label:String, component:Component):Container{ var p:JPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); p.append(new JLabel(label)); p.append(component); component.addEventListener(AWEvent.HIDDEN, function():void{ p.setVisible(false); }); component.addEventListener(AWEvent.SHOWN, function():void{ p.setVisible(true); }); return p; } //---------------------------------------------------------------------- private function getMixerPaneSize():IntDimension{ var crm:Number = getColorRectMargin()*2; var hss:IntDimension = getHSSize(); var ls:IntDimension = getLSize(); hss.change(crm, crm); ls.change(crm, crm); var size:IntDimension = new IntDimension(hss.width + getHS2LGap() + ls.width, Math.max(hss.height, ls.height)); size.change(getMCsMarginSize(), getMCsMarginSize()); return size; } private function getMCsMarginSize():int{ return 4; } private function getColorRectMargin():int{ return 1; } private function getHSSize():IntDimension{ return new IntDimension(120, 100); } private function getHS2LGap():int{ return 8; } private function getLSize():IntDimension{ return new IntDimension(40, 100); } private function getLStripWidth():int{ return 20; //half of getLSize().width } private function getSelectedColor():ASColor{ var c:ASColor = colorMixer.getSelectedColor(); if(c == null) return ASColor.BLACK; return c; } private function setSelectedColor(c:ASColor):void{ color_at_views = c; colorMixer.setSelectedColor(c); } private function updateMixerAllItems():void{ updateMixerAllItemsWithColor(getSelectedColor()); } private function getHFromPos(p:IntPoint):Number{ return (p.x - getHSColorsStartX()) / getHSSize().width; } private function getSFromPos(p:IntPoint):Number{ return 1 - ((p.y - getHSColorsStartY()) / getHSSize().height); } private function getLFromPos(p:IntPoint):Number{ return 1 - ((p.y - getLColorsStartY()) / getLSize().height); } private function getHAdjusterValueFromH(h:Number):Number{ return h * (HAdjuster.getMaximum()- HAdjuster.getMinimum()); } private function getSAdjusterValueFromS(s:Number):Number{ return s * (SAdjuster.getMaximum()- SAdjuster.getMinimum()); } private function getLAdjusterValueFromL(l:Number):Number{ return l * (LAdjuster.getMaximum()- LAdjuster.getMinimum()); } private function getHFromHAdjuster():Number{ return HAdjuster.getValue() / (HAdjuster.getMaximum()- HAdjuster.getMinimum()); } private var HAdjusterUpdating:Boolean; private function updateHAdjusterWithH(h:Number):void{ HAdjusterUpdating = true; HAdjuster.setValue(getHAdjusterValueFromH(h)); HAdjusterUpdating = false; } private function getSFromSAdjuster():Number{ return SAdjuster.getValue() / (SAdjuster.getMaximum()- SAdjuster.getMinimum()); } private var SAdjusterUpdating:Boolean; private function updateSAdjusterWithS(s:Number):void{ SAdjusterUpdating = true; SAdjuster.setValue(getSAdjusterValueFromS(s)); SAdjusterUpdating = false; } private function getLFromLAdjuster():Number{ return LAdjuster.getValue() / (LAdjuster.getMaximum()- LAdjuster.getMinimum()); } private var LAdjusterUpdating:Boolean; private function updateLAdjusterWithL(l:Number):void{ LAdjusterUpdating = true; LAdjuster.setValue(getLAdjusterValueFromL(l)); LAdjusterUpdating = false; } private var RAdjusterUpdating:Boolean; private function updateRAdjusterWithL(v:Number):void{ RAdjusterUpdating = true; RAdjuster.setValue(v); RAdjusterUpdating = false; } private var GAdjusterUpdating:Boolean; private function updateGAdjusterWithG(v:Number):void{ GAdjusterUpdating = true; GAdjuster.setValue(v); GAdjusterUpdating = false; } private var BAdjusterUpdating:Boolean; private function updateBAdjusterWithB(v:Number):void{ BAdjusterUpdating = true; BAdjuster.setValue(v); BAdjusterUpdating = false; } private function getAFromAAdjuster():Number{ return AAdjuster.getValue()/100; } private var AAdjusterUpdating:Boolean; private function updateAAdjusterWithA(v:Number):void{ AAdjusterUpdating = true; AAdjuster.setValue(v*100); AAdjusterUpdating = false; } private function getColorFromRGBAAdjusters():ASColor{ var rr:Number = RAdjuster.getValue(); var gg:Number = GAdjuster.getValue(); var bb:Number = BAdjuster.getValue(); return ASColor.getASColor(rr, gg, bb, getAFromAAdjuster()); } private function getColorFromHLSAAdjusters():ASColor{ var hh:Number = getHFromHAdjuster(); var ll:Number = getLFromLAdjuster(); var ss:Number = getSFromSAdjuster(); return HLSA2ASColor(hh, ll, ss, getAFromAAdjuster()); } //----------------------------------------------------------------------- override public function paint(c:Component, g:Graphics2D, b:IntRectangle):void{ super.paint(c, g, b); updateSectionVisibles(); updateMixerAllItems(); } private function updateSectionVisibles():void{ hexText.setVisible(colorMixer.isHexSectionVisible()); AAdjuster.setVisible(colorMixer.isAlphaSectionVisible()); } //------------------------------------------------------------------------ private function __AAdjusterValueChanged(e:Event):void{ if(!AAdjusterUpdating){ updatePreviewColorWithHSL(); } } private function __AAdjusterValueAction(e:Event):void{ colorMixer.setSelectedColor(getColorFromMCViewsAndAAdjuster()); } private function __RGBAdjusterValueChanged(e:Event):void{ if(RAdjusterUpdating || GAdjusterUpdating || BAdjusterUpdating){ return; } var color:ASColor = getColorFromRGBAAdjusters(); var hls:Object = getHLS(color); var hh:Number = hls.h; var ss:Number = hls.s; var ll:Number = hls.l; H_at_HSMC = hh; S_at_HSMC = ss; L_at_LMC = ll; color_at_views = color; updateHSLPosFromHLS(H_at_HSMC, L_at_LMC, S_at_HSMC); updateHexTextWithColor(color); updateHLSAdjustersWithHLS(hh, ll, ss); updatePreviewWithColor(color); } private function __RGBAdjusterValueAction(e:Event):void{ colorMixer.setSelectedColor(getColorFromRGBAAdjusters()); } private function __HLSAdjusterValueChanged(e:Event):void{ if(HAdjusterUpdating || LAdjusterUpdating || SAdjusterUpdating){ return; } H_at_HSMC = getHFromHAdjuster(); L_at_LMC = getLFromLAdjuster(); S_at_HSMC = getSFromSAdjuster(); var color:ASColor = HLSA2ASColor(H_at_HSMC, L_at_LMC, S_at_HSMC, getAFromAAdjuster()); color_at_views = color; updateHSLPosFromHLS(H_at_HSMC, L_at_LMC, S_at_HSMC); updateHexTextWithColor(color); updateRGBAdjustersWithColor(color); updatePreviewWithColor(color); } private function __HLSAdjusterValueAction(e:Event):void{ colorMixer.setSelectedColor(getColorFromHLSAAdjusters()); } private function __hexTextChanged(e:Event):void{ if(hexTextUpdating){ return; } var color:ASColor = getColorFromHexTextAndAdjuster(); var hls:Object = getHLS(color); var hh:Number = hls.h; var ss:Number = hls.s; var ll:Number = hls.l; H_at_HSMC = hh; S_at_HSMC = ss; L_at_LMC = ll; color_at_views = color; updateHSLPosFromHLS(H_at_HSMC, L_at_LMC, S_at_HSMC); updateHLSAdjustersWithHLS(hh, ll, ss); updateRGBAdjustersWithColor(color); updatePreviewWithColor(color); } private function __hexTextAction(e:Event):void{ colorMixer.setSelectedColor(getColorFromHexTextAndAdjuster()); } private var H_at_HSMC:Number; private var S_at_HSMC:Number; private var L_at_LMC:Number; private var color_at_views:ASColor; private function __colorSelectionChanged(e:Event):void{ var color:ASColor = getSelectedColor(); previewColorIcon.setColor(color); previewColorLabel.repaint(); if(!color.equals(color_at_views)){ updateMixerAllItemsWithColor(color); color_at_views = color; } } private function createHSAndL():void{ HSMC = new AWSprite(); HSPosMC = new AWSprite(); LMC = new AWSprite(); LPosMC = new AWSprite(); mixerPanel.addChild(HSMC); mixerPanel.addChild(HSPosMC); mixerPanel.addChild(LMC); mixerPanel.addChild(LPosMC); paintHSMC(); paintHSPosMC(); paintLMC(); paintLPosMC(); HSMC.addEventListener(MouseEvent.MOUSE_DOWN, __HSMCPress); HSMC.addEventListener(ReleaseEvent.RELEASE, __HSMCRelease); HSMC.addEventListener(ReleaseEvent.RELEASE_OUT_SIDE, __HSMCRelease); LMC.addEventListener(MouseEvent.MOUSE_DOWN, __LMCPress); LMC.addEventListener(ReleaseEvent.RELEASE, __LMCRelease); LMC.addEventListener(ReleaseEvent.RELEASE_OUT_SIDE, __LMCRelease); } private function __HSMCPress(e:Event):void{ HSMC.addEventListener(MouseEvent.MOUSE_MOVE, __HSMCDragging); __HSMCDragging(null); } private function __HSMCRelease(e:Event):void{ HSMC.removeEventListener(MouseEvent.MOUSE_MOVE, __HSMCDragging); countHSWithMousePosOnHSMCAndUpdateViews(); setSelectedColor(getColorFromMCViewsAndAAdjuster()); } private function __HSMCDragging(e:Event):void{ countHSWithMousePosOnHSMCAndUpdateViews(); } private function __LMCPress(e:Event):void{ LMC.addEventListener(MouseEvent.MOUSE_MOVE, __LMCDragging); __LMCDragging(null); } private function __LMCRelease(e:Event):void{ LMC.removeEventListener(MouseEvent.MOUSE_MOVE, __LMCDragging); countLWithMousePosOnLMCAndUpdateViews(); setSelectedColor(getColorFromMCViewsAndAAdjuster()); } private function __LMCDragging(e:Event):void{ countLWithMousePosOnLMCAndUpdateViews(); } private function countHSWithMousePosOnHSMCAndUpdateViews():void{ var p:IntPoint = mixerPanel.getMousePosition(); var hs:Object = getHSWithPosOnHSMC(p); HSPosMC.x = p.x; HSPosMC.y = p.y; var h:Number = hs.h; var s:Number = hs.s; H_at_HSMC = h; S_at_HSMC = s; updateOthersWhenHSMCAdjusting(); } private function getHSWithPosOnHSMC(p:IntPoint):Object{ var hsSize:IntDimension = getHSSize(); var minX:Number = getHSColorsStartX(); var maxX:Number = minX + hsSize.width; var minY:Number = getHSColorsStartY(); var maxY:Number = minY + hsSize.height; p.x = Math.max(minX, Math.min(maxX, p.x)); p.y = Math.max(minY, Math.min(maxY, p.y)); var h:Number = getHFromPos(p); var s:Number = getSFromPos(p); return {h:h, s:s}; } private function countLWithMousePosOnLMCAndUpdateViews():void{ var p:IntPoint = mixerPanel.getMousePosition(); var ll:Number = getLWithPosOnLMC(p); LPosMC.y = p.y; L_at_LMC = ll; updateOthersWhenLMCAdjusting(); } private function getLWithPosOnLMC(p:IntPoint):Number{ var lSize:IntDimension = getLSize(); var minY:Number = getLColorsStartY(); var maxY:Number = minY + lSize.height; p.y = Math.max(minY, Math.min(maxY, p.y)); return getLFromPos(p); } private function getColorFromMCViewsAndAAdjuster():ASColor{ return HLSA2ASColor(H_at_HSMC, L_at_LMC, S_at_HSMC, getAFromAAdjuster()); } private function updatePreviewColorWithHSL():void{ updatePreviewWithColor(getColorFromMCViewsAndAAdjuster()); } private function updatePreviewWithColor(color:ASColor):void{ previewColorIcon.setCurrentColor(color); previewColorLabel.repaint(); colorMixer.getModel().fireColorAdjusting(color); } private function updateOthersWhenHSMCAdjusting():void{ paintLMCWithHS(H_at_HSMC, S_at_HSMC); var color:ASColor = getColorFromMCViewsAndAAdjuster(); updateHexTextWithColor(color); updateHLSAdjustersWithHLS(H_at_HSMC, L_at_LMC, S_at_HSMC); updateRGBAdjustersWithColor(color); updatePreviewWithColor(color); } private function updateOthersWhenLMCAdjusting():void{ var color:ASColor = getColorFromMCViewsAndAAdjuster(); updateHexTextWithColor(color); LAdjuster.setValue(getLAdjusterValueFromL(L_at_LMC)); updateRGBAdjustersWithColor(color); updatePreviewWithColor(color); } //******************************************************************************* // Override these methods to easiy implement different look //****************************************************************************** private function getALabel():String{ return "Alpha:"; } private function getRLabel():String{ return "R:"; } private function getGLabel():String{ return "G:"; } private function getBLabel():String{ return "B:"; } private function getHLabel():String{ return "H:"; } private function getSLabel():String{ return "S:"; } private function getLLabel():String{ return "L:"; } private function getHexLabel():String{ return "#"; } private function updateMixerAllItemsWithColor(color:ASColor):void{ var hls:Object = getHLS(color); var hh:Number = hls.h; var ss:Number = hls.s; var ll:Number = hls.l; H_at_HSMC = hh; S_at_HSMC = ss; L_at_LMC = ll; updateHSLPosFromHLS(hh, ll, ss); previewColorIcon.setColor(color); previewColorLabel.repaint(); updateRGBAdjustersWithColor(color); updateHLSAdjustersWithHLS(hh, ll, ss); updateAlphaAdjusterWithColor(color); updateHexTextWithColor(color); } private function updateHSLPosFromHLS(hh:Number, ll:Number, ss:Number):void{ var hsSize:IntDimension = getHSSize(); HSPosMC.x = hh*hsSize.width + getHSColorsStartX(); HSPosMC.y = (1-ss)*hsSize.height + getHSColorsStartY(); paintLMCWithHS(hh, ss); LPosMC.y = getLColorsStartY() + (1-ll)*getLSize().height; } private function updateRGBAdjustersWithColor(color:ASColor):void{ updateRAdjusterWithL(color.getRed()); updateGAdjusterWithG(color.getGreen()); updateBAdjusterWithB(color.getBlue()); } private function updateHLSAdjustersWithHLS(h:Number, l:Number, s:Number):void{ updateHAdjusterWithH(h); updateLAdjusterWithL(l); updateSAdjusterWithS(s); } private function updateAlphaAdjusterWithColor(color:ASColor):void{ updateAAdjusterWithA(color.getAlpha()); } private var hexTextColor:ASColor; private var hexTextUpdating:Boolean; private function updateHexTextWithColor(color:ASColor):void{ if(!color.equals(hexTextColor)){ hexTextColor = color; var hex:String; if(color == null){ hex = "000000"; }else{ hex = color.getRGB().toString(16); } for(var i:Number=6-hex.length; i>0; i--){ hex = "0" + hex; } hex = hex.toUpperCase(); hexTextUpdating = true; hexText.setText(hex); hexTextUpdating = false; } } private function getColorFromHexTextAndAdjuster():ASColor{ var text:String = hexText.getText(); var rgb:Number = parseInt("0x" + text); return new ASColor(rgb, getAFromAAdjuster()); } private function getHSColorsStartX():Number{ return getMCsMarginSize() + getColorRectMargin(); } private function getHSColorsStartY():Number{ return getMCsMarginSize() + getColorRectMargin(); } private function getLColorsStartY():Number{ return getMCsMarginSize() + getColorRectMargin(); } //private function getLColorsStartX():Number{ // return getHSSize().width + getMCsMarginSize() + getColorRectMargin()*2 + getHS2LGap(); //} private function paintHSMC():void{ HSMC.graphics.clear(); var g:Graphics2D = new Graphics2D(HSMC.graphics); var offset:Number = getMCsMarginSize(); var thickness:Number = getColorRectMargin(); var hsSize:IntDimension = getHSSize(); var H:Number = hsSize.width; var S:Number = hsSize.height; var w:Number = H+thickness*2; var h:Number = S+thickness*2; g.drawLine(new Pen(ASColor.GRAY, thickness), offset+thickness/2, offset+thickness/2, offset+w-thickness, offset+thickness/2); g.drawLine(new Pen(ASColor.GRAY, 1), offset+thickness/2, offset+thickness/2, offset+thickness/2, offset+h-thickness); offset += thickness; var colors:Array = [0, 0x808080]; var alphas:Array = [1, 1]; var ratios:Array = [0, 255]; var matrix:Matrix = new Matrix(); matrix.createGradientBox(1, S, (90/180)*Math.PI, offset, 0); var brush:GradientBrush = new GradientBrush(GradientBrush.LINEAR, colors, alphas, ratios, matrix); for(var x:Number=0; x<H; x++){ var pc:ASColor = HLSA2ASColor(x/H, 0.5, 1, 100); colors[0] = pc.getRGB(); matrix.tx = x+offset; g.fillRectangle(brush, x+offset, offset, 1, S); } } private function paintHSPosMC():void{ HSPosMC.graphics.clear(); var g:Graphics2D = new Graphics2D(HSPosMC.graphics); g.drawLine(new Pen(ASColor.BLACK, 2), -6, 0, -3, 0); g.drawLine(new Pen(ASColor.BLACK, 2), 6, 0, 3, 0); g.drawLine(new Pen(ASColor.BLACK, 2), 0, -6, 0, -3); g.drawLine(new Pen(ASColor.BLACK, 2), 0, 6, 0, 3); } private function paintLMCWithHS(hh:Number, ss:Number):void{ LMC.graphics.clear(); var g:Graphics2D = new Graphics2D(LMC.graphics); var x:Number = getHSSize().width + getMCsMarginSize() + getColorRectMargin()*2 + getHS2LGap(); var y:Number = getMCsMarginSize(); var thickness:Number = getColorRectMargin(); var lSize:IntDimension = getLSize(); var w:Number = getLStripWidth() + thickness*2; var h:Number = lSize.height + thickness*2; g.drawLine(new Pen(ASColor.GRAY, thickness), x+thickness/2, y+thickness/2, x+w-thickness, y+thickness/2); g.drawLine(new Pen(ASColor.GRAY, 1), x+thickness/2, y+thickness/2, x+thickness/2, y+h-thickness); x += thickness; y += thickness; w = getLStripWidth(); h = lSize.height; var colors:Array = [0xFFFFFF, HLSA2ASColor(hh, 0.5, ss, 100).getRGB(), 0]; var alphas:Array = [1, 1, 1]; var ratios:Array = [0, 127.5, 255]; var matrix:Matrix = new Matrix(); matrix.createGradientBox(w, h, (90/180)*Math.PI, x, y); var brush:GradientBrush = new GradientBrush(GradientBrush.LINEAR, colors, alphas, ratios, matrix); g.fillRectangle(brush, x, y, w, h); } private function paintLMCWithColor(color:ASColor):void{ var hls:Object = getHLS(color); var hh:Number = hls.h; var ss:Number = hls.s; paintLMCWithHS(hh, ss); } private function paintLMC():void{ paintLMCWithColor(getSelectedColor()); } private function paintLPosMC():void{ LPosMC.graphics.clear(); var g:Graphics2D = new Graphics2D(LPosMC.graphics); g.fillPolygon(new SolidBrush(ASColor.BLACK), [ new IntPoint(0, 0), new IntPoint(4, -4), new IntPoint(4, 4)]); LPosMC.x = getHSSize().width + getMCsMarginSize() + getColorRectMargin()*2 + getHS2LGap() + getLStripWidth() + 1; } private function createMixerPanel():JPanel{ var p:JPanel = new JPanel(); p.setBorder(null); //esure there is no border p.setPreferredSize(getMixerPaneSize()); return p; } private function createPreviewColorIcon():PreviewColorIcon{ return new PreviewColorIcon(46, 100, PreviewColorIcon.VERTICAL); } private function createPreviewColorLabel():JLabel{ var label:JLabel = new JLabel(); var margin:Number = getMCsMarginSize(); var bb:BevelBorder = new BevelBorder(null, BevelBorder.LOWERED); bb.setThickness(1); label.setBorder(new EmptyBorder(bb, new Insets(margin, 0, margin, 0))); return label; } private function createHexTextField():JTextField{ return new JTextField("000000", 6); } private function createAdjusters():void{ AAdjuster = createAAdjuster(); RAdjuster = createRAdjuster(); GAdjuster = createGAdjuster(); BAdjuster = createBAdjuster(); HAdjuster = createHAdjuster(); SAdjuster = createSAdjuster(); LAdjuster = createLAdjuster(); } private function createAAdjuster():JAdjuster{ var adjuster:JAdjuster = new JAdjuster(4, JAdjuster.VERTICAL); adjuster.setValueTranslator( function(value:Number):String{ return Math.round(value) + "%"; }); adjuster.setValues(100, 0, 0, 100); return adjuster; } private function createRAdjuster():JAdjuster{ var adjuster:JAdjuster = new JAdjuster(4, JAdjuster.VERTICAL); adjuster.setValues(255, 0, 0, 255); return adjuster; } private function createGAdjuster():JAdjuster{ var adjuster:JAdjuster = new JAdjuster(4, JAdjuster.VERTICAL); adjuster.setValues(255, 0, 0, 255); return adjuster; } private function createBAdjuster():JAdjuster{ var adjuster:JAdjuster = new JAdjuster(4, JAdjuster.VERTICAL); adjuster.setValues(255, 0, 0, 255); return adjuster; } private function createHAdjuster():JAdjuster{ var adjuster:JAdjuster = new JAdjuster(4, JAdjuster.VERTICAL); adjuster.setValues(0, 0, 0, 360); adjuster.setValueTranslator( function(value:Number):String{ return Math.round(value) + "°"; }); return adjuster; } private function createSAdjuster():JAdjuster{ var adjuster:JAdjuster = new JAdjuster(4, JAdjuster.VERTICAL); adjuster.setValues(0, 0, 0, 100); adjuster.setValueTranslator( function(value:Number):String{ return Math.round(value) + "%"; }); return adjuster; } private function createLAdjuster():JAdjuster{ var adjuster:JAdjuster = new JAdjuster(4, JAdjuster.VERTICAL); adjuster.setValues(0, 0, 0, 100); adjuster.setValueTranslator( function(value:Number):String{ return Math.round(value) + "%"; }); return adjuster; } //----------------Tool functions-------------------- private static function getHLS(color:ASColor):Object{ var rr:Number = color.getRed()/255; var gg:Number = color.getGreen()/255; var bb:Number = color.getBlue()/255; var hls:Object = rgb2Hls(rr, gg, bb); return hls; } /** * H, L, S -> [0, 1], alpha -> [0, 100] */ private static function HLSA2ASColor(H:Number, L:Number, S:Number, alpha:Number):ASColor{ var p1:Number, p2:Number, r:Number, g:Number, b:Number; p1 = p2 = 0; H = H*360; if(L<0.5){ p2=L*(1+S); }else{ p2=L + S - L*S; } p1=2*L-p2; if(S==0){ r=L; g=L; b=L; }else{ r = hlsValue(p1, p2, H+120); g = hlsValue(p1, p2, H); b = hlsValue(p1, p2, H-120); } r *= 255; g *= 255; b *= 255; return ASColor.getASColor(r, g, b, alpha); } private static function hlsValue(p1:Number, p2:Number, h:Number):Number{ if (h > 360) h = h - 360; if (h < 0) h = h + 360; if (h < 60 ) return p1 + (p2-p1)*h/60; if (h < 180) return p2; if (h < 240) return p1 + (p2-p1)*(240-h)/60; return p1; } private static function rgb2Hls(rr:Number, gg:Number, bb:Number):Object{ // Static method to compute HLS from RGB. The r,g,b triplet is between // [0,1], h, l, s are [0,1]. var rnorm:Number, gnorm:Number, bnorm:Number; var minval:Number, maxval:Number, msum:Number, mdiff:Number; var r:Number, g:Number, b:Number; var hue:Number, light:Number, satur:Number; r = g = b = 0; if (rr > 0) r = rr; if (r > 1) r = 1; if (gg > 0) g = gg; if (g > 1) g = 1; if (bb > 0) b = bb; if (b > 1) b = 1; minval = r; if (g < minval) minval = g; if (b < minval) minval = b; maxval = r; if (g > maxval) maxval = g; if (b > maxval) maxval = b; rnorm = gnorm = bnorm = 0; mdiff = maxval - minval; msum = maxval + minval; light = 0.5 * msum; if (maxval != minval) { rnorm = (maxval - r)/mdiff; gnorm = (maxval - g)/mdiff; bnorm = (maxval - b)/mdiff; } else { satur = hue = 0; return {h:hue, l:light, s:satur}; } if (light < 0.5) satur = mdiff/msum; else satur = mdiff/(2.0 - msum); if (r == maxval) hue = 60.0 * (6.0 + bnorm - gnorm); else if (g == maxval) hue = 60.0 * (2.0 + rnorm - bnorm); else hue = 60.0 * (4.0 + gnorm - rnorm); if (hue > 360) hue = hue - 360; hue/=360; return {h:hue, l:light, s:satur}; } } }
package { import com.ncreated.ai.potentialfields.PFAgent; import com.ncreated.ai.potentialfields.PFDynamicPotentialsMap; import com.ncreated.ai.potentialfields.PFPotentialField; import com.ncreated.ai.potentialfields.PFRadialPotentialField; import com.ncreated.ai.potentialfields.PFRectangularPotentialField; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; /** * Demo: basic usage of potential fields library. * * @author maciek grzybowski, 23.08.2013 03:29 * */ [SWF(width='400', height='300', backgroundColor='#ffffff', frameRate='10')] public class HelloPotentials extends Sprite { private var _debugBitmap:Bitmap; private var _map:PFDynamicPotentialsMap; private var _field:PFRadialPotentialField; private var _agent:PFAgent; public function HelloPotentials() { addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true); } private function init(event:Event):void { stage.addEventListener(Event.ENTER_FRAME, onEnterFrame, false, 0, true); stage.addEventListener(MouseEvent.CLICK, onMouseClick, false, 0, true); const TILE_SIZE:int = 4; const MAP_WIDTH:int = Math.ceil(stage.stageWidth / TILE_SIZE); const MAP_HEIGHT:int = Math.ceil(stage.stageHeight / TILE_SIZE); /* Create attracting potential field. */ _field = new PFRadialPotentialField(); _field.type = PFPotentialField.PF_TYPE_ATTRACT; _field.potential = 250; _field.gradation = 5; _field.position.setTo(MAP_WIDTH * 0.5, MAP_HEIGHT * 0.5); /* Create potentials map. */ _map = new PFDynamicPotentialsMap(MAP_WIDTH, MAP_HEIGHT); /* Add field to the map. */ _map.addPotentialField(_field); /* Create an agent. */ _agent = new PFAgent(); _agent.position.setTo(80, 50); /* Add map to the agent (let him move on it!). */ _agent.addDynamicPotentialsMap(_map); /* Create an obstacle. */ var obstacle:PFRectangularPotentialField = new PFRectangularPotentialField(2, 2); obstacle.type = PFPotentialField.PF_TYPE_REPEL; obstacle.position.setTo(40, 45); obstacle.potential = 250; obstacle.gradation = 100; /* Add obstacle to the map. */ _map.addPotentialField(obstacle); // Just for debug purposes: /* Create debug bitmap. */ _debugBitmap = new Bitmap(new BitmapData(MAP_WIDTH, MAP_HEIGHT)); _debugBitmap.scaleX = stage.stageWidth / MAP_WIDTH; _debugBitmap.scaleY = stage.stageHeight/ MAP_HEIGHT; addChild(_debugBitmap); } private function onEnterFrame(event:Event):void { /* Move an agent. */ if (_agent) { _agent.moveToPositionPoint(_agent.nextPosition()); } // Just for debug purposes: /* Clear debug drawing. */ _debugBitmap.bitmapData.fillRect(_debugBitmap.bitmapData.rect, 0xFFFFFF); /* Draw map's potentials. */ _map.debugDrawPotentials(_debugBitmap.bitmapData); /* Draw agent's position. */ _debugBitmap.bitmapData.setPixel32(_agent.position.x, _agent.position.y, 0xFF0000FF); } private function onMouseClick(event:MouseEvent):void { /* Reset agent position to mouse position. */ _agent.position.setTo( (stage.mouseX / stage.stageWidth) * _debugBitmap.bitmapData.width, (stage.mouseY / stage.stageHeight) * _debugBitmap.bitmapData.height ); } } }
/** * Copyright 2008 Marvin Herman Froeder * 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.sonatype.flexmojos.todolist.domain { [Bindable] [RemoteClass(alias="org.sonatype.flexmojos.todolist.domain.TodoItem")] public class TodoItem extends TodoItemBase { } }
// ================================================================================================= // // Flox AS3 // Copyright 2012 Gamua OG. All Rights Reserved. // // ================================================================================================= package com.gamua.flox { import com.gamua.flox.utils.createUID; import flash.net.SharedObject; /** A queue that uses SharedObjects to save its contents to the disk. Objects are serialized * using the AMF format, so be sure to use either primitive objects or classes to provide an * empty constructor and r/w properties. */ internal class PersistentQueue { private var mName:String; private var mIndex:SharedObject; /** Create a persistent queue with a certain name. If the name was already used in a * previous session, the existing queue is restored. */ public function PersistentQueue(name:String) { mName = name; mIndex = SharedObjectPool.getObject(mName); if (!("elements" in mIndex.data)) mIndex.data.elements = []; if ("keys" in mIndex.data) { // migrate to new index system (can be removed in a future version) for each (var key:String in mIndex.data.keys) mIndex.data.elements.push({ name: key, meta: null }); delete mIndex.data["keys"]; } } /** Insert an object at the beginning of the queue. * You can optionally add meta data that is stored in the index file. */ public function enqueue(object:Object, metaData:Object=null):void { var name:String = createUID(); var sharedObject:SharedObject = SharedObjectPool.getObject(name); sharedObject.data.value = object; mIndex.data.elements.unshift({ name: name, meta: metaData }); } /** Remove the object at the head of the queue. * If the queue is empty, this method returns null. */ public function dequeue():Object { return getHead(true); } /** Returns the object at the head of the queue (without removing it). * If the queue is empty, this method returns null. */ public function peek():Object { return getHead(false); } /** Removes all elements from the queue. */ public function clear():void { while (dequeue()) {}; } /** Saves the current state of the queue to the disk. */ public function flush():void { mIndex.flush(); } /** Executes a callback for each queue element. If the callback returns 'false', * the object will be removed from the queue. Callback definition: * <pre>function(index:int, metaData:Object):Boolean;</pre> */ public function filter(callback:Function):void { mIndex.data.elements = mIndex.data.elements.filter( function (element:Object, index:int, array:Array):Boolean { var keep:Boolean = callback(index, element.meta); if (!keep) SharedObjectPool.getObject(element.name).clear(); return keep; }); } private function getHead(removeHead:Boolean):Object { var elements:Array = mIndex.data.elements; if (elements.length == 0) return null; var name:String = elements[elements.length-1].name; var sharedObject:SharedObject = SharedObjectPool.getObject(name); var head:Object = sharedObject.data.value; if (head == null) { // shared object was deleted! remove object and try again elements.pop(); head = getHead(removeHead); } else { if (removeHead) { elements.pop(); sharedObject.clear(); } } return head; } /** Returns the number of elements in the queue. */ public function get length():int { return mIndex.data.elements.length; } /** Returns the name of the queue as it was provided in the constructor. */ public function get name():String { return mName; } } }
package { import F4SE.ICodeObject; import F4SE.XSE; import System.Diagnostics.Debug; import System.UI.MenuType; import flash.display.MovieClip; public class ScopeClient extends MenuType implements F4SE.ICodeObject { // Host public var ScopeMenu:MovieClip; private const Name:String = "ScopeMenu"; // the parent menu name // Stage Instance public var Controller:MovieClip; // Client private const ClientLoadedCallback:String = "SystemScopeMenu_ClientLoadedCallback"; // Loader private var Scope:ScopeLoader; private var ScopeFrame:int = 0; private const MountID:String = "ScopeMenu_ImageMount"; // Initialize //--------------------------------------------- public function ScopeClient() { Debug.Prefix = "System:UI:Scope"; super(); Debug.WriteLine("[ScopeClient]", "(ctor)", "Constructor Code", this.loaderInfo.url); } // @F4SE.ICodeObject public function onF4SEObjCreated(codeObject:*):void { F4SE.XSE.API = codeObject; Debug.WriteLine("[ScopeClient]", "(onF4SEObjCreated)"); } } }
/* Class:ExtendedChars * @author Ryan C. Knaggs * @date 11/19/2009 * @since 1.0 * @version 1.0 * @description: The Flex htmlText property * for the text field and labels components * sometimes will not understand the * symbol set for displaying the ASCII Extended * charater set for international characters * This class will intercept the html text data * and change the HTML symbols to properly work * with the flex text fields to propertly display * any internation character set * @see GlobalsVO */ package libs.utils { import libs.vo.GlobalsVO; public class ExtendedChars { private var _str:String; public function ExtendedChars() { } public function convertHTML(str:String):String { if(str == null || str == "undefined") return str; this._str = str; var convert:Array = GlobalsVO.htmlSymbols; for(var i:int=0; i<convert.length; ++i) { this._str = _str.replace(new RegExp(convert[i].from,"gi"), convert[i].to); } return _str; } public function convertWord(str:String):String { if(str == null || str == "undefined") return str; this._str = str; var convert:Array = GlobalsVO.wordSymbols; for(var i:int=0; i<convert.length; ++i) { this._str = _str.replace(new RegExp(convert[i].from,"gi"), convert[i].to); } return _str; } } }
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2013 CodeCatalyst, LLC - http://www.codecatalyst.com/ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. //////////////////////////////////////////////////////////////////////////////// package com.codecatalyst.promise { import com.codecatalyst.util.optionally; /** * Consequences are used internally by a Resolver to capture and notify * callbacks, and propagate their transformed results as fulfillment or * rejection. * * Developers never directly interact with a Consequence. * * A Consequence forms a chain between two Resolvers, where the result of * the first Resolver is transformed by the corresponding callback before * being applied to the second Resolver. * * Each time a Resolver's then() method is called, it creates a new * Consequence that will be triggered once its originating Resolver has * been fulfilled or rejected. A Consequence captures a pair of optional * onFulfilled and onRejected callbacks. * * Each Consequence has its own Resolver (which in turn has a Promise) * that is resolved or rejected when the Consequence is triggered. When a * Consequence is triggered by its originating Resolver, it calls the * corresponding callback and propagates the transformed result to its own * Resolver; resolved with the callback return value or rejected with any * error thrown by the callback. */ internal class Consequence { // ======================================== // Public properties // ======================================== /** * Promise of the future value of this Consequence. */ public function get promise():Promise { return resolver.promise; } // ======================================== // Private properties // ======================================== /** * Internal Resolver for this Consequence. */ private var resolver:Resolver = null; /** * Callback to execute when this Consequence is triggered with a fulfillment value. */ private var onFulfilled:Function = null; /** * Callback to execute when this Consequence is triggered with a rejection reason. */ private var onRejected:Function = null; // ======================================== // Constructor // ======================================== /** * Constructor. * * @param onFulfilled Callback to execute to transform a fulfillment value. * @param onRejected Callback to execute to transform a rejection reason. */ public function Consequence( onFulfilled:Function, onRejected:Function ) { this.onFulfilled = onFulfilled; this.onRejected = onRejected; this.resolver = new Resolver(); } // ======================================== // Public methods // ======================================== /** * Trigger this Consequence with the specified action and value. * * @param action Completion action (i.e. CompletionAction.FULFILL or CompletionAction.REJECT). * @param value Fulfillment value or rejection reason. */ public function trigger( action:String, value:* ):void { switch ( action ) { case CompletionAction.FULFILL: propagate( value, onFulfilled, resolver.resolve ); break; case CompletionAction.REJECT: propagate( value, onRejected, resolver.reject ); break; } } // ======================================== // Private methods // ======================================== /** * Propagate the specified value using either the optional callback or * a Resolver method. * * @param value Value to transform and/or propagate. * @param callback (Optional) callback to use to transform the value. * @param resolverMethod Resolver method to call to propagate the value, if no callback was specified. */ private function propagate( value:*, callback:Function, resolverMethod:Function ):void { if ( callback is Function ) { schedule( transform, [ value, callback ] ); } else { resolverMethod.call( resolver, value ); } } /** * Transform the specified value using the specified callback and * propagate the transformed result. * * @param value Value to transform. * @param callback Callback to execute to transform the value. */ private function transform( value:*, callback:Function ):void { try { resolver.resolve( optionally( callback, [ value ] ) ); } catch ( error:* ) { resolver.reject( error ); } } /** * Schedules the specified callback function to be executed on * the next turn of the event loop. * * @param callback Callback function. * @param parameters Optional parameters to pass to the callback function. */ private function schedule( callback:Function, parameters:Array = null ):void { CallbackQueue.instance.schedule( callback, parameters ); } } } import flash.utils.clearInterval; import flash.utils.setInterval; /** * Used to queue callbacks for execution on the next turn of the event loop (using a single Array instance and timer). * * @private */ class CallbackQueue { // ======================================== // Public properties // ======================================== /** * Singleton instance accessor. */ public static const instance:CallbackQueue = new CallbackQueue(); // ======================================== // Protected properties // ======================================== /** * Queued Callback(s). */ protected const queuedCallbacks:Array = new Array(1e4); /** * Interval identifier. */ protected var intervalId:int = 0; /** * # of pending callbacks. */ protected var queuedCallbackCount:uint = 0; // ======================================== // Constructor // ======================================== public function CallbackQueue() { super(); } // ======================================== // Public methods // ======================================== /** * Add a callback to the end of the queue, to be executed on the next turn of the event loop. * * @param callback Callback function. * @param parameters Optional parameters to pass to the callback function. */ public function schedule( callback:Function, parameters:Array = null ):void { queuedCallbacks[ queuedCallbackCount++ ] = new Callback( callback, parameters ); if ( queuedCallbackCount == 1 ) { intervalId = setInterval( execute, 0 ); } } // ======================================== // Protected methods // ======================================== /** * Execute any queued callbacks and clear the queue. */ protected function execute():void { clearInterval( intervalId ); var index:uint = 0; while ( index < queuedCallbackCount ) { (queuedCallbacks[ index ] as Callback).execute(); queuedCallbacks[ index ] = null; index++; } queuedCallbackCount = 0; } } /** * Used to capture a callback closure, along with optional parameters. * * @private */ class Callback { // ======================================== // Protected properties // ======================================== /** * Callback closure. */ protected var closure:Function; /** * Callback parameters. */ protected var parameters:Array; // ======================================== // Constructor // ======================================== public function Callback( closure:Function, parameters:Array = null ) { super(); this.closure = closure; this.parameters = parameters; } // ======================================== // Public methods // ======================================== /** * Execute this callback. */ public function execute():void { closure.apply( null, parameters ); } }
package com.rockdot.plugin.ugc.command { import com.rockdot.core.mvc.RockdotEvent; import com.rockdot.plugin.ugc.model.vo.UGCGameVO; public class GamingSaveGameCommand extends AbstractUGCCommand { override public function execute(event : RockdotEvent = null) : * { super.execute(event); var vo : UGCGameVO = event.data; vo.uid = _ugcModel.userDAO.uid; amfOperation("GamingEndpoint.saveGame", vo); } override public function dispatchCompleteEvent(result : * = null) : Boolean { return super.dispatchCompleteEvent(); } } }
/* Copyright aswing.org, see the LICENCE.txt. */ import GUI.fox.aswing.ToggleButtonModel; /** * The RadioButton model * @author Igor Sadovskiy */ class GUI.fox.aswing.RadioButtonModel extends ToggleButtonModel{ /** * Creates a new RadioButton Model */ public function RadioButtonModel() { super(); allowUnselectAllInGroup = false; } }
package math { public class SimpleMath { public function add( n1:Number, n2:Number ):Number { return (n1+n2); } public function subtract( n1:Number, n2:Number ):Number { return (n1-n2); } public function multiply( n1:Number, n2:Number ):Number { return (n1*n2); } public function divide( n1:Number, n2:Number ):Number { return (n1/n2); } } }
/* Copyright aswing.org, see the LICENCE.txt. */ package org.aswing.lookandfeel.plaf.basic { import org.aswing.components.Component; import org.aswing.event.FocusKeyEvent; import org.aswing.geom.IntRectangle; import org.aswing.JSlider; import org.aswing.plaf.BaseComponentUI; import org.aswing.plaf.SliderUI; import org.aswing.util.ASTimer; import org.aswing.values.ASColor; import org.aswing.values.Insets; import org.aswing.decorators.Icon; import starling.display.Shape; import flash.events.*; import flash.ui.Keyboard; /** * Basic slider ui imp. * @author iiley * @private */ public class BasicSliderUI extends BaseComponentUI implements SliderUI { protected var slider:JSlider; protected var thumbIcon:Icon; protected var progressColor:ASColor; protected var trackRect:IntRectangle; protected var trackDrawRect:IntRectangle; protected var tickRect:IntRectangle; protected var thumbRect:IntRectangle; private var offset:int; private var isDragging:Boolean; private var scrollIncrement:int; private var scrollContinueDestination:int; private var scrollTimer:ASTimer; private static var scrollSpeedThrottle:Number = 60; // delay in milli seconds private static var initialScrollSpeedThrottle:Number = 500; // first delay in milli seconds protected var trackCanvas:Shape; protected var progressCanvas:Shape; public function BasicSliderUI() { super(); trackRect = new IntRectangle(); tickRect = new IntRectangle(); thumbRect = new IntRectangle(); trackDrawRect = new IntRectangle(); offset = 0; isDragging = false; } protected function getPropertyPrefix():String { return "Slider."; } override public function installUI(c:Component):void { slider = JSlider(c); installDefaults(); installComponents(); installListeners(); } override public function uninstallUI(c:Component):void { slider = JSlider(c); uninstallDefaults(); uninstallComponents(); uninstallListeners(); } protected function installDefaults():void { var pp:String = getPropertyPrefix(); LookAndFeel.installColorsAndFont(slider, pp); LookAndFeel.installBasicProperties(slider, pp); LookAndFeel.installBorderAndBFDecorators(slider, pp); configureSliderColors(); } protected function configureSliderColors():void { var pp:String = getPropertyPrefix(); progressColor = getColor(pp + "progressColor"); } protected function uninstallDefaults():void { LookAndFeel.uninstallBorderAndBFDecorators(slider); } protected function installComponents():void { var pp:String = getPropertyPrefix(); thumbIcon = getIcon(pp + "thumbIcon"); if (thumbIcon.getDisplay(slider) == null) { throw new Error("Slider thumb icon must has its own display object(getDisplay()!=null)!"); } trackCanvas = new Shape(); progressCanvas = new Shape(); slider.addChild(trackCanvas); slider.addChild(progressCanvas); slider.addChild(thumbIcon.getDisplay(slider)); } protected function uninstallComponents():void { slider.removeChild(trackCanvas); slider.removeChild(progressCanvas); slider.removeChild(thumbIcon.getDisplay(slider)); thumbIcon = null; progressCanvas = null; trackCanvas = null; } protected function installListeners():void { slider.addEventListener(MouseEvent.MOUSE_DOWN, __onSliderPress); slider.addEventListener(ReleaseEvent.RELEASE, __onSliderReleased); slider.addEventListener(MouseEvent.MOUSE_WHEEL, __onSliderMouseWheel); slider.addStateListener(__onSliderStateChanged); slider.addEventListener(FocusKeyEvent.FOCUS_KEY_DOWN, __onSliderKeyDown); scrollTimer = new ASTimer(scrollSpeedThrottle); scrollTimer.setInitialDelay(initialScrollSpeedThrottle); scrollTimer.addActionListener(__scrollTimerPerformed); } protected function uninstallListeners():void { slider.removeEventListener(MouseEvent.MOUSE_DOWN, __onSliderPress); slider.removeEventListener(ReleaseEvent.RELEASE, __onSliderReleased); slider.removeEventListener(MouseEvent.MOUSE_WHEEL, __onSliderMouseWheel); slider.removeStateListener(__onSliderStateChanged); slider.removeEventListener(FocusKeyEvent.FOCUS_KEY_DOWN, __onSliderKeyDown); scrollTimer.stop(); scrollTimer = null; } protected function isVertical():Boolean { return slider.getOrientation() == JSlider.VERTICAL; } override public function paint(c:Component, g:Graphics2D, b:IntRectangle):void { super.paint(c, g, b); countTrackRect(b); countThumbRect(); countTickRect(b); paintTrack(g, trackDrawRect); paintThumb(g, thumbRect); paintTick(g, tickRect); } protected function countTrackRect(b:IntRectangle):void { var thumbSize:IntDimension = getThumbSize(); var h_margin:int, v_margin:int; if (isVertical()) { v_margin = Math.ceil(thumbSize.height / 2.0); h_margin = 4 / 2; //h_margin = thumbSize.width/3-1; trackDrawRect.setRectXYWH(b.x + h_margin, b.y + v_margin, thumbSize.width - h_margin * 2, b.height - v_margin * 2); trackRect.setRectXYWH(b.x, b.y + v_margin, thumbSize.width, b.height - v_margin * 2); } else { h_margin = Math.ceil(thumbSize.width / 2.0); v_margin = 4 / 2; //v_margin = thumbSize.height/3-1; trackDrawRect.setRectXYWH(b.x + h_margin, b.y + v_margin, b.width - h_margin * 2, thumbSize.height - v_margin * 2); trackRect.setRectXYWH(b.x + h_margin, b.y, b.width - h_margin * 2, thumbSize.height); } } protected function countTickRect(b:IntRectangle):void { if (isVertical()) { tickRect.y = trackRect.y; tickRect.x = trackRect.x + trackRect.width + getTickTrackGap(); tickRect.height = trackRect.height; tickRect.width = b.width - trackRect.width - getTickTrackGap(); } else { tickRect.x = trackRect.x; tickRect.y = trackRect.y + trackRect.height + getTickTrackGap(); tickRect.width = trackRect.width; tickRect.height = b.height - trackRect.height - getTickTrackGap(); } } protected function countThumbRect():void { thumbRect.setSize(getThumbSize()); if (slider.getSnapToTicks()) { var sliderValue:int = slider.getValue(); var snappedValue:int = sliderValue; var majorTickSpacing:int = slider.getMajorTickSpacing(); var minorTickSpacing:int = slider.getMinorTickSpacing(); var tickSpacing:int = 0; if (minorTickSpacing > 0) { tickSpacing = minorTickSpacing; } else if (majorTickSpacing > 0) { tickSpacing = majorTickSpacing; } if (tickSpacing != 0) { // If it's not on a tick, change the value if ((sliderValue - slider.getMinimum()) % tickSpacing != 0) { var temp:Number = (sliderValue - slider.getMinimum()) / tickSpacing; var whichTick:int = Math.round(temp); snappedValue = slider.getMinimum() + (whichTick * tickSpacing); } if (snappedValue != sliderValue) { slider.setValue(snappedValue); } } } var valuePosition:int; if (isVertical()) { valuePosition = yPositionForValue(slider.getValue()); thumbRect.x = trackRect.x; thumbRect.y = valuePosition - (thumbRect.height / 2); } else { valuePosition = xPositionForValue(slider.getValue()); thumbRect.x = valuePosition - (thumbRect.width / 2); thumbRect.y = trackRect.y; } } protected function getThumbSize():IntDimension { if (isVertical()) { return new IntDimension(thumbIcon.getIconHeight(slider), thumbIcon.getIconWidth(slider)); } else { return new IntDimension(thumbIcon.getIconWidth(slider), thumbIcon.getIconHeight(slider)); } } protected function countTickSize(sliderRect:IntRectangle):IntDimension { if (isVertical()) { return new IntDimension(getTickLength(), sliderRect.height); } else { return new IntDimension(sliderRect.width, getTickLength()); } } /** * Gets the height of the tick area for horizontal sliders and the width of the * tick area for vertical sliders. BasicSliderUI uses the returned value to * determine the tick area rectangle. If you want to give your ticks some room, * make this larger than you need and paint your ticks away from the sides in paintTicks(). */ protected function getTickLength():Number { return 10; } protected function countTrackAndThumbSize(sliderRect:IntRectangle):IntDimension { if (isVertical()) { return new IntDimension(getThumbSize().width, sliderRect.height); } else { return new IntDimension(sliderRect.width, getThumbSize().height); } } protected function getTickTrackGap():int { return 2; } public function xPositionForValue(value:int):Number { var min:int = slider.getMinimum(); var max:int = slider.getMaximum(); var trackLength:int = trackRect.width; var valueRange:int = max - min; var pixelsPerValue:Number = trackLength / valueRange; var trackLeft:int = trackRect.x; var trackRight:int = trackRect.x + (trackRect.width - 0); //0 var xPosition:int; if (!slider.getInverted()) { xPosition = trackLeft; xPosition += Math.round(pixelsPerValue * (value - min)); } else { xPosition = trackRight; xPosition -= Math.round(pixelsPerValue * (value - min)); } xPosition = Math.max(trackLeft, xPosition); xPosition = Math.min(trackRight, xPosition); return xPosition; } public function yPositionForValue(value:int):int { var min:int = slider.getMinimum(); var max:int = slider.getMaximum(); var trackLength:int = trackRect.height; var valueRange:int = max - min; var pixelsPerValue:Number = trackLength / valueRange; var trackTop:int = trackRect.y; var trackBottom:int = trackRect.y + (trackRect.height - 1); var yPosition:int; if (!slider.getInverted()) { yPosition = trackTop; yPosition += Math.round(pixelsPerValue * (max - value)); } else { yPosition = trackTop; yPosition += Math.round(pixelsPerValue * (value - min)); } yPosition = Math.max(trackTop, yPosition); yPosition = Math.min(trackBottom, yPosition); return yPosition; } /** * Returns a value give a y position. If yPos is past the track at the top or the * bottom it will set the value to the min or max of the slider, depending if the * slider is inverted or not. */ public function valueForYPosition(yPos:int):int { var value:int; var minValue:int = slider.getMinimum(); var maxValue:int = slider.getMaximum(); var trackLength:int = trackRect.height; var trackTop:int = trackRect.y; var trackBottom:int = trackRect.y + (trackRect.height - 1); var inverted:Boolean = slider.getInverted(); if (yPos <= trackTop) { value = inverted ? minValue : maxValue; } else if (yPos >= trackBottom) { value = inverted ? maxValue : minValue; } else { var distanceFromTrackTop:int = yPos - trackTop; var valueRange:int = maxValue - minValue; var valuePerPixel:Number = valueRange / trackLength; var valueFromTrackTop:int = Math.round(distanceFromTrackTop * valuePerPixel); value = inverted ? minValue + valueFromTrackTop : maxValue - valueFromTrackTop; } return value; } /** * Returns a value give an x position. If xPos is past the track at the left or the * right it will set the value to the min or max of the slider, depending if the * slider is inverted or not. */ public function valueForXPosition(xPos:int):int { var value:int; var minValue:int = slider.getMinimum(); var maxValue:int = slider.getMaximum(); var trackLength:int = trackRect.width; var trackLeft:int = trackRect.x; var trackRight:int = trackRect.x + (trackRect.width - 0); //1 var inverted:Boolean = slider.getInverted(); if (xPos <= trackLeft) { value = inverted ? maxValue : minValue; } else if (xPos >= trackRight) { value = inverted ? minValue : maxValue; } else { var distanceFromTrackLeft:int = xPos - trackLeft; var valueRange:int = maxValue - minValue; var valuePerPixel:Number = valueRange / trackLength; var valueFromTrackLeft:int = Math.round(distanceFromTrackLeft * valuePerPixel); value = inverted ? maxValue - valueFromTrackLeft : minValue + valueFromTrackLeft; } return value; } //------------------------- protected function paintTrack(g:Graphics2D, drawRect:IntRectangle):void { trackCanvas.graphics.clear(); if (!slider.getPaintTrack()) { return; } g = new Graphics2D(trackCanvas.graphics); var verticle:Boolean = (slider.getOrientation() == AsWingConstants.VERTICAL); var style:StyleTune = slider.getStyleTune(); var b:IntRectangle = drawRect.clone(); var radius:Number = 0; if (verticle) { radius = Math.floor(b.width / 2); } else { radius = Math.floor(b.height / 2); } if (radius > style.round) { radius = style.round; } g.fillRoundRect(new SolidBrush(slider.getBackground()), b.x, b.y, b.width, b.height, radius); //trackCanvas.filters = [new GlowFilter(0x0, style.shadowAlpha, 5, 5, 1, 1, true)]; trackCanvas.filters = [BlurFilter.createGlow(0x0, style.shadowAlpha, 5, 0.6)]; } protected function paintTrackProgress(g:Graphics2D, trackDrawRect:IntRectangle):void { if (!slider.getPaintTrack()) { return; } return; //do not paint progress here var rect:IntRectangle = trackDrawRect.clone(); var width:int; var height:int; var x:int; var y:int; var inverted:Boolean = slider.getInverted(); if (isVertical()) { width = rect.width - 5; height = thumbRect.y + thumbRect.height / 2 - rect.y - 5; x = rect.x + 2; if (inverted) { y = rect.y + 2; } else { height = rect.y + rect.height - thumbRect.y - thumbRect.height / 2 - 2; y = thumbRect.y + thumbRect.height / 2; } } else { height = rect.height - 5; if (inverted) { width = rect.x + rect.width - thumbRect.x - thumbRect.width / 2 - 2; x = thumbRect.x + thumbRect.width / 2; } else { width = thumbRect.x + thumbRect.width / 2 - rect.x - 5; x = rect.x + 2; } y = rect.y + 2; } g.fillRectangle(new SolidBrush(progressColor), x, y, width, height); } protected function paintThumb(g:Graphics2D, drawRect:IntRectangle):void { if (isVertical()) { thumbIcon.getDisplay(slider).rotation = 90; thumbIcon.updateIcon(slider, g, drawRect.x + thumbIcon.getIconHeight(slider), drawRect.y); } else { thumbIcon.getDisplay(slider).rotation = 0; thumbIcon.updateIcon(slider, g, drawRect.x, drawRect.y); } } protected function paintTick(g:Graphics2D, drawRect:IntRectangle):void { if (!slider.getPaintTicks()) { return; } var tickBounds:IntRectangle = drawRect; var majT:int = slider.getMajorTickSpacing(); var minT:int = slider.getMinorTickSpacing(); var max:int = slider.getMaximum(); g.beginDraw(new Pen(slider.getForeground(), 0)); var yPos:int = 0; var value:int = 0; var xPos:int = 0; if (isVertical()) { xPos = tickBounds.x; value = slider.getMinimum(); yPos = 0; if (minT > 0) { while (value <= max) { yPos = yPositionForValue(value); paintMinorTickForVertSlider(g, tickBounds, xPos, yPos); value += minT; } } if (majT > 0) { value = slider.getMinimum(); while (value <= max) { yPos = yPositionForValue(value); paintMajorTickForVertSlider(g, tickBounds, xPos, yPos); value += majT; } } } else { yPos = tickBounds.y; value = slider.getMinimum(); xPos = 0; if (minT > 0) { while (value <= max) { xPos = xPositionForValue(value); paintMinorTickForHorizSlider(g, tickBounds, xPos, yPos); value += minT; } } if (majT > 0) { value = slider.getMinimum(); while (value <= max) { xPos = xPositionForValue(value); paintMajorTickForHorizSlider(g, tickBounds, xPos, yPos); value += majT; } } } g.endDraw(); } private function paintMinorTickForHorizSlider(g:Graphics2D, tickBounds:IntRectangle, x:int, y:int):void { g.line(x, y, x, y + tickBounds.height / 2 - 1); } private function paintMajorTickForHorizSlider(g:Graphics2D, tickBounds:IntRectangle, x:int, y:int):void { g.line(x, y, x, y + tickBounds.height - 2); } private function paintMinorTickForVertSlider(g:Graphics2D, tickBounds:IntRectangle, x:int, y:int):void { g.line(x, y, x + tickBounds.width / 2 - 1, y); } private function paintMajorTickForVertSlider(g:Graphics2D, tickBounds:IntRectangle, x:int, y:int):void { g.line(x, y, x + tickBounds.width - 2, y); } //---------------------------- private function __onSliderStateChanged(e:Event):void { if (!isDragging) { countThumbRect(); paintThumb(null, thumbRect); progressCanvas.graphics.clear(); paintTrackProgress(new Graphics2D(progressCanvas.graphics), trackDrawRect); } } private function __onSliderKeyDown(e:FocusKeyEvent):void { if (!slider.isEnabled()) { return; } var code:uint = e.keyCode; var unit:int = getUnitIncrement(); var block:int = slider.getMajorTickSpacing() > 0 ? slider.getMajorTickSpacing() : unit * 5; if (isVertical()) { unit = -unit; block = -block; } if (slider.getInverted()) { unit = -unit; block = -block; } if (code == Keyboard.UP || code == Keyboard.LEFT) { scrollByIncrement(-unit); } else if (code == Keyboard.DOWN || code == Keyboard.RIGHT) { scrollByIncrement(unit); } else if (code == Keyboard.PAGE_UP) { scrollByIncrement(-block); } else if (code == Keyboard.PAGE_DOWN) { scrollByIncrement(block); } else if (code == Keyboard.HOME) { slider.setValue(slider.getMinimum()); } else if (code == Keyboard.END) { slider.setValue(slider.getMaximum() - slider.getExtent()); } } private function __onSliderPress(e:Event):void { var mousePoint:IntPoint = slider.getMousePosition(); if (thumbRect.containsPoint(mousePoint)) { __startDragThumb(); } else { var inverted:Boolean = slider.getInverted(); var thumbCenterPos:Number; if (isVertical()) { thumbCenterPos = thumbRect.y + thumbRect.height / 2; if (mousePoint.y > thumbCenterPos) { scrollIncrement = inverted ? getUnitIncrement() : -getUnitIncrement(); } else { scrollIncrement = inverted ? -getUnitIncrement() : getUnitIncrement(); } scrollContinueDestination = valueForYPosition(mousePoint.y); } else { thumbCenterPos = thumbRect.x + thumbRect.width / 2; if (mousePoint.x > thumbCenterPos) { scrollIncrement = inverted ? -getUnitIncrement() : getUnitIncrement(); } else { scrollIncrement = inverted ? getUnitIncrement() : -getUnitIncrement(); } scrollContinueDestination = valueForXPosition(mousePoint.x); } scrollTimer.restart(); __scrollTimerPerformed(null); //run one time immediately first } } private function __onSliderReleased(e:Event):void { if (isDragging) { __stopDragThumb(); } if (scrollTimer.isRunning()) { scrollTimer.stop(); } } private function __onSliderMouseWheel(e:MouseEvent):void { if (!slider.isEnabled()) { return; } var delta:int = e.delta; if (slider.getInverted()) { delta = -delta; } scrollByIncrement(delta * getUnitIncrement()); } private function __scrollTimerPerformed(e:Event):void { var value:int = slider.getValue() + scrollIncrement; var finished:Boolean = false; if (scrollIncrement > 0) { if (value >= scrollContinueDestination) { finished = true; } } else { if (value <= scrollContinueDestination) { finished = true; } } if (finished) { slider.setValue(scrollContinueDestination); scrollTimer.stop(); } else { scrollByIncrement(scrollIncrement); } } private function scrollByIncrement(increment:int):void { slider.setValue(slider.getValue() + increment); } private function getUnitIncrement():int { var unit:int = 0; if (slider.getMinorTickSpacing() > 0) { unit = slider.getMinorTickSpacing(); } else if (slider.getMajorTickSpacing() > 0) { unit = slider.getMajorTickSpacing(); } else { var range:Number = slider.getMaximum() - slider.getMinimum(); if (range > 2) { unit = Math.max(1, Math.round(range / 500)); } else { unit = range / 100; } } return unit; } private function __startDragThumb():void { isDragging = true; slider.setValueIsAdjusting(true); var mp:IntPoint = slider.getMousePosition(); var mx:int = mp.x; var my:int = mp.y; var tr:IntRectangle = thumbRect; if (isVertical()) { offset = my - tr.y; } else { offset = mx - tr.x; } __startHandleDrag(); } private function __stopDragThumb():void { __stopHandleDrag(); if (isDragging) { isDragging = false; countThumbRect(); } slider.setValueIsAdjusting(false); offset = 0; } private function __startHandleDrag():void { if (slider.stage) { slider.stage.addEventListener(MouseEvent.MOUSE_MOVE, __onMoveThumb, false, 0, true); slider.addEventListener(Event.REMOVED_FROM_STAGE, __onMoveThumbRFS, false, 0, true); showValueTip(); } } private function __onMoveThumbRFS(e:Event):void { slider.stage.removeEventListener(MouseEvent.MOUSE_MOVE, __onMoveThumb); slider.removeEventListener(Event.REMOVED_FROM_STAGE, __onMoveThumbRFS); } private function __stopHandleDrag():void { if (slider.stage) { __onMoveThumbRFS(null); } disposValueTip(); } private function __onMoveThumb(e:MouseEvent):void { scrollThumbToCurrentMousePosition(); showValueTip(); e.updateAfterEvent(); } protected function showValueTip():void { if (slider.getShowValueTip()) { var tip:JToolTip = slider.getValueTip(); tip.setWaitThenPopupEnabled(false); tip.setTipText(slider.getValue() + ""); if (!tip.isShowing()) { tip.showToolTip(); } tip.moveLocationRelatedTo(slider.componentToGlobal(slider.getMousePosition())); } } protected function disposValueTip():void { if (slider.getValueTip() != null) { slider.getValueTip().disposeToolTip(); } } protected function scrollThumbToCurrentMousePosition():void { var mp:IntPoint = slider.getMousePosition(); var mx:int = mp.x; var my:int = mp.y; var thumbPos:int, minPos:int, maxPos:int; var halfThumbLength:int; var sliderValue:int; var paintThumbRect:IntRectangle = thumbRect.clone(); if (isVertical()) { halfThumbLength = thumbRect.height / 2; thumbPos = my - offset; if (!slider.getInverted()) { maxPos = yPositionForValue(slider.getMinimum()) - halfThumbLength; minPos = yPositionForValue(slider.getMaximum() - slider.getExtent()) - halfThumbLength; } else { minPos = yPositionForValue(slider.getMinimum()) - halfThumbLength; maxPos = yPositionForValue(slider.getMaximum() - slider.getExtent()) - halfThumbLength; } thumbPos = Math.max(minPos, Math.min(maxPos, thumbPos)); sliderValue = valueForYPosition(thumbPos + halfThumbLength); slider.setValue(sliderValue); thumbRect.y = yPositionForValue(slider.getValue()) - halfThumbLength; paintThumbRect.y = thumbPos; } else { halfThumbLength = thumbRect.width / 2; thumbPos = mx - offset; if (slider.getInverted()) { maxPos = xPositionForValue(slider.getMinimum()) - halfThumbLength; minPos = xPositionForValue(slider.getMaximum() - slider.getExtent()) - halfThumbLength; } else { minPos = xPositionForValue(slider.getMinimum()) - halfThumbLength; maxPos = xPositionForValue(slider.getMaximum() - slider.getExtent()) - halfThumbLength; } thumbPos = Math.max(minPos, Math.min(maxPos, thumbPos)); sliderValue = valueForXPosition(thumbPos + halfThumbLength); slider.setValue(sliderValue); thumbRect.x = xPositionForValue(slider.getValue()) - halfThumbLength; paintThumbRect.x = thumbPos; } paintThumb(null, paintThumbRect); progressCanvas.graphics.clear(); paintTrackProgress(new Graphics2D(progressCanvas.graphics), trackDrawRect); } public function getTrackMargin():Insets { var b:IntRectangle = slider.getPaintBounds(); countTrackRect(b); var insets:Insets = new Insets(); insets.top = trackRect.y - b.y; insets.bottom = b.y + b.height - trackRect.y - trackRect.height; insets.left = trackRect.x - b.x; insets.right = b.x + b.width - trackRect.x - trackRect.width; return insets; } //--------------------- protected function getPrefferedLength():int { return 200; } override public function getPreferredSize(c:Component):IntDimension { var size:IntDimension; var thumbSize:IntDimension = getThumbSize(); var tickLength:int = this.getTickLength(); var gap:int = this.getTickTrackGap(); var wide:int = slider.getPaintTicks() ? gap + tickLength : 0; if (isVertical()) { wide += thumbSize.width; size = new IntDimension(wide, Math.max(wide, getPrefferedLength())); } else { wide += thumbSize.height; size = new IntDimension(Math.max(wide, getPrefferedLength()), wide); } return c.getInsets().getOutsideSize(size); } override public function getMaximumSize(c:Component):IntDimension { return IntDimension.createBigDimension(); } override public function getMinimumSize(c:Component):IntDimension { var size:IntDimension; var thumbSize:IntDimension = getThumbSize(); var tickLength:int = this.getTickLength(); var gap:int = this.getTickTrackGap(); var wide:int = slider.getPaintTicks() ? gap + tickLength : 0; if (isVertical()) { wide += thumbSize.width; size = new IntDimension(wide, thumbSize.height); } else { wide += thumbSize.height; size = new IntDimension(thumbSize.width, wide); } return c.getInsets().getOutsideSize(size); } } }
package { import flash.events.Event; /** * ... * @author Jake */ public class AddEvent extends Event { // Event types. public static const PAGE_ADD:String = "addPage"; public static const PAGE_REMOVE:String = "removePage"; public var params:Object; public function AddEvent(type:String, bubbles:Boolean = false,params:Object = null, cancelable:Boolean = false) { this.params = params; super(type, bubbles, cancelable); } override public function clone():Event { return new AddEvent(type, bubbles, cancelable); } } }
/** * This is a generated sub-class of _RedemptionLocation.as and is intended for behavior * customization. This class is only generated when there is no file already present * at its target location. Thus custom behavior that you add here will survive regeneration * of the super-class. * * NOTE: Do not manually modify the RemoteClass mapping unless * your server representation of this class has changed and you've * updated your ActionScriptGeneration,RemoteClass annotation on the * corresponding entity **/ package valueObjects { import com.adobe.fiber.core.model_internal; public class RedemptionLocation extends _Super_RedemptionLocation { /** * DO NOT MODIFY THIS STATIC INITIALIZER - IT IS NECESSARY * FOR PROPERLY SETTING UP THE REMOTE CLASS ALIAS FOR THIS CLASS * **/ /** * Calling this static function will initialize RemoteClass aliases * for this value object as well as all of the value objects corresponding * to entities associated to this value object's entity. */ public static function _initRemoteClassAlias() : void { _Super_RedemptionLocation.model_internal::initRemoteClassAliasSingle(valueObjects.RedemptionLocation); _Super_RedemptionLocation.model_internal::initRemoteClassAliasAllRelated(); } model_internal static function initRemoteClassAliasSingleChild() : void { _Super_RedemptionLocation.model_internal::initRemoteClassAliasSingle(valueObjects.RedemptionLocation); } { _Super_RedemptionLocation.model_internal::initRemoteClassAliasSingle(valueObjects.RedemptionLocation); } /** * END OF DO NOT MODIFY SECTION * **/ } }
//////////////////////////////////////////////////////////////////////////////// // // ADOBE SYSTEMS INCORPORATED // Copyright 2009 Adobe Systems Incorporated // All Rights Reserved. // // NOTICE: Adobe permits you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// package spark.accessibility { import mx.accessibility.AccConst; import mx.core.UIComponent; import mx.core.mx_internal; import spark.components.CheckBox; import spark.components.supportClasses.ToggleButtonBase; use namespace mx_internal; /** * CheckBoxAccImpl is the accessibility implementation class * for spark.components.CheckBox. * * <p>When a Spark CheckBox is created, * its <code>accessibilityImplementation</code> property * is set to an instance of this class. * The Flash Player then uses this class to allow MSAA clients * such as screen readers to see and manipulate the CheckBox. * See the mx.accessibility.AccImpl and * flash.accessibility.AccessibilityImplementation classes * for background information about accessibility implementation * classes and MSAA.</p> * * <p><b>Children</b></p> * * <p>A CheckBox has no MSAA children.</p> * * <p><b>Role</b></p> * * <p>The MSAA Role of a CheckBox is ROLE_SYSTEM_CHECKBOX.</p> * * <p><b>Name</b></p> * * <p>The MSAA Name of a CheckBox is, by default, the label that it displays. * When wrapped in a FormItem element, * this label will be combined with the FormItem's label. * To override this behavior, * set the CheckBox's <code>accessibilityName</code> property.</p> * * <p>When the Name changes, * a CheckBox dispatches the MSAA event EVENT_OBJECT_NAMECHANGE.</p> * * <p><b>Description</b></p> * * <p>The MSAA Description of a CheckBox is, by default, the empty string, * but you can set the CheckBox's <code>accessibilityDescription</code> * property.</p> * * <p><b>State</b></p> * * <p>The MSAA State of a CheckBox is a combination of: * <ul> * <li>STATE_SYSTEM_UNAVAILABLE (when enabled is false)</li> * <li>STATE_SYSTEM_FOCUSABLE (when enabled is true)</li> * <li>STATE_SYSTEM_FOCUSED (when enabled is true * and the CheckBox has focus)</li> * <li>STATE_SYSTEM_CHECKED (when selected is true)</li> * </ul></p> * * <p>When the Name changes, * a CheckBox dispatches the MSAA event EVENT_OBJECT_STATECHANGE.</p> * * <p><b>Value</b></p> * * <p>A CheckBox does not have an MSAA Value.</p> * * <p><b>Location</b></p> * * <p>The MSAA Location of a CheckBox is its bounding rectangle.</p> * * <p><b>Default Action</b></p> * * <p>The MSAA DefaultAction of a CheckBox is "Check" or "UnCheck", * depending on whether it is currently checked or not.</p> * * <p>When an MSAA client tells the CheckBox to perform this action, * KEY_DOWN and KEY_UP MouseEvents for the SPACE key are generated, * to simulate pressing the CheckBox via the keyboard, * if the CheckBox is enabled.</p> * * <p><b>Focus</b></p> * * <p>A CheckBox accepts focus. * When it does so, it dispatches the MSAA event EVENT_OBJECT_FOCUS.</p> * * <p><b>Selection</b></p> * * <p>A CheckBox does not support selection in the MSAA sense.</p> * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public class CheckBoxAccImpl extends ButtonBaseAccImpl { include "../core/Version.as"; //-------------------------------------------------------------------------- // // Class methods // //-------------------------------------------------------------------------- /** * Enables accessibility in the CheckBox class. * * <p>This method is called by application startup code * that is autogenerated by the MXML compiler. * Afterwards, when instances of CheckBox are initialized, * their <code>accessibilityImplementation</code> property * will be set to an instance of this class.</p> * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public static function enableAccessibility():void { CheckBox.createAccessibilityImplementation = createAccessibilityImplementation; } /** * @private * Creates a CheckBox's AccessibilityImplementation object. * This method is called from UIComponent's * initializeAccessibility() method. */ mx_internal static function createAccessibilityImplementation( component:UIComponent):void { component.accessibilityImplementation = new CheckBoxAccImpl(component); } //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @param master The UIComponent instance that this AccImpl instance * is making accessible. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function CheckBoxAccImpl(master:UIComponent) { super(master); role = AccConst.ROLE_SYSTEM_CHECKBUTTON; } //-------------------------------------------------------------------------- // // Overridden methods: AccessibilityImplementation // //-------------------------------------------------------------------------- /** * @private * IAccessible method for returning the state of the CheckBox. * States are predefined for all the components in MSAA. * Values are assigned to each state. * Depending upon whether the CheckBox is checked or unchecked, * a value is returned. * * @param childID uint * * @return State Whether the CheckBox is checked or unchecked. */ override public function get_accState(childID:uint):uint { var accState:uint = getState(childID); if (ToggleButtonBase(master).selected) accState |= AccConst.STATE_SYSTEM_CHECKED; return accState; } /** * @private * IAccessible method for returning the default action of * the CheckBox, which is Check or UnCheck depending on the state. * * @param childID uint * * @return DefaultAction Check or UnCheck. */ override public function get_accDefaultAction(childID:uint):String { return ToggleButtonBase(master).selected ? "UnCheck" : "Check"; } } }
package pvpBattlefield.command { import com.tencent.morefun.framework.base.Command; import serverProto.battleRoyale.ProtoGetBattleRoyaleSchemaResp; import def.PluginDef; public class IconPvpBattleFieldTimerCmd extends Command { public var status:int = 0; public var result:ProtoGetBattleRoyaleSchemaResp; public function IconPvpBattleFieldTimerCmd() { super(2); } override public function getPluginName() : String { return PluginDef.PVPBATTLEFIELD; } } }
/** * <p>Original Author: toddanderson</p> * <p>Class File: VerticalSliderStrategy.as</p> * <p>Version: 0.3</p> * * <p>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:</p> * * <p>The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software.</p> * * <p>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.</p> * * <p>Licensed under The MIT License</p> * <p>Redistributions of files must retain the above copyright notice.</p> */ package com.custardbelly.as3flobile.controls.slider.context { import flash.events.Event; import flash.geom.Point; /** * VerticalSliderStrategy is a concrete implementation of BaseSliderStrategy to position displays of a slider control along the y-axis. * @author toddanderson */ public class VerticalSliderStrategy extends BaseSliderStrategy { protected var _height:Number; protected var _topLimitPosition:Number; protected var _bottomLimitPosition:Number; protected var _velocityY:Number; protected var _previousY:Number; protected var _targetY:Number; protected var _pointCache:Point; /** * Constructor. */ public function VerticalSliderStrategy() { super(); _pointCache = new Point( 0, 0 ); } /** * @inherit */ override protected function initialize():void { _height = _bounds.height; _topLimitPosition = 0; _bottomLimitPosition = _height - _thumb.height; } /** * @inherit */ override protected function limitPosition():Boolean { _bottomLimitPosition = _height - _thumb.height; // Limit the position of the thumb along the y-axis. if( _thumb.y < _topLimitPosition ) { _thumb.y = _topLimitPosition; return true; } else if( _thumb.y > _bottomLimitPosition ) { _thumb.y = _bottomLimitPosition; return true; } return false; } /** * @private * * Notify target of change to position value. */ protected function commitPosition():void { _pointCache.y = _thumb.y; _sliderTarget.commitOnPositionChange( _pointCache ); } /** * @inherit */ override protected function updatePosition( xpos:Number, ypos:Number ):void { // Update along the y-axis. _thumb.y += ypos - _previousY; // Limit. var hasLimit:Boolean = limitPosition(); if( !hasLimit ) _previousY = ypos; // Commit/ commitPosition(); } /** * @inherit */ override protected function placePosition( xpos:Number, ypos:Number ):void { _targetY = ypos - ( _thumb.height * 0.5 ); _velocityY = 0; startAnimation(); } /** * @inherit */ override protected function animate( evt:Event = null ):void { // Basic easing toward target position. _velocityY = ( _targetY - _thumb.y ) * 0.42; var absVelY:Number = ( _velocityY > 0 ) ? _velocityY : -_velocityY; if( absVelY < 0.75 ) { _thumb.y = _targetY; _velocityY = 0; } // Update current positon with velocity. _thumb.y += _velocityY; // If we ain't moving, we ain't moving. var hasLimit:Boolean = limitPosition(); if( _velocityY == 0 || hasLimit ) { endAnimation(); } } /** * @inherit */ override protected function endAnimation( updateSelection:Boolean = true ):void { super.endAnimation( updateSelection ); if( updateSelection ) { commitPosition(); } } /** * @inherit */ override public function start( position:Point ):void { super.start( position ); // Mark previous as start. _previousY = position.y; } /** * @inherit */ override public function end( position:Point ):void { super.end( position ); commitPosition(); } } }
package game.view.playerThumbnail { import com.pickgliss.ui.LayerManager; import com.pickgliss.ui.ShowTipManager; import com.pickgliss.ui.core.Disposeable; import ddt.utils.PositionUtils; import ddt.view.tips.PlayerThumbnailTip; import flash.display.DisplayObject; import flash.display.Sprite; import flash.events.Event; import flash.geom.Point; import game.model.Player; import road7th.data.DictionaryData; import road7th.data.DictionaryEvent; public class PlayerThumbnailList extends Sprite implements Disposeable { private var _info:DictionaryData; private var _players:DictionaryData; private var _dirct:int; private var _thumbnailTip:PlayerThumbnailTip; public function PlayerThumbnailList(param1:DictionaryData, param2:int = 1) { super(); this._dirct = param2; this._info = param1; this.initView(); this.initEvents(); } private function initView() : void { var _loc1_:int = 0; var _loc2_:* = null; var _loc3_:PlayerThumbnail = null; this._players = new DictionaryData(); if(this._info) { _loc1_ = 0; for(_loc2_ in this._info) { _loc3_ = new PlayerThumbnail(this._info[_loc2_],this._dirct); _loc3_.addEventListener("playerThumbnailEvent",this.__onTipClick); this._players.add(_loc2_,_loc3_); addChild(_loc3_); } } this.arrange(); } private function __onTipClick(param1:Event) : void { var __addTip:Function = null; var e:Event = param1; __addTip = function(param1:Event):void { if((param1.currentTarget as PlayerThumbnailTip).tipDisplay) { (param1.currentTarget as PlayerThumbnailTip).tipDisplay.recoverTip(); } }; this._thumbnailTip = ShowTipManager.Instance.getTipInstanceByStylename("ddt.view.tips.PlayerThumbnailTip") as PlayerThumbnailTip; if(this._thumbnailTip == null) { this._thumbnailTip = ShowTipManager.Instance.createTipByStyleName("ddt.view.tips.PlayerThumbnailTip"); this._thumbnailTip.addEventListener("playerThumbnailTipItemClick",__addTip); } this._thumbnailTip.tipDisplay = e.currentTarget as PlayerThumbnail; this._thumbnailTip.x = this.mouseX; this._thumbnailTip.y = e.currentTarget.height + e.currentTarget.y + 12; PositionUtils.setPos(this._thumbnailTip,localToGlobal(new Point(this._thumbnailTip.x,this._thumbnailTip.y))); LayerManager.Instance.addToLayer(this._thumbnailTip,LayerManager.GAME_DYNAMIC_LAYER,false); } private function arrange() : void { var _loc2_:DisplayObject = null; var _loc1_:int = 0; while(_loc1_ < numChildren) { _loc2_ = getChildAt(_loc1_); if(this._dirct < 0) { _loc2_.x = (_loc1_ + 1) * (_loc2_.width + 4) * this._dirct; } else { _loc2_.x = _loc1_ * (_loc2_.width + 4) * this._dirct; } _loc1_++; } } private function initEvents() : void { this._info.addEventListener(DictionaryEvent.REMOVE,this.__removePlayer); this._info.addEventListener(DictionaryEvent.ADD,this.__addLiving); } private function removeEvents() : void { this._info.removeEventListener(DictionaryEvent.REMOVE,this.__removePlayer); this._info.removeEventListener(DictionaryEvent.ADD,this.__addLiving); } private function __addLiving(param1:DictionaryEvent) : void { } public function __removePlayer(param1:DictionaryEvent) : void { var _loc2_:Player = param1.data as Player; if(_loc2_ && _loc2_.playerInfo) { if(this._players[_loc2_.playerInfo.ID]) { this._players[_loc2_.playerInfo.ID].removeEventListener("playerThumbnailEvent",this.__onTipClick); this._players[_loc2_.playerInfo.ID].dispose(); delete this._players[_loc2_.playerInfo.ID]; } } } public function dispose() : void { var _loc1_:* = null; this.removeEvents(); for(_loc1_ in this._players) { if(this._players[_loc1_]) { this._players[_loc1_].removeEventListener("playerThumbnailEvent",this.__onTipClick); this._players[_loc1_].dispose(); } } this._players = null; if(this._thumbnailTip) { this._thumbnailTip.tipDisplay = null; } this._thumbnailTip = null; if(parent) { parent.removeChild(this); } } } }
package laya.webgl.utils { import laya.display.css.TransformInfo; import laya.display.Sprite; import laya.display.Sprite; import laya.display.css.Style; import laya.maths.Matrix; import laya.maths.Rectangle; import laya.renders.RenderContext; import laya.renders.RenderSprite; import laya.resource.Texture; import laya.webgl.canvas.WebGLContext2D; import laya.webgl.resource.RenderTarget2D; import laya.webgl.shader.d2.ShaderDefines2D; import laya.webgl.shader.d2.value.Value2D; import laya.webgl.submit.SubmitCMD; import laya.webgl.submit.SubmitCMDScope; import laya.webgl.submit.SubmitStencil; public class RenderSprite3D extends RenderSprite { public static var tempUV:Array = new Array(8); public function RenderSprite3D(type:int, next:RenderSprite) { super(type, next); } protected override function onCreate(type:int):void { switch (type) { case BLEND: _fun = this._blend; return; case TRANSFORM: _fun = this._transform; return; // case FILTERS: // _fun = _filter; // return; } } public static function tmpTarget(scope:SubmitCMDScope, context:RenderContext):void { var b:Rectangle = scope.getValue("bounds"); var tmpTarget:RenderTarget2D = RenderTarget2D.create(b.width, b.height); tmpTarget.start(); tmpTarget.clear(0, 0, 0, 0); scope.addValue("tmpTarget", tmpTarget); } public static function endTmpTarget(scope:SubmitCMDScope):void { var tmpTarget:* = scope.getValue("tmpTarget"); tmpTarget.end(); } public static function recycleTarget(scope:SubmitCMDScope):void { var tmpTarget:* = scope.getValue("tmpTarget"); tmpTarget.recycle(); scope.recycle(); } override public function _mask(sprite:Sprite, context:RenderContext, x:Number, y:Number):void { var next:RenderSprite = this._next; var mask:Sprite = sprite.mask; var submitCMD:SubmitCMD; var submitStencil:SubmitStencil; if (mask) { context.ctx.save(); var preBlendMode:String = (context.ctx as WebGLContext2D).globalCompositeOperation; var tRect:Rectangle = new Rectangle(); tRect.copyFrom(mask.getBounds()); tRect.width=Math.round(tRect.width); tRect.height=Math.round(tRect.height); tRect.x=Math.round(tRect.x); tRect.y=Math.round(tRect.y); if (tRect.width > 0 && tRect.height > 0) { var tf:TransformInfo=sprite._style._tf; var scope:SubmitCMDScope = SubmitCMDScope.create(); scope.addValue("bounds", tRect); submitCMD = SubmitCMD.create([scope, context], RenderSprite3D.tmpTarget); context.addRenderObject(submitCMD); mask.render(context, -tRect.x, -tRect.y); submitCMD = SubmitCMD.create([scope], RenderSprite3D.endTmpTarget); context.addRenderObject(submitCMD); //裁剪 context.ctx.save(); context.clipRect(x - tf.translateX + tRect.x, y - tf.translateY + tRect.y, tRect.width, tRect.height); next._fun.call(next, sprite, context, x, y); context.ctx.restore(); //设置混合模式 submitStencil = SubmitStencil.create(6); preBlendMode = (context.ctx as WebGLContext2D).globalCompositeOperation; submitStencil.blendMode = "mask"; context.addRenderObject(submitStencil); Matrix.TEMP.identity(); var shaderValue:Value2D = Value2D.create(ShaderDefines2D.TEXTURE2D, 0); var uv:Array = Texture.INV_UV; var w:Number = tRect.width; var h:Number = tRect.height; //这个地方代码不要删除,为了解决在iphone6-plus上的诡异问题 //renderTarget + StencilBuffer + renderTargetSize < 32 就会变得超级卡 //所以增加的限制。王亚伟 const tempLimit:Number = 32; if ( tRect.width < tempLimit || tRect.height < tempLimit ) { uv = tempUV; uv[0] = 0; uv[1] = 0; uv[2] = ( tRect.width >= 32 ) ? 1 : tRect.width/tempLimit; uv[3] = 0 uv[4] = ( tRect.width >= 32 ) ? 1 : tRect.width/tempLimit; uv[5] = ( tRect.height >= 32 ) ? 1 : tRect.height/tempLimit; uv[6] = 0; uv[7] = ( tRect.height >= 32 ) ? 1 : tRect.height/tempLimit; tRect.width = ( tRect.width >= 32 ) ? tRect.width : tempLimit; tRect.height = ( tRect.height >= 32 ) ? tRect.height : tempLimit; uv[1] *= -1; uv[3] *= -1; uv[5] *= -1; uv[7] *= -1; uv[1] += 1;uv[3] += 1;uv[5] += 1;uv[7] += 1; } (context.ctx as WebGLContext2D).drawTarget(scope, x + tRect.x - tf.translateX, y + tRect.y - tf.translateY, w, h, Matrix.TEMP, "tmpTarget", shaderValue, uv, 6); submitCMD = SubmitCMD.create([scope], RenderSprite3D.recycleTarget); context.addRenderObject(submitCMD); submitStencil = SubmitStencil.create(6); submitStencil.blendMode = preBlendMode; context.addRenderObject(submitStencil); } context.ctx.restore(); } else { next._fun.call(next, sprite, context, x, y); } } override public function _blend(sprite:Sprite, context:RenderContext, x:Number, y:Number):void { var style:Style = sprite._style; var next:RenderSprite = this._next; if (style.blendMode) { context.ctx.save(); context.ctx.globalCompositeOperation = style.blendMode; next._fun.call(next, sprite, context, x, y); context.ctx.restore(); } else { next._fun.call(next, sprite, context, x, y); } } override public function _transform(sprite:Sprite, context:RenderContext, x:Number, y:Number):void { var transform:Matrix = sprite.transform, _next:RenderSprite = this._next; if (transform && _next != NORENDER) { var ctx:WebGLContext2D = context.ctx; var style:Style = sprite._style; transform.tx = x; transform.ty = y; var m2:Matrix = ctx._getTransformMatrix(); var m1:Matrix = m2.clone(); Matrix.mul(transform, m2, m2); m2._checkTransform(); transform.tx = transform.ty = 0; _next._fun.call(_next, sprite, context, 0, 0); m1.copyTo(m2); m1.destroy(); } else { _next._fun.call(_next, sprite, context, x, y); } } } }
package cmodule.lua_wrapper { var _AS3_Number:int; }
package maryfisher.framework.data { /** * ... * @author mary_fisher */ public class LoaderData { public var path:String; public var description:String; /** * caches the class */ public var cacheClass:Boolean; /** * caches an instance of the class to be reused */ public var reuse:Boolean; public function LoaderData(path:String, cacheClass:Boolean = false, reuse:Boolean = false, description:String = "") { this.description = description; this.path = path; this.cacheClass = cacheClass; this.reuse = reuse; } public function toString():String { return "[LoaderData path=" + path + " description=" + description + " doCache=" + cacheClass + " reuse=" + reuse + "]"; } } }
package h2olib.control.headerRenderer { import flash.events.Event; import mx.controls.ComboBox; import mx.controls.dataGridClasses.DataGridColumn; [Bindable] public class HeaderRendererDDL extends BaseHeaderRenderer { private var _ddl:ComboBox; public function HeaderRendererDDL() { } private var _array:Array; private static var firstString:String = "All"; override public function set data(value:Object):void { super.data = value; if (value is DataGridColumn) { this._array = this.createValueList(); } } override public function initialize():void { super.initialize(); if (this._ddl && data) { this._array = this.createValueList(); this._ddl.dataProvider = this._array; var s:String = getData() as String; if(!s) { this._ddl.selectedIndex = 0; } else { this._ddl.selectedItem = s; } } } override public function validateDisplayList():void { super.validateDisplayList(); } override protected function createChildren():void { super.createChildren(); if (!this._ddl) { this._ddl = new ComboBox(); this._ddl.setStyle("cornerRadius","0"); this._ddl.setStyle("borderThickness","0"); this._ddl.addEventListener(Event.CHANGE, changeDdlFieldHandler); this._ddl.percentWidth = 100; this._ddl.minWidth = 0; addControlElement(this._ddl); } } private function changeDdlFieldHandler(event:Event):void { if (this._ddl.selectedIndex == 0) { saveData(null); } else { saveData(this._ddl.selectedItem); } refreshDataProvider(); } [Bindable(action="change")] public function createValueList():Array { var result:Array = new Array(); result = result.concat(firstString); var buf:String; if (dataProvider) { for (var i:int=0; i<dataProvider.list.length;i++) { buf = (data as DataGridColumn).itemToLabel(dataProvider.list.getItemAt(i)); if(result.indexOf(buf) >= 0) continue; result = result.concat(buf); } } return result; } } }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import com.adobe.test.Assert; // TODO: REVIEW AS4 CONVERSION ISSUE function ToInteger( t ) { t = Number( t ); if ( isNaN( t ) ){ return ( Number.NaN ); } if ( t == 0 || t == -0 || t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) { return 0; } var sign = ( t < 0 ) ? -1 : 1; return ( sign * Math.floor( Math.abs( t ) ) ); } function getTimeZoneDiff() { return -((new Date(2000, 1, 1)).getTimezoneOffset())/60; } var msPerDay = 86400000; var HoursPerDay = 24; var MinutesPerHour = 60; var SecondsPerMinute = 60; var msPerSecond = 1000; var msPerMinute = 60000; // msPerSecond * SecondsPerMinute var msPerHour = 3600000; // msPerMinute * MinutesPerHour var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC var TZ_PST = -8; // offset of Pacific Standard Time from UTC var TZ_IST = +5.5; // offset of Indian Standard Time from UTC var IST_DIFF = TZ_DIFF - TZ_IST; // offset of tester's timezone from IST var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST var TIME_1970 = 0; var TIME_2000 = 946684800000; var TIME_1900 = -2208988800000; var now = new Date(); var TZ_DIFF = getTimeZoneDiff(); var TZ_ADJUST = TZ_DIFF * msPerHour; var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); var TIME_NOW = now.valueOf(); // Date test "ResultArrays" are hard-coded for Pacific Standard Time. // We must adjust them for the tester's own timezone - var TIME; var UTC_YEAR; var UTC_MONTH; var UTC_DATE; var UTC_DAY; var UTC_HOURS; var UTC_MINUTES; var UTC_SECONDS; var UTC_MS; var YEAR; var MONTH; var DATE; var DAY; var HOURS; var MINUTES; var SECONDS; var MS; function adjustResultArray(ResultArray, msMode) { // If the tester's system clock is in PST, no need to continue - if (!PST_DIFF) {return;} // The date testcases instantiate Date objects in two different ways: // // millisecond mode: e.g. dt = new Date(10000000); // year-month-day mode: dt = new Date(2000, 5, 1, ...); // // In the first case, the date is measured from Time 0 in Greenwich (i.e. UTC). // In the second case, it is measured with reference to the tester's local timezone. // // In the first case we must correct those values expected for local measurements, // like dt.getHours() etc. No correction is necessary for dt.getUTCHours() etc. // // In the second case, it is exactly the other way around - var t; if (msMode) { // The hard-coded UTC milliseconds from Time 0 derives from a UTC date. // Shift to the right by the offset between UTC and the tester. t = ResultArray[TIME] + TZ_DIFF*msPerHour; // Use our date arithmetic functions to determine the local hour, day, etc. ResultArray[MINUTES] = MinFromTime(t); ResultArray[HOURS] = HourFromTime(t); ResultArray[DAY] = WeekDay(t); ResultArray[DATE] = DateFromTime(t); ResultArray[MONTH] = MonthFromTime(t); ResultArray[YEAR] = YearFromTime(t); } else { // The hard-coded UTC milliseconds from Time 0 derives from a PST date. // Shift to the left by the offset between PST and the tester. t = ResultArray[TIME] - PST_DIFF*msPerHour; // Use our date arithmetic functions to determine the UTC hour, day, etc. ResultArray[TIME] = t; ResultArray[UTC_MINUTES] = MinFromTime(t); ResultArray[UTC_HOURS] = HourFromTime(t); ResultArray[UTC_DAY] = WeekDay(t); ResultArray[UTC_DATE] = DateFromTime(t); ResultArray[UTC_MONTH] = MonthFromTime(t); ResultArray[UTC_YEAR] = YearFromTime(t); } } function Day( t ) { return ( Math.floor(t/msPerDay ) ); } function DaysInYear( y ) { if ( y % 4 != 0 ) { return 365; } if ( (y % 4 == 0) && (y % 100 != 0) ) { return 366; } if ( (y % 100 == 0) && (y % 400 != 0) ) { return 365; } if ( (y % 400 == 0) ){ return 366; } else { _print("ERROR: DaysInYear(" + y + ") case not covered"); return Number.NaN; //"ERROR: DaysInYear(" + y + ") case not covered"; } } function TimeInYear( y ) { return ( DaysInYear(y) * msPerDay ); } function DayNumber( t ) { return ( Math.floor( t / msPerDay ) ); } function TimeWithinDay( t ) { if ( t < 0 ) { return ( (t % msPerDay) + msPerDay ); } else { return ( t % msPerDay ); } } function YearNumber( t ) { } function TimeFromYear( y ) { return ( msPerDay * DayFromYear(y) ); } function DayFromYear( y ) { return ( 365*(y-1970) + Math.floor((y-1969)/4) - Math.floor((y-1901)/100) + Math.floor((y-1601)/400) ); } function InLeapYear( t ) { if ( DaysInYear(YearFromTime(t)) == 365 ) { return 0; } if ( DaysInYear(YearFromTime(t)) == 366 ) { return 1; } else { return "ERROR: InLeapYear("+ t + ") case not covered"; } } function YearFromTime( t ) { t = Number( t ); var sign = ( t < 0 ) ? -1 : 1; var year = ( sign < 0 ) ? 1969 : 1970; for ( var timeToTimeZero = t; ; ) { // subtract the current year's time from the time that's left. timeToTimeZero -= sign * TimeInYear(year) if (isNaN(timeToTimeZero)) return NaN; // if there's less than the current year's worth of time left, then break. if ( sign < 0 ) { if ( sign * timeToTimeZero <= 0 ) { break; } else { year += sign; } } else { if ( sign * timeToTimeZero < 0 ) { break; } else { year += sign; } } } return ( year ); } function MonthFromTime( t ) { // i know i could use switch but i'd rather not until it's part of ECMA var day = DayWithinYear( t ); var leap = InLeapYear(t); if ( (0 <= day) && (day < 31) ) { return 0; } if ( (31 <= day) && (day < (59+leap)) ) { return 1; } if ( ((59+leap) <= day) && (day < (90+leap)) ) { return 2; } if ( ((90+leap) <= day) && (day < (120+leap)) ) { return 3; } if ( ((120+leap) <= day) && (day < (151+leap)) ) { return 4; } if ( ((151+leap) <= day) && (day < (181+leap)) ) { return 5; } if ( ((181+leap) <= day) && (day < (212+leap)) ) { return 6; } if ( ((212+leap) <= day) && (day < (243+leap)) ) { return 7; } if ( ((243+leap) <= day) && (day < (273+leap)) ) { return 8; } if ( ((273+leap) <= day) && (day < (304+leap)) ) { return 9; } if ( ((304+leap) <= day) && (day < (334+leap)) ) { return 10; } if ( ((334+leap) <= day) && (day < (365+leap)) ) { return 11; } else { return "ERROR: MonthFromTime("+t+") not known"; } } function DayWithinYear( t ) { return( Day(t) - DayFromYear(YearFromTime(t))); } function DateFromTime( t ) { var day = DayWithinYear(t); var month = MonthFromTime(t); if ( month == 0 ) { return ( day + 1 ); } if ( month == 1 ) { return ( day - 30 ); } if ( month == 2 ) { return ( day - 58 - InLeapYear(t) ); } if ( month == 3 ) { return ( day - 89 - InLeapYear(t)); } if ( month == 4 ) { return ( day - 119 - InLeapYear(t)); } if ( month == 5 ) { return ( day - 150- InLeapYear(t)); } if ( month == 6 ) { return ( day - 180- InLeapYear(t)); } if ( month == 7 ) { return ( day - 211- InLeapYear(t)); } if ( month == 8 ) { return ( day - 242- InLeapYear(t)); } if ( month == 9 ) { return ( day - 272- InLeapYear(t)); } if ( month == 10 ) { return ( day - 303- InLeapYear(t)); } if ( month == 11 ) { return ( day - 333- InLeapYear(t)); } return ("ERROR: DateFromTime("+t+") not known" ); } function WeekDay( t ) { var weekday = (Day(t)+4) % 7; return( weekday < 0 ? 7 + weekday : weekday ); } // missing daylight savins time adjustment function HourFromTime( t ) { var h = Math.floor( t / msPerHour ) % HoursPerDay; return ( (h<0) ? HoursPerDay + h : h ); } function MinFromTime( t ) { var min = Math.floor( t / msPerMinute ) % MinutesPerHour; return( ( min < 0 ) ? MinutesPerHour + min : min ); } function SecFromTime( t ) { var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute; return ( (sec < 0 ) ? SecondsPerMinute + sec : sec ); } function msFromTime( t ) { var ms = t % msPerSecond; return ( (ms < 0 ) ? msPerSecond + ms : ms ); } function LocalTZA() { return ( TZ_DIFF * msPerHour ); } function UTC( t ) { return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) ); } function DaylightSavingTA( t ) { // There is no Daylight saving time in India if (IST_DIFF == 0) return 0; var dst_start; var dst_end; // Windows fix for 2007 DST change made all previous years follow new DST rules // create a date pre-2007 when DST is enabled according to 2007 rules var pre_2007:Date = new Date("Mar 20 2006"); // create a date post-2007 var post_2007:Date = new Date("Mar 20 2008"); // if the two dates timezoneoffset match, then this must be a windows box applying // post-2007 DST rules to earlier dates. var win_machine:Boolean = pre_2007.timezoneOffset == post_2007.timezoneOffset if (TZ_DIFF<=-4 && TZ_DIFF>=-8) { if (win_machine || YearFromTime(t)>=2007) { dst_start = GetSecondSundayInMarch(t) + 2*msPerHour; dst_end = GetFirstSundayInNovember(t) + 2*msPerHour; } else { dst_start = GetFirstSundayInApril(t) + 2*msPerHour; dst_end = GetLastSundayInOctober(t) + 2*msPerHour; } } else { dst_start = GetLastSundayInMarch(t) + 2*msPerHour; dst_end = GetLastSundayInOctober(t) + 2*msPerHour; } if ( t >= dst_start && t < dst_end ) { return msPerHour; } else { return 0; } // Daylight Savings Time starts on the second Sunday in March at 2:00AM in // PST. Other time zones will need to override this function. _print( new Date( UTC(dst_start + LocalTZA())) ); return UTC(dst_start + LocalTZA()); } function GetLastSundayInMarch(t) { var year = YearFromTime(t); var leap = InLeapYear(t); var march = TimeFromYear(year) + TimeInMonth(0,leap) + TimeInMonth(1,leap)-LocalTZA()+2*msPerHour; var sunday; for( sunday=march;WeekDay(sunday)>0;sunday +=msPerDay ){;} var last_sunday; while (true) { sunday=sunday+7*msPerDay; if (MonthFromTime(sunday)>2) break; last_sunday=sunday; } return last_sunday; } function GetSecondSundayInMarch(t ) { var year = YearFromTime(t); var leap = InLeapYear(t); var march = TimeFromYear(year) + TimeInMonth(0,leap) + TimeInMonth(1,leap)-LocalTZA()+2*msPerHour; var first_sunday; for ( first_sunday = march; WeekDay(first_sunday) >0; first_sunday +=msPerDay ) { ; } var second_sunday=first_sunday+7*msPerDay; return second_sunday; } function GetFirstSundayInNovember( t ) { var year = YearFromTime(t); var leap = InLeapYear(t); var nov,m; for ( nov = TimeFromYear(year), m = 0; m < 10; m++ ) { nov += TimeInMonth(m, leap); } nov=nov-LocalTZA()+2*msPerHour; for ( var first_sunday = nov; WeekDay(first_sunday) > 0; first_sunday += msPerDay ) { ; } return first_sunday; } function GetFirstSundayInApril( t ) { var year = YearFromTime(t); var leap = InLeapYear(t); var apr,m; for ( apr = TimeFromYear(year), m = 0; m < 3; m++ ) { apr += TimeInMonth(m, leap); } apr=apr-LocalTZA()+2*msPerHour; for ( var first_sunday = apr; WeekDay(first_sunday) > 0; first_sunday += msPerDay ) { ; } return first_sunday; } function GetLastSundayInOctober(t) { var year = YearFromTime(t); var leap = InLeapYear(t); var oct,m; for (oct = TimeFromYear(year), m = 0; m < 9; m++ ) { oct += TimeInMonth(m, leap); } oct=oct-LocalTZA()+2*msPerHour; var sunday; for( sunday=oct;WeekDay(sunday)>0;sunday +=msPerDay ){;} var last_sunday; while (true) { last_sunday=sunday; sunday=sunday+7*msPerDay; if (MonthFromTime(sunday)>9) break; } return last_sunday; } function LocalTime( t ) { return ( t + LocalTZA() + DaylightSavingTA(t) ); } function MakeTime( hour, min, sec, ms ) { if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) { return Number.NaN; } hour = ToInteger(hour); min = ToInteger( min); sec = ToInteger( sec); ms = ToInteger( ms ); return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms ); } function MakeDay( year, month, date ) { if ( isNaN(year) || isNaN(month) || isNaN(date) ) { return Number.NaN; } year = ToInteger(year); month = ToInteger(month); date = ToInteger(date ); var sign = ( year < 1970 ) ? -1 : 1; var t = ( year < 1970 ) ? 1 : 0; var y = ( year < 1970 ) ? 1969 : 1970; var result5 = year + Math.floor( month/12 ); var result6 = month % 12; if ( year < 1970 ) { for ( y = 1969; y >= year; y += sign ) { t += sign * TimeInYear(y); } } else { for ( y = 1970 ; y < year; y += sign ) { t += sign * TimeInYear(y); } } var leap = InLeapYear( t ); for ( var m = 0; m < month; m++ ) { t += TimeInMonth( m, leap ); } if ( YearFromTime(t) != result5 ) { return Number.NaN; } if ( MonthFromTime(t) != result6 ) { return Number.NaN; } if ( DateFromTime(t) != 1 ) { return Number.NaN; } return ( (Day(t)) + date - 1 ); } function TimeInMonth( month, leap ) { // september april june november // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6 // aug 7 sep 8 oct 9 nov 10 dec 11 if ( month == 3 || month == 5 || month == 8 || month == 10 ) { return ( 30*msPerDay ); } // all the rest if ( month == 0 || month == 2 || month == 4 || month == 6 || month == 7 || month == 9 || month == 11 ) { return ( 31*msPerDay ); } // save february return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); } function MakeDate( day, time ) { if ( day == Number.POSITIVE_INFINITY || day == Number.NEGATIVE_INFINITY || day == Number.NaN ) { return Number.NaN; } if ( time == Number.POSITIVE_INFINITY || time == Number.POSITIVE_INFINITY || day == Number.NaN) { return Number.NaN; } return ( day * msPerDay ) + time; } // Compare 2 dates, they are considered equal if the difference is less than 1 second function compareDate(d1, d2) { //Dates may be off by a second if (d1 == d2) { return true; } else if (Math.abs(new Date(d1).getTime() - new Date(d2).getTime()) <= 1000) { return true; } else { return false; } } function TimeClip( t ) { if ( isNaN( t ) ) { return ( Number.NaN ); } if ( Math.abs( t ) > 8.64e15 ) { return ( Number.NaN ); } return ( ToInteger( t ) ); } // TODO: --END-- REVIEW AS4 CONVERSION ISSUE // var SECTION = "15.9.5.13"; // var VERSION = "ECMA_1"; // var TITLE = "Date.prototype.getUTCMonth()"; var testcases = getTestCases(); function getTestCases() { var array = new Array(); var item = 0; var TZ_ADJUST = TZ_DIFF * msPerHour; // get the current time var now = (new Date()).valueOf(); // calculate time for year 0 for ( var time = 0, year = 1969; year >= 0; year-- ) { time -= TimeInYear(year); } // get time for 29 feb 2000 var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour; // get time for 1 jan 2005 var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004); addTestCase( now ); array[item++] = Assert.expectEq( "(new Date(NaN)).getUTCMonth()", NaN, (new Date(NaN)).getUTCMonth() ); array[item++] = Assert.expectEq( "Date.prototype.getUTCMonth.length", 0, Date.prototype.getUTCMonth.length ); function addTestCase( t ) { for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) { t += d; array[item++] = Assert.expectEq( "(new Date(currentTime+"+d+")).getUTCMonth()", true, MonthFromTime(t) == (new Date(t)).getUTCMonth() ); } } return ( array ); }
package fl.controls { import fl.core.InvalidationType; import fl.core.UIComponent; import fl.events.ComponentEvent; import flash.display.DisplayObject; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.utils.Timer; /** * Dispatched when the user presses the Button component. * If the <code>autoRepeat</code> property is <code>true</code>, * this event is dispatched at specified intervals until the * button is released. * * <p>The <code>repeatDelay</code> style is used to * specify the delay before the <code>buttonDown</code> event is * dispatched a second time. The <code>repeatInterval</code> style * specifies the interval at which this event is dispatched thereafter, * until the user releases the button.</p> * * @eventType fl.events.ComponentEvent.BUTTON_DOWN * * @includeExample examples/BaseButton.autoRepeat.1.as -noswf * * @see #autoRepeat * @see #style:repeatDelay style * @see #style:repeatInterval style * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Event(name="buttonDown", type="fl.events.ComponentEvent")] /** * Dispatched when the value of the <code>selected</code> property * of a toggle Button component changes. A toggle Button component is a * Button component whose <code>toggle</code> property is set to <code>true</code>. * * <p>The CheckBox and RadioButton components dispatch this event after * there is a change in the <code>selected</code> property.</p> * * @eventType flash.events.Event.CHANGE * * @includeExample examples/LabelButton.toggle.1.as -noswf * * @see #selected selected * @see LabelButton#toggle LabelButton.toggle * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Event(name="change", type="flash.events.Event")] /** * @copy fl.controls.LabelButton#style:upSkin * * @default Button_upSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="upSkin", type="Class")] /** * @copy fl.controls.LabelButton#style:downSkin * * @default Button_downSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="downSkin", type="Class")] /** * @copy fl.controls.LabelButton#style:overSkin * * @default Button_overSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="overSkin", type="Class")] /** * @copy fl.controls.LabelButton#style:disabledSkin * * @default Button_disabledSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="disabledSkin", type="Class")] /** * @copy fl.controls.LabelButton#style:selectedDisabledSkin * * @default Button_selectedDisabledSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="selectedDisabledSkin", type="Class")] /** * @copy fl.controls.LabelButton#style:selectedUpSkin * * @default Button_selectedUpSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="selectedUpSkin", type="Class")] /** * @copy fl.controls.LabelButton#style:selectedDownSkin * * @default Button_selectedDownSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="selectedDownSkin", type="Class")] /** * @copy fl.controls.LabelButton#style:selectedOverSkin * * @default Button_selectedOverSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="selectedOverSkin", type="Class")] /** * The number of milliseconds to wait after the <code>buttonDown</code> * event is first dispatched before sending a second <code>buttonDown</code> * event. * * @default 500 * * @see #event:buttonDown * @see #autoRepeat * @see #style:repeatInterval * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="repeatDelay", type="Number", format="Time")] /** * The interval, in milliseconds, between <code>buttonDown</code> events * that are dispatched after the delay that is specified by the <code>repeatDelay</code> * style. * * @default 35 * * @see #event:buttonDown * @see #autoRepeat * @see #style:repeatDelay * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ [Style(name="repeatInterval", type="Number", format="Time")] /** * The BaseButton class is the base class for all button components, defining * properties and methods that are common to all buttons. This class handles * drawing states and the dispatching of button events. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public class BaseButton extends UIComponent { /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var background : DisplayObject; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var mouseState : String; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _selected : Boolean; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _autoRepeat : Boolean; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var pressTimer : Timer; /** * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ private var _mouseStateLocked : Boolean; /** * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ private var unlockedMouseState : String; /** * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ private static var defaultStyles : Object; /** * Gets or sets a value that indicates whether the component can accept user * input. A value of <code>true</code> indicates that the component can accept * user input; a value of <code>false</code> indicates that it cannot. * * <p>When this property is set to <code>false</code>, the button is disabled. * This means that although it is visible, it cannot be clicked. This property is * useful for disabling a specific part of the user interface. For example, a button * that is used to trigger the reloading of a web page could be disabled * by using this technique.</p> * * @default true * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get enabled () : Boolean; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set enabled (value:Boolean) : void; /** * Gets or sets a Boolean value that indicates whether a toggle button * is selected. A value of <code>true</code> indicates that the button is * selected; a value of <code>false</code> indicates that it is not. * This property has no effect if the <code>toggle</code> property * is not set to <code>true</code>. * * <p>For a CheckBox component, this value indicates whether the box is * checked. For a RadioButton component, this value indicates whether the * component is selected.</p> * * <p>This value changes when the user clicks the component * but can also be changed programmatically. If the <code>toggle</code> * property is set to <code>true</code>, changing this property causes * a <code>change</code> event object to be dispatched.</p> * * @default false * * @includeExample examples/LabelButton.toggle.1.as -noswf * * @see #event:change change * @see LabelButton#toggle LabelButton.toggle * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get selected () : Boolean; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set selected (value:Boolean) : void; /** * Gets or sets a Boolean value that indicates whether the <code>buttonDown</code> event * is dispatched more than one time when the user holds the mouse button down over the component. * A value of <code>true</code> indicates that the <code>buttonDown</code> event * is dispatched repeatedly while the mouse button remains down; a value of <code>false</code> * indicates that the event is dispatched only one time. * * <p>If this value is <code>true</code>, after the delay specified by the * <code>repeatDelay</code> style, the <code>buttonDown</code> * event is dispatched at the interval that is specified by the <code>repeatInterval</code> style.</p> * * @default false * * @includeExample examples/BaseButton.autoRepeat.1.as -noswf * * @see #style:repeatDelay * @see #style:repeatInterval * @see #event:buttonDown * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get autoRepeat () : Boolean; /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set autoRepeat (value:Boolean) : void; /** * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set mouseStateLocked (value:Boolean) : void; /** * @copy fl.core.UIComponent#getStyleDefinition() * * @includeExample ../core/examples/UIComponent.getStyleDefinition.1.as -noswf * * @see fl.core.UIComponent#getStyle() UIComponent.getStyle() * @see fl.core.UIComponent#setStyle() UIComponent.setStyle() * @see fl.managers.StyleManager StyleManager * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static function getStyleDefinition () : Object; /** * Creates a new BaseButton instance. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function BaseButton (); /** * Set the mouse state via ActionScript. The BaseButton class * uses this property internally, but it can also be invoked manually, * and will set the mouse state visually. * * @param state A string that specifies a mouse state. Supported values are * "up", "over", and "down". * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function setMouseState (state:String) : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function setupMouseEvents () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function mouseEventHandler (event:MouseEvent) : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function startPress () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function buttonDown (event:TimerEvent) : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function endPress () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function draw () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function drawBackground () : void; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected function drawLayout () : void; } }
package org.aswing.decorators { import flash.display.Shape; import starling.display.DisplayObject; import starling.display.Image; import starling.display.Sprite; import flash.display.BitmapData; import flash.display.GradientType; import flash.geom.Matrix; import org.aswing.ASColor; import org.aswing.Component; import org.aswing.geom.IntRectangle; import org.aswing.graphics.BitmapBrush; import org.aswing.graphics.GradientBrush; import org.aswing.graphics.Graphics2D; import org.aswing.graphics.Pen; import org.aswing.graphics.SolidBrush; import org.aswing.GroundDecorator; import starling.textures.Texture; /** * ColorDecorator * @author DEVORON */ public class GradientDecorator implements GroundDecorator { public var radius:Number; protected var topRightRadius:Number = -1; protected var bottomLeftRadius:Number = -1; protected var bottomRightRadius:Number = -1; protected var colors:Array; protected var alphas:Array; protected var matrix:Matrix; protected var spreadMethod:String; protected var interpolationMethod:String; protected var focalPointRatio:Number; protected var fillType:String; protected var ratios:Array; public var borderColor:ASColor; public var backgroundShape:Sprite; public var comp:Component; public var graphics:Graphics2D; public var bounds:IntRectangle; public var rightGap:int; public var leftGap:int; public var topGap:int; public var bottomGap:int; public var image:BitmapData; public static const LINEAR:String = GradientType.LINEAR; public static const RADIAL:String = GradientType.RADIAL; public function GradientDecorator(fillType:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix, spreadMethod:String = "pad", interpolationMethod:String = "rgb", focalPointRatio:Number = 0, borderColor:ASColor = null, radius:Number = 0) { this.ratios = ratios; this.fillType = fillType; this.focalPointRatio = focalPointRatio; this.interpolationMethod = interpolationMethod; this.spreadMethod = spreadMethod; this.matrix = matrix; this.alphas = alphas; this.colors = colors; this.radius = radius; this.borderColor = borderColor ? borderColor : new ASColor(0, 0); //this.color = color; backgroundShape = new Shape(); } public function setRadiuses(radius:Number, topRightRadius:Number = -1, bottomLeftRadius:Number = -1, bottomRightRadius:Number = -1):void { this.bottomRightRadius = bottomRightRadius; this.bottomLeftRadius = bottomLeftRadius; this.topRightRadius = topRightRadius; this.radius = radius; } public function setGaps(rightGap:int = 0, leftGap:int = 0, topGap:int = 0, bottomGap:int = 0):void { this.bottomGap = bottomGap; this.topGap = topGap; this.leftGap = leftGap; this.rightGap = rightGap; } /*public function clone():ColorDecorator { var decorator:ColorDecorator = new ColorDecorator(color, borderColor, radius); decorator.setGaps(rightGap, leftGap, topGap, bottomGap); if (image) decorator.setImage(image.clone()); return decorator; }*/ public function getColors():Array { return colors; } public function setColors(value:Array):void { colors = value; if (comp) { updateDecorator(comp, graphics, bounds); //c.updateUI(); } } /* INTERFACE devoron.aswing3d.GroundDecorator */ public function updateDecorator(c:Component, g:Graphics2D, b:IntRectangle):void { comp = c; graphics = g; bounds = b; backgroundSprite.graphics.clear(); /*backgroundSprite.mouseChildren = true; backgroundSprite.mouseEnabled = false;*/ var g2d:Graphics2D = new Graphics2D(backgroundShape.graphics); var matrix:Matrix = new Matrix(); matrix.createGradientBox(b.width, b.height, 0, 0, 0); g2d.beginFill(new GradientBrush(fillType, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio)); if (radius != 0) { var trR:Number = topRightRadius == -1 ? radius : topRightRadius; var blR:Number = bottomLeftRadius == -1 ? radius : bottomLeftRadius; var brR:Number = bottomRightRadius == -1 ? radius : bottomRightRadius; g2d.drawRoundRect(new Pen(borderColor, 0), b.x + leftGap, b.y + topGap, b.width + rightGap, b.height + bottomGap, radius, trR, blR, brR); } else { g2d.drawRectangle(new Pen(borderColor, 0), b.x + leftGap, b.y + topGap, b.width + rightGap, b.height + bottomGap); } g2d.endDraw(); g2d.endFill(); } public function getDisplay(c:Component):DisplayObject { return backgroundShape; } } }
import smallCalendar.text_area.TextArea class smallCalendar.text_area.Scroll extends MovieClip { var __scrollHeightNull:Boolean=false var __drag:Number var __last:Number var __first:Number var mc_scroll:MovieClip var arrow_up:MovieClip var arrow_down:MovieClip var __v:Number=10 var __onChange:Function var __height:Number=200 var background:MovieClip var __proportion:Number var __textArea:TextArea //////////////////////////////////////color /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function Scroll(){ this.mc_scroll.onPress=Delegate2.create(this,onPressScroll) this.mc_scroll.onRelease=this.mc_scroll.onReleaseOutside=Delegate2.create(this,onReleaseScroll) this.mc_scroll.onRollOver=Delegate2.create(this,this.onRollOverScroll) this.mc_scroll.onRollOut=Delegate2.create(this,this.onRollOutScroll) //////// this.arrow_down.onPress=Delegate2.create(this,onPressScroll,"d") this.arrow_down.onRelease=this.arrow_down.onReleaseOutside=Delegate2.create(this,onReleaseScroll) /// this.arrow_up.onPress=Delegate2.create(this,onPressScroll,"g") this.arrow_up.onRelease=this.arrow_up.onReleaseOutside=Delegate2.create(this,onReleaseScroll) } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function setColor(mc_,color_){ var k:Color=new Color(mc_) k.setRGB(color_) } //////////////////////////////////////////////////// function setColorScroll(color_){ this.setColor(this.mc_scroll,color_) } ///////////////////////////////////////////// function setColorScrollBackground(color_){ this.setColor(this.background,color_) } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function onReleaseScroll(){ refresh() this.mc_scroll.stopDrag() delete this.onEnterFrame } //////////////////////////////////// function onRollOverScroll(){ } ////////////////////////////////////////////// function onRollOutScroll(){ } ////////////////////////////////////////////// function set limit(t:Array){ __first=Number(t[0]) __last=Number(t[1]) proportion=Number(t[2]) } ////////////////////////////////////////////////////////////////////////// function set proportion(f){ __proportion=(f>1) ? 1 : f scrollHeight=Math.ceil(__drag*__proportion) size() } ////////////////////////////////////////////////////////////////////////// function set height(war:Number){ __height=war size() } ////////////////////////////////////////////////////////////////////////// function set y(war:Number){ this._y=war+arrow_up._height size() } ////////////////////////////////////////////////////////////////////////// function set x(war:Number){ this._x=war size() } ////////////////////////////////////////////////////////////////////////// function set onChange(f:Function){ __onChange=f } ////////////////////////////////////////////////////////////////////////// function get scrollHeight(){ ////zwraca wysokosc suwaka return (__scrollHeightNull==true) ? 0 : mc_scroll._height } ////////////////////////////////////////////////////////////////////////// function set scrollHeight(value){ mc_scroll._height=value } ////////////////////////////////////////////////////////////////////////// function size(){ __drag=__height-(arrow_down._height+arrow_up._height) this.mc_scroll._y=0 arrow_down._y=__drag arrow_up._y=-arrow_up._height __first=(__first==undefined) ? 0 : __first //background._width=mc_scroll._width background._height=__drag background.onPress=function(){} background.useHandCursor=false } //////////////////////////////////////////////////////////////////////////////////// function setScroll(war:Number){ if(war>1){war=1} this.mc_scroll._y=war*(__drag-scrollHeight) refresh() } //////////////////////////////////////////////////////////////////////////////////// function setScrollPosition(value_,boolean_){ var p=Math.min(__first,__last) var k=Math.max(__first,__last) value_=Math.max(p,Math.min(k,value_)) mc_scroll._y=( (value_-__first) * (__drag-scrollHeight) ) / (__last-__first) if(boolean_!=false){ refresh() } } //////////////////////////////////////////////////////////////////////////////////////////////////// function getScrollPosition(){ return __first+( this.mc_scroll._y / (__drag-scrollHeight) )*(__last-__first) } //////////////////////////////////////////////////////////////////////////////////// function refresh(button:String):Void{ var value_=getScrollPosition() __onChange(value_) if(button=="d"){ var kon=this.mc_scroll._y+this.scrollHeight // if(kon+__v>__drag) {this.mc_scroll._y=(__drag-this.scrollHeight)} else{this.mc_scroll._y+=__v} } else if(button=="g"){ if(mc_scroll._y-__v<=0){mc_scroll._y=0} else{mc_scroll._y-=__v} } } //////////////////////////////////////////////////////////////////////////////////// function onPressScroll(button:String):Void{ ////// if(button==undefined){this.mc_scroll.startDrag(false,0,0,0,(__drag-scrollHeight))} this.onEnterFrame=Delegate2.create(this,refresh,button) } //////////////////////////////////////////////////////////////////////////////////////////////////// }