CombinedText stringlengths 4 3.42M |
|---|
/*
* Temple Library for ActionScript 3.0
* Copyright © MediaMonks B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by MediaMonks B.V.
* 4. Neither the name of MediaMonks B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY MEDIAMONKS B.V. ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL MEDIAMONKS B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Note: This license does not apply to 3rd party classes inside the Temple
* repository with their own license!
*/
package temple.net.sharedobject
{
import temple.core.events.CoreEventDispatcher;
import temple.data.collections.HashMap;
import flash.events.NetStatusEvent;
import flash.net.SharedObject;
/**
* Wrapper class that supports Quick assses to shared object properties.
*
* @example
* <listing version="3.0">
* SharedObjectService.getInstance('projectName').setProperty('muted', true);
* SharedObjectService.getInstance('projectName').getProperty('muted');
*
* //also:
*
* _sharedObjectSite = new SharedObjectService('projectName', '');
* _sharedObjectGame = new SharedObjectService('projectName', '/game');
*
* //tip: extend and provide typed accessors with prefilled default-values
*
* dispatches SharedObjectServiceEvent's when flushing (to check if the flushing fails or displays the dialog window)
*
* </listing>
*
* @author Arjan van Wijk, Bart van der Schoor
*/
public final class SharedObjectService extends CoreEventDispatcher implements ISharedObjectService
{
//to compare to returned values
public static const FP_SO_FLUSH_SUCCESS:String = 'SharedObject.Flush.Success';
public static const FP_SO_FLUSH_FAIL:String = 'SharedObject.Flush.Failed';
private static var _instances:HashMap;
/**
* This class is used as a Multiton. SharedObjects are always saved in the / path
* @param name The name of the SharedObject
*/
public static function getInstance(name:String = 'default'):ISharedObjectService
{
if (SharedObjectService._instances == null) SharedObjectService._instances = new HashMap();
if (SharedObjectService._instances[name] == null) SharedObjectService._instances[name] = new SharedObjectService(name);
return SharedObjectService._instances[name];
}
private var _so:SharedObject;
private var _data:Object;
private var _name:String;
private var _expectedSize:int;
public function SharedObjectService(name:String, path:String='/', expectedSize:int=0)
{
_name = name;
_expectedSize = expectedSize;
try
{
_so = SharedObject.getLocal(_name, path);
}
catch(e:Error)
{
logError('error while reading Shared Object ' + _name + ': ' + e);
}
if(_so == null)
{
logError('cannot retrieve SharedObject ' + _name + ', local fallback');
_data = new Object();
}
else
{
_data = _so.data;
_so.addEventListener(NetStatusEvent.NET_STATUS, handleNetStatusEvent);
}
}
/**
* @inheritDoc
*/
public function setProperty(name:String, value:*):void
{
_data[name] = value;
flush();
}
/**
* @inheritDoc
*/
public function getProperty(name:String, alt:*=null):*
{
return name in _data ? _data[name] : alt;
}
/**
* @inheritDoc
*/
public function hasProperty(name:String):*
{
return name in _data;
}
/**
* @inheritDoc
*/
public function removeProperty(name:String):void
{
if(name in _data)
{
delete _data[name];
}
flush();
}
/**
* @inheritDoc
*/
public function clear():void
{
if (_so)
{
_so.clear();
_data = _so.data;
}
else
{
_data = new Object();
}
}
/**
* @inheritDoc
*/
public function flush(expectedSize:int=0):String
{
if (expectedSize != 0 && expectedSize > _expectedSize)
{
_expectedSize = expectedSize;
}
var status:String = SharedObjectServiceEvent.FLUSH_ERROR;
if (_so)
{
try
{
status = _so.flush(_expectedSize);
}
catch(e:Error)
{
logError('error while flushing Shared Object ' + _name + ': ' + e);
}
}
else
{
status = SharedObjectServiceEvent.FLUSHED;
}
dispatchEvent(new SharedObjectServiceEvent(status));
return status;
}
/**
* @inheritDoc
*/
public function get so():SharedObject
{
return _so;
}
/**
* @inheritDoc
*/
public function data():Object
{
return _data;
}
private function handleNetStatusEvent(event:NetStatusEvent):void
{
if(event.info && event.info['code'] == FP_SO_FLUSH_SUCCESS)
{
dispatchEvent(new SharedObjectServiceEvent(SharedObjectServiceEvent.FLUSHED));
}
else
{
dispatchEvent(new SharedObjectServiceEvent(SharedObjectServiceEvent.FLUSH_ERROR));
}
}
/**
* @inheritDoc
*/
override public function destruct():void
{
if (SharedObjectService._instances)
{
delete SharedObjectService._instances[_name];
// check if there are some NotificationCenters left
for (var key:String in SharedObjectService._instances);
if (key == null) SharedObjectService._instances = null;
}
_data = null;
if (_so)
{
_so.close();
_so = null;
}
super.destruct();
}
}
} |
/**
* Copyright (c) 2007-2009 The PyAMF Project.
* See LICENSE.txt for details.
*/
package org.pyamf.examples.addressbook.components
{
import mx.containers.TitleWindow;
import mx.controls.TextInput;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
import org.pyamf.examples.addressbook.models.Email;
public class EditEmailDlgClass extends TitleWindow
{
[Bindable]
public var email : Email;
public var emailLabel : TextInput;
public var emailText : TextInput;
/**
* Constructor.
*/
public function EditEmailDlgClass()
{
super();
addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler);
}
protected function creationCompleteHandler( event:FlexEvent ):void
{
PopUpManager.centerPopUp(this);
}
protected function close():void
{
email.label = emailLabel.text;
email.email = emailText.text;
PopUpManager.removePopUp(this);
}
}
} |
package view {
import flash.display.Shape;
import flash.display3D.textures.Texture;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldType;
import model.Cell;
import model.YuanJian;
/**
* ...
* @author hongjie
*/
public class ShuXingYuanJian extends ShuXing {
protected var _marginTopTF:TextField;
protected var _margionBottomTF:TextField;
protected var _offsetTF:TextField;
protected var _offsetY:TextField;
public function ShuXingYuanJian(width:int, height:int, type:String = '元件') {
super(width, height, type);
}
override protected function _init(width:int, height:int):void {
var label:TextField = new TextField();
label.mouseEnabled = false;
label.text = '距离:';
label.y = (height - label.textHeight) >> 1;
addChild(label);
var border:Shape = _drawInputBorder(50, 18);
border.x = 40;
border.y = label.y;
addChild(border);
_xTF = new TextField();
_xTF.type = TextFieldType.INPUT;
_xTF.text = '0';
_xTF.width = 50;
_xTF.height = 18;
_xTF.restrict = '0-9';
_xTF.x = 40;
_xTF.y = label.y;
_xTF.addEventListener(Event.CHANGE, _onXChanged);
addChild(_xTF);
label = new TextField();
label.mouseEnabled = false;
label.text = '上轨:';
label.x = 100;
label.y = (height - label.textHeight) >> 1;
addChild(label);
border = _drawInputBorder(50, 18);
border.x = 40;
border.y = label.y;
addChild(border);
_marginTopTF = new TextField();
_marginTopTF.mouseEnabled = false;
//_marginTopTF.type = TextFieldType.INPUT;
_marginTopTF.text = '0';
_marginTopTF.width = 50;
_marginTopTF.height = 18;
_marginTopTF.restrict = '0-9';
_marginTopTF.x = 140;
_marginTopTF.y = label.y;
//_marginTopTF.addEventListener(Event.CHANGE, _onXChanged);
addChild(_marginTopTF);
label = new TextField();
label.mouseEnabled = false;
label.text = '下轨:';
label.x = 180;
label.y = (height - label.textHeight) >> 1;
addChild(label);
border = _drawInputBorder(50, 18);
border.x = 40;
border.y = label.y;
addChild(border);
_margionBottomTF = new TextField();
_margionBottomTF.mouseEnabled = false;
//_margionBottomTF.type = TextFieldType.INPUT;
_margionBottomTF.text = '0';
_margionBottomTF.width = 50;
_margionBottomTF.height = 18;
_margionBottomTF.restrict = '0-9';
_margionBottomTF.x = 220;
_margionBottomTF.y = label.y;
//_margionBottomTF.addEventListener(Event.CHANGE, _onXChanged);
addChild(_margionBottomTF);
label = new TextField();
label.mouseEnabled = false;
label.text = '调整值:';
label.x = 0;
label.y = 60;
addChild(label);
border = _drawInputBorder(30, 18);
border.x = 40 + label.x;
border.y = label.y;
addChild(border);
_offsetTF = new TextField();
_offsetTF.type = TextFieldType.INPUT;
_offsetTF.text = '0';
_offsetTF.width = 30;
_offsetTF.height = 18;
_offsetTF.x = 40 + label.x;
_offsetTF.y = label.y;
_offsetTF.addEventListener(Event.CHANGE, _onOffsetChanged);
addChild(_offsetTF);
label = new TextField();
label.mouseEnabled = false;
label.text = '调整值:';
label.x = 260;
label.y = (height - label.textHeight) >> 1;
addChild(label);
border = _drawInputBorder(30, 18);
border.x = 40 + label.x;
border.y = label.y;
addChild(border);
_offsetY = new TextField();
_offsetY.type = TextFieldType.INPUT;
_offsetY.text = '0';
_offsetY.width = 30;
_offsetY.height = 18;
_offsetY.x = 40 + label.x;
_offsetY.y = label.y;
_offsetY.addEventListener(Event.CHANGE, _onOffsetYChanged);
addChild(_offsetY);
}
override public function setCurCell(cell:Cell):void {
_curCell = cell;
if (cell) {
var yuanJian:YuanJian = cell as YuanJian;
this._xTF.text = yuanJian.offsetX.toString();
_marginTopTF.text = yuanJian.marginTopToXianCao.toString();
_margionBottomTF.text = yuanJian.marginBottomToXianCao.toString();
_offsetTF.text = ScaleLine.OFFSET.toString();
this._offsetY.text = yuanJian.offsetY.toString();
}
}
private function _onOffsetChanged(e:Event):void {
ScaleLine.OFFSET = int(_offsetTF.text);
}
private function _onOffsetYChanged(e:Event):void {
if (this._curCell) {
(_curCell as YuanJian).offsetY = int(_offsetY.text);
}
}
override protected function _onXChanged(e:Event):void {
if (this._curCell) {
(_curCell as YuanJian).offsetX = int(_xTF.text);
if (ScaleLine.instance.parentCell == _curCell) {
ScaleLine.instance.resetRect();
}
}
}
}
} |
package
{
import net.flashpunk.Entity;
import net.flashpunk.FP;
import worlds.*;
/**
* Base class for moving Entities to handle collision.
*/
public class Moveable extends Entity
{
/**
* Entity -type- to consider solid when colliding.
*/
public var solid:String = "solid";
/**
* Constructor.
*/
public function Moveable()
{
}
/**
* Moves the entity by the specified amount horizontally and vertically.
*/
public function move(moveX:Number = 0, moveY:Number = 0):void
{
// movement counters
_moveX += moveX;
_moveY += moveY;
moveX = Math.round(_moveX);
moveY = Math.round(_moveY);
_moveX -= moveX;
_moveY -= moveY;
// movement vars
var sign:int, e:Entity;
// horizontal
if (moveX != 0)
{
sign = moveX > 0 ? 1 : -1;
while (moveX != 0)
{
moveX -= sign;
if ((e = collide(solid, x + sign, y)))
{
collideX(e);
moveX = 0;
}
// edge of screen
else if (x + sign < width / 2 || x + sign > MyWorld.width - width / 2)
{
moveX = 0;
}
else x += sign;
}
}
// vertical
if (moveY != 0)
{
sign = moveY > 0 ? 1 : -1;
while (moveY != 0)
{
moveY -= sign;
if ((e = collide(solid, x, y + sign)))
{
collideY(e);
moveY = 0;
}
// edge of screen
else if (y + sign < height / 2 || y + sign > MyWorld.height - height / 2)
{
moveY = 0;
}
else y += sign;
}
}
}
/**
* Horizontal collision (override for specific behaviour).
*/
protected function collideX(e:Entity):void
{
}
/**
* Vertical collision (override for specific behaviour).
*/
protected function collideY(e:Entity):void
{
}
/**
* Helper vars used by move().
*/
private var _moveX:Number = 0;
private var _moveY:Number = 0;
}
} |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is [Open Source Virtual Machine.].
*
* The Initial Developer of the Original Code is
* Adobe System Incorporated.
* Portions created by the Initial Developer are Copyright (C) 2004-2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Adobe AS3 Team
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
import PublicClassImpInternalInt.*;
var SECTION = "Definitions"; // provide a document reference (ie, Actionscript section)
var VERSION = "AS3"; // Version of ECMAScript or ActionScript
var TITLE = "Public class implements internal interface"; // Provide ECMA section title or a description
var BUGNUMBER = "";
startTest(); // leave this alone
/**
* Calls to AddTestCase here. AddTestCase is a function that is defined
* in shell.js and takes three arguments:
* - a string representation of what is being tested
* - the expected result
* - the actual result
*
* For example, a test might look like this:
*
* var helloWorld = "Hello World";
*
* AddTestCase(
* "var helloWorld = 'Hello World'", // description of the test
* "Hello World", // expected result
* helloWorld ); // actual result
*
*/
///////////////////////////////////////////////////////////////
// add your tests here
var obj = new PublicsubClass();
//use namespace ns;
//Public class extends Public class implements an internal interface with a default method
//AddTestCase("Public class extends Public class implements an internal interface with a //default method", "PASSED", obj.getdeffunc());
//Public class extends Public class implements an internal interface with a public method
AddTestCase("Public class extends Public class implements an internal interface with a public method", false, obj.pubFunc());
//Public class extends Public class implements an internal interface with a namespace method
AddTestCase("Public class extends Public class implements an internal interface with a namespace method", 4, obj.getnsFunc());
////////////////////////////////////////////////////////////////
test(); // leave this alone. this executes the test cases and
// displays results.
|
package editor.command
{
import editor.core.EDConfig;
import emap.map2d.EMap2D;
import emap.map2d.Floor;
import emap.map2d.Route;
import emap.map2d.core.E2Config;
import flash.display.Sprite;
import flash.events.MouseEvent;
public class SubRouteCommand extends _InternalCommand
{
public function SubRouteCommand($value:Boolean)
{
begin = $value;
super();
}
override public function execute():void
{
commandStart();
if(begin)
EDConfig.instance.routeManager.beginDeleteRoute();
else
EDConfig.instance.routeManager.endDeleteRoute();
commandEnd();
}
private var begin:Boolean;
private var floor:Floor;
private var nodeLayer:Sprite;
private var eMap:EMap2D;
}
} |
package com.qcenzo.flake2d.system
{
public namespace flake2d;
} |
package laya.webgl.atlas {
import laya.renders.Render;
import laya.resource.Bitmap;
import laya.resource.HTMLImage;
import laya.utils.Browser;
import laya.webgl.resource.WebGLImage;
import laya.webgl.WebGL;
import laya.webgl.WebGLContext;
public class AtlasWebGLCanvas extends Bitmap {
public var _atlaser:Atlaser = null;
/***
* 设置图片宽度
* @param value 图片宽度
*/
public function set width(value:Number):void {
_w = value;
}
/***
* 设置图片高度
* @param value 图片高度
*/
public function set height(value:Number):void {
_h = value;
}
public function AtlasWebGLCanvas() {
super();
}
/**兼容Stage3D使用*/
public var _flashCacheImage:WebGLImage;
public var _flashCacheImageNeedFlush:Boolean = false;
/***重新创建资源*/
override protected function recreateResource():void {
var gl:WebGLContext = WebGL.mainContext;
var glTex:* = _source = gl.createTexture();
var preTarget:* = WebGLContext.curBindTexTarget;
var preTexture:* = WebGLContext.curBindTexValue;
WebGLContext.bindTexture(gl, WebGLContext.TEXTURE_2D, glTex);
gl.texImage2D(WebGLContext.TEXTURE_2D, 0, WebGLContext.RGBA, _w, _h, 0, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, null);
gl.texParameteri(WebGLContext.TEXTURE_2D, WebGLContext.TEXTURE_MIN_FILTER, WebGLContext.LINEAR);
gl.texParameteri(WebGLContext.TEXTURE_2D, WebGLContext.TEXTURE_MAG_FILTER, WebGLContext.LINEAR);
gl.texParameteri(WebGLContext.TEXTURE_2D, WebGLContext.TEXTURE_WRAP_S, WebGLContext.CLAMP_TO_EDGE);
gl.texParameteri(WebGLContext.TEXTURE_2D, WebGLContext.TEXTURE_WRAP_T, WebGLContext.CLAMP_TO_EDGE);
(preTarget && preTexture) && (WebGLContext.bindTexture(gl, preTarget, preTexture));
memorySize = _w * _h * 4;
completeCreate();
}
/***销毁资源*/
override protected function disposeResource():void {
if (_source) {
WebGL.mainContext.deleteTexture(_source);
_source = null;
memorySize = 0;
}
}
/**采样image到WebGLTexture的一部分*/
public function texSubImage2D(xoffset:Number, yoffset:Number, bitmap:*):void {
if (!Render.isFlash) {
var gl:WebGLContext = WebGL.mainContext;
var preTarget:* = WebGLContext.curBindTexTarget;
var preTexture:* = WebGLContext.curBindTexValue;
WebGLContext.bindTexture(gl, WebGLContext.TEXTURE_2D, _source);
//由于HTML5中Image不能直接获取像素素数,只能先画到Canvas上再取出像素数据,再分别texSubImage2D四个边缘(包含一次行列转换),性能可能低于直接texSubImage2D整张image,
//实测76*59的image此函数耗时1.2毫秒
gl.pixelStorei( WebGLContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
(xoffset - 1 >= 0) && (gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset - 1, yoffset, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap));
(xoffset + 1 <= _w) && (gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset + 1, yoffset, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap));
(yoffset - 1 >= 0) && (gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset, yoffset - 1, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap));
(yoffset + 1 <= _h) && (gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset, yoffset + 1, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap));
gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset, yoffset, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap);
gl.pixelStorei( WebGLContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
(preTarget && preTexture) && (WebGLContext.bindTexture(gl, preTarget, preTexture));
} else {
if (!_flashCacheImage) {
_flashCacheImage = HTMLImage.create("");
_flashCacheImage._image.createCanvas(_w, _h);
}
var bmData:* = bitmap.bitmapdata;
//(xoffset - 1 >= 0) && (_flashCacheImage.image.copyPixels(bmData, 0, 0, bmData.width - 1, bmData.height, xoffset, yoffset));
//(xoffset + 1 <= _w) && (_flashCacheImage.image.copyPixels(bmData, 0, 0, bmData.width + 1, bmData.height, xoffset, yoffset));
//(yoffset - 1 >= 0) && (_flashCacheImage.image.copyPixels(bmData, 0, 0, bmData.width, bmData.height - 1, xoffset, yoffset));
//(yoffset + 1 <= _h) && (_flashCacheImage.image.copyPixels(bmData, 0, 0, bmData.width + 1, bmData.height, xoffset, yoffset));
_flashCacheImage._image.copyPixels(bmData, 0, 0, bmData.width, bmData.height, xoffset, yoffset);
(_flashCacheImageNeedFlush) || (_flashCacheImageNeedFlush = true);
}
}
/**采样image到WebGLTexture的一部分*/
public function texSubImage2DPixel(xoffset:Number, yoffset:Number, width:int, height:int, pixel:*):void {
var gl:WebGLContext = WebGL.mainContext;
var preTarget:* = WebGLContext.curBindTexTarget;
var preTexture:* = WebGLContext.curBindTexValue;
WebGLContext.bindTexture(gl, WebGLContext.TEXTURE_2D, _source);
////由于HTML5中Image不能直接获取像素素数,只能先画到Canvas上再取出像素数据,再分别texSubImage2D四个边缘(包含一次行列转换),性能可能低于直接texSubImage2D整张image,
////实测76*59的image此函数耗时1.2毫秒
//(xoffset - 1 >= 0) && (gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset - 1, yoffset, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap));
//(xoffset + 1 <= _w) && (gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset + 1, yoffset, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap));
//(yoffset - 1 >= 0) && (gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset, yoffset - 1, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap));
//(yoffset + 1 <= _h) && (gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset, yoffset + 1, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, bitmap));
var pixels:Uint8Array = new Uint8Array(pixel.data);
gl.pixelStorei( WebGLContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
gl.texSubImage2D(WebGLContext.TEXTURE_2D, 0, xoffset, yoffset, width, height, WebGLContext.RGBA, WebGLContext.UNSIGNED_BYTE, pixels);
gl.pixelStorei( WebGLContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
(preTarget && preTexture) && (WebGLContext.bindTexture(gl, preTarget, preTexture));
}
}
} |
/*
Feathers
Copyright 2012-2013 Joshua Tynjala. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/
package feathers.controls
{
import feathers.controls.renderers.DefaultGroupedListHeaderOrFooterRenderer;
import feathers.controls.renderers.DefaultGroupedListItemRenderer;
import feathers.controls.supportClasses.GroupedListDataViewPort;
import feathers.core.IFocusDisplayObject;
import feathers.core.PropertyProxy;
import feathers.data.HierarchicalCollection;
import feathers.events.CollectionEventType;
import feathers.layout.ILayout;
import feathers.layout.VerticalLayout;
import flash.geom.Point;
import flash.ui.Keyboard;
import starling.events.Event;
import starling.events.KeyboardEvent;
/**
* Dispatched when the selected item changes.
*
* @eventType starling.events.Event.CHANGE
*/
[Event(name="change",type="starling.events.Event")]
/**
* Dispatched when an item renderer is added to the list. When the layout is
* virtualized, item renderers may not exist for every item in the data
* provider. This event can be used to track which items currently have
* renderers.
*
* @eventType feathers.events.FeathersEventType.RENDERER_ADD
*/
[Event(name="rendererAdd",type="starling.events.Event")]
/**
* Dispatched when an item renderer is removed from the list. When the layout is
* virtualized, item renderers may not exist for every item in the data
* provider. This event can be used to track which items currently have
* renderers.
*
* @eventType feathers.events.FeathersEventType.RENDERER_REMOVE
*/
[Event(name="rendererRemove",type="starling.events.Event")]
[DefaultProperty("dataProvider")]
/**
* Displays a list of items divided into groups or sections. Takes a
* hierarchical provider limited to two levels of hierarchy. This component
* supports scrolling, custom item (and header and footer) renderers, and
* custom layouts.
*
* <p>Layouts may be, and are highly encouraged to be, <em>virtual</em>,
* meaning that the List is capable of creating a limited number of item
* renderers to display a subset of the data provider instead of creating a
* renderer for every single item. This allows for optimal performance with
* very large data providers.</p>
*
* <p>The following example creates a grouped list, gives it a data
* provider, tells the item renderer how to interpret the data, and listens
* for when the selection changes:</p>
*
* <listing version="3.0">
* var list:GroupedList = new GroupedList();
*
* list.dataProvider = new HierarchicalCollection(
* [
* {
* header: "Dairy",
* children:
* [
* { text: "Milk", thumbnail: textureAtlas.getTexture( "milk" ) },
* { text: "Cheese", thumbnail: textureAtlas.getTexture( "cheese" ) },
* ]
* },
* {
* header: "Bakery",
* children:
* [
* { text: "Bread", thumbnail: textureAtlas.getTexture( "bread" ) },
* ]
* },
* {
* header: "Produce",
* children:
* [
* { text: "Bananas", thumbnail: textureAtlas.getTexture( "bananas" ) },
* { text: "Lettuce", thumbnail: textureAtlas.getTexture( "lettuce" ) },
* { text: "Onion", thumbnail: textureAtlas.getTexture( "onion" ) },
* ]
* },
* ]);
*
* list.itemRendererFactory = function():IGroupedListItemRenderer
* {
* var renderer:DefaultGroupedListItemRenderer = new DefaultGroupedListItemRenderer();
* renderer.labelField = "text";
* renderer.iconSourceField = "thumbnail";
* return renderer;
* };
*
* list.addEventListener( Event.CHANGE, list_changeHandler );
*
* this.addChild( list );</listing>
*
* @see http://wiki.starling-framework.org/feathers/grouped-list
*/
public class GroupedList extends Scroller implements IFocusDisplayObject
{
/**
* @private
*/
private static const HELPER_POINT:Point = new Point();
/**
* An alternate name to use with GroupedList to allow a theme to give it
* an inset style. If a theme does not provide a skin for the inset
* grouped list, the theme will automatically fall back to using the
* default grouped list skin.
*
* <p>An alternate name should always be added to a component's
* <code>nameList</code> before the component is added to the stage for
* the first time.</p>
*
* <p>In the following example, the inset style is applied to a grouped
* list:</p>
*
* <listing version="3.0">
* var list:GroupedList = new GroupedList();
* list.nameList.add( GroupedList.ALTERNATE_NAME_INSET_GROUPED_LIST );
* this.addChild( list );</listing>
*
* @see feathers.core.IFeathersControl#nameList
*/
public static const ALTERNATE_NAME_INSET_GROUPED_LIST:String = "feathers-inset-grouped-list";
/**
* The default name to use with header renderers.
*
* @see feathers.core.IFeathersControl#nameList
*/
public static const DEFAULT_CHILD_NAME_HEADER_RENDERER:String = "feathers-grouped-list-header-renderer";
/**
* An alternate name to use with header renderers to give them an inset
* style. This name is usually only referenced inside themes.
*
* <p>In the following example, the inset style is applied to a grouped
* list's header:</p>
*
* <listing version="3.0">
* list.headerRendererName = GroupedList.ALTERNATE_CHILD_NAME_INSET_HEADER_RENDERER;</listing>
*
* @see feathers.core.IFeathersControl#nameList
*/
public static const ALTERNATE_CHILD_NAME_INSET_HEADER_RENDERER:String = "feathers-grouped-list-inset-header-renderer";
/**
* The default name to use with footer renderers.
*
* @see feathers.core.IFeathersControl#nameList
*/
public static const DEFAULT_CHILD_NAME_FOOTER_RENDERER:String = "feathers-grouped-list-footer-renderer";
/**
* An alternate name to use with footer renderers to give them an inset
* style. This name is usually only referenced inside themes.
*
* <p>In the following example, the inset style is applied to a grouped
* list's footer:</p>
*
* <listing version="3.0">
* list.footerRendererName = GroupedList.ALTERNATE_CHILD_NAME_INSET_FOOTER_RENDERER;</listing>
*/
public static const ALTERNATE_CHILD_NAME_INSET_FOOTER_RENDERER:String = "feathers-grouped-list-inset-footer-renderer";
/**
* An alternate name to use with item renderers to give them an inset
* style. This name is usually only referenced inside themes.
*
* <p>In the following example, the inset style is applied to a grouped
* list's item renderer:</p>
*
* <listing version="3.0">
* list.itemRendererRendererName = GroupedList.ALTERNATE_CHILD_NAME_INSET_ITEM_RENDERER;</listing>
*
* @see feathers.core.IFeathersControl#nameList
*/
public static const ALTERNATE_CHILD_NAME_INSET_ITEM_RENDERER:String = "feathers-grouped-list-inset-item-renderer";
/**
* An alternate name to use for item renderers to give them an inset
* style. Typically meant to be used for the renderer of the first item
* in a group. This name is usually only referenced inside themes.
*
* <p>In the following example, the inset style is applied to a grouped
* list's first item renderer:</p>
*
* <listing version="3.0">
* list.firstItemRendererRendererName = GroupedList.ALTERNATE_CHILD_NAME_INSET_FIRST_ITEM_RENDERER;</listing>
*
* @see feathers.core.IFeathersControl#nameList
*/
public static const ALTERNATE_CHILD_NAME_INSET_FIRST_ITEM_RENDERER:String = "feathers-grouped-list-inset-first-item-renderer";
/**
* An alternate name to use for item renderers to give them an inset
* style. Typically meant to be used for the renderer of the last item
* in a group. This name is usually only referenced inside themes.
*
* <p>In the following example, the inset style is applied to a grouped
* list's last item renderer:</p>
*
* <listing version="3.0">
* list.lastItemRendererRendererName = GroupedList.ALTERNATE_CHILD_NAME_INSET_LAST_ITEM_RENDERER;</listing>
*
* @see feathers.core.IFeathersControl#nameList
*/
public static const ALTERNATE_CHILD_NAME_INSET_LAST_ITEM_RENDERER:String = "feathers-grouped-list-inset-last-item-renderer";
/**
* An alternate name to use for item renderers to give them an inset
* style. Typically meant to be used for the renderer of an item in a
* group that has no other items. This name is usually only referenced
* inside themes.
*
* <p>In the following example, the inset style is applied to a grouped
* list's single item renderer:</p>
*
* <listing version="3.0">
* list.singleItemRendererName = GroupedList.ALTERNATE_CHILD_NAME_INSET_SINGLE_ITEM_RENDERER;</listing>
*
* @see feathers.core.IFeathersControl#nameList
*/
public static const ALTERNATE_CHILD_NAME_INSET_SINGLE_ITEM_RENDERER:String = "feathers-grouped-list-inset-single-item-renderer";
/**
* @copy feathers.controls.Scroller#SCROLL_POLICY_AUTO
*
* @see feathers.controls.Scroller#horizontalScrollPolicy
* @see feathers.controls.Scroller#verticalScrollPolicy
*/
public static const SCROLL_POLICY_AUTO:String = "auto";
/**
* @copy feathers.controls.Scroller#SCROLL_POLICY_ON
*
* @see feathers.controls.Scroller#horizontalScrollPolicy
* @see feathers.controls.Scroller#verticalScrollPolicy
*/
public static const SCROLL_POLICY_ON:String = "on";
/**
* @copy feathers.controls.Scroller#SCROLL_POLICY_OFF
*
* @see feathers.controls.Scroller#horizontalScrollPolicy
* @see feathers.controls.Scroller#verticalScrollPolicy
*/
public static const SCROLL_POLICY_OFF:String = "off";
/**
* @copy feathers.controls.Scroller#SCROLL_BAR_DISPLAY_MODE_FLOAT
*
* @see feathers.controls.Scroller#scrollBarDisplayMode
*/
public static const SCROLL_BAR_DISPLAY_MODE_FLOAT:String = "float";
/**
* @copy feathers.controls.Scroller#SCROLL_BAR_DISPLAY_MODE_FIXED
*
* @see feathers.controls.Scroller#scrollBarDisplayMode
*/
public static const SCROLL_BAR_DISPLAY_MODE_FIXED:String = "fixed";
/**
* @copy feathers.controls.Scroller#SCROLL_BAR_DISPLAY_MODE_NONE
*
* @see feathers.controls.Scroller#scrollBarDisplayMode
*/
public static const SCROLL_BAR_DISPLAY_MODE_NONE:String = "none";
/**
* @copy feathers.controls.Scroller#INTERACTION_MODE_TOUCH
*
* @see feathers.controls.Scroller#interactionMode
*/
public static const INTERACTION_MODE_TOUCH:String = "touch";
/**
* @copy feathers.controls.Scroller#INTERACTION_MODE_MOUSE
*
* @see feathers.controls.Scroller#interactionMode
*/
public static const INTERACTION_MODE_MOUSE:String = "mouse";
/**
* Constructor.
*/
public function GroupedList()
{
super();
}
/**
* @private
* The guts of the List's functionality. Handles layout and selection.
*/
protected var dataViewPort:GroupedListDataViewPort;
/**
* @private
*/
override public function get isFocusEnabled():Boolean
{
return this._isSelectable && this._isFocusEnabled;
}
/**
* @private
*/
protected var _layout:ILayout;
/**
* The layout algorithm used to position and, optionally, size the
* list's items.
*
* <p>By default, if no layout is provided by the time that the list
* initializes, a vertical layout with options targeted at touch screens
* is created.</p>
*
* <p>The following example tells the list to use a horizontal layout:</p>
*
* <listing version="3.0">
* var layout:HorizontalLayout = new HorizontalLayout();
* layout.gap = 20;
* layout.padding = 20;
* list.layout = layout;</listing>
*/
public function get layout():ILayout
{
return this._layout;
}
/**
* @private
*/
public function set layout(value:ILayout):void
{
if(this._layout == value)
{
return;
}
this._layout = value;
this.invalidate(INVALIDATION_FLAG_SCROLL);
}
/**
* @private
*/
protected var _dataProvider:HierarchicalCollection;
/**
* The collection of data displayed by the list.
*
* <p>The following example passes in a data provider and tells the item
* renderer how to interpret the data:</p>
*
* <listing version="3.0">
* list.dataProvider = new HierarchicalCollection(
* [
* {
* header: "Dairy",
* children:
* [
* { text: "Milk", thumbnail: textureAtlas.getTexture( "milk" ) },
* { text: "Cheese", thumbnail: textureAtlas.getTexture( "cheese" ) },
* ]
* },
* {
* header: "Bakery",
* children:
* [
* { text: "Bread", thumbnail: textureAtlas.getTexture( "bread" ) },
* ]
* },
* {
* header: "Produce",
* children:
* [
* { text: "Bananas", thumbnail: textureAtlas.getTexture( "bananas" ) },
* { text: "Lettuce", thumbnail: textureAtlas.getTexture( "lettuce" ) },
* { text: "Onion", thumbnail: textureAtlas.getTexture( "onion" ) },
* ]
* },
* ]);
*
* list.itemRendererFactory = function():IGroupedListItemRenderer
* {
* var renderer:DefaultGroupedListItemRenderer = new DefaultGroupedListItemRenderer();
* renderer.labelField = "text";
* renderer.iconSourceField = "thumbnail";
* return renderer;
* };</listing>
*
* <p>By default, a <code>HierarchicalCollection</code> accepts an
* <code>Array</code> containing objects for each group. By default, the
* <code>header</code> and <code>footer</code> fields in each group will
* contain data to pass to the header and footer renderers of the
* grouped list. The <code>children</code> field of each group should be
* be an <code>Array</code> of data where each item is passed to an item
* renderer.</p>
*
* <p>A custom <em>data descriptor</em> may be passed to the
* <code>HierarchicalCollection</code> to tell it to parse the data
* source differently than the default behavior described above. For
* instance, you might want to use <code>Vector</code> instead of
* <code>Array</code> or structure the data differently. Custom data
* descriptors may be implemented with the
* <code>IHierarchicalCollectionDataDescriptor</code> interface.</p>
*
* @default null
*
* @see feathers.data.HierarchicalCollection
* @see feathers.data.IHierarchicalCollectionDataDescriptor
*/
public function get dataProvider():HierarchicalCollection
{
return this._dataProvider;
}
/**
* @private
*/
public function set dataProvider(value:HierarchicalCollection):void
{
if(this._dataProvider == value)
{
return;
}
if(this._dataProvider)
{
this._dataProvider.removeEventListener(CollectionEventType.RESET, dataProvider_resetHandler);
}
this._dataProvider = value;
if(this._dataProvider)
{
this._dataProvider.addEventListener(CollectionEventType.RESET, dataProvider_resetHandler);
}
//reset the scroll position because this is a drastic change and
//the data is probably completely different
this.horizontalScrollPosition = 0;
this.verticalScrollPosition = 0;
this.invalidate(INVALIDATION_FLAG_DATA);
}
/**
* @private
*/
protected var _isSelectable:Boolean = true;
/**
* Determines if an item in the list may be selected.
*
* <p>The following example disables selection:</p>
*
* <listing version="3.0">
* list.isSelectable = false;</listing>
*
* @default true
*/
public function get isSelectable():Boolean
{
return this._isSelectable;
}
/**
* @private
*/
public function set isSelectable(value:Boolean):void
{
if(this._isSelectable == value)
{
return;
}
this._isSelectable = value;
if(!this._isSelectable)
{
this.setSelectedLocation(-1, -1);
}
this.invalidate(INVALIDATION_FLAG_SELECTED);
}
/**
* @private
*/
protected var _selectedGroupIndex:int = -1;
/**
* The group index of the currently selected item. Returns <code>-1</code>
* if no item is selected.
*
* <p>Because the selection consists of both a group index and an item
* index, this property does not have a setter. To change the selection,
* call <code>setSelectedLocation()</code> instead.</p>
*
* <p>The following example listens for when selection changes and
* requests the selected group index and selected item index:</p>
*
* <listing version="3.0">
* function list_changeHandler( event:Event ):void
* {
* var list:List = GroupedList(event.currentTarget);
* var groupIndex:int = list.selectedGroupIndex;
* var itemIndex:int = list.selectedItemIndex;
*
* }
* list.addEventListener( Event.CHANGE, list_changeHandler );</listing>
*
* @default -1
*
* @see #selectedItemIndex
* @see #setSelectedLocation()
*/
public function get selectedGroupIndex():int
{
return this._selectedGroupIndex;
}
/**
* @private
*/
protected var _selectedItemIndex:int = -1;
/**
* The item index of the currently selected item. Returns <code>-1</code>
* if no item is selected.
*
* <p>Because the selection consists of both a group index and an item
* index, this property does not have a setter. To change the selection,
* call <code>setSelectedLocation()</code> instead.</p>
*
* <p>The following example listens for when selection changes and
* requests the selected group index and selected item index:</p>
*
* <listing version="3.0">
* function list_changeHandler( event:Event ):void
* {
* var list:GroupedList = GroupedList( event.currentTarget );
* var groupIndex:int = list.selectedGroupIndex;
* var itemIndex:int = list.selectedItemIndex;
*
* }
* list.addEventListener( Event.CHANGE, list_changeHandler );</listing>
*
* @default -1
*
* @see #selectedGroupIndex
* @see #setSelectedLocation()
*/
public function get selectedItemIndex():int
{
return this._selectedItemIndex;
}
/**
* The currently selected item. Returns <code>null</code> if no item is
* selected.
*
* <p>The following example listens for when selection changes and
* requests the selected item:</p>
*
* <listing version="3.0">
* function list_changeHandler( event:Event ):void
* {
* var list:GroupedList = GroupedList( event.currentTarget );
* var item:Object = list.selectedItem;
*
* }
* list.addEventListener( Event.CHANGE, list_changeHandler );</listing>
*
* @default null
*/
public function get selectedItem():Object
{
if(!this._dataProvider || this._selectedGroupIndex < 0 || this._selectedItemIndex < 0)
{
return null;
}
return this._dataProvider.getItemAt(this._selectedGroupIndex, this._selectedItemIndex);
}
/**
* @private
*/
public function set selectedItem(value:Object):void
{
const result:Vector.<int> = this._dataProvider.getItemLocation(value);
if(result.length == 2)
{
this.setSelectedLocation(result[0], result[1]);
}
else
{
this.setSelectedLocation(-1, -1);
}
}
/**
* @private
*/
protected var _itemRendererType:Class = DefaultGroupedListItemRenderer;
/**
* The class used to instantiate item renderers. Must implement the
* <code>IGroupedListItemRenderer</code> interface.
*
* <p>To customize properties on the item renderer, use
* <code>itemRendererFactory</code> instead.</p>
*
* <p>The following example changes the item renderer type:</p>
*
* <listing version="3.0">
* list.itemRendererType = CustomItemRendererClass;</listing>
*
* <p>The first item and last item in a group may optionally use
* different item renderer types, if desired. Use the
* <code>firstItemRendererType</code> and <code>lastItemRendererType</code>,
* respectively. Additionally, if a group contains only one item, it may
* also have a different type. Use the <code>singleItemRendererType</code>.
* Finally, factories for each of these types may also be customized.</p>
*
* @default DefaultGroupedListItemRenderer
*
* @see feathers.controls.renderers.IGroupedListItemRenderer
* @see #itemRendererFactory
* @see #firstItemRendererType
* @see #lastItemRendererType
* @see #singleItemRendererType
*/
public function get itemRendererType():Class
{
return this._itemRendererType;
}
/**
* @private
*/
public function set itemRendererType(value:Class):void
{
if(this._itemRendererType == value)
{
return;
}
this._itemRendererType = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _itemRendererFactory:Function;
/**
* A function called that is expected to return a new item renderer. Has
* a higher priority than <code>itemRendererType</code>. Typically, you
* would use an <code>itemRendererFactory</code> instead of an
* <code>itemRendererType</code> if you wanted to initialize some
* properties on each separate item renderer, such as skins.
*
* <p>The function is expected to have the following signature:</p>
*
* <pre>function():IGroupedListItemRenderer</pre>
*
* <p>The following example provides a factory for the item renderer:</p>
*
* <listing version="3.0">
* list.itemRendererFactory = function():IGroupedListItemRenderer
* {
* var renderer:CustomItemRendererClass = new CustomItemRendererClass();
* renderer.backgroundSkin = new Quad( 10, 10, 0xff0000 );
* return renderer;
* };</listing>
*
* <p>The first item and last item in a group may optionally use
* different item renderer factories, if desired. Use the
* <code>firstItemRendererFactory</code> and <code>lastItemRendererFactory</code>,
* respectively. Additionally, if a group contains only one item, it may
* also have a different factory. Use the <code>singleItemRendererFactory</code>.</p>
*
* @default null
*
* @see feathers.controls.renderers.IGroupedListItemRenderer
* @see #itemRendererType
* @see #firstItemRendererFactory
* @see #lastItemRendererFactory
* @see #singleItemRendererFactory
*/
public function get itemRendererFactory():Function
{
return this._itemRendererFactory;
}
/**
* @private
*/
public function set itemRendererFactory(value:Function):void
{
if(this._itemRendererFactory === value)
{
return;
}
this._itemRendererFactory = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _typicalItem:Object = null;
/**
* Used to auto-size the list when a virtualized layout is used. If the
* list's width or height is unknown, the list will try to automatically
* pick an ideal size. This item is used to create a sample item
* renderer to measure item renderers that are virtual and not visible
* in the viewport.
*
* <p>The following example provides a typical item:</p>
*
* <listing version="3.0">
* list.typicalItem = { text: "A typical item", thumbnail: texture };
* list.itemRendererProperties.labelField = "text";
* list.itemRendererProperties.iconSourceField = "thumbnail";</listing>
*
* @default null
*/
public function get typicalItem():Object
{
return this._typicalItem;
}
/**
* @private
*/
public function set typicalItem(value:Object):void
{
if(this._typicalItem == value)
{
return;
}
this._typicalItem = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _itemRendererName:String;
/**
* A name to add to all item renderers in this list. Typically used by a
* theme to provide different skins to different lists.
*
* <p>The following example sets the item renderer name:</p>
*
* <listing version="3.0">
* list.itemRendererName = "my-custom-item-renderer";</listing>
*
* <p>In your theme, you can target this sub-component name to provide
* different skins than the default style:</p>
*
* <listing version="3.0">
* setInitializerForClass( DefaultGroupedListItemRenderer, customItemRendererInitializer, "my-custom-item-renderer");</listing>
*
* @see feathers.core.FeathersControl#nameList
* @see feathers.core.DisplayListWatcher
* @see #firstItemRendererName
* @see #lastItemRendererName
* @see #singleItemRendererName
*/
public function get itemRendererName():String
{
return this._itemRendererName;
}
/**
* @private
*/
public function set itemRendererName(value:String):void
{
if(this._itemRendererName == value)
{
return;
}
this._itemRendererName = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _itemRendererProperties:PropertyProxy;
/**
* A set of key/value pairs to be passed down to all of the list's item
* renderers. These values are shared by each item renderer, so values
* that cannot be shared (such as display objects that need to be added
* to the display list) should be passed to the item renderers using the
* <code>itemRendererFactory</code> or with a theme. The item renderers
* are instances of <code>IGroupedListItemRenderer</code>. The available
* properties depend on which <code>IGroupedListItemRenderer</code>
* implementation is returned by <code>itemRendererFactory</code>.
*
* <p>The following example customizes some item renderer properties
* (this example assumes that the item renderer's label text renderer
* is a <code>BitmapFontTextRenderer</code>):</p>
*
* <listing version="3.0">
* list.itemRendererProperties.@defaultLabelProperties.textFormat = new BitmapFontTextFormat( bitmapFont );
* list.itemRendererProperties.padding = 20;</listing>
*
* <p>If the subcomponent has its own subcomponents, their properties
* can be set too, using attribute <code>@</code> notation. For example,
* to set the skin on the thumb of a <code>SimpleScrollBar</code>
* which is in a <code>Scroller</code> which is in a <code>List</code>,
* you can use the following syntax:</p>
* <pre>list.scrollerProperties.@verticalScrollBarProperties.@thumbProperties.defaultSkin = new Image(texture);</pre>
*
* <p>Setting properties in a <code>itemRendererFactory</code> function instead
* of using <code>itemRendererProperties</code> will result in better
* performance.</p>
*
* @see #itemRendererFactory
* @see feathers.controls.renderers.IGroupedListItemRenderer
* @see feathers.controls.renderers.DefaultGroupedListItemRenderer
*/
public function get itemRendererProperties():Object
{
if(!this._itemRendererProperties)
{
this._itemRendererProperties = new PropertyProxy(childProperties_onChange);
}
return this._itemRendererProperties;
}
/**
* @private
*/
public function set itemRendererProperties(value:Object):void
{
if(this._itemRendererProperties == value)
{
return;
}
if(!value)
{
value = new PropertyProxy();
}
if(!(value is PropertyProxy))
{
const newValue:PropertyProxy = new PropertyProxy();
for(var propertyName:String in value)
{
newValue[propertyName] = value[propertyName];
}
value = newValue;
}
if(this._itemRendererProperties)
{
this._itemRendererProperties.removeOnChangeCallback(childProperties_onChange);
}
this._itemRendererProperties = PropertyProxy(value);
if(this._itemRendererProperties)
{
this._itemRendererProperties.addOnChangeCallback(childProperties_onChange);
}
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _firstItemRendererType:Class;
/**
* The class used to instantiate the item renderer for the first item in
* a group. Must implement the <code>IGroupedListItemRenderer</code>
* interface.
*
* <p>The following example changes the first item renderer type:</p>
*
* <listing version="3.0">
* list.firstItemRendererType = CustomItemRendererClass;</listing>
*
* @see feathers.controls.renderer.IGroupedListItemRenderer
* @see #itemRendererType
* @see #lastItemRendererType
* @see #singleItemRendererType
*/
public function get firstItemRendererType():Class
{
return this._firstItemRendererType;
}
/**
* @private
*/
public function set firstItemRendererType(value:Class):void
{
if(this._firstItemRendererType == value)
{
return;
}
this._firstItemRendererType = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _firstItemRendererFactory:Function;
/**
* A function called that is expected to return a new item renderer for
* the first item in a group. Has a higher priority than
* <code>firstItemRendererType</code>. Typically, you would use an
* <code>firstItemRendererFactory</code> instead of an
* <code>firstItemRendererType</code> if you wanted to initialize some
* properties on each separate item renderer, such as skins.
*
* <p>The function is expected to have the following signature:</p>
*
* <pre>function():IGroupedListItemRenderer</pre>
*
* <p>The following example provides a factory for the item renderer
* used for the first item in a group:</p>
*
* <listing version="3.0">
* list.firstItemRendererFactory = function():IGroupedListItemRenderer
* {
* var renderer:CustomItemRendererClass = new CustomItemRendererClass();
* renderer.backgroundSkin = new Quad( 10, 10, 0xff0000 );
* return renderer;
* };</listing>
*
* @see feathers.controls.renderers.IGroupedListItemRenderer
* @see #firstItemRendererType
* @see #itemRendererFactory
* @see #lastItemRendererFactory
* @see #singleItemRendererFactory
*/
public function get firstItemRendererFactory():Function
{
return this._firstItemRendererFactory;
}
/**
* @private
*/
public function set firstItemRendererFactory(value:Function):void
{
if(this._firstItemRendererFactory === value)
{
return;
}
this._firstItemRendererFactory = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _firstItemRendererName:String;
/**
* A name to add to all item renderers in this list that are the first
* item in a group. Typically used by a theme to provide different skins
* to different lists, and to differentiate first items from regular
* items if they are created with the same class. If this value is null
* the regular <code>itemRendererName</code> will be used instead.
*
* <p>The following example provides an name for the first item renderer
* in a group:</p>
*
* <listing version="3.0">
* list.firstItemRendererName = "my-custom-first-item-renderer";</listing>
*
* <p>In your theme, you can target this sub-component name to provide
* different skins than the default style:</p>
*
* <listing version="3.0">
* setInitializerForClass( DefaultGroupedListItemRenderer, customFirstItemRendererInitializer, "my-custom-first-item-renderer");</listing>
*
* @see feathers.core.FeathersControl#nameList
* @see feathers.core.DisplayListWatcher
* @see #itemRendererName
* @see #lastItemRendererName
* @see #singleItemRendererName
*/
public function get firstItemRendererName():String
{
return this._firstItemRendererName;
}
/**
* @private
*/
public function set firstItemRendererName(value:String):void
{
if(this._firstItemRendererName == value)
{
return;
}
this._firstItemRendererName = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _lastItemRendererType:Class;
/**
* The class used to instantiate the item renderer for the last item in
* a group. Must implement the <code>IGroupedListItemRenderer</code>
* interface.
*
* <p>The following example changes the last item renderer type:</p>
*
* <listing version="3.0">
* list.lastItemRendererType = CustomItemRendererClass;</listing>
*
* @see feathers.controls.renderer.IGroupedListItemRenderer
* @see #lastItemRendererFactory
* @see #itemRendererType
* @see #firstItemRendererType
* @see #singleItemRendererType
*/
public function get lastItemRendererType():Class
{
return this._lastItemRendererType;
}
/**
* @private
*/
public function set lastItemRendererType(value:Class):void
{
if(this._lastItemRendererType == value)
{
return;
}
this._lastItemRendererType = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _lastItemRendererFactory:Function;
/**
* A function called that is expected to return a new item renderer for
* the last item in a group. Has a higher priority than
* <code>lastItemRendererType</code>. Typically, you would use an
* <code>lastItemRendererFactory</code> instead of an
* <code>lastItemRendererType</code> if you wanted to initialize some
* properties on each separate item renderer, such as skins.
*
* <p>The function is expected to have the following signature:</p>
*
* <pre>function():IGroupedListItemRenderer</pre>
*
* <p>The following example provides a factory for the item renderer
* used for the last item in a group:</p>
*
* <listing version="3.0">
* list.firstItemRendererFactory = function():IGroupedListItemRenderer
* {
* var renderer:CustomItemRendererClass = new CustomItemRendererClass();
* renderer.backgroundSkin = new Quad( 10, 10, 0xff0000 );
* return renderer;
* };</listing>
*
* @see feathers.controls.renderers.IGroupedListItemRenderer
* @see #lastItemRendererType
* @see #itemRendererFactory
* @see #firstItemRendererFactory
* @see #singleItemRendererFactory
*/
public function get lastItemRendererFactory():Function
{
return this._lastItemRendererFactory;
}
/**
* @private
*/
public function set lastItemRendererFactory(value:Function):void
{
if(this._lastItemRendererFactory === value)
{
return;
}
this._lastItemRendererFactory = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _lastItemRendererName:String;
/**
* A name to add to all item renderers in this list that are the last
* item in a group. Typically used by a theme to provide different skins
* to different lists, and to differentiate last items from regular
* items if they are created with the same class. If this value is null
* the regular <code>itemRendererName</code> will be used instead.
*
* <p>The following example provides an name for the last item renderer
* in a group:</p>
*
* <listing version="3.0">
* list.lastItemRendererName = "my-custom-last-item-renderer";</listing>
*
* <p>In your theme, you can target this sub-component name to provide
* different skins than the default style:</p>
*
* <listing version="3.0">
* setInitializerForClass( DefaultGroupedListItemRenderer, customLastItemRendererInitializer, "my-custom-last-item-renderer");</listing>
*
* @see feathers.core.FeathersControl#nameList
* @see feathers.core.DisplayListWatcher
* @see #itemRendererName
* @see #firstItemRendererName
* @see #singleItemRendererName
*/
public function get lastItemRendererName():String
{
return this._lastItemRendererName;
}
/**
* @private
*/
public function set lastItemRendererName(value:String):void
{
if(this._lastItemRendererName == value)
{
return;
}
this._lastItemRendererName = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _singleItemRendererType:Class;
/**
* The class used to instantiate the item renderer for an item in a
* group with no other items. Must implement the
* <code>IGroupedListItemRenderer</code> interface.
*
* <p>The following example changes the single item renderer type:</p>
*
* <listing version="3.0">
* list.singleItemRendererType = CustomItemRendererClass;</listing>
*
* @see feathers.controls.renderer.IGroupedListItemRenderer
* @see #singleItemRendererFactory
* @see #itemRendererType
* @see #firstItemRendererType
* @see #lastItemRendererType
*/
public function get singleItemRendererType():Class
{
return this._singleItemRendererType;
}
/**
* @private
*/
public function set singleItemRendererType(value:Class):void
{
if(this._singleItemRendererType == value)
{
return;
}
this._singleItemRendererType = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _singleItemRendererFactory:Function;
/**
* A function called that is expected to return a new item renderer for
* an item in a group with no other items. Has a higher priority than
* <code>singleItemRendererType</code>. Typically, you would use an
* <code>singleItemRendererFactory</code> instead of an
* <code>singleItemRendererType</code> if you wanted to initialize some
* properties on each separate item renderer, such as skins.
*
* <p>The function is expected to have the following signature:</p>
*
* <pre>function():IGroupedListItemRenderer</pre>
*
* <p>The following example provides a factory for the item renderer
* used for when only one item appears in a group:</p>
*
* <listing version="3.0">
* list.firstItemRendererFactory = function():IGroupedListItemRenderer
* {
* var renderer:CustomItemRendererClass = new CustomItemRendererClass();
* renderer.backgroundSkin = new Quad( 10, 10, 0xff0000 );
* return renderer;
* };</listing>
*
* @see feathers.controls.renderers.IGroupedListItemRenderer
* @see #singleItemRendererType
* @see #itemRendererFactory
* @see #firstItemRendererFactory
* @see #lastItemRendererFactory
*/
public function get singleItemRendererFactory():Function
{
return this._singleItemRendererFactory;
}
/**
* @private
*/
public function set singleItemRendererFactory(value:Function):void
{
if(this._singleItemRendererFactory === value)
{
return;
}
this._singleItemRendererFactory = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _singleItemRendererName:String;
/**
* A name to add to all item renderers in this list that are an item in
* a group with no other items. Typically used by a theme to provide
* different skins to different lists, and to differentiate single items
* from other items if they are created with the same class. If this
* value is null the regular <code>itemRendererName</code> will be used
* instead.
*
* <p>The following example provides an name for a single item renderer
* in a group:</p>
*
* <listing version="3.0">
* list.singleItemRendererName = "my-custom-single-item-renderer";</listing>
*
* <p>In your theme, you can target this sub-component name to provide
* different skins than the default style:</p>
*
* <listing version="3.0">
* setInitializerForClass( DefaultGroupedListItemRenderer, customSingleItemRendererInitializer, "my-custom-single-item-renderer");</listing>
*
* @see feathers.core.FeathersControl#nameList
* @see feathers.core.DisplayListWatcher
* @see #itemRendererName
* @see #firstItemRendererName
* @see #lastItemRendererName
*/
public function get singleItemRendererName():String
{
return this._singleItemRendererName;
}
/**
* @private
*/
public function set singleItemRendererName(value:String):void
{
if(this._singleItemRendererName == value)
{
return;
}
this._singleItemRendererName = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _headerRendererType:Class = DefaultGroupedListHeaderOrFooterRenderer;
/**
* The class used to instantiate header renderers. Must implement the
* <code>IGroupedListHeaderOrFooterRenderer</code> interface.
*
* <p>The following example changes the header renderer type:</p>
*
* <listing version="3.0">
* list.headerRendererType = CustomHeaderRendererClass;</listing>
*
* @see feathers.controls.renderers.IGroupedListHeaderOrFooterRenderer
* @see #headerRendererFactory
*/
public function get headerRendererType():Class
{
return this._headerRendererType;
}
/**
* @private
*/
public function set headerRendererType(value:Class):void
{
if(this._headerRendererType == value)
{
return;
}
this._headerRendererType = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _headerRendererFactory:Function;
/**
* A function called that is expected to return a new header renderer.
* Has a higher priority than <code>headerRendererType</code>.
* Typically, you would use an <code>headerRendererFactory</code>
* instead of a <code>headerRendererType</code> if you wanted to
* initialize some properties on each separate header renderer, such as
* skins.
*
* <p>The function is expected to have the following signature:</p>
*
* <pre>function():IGroupedListHeaderOrFooterRenderer</pre>
*
* <p>The following example provides a factory for the header renderer:</p>
*
* <listing version="3.0">
* list.itemRendererFactory = function():IGroupedListHeaderOrFooterRenderer
* {
* var renderer:CustomHeaderRendererClass = new CustomHeaderRendererClass();
* renderer.backgroundSkin = new Quad( 10, 10, 0xff0000 );
* return renderer;
* };</listing>
*
* @see feathers.controls.renderers.IGroupedListHeaderOrFooterRenderer
* @see #headerRendererType
*/
public function get headerRendererFactory():Function
{
return this._headerRendererFactory;
}
/**
* @private
*/
public function set headerRendererFactory(value:Function):void
{
if(this._headerRendererFactory === value)
{
return;
}
this._headerRendererFactory = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _typicalHeader:Object = null;
/**
* Used to auto-size the grouped list. If the list's width or height is
* <code>NaN</code>, the grouped list will try to automatically pick an
* ideal size. This data is used in that process to create a sample
* header renderer.
*
* <p>The following example provides a typical header:</p>
*
* <listing version="3.0">
* list.typicalHeader = { text: "A typical header" };
* list.headerRendererProperties.contentLabelField = "text";</listing>
*/
public function get typicalHeader():Object
{
return this._typicalHeader;
}
/**
* @private
*/
public function set typicalHeader(value:Object):void
{
if(this._typicalHeader == value)
{
return;
}
this._typicalHeader = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _headerRendererName:String = DEFAULT_CHILD_NAME_HEADER_RENDERER;
/**
* A name to add to all header renderers in this grouped list. Typically
* used by a theme to provide different skins to different lists.
*
* <p>The following example sets the header renderer name:</p>
*
* <listing version="3.0">
* list.headerRendererName = "my-custom-header-renderer";</listing>
*
* <p>In your theme, you can target this sub-component name to provide
* different skins than the default style:</p>
*
* <listing version="3.0">
* setInitializerForClass( DefaultGroupedListHeaderOrFooterRenderer, customHeaderRendererInitializer, "my-custom-header-renderer");</listing>
*
* @see feathers.core.FeathersControl#nameList
* @see feathers.core.DisplayListWatcher
*/
public function get headerRendererName():String
{
return this._headerRendererName;
}
/**
* @private
*/
public function set headerRendererName(value:String):void
{
if(this._headerRendererName == value)
{
return;
}
this._headerRendererName = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _headerRendererProperties:PropertyProxy;
/**
* A set of key/value pairs to be passed down to all of the grouped
* list's header renderers. These values are shared by each header
* renderer, so values that cannot be shared (such as display objects
* that need to be added to the display list) should be passed to the
* header renderers using the <code>headerRendererFactory</code> or in a
* theme. The header renderers are instances of
* <code>IGroupedListHeaderOrFooterRenderer</code>. The available
* properties depend on which <code>IGroupedListItemRenderer</code>
* implementation is returned by <code>headerRendererFactory</code>.
*
* <p>The following example customizes some header renderer properties:</p>
*
* <listing version="3.0">
* list.headerRendererProperties.@contentLabelProperties.textFormat = new BitmapFontTextFormat( bitmapFont );
* list.headerRendererProperties.padding = 20;</listing>
*
* <p>If the subcomponent has its own subcomponents, their properties
* can be set too, using attribute <code>@</code> notation. For example,
* to set the skin on the thumb of a <code>SimpleScrollBar</code>
* which is in a <code>Scroller</code> which is in a <code>List</code>,
* you can use the following syntax:</p>
* <pre>list.scrollerProperties.@verticalScrollBarProperties.@thumbProperties.defaultSkin = new Image(texture);</pre>
*
* <p>Setting properties in a <code>headerRendererFactory</code> function instead
* of using <code>headerRendererProperties</code> will result in better
* performance.</p>
*
* @see #headerRendererFactory
* @see feathers.controls.renderers.IGroupedListHeaderOrFooterRenderer
* @see feathers.controls.renderers.DefaultGroupedListHeaderOrFooterRenderer
*/
public function get headerRendererProperties():Object
{
if(!this._headerRendererProperties)
{
this._headerRendererProperties = new PropertyProxy(childProperties_onChange);
}
return this._headerRendererProperties;
}
/**
* @private
*/
public function set headerRendererProperties(value:Object):void
{
if(this._headerRendererProperties == value)
{
return;
}
if(!value)
{
value = new PropertyProxy();
}
if(!(value is PropertyProxy))
{
const newValue:PropertyProxy = new PropertyProxy();
for(var propertyName:String in value)
{
newValue[propertyName] = value[propertyName];
}
value = newValue;
}
if(this._headerRendererProperties)
{
this._headerRendererProperties.removeOnChangeCallback(childProperties_onChange);
}
this._headerRendererProperties = PropertyProxy(value);
if(this._headerRendererProperties)
{
this._headerRendererProperties.addOnChangeCallback(childProperties_onChange);
}
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _footerRendererType:Class = DefaultGroupedListHeaderOrFooterRenderer;
/**
* The class used to instantiate footer renderers. Must implement the
* <code>IGroupedListHeaderOrFooterRenderer</code> interface.
*
* <p>The following example changes the footer renderer type:</p>
*
* <listing version="3.0">
* list.footerRendererType = CustomFooterRendererClass;</listing>
*
* @see feathers.controls.renderers.IGroupedListHeaderOrFooterRenderer
* @see #footerRendererFactory
*/
public function get footerRendererType():Class
{
return this._footerRendererType;
}
/**
* @private
*/
public function set footerRendererType(value:Class):void
{
if(this._footerRendererType == value)
{
return;
}
this._footerRendererType = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _footerRendererFactory:Function;
/**
* A function called that is expected to return a new footer renderer.
* Has a higher priority than <code>footerRendererType</code>.
* Typically, you would use an <code>footerRendererFactory</code>
* instead of a <code>footerRendererType</code> if you wanted to
* initialize some properties on each separate footer renderer, such as
* skins.
*
* <p>The function is expected to have the following signature:</p>
*
* <pre>function():IGroupedListHeaderOrFooterRenderer</pre>
*
* <p>The following example provides a factory for the footer renderer:</p>
*
* <listing version="3.0">
* list.itemRendererFactory = function():IGroupedListHeaderOrFooterRenderer
* {
* var renderer:CustomFooterRendererClass = new CustomFooterRendererClass();
* renderer.backgroundSkin = new Quad( 10, 10, 0xff0000 );
* return renderer;
* };</listing>
*
* @see feathers.controls.renderers.IGroupedListHeaderOrFooterRenderer
* @see #footerRendererType
*/
public function get footerRendererFactory():Function
{
return this._footerRendererFactory;
}
/**
* @private
*/
public function set footerRendererFactory(value:Function):void
{
if(this._footerRendererFactory === value)
{
return;
}
this._footerRendererFactory = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _typicalFooter:Object = null;
/**
* Used to auto-size the grouped list. If the grouped list's width or
* height is <code>NaN</code>, the grouped list will try to
* automatically pick an ideal size. This data is used in that process
* to create a sample footer renderer.
*
* <p>The following example provides a typical footer:</p>
*
* <listing version="3.0">
* list.typicalHeader = { text: "A typical footer" };
* list.footerRendererProperties.contentLabelField = "text";</listing>
*/
public function get typicalFooter():Object
{
return this._typicalFooter;
}
/**
* @private
*/
public function set typicalFooter(value:Object):void
{
if(this._typicalFooter == value)
{
return;
}
this._typicalFooter = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _footerRendererName:String = DEFAULT_CHILD_NAME_FOOTER_RENDERER;
/**
* A name to add to all footer renderers in this grouped list. Typically
* used by a theme to provide different skins to different lists.
*
* <p>The following example sets the footer renderer name:</p>
*
* <listing version="3.0">
* list.footerRendererName = "my-custom-footer-renderer";</listing>
*
* <p>In your theme, you can target this sub-component name to provide
* different skins than the default style:</p>
*
* <listing version="3.0">
* setInitializerForClass( DefaultGroupedListHeaderOrFooterRenderer, customFooterRendererInitializer, "my-custom-footer-renderer");</listing>
*
* @see feathers.core.FeathersControl#nameList
* @see feathers.core.DisplayListWatcher
*/
public function get footerRendererName():String
{
return this._footerRendererName;
}
/**
* @private
*/
public function set footerRendererName(value:String):void
{
if(this._footerRendererName == value)
{
return;
}
this._footerRendererName = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _footerRendererProperties:PropertyProxy;
/**
* A set of key/value pairs to be passed down to all of the grouped
* list's footer renderers. These values are shared by each footer
* renderer, so values that cannot be shared (such as display objects
* that need to be added to the display list) should be passed to the
* footer renderers using a <code>footerRendererFactory</code> or with
* a theme. The header renderers are instances of
* <code>IGroupedListHeaderOrFooterRenderer</code>. The available
* properties depend on which <code>IGroupedListItemRenderer</code>
* implementation is returned by <code>headerRendererFactory</code>.
*
* <p>The following example customizes some header renderer properties:</p>
*
* <listing version="3.0">
* list.footerRendererProperties.@contentLabelProperties.textFormat = new BitmapFontTextFormat( bitmapFont );
* list.footerRendererProperties.padding = 20;</listing>
*
* <p>If the subcomponent has its own subcomponents, their properties
* can be set too, using attribute <code>@</code> notation. For example,
* to set the skin on the thumb of a <code>SimpleScrollBar</code>
* which is in a <code>Scroller</code> which is in a <code>List</code>,
* you can use the following syntax:</p>
* <pre>list.scrollerProperties.@verticalScrollBarProperties.@thumbProperties.defaultSkin = new Image(texture);</pre>
*
* <p>Setting properties in a <code>footerRendererFactory</code> function instead
* of using <code>footerRendererProperties</code> will result in better
* performance.</p>
*
* @see #footerRendererFactory
* @see feathers.controls.renderers.IGroupedListHeaderOrFooterRenderer
* @see feathers.controls.renderers.DefaultGroupedListHeaderOrFooterRenderer
*/
public function get footerRendererProperties():Object
{
if(!this._footerRendererProperties)
{
this._footerRendererProperties = new PropertyProxy(childProperties_onChange);
}
return this._footerRendererProperties;
}
/**
* @private
*/
public function set footerRendererProperties(value:Object):void
{
if(this._footerRendererProperties == value)
{
return;
}
if(!value)
{
value = new PropertyProxy();
}
if(!(value is PropertyProxy))
{
const newValue:PropertyProxy = new PropertyProxy();
for(var propertyName:String in value)
{
newValue[propertyName] = value[propertyName];
}
value = newValue;
}
if(this._footerRendererProperties)
{
this._footerRendererProperties.removeOnChangeCallback(childProperties_onChange);
}
this._footerRendererProperties = PropertyProxy(value);
if(this._footerRendererProperties)
{
this._footerRendererProperties.addOnChangeCallback(childProperties_onChange);
}
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _headerField:String = "header";
/**
* The field in a group that contains the data for a header. If the
* group does not have this field, and a <code>headerFunction</code> is
* not defined, then no header will be displayed for the group. In other
* words, a header is optional, and a group may not have one.
*
* <p>All of the header fields and functions, ordered by priority:</p>
* <ol>
* <li><code>headerFunction</code></li>
* <li><code>headerField</code></li>
* </ol>
*
* <p>The following example sets the header field:</p>
*
* <listing version="3.0">
* list.headerField = "header";</listing>
*
* @see #headerFunction
*/
public function get headerField():String
{
return this._headerField;
}
/**
* @private
*/
public function set headerField(value:String):void
{
if(this._headerField == value)
{
return;
}
this._headerField = value;
this.invalidate(INVALIDATION_FLAG_DATA);
}
/**
* @private
*/
protected var _headerFunction:Function;
/**
* A function used to generate header data for a specific group. If this
* function is not null, then the <code>headerField</code> will be
* ignored.
*
* <p>The function is expected to have the following signature:</p>
* <pre>function( item:Object ):Object</pre>
*
* <p>All of the header fields and functions, ordered by priority:</p>
* <ol>
* <li><code>headerFunction</code></li>
* <li><code>headerField</code></li>
* </ol>
*
* <p>The following example sets the header function:</p>
*
* <listing version="3.0">
* list.headerFunction = function( group:Object ):Object
* {
* return group.header;
* };</listing>
*
* @see #headerField
*/
public function get headerFunction():Function
{
return this._headerFunction;
}
/**
* @private
*/
public function set headerFunction(value:Function):void
{
if(this._headerFunction == value)
{
return;
}
this._headerFunction = value;
this.invalidate(INVALIDATION_FLAG_DATA);
}
/**
* @private
*/
protected var _footerField:String = "footer";
/**
* The field in a group that contains the data for a footer. If the
* group does not have this field, and a <code>footerFunction</code> is
* not defined, then no footer will be displayed for the group. In other
* words, a footer is optional, and a group may not have one.
*
* <p>All of the footer fields and functions, ordered by priority:</p>
* <ol>
* <li><code>footerFunction</code></li>
* <li><code>footerField</code></li>
* </ol>
*
* <p>The following example sets the footer field:</p>
*
* <listing version="3.0">
* list.footerField = "footer";</listing>
*
* @see #footerFunction
*/
public function get footerField():String
{
return this._footerField;
}
/**
* @private
*/
public function set footerField(value:String):void
{
if(this._footerField == value)
{
return;
}
this._footerField = value;
this.invalidate(INVALIDATION_FLAG_DATA);
}
/**
* @private
*/
protected var _footerFunction:Function;
/**
* A function used to generate footer data for a specific group. If this
* function is not null, then the <code>footerField</code> will be
* ignored.
*
* <p>The function is expected to have the following signature:</p>
* <pre>function( item:Object ):Object</pre>
*
* <p>All of the footer fields and functions, ordered by priority:</p>
* <ol>
* <li><code>footerFunction</code></li>
* <li><code>footerField</code></li>
* </ol>
*
* <p>The following example sets the footer function:</p>
*
* <listing version="3.0">
* list.footerFunction = function( group:Object ):Object
* {
* return group.footer;
* };</listing>
*
* @see #footerField
*/
public function get footerFunction():Function
{
return this._footerFunction;
}
/**
* @private
*/
public function set footerFunction(value:Function):void
{
if(this._footerFunction == value)
{
return;
}
this._footerFunction = value;
this.invalidate(INVALIDATION_FLAG_DATA);
}
/**
* The pending group index to scroll to after validating. A value of
* <code>-1</code> means that the scroller won't scroll to a group after
* validating.
*/
protected var pendingGroupIndex:int = -1;
/**
* The pending item index to scroll to after validating. A value of
* <code>-1</code> means that the scroller won't scroll to an item after
* validating.
*/
protected var pendingItemIndex:int = -1;
/**
* @private
*/
override public function dispose():void
{
this.dataProvider = null;
super.dispose();
}
/**
* @private
*/
override public function scrollToPosition(horizontalScrollPosition:Number, verticalScrollPosition:Number, animationDuration:Number = 0):void
{
this.pendingItemIndex = -1;
super.scrollToPosition(horizontalScrollPosition, verticalScrollPosition, animationDuration);
}
/**
* @private
*/
override public function scrollToPageIndex(horizontalPageIndex:int, verticalPageIndex:int, animationDuration:Number = 0):void
{
this.pendingGroupIndex = -1;
this.pendingItemIndex = -1;
super.scrollToPageIndex(horizontalPageIndex, verticalPageIndex, animationDuration);
}
/**
* After the next validation, scrolls the list so that the specified
* item is visible. If <code>animationDuration</code> is greater than
* zero, the scroll will animate. The duration is in seconds.
*
* <p>In the following example, the list is scrolled to display the
* third item in the second group:</p>
*
* <listing version="3.0">
* list.scrollToDisplayIndex( 1, 2 );</listing>
*/
public function scrollToDisplayIndex(groupIndex:int, itemIndex:int, animationDuration:Number = 0):void
{
this.pendingHorizontalPageIndex = -1;
this.pendingVerticalPageIndex = -1;
this.pendingHorizontalScrollPosition = NaN;
this.pendingVerticalScrollPosition = NaN;
if(this.pendingGroupIndex == groupIndex &&
this.pendingItemIndex == itemIndex &&
this.pendingScrollDuration == animationDuration)
{
return;
}
this.pendingGroupIndex = groupIndex;
this.pendingItemIndex = itemIndex;
this.pendingScrollDuration = animationDuration;
this.invalidate(INVALIDATION_FLAG_PENDING_SCROLL);
}
/**
* Sets the selected group and item index.
*
* <p>In the following example, the third item in the second group
* is selected:</p>
*
* <listing version="3.0">
* list.setSelectedLocation( 1, 2 );</listing>
*
* <p>In the following example, the selection is cleared:</p>
*
* <listing version="3.0">
* list.setSelectedLocation( -1, -1 );</listing>
*
* @see #selectedGroupIndex
* @see #selectedItemIndex
* @see #selectedItem
*/
public function setSelectedLocation(groupIndex:int, itemIndex:int):void
{
if(this._selectedGroupIndex == groupIndex && this._selectedItemIndex == itemIndex)
{
return;
}
if((groupIndex < 0 && itemIndex >= 0) || (groupIndex >= 0 && itemIndex < 0))
{
throw new ArgumentError("To deselect items, group index and item index must both be < 0.");
}
this._selectedGroupIndex = groupIndex;
this._selectedItemIndex = itemIndex;
this.invalidate(INVALIDATION_FLAG_SELECTED);
this.dispatchEventWith(Event.CHANGE);
}
/**
* Extracts header data from a group object.
*/
public function groupToHeaderData(group:Object):Object
{
if(this._headerFunction != null)
{
return this._headerFunction(group);
}
else if(this._headerField != null && group && group.hasOwnProperty(this._headerField))
{
return group[this._headerField];
}
return null;
}
/**
* Extracts footer data from a group object.
*/
public function groupToFooterData(group:Object):Object
{
if(this._footerFunction != null)
{
return this._footerFunction(group);
}
else if(this._footerField != null && group && group.hasOwnProperty(this._footerField))
{
return group[this._footerField];
}
return null;
}
/**
* @private
*/
override protected function initialize():void
{
const hasLayout:Boolean = this._layout != null;
super.initialize();
if(!this.dataViewPort)
{
this.viewPort = this.dataViewPort = new GroupedListDataViewPort();
this.dataViewPort.owner = this;
this.dataViewPort.addEventListener(Event.CHANGE, dataViewPort_changeHandler);
this.viewPort = this.dataViewPort;
}
if(!hasLayout)
{
if(this._hasElasticEdges &&
this._verticalScrollPolicy == SCROLL_POLICY_AUTO &&
this._scrollBarDisplayMode != SCROLL_BAR_DISPLAY_MODE_FIXED)
{
//so that the elastic edges work even when the max scroll
//position is 0, similar to iOS.
this.verticalScrollPolicy = SCROLL_POLICY_ON;
}
const layout:VerticalLayout = new VerticalLayout();
layout.useVirtualLayout = true;
layout.paddingTop = layout.paddingRight = layout.paddingBottom =
layout.paddingLeft = 0;
layout.gap = 0;
layout.horizontalAlign = VerticalLayout.HORIZONTAL_ALIGN_JUSTIFY;
layout.verticalAlign = VerticalLayout.VERTICAL_ALIGN_TOP;
layout.manageVisibility = true;
this._layout = layout;
}
}
/**
* @private
*/
override protected function draw():void
{
this.refreshDataViewPortProperties();
super.draw();
this.refreshFocusIndicator();
}
/**
* @private
*/
protected function refreshDataViewPortProperties():void
{
this.dataViewPort.isSelectable = this._isSelectable;
this.dataViewPort.setSelectedLocation(this._selectedGroupIndex, this._selectedItemIndex);
this.dataViewPort.dataProvider = this._dataProvider;
this.dataViewPort.itemRendererType = this._itemRendererType;
this.dataViewPort.itemRendererFactory = this._itemRendererFactory;
this.dataViewPort.itemRendererProperties = this._itemRendererProperties;
this.dataViewPort.itemRendererName = this._itemRendererName;
this.dataViewPort.typicalItem = this._typicalItem;
this.dataViewPort.firstItemRendererType = this._firstItemRendererType;
this.dataViewPort.firstItemRendererFactory = this._firstItemRendererFactory;
this.dataViewPort.firstItemRendererName = this._firstItemRendererName;
this.dataViewPort.lastItemRendererType = this._lastItemRendererType;
this.dataViewPort.lastItemRendererFactory = this._lastItemRendererFactory;
this.dataViewPort.lastItemRendererName = this._lastItemRendererName;
this.dataViewPort.singleItemRendererType = this._singleItemRendererType;
this.dataViewPort.singleItemRendererFactory = this._singleItemRendererFactory;
this.dataViewPort.singleItemRendererName = this._singleItemRendererName;
this.dataViewPort.headerRendererType = this._headerRendererType;
this.dataViewPort.headerRendererFactory = this._headerRendererFactory;
this.dataViewPort.headerRendererProperties = this._headerRendererProperties;
this.dataViewPort.headerRendererName = this._headerRendererName;
this.dataViewPort.typicalHeader = this._typicalHeader;
this.dataViewPort.footerRendererType = this._footerRendererType;
this.dataViewPort.footerRendererFactory = this._footerRendererFactory;
this.dataViewPort.footerRendererProperties = this._footerRendererProperties;
this.dataViewPort.footerRendererName = this._footerRendererName;
this.dataViewPort.typicalFooter = this._typicalFooter;
this.dataViewPort.layout = this._layout;
}
/**
* @private
*/
override protected function handlePendingScroll():void
{
if(this.pendingGroupIndex >= 0 && this.pendingItemIndex >= 0)
{
const item:Object = this._dataProvider.getItemAt(this.pendingGroupIndex, this.pendingItemIndex);
if(item is Object)
{
this.dataViewPort.getScrollPositionForIndex(this.pendingGroupIndex, this.pendingItemIndex, HELPER_POINT);
this.pendingGroupIndex = -1;
this.pendingItemIndex = -1;
if(this.pendingScrollDuration > 0)
{
this.throwTo(Math.max(0, Math.min(HELPER_POINT.x, this._maxHorizontalScrollPosition)),
Math.max(0, Math.min(HELPER_POINT.y, this._maxVerticalScrollPosition)), this.pendingScrollDuration);
}
else
{
this.horizontalScrollPosition = Math.max(0, Math.min(HELPER_POINT.x, this._maxHorizontalScrollPosition));
this.verticalScrollPosition = Math.max(0, Math.min(HELPER_POINT.y, this._maxVerticalScrollPosition));
}
}
}
super.handlePendingScroll();
}
/**
* @private
*/
override protected function focusInHandler(event:Event):void
{
super.focusInHandler(event);
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, stage_keyDownHandler);
}
/**
* @private
*/
override protected function focusOutHandler(event:Event):void
{
super.focusOutHandler(event);
this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, stage_keyDownHandler);
}
/**
* @private
*/
protected function stage_keyDownHandler(event:KeyboardEvent):void
{
if(!this._dataProvider)
{
return;
}
if(event.keyCode == Keyboard.HOME)
{
if(this._dataProvider.getLength() > 0 && this._dataProvider.getLength(0) > 0)
{
this.setSelectedLocation(0, 0);
}
}
if(event.keyCode == Keyboard.END)
{
var groupIndex:int = this._dataProvider.getLength();
var itemIndex:int = -1;
do
{
groupIndex--;
if(groupIndex >= 0)
{
itemIndex = this._dataProvider.getLength(groupIndex) - 1;
}
}
while(groupIndex > 0 && itemIndex < 0)
if(groupIndex >= 0 && itemIndex >= 0)
{
this.setSelectedLocation(groupIndex, itemIndex);
}
}
else if(event.keyCode == Keyboard.UP)
{
groupIndex = this._selectedGroupIndex;
itemIndex = this._selectedItemIndex - 1;
if(itemIndex < 0)
{
do
{
groupIndex--;
if(groupIndex >= 0)
{
itemIndex = this._dataProvider.getLength(groupIndex) - 1;
}
}
while(groupIndex > 0 && itemIndex < 0)
}
if(groupIndex >= 0 && itemIndex >= 0)
{
this.setSelectedLocation(groupIndex, itemIndex);
}
}
else if(event.keyCode == Keyboard.DOWN)
{
groupIndex = this._selectedGroupIndex;
if(groupIndex < 0)
{
itemIndex = -1;
}
else
{
itemIndex = this._selectedItemIndex + 1;
}
if(groupIndex < 0 || itemIndex >= this._dataProvider.getLength(groupIndex))
{
itemIndex = -1;
groupIndex++;
const groupCount:int = this._dataProvider.getLength();
while(groupIndex < groupCount && itemIndex < 0)
{
if(this._dataProvider.getLength(groupIndex) > 0)
{
itemIndex = 0;
}
else
{
groupIndex++;
}
}
}
if(groupIndex >= 0 && itemIndex >= 0)
{
this.setSelectedLocation(groupIndex, itemIndex);
}
}
}
/**
* @private
*/
protected function dataProvider_resetHandler(event:Event):void
{
this.horizontalScrollPosition = 0;
this.verticalScrollPosition = 0;
}
/**
* @private
*/
protected function dataViewPort_changeHandler(event:Event):void
{
this.setSelectedLocation(this.dataViewPort.selectedGroupIndex, this.dataViewPort.selectedItemIndex);
}
}
}
|
/**
* MyClient2地图编辑器 - Copyright (c) 2010 王明凡
*/
package com.vo.common
{
import mx.core.UIComponent;
/**
* 消息提示框2
* @author 王明凡
*/
public class MessageAlert2VO
{
//提示消息
public var msg:String;
//字体颜色
public var color:String="#ed0404";
//x位置
public var x:int=400;
//y位置
public var y:int=50;
//间隔毫秒
public var delay:int=3000;
//指定显示父对象
public var appUI:UIComponent;
}
} |
package net.guttershark.support.eventmanager
{
import fl.controls.LabelButton;
import fl.events.ComponentEvent;
/**
* The LabelButtonEventListenerDelegate implements event listener logic
* for LabelButton instances.
*/
final public class LabelButtonEventListenerDelegate extends EventListenerDelegate
{
/**
* @inheritDoc
*/
override public function addListeners(obj:*):void
{
super.addListeners(obj);
if(obj is LabelButton)
{
if(callbackPrefix + "LabelChange" in callbackDelegate || cycleAllThroughTracking) obj.addEventListener(ComponentEvent.LABEL_CHANGE, onLabelChange);
}
}
/**
* @inheritDoc
*/
override public function dispose():void
{
super.dispose();
}
/**
* @inheritDoc
*/
override protected function removeEventListeners():void
{
super.removeEventListeners();
obj.removeEventListener(ComponentEvent.LABEL_CHANGE,onLabelChange);
}
private function onLabelChange(ce:ComponentEvent):void
{
handleEvent(ce,"LabelChange",true);
}
}
}
|
package {
import flash.display.Sprite;
import flash.display.Stage;
import ngine.tests.HexagonalGridTests;
import org.flexunit.internals.TraceListener;
import org.flexunit.runner.FlexUnitCore;
public class Main extends Sprite {
private var _testCore:FlexUnitCore;
public static var currentStage:Stage;
public function Main() {
currentStage = stage;
_testCore = new FlexUnitCore();
_testCore.addListener(new TraceListener());
_testCore.run(HexagonalGridTests);
};
}
}
|
package com.game
{
public class Setting
{
public static const FONTTYPE:String = "Times New Roman";
public function Setting()
{
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package mx.charts.series
{
import flash.utils.Dictionary;
import mx.charts.HitData;
import mx.charts.chartClasses.HLOCSeriesBase;
import mx.charts.renderers.HLOCItemRenderer;
import mx.charts.series.items.HLOCSeriesItem;
import mx.charts.styles.HaloDefaults;
import mx.core.ClassFactory;
import mx.core.IFlexModuleFactory;
import mx.core.mx_internal;
import mx.graphics.IStroke;
import mx.graphics.LinearGradientStroke;
import mx.graphics.SolidColorStroke;
import mx.graphics.Stroke;
import mx.styles.CSSStyleDeclaration;
use namespace mx_internal;
/**
* Specifies the length, in pixels, for the close tick mark.
* Regardless of this value, an HLOCSeries will not render the close tick
* mark outside of the area assigned to the individual element.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Style(name="closeTickLength", type="Number", format="Length", inherit="no")]
/**
* Specifies the stroke to use for the close tick mark
* if an opening value is specified.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Style(name="closeTickStroke", type="mx.graphics.IStroke", inherit="no")]
/**
* @private
* Style used to determine default color of stroke to be used
* when custom IStroke is specified as either stroke, openTickStroke or
* closeTickStroke.
*/
[Style(name="hlocColor", type="uint", format="Color", inherit="no")]
/**
* Specifies the length, in pixels, for the open tick mark
* if an opening value is specified.
* Regardless of this value, an HLOCSeries will not render the open tick
* mark outside of the area assigned to the individual element.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Style(name="openTickLength", type="Number", format="Length", inherit="no")]
/**
* Specifies the stroke to use for the open tick mark
* if an opening value is specified.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Style(name="openTickStroke", type="mx.graphics.IStroke", inherit="no")]
/**
* Sets the stroke style for this data series.
* You must specify a Stroke object to define the stroke.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Style(name="stroke", type="mx.graphics.IStroke", inherit="no")]
[Exclude(name="hlocColor", kind="style")] //this is private style and excluded from tag inspector
/**
* Represents financial data as a series of elements
* representing the high, low, closing, and, optionally, opening values
* of a data series.
* The top and bottom of the vertical line in each element
* represent the high and low values for the datapoint.
* The right-facing tick mark represents the closing value,
* and the left tick mark represents the opening value, if one was specified.
*
* @mxml
*
* <p>The <code><mx:HLOCSeries></code> tag inherits all the properties
* of its parent classes, and adds the following properties:</p>
*
* <pre>
* <mx:HLOCSeries
* <strong>Styles</strong>
* closeTickLength="<i>No default</i>"
* closeTickStroke="<i>No default</i>"
* openTickLength="<i>No default</i>"
* openTickStroke="<i>No default</i>"
* stroke="<i>No default</i>"
* />
* </pre>
*
* @see mx.charts.HLOCChart
*
* @includeExample ../examples/HLOCChartExample.mxml
*
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public class HLOCSeries extends HLOCSeriesBase
{
include "../../core/Version.as";
//--------------------------------------------------------------------------
//
// Class initialization
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function HLOCSeries()
{
super();
}
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
/**
* @private
*/
private static var _moduleFactoryInitialized:Dictionary = new Dictionary(true);
//--------------------------------------------------------------------------
//
// Overridden methods
//
//--------------------------------------------------------------------------
/**
* @private
*/
private function initStyles():Boolean
{
HaloDefaults.init(styleManager);
var hlocSeriesStyle:CSSStyleDeclaration = HaloDefaults.findStyleDeclaration(styleManager, "mx.charts.series.HLOCSeries");
if (hlocSeriesStyle)
{
hlocSeriesStyle.setStyle("closeTickStroke", new SolidColorStroke(0, 3, 1, false, "normal", "none"));
hlocSeriesStyle.setStyle("openTickStroke", new SolidColorStroke(0, 3, 1, false, "normal", "none"));
hlocSeriesStyle.setStyle("itemRenderer", new ClassFactory(mx.charts.renderers.HLOCItemRenderer));
hlocSeriesStyle.setStyle("stroke", new SolidColorStroke(0,0));
}
return true;
}
/**
* @inheritDoc
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
override public function set moduleFactory(factory:IFlexModuleFactory):void
{
super.moduleFactory = factory;
if (_moduleFactoryInitialized[factory])
return;
_moduleFactoryInitialized[factory] = true;
// our style settings
initStyles();
}
/**
* @private
*/
override public function getAllDataPoints():Array /* of HitData */
{
if (!_renderData)
return [];
if (!(_renderData.filteredCache))
return [];
var itemArr:Array /* of HLOCSeriesItem */ = [];
if (chart && chart.dataTipItemsSet && dataTipItems)
itemArr = dataTipItems;
else if (chart && chart.showAllDataTips && _renderData.filteredCache)
itemArr = _renderData.filteredCache;
else
itemArr = [];
var n:uint = itemArr.length;
var i:uint;
var result:Array /* of HitData */ = [];
for (i = 0; i < n; i++)
{
var v:HLOCSeriesItem = itemArr[i];
if (_renderData.filteredCache.indexOf(v) == -1)
{
var itemExists:Boolean = false;
var m:int = _renderData.filteredCache.length;
for (var j:int = 0; j < m; j++)
{
if (v.item == _renderData.filteredCache[j].item)
{
v = _renderData.filteredCache[j];
itemExists = true;
break;
}
}
if (!itemExists)
continue;
}
if (v)
{
var ypos:Number = _openField != "" ?
(v.open + v.close) / 2 :
v.close;
var id:int = v.index;
var hd:HitData = new HitData(createDataID(id), Math.sqrt(0),
v.x + _renderData.renderedXOffset,
ypos, v);
var istroke:IStroke;
var gb:LinearGradientStroke;
istroke= getStyle("stroke");
if (istroke is SolidColorStroke)
{
hd.contextColor = SolidColorStroke(istroke).color;
}
else if (istroke is LinearGradientStroke)
{
gb = LinearGradientStroke(istroke);
if (gb.entries.length > 0)
hd.contextColor = gb.entries[0].color;
}
hd.dataTipFunction = formatDataTip;
result.push(hd);
}
}
return result;
}
/**
* @private
*/
override public function findDataPoints(x:Number, y:Number,
sensitivity:Number):Array /* of HitData */
{
// esg, 8/7/06: if your mouse is over a series when it gets added and displayed for the first time, this can get called
// before updateData, and before and render data is constructed. The right long term fix is to make sure a stubbed out
// render data is _always_ present, but that's a little disruptive right now.
if (interactive == false || !_renderData)
return [];
var minDist:Number = _renderData.renderedHalfWidth;
var strokeLength:Number = getStyle("closeTickLength");
if (openField != "" && openField != null)
strokeLength += getStyle("openTickLength");
if (minDist > strokeLength)
minDist = strokeLength;
minDist += sensitivity;
var minItem:HLOCSeriesItem;
var n:int = _renderData.filteredCache.length;
for (var i:int = 0; i < n; i++)
{
var v:HLOCSeriesItem = _renderData.filteredCache[i];
var dist:Number = Math.abs((v.x + _renderData.renderedXOffset) - x);
if (dist > minDist)
continue;
var lowValue:Number = Math.max(v.low,Math.max(v.high,v.close));
var highValue:Number = Math.min(v.low,Math.min(v.high,v.close));
if (!isNaN(v.open))
{
lowValue = Math.max(lowValue,v.open);
highValue = Math.min(highValue,v.open);
}
if (highValue- y > sensitivity)
continue;
if (y - lowValue > sensitivity)
continue;
minDist = dist;
minItem = v;
if (dist < _renderData.renderedHalfWidth)
{
// We're actually inside the column, so go no further.
break;
}
}
if (minItem)
{
var ypos:Number = _openField != "" ?
(minItem.open + minItem.close) / 2 :
minItem.close;
var id:int = minItem.index;
var hd:HitData = new HitData(createDataID(id), Math.sqrt(minDist),
minItem.x + _renderData.renderedXOffset,
ypos, minItem);
var istroke:IStroke;
var gb:LinearGradientStroke;
istroke= getStyle("stroke");
if (istroke is SolidColorStroke)
{
hd.contextColor = SolidColorStroke(istroke).color;
}
else if (istroke is LinearGradientStroke)
{
gb = LinearGradientStroke(istroke);
if (gb.entries.length > 0)
hd.contextColor = gb.entries[0].color;
}
hd.dataTipFunction = formatDataTip;
istroke = getStyle("stroke");
if (istroke is SolidColorStroke)
{
hd.contextColor = SolidColorStroke(istroke).color;
}
else if (istroke is LinearGradientStroke)
{
gb = LinearGradientStroke(istroke);
if (gb.entries.length > 0)
hd.contextColor = gb.entries[0].color;
}
return [ hd ];
}
return [];
}
}
}
|
package org.un.cava.birdeye.ravis.utils
{
import flash.display.Graphics;
import flash.geom.Point;
/**
* The class wraps the Graphics class so that you can add a fuzz factor around edges. This is so you can mouse over them
* much more easily. It draws an invisible line underneath the lines that are actually being drawn so that mouse events
* are caught, but it does not appear any different to the user.
*/
public class GraphicsWrapper
{
public var fuzzFactor:Number = 5;
private var _g:Graphics;
private var _actualStyle:Object;
private var _current:Point;
private var _passThrough:Boolean;
private var _disable:Boolean;
public function GraphicsWrapper(g:Graphics)
{
_g = g;
_actualStyle = {};
_current = new Point();
}
public function clear():void
{
_actualStyle = {};
_g.clear();
}
private function applyInvisiStyle():void
{
_g.lineStyle(_actualStyle.thickness + fuzzFactor,
0xFF0000,
0,
_actualStyle.pixelHinting,
_actualStyle.scaleMode,
_actualStyle.caps,
_actualStyle.joints,
_actualStyle.miterLimit);
}
private function applyActualStyle():void
{
_g.lineStyle(_actualStyle.thickness,
_actualStyle.color,
_actualStyle.alpha,
_actualStyle.pixelHinting,
_actualStyle.scaleMode,
_actualStyle.caps,
_actualStyle.joints,
_actualStyle.miterLimit);
}
public function lineStyle(thickness:Number=0,
color:uint=0,
alpha:Number=1,
pixelHinting:Boolean=false,
scaleMode:String="normal",
caps:String=null,
joints:String=null,
miterLimit:Number=3):void
{
_actualStyle.thickness = thickness;
_actualStyle.color = color;
_actualStyle.pixelHinting = pixelHinting;
_actualStyle.scaleMode = scaleMode;
_actualStyle.caps = caps;
_actualStyle.joints = joints;
_actualStyle.miterLimit = miterLimit;
_g.lineStyle(thickness,color,alpha,pixelHinting,scaleMode,caps,joints,miterLimit);
}
public function beginFill(color:uint,alpha:Number=1):void
{
_passThrough = true;
_g.beginFill(color,alpha);
}
public function endFill():void
{
_g.endFill();
_passThrough = false;
}
public function moveTo(x:Number,y:Number):void
{
_g.moveTo(x,y);
_current.x = x;
_current.y = y;
}
public function curveTo(controlX:Number,controlY:Number,x:Number,y:Number):void
{
_g.curveTo(controlX,controlY,x,y);
if(enabled)
{
applyInvisiStyle();
_g.moveTo(_current.x,_current.y);
_g.curveTo(controlX,controlY,x,y);
applyActualStyle();
}
_current.x = x;
_current.y = y;
}
public function lineTo(x:Number,y:Number):void
{
_g.lineTo(x,y);
if(enabled)
{
applyInvisiStyle();
_g.moveTo(_current.x,_current.y);
_g.lineTo(x,y);
applyActualStyle();
}
_current.x = x;
_current.y = y;
}
public function get enabled():Boolean { return _disable == false }
public function get disable():Boolean { return _disable; }
public function set disable(value:Boolean):void
{
_disable = value;
}
}
} |
package asunit.framework {
import p2.reflect.Reflection;
import p2.reflect.ReflectionMethod;
import p2.reflect.ReflectionMetaData;
public class Method {
private var _scopeName:String;
public var expects:String;
public var ignore:Boolean;
public var ignoreDescription:String;
public var metadata:ReflectionMetaData;
public var name:String;
public var order:int = 0;
public var scope:Object;
public var timeout:int = -1;
public var value:Function;
public function Method(scope:Object, reflection:ReflectionMethod) {
this.scope = scope;
this.name = reflection.name;
this.value = scope[reflection.name];
metadata = reflection.getMetaDataByName('Test');
if(metadata != null) {
var ignoreReflection:ReflectionMetaData = reflection.getMetaDataByName('Ignore');
if(ignoreReflection) {
ignore = true;
ignoreDescription = ignoreReflection.getValueFor('description');
}
handleTimeoutMetaData();
applyMetaData('expects');
applyMetaData('order');
}
}
public function get scopeName():String {
return _scopeName ||= Reflection.create(scope).name
}
private function handleTimeoutMetaData():void {
var value:* = metadata.getValueFor('timeout');
if(value != null) {
var message:String = "It seems you're using [Test(timeout=n)] for " + name + ", but this has been deprecated.\n";
message += "If you'd like to set a different timeout value, please send it to your Async instance methods like: async.add(null, timeoutInMilliseconds)";
trace("[DEPRECATION WARNING] " + message);
}
}
// The null response for timeout was updating the
// int field to zero when it needs to be -1...
private function applyMetaData(name:String):void {
var value:* = metadata.getValueFor(name);
if(value != null) {
this[name] = value;
}
}
public function execute():void {
value.call(scope);
}
public function get isTest():Boolean {
return (metadata != null || isLegacyTest);
}
public function get isLegacyTest():Boolean {
return (metadata == null && name.match(/^test/));
}
public function toString():String {
return name;
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package {
import mx.controls.Label;
import mx.controls.dataGridClasses.*;
public class ColorRenderer extends Label {
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
if (data && listData && data[DataGridListData(listData).dataField] < 0)
{
setStyle("color", 0xFF0000);
}
else
{
setStyle("color", 0x009900);
}
}
}
} |
_global.searchResultsArray = new Array();
_global.nodeToProcessArray = new Array();
/*******************************************************************************************
SEARCH FUNCTIONS
These are the functions used for the search process
*******************************************************************************************/
// this function attaches a search field for the user to enter a name to search for.
// it then searches the names xml file to find the program that person is in and calls
// LoadXML to load the program xml file (ie. Architecture, Digital).
function FindDetail(){
// trace("xmlFile is :" + xmlFile);
// trace("now in parseData function");
var spacing = 30;
var mainNode = namesXML.firstChild;
listBox.namesBox_MC.attachMovie("nameSearchBox", "searchBox", 700);
// Listen for the return key to be pressed. if it is go search.
myListener = new Object();
myListener.onKeyDown = function () {
// trace ("You pressed a key.");
if(Key.isDown(Key.ENTER)){
Search();
}
}
Key.addListener(myListener);
//this is so that if they scrolled the list it will start at the top.
listBox.namesBox_MC._y = listBoxStartingY;
listBox.namesBox_MC.searchBox.goSearch.onRelease = function(){
Search();
}
function Search(){
searchResultsArray = [];
nodeToProcessArray = [];
// ResetButtons("", names);
removeMovieClip(detailBox[detailInstanceName]);
// trace("number of names is: " + numberOfNames);
// trace("number of searchNames is: " + numberOfSearchNames);
ResetSearchNames();
numberOfSearchNames = 0;
var nameToSearch = listBox.namesBox_MC.searchBox.SearchBoxMC.searchText.text;
// trace("name to search is: " + nameToSearch);
var numberOfNames = mainNode.childNodes.length;
// trace("number of names is: " + numberOfNames);
for (i=0; i<numberOfNames; i++){
nodeToProcess = mainNode.childNodes[i];
nameConcat = nodeToProcess.childNodes[0].childNodes.toString() + " " + nodeToProcess.childNodes[1].childNodes.toString();
// trace("nameConcat is: " + nameConcat);
// trace("nameToSearch is: " + nameToSearch);
// if (nameConcat == nameToSearch){
if (nameConcat.indexOf(nameToSearch) != -1){
searchResultsArray.push(nameConcat);
nodeToProcessArray.push(nodeToProcess);
// trace("searchResultsArray is: " + searchResultsArray);
// trace("nodeToProcessArray is: " + nodeToProcessArray);
}
}
listBox.namesBox_MC._y = listBoxStartingY;
trace("search array results: " + searchResultsArray.length);
if (searchResultsArray.length == 0){
trace("there are no results");
ResetSearchNames();
detailBox.attachMovie("searchErrorMC", "searchErrorMC", 800);
detailBox.searchErrorMC.errorOK.onRelease = function(){
removeMovieClip(detailBox.searchErrorMC);
}
/*
listBox.namesBox_MC.attachMovie("buttonBox", noResults, 200);
listBox.namesBox_MC.noResults.textBoxMC.menuText.text = "nothing found";
listBox.namesBox_MC.noResults.textBoxMC.menuText.setTextFormat(listBoxTextDisplay);
listBox.namesBox_MC.noResults._y = 60;
*/
}else{
for (z=0; z < searchResultsArray.length; z++){
// trace("in the populate listbox for loop");
var name = "nameBox" + z;
// y = z * listBox.namesBox_MC.searchBox._y;
y = z * spacing + 30; //plus 30 so that the names get displayed below the search box
// trace("searchBox y is: " + listBox.namesBox_MC.searchBox._y);
// trace("y is: " + y);
listBox.namesBox_MC.attachMovie("buttonBox", name, z);
listBox.namesBox_MC[name]._y = y;
listBox.namesBox_MC[name].textBoxMC.menuText.text = searchResultsArray[z];
listBox.namesBox_MC[name].textBoxMC.menuText.setTextFormat(listBoxTextDisplay);
listBox.namesBox_MC[name].node = nodeToProcessArray[z];
// trace("listBox name is: " + listBox.namesbox_MC[name]);
listBox.namesBox_MC[name].name = name;
listBox.namesBox_MC[name].onRollOver = function(){
this.rollover(listBoxRolloverDisplay);
}
listBox.namesBox_MC[name].onRollOut = function(){
this.rollout(listBoxTextDisplay);
}
listBox.namesBox_MC[name].onRelease = function(){
this.searchNameRelease(this.node);
}
// LoadXML(xmlFile, "searchProgram");
// this.searchNameRelease(this.node);
}
}
// keep a number of names count for the clearing function (ResetNames)
listBox.bkgd._yscale += spacing;
numberOfSearchNames += z;
// trace("number of search names is: " + numberOfSearchNames);
}
}
function ResetSearchNames(){
var t = 0;
while (++t < numberOfSearchNames){
name = "nameBox" + t;
listBox.namesBox_MC[name].removeMovieClip();
}
}
// This function searches the program (school) xml file for the searched name and calles the
// DisplayDetail function to display the details.
function LoadDetail(finalName){
// trace("in the load detail function");
// trace("finalName is: " + finalName);
// trace("name concat is: " + nameConcat);
var mainNode = namesXML.firstChild;
// trace("main node is: " + mainNode.toString());
var numberOfNames = mainNode.childNodes.length;
trace ("number of names is: " + numberOfNames);
for (i=0; i<numberOfNames; i++){
NewNodeToProcess = mainNode.childNodes[i];
NewNameConcat = NewNodeToProcess.childNodes[1].childNodes.toString() + " " + NewNodeToProcess.childNodes[2].childNodes.toString();
// trace("nameConcat is: " + nameConcat);
// trace("NewNameConcat is: " + NewNameConcat);
if (finalName == NewNameConcat){
DisplayDetail(NewNodeToProcess);
}
}
}
/*******************************************************************************************
OTHER XML PARSE FUNCTIONS
These are the functions used for the search process
*******************************************************************************************/
// This function is called when the user clicks on a school name. It reads all of the
// student names from the xml file and dispays them in the list box.
function DisplayNames(){
var mainNode = namesXML.firstChild;
spacing = 30;
numberOfStudents = mainNode.childNodes.length;
schoolName = mainNode.attributes.name;
listBox.namesBox_MC._y = listBoxStartingY;
for (i=0; i<numberOfStudents; i++){
nodeToProcess = mainNode.childNodes[i];
nameConcat = nodeToProcess.childNodes[1].childNodes.toString() + " " + nodeToProcess.childNodes[2].childNodes.toString();
name = "nameBox" + i;
y = i * spacing;
listBox.namesBox_MC.attachMovie("buttonBox", name, i);
listBox.namesBox_MC[name]._y = y;
listBox.namesBox_MC[name].textBoxMC.menuText.text = nameConcat;
listBox.namesBox_MC[name].textBoxMC.menuText.setTextFormat(listBoxTextDisplay);
listBox.namesBox_MC[name].node = nodeToProcess;
// trace("listBox name is: " + listBox.namesbox_MC[name]);
listBox.namesBox_MC[name].name = name;
listBox.namesBox_MC[name].onRollOver = function(){
this.rollover(listBoxRolloverDisplay);
}
listBox.namesBox_MC[name].onRollOut = function(){
this.rollout(listBoxTextDisplay);
}
listBox.namesBox_MC[name].onRelease = function(){
this.nameRelease(this.node);
}
// keep a number of names count for the clearing function (ResetNames)
numberOfNames += 1
listBox.bkgd._yscale += spacing;
}
}
// This function reads the student node from the xml file (object) and displays the detail content
// for that student.
function DisplayDetail(node){
// trace ("display detail node is: " + node);
detailInstanceName = "detailBox" + node.childNodes[0].childNodes.toString()
detailBox.attachMovie("detailBoxMC", detailInstanceName, 900);
// trace("detailBoxMC name is: " + detailInstanceName);
// this.detailInstanceName._x = 481.9;
// this.detailInstanceName._y = 64.0;
// trace("detail box frame : " + detailBox[detailInstanceName]._currentframe);
detailBox[detailInstanceName].onEnterFrame = function (){
// trace("in the enterFrame function");
// trace("detail Box Frame is: " + detailBox[detailInstanceName]._currentframe);
if (detailBox[detailInstanceName]._currentframe == detailBoxEndingFrame){
// trace("in the if");
// trace("frame is: " + detailBox[detailInstanceName]._currentframe);
// detailBox[detailInstanceName].detail_bkgd.setRGB(DETAIL_BKGD_COLOR);
// detailBox[detailInstanceName].detail_bkgd._alpha = DETAIL_BKGD_ALPHA;
// detailBox[detailInstanceName].detail_bkgd_2.setRGB(DETAIL_BKGD_COLOR);
// detailBox[detailInstanceName].detail_bkgd_2._alpha = DETAIL_BKGD_ALPHA;
detailStartingY = detailBox[detailInstanceName].detail_bkgd._y + 120;
firstName = node.childNodes[1].childNodes.toString();
lastName = node.childNodes[2].childNodes.toString();
project = node.childNodes[3].childNodes.toString();
media = node.childNodes[4].childNodes.toString();
statement = node.childNodes[5].childNodes.toString();
email = node.childNodes[6].childNodes.toString();
phone = node.childNodes[7].childNodes.toString();
photoURL = lastName + "_" + firstName;
// trace("photoURL is :" + photoURL);
detailBox[detailInstanceName].dynamicName.text = firstName + " " + lastName;
detailBox[detailInstanceName].dynamicEmail.text = "e: " + email;
detailBox[detailInstanceName].dynamicPhone.text = "p: " + phone;
detailBox[detailInstanceName].dynamicStatement.htmlText = statement;
detailBox[detailInstanceName].dynamicMedia.htmlText = media;
detailBox[detailInstanceName].dynamicProject.htmlText = project;
// trace(PICTURE_FOLDER + "/" + photoURL + "/" + photoURL + ".jpg");
// var picOneBytesTotal = detailBox[detailInstanceName].pictureBox1.getBytesTotal();
// var picTwoBytesTotal = detailBox[detailInstanceName].pictureBox2.getBytesTotal();
// trace("pic one bytes total before is: " + picOneBytesTotal);
// trace("pic two bytes total before is: " + picTwoBytesTotal);
// trace("photo URL is: " + photoURL);
detailBox[detailInstanceName].pictureBox1.loadMovie(PICTURE_FOLDER + "/" + photoURL + "/" + photoURL + ".jpg");
detailBox[detailInstanceName].pictureBox2.loadMovie(PICTURE_FOLDER + "/" + photoURL + "/" + photoURL + "-w.jpg");
// var picOneBytesLoaded = detailBox[detailInstanceName].pictureBox1.getBytesLoaded();
// var picTwoBytesLoaded = detailBox[detailInstanceName].pictureBox2.getBytesLoaded();
// trace("pic one bytes loaded after is: " + picOneBytesLoaded);
// trace("pic two bytes loaded after is: " + picTwoBytesLoaded);
// trace(detailBox[detailInstanceName].pictureBox1.loadMovie(PICTURE_FOLDER + "/" + photoURL + "/" + photoURL + ".jpg"));
// if (!detailBox[detailInstanceName].pictureBox1.loadMovie(PICTURE_FOLDER + "/" + photoURL + "/" + photoURL + ".jpg")){
// detailBox[detailInstanceName].pictureBox1.loadMovie(PICTURE_FOLDER + "/none/BOY.jpg")
// }
// if (!detailBox[detailInstanceName].pictureBox2.loadMovie(PICTURE_FOLDER + "/" + photoURL + "/" + photoURL + "-w.jpg")){
// ;
// }
detailBox[detailInstanceName].pictureBox1._width = 50;
detailBox[detailInstanceName].pictureBox1._height = 50;
detailBox[detailInstanceName].pictureBox2._width = 50;
detailBox[detailInstanceName].pictureBox2._height = 50;
// detailBox[detailInstanceName].pictureBox1.onRollOver = function(){
// detailBox[detailInstanceName].pictureBox1._xscale = 200;
// detailBox[detailInstanceName].pictureBox1._yscale = 200;
// }
delete this.onEnterFrame;
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// 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.jewel.supportClasses
{
import org.apache.royale.core.DataContainerBase;
import org.apache.royale.utils.IClassSelectorListSupport;
import org.apache.royale.utils.ClassSelectorList;
public class DataContainerBase extends org.apache.royale.core.DataContainerBase implements IClassSelectorListSupport
{
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function DataContainerBase()
{
classSelectorList = new ClassSelectorList(this);
super();
}
protected var classSelectorList:ClassSelectorList;
COMPILE::JS
override protected function setClassName(value:String):void
{
classSelectorList.addNames(value);
}
/**
* Add a class selector to the list.
*
* @param name Name of selector to add.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
public function addClass(name:String):void
{
COMPILE::JS
{
classSelectorList.add(name);
}
}
/**
* Removes a class selector from the list.
*
* @param name Name of selector to remove.
*
* @royaleignorecoercion HTMLElement
* @royaleignorecoercion DOMTokenList
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
public function removeClass(name:String):void
{
COMPILE::JS
{
classSelectorList.remove(name);
}
}
/**
* Add or remove a class selector to/from the list.
*
* @param name Name of selector to add or remove.
* @param value True to add, False to remove.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
public function toggleClass(name:String, value:Boolean):void
{
COMPILE::JS
{
classSelectorList.toggle(name, value);
}
}
/**
* Search for the name in the element class list
*
* @param name Name of selector to find.
* @return return true if the name is found or false otherwise.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.3
*/
public function containsClass(name:String):Boolean
{
COMPILE::JS
{
return classSelectorList.contains(name);
}
COMPILE::SWF
{//not implemented
return false;
}
}
}
} |
package laya.debug.view.nodeInfo.nodetree
{
import laya.debug.data.Base64AtlasManager;
import laya.events.Event;
import laya.maths.Rectangle;
import laya.debug.tools.DisControlTool;
import laya.debug.ui.debugui.DebugPanelUI;
/**
* ...
* @author ww
*/
public class DebugPage extends DebugPanelUI
{
private var views:Array;
public function DebugPage()
{
Base64AtlasManager.replaceRes(DebugPanelUI.uiView);
createView(DebugPanelUI.uiView);
DisControlTool.setResizeAbleEx(this);
views = [treePanel,selectPanel, profilePanel];
tab.selectedIndex = 0;
tabChange();
tab.on(Event.CHANGE, this, tabChange);
changeSize();
}
override protected function createChildren():void
{
super.viewMapRegists();
}
private function tabChange():void
{
//trace("tabChange:",tab.selectedIndex);
DisControlTool.addOnlyByIndex(views, tab.selectedIndex, this);
DisControlTool.setTop(resizeBtn);
}
private var msRec:Rectangle=new Rectangle();
override protected function changeSize():void
{
// TODO Auto Generated method stub
if (this.width < 245)
{
this.width = 245;
//return;
}
if (this.height < 100)
{
this.height = 200;
//return;
}
super.changeSize();
msRec.setTo(0,0,this.width,this.height);
this.scrollRect=msRec;
}
}
} |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* brendan@mozilla.org, pschwartau@netscape.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Date: 2001-08-27
*
* SUMMARY: Testing binding of function names
*
* Brendan:
*
* "... the question is, does Rhino bind 'sum' in the global object
* for the following test? If it does, it's buggy.
*
* var f = function sum(){};
* print(sum); // should fail with 'sum is not defined' "
*
*/
//-----------------------------------------------------------------------------
var SECTION = "binding_001";
var VERSION = "";
var ERR_REF_YES = 'ReferenceError';
var ERR_REF_NO = 'did NOT generate a ReferenceError';
startTest();
var TITLE = "Testing binding of function names";
writeHeaderToLog( SECTION + " "+ TITLE);
var testcases = getTestCases();
test();
function getTestCases() {
var array = new Array();
var item = 0;
var UBound = 0;
var statusitems = [];
var actualvalues = [];
var expectedvalues = [];
var status = TITLE;
var actual = ERR_REF_NO;
var expect= ERR_REF_YES;
//var match;
try
{
var f = function sum(){};
trace(sum);
}
catch (e)
{
status = 'e instanceof ReferenceError';
actual = e instanceof ReferenceError;
expect = true;
array[item++] = new TestCase(SECTION, status, isReferenceError(expect), isReferenceError(actual));
/*
* This test is more literal, and one day may not be valid.
* Searching for literal string "ReferenceError" in e.toString()
*/
status = 'e.toString().search(/ReferenceError/)';
var match = e.toString().search(/ReferenceError/);
actual = (match > -1);
expect = true;
array[item++] = new TestCase(SECTION, status, isReferenceError(expect), isReferenceError(actual));
}
return array;
}
// converts a Boolean result into a textual result -
function isReferenceError(bResult)
{
return bResult? ERR_REF_YES : ERR_REF_NO;
}
|
package zpp_nape.util
{
import zpp_nape.geom.ZPP_SimpleEvent;
public class ZPP_Set_ZPP_SimpleEvent extends Object
{
public function ZPP_Set_ZPP_SimpleEvent()
{
}
public static var zpp_pool:ZPP_Set_ZPP_SimpleEvent;
public function verify() : Boolean
{
var _loc1_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc2_:* = null as ZPP_SimpleEvent;
var _loc3_:* = false;
var _loc4_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc5_:* = null as ZPP_SimpleEvent;
if(!empty())
{
_loc1_ = parent;
while(_loc1_.prev != null)
{
_loc1_ = _loc1_.prev;
}
while(_loc1_ != null)
{
_loc2_ = _loc1_.data;
_loc3_ = true;
if(!empty())
{
_loc4_ = parent;
while(_loc4_.prev != null)
{
_loc4_ = _loc4_.prev;
}
while(_loc4_ != null)
{
_loc5_ = _loc4_.data;
if(!_loc3_)
{
if(!lt(_loc2_,_loc5_))
{
false;
}
if(false)
{
return false;
}
}
else if(_loc2_ == _loc5_)
{
_loc3_ = false;
}
else
{
if(!lt(_loc5_,_loc2_))
{
false;
}
if(false)
{
return false;
}
}
if(_loc4_.next != null)
{
_loc4_ = _loc4_.next;
while(_loc4_.prev != null)
{
_loc4_ = _loc4_.prev;
}
}
else
{
while(true)
{
if(_loc4_.parent != null)
{
false;
}
if(!false)
{
break;
}
_loc4_ = _loc4_.parent;
}
_loc4_ = _loc4_.parent;
}
}
}
if(_loc1_.next != null)
{
_loc1_ = _loc1_.next;
while(_loc1_.prev != null)
{
_loc1_ = _loc1_.prev;
}
}
else
{
while(true)
{
if(_loc1_.parent != null)
{
false;
}
if(!false)
{
break;
}
_loc1_ = _loc1_.parent;
}
_loc1_ = _loc1_.parent;
}
}
}
return true;
}
public function try_insert_bool(param1:ZPP_SimpleEvent) : Boolean
{
var _loc2_:ZPP_Set_ZPP_SimpleEvent = null;
var _loc3_:ZPP_Set_ZPP_SimpleEvent = null;
if(parent == null)
{
if(ZPP_Set_ZPP_SimpleEvent.zpp_pool == null)
{
_loc2_ = new ZPP_Set_ZPP_SimpleEvent();
}
else
{
_loc2_ = ZPP_Set_ZPP_SimpleEvent.zpp_pool;
ZPP_Set_ZPP_SimpleEvent.zpp_pool = _loc2_.next;
_loc2_.next = null;
}
_loc2_.alloc();
_loc2_.data = param1;
parent = _loc2_;
}
else
{
_loc3_ = parent;
while(true)
{
if(lt(param1,_loc3_.data))
{
if(_loc3_.prev == null)
{
if(ZPP_Set_ZPP_SimpleEvent.zpp_pool == null)
{
_loc2_ = new ZPP_Set_ZPP_SimpleEvent();
}
else
{
_loc2_ = ZPP_Set_ZPP_SimpleEvent.zpp_pool;
ZPP_Set_ZPP_SimpleEvent.zpp_pool = _loc2_.next;
_loc2_.next = null;
}
_loc2_.alloc();
_loc2_.data = param1;
_loc3_.prev = _loc2_;
_loc2_.parent = _loc3_;
break;
}
_loc3_ = _loc3_.prev;
continue;
}
if(lt(_loc3_.data,param1))
{
if(_loc3_.next == null)
{
if(ZPP_Set_ZPP_SimpleEvent.zpp_pool == null)
{
_loc2_ = new ZPP_Set_ZPP_SimpleEvent();
}
else
{
_loc2_ = ZPP_Set_ZPP_SimpleEvent.zpp_pool;
ZPP_Set_ZPP_SimpleEvent.zpp_pool = _loc2_.next;
_loc2_.next = null;
}
_loc2_.alloc();
_loc2_.data = param1;
_loc3_.next = _loc2_;
_loc2_.parent = _loc3_;
break;
}
_loc3_ = _loc3_.next;
continue;
}
break;
}
}
if(_loc2_ == null)
{
return false;
}
if(_loc2_.parent == null)
{
_loc2_.colour = 1;
}
else
{
_loc2_.colour = 0;
if(_loc2_.parent.colour == 0)
{
__fix_dbl_red(_loc2_);
}
}
return true;
}
public function try_insert(param1:ZPP_SimpleEvent) : ZPP_Set_ZPP_SimpleEvent
{
var _loc2_:ZPP_Set_ZPP_SimpleEvent = null;
var _loc3_:ZPP_Set_ZPP_SimpleEvent = null;
if(parent == null)
{
if(ZPP_Set_ZPP_SimpleEvent.zpp_pool == null)
{
_loc2_ = new ZPP_Set_ZPP_SimpleEvent();
}
else
{
_loc2_ = ZPP_Set_ZPP_SimpleEvent.zpp_pool;
ZPP_Set_ZPP_SimpleEvent.zpp_pool = _loc2_.next;
_loc2_.next = null;
}
_loc2_.alloc();
_loc2_.data = param1;
parent = _loc2_;
}
else
{
_loc3_ = parent;
while(true)
{
if(lt(param1,_loc3_.data))
{
if(_loc3_.prev == null)
{
if(ZPP_Set_ZPP_SimpleEvent.zpp_pool == null)
{
_loc2_ = new ZPP_Set_ZPP_SimpleEvent();
}
else
{
_loc2_ = ZPP_Set_ZPP_SimpleEvent.zpp_pool;
ZPP_Set_ZPP_SimpleEvent.zpp_pool = _loc2_.next;
_loc2_.next = null;
}
_loc2_.alloc();
_loc2_.data = param1;
_loc3_.prev = _loc2_;
_loc2_.parent = _loc3_;
break;
}
_loc3_ = _loc3_.prev;
continue;
}
if(lt(_loc3_.data,param1))
{
if(_loc3_.next == null)
{
if(ZPP_Set_ZPP_SimpleEvent.zpp_pool == null)
{
_loc2_ = new ZPP_Set_ZPP_SimpleEvent();
}
else
{
_loc2_ = ZPP_Set_ZPP_SimpleEvent.zpp_pool;
ZPP_Set_ZPP_SimpleEvent.zpp_pool = _loc2_.next;
_loc2_.next = null;
}
_loc2_.alloc();
_loc2_.data = param1;
_loc3_.next = _loc2_;
_loc2_.parent = _loc3_;
break;
}
_loc3_ = _loc3_.next;
continue;
}
break;
}
}
if(_loc2_ == null)
{
return _loc3_;
}
if(_loc2_.parent == null)
{
_loc2_.colour = 1;
}
else
{
_loc2_.colour = 0;
if(_loc2_.parent.colour == 0)
{
__fix_dbl_red(_loc2_);
}
}
return _loc2_;
}
public var swapped:Function;
public function successor_node(param1:ZPP_Set_ZPP_SimpleEvent) : ZPP_Set_ZPP_SimpleEvent
{
var _loc2_:* = null as ZPP_Set_ZPP_SimpleEvent;
if(param1.next != null)
{
param1 = param1.next;
while(param1.prev != null)
{
param1 = param1.prev;
}
}
else
{
_loc2_ = param1;
param1 = param1.parent;
while(true)
{
if(param1 != null)
{
false;
}
if(!false)
{
break;
}
_loc2_ = param1;
param1 = param1.parent;
}
}
return param1;
}
public function successor(param1:ZPP_SimpleEvent) : ZPP_SimpleEvent
{
var _loc2_:ZPP_Set_ZPP_SimpleEvent = successor_node(find(param1));
return _loc2_ == null?null:_loc2_.data;
}
public function size() : int
{
var _loc2_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc3_:* = null as ZPP_SimpleEvent;
var _loc1_:* = 0;
if(!empty())
{
_loc2_ = parent;
while(_loc2_.prev != null)
{
_loc2_ = _loc2_.prev;
}
while(_loc2_ != null)
{
_loc3_ = _loc2_.data;
_loc1_++;
if(_loc2_.next != null)
{
_loc2_ = _loc2_.next;
while(_loc2_.prev != null)
{
_loc2_ = _loc2_.prev;
}
}
else
{
while(true)
{
if(_loc2_.parent != null)
{
false;
}
if(!false)
{
break;
}
_loc2_ = _loc2_.parent;
}
_loc2_ = _loc2_.parent;
}
}
}
return _loc1_;
}
public function singular() : Boolean
{
if(parent != null)
{
false;
}
if(false)
{
false;
}
return false;
}
public function remove_node(param1:ZPP_Set_ZPP_SimpleEvent) : void
{
var _loc2_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc3_:* = null as ZPP_SimpleEvent;
var _loc4_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc5_:* = null as ZPP_Set_ZPP_SimpleEvent;
if(param1.next != null)
{
false;
}
if(false)
{
_loc2_ = param1.next;
while(_loc2_.prev != null)
{
_loc2_ = _loc2_.prev;
}
_loc3_ = param1.data;
param1.data = _loc2_.data;
_loc2_.data = _loc3_;
if(swapped != null)
{
swapped(param1.data,_loc2_.data);
}
param1 = _loc2_;
}
_loc2_ = param1.prev == null?param1.next:param1.prev;
if(param1.colour == 1)
{
if(param1.prev == null)
{
true;
}
if(true)
{
_loc2_.colour = 1;
}
else if(param1.parent != null)
{
_loc4_ = param1.parent;
while(true)
{
_loc4_.colour = _loc4_.colour + 1;
_loc4_.prev.colour = _loc4_.prev.colour - 1;
_loc4_.next.colour = _loc4_.next.colour - 1;
_loc5_ = _loc4_.prev;
if(_loc5_.colour == -1)
{
__fix_neg_red(_loc5_);
break;
}
if(_loc5_.colour == 0)
{
if(_loc5_.prev != null)
{
false;
}
if(false)
{
__fix_dbl_red(_loc5_.prev);
break;
}
if(_loc5_.next != null)
{
false;
}
if(false)
{
__fix_dbl_red(_loc5_.next);
break;
}
}
_loc5_ = _loc4_.next;
if(_loc5_.colour == -1)
{
__fix_neg_red(_loc5_);
break;
}
if(_loc5_.colour == 0)
{
if(_loc5_.prev != null)
{
false;
}
if(false)
{
__fix_dbl_red(_loc5_.prev);
break;
}
if(_loc5_.next != null)
{
false;
}
if(false)
{
__fix_dbl_red(_loc5_.next);
break;
}
}
if(_loc4_.colour == 2)
{
if(_loc4_.parent == null)
{
_loc4_.colour = 1;
}
else
{
_loc4_ = _loc4_.parent;
continue;
}
}
break;
}
}
}
_loc4_ = param1.parent;
if(_loc4_ == null)
{
parent = _loc2_;
}
else if(_loc4_.prev == param1)
{
_loc4_.prev = _loc2_;
}
else
{
_loc4_.next = _loc2_;
}
if(_loc2_ != null)
{
_loc2_.parent = _loc4_;
}
_loc4_ = null;
param1.next = _loc4_;
_loc4_ = _loc4_;
param1.prev = _loc4_;
param1.parent = _loc4_;
_loc4_ = param1;
_loc4_.free();
_loc4_.next = ZPP_Set_ZPP_SimpleEvent.zpp_pool;
ZPP_Set_ZPP_SimpleEvent.zpp_pool = _loc4_;
}
public function remove(param1:ZPP_SimpleEvent) : void
{
var _loc2_:ZPP_Set_ZPP_SimpleEvent = find(param1);
remove_node(_loc2_);
}
public var prev:ZPP_Set_ZPP_SimpleEvent;
public function predecessor_node(param1:ZPP_Set_ZPP_SimpleEvent) : ZPP_Set_ZPP_SimpleEvent
{
var _loc2_:* = null as ZPP_Set_ZPP_SimpleEvent;
if(param1.prev != null)
{
param1 = param1.prev;
while(param1.next != null)
{
param1 = param1.next;
}
}
else
{
_loc2_ = param1;
param1 = param1.parent;
while(true)
{
if(param1 != null)
{
false;
}
if(!false)
{
break;
}
_loc2_ = param1;
param1 = param1.parent;
}
}
return param1;
}
public function predecessor(param1:ZPP_SimpleEvent) : ZPP_SimpleEvent
{
var _loc2_:ZPP_Set_ZPP_SimpleEvent = predecessor_node(find(param1));
return _loc2_ == null?null:_loc2_.data;
}
public function pop_front() : ZPP_SimpleEvent
{
var _loc1_:ZPP_Set_ZPP_SimpleEvent = parent;
while(_loc1_.prev != null)
{
_loc1_ = _loc1_.prev;
}
var _loc2_:ZPP_SimpleEvent = _loc1_.data;
remove_node(_loc1_);
return _loc2_;
}
public var parent:ZPP_Set_ZPP_SimpleEvent;
public var next:ZPP_Set_ZPP_SimpleEvent;
public var lt:Function;
public function lower_bound(param1:ZPP_SimpleEvent) : ZPP_SimpleEvent
{
var _loc3_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc4_:* = null as ZPP_SimpleEvent;
var _loc2_:ZPP_SimpleEvent = null;
if(!empty())
{
_loc3_ = parent;
while(_loc3_.prev != null)
{
_loc3_ = _loc3_.prev;
}
while(_loc3_ != null)
{
_loc4_ = _loc3_.data;
if(!lt(_loc4_,param1))
{
_loc2_ = _loc4_;
break;
}
if(_loc3_.next != null)
{
_loc3_ = _loc3_.next;
while(_loc3_.prev != null)
{
_loc3_ = _loc3_.prev;
}
}
else
{
while(true)
{
if(_loc3_.parent != null)
{
false;
}
if(!false)
{
break;
}
_loc3_ = _loc3_.parent;
}
_loc3_ = _loc3_.parent;
}
}
}
return _loc2_;
}
public function insert(param1:ZPP_SimpleEvent) : ZPP_Set_ZPP_SimpleEvent
{
var _loc2_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc3_:* = null as ZPP_Set_ZPP_SimpleEvent;
if(ZPP_Set_ZPP_SimpleEvent.zpp_pool == null)
{
_loc2_ = new ZPP_Set_ZPP_SimpleEvent();
}
else
{
_loc2_ = ZPP_Set_ZPP_SimpleEvent.zpp_pool;
ZPP_Set_ZPP_SimpleEvent.zpp_pool = _loc2_.next;
_loc2_.next = null;
}
_loc2_.alloc();
_loc2_.data = param1;
if(parent == null)
{
parent = _loc2_;
}
else
{
_loc3_ = parent;
while(true)
{
if(lt(_loc2_.data,_loc3_.data))
{
if(_loc3_.prev == null)
{
_loc3_.prev = _loc2_;
_loc2_.parent = _loc3_;
break;
}
_loc3_ = _loc3_.prev;
}
else
{
if(_loc3_.next == null)
{
_loc3_.next = _loc2_;
_loc2_.parent = _loc3_;
break;
}
_loc3_ = _loc3_.next;
}
}
}
if(_loc2_.parent == null)
{
_loc2_.colour = 1;
}
else
{
_loc2_.colour = 0;
if(_loc2_.parent.colour == 0)
{
__fix_dbl_red(_loc2_);
}
}
return _loc2_;
}
public function has_weak(param1:ZPP_SimpleEvent) : Boolean
{
return !(find_weak(param1) == null);
}
public function has(param1:ZPP_SimpleEvent) : Boolean
{
return !(find(param1) == null);
}
public function free() : void
{
data = null;
lt = null;
swapped = null;
}
public function first() : ZPP_SimpleEvent
{
var _loc1_:ZPP_Set_ZPP_SimpleEvent = parent;
while(_loc1_.prev != null)
{
_loc1_ = _loc1_.prev;
}
return _loc1_.data;
}
public function find_weak(param1:ZPP_SimpleEvent) : ZPP_Set_ZPP_SimpleEvent
{
var _loc2_:ZPP_Set_ZPP_SimpleEvent = parent;
while(_loc2_ != null)
{
if(lt(param1,_loc2_.data))
{
_loc2_ = _loc2_.prev;
continue;
}
if(lt(_loc2_.data,param1))
{
_loc2_ = _loc2_.next;
continue;
}
break;
}
return _loc2_;
}
public function find(param1:ZPP_SimpleEvent) : ZPP_Set_ZPP_SimpleEvent
{
var _loc2_:ZPP_Set_ZPP_SimpleEvent = parent;
while(true)
{
if(_loc2_ != null)
{
false;
}
if(!false)
{
break;
}
if(lt(param1,_loc2_.data))
{
_loc2_ = _loc2_.prev;
}
else
{
_loc2_ = _loc2_.next;
}
}
return _loc2_;
}
public function empty() : Boolean
{
return parent == null;
}
public var data:ZPP_SimpleEvent;
public var colour:int;
public function clear_with(param1:Function) : void
{
var _loc2_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc3_:* = null as ZPP_Set_ZPP_SimpleEvent;
if(parent == null)
{
return;
}
_loc2_ = parent;
while(_loc2_ != null)
{
if(_loc2_.prev == null)
{
if(_loc2_.next == null)
{
param1(_loc2_.data);
_loc3_ = _loc2_.parent;
if(_loc3_ != null)
{
if(_loc2_ == _loc3_.prev)
{
_loc3_.prev = null;
}
else
{
_loc3_.next = null;
}
_loc2_.parent = null;
}
}
}
if(_loc2_.prev != null)
{
_loc2_ = _loc2_.prev;
}
else
{
_loc2_ = _loc2_.next != null?_loc2_.next:_loc3_;
}
}
parent = null;
}
public function clear_node(param1:ZPP_Set_ZPP_SimpleEvent, param2:Function) : ZPP_Set_ZPP_SimpleEvent
{
param2(param1.data);
var _loc3_:ZPP_Set_ZPP_SimpleEvent = param1.parent;
if(_loc3_ != null)
{
if(param1 == _loc3_.prev)
{
_loc3_.prev = null;
}
else
{
_loc3_.next = null;
}
param1.parent = null;
}
return _loc3_;
}
public function clear() : void
{
var _loc1_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc2_:* = null as ZPP_Set_ZPP_SimpleEvent;
if(parent == null)
{
null;
}
else
{
_loc1_ = parent;
while(_loc1_ != null)
{
if(_loc1_.prev == null)
{
if(_loc1_.next == null)
{
_loc2_ = _loc1_.parent;
if(_loc2_ != null)
{
if(_loc1_ == _loc2_.prev)
{
_loc2_.prev = null;
}
else
{
_loc2_.next = null;
}
_loc1_.parent = null;
}
}
}
if(_loc1_.prev != null)
{
_loc1_ = _loc1_.prev;
}
else
{
_loc1_ = _loc1_.next != null?_loc1_.next:_loc2_;
}
}
parent = null;
}
}
public function alloc() : void
{
}
public function __fix_neg_red(param1:ZPP_Set_ZPP_SimpleEvent) : void
{
var _loc4_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc5_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc6_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc7_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc8_:* = 0;
var _loc9_:* = null as ZPP_SimpleEvent;
var _loc2_:ZPP_Set_ZPP_SimpleEvent = param1.parent;
if(_loc2_.prev == param1)
{
_loc4_ = param1.prev;
_loc5_ = param1.next;
_loc6_ = _loc5_.prev;
_loc7_ = _loc5_.next;
_loc4_.colour = 0;
_loc8_ = 1;
_loc2_.colour = _loc8_;
param1.colour = _loc8_;
param1.next = _loc6_;
if(_loc6_ != null)
{
_loc6_.parent = param1;
}
_loc9_ = _loc2_.data;
_loc2_.data = _loc5_.data;
_loc5_.data = _loc9_;
if(swapped != null)
{
swapped(_loc2_.data,_loc5_.data);
}
_loc5_.prev = _loc7_;
if(_loc7_ != null)
{
_loc7_.parent = _loc5_;
}
_loc5_.next = _loc2_.next;
if(_loc2_.next != null)
{
_loc2_.next.parent = _loc5_;
}
_loc2_.next = _loc5_;
if(_loc5_ != null)
{
_loc5_.parent = _loc2_;
}
}
else
{
_loc4_ = param1.next;
_loc5_ = param1.prev;
_loc6_ = _loc5_.next;
_loc7_ = _loc5_.prev;
_loc4_.colour = 0;
_loc8_ = 1;
_loc2_.colour = _loc8_;
param1.colour = _loc8_;
param1.prev = _loc6_;
if(_loc6_ != null)
{
_loc6_.parent = param1;
}
_loc9_ = _loc2_.data;
_loc2_.data = _loc5_.data;
_loc5_.data = _loc9_;
if(swapped != null)
{
swapped(_loc2_.data,_loc5_.data);
}
_loc5_.next = _loc7_;
if(_loc7_ != null)
{
_loc7_.parent = _loc5_;
}
_loc5_.prev = _loc2_.prev;
if(_loc2_.prev != null)
{
_loc2_.prev.parent = _loc5_;
}
_loc2_.prev = _loc5_;
if(_loc5_ != null)
{
_loc5_.parent = _loc2_;
}
}
if(_loc2_.prev == param1)
{
_loc3_ = _loc4_;
if(_loc3_.prev != null)
{
false;
}
if(false)
{
__fix_dbl_red(_loc3_.prev);
}
else
{
if(_loc3_.next != null)
{
false;
}
if(false)
{
__fix_dbl_red(_loc3_.next);
}
}
return;
}
var _loc3_:ZPP_Set_ZPP_SimpleEvent = _loc4_;
if(_loc3_.prev != null)
{
false;
}
if(false)
{
__fix_dbl_red(_loc3_.prev);
}
else
{
if(_loc3_.next != null)
{
false;
}
if(false)
{
__fix_dbl_red(_loc3_.next);
}
}
}
public function __fix_dbl_red(param1:ZPP_Set_ZPP_SimpleEvent) : void
{
var _loc2_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc3_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc4_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc5_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc6_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc7_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc8_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc9_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc10_:* = null as ZPP_Set_ZPP_SimpleEvent;
var _loc11_:* = null as ZPP_Set_ZPP_SimpleEvent;
while(true)
{
_loc2_ = param1.parent;
_loc3_ = _loc2_.parent;
if(_loc3_ == null)
{
_loc2_.colour = 1;
break;
}
if(_loc2_ == _loc3_.prev)
{
_loc6_ = _loc3_;
_loc10_ = _loc3_.next;
if(param1 == _loc2_.prev)
{
_loc4_ = param1;
_loc5_ = _loc2_;
_loc7_ = param1.prev;
_loc8_ = param1.next;
_loc9_ = _loc2_.next;
}
else
{
_loc4_ = _loc2_;
_loc5_ = param1;
_loc7_ = _loc2_.prev;
_loc8_ = param1.prev;
_loc9_ = param1.next;
}
}
else
{
_loc4_ = _loc3_;
_loc7_ = _loc3_.prev;
if(param1 == _loc2_.prev)
{
_loc5_ = param1;
_loc6_ = _loc2_;
_loc8_ = param1.prev;
_loc9_ = param1.next;
_loc10_ = _loc2_.next;
}
else
{
_loc5_ = _loc2_;
_loc6_ = param1;
_loc8_ = _loc2_.prev;
_loc9_ = param1.prev;
_loc10_ = param1.next;
}
}
_loc11_ = _loc3_.parent;
if(_loc11_ == null)
{
parent = _loc5_;
}
else if(_loc11_.prev == _loc3_)
{
_loc11_.prev = _loc5_;
}
else
{
_loc11_.next = _loc5_;
}
if(_loc5_ != null)
{
_loc5_.parent = _loc11_;
}
_loc4_.prev = _loc7_;
if(_loc7_ != null)
{
_loc7_.parent = _loc4_;
}
_loc4_.next = _loc8_;
if(_loc8_ != null)
{
_loc8_.parent = _loc4_;
}
_loc5_.prev = _loc4_;
if(_loc4_ != null)
{
_loc4_.parent = _loc5_;
}
_loc5_.next = _loc6_;
if(_loc6_ != null)
{
_loc6_.parent = _loc5_;
}
_loc6_.prev = _loc9_;
if(_loc9_ != null)
{
_loc9_.parent = _loc6_;
}
_loc6_.next = _loc10_;
if(_loc10_ != null)
{
_loc10_.parent = _loc6_;
}
_loc5_.colour = _loc3_.colour - 1;
_loc4_.colour = 1;
_loc6_.colour = 1;
if(_loc5_ == parent)
{
parent.colour = 1;
}
else
{
if(_loc5_.colour == 0)
{
false;
}
if(false)
{
param1 = _loc5_;
continue;
}
}
break;
}
}
}
}
|
package kabam.rotmg.text.view {
import kabam.rotmg.core.StaticInjectorContext;
import kabam.rotmg.text.model.FontModel;
import kabam.rotmg.text.model.TextAndMapProvider;
import org.swiftsuspenders.Injector;
public class StaticTextDisplay extends TextDisplay {
public function StaticTextDisplay() {
var _loc1_:Injector = StaticInjectorContext.getInjector();
super(_loc1_.getInstance(FontModel),_loc1_.getInstance(TextAndMapProvider));
}
}
}
|
package com.guepard.decompiler.data
{
import com.guepard.decompiler.tags.CSMTextSettings;
import com.guepard.decompiler.tags.DefineBinaryData;
import com.guepard.decompiler.tags.DefineBits;
import com.guepard.decompiler.tags.DefineBitsJPEG2;
import com.guepard.decompiler.tags.DefineBitsJPEG3;
import com.guepard.decompiler.tags.DefineBitsJPEG4;
import com.guepard.decompiler.tags.DefineBitsLossless;
import com.guepard.decompiler.tags.DefineBitsLossless2;
import com.guepard.decompiler.tags.DefineButton2;
import com.guepard.decompiler.tags.DefineEditText;
import com.guepard.decompiler.tags.DefineFont;
import com.guepard.decompiler.tags.DefineFont2;
import com.guepard.decompiler.tags.DefineFont3;
import com.guepard.decompiler.tags.DefineFont4;
import com.guepard.decompiler.tags.DefineFontAlignZones;
import com.guepard.decompiler.tags.DefineFontInfo;
import com.guepard.decompiler.tags.DefineFontInfo2;
import com.guepard.decompiler.tags.DefineFontName;
import com.guepard.decompiler.tags.DefineScene;
import com.guepard.decompiler.tags.DefineShape;
import com.guepard.decompiler.tags.DefineShape2;
import com.guepard.decompiler.tags.DefineShape3;
import com.guepard.decompiler.tags.DefineShape4;
import com.guepard.decompiler.tags.DefineSound;
import com.guepard.decompiler.tags.DefineSprite;
import com.guepard.decompiler.tags.DefineText;
import com.guepard.decompiler.tags.DefineText2;
import com.guepard.decompiler.tags.DoABC;
import com.guepard.decompiler.tags.FileAttributes;
import com.guepard.decompiler.tags.FrameLabel;
import com.guepard.decompiler.tags.PlaceObject;
import com.guepard.decompiler.tags.PlaceObject2;
import com.guepard.decompiler.tags.PlaceObject3;
import com.guepard.decompiler.tags.RemoveObject;
import com.guepard.decompiler.tags.RemoveObject2;
import com.guepard.decompiler.tags.SetBackgroundColor;
import com.guepard.decompiler.tags.ShowFrame;
import com.guepard.decompiler.tags.SoundStreamBlock;
import com.guepard.decompiler.tags.SoundStreamHead;
import com.guepard.decompiler.tags.SoundStreamHead2;
import com.guepard.decompiler.tags.StartSound;
import com.guepard.decompiler.tags.StartSound2;
import com.guepard.decompiler.tags.SymbolClass;
/**
* ...
* @author Antonov Sergey
*/
public class TagType
{
public static const SHOW_FRAME:uint = 1;
public static const FILE_ATTRIBUTES:uint = 69;
public static const SET_BACKGROUND_COLOR:uint = 9;
public static const PLACE_OBJECT:uint = 4;
public static const PLACE_OBJECT_2:uint = 26;
public static const PLACE_OBJECT_3:uint = 70;
public static const REMOVE_OBJECT:uint = 5;
public static const REMOVE_OBJECT_2:uint = 28;
public static const DEFINE_BINARY_DATA:uint = 87;
public static const DEFINE_SPRITE:uint = 39;
public static const FRAME_LABEL:uint = 43;
public static const DEFINE_SHAPE:uint = 2;
public static const DEFINE_SHAPE_2:uint = 22;
public static const DEFINE_SHAPE_3:uint = 32;
public static const DEFINE_SHAPE_4:uint = 83;
public static const DO_ABC:uint = 82;
public static const SYMBOL_CLASS:uint = 76;
public static const DEFINE_SCENE:uint = 86;
public static const JPEG_TABLES:uint = 8;
public static const DEFINE_BITS:uint = 6;
public static const DEFINE_BITS_JPEG_2:uint = 21;
public static const DEFINE_BITS_JPEG_3:uint = 35;
public static const DEFINE_BITS_JPEG_4:uint = 90;
public static const DEFINE_BITS_LOSS_LESS:uint = 20;
public static const DEFINE_BITS_LOSS_LESS_2:uint = 36;
public static const DEFINE_TEXT:uint = 11;
public static const DEFINE_TEXT_2:uint = 33;
public static const DEFINE_EDIT_TEXT:uint = 37;
public static const CSM_TEXT_SETTINGS:uint = 74;
public static const DEFINE_FONT:uint = 10;
public static const DEFINE_FONT_INFO:uint = 13;
public static const DEFINE_FONT_2:uint = 48;
public static const DEFINE_FONT_INFO_2:uint = 62;
public static const DEFINE_FONT_ALIGN_ZONES:uint = 73;
public static const DEFINE_FONT_3:uint = 75;
public static const DEFINE_FONT_NAME:uint = 88;
public static const DEFINE_FONT_4:uint = 91;
public static const DEFINE_SOUND:uint = 14;
public static const START_SOUND:uint = 15;
public static const START_SOUND_2:uint = 89;
public static const SOUND_STREAM_HEAD:uint = 18;
public static const SOUND_STREAM_HEAD_2:uint = 45;
public static const SOUND_STREAM_BLOCK:uint = 19;
static public const DEFINE_BUTTON_2:uint = 34;
static public function getName(type:uint):String
{
switch (type)
{
case 0:
return "End";
case 1:
return "ShowFrame";
case 2:
return "DefineShape";
case 4:
return "PlaceObject";
case 5:
return "RemoveObject";
case 6:
return "DefineBits";
case 7:
return "DefineButton";
case 8:
return "JPEGTables";
case 9:
return "SetBackgroundColor";
case 10:
return "DefineFont";
case 11:
return "DefineText";
case 12:
return "DoAction";
case 13:
return "DefineFontInfo";
case 14:
return "DefineSound";
case 15:
return "StartSound";
case 17:
return "DefineButtonSound";
case 18:
return "SoundStreamHead";
case 19:
return "SoundStreamBlock";
case 20:
return "DefineBitsLossless";
case 21:
return "DefineBitsJPEG2";
case 22:
return "DefineShape2";
case 23:
return "DefineButtonCxform";
case 24:
return "Protect";
case 26:
return "PlaceObject2";
case 28:
return "RemoveObject2";
case 32:
return "DefineShape3";
case 33:
return "DefineText2";
case 34:
return "DefineButton2";
case 35:
return "DefineBitsJPEG3";
case 36:
return "DefineBitsLossless2";
case 37:
return "DefineEditText";
case 39:
return "DefineSprite";
case 43:
return "FrameLabel";
case 45:
return "SoundStreamHead2";
case 46:
return "DefineMorphShape";
case 48:
return "DefineFont2";
case 56:
return "ExportAssets";
case 57:
return "ImoprtAssets";
case 58:
return "EnableDebugger";
case 59:
return "DoInitAction";
case 60:
return "DefineVideoStream";
case 61:
return "VideoStream";
case 62:
return "DefineFontInfo2";
case 64:
return "EnableDebugger2";
case 65:
return "ScriptLimits";
case 66:
return "SetTabIndex";
case 69:
return "FileAttributes";
case 70:
return "PlaceObject3";
case 71:
return "ImportAssets2";
case 73:
return "DefineFontAlignZones";
case 74:
return "CSMTextSettings";
case 75:
return "DefineFont3";
case 76:
return "SymbolClass";
case 77:
return "Metadata";
case 78:
return "DefineScalignGrid";
case 82:
return "DoABC";
case 83:
return "DefineShape4";
case 84:
return "DefineMorphShape2";
case 86:
return "DefineScene";
case 87:
return "DefineBinaryData";
case 88:
return "DefineFontName";
case 89:
return "StartSound2";
case 90:
return "DefineBitsJPEG4";
case 91:
return "DefineFont4";
default :
return "Unknown";
}
}
static public function getClass(type:uint):Class
{
switch (type)
{
case SHOW_FRAME:
return ShowFrame;
case PLACE_OBJECT:
return PlaceObject;
case PLACE_OBJECT_2:
return PlaceObject2;
case PLACE_OBJECT_3:
return PlaceObject3;
case REMOVE_OBJECT:
return RemoveObject;
case REMOVE_OBJECT_2:
return RemoveObject2;
case DEFINE_SPRITE:
return DefineSprite;
case FRAME_LABEL:
return FrameLabel;
case DEFINE_SHAPE:
return DefineShape;
case DEFINE_SHAPE_2:
return DefineShape2;
case DEFINE_SHAPE_3:
return DefineShape3;
case DEFINE_SHAPE_4:
return DefineShape4;
case DO_ABC:
return DoABC;
case SYMBOL_CLASS:
return SymbolClass;
case FILE_ATTRIBUTES:
return FileAttributes;
case SET_BACKGROUND_COLOR:
return SetBackgroundColor;
case DEFINE_BINARY_DATA:
return DefineBinaryData;
case JPEG_TABLES:
return Tag;
case DEFINE_BITS:
return DefineBits;
case DEFINE_BITS_JPEG_2:
return DefineBitsJPEG2;
case DEFINE_BITS_JPEG_3:
return DefineBitsJPEG3;
case DEFINE_BITS_JPEG_4:
return DefineBitsJPEG4;
case DEFINE_BITS_LOSS_LESS:
return DefineBitsLossless;
case DEFINE_BITS_LOSS_LESS_2:
return DefineBitsLossless2;
case DEFINE_TEXT:
return DefineText;
case DEFINE_TEXT_2:
return DefineText2;
case DEFINE_EDIT_TEXT:
return DefineEditText;
case CSM_TEXT_SETTINGS:
return CSMTextSettings;
case DEFINE_FONT:
return DefineFont;
case DEFINE_FONT_INFO:
return DefineFontInfo;
case DEFINE_FONT_2:
return DefineFont2;
case DEFINE_FONT_INFO_2:
return DefineFontInfo2;
case DEFINE_FONT_ALIGN_ZONES:
return DefineFontAlignZones;
case DEFINE_FONT_3:
return DefineFont3;
case DEFINE_FONT_NAME:
return DefineFontName;
case DEFINE_FONT_4:
return DefineFont4;
case DEFINE_SCENE:
return DefineScene;
case DEFINE_SOUND:
return DefineSound;
case START_SOUND:
return StartSound;
case START_SOUND_2:
return StartSound2;
case SOUND_STREAM_HEAD:
return SoundStreamHead;
case SOUND_STREAM_HEAD_2:
return SoundStreamHead2;
case SOUND_STREAM_BLOCK:
return SoundStreamBlock;
case DEFINE_BUTTON_2:
return DefineButton2;
default:
return Tag;
}
}
}
} |
/**
* GetAllAdGroupsResultEvent.as
* This file was auto-generated from WSDL
* Any change made to this file will be overwritten when the code is re-generated.
*/
package com.macys.marketing.sema
{
import mx.utils.ObjectProxy;
import flash.events.Event;
import flash.utils.ByteArray;
import mx.rpc.soap.types.*;
/**
* Typed event handler for the result of the operation
*/
public class GetAllAdGroupsResultEvent extends Event
{
/**
* The event type value
*/
public static var GetAllAdGroups_RESULT:String="GetAllAdGroups_result";
/**
* Constructor for the new event type
*/
public function GetAllAdGroupsResultEvent()
{
super(GetAllAdGroups_RESULT,false,false);
}
private var _headers:Object;
private var _result:GetAllAdGroupsResponse;
public function get result():GetAllAdGroupsResponse
{
return _result;
}
public function set result(value:GetAllAdGroupsResponse):void
{
_result = value;
}
public function get headers():Object
{
return _headers;
}
public function set headers(value:Object):void
{
_headers = value;
}
}
} |
/*
* Copyright 2007-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.as3commons.lang {
import flash.utils.Dictionary;
public class HashArray {
//These are all the properties and method names of Object, these are illegal names to be used as a key in a Dictionary:
private static const illegalKeys:Array = ['hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'setPropertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'prototype', 'constructor'];
private var _list:Array;
private var _lookup:Dictionary;
private var _lookUpPropertyName:String;
private var _allowDuplicates:Boolean = false;
public function HashArray( lookUpPropertyName:String, allowDuplicates:Boolean = false, items:Array = null) {
super();
init(lookUpPropertyName, allowDuplicates, items);
}
protected function init(lookUpPropertyName:String, allowDuplicates:Boolean, items:Array):void {
_lookup = new Dictionary();
_lookUpPropertyName = makeValidKey(lookUpPropertyName);
_allowDuplicates = allowDuplicates;
_list = [];
add(items);
}
public function get allowDuplicates():Boolean {
return _allowDuplicates;
}
public function set allowDuplicates(value:Boolean):void {
_allowDuplicates = value;
}
public function get length():uint {
return _list.length;
}
public function rehash():void {
_lookup = new Dictionary();
var len:uint = _list.length;
var val:*;
for (var i:uint; i < len; i++) {
val = _list[i];
if (val != null) {
addToLookup(val)
}
}
}
protected function removeFromLookup(item:*):void {
var value:* = _lookup[item[_lookUpPropertyName]];
if ((value is Array) && (_allowDuplicates)) {
var arr:Array = (value as Array);
var idx:int = ArrayUtils.removeFirstOccurance(arr, item);
if (arr.length < 1) {
delete _lookup[item[_lookUpPropertyName]];
}
} else {
delete _lookup[item[_lookUpPropertyName]];
}
}
protected function addToLookup(newItem:*):void {
var validKey:* = makeValidKey(newItem[_lookUpPropertyName]);
if (_allowDuplicates) {
var items:* = _lookup[validKey];
var arr:Array;
if (items == null) {
_lookup[validKey] = [newItem];
} else if (items is Array) {
arr = (items as Array);
arr[arr.length] = newItem;
} else {
arr = [];
arr[arr.length] = items;
arr[arr.length] = newItem;
_lookup[validKey] = arr;
}
} else {
var oldItem:* = _lookup[validKey];
if (oldItem != null) {
ArrayUtils.removeFirstOccurance(_list, oldItem);
}
_lookup[validKey] = newItem;
}
}
protected function makeValidKey(propertyValue:*):* {
if (!(propertyValue is String)) {
return propertyValue;
} else if (illegalKeys.indexOf(String(propertyValue)) > -1) {
return String(propertyValue) + '_';
}
return propertyValue;
}
public function get(lookupPropertyValue:String):* {
lookupPropertyValue = makeValidKey(lookupPropertyValue);
return _lookup[lookupPropertyValue];
}
public function pop():* {
var value:* = _list.pop();
removeFromLookup(value);
return value;
}
public function push(... parameters):uint {
var len:uint = parameters.length;
var args:Array;
if (len == 1 && parameters[0] is Array) {
args = parameters[0] as Array;
len = args.length;
} else {
args = parameters;
}
var idx:int = 0;
for (var i:uint = 0; i < len; i++) {
var arg:* = args[i];
addToLookup(arg);
idx = _list.push(arg);
}
return idx;
}
protected function add(items:Array):void {
if (items != null) {
var len:uint = items.length;
for (var i:uint = 0; i < len; i++) {
pushOne(items[i]);
}
}
}
protected function pushOne(item:*):void {
addToLookup(item);
_list.push(item);
}
public function shift():* {
var item:* = _list.shift();
removeFromLookup(item);
return item;
}
public function getArray():Array {
return _list.concat();
}
public function splice(... parameters):* {
var result:* = _list.splice(parameters);
rehash();
return result;
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
//
// No warranty of merchantability or fitness of any kind.
// Use this software at your own risk.
//
////////////////////////////////////////////////////////////////////////////////
package actionScripts.plugin.syntax
{
import flash.text.engine.ElementFormat;
import flash.text.engine.FontDescription;
import actionScripts.events.EditorPluginEvent;
import actionScripts.plugin.IEditorPlugin;
import actionScripts.plugin.PluginBase;
import actionScripts.plugin.settings.ISettingsProvider;
import actionScripts.plugin.settings.vo.ISetting;
import actionScripts.ui.parser.AS3LineParser;
import actionScripts.valueObjects.ConstantsCoreVO;
import actionScripts.valueObjects.Settings;
public class JSSyntaxPlugin extends PluginBase implements ISettingsProvider, IEditorPlugin
{
private var formats:Object = {};
override public function get name():String {return "JS Syntax Plugin";}
override public function get author():String {return ConstantsCoreVO.MOONSHINE_IDE_LABEL +" Project Team";}
override public function get description():String {return "Provides highlighting for JS.";}
public function getSettingsList():Vector.<ISetting> {return new Vector.<ISetting>();}
override public function activate():void
{
super.activate();
init();
}
override public function deactivate():void
{
super.deactivate();
}
public function JSSyntaxPlugin()
{
}
private function init():void
{
var fontDescription:FontDescription = Settings.font.defaultFontDescription;
var fontSize:Number = Settings.font.defaultFontSize;
formats[0] = /* default, parser fault */ new ElementFormat(fontDescription, fontSize, 0xFF0000);
formats[AS3LineParser.AS_CODE] = new ElementFormat(fontDescription, fontSize, 0x101010);
formats[AS3LineParser.AS_STRING1] =
formats[AS3LineParser.AS_STRING2] = new ElementFormat(fontDescription, fontSize, 0xca2323);
formats[AS3LineParser.AS_COMMENT] =
formats[AS3LineParser.AS_MULTILINE_COMMENT] = new ElementFormat(fontDescription, fontSize, 0x39c02f);
formats[AS3LineParser.AS_REGULAR_EXPRESSION] = new ElementFormat(fontDescription, fontSize, 0x9b0000);
formats[AS3LineParser.AS_KEYWORD] = new ElementFormat(fontDescription, fontSize, 0x0082cd);
formats[AS3LineParser.AS_VAR_KEYWORD] = new ElementFormat(fontDescription, fontSize, 0x6d5a9c);
formats[AS3LineParser.AS_FUNCTION_KEYWORD] = new ElementFormat(fontDescription, fontSize, 0x3382dd);
formats[AS3LineParser.AS_PACKAGE_CLASS_KEYWORDS] = new ElementFormat(fontDescription, fontSize, 0xa848da);
formats['lineNumber'] = new ElementFormat(fontDescription, fontSize, 0x888888);
formats['breakPointLineNumber'] = new ElementFormat(fontDescription, fontSize, 0xffffff);
formats['breakPointBackground'] = 0xdea5dd;
formats['tracingLineColor']= 0xc6dbae;
dispatcher.addEventListener(EditorPluginEvent.EVENT_EDITOR_OPEN, handleEditorOpen);
}
private function handleEditorOpen(event:EditorPluginEvent):void
{
if (event.fileExtension == "js" || event.fileExtension == "json")
{
event.editor.setParserAndStyles(new AS3LineParser(), formats);
}
}
}
} |
/**
* Created by vizoli on 4/9/16.
*/
package ageofai.game.model
{
public interface IGameModel
{
function init():void;
}
}
|
package net.flashpunk
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.PixelSnapping;
import flash.display.Sprite;
import flash.geom.Matrix;
import net.flashpunk.graphics.Image;
/**
* Container for the main screen buffer. Can be used to transform the screen.
*/
public class Screen
{
/**
* Constructor.
*/
public function Screen()
{
FP.engine.addChild(_sprite);
resize();
update();
}
/**
* Initialise buffers to current screen size.
*/
public function resize():void
{
if (_bitmap[0]) {
_sprite.removeChild(_bitmap[0]);
_sprite.removeChild(_bitmap[1]);
_bitmap[0].bitmapData.dispose();
_bitmap[1].bitmapData.dispose();
}
// create screen buffers
_bitmap[0] = new Bitmap(new BitmapData(FP.width, FP.height, false, _color), PixelSnapping.NEVER);
_bitmap[1] = new Bitmap(new BitmapData(FP.width, FP.height, false, _color), PixelSnapping.NEVER);
_sprite.addChild(_bitmap[0]).visible = true;
_sprite.addChild(_bitmap[1]).visible = false;
FP.buffer = _bitmap[0].bitmapData;
_width = FP.width;
_height = FP.height;
_current = 0;
}
/**
* Swaps screen buffers.
*/
public function swap():void
{
_current = 1 - _current;
FP.buffer = _bitmap[_current].bitmapData;
}
/**
* Refreshes the screen.
*/
public function refresh():void
{
// refreshes the screen
FP.buffer.fillRect(FP.bounds, _color);
}
/**
* Redraws the screen.
*/
public function redraw():void
{
// refresh the buffers
_bitmap[_current].visible = true;
_bitmap[1 - _current].visible = false;
}
/** @private Re-applies transformation matrix. */
public function update():void
{
_matrix.b = _matrix.c = 0;
_matrix.a = _scaleX * _scale;
_matrix.d = _scaleY * _scale;
_matrix.tx = -_originX * _matrix.a;
_matrix.ty = -_originY * _matrix.d;
if (_angle != 0) _matrix.rotate(_angle);
_matrix.tx += _originX * _scaleX * _scale + _x;
_matrix.ty += _originY * _scaleX * _scale + _y;
_sprite.transform.matrix = _matrix;
}
/**
* Refresh color of the screen.
*/
public function get color():uint { return _color; }
public function set color(value:uint):void { _color = 0xFF000000 | value; }
/**
* X offset of the screen.
*/
public function get x():int { return _x; }
public function set x(value:int):void
{
if (_x == value) return;
_x = value;
update();
}
/**
* Y offset of the screen.
*/
public function get y():int { return _y; }
public function set y(value:int):void
{
if (_y == value) return;
_y = value;
update();
}
/**
* X origin of transformations.
*/
public function get originX():int { return _originX; }
public function set originX(value:int):void
{
if (_originX == value) return;
_originX = value;
update();
}
/**
* Y origin of transformations.
*/
public function get originY():int { return _originY; }
public function set originY(value:int):void
{
if (_originY == value) return;
_originY = value;
update();
}
/**
* X scale of the screen.
*/
public function get scaleX():Number { return _scaleX; }
public function set scaleX(value:Number):void
{
if (_scaleX == value) return;
_scaleX = value;
update();
}
/**
* Y scale of the screen.
*/
public function get scaleY():Number { return _scaleY; }
public function set scaleY(value:Number):void
{
if (_scaleY == value) return;
_scaleY = value;
update();
}
/**
* Scale factor of the screen. Final scale is scaleX * scale by scaleY * scale, so
* you can use this factor to scale the screen both horizontally and vertically.
*/
public function get scale():Number { return _scale; }
public function set scale(value:Number):void
{
if (_scale == value) return;
_scale = value;
update();
}
/**
* Rotation of the screen, in degrees.
*/
public function get angle():Number { return _angle * FP.DEG; }
public function set angle(value:Number):void
{
if (_angle == value * FP.RAD) return;
_angle = value * FP.RAD;
update();
}
/**
* Whether screen smoothing should be used or not.
*/
public function get smoothing():Boolean { return _bitmap[0].smoothing; }
public function set smoothing(value:Boolean):void { _bitmap[0].smoothing = _bitmap[1].smoothing = value; }
/**
* Width of the screen.
*/
public function get width():uint { return _width; }
/**
* Height of the screen.
*/
public function get height():uint { return _height; }
/**
* X position of the mouse on the screen.
*/
public function get mouseX():int { return _sprite.mouseX; }
/**
* Y position of the mouse on the screen.
*/
public function get mouseY():int { return _sprite.mouseY; }
/**
* Captures the current screen as an Image object.
* @return A new Image object.
*/
public function capture():Image
{
return new Image(_bitmap[_current].bitmapData.clone());
}
// Screen information.
/** @private */ private var _sprite:Sprite = new Sprite;
/** @private */ private var _bitmap:Vector.<Bitmap> = new Vector.<Bitmap>(2);
/** @private */ private var _current:int = 0;
/** @private */ private var _matrix:Matrix = new Matrix;
/** @private */ private var _x:int;
/** @private */ private var _y:int;
/** @private */ private var _width:uint;
/** @private */ private var _height:uint;
/** @private */ private var _originX:int;
/** @private */ private var _originY:int;
/** @private */ private var _scaleX:Number = 1;
/** @private */ private var _scaleY:Number = 1;
/** @private */ private var _scale:Number = 1;
/** @private */ private var _angle:Number = 0;
/** @private */ private var _color:uint = 0xfff9f9f9;
}
}
|
/*
Feathers
Copyright 2012-2013 Joshua Tynjala. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/
package feathers.core
{
/**
* Dispatched when the selection changes.
*
* @eventType starling.events.Event.CHANGE
*/
[Event(name="change",type="starling.events.Event")]
/**
* An interface for something that may be selected.
*/
public interface IToggle extends IFeathersControl
{
/**
* Indicates if the IToggle is selected or not.
*/
function get isSelected():Boolean;
/**
* @private
*/
function set isSelected(value:Boolean):void;
}
} |
package com.splunk.charting.charts
{
import com.jasongatt.core.ObservableProperty;
import com.jasongatt.graphics.brushes.IBrush;
import com.jasongatt.graphics.brushes.SolidFillBrush;
import com.jasongatt.graphics.brushes.SolidStrokeBrush;
import com.jasongatt.graphics.shapes.IShape;
import com.jasongatt.graphics.shapes.TransformShape;
import com.jasongatt.graphics.shapes.UniformSizeShape;
import com.jasongatt.graphics.shapes.WedgeShape;
import com.jasongatt.layout.LayoutSprite;
import com.jasongatt.layout.Size;
import com.jasongatt.layout.Visibility;
import com.jasongatt.motion.GroupTween;
import com.jasongatt.motion.PropertyTween;
import com.jasongatt.motion.TweenRunner;
import com.jasongatt.utils.NumberUtil;
import com.splunk.charting.legend.ILegend;
import com.splunk.controls.Label;
import com.splunk.controls.Tooltip;
import com.splunk.data.IDataTable;
import com.splunk.data.ResultsDataTable;
import com.splunk.palettes.brush.IBrushPalette;
import com.splunk.palettes.brush.SolidFillBrushPalette;
import com.splunk.palettes.color.ListColorPalette;
import com.splunk.palettes.shape.IShapePalette;
import com.splunk.services.search.data.ResultsData;
import com.splunk.utils.LayoutUtil;
import com.splunk.utils.Style;
import flash.display.CapsStyle;
import flash.display.Graphics;
import flash.display.LineScaleMode;
import flash.display.Shape;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;
public class PieChart extends AbstractChart
{
// Private Properties
private var _sliceBrushPalette:ObservableProperty;
private var _sliceStyle:ObservableProperty;
private var _sliceCollapsingThreshold:ObservableProperty;
private var _sliceCollapsingLabel:ObservableProperty;
private var _labelStyle:ObservableProperty;
private var _labelLineBrush:ObservableProperty;
private var _showLabels:ObservableProperty;
private var _showPercent:ObservableProperty;
private var _sliceLabels:Array;
private var _sliceShapes:Array;
private var _seriesSprites:Array;
private var _seriesMask:Shape;
private var _seriesContainer:Sprite;
private var _highlightedElement:DataSprite;
// Constructor
public function PieChart()
{
var colorPalette:ListColorPalette = new ListColorPalette([ 0xCC0000, 0xCCCC00, 0x00CC00, 0x00CCCC, 0x0000CC ], true);
var lineBrush:SolidStrokeBrush = new SolidStrokeBrush(1, 0x000000, 1, true, LineScaleMode.NORMAL, CapsStyle.SQUARE);
this._sliceBrushPalette = new ObservableProperty(this, "sliceBrushPalette", IBrushPalette, new SolidFillBrushPalette(colorPalette, 1), this.invalidates(AbstractChart.UPDATE_LEGEND_SWATCHES));
this._sliceStyle = new ObservableProperty(this, "sliceStyle", Style, null, this.invalidates(AbstractChart.UPDATE_LEGEND_SWATCHES));
this._sliceCollapsingThreshold = new ObservableProperty(this, "sliceCollapsingThreshold", Number, 0.01, this.invalidates(AbstractChart.PROCESS_DATA));
this._sliceCollapsingLabel = new ObservableProperty(this, "sliceCollapsingLabel", String, "other", this.invalidates(AbstractChart.PROCESS_DATA));
this._labelStyle = new ObservableProperty(this, "labelStyle", Style, null, this.invalidates(LayoutSprite.MEASURE));
this._labelLineBrush = new ObservableProperty(this, "labelLineBrush", IBrush, lineBrush, this.invalidates(AbstractChart.RENDER_CHART));
this._showLabels = new ObservableProperty(this, "showLabels", Boolean, true, this.invalidates(LayoutSprite.MEASURE));
this._showPercent = new ObservableProperty(this, "showPercent", Boolean, false, this.invalidates(LayoutSprite.MEASURE));
this._sliceLabels = new Array();
this._sliceShapes = new Array();
this._seriesSprites = new Array();
this._seriesMask = new Shape();
this._seriesContainer = new Sprite();
this._seriesContainer.mouseEnabled = false;
this._seriesContainer.mask = this._seriesMask;
this.addChild(this._seriesContainer);
this.addChild(this._seriesMask);
}
// Public Getters/Setters
public function get sliceBrushPalette() : IBrushPalette
{
return this._sliceBrushPalette.value;
}
public function set sliceBrushPalette(value:IBrushPalette) : void
{
this._sliceBrushPalette.value = value;
}
public function get sliceStyle() : Style
{
return this._sliceStyle.value;
}
public function set sliceStyle(value:Style) : void
{
this._sliceStyle.value = value;
}
public function get sliceCollapsingThreshold() : Number
{
return this._sliceCollapsingThreshold.value;
}
public function set sliceCollapsingThreshold(value:Number) : void
{
this._sliceCollapsingThreshold.value = value;
}
public function get sliceCollapsingLabel() : String
{
return this._sliceCollapsingLabel.value;
}
public function set sliceCollapsingLabel(value:String) : void
{
this._sliceCollapsingLabel.value = value;
}
public function get labelStyle() : Style
{
return this._labelStyle.value;
}
public function set labelStyle(value:Style) : void
{
this._labelStyle.value = value;
}
public function get labelLineBrush() : IBrush
{
return this._labelLineBrush.value;
}
public function set labelLineBrush(value:IBrush) : void
{
this._labelLineBrush.value = value;
}
public function get showLabels() : Boolean
{
return this._showLabels.value;
}
public function set showLabels(value:Boolean) : void
{
this._showLabels.value = value;
}
public function get showPercent() : Boolean
{
return this._showPercent.value;
}
public function set showPercent(value:Boolean) : void
{
this._showPercent.value = value;
}
// Protected Methods
protected override function processDataOverride(data:IDataTable) : void
{
super.processDataOverride(data);
this.invalidate(LayoutSprite.MEASURE);
var sliceLabels:Array = this._sliceLabels;
var sliceShapes:Array = this._sliceShapes;
var seriesSprites:Array = this._seriesSprites;
var numProcessedSlices:int = 0;
if (data)
{
var numDataColumns:int = data.numColumns;
if (numDataColumns > 1)
{
var numRows:int = data.numRows;
var value1:*;
var value2:*;
var label:String;
var value:Number;
var numValues:int;
var sum:Number = 0;
var sumOffset:Number = 0;
var valueSum:Number = 0;
var i:int;
var labels:Array = new Array();
var values:Array = new Array();
var rowIndexes:Array = new Array();
var collapseThreshold:Number = this._sliceCollapsingThreshold.value;
var collapseLabel:String = this._sliceCollapsingLabel.value;
var collapseIndexes:Array = new Array();
var collapseCount:int;
var collapseIndex:int;
var collapseValue:Number = 0;
var field1:String = data.getColumnName(0);
var field2:String = data.getColumnName(1);
var field3:String = field2 + "%";
var numSeriesSprites:int = seriesSprites.length;
var seriesSprite:SeriesSprite;
var sliceSprite:SliceSprite;
var sliceShape:WedgeShape;
var angle1:Number = 0;
var angle2:Number = 0;
var resultsDataTable:ResultsDataTable = data as ResultsDataTable;
var resultsData:ResultsData = resultsDataTable ? resultsDataTable.resultsData : null;
var results:Array = resultsData ? resultsData.results : null;
var totalCount:Number = (results && (results.length > 0)) ? NumberUtil.parseNumber(results[0]._tc) : NaN;
// extract labels and values from data and compute sum
for (i = 0; i < numRows; i++)
{
value1 = data.getValue(i, 0);
if (value1 == null)
continue;
value2 = data.getValue(i, 1);
if (value2 == null)
continue;
label = String(value1);
if (!label)
continue;
value = NumberUtil.parseNumber(value2);
if ((value != value) || (value <= 0))
continue;
sum += value;
labels.push(label);
values.push(value);
rowIndexes.push(i);
}
// compute sumOffset
sumOffset = ((sum < totalCount) && ((sum / totalCount) < 0.99)) ? (totalCount - sum) : 0;
// compute slices to collapse
numValues = values.length;
for (i = 0; i < numValues; i++)
{
value = values[i];
if ((value / sum) < collapseThreshold)
collapseIndexes.push(i);
}
// collapse slices
collapseCount = collapseIndexes.length;
if (collapseCount > 1)
{
for (i = collapseCount - 1; i >= 0; i--)
{
collapseIndex = collapseIndexes[i];
collapseValue += values[collapseIndex];
labels.splice(collapseIndex, 1);
values.splice(collapseIndex, 1);
rowIndexes.splice(collapseIndex, 1);
}
}
// generate new slice and update sum if slices were collapsed or sumOffset > 0
if ((collapseValue > 0) || (sumOffset > 0))
{
labels.push(collapseLabel);
values.push(collapseValue + sumOffset);
rowIndexes.push(-1);
sum += sumOffset;
}
// create slices
numValues = values.length;
for (i = 0; i < numValues; i++)
{
value = values[i];
valueSum += value;
if (i < numSeriesSprites)
{
sliceLabels[i] = labels[i];
sliceShape = sliceShapes[i];
seriesSprite = seriesSprites[i];
}
else
{
sliceLabels.push(labels[i]);
sliceShape = new WedgeShape();
sliceShapes.push(sliceShape);
seriesSprite = new SeriesSprite();
seriesSprites.push(seriesSprite);
this._seriesContainer.addChild(seriesSprite);
}
seriesSprite.field = labels[i];
sliceSprite = seriesSprite.sliceSprite;
sliceSprite.chart = this;
sliceSprite.tipPlacement = Tooltip.LEFT_RIGHT;
sliceSprite.seriesName = labels[i];
sliceSprite.fields = [ field1, field2, field3 ];
sliceSprite.data = new Object();
sliceSprite.data[field1] = labels[i];
sliceSprite.data[field2] = values[i];
sliceSprite.data[field3] = (Math.round((value / sum) * 10000) / 100) + "%";
sliceSprite.dataRowIndex = rowIndexes[i];
angle1 = angle2;
angle2 = 360 * (valueSum / sum);
sliceShape.startAngle = angle1 - 90;
sliceShape.arcAngle = angle2 - angle1;
}
numProcessedSlices = numValues;
}
}
for (i = seriesSprites.length - 1; i >= numProcessedSlices; i--)
{
sliceLabels.pop();
sliceShapes.pop();
seriesSprite = seriesSprites.pop();
this._seriesContainer.removeChild(seriesSprite);
}
}
protected override function updateLegendLabelsOverride(data:IDataTable) : Array
{
var labels:Array = new Array();
var sliceLabels:Array = this._sliceLabels;
var numLabels:int = sliceLabels.length;
for (var i:int = 0; i < numLabels; i++)
labels.push(sliceLabels[i]);
return labels;
}
protected override function updateLegendSwatchesOverride(legend:ILegend, labels:Array) : Array
{
var swatches:Array = new Array();
var sliceBrushPalette:IBrushPalette = this._sliceBrushPalette.value;
var sliceStyle:Style = this._sliceStyle.value;
var sliceBrush:IBrush;
var sliceShape:IShape = new UniformSizeShape(new TransformShape(new WedgeShape(-90, 90), -1, 0, 2, 2));
var numLabels:int = labels.length;
var label:String;
var labelIndex:int;
var labelCount:int = legend ? legend.numLabels : numLabels;
for (var i:int = 0; i < numLabels; i++)
{
label = labels[i];
labelIndex = legend ? legend.getLabelIndex(label) : i;
sliceBrush = sliceBrushPalette ? sliceBrushPalette.getBrush(label, labelIndex, labelCount) : null;
if (!sliceBrush)
sliceBrush = new SolidFillBrush(0x000000, 1);
swatches.push(new SeriesSwatch([ sliceShape ], [ sliceBrush ], [ sliceStyle ], 1));
}
return swatches;
}
protected override function measureOverride(availableSize:Size) : Size
{
var labelStyle:Style = this._labelStyle.value;
var showLabels:Boolean = this._showLabels.value;
var showPercent:Boolean = this._showPercent.value;
var seriesSprite:SeriesSprite;
var sliceSprite:SliceSprite;
var sliceLabel:Label;
var sliceText:String;
var labelSize:Size = new Size(Math.max((availableSize.width / 3) - 30, 0), Infinity);
for each (seriesSprite in this._seriesSprites)
{
sliceSprite = seriesSprite.sliceSprite;
sliceLabel = sliceSprite.label;
sliceText = "";
if (sliceSprite.seriesName)
sliceText += sliceSprite.seriesName;
if (showPercent && sliceSprite.data && sliceSprite.fields && (sliceSprite.fields.length > 2))
sliceText += ", " + sliceSprite.data[sliceSprite.fields[2]] + "";
sliceLabel.text = sliceText;
Style.applyStyle(sliceLabel, labelStyle);
sliceLabel.visibility = showLabels ? Visibility.VISIBLE : Visibility.COLLAPSED;
sliceLabel.measure(labelSize);
}
return super.measureOverride(availableSize);
}
protected override function renderChartOverride(chartWidth:Number, chartHeight:Number, legend:ILegend) : void
{
var showLabels:Boolean = this._showLabels.value;
var seriesSprites:Array = this._seriesSprites;
var seriesSprite:SeriesSprite;
var seriesIndex:int;
var seriesCount:int;
var sliceBrushPalette:IBrushPalette = this._sliceBrushPalette.value;
var sliceStyle:Style = this._sliceStyle.value;
var sliceSprite:SliceSprite;
var sliceLabel:Label;
var sliceGraphics:Graphics;
var sliceBrush:IBrush;
var sliceShapes:Array = this._sliceShapes;
var sliceShape:WedgeShape;
var sliceRadius:Number = showLabels ? Math.min(chartWidth / 3, chartHeight - 30) : Math.min(chartWidth - 4, chartHeight - 4);
sliceRadius = Math.round(Math.max(sliceRadius, 0) / 2);
var numSeriesSprites:int = seriesSprites.length;
var halfWidth:Number = Math.round(chartWidth / 2);
var halfHeight:Number = Math.round(chartHeight / 2);
var x1:Number = halfWidth - sliceRadius;
var x2:Number = halfWidth + sliceRadius;
var y1:Number = halfHeight - sliceRadius;
var y2:Number = halfHeight + sliceRadius;
var rTip:Number = sliceRadius * (2 / 3);
var r1:Number = sliceRadius + 2;
var r2:Number = sliceRadius + 10;
var a:Number;
var i:int;
var labelLineBrush:IBrush = this._labelLineBrush.value;
var labelBounds:Rectangle;
var leftSliceSprites:Array = new Array();
var leftLabelBoundsList:Array = new Array();
var leftPoints1:Array = new Array();
var leftPoints2:Array = new Array();
var rightSliceSprites:Array = new Array();
var rightLabelBoundsList:Array = new Array();
var rightPoints1:Array = new Array();
var rightPoints2:Array = new Array();
var p1:Point;
var p2:Point;
var p3:Point;
var p4:Point;
if (!labelLineBrush)
labelLineBrush = new SolidStrokeBrush(1, 0x000000, 1, true, LineScaleMode.NORMAL, CapsStyle.SQUARE);
seriesCount = legend ? legend.numLabels : numSeriesSprites;
for (i = 0; i < numSeriesSprites; i++)
{
seriesSprite = seriesSprites[i];
sliceSprite = seriesSprite.sliceSprite;
sliceGraphics = sliceSprite.graphics;
sliceGraphics.clear();
seriesIndex = legend ? legend.getLabelIndex(seriesSprite.field) : i;
sliceBrush = sliceBrushPalette ? sliceBrushPalette.getBrush(seriesSprite.field, seriesIndex, seriesCount) : null;
if (!sliceBrush)
sliceBrush = new SolidFillBrush(0x000000, 1);
sliceShape = sliceShapes[i];
a = (sliceShape.startAngle + sliceShape.arcAngle / 2) * (Math.PI / 180);
if (showLabels)
{
sliceLabel = sliceSprite.label;
p1 = new Point(halfWidth + r1 * Math.cos(a), halfHeight + r1 * Math.sin(a));
p2 = new Point(halfWidth + r2 * Math.cos(a), Math.round(halfHeight + r2 * Math.sin(a)));
if (p2.x < halfWidth)
{
labelBounds = new Rectangle(x1 - sliceLabel.measuredWidth - 30, p2.y - sliceLabel.measuredHeight / 2, sliceLabel.measuredWidth, sliceLabel.measuredHeight);
leftSliceSprites.unshift(sliceSprite);
leftLabelBoundsList.unshift(labelBounds);
leftPoints1.unshift(p1);
leftPoints2.unshift(p2);
}
else
{
labelBounds = new Rectangle(x2 + 30, p2.y - sliceLabel.measuredHeight / 2, sliceLabel.measuredWidth, sliceLabel.measuredHeight);
rightSliceSprites.push(sliceSprite);
rightLabelBoundsList.push(labelBounds);
rightPoints1.push(p1);
rightPoints2.push(p2);
}
}
sliceShape.draw(sliceGraphics, x1, y1, x2 - x1, y2 - y1, sliceBrush);
Style.applyStyle(sliceSprite, sliceStyle);
sliceSprite.tipBounds = new Rectangle(Math.round(halfWidth + rTip * Math.cos(a)), Math.round(halfHeight + rTip * Math.sin(a)), 0, 0);
}
if (showLabels)
{
leftLabelBoundsList = LayoutUtil.unoverlap(leftLabelBoundsList, "y", new Rectangle(0, 0, x1, chartHeight));
rightLabelBoundsList = LayoutUtil.unoverlap(rightLabelBoundsList, "y", new Rectangle(x2, 0, chartWidth - x2, chartHeight));
numSeriesSprites = leftSliceSprites.length;
for (i = 0; i < numSeriesSprites; i++)
{
sliceSprite = leftSliceSprites[i];
sliceLabel = sliceSprite.label;
labelBounds = leftLabelBoundsList[i];
p1 = leftPoints1[i];
p2 = leftPoints2[i];
p3 = new Point(x1 - 20, p2.y);
p4 = new Point(x1 - 30, Math.round(labelBounds.y + labelBounds.height / 2));
labelLineBrush.beginBrush(sliceSprite.graphics);
labelLineBrush.moveTo(p1.x, p1.y);
labelLineBrush.lineTo(p2.x, p2.y);
labelLineBrush.lineTo(p3.x, p3.y);
labelLineBrush.lineTo(p4.x, p4.y);
labelLineBrush.endBrush();
sliceLabel.x = Math.round(labelBounds.x);
sliceLabel.y = Math.round(labelBounds.y);
}
numSeriesSprites = rightSliceSprites.length;
for (i = 0; i < numSeriesSprites; i++)
{
sliceSprite = rightSliceSprites[i];
sliceLabel = sliceSprite.label;
labelBounds = rightLabelBoundsList[i];
p1 = rightPoints1[i];
p2 = rightPoints2[i];
p3 = new Point(x2 + 20, p2.y);
p4 = new Point(x2 + 30, Math.round(labelBounds.y + labelBounds.height / 2));
labelLineBrush.beginBrush(sliceSprite.graphics);
labelLineBrush.moveTo(p1.x, p1.y);
labelLineBrush.lineTo(p2.x, p2.y);
labelLineBrush.lineTo(p3.x, p3.y);
labelLineBrush.lineTo(p4.x, p4.y);
labelLineBrush.endBrush();
sliceLabel.x = Math.round(labelBounds.x);
sliceLabel.y = Math.round(labelBounds.y);
}
}
var maskGraphics:Graphics = this._seriesMask.graphics;
maskGraphics.clear();
maskGraphics.beginFill(0x000000, 1);
maskGraphics.drawRect(0, 0, chartWidth, chartHeight);
maskGraphics.endFill();
}
protected override function highlightSeriesOverride(seriesName:String) : void
{
var tweens:Array = new Array();
var a:Number = AbstractChart.HIGHLIGHT_RATIO;
var seriesSprites:Array = this._seriesSprites;
var numSeriesSprites:int = seriesSprites.length;
var seriesSprite:SeriesSprite;
for (var i:int = 0; i < numSeriesSprites; i++)
{
seriesSprite = seriesSprites[i];
if (seriesSprite)
{
if (seriesName && (seriesSprite.field != seriesName))
tweens.push(new PropertyTween(seriesSprite, "alpha", null, a));
else
tweens.push(new PropertyTween(seriesSprite, "alpha", null, 1));
}
}
if (tweens.length > 0)
TweenRunner.start(new GroupTween(tweens, AbstractChart.HIGHLIGHT_EASER), AbstractChart.HIGHLIGHT_DURATION);
}
protected override function highlightElementOverride(element:DataSprite) : void
{
var tweens:Array = new Array();
var a:Number;
if (element)
{
a = AbstractChart.HIGHLIGHT_RATIO;
if (element.chart == this)
{
tweens.push(new PropertyTween(element, "alpha", null, 1 / a));
this._highlightedElement = element;
}
}
else
{
a = 1;
if (this._highlightedElement)
{
tweens.push(new PropertyTween(this._highlightedElement, "alpha", null, 1));
this._highlightedElement = null;
}
}
var seriesSprites:Array = this._seriesSprites;
var numSeriesSprites:int = seriesSprites.length;
var seriesSprite:SeriesSprite;
for (var i:int = 0; i < numSeriesSprites; i++)
{
seriesSprite = seriesSprites[i];
if (seriesSprite)
tweens.push(new PropertyTween(seriesSprite, "alpha", null, a));
}
if (tweens.length > 0)
TweenRunner.start(new GroupTween(tweens, AbstractChart.HIGHLIGHT_EASER), AbstractChart.HIGHLIGHT_DURATION);
}
}
}
import com.jasongatt.controls.OverflowMode;
import com.splunk.charting.charts.DataSprite;
import com.splunk.controls.Label;
import flash.display.Sprite;
import flash.text.TextFormat;
class SeriesSprite extends Sprite
{
// Public Properties
public var field:String;
public var sliceSprite:SliceSprite;
// Constructor
public function SeriesSprite()
{
this.sliceSprite = new SliceSprite();
this.mouseEnabled = false;
this.addChild(this.sliceSprite);
}
}
class SliceSprite extends DataSprite
{
// Public Properties
public var label:Label;
// Constructor
public function SliceSprite()
{
this.label = new Label();
this.label.overflowMode = OverflowMode.ELLIPSIS_MIDDLE;
this.addChild(this.label);
}
}
|
/**
* Created by newkrok on 14/08/15.
*/
package src.menu
{
import net.fpp.common.starling.StaticAssetManager;
import src.assets.Fonts;
import starling.display.Image;
import starling.display.Sprite;
import starling.events.Event;
import starling.text.TextField;
import starling.text.TextFormat;
import starling.utils.Align;
public class StarGuiView extends Sprite
{
private var _back:Image;
private var _text:TextField;
private var _value:uint = 0;
public function StarGuiView():void
{
addEventListener( Event.ADDED_TO_STAGE, loaded );
}
private function loaded( event:Event ):void
{
removeEventListener( Event.ADDED_TO_STAGE, loaded );
addChild( _back = new Image( StaticAssetManager.instance.getTexture( "star_counter_back" ) ) );
var textFormat:TextFormat = new TextFormat();
textFormat.font = Fonts.getAachenLightFont().name;
textFormat.size = 15;
textFormat.color = 0xFFFF00;
textFormat.horizontalAlign = Align.RIGHT;
textFormat.verticalAlign = Align.CENTER;
addChild( _text = new TextField( 50, _back.height, '0', textFormat ) );
_text.touchable = false;
_text.pivotX = _text.width / 2;
_text.pivotY = _text.height / 2;
_text.x = _back.width - _text.width - 10 + _text.pivotX;
_text.y = 4 + _text.pivotY;
}
public function updateValue( value:uint ):void
{
if( value != _value )
{
_value = value;
_text.text = _value.toString();
}
}
override public function dispose():void
{
_back.removeFromParent( true );
_back = null;
_text.removeFromParent( true );
_text = null;
super.dispose();
}
}
} |
package org.axgl.render {
import com.adobe.utils.AGALMiniAssembler;
import flash.display3D.Context3DProgramType;
import flash.display3D.Program3D;
import flash.utils.getTimer;
import org.axgl.Ax;
/**
* A descriptor holding the information required for rendering, including the vertex shader, the fragment
* shader, and the size of each row in the vertex buffer.
*/
public class AxShader {
/**
* The Program3D holding the vertex and fragment shaders.
*/
public var program:Program3D;
/**
* The size of each row in the vertex buffer.
*/
public var rowSize:uint;
/**
* Creates a new AxShader containing the shaders and buffer row size.
*
* @param vertexShader The vertex shader.
* @param fragmentShader The fragment shader.
* @param rowSize The size of each row in the vertex buffer.
*
*/
public function AxShader(vertexShader:Array, fragmentShader:Array, rowSize:uint) {
var vertexShaderAssembler:AGALMiniAssembler = new AGALMiniAssembler();
vertexShaderAssembler.assemble(Context3DProgramType.VERTEX, vertexShader.join("\n"));
var fragmentShaderAssembler:AGALMiniAssembler = new AGALMiniAssembler();
fragmentShaderAssembler.assemble(Context3DProgramType.FRAGMENT, fragmentShader.join("\n"));
program = Ax.context.createProgram();
program.upload(vertexShaderAssembler.agalcode, fragmentShaderAssembler.agalcode);
this.rowSize = rowSize;
}
}
}
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
/* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */
/* 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 = "6.3.4";
// var VERSION = "AS3";
// var TITLE = "The numeric identity operator +";
var flt:float = -2.1e-3f;
AddStrictTestCase("unary plus on float", flt, +flt);
var u = +flt;
Assert.expectEq("unary plus on float returns float", "float", typeof(u));
u = +Number(u);
Assert.expectEq("unary plus on number returns number, not float", "number", typeof(u));
var neg_zerof:float = -0.0f;
Assert.expectEq("unary plus on -0.0f", float.NEGATIVE_INFINITY, float.POSITIVE_INFINITY/+neg_zerof);
Assert.expectEq("unary plus on -0.0f FloatLiteral", float.NEGATIVE_INFINITY, float.POSITIVE_INFINITY/+(-0.0f));
flt = new float(-12.375f);
var pos = 1095106560;
var neg = 3242590208;
Assert.expectEq("float binary form match", neg.toString(2), uint(FloatRawBits(flt)).toString(2));
Assert.expectEq("unary plus on float", neg.toString(2), uint(FloatRawBits(+flt)).toString(2));
Assert.expectEq("unary plus on float.POSITIVE_INFINITY", float.POSITIVE_INFINITY, +float.POSITIVE_INFINITY);
Assert.expectEq("unary plus on float.NEGATIVE_INFINITY", float.NEGATIVE_INFINITY, +float.NEGATIVE_INFINITY);
Assert.expectEq("unary plus on float.MAX_VALUE", float.MAX_VALUE, +float.MAX_VALUE);
Assert.expectEq("unary plus on float.MIN_VALUE", float.MIN_VALUE, +float.MIN_VALUE);
Assert.expectEq("unary plus on float.NaN", float.NaN, +float.NaN);
|
// makeswf -v 7 -s 200x150 -r 1 -o same-argument-name.swf same-argument-name.as
function foo (x, x) {
trace (x);
};
foo (1, 2);
getURL ("fscommand:quit", "");
|
/* 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 NameSpacePackage{
public namespace NameSpaceDef = "http://www.adobe.com/go";
}
|
package com.nodename.Delaunay
{
import __AS3__.vec.Vector;
import flash.geom.Point;
internal function selectEdgesForSitePoint(coord:Point, edgesToTest:Vector.<Edge>):Vector.<Edge>
{
return edgesToTest.filter(myTest);
function myTest(edge:Edge, index:int, vector:Vector.<Edge>):Boolean
{
return ((edge.leftSite && edge.leftSite.coord == coord)
|| (edge.rightSite && edge.rightSite.coord == coord));
}
}
} |
/*
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.popups
{
import feathers.core.IFeathersControl;
import feathers.core.IValidating;
import feathers.core.PopUpManager;
import feathers.core.ValidationQueue;
import feathers.display.RenderDelegate;
import feathers.events.FeathersEventType;
import feathers.layout.RelativePosition;
import feathers.utils.display.getDisplayObjectDepthFromStage;
import feathers.utils.geom.matrixToScaleX;
import feathers.utils.geom.matrixToScaleY;
import flash.errors.IllegalOperationError;
import flash.events.KeyboardEvent;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.ui.Keyboard;
import starling.animation.Transitions;
import starling.animation.Tween;
import starling.core.Starling;
import starling.display.DisplayObject;
import starling.display.DisplayObjectContainer;
import starling.display.Quad;
import starling.display.Stage;
import starling.events.Event;
import starling.events.EventDispatcher;
import starling.events.ResizeEvent;
import starling.events.Touch;
import starling.events.TouchEvent;
import starling.events.TouchPhase;
import starling.utils.Pool;
/**
* Dispatched when the pop-up content opens.
*
* <p>The properties of the event object have the following values:</p>
* <table class="innertable">
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td><code>bubbles</code></td><td>false</td></tr>
* <tr><td><code>currentTarget</code></td><td>The Object that defines the
* event listener that handles the event. For example, if you use
* <code>myButton.addEventListener()</code> to register an event listener,
* myButton is the value of the <code>currentTarget</code>.</td></tr>
* <tr><td><code>data</code></td><td>null</td></tr>
* <tr><td><code>target</code></td><td>The Object that dispatched the event;
* it is not always the Object listening for the event. Use the
* <code>currentTarget</code> property to always access the Object
* listening for the event.</td></tr>
* </table>
*
* @eventType starling.events.Event.OPEN
*/
[Event(name="open",type="starling.events.Event")]
/**
* Dispatched when the pop-up content closes.
*
* <p>The properties of the event object have the following values:</p>
* <table class="innertable">
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td><code>bubbles</code></td><td>false</td></tr>
* <tr><td><code>currentTarget</code></td><td>The Object that defines the
* event listener that handles the event. For example, if you use
* <code>myButton.addEventListener()</code> to register an event listener,
* myButton is the value of the <code>currentTarget</code>.</td></tr>
* <tr><td><code>data</code></td><td>null</td></tr>
* <tr><td><code>target</code></td><td>The Object that dispatched the event;
* it is not always the Object listening for the event. Use the
* <code>currentTarget</code> property to always access the Object
* listening for the event.</td></tr>
* </table>
*
* @eventType starling.events.Event.CLOSE
*/
[Event(name="close",type="starling.events.Event")]
/**
* Displays pop-up content as a desktop-style drop-down.
*
* @productversion Feathers 1.0.0
*/
public class DropDownPopUpContentManager extends EventDispatcher implements IPopUpContentManager
{
/**
* Constructor.
*/
public function DropDownPopUpContentManager()
{
super();
}
/**
* @private
*/
protected var content:DisplayObject;
/**
* @private
*/
protected var source:DisplayObject;
/**
* @private
*/
protected var _delegate:RenderDelegate;
/**
* @private
* Stores the same value as the content property, but the content
* property may be set to null before the animation ends.
*/
protected var _openCloseTweenTarget:DisplayObject;
/**
* @private
*/
protected var _openCloseTween:Tween;
/**
* @inheritDoc
*/
public function get isOpen():Boolean
{
return this.content !== null;
}
/**
* @private
*/
protected var _isModal:Boolean = false;
/**
* Determines if the pop-up will be modal or not.
*
* <p>Note: If you change this value while a pop-up is displayed, the
* new value will not go into effect until the pop-up is removed and a
* new pop-up is added.</p>
*
* <p>In the following example, the pop-up is modal:</p>
*
* <listing version="3.0">
* manager.isModal = true;</listing>
*
* @default false
*/
public function get isModal():Boolean
{
return this._isModal;
}
/**
* @private
*/
public function set isModal(value:Boolean):void
{
this._isModal = value;
}
/**
* @private
*/
protected var _overlayFactory:Function;
/**
* If <code>isModal</code> is <code>true</code>, this function may be
* used to customize the modal overlay displayed by the pop-up manager.
* If the value of <code>overlayFactory</code> is <code>null</code>, the
* pop-up manager's default overlay factory will be used instead.
*
* <p>This function is expected to have the following signature:</p>
* <pre>function():DisplayObject</pre>
*
* <p>In the following example, the overlay is customized:</p>
*
* <listing version="3.0">
* manager.isModal = true;
* manager.overlayFactory = function():DisplayObject
* {
* var quad:Quad = new Quad(1, 1, 0xff00ff);
* quad.alpha = 0;
* return quad;
* };</listing>
*
* @default null
*
* @see feathers.core.PopUpManager#overlayFactory
*/
public function get overlayFactory():Function
{
return this._overlayFactory;
}
/**
* @private
*/
public function set overlayFactory(value:Function):void
{
this._overlayFactory = value;
}
/**
* @private
*/
protected var _gap:Number = 0;
/**
* The space, in pixels, between the source and the pop-up.
*/
public function get gap():Number
{
return this._gap;
}
/**
* @private
*/
public function set gap(value:Number):void
{
this._gap = value;
}
/**
* @private
*/
protected var _openCloseDuration:Number = 0.2;
/**
* The duration, in seconds, of the open and close animation.
*/
public function get openCloseDuration():Number
{
return this._openCloseDuration;
}
/**
* @private
*/
public function set openCloseDuration(value:Number):void
{
this._openCloseDuration = value;
}
/**
* @private
*/
protected var _openCloseEase:Object = Transitions.EASE_OUT;
/**
* The easing function to use for the open and close animation.
*/
public function get openCloseEase():Object
{
return this._openCloseEase;
}
/**
* @private
*/
public function set openCloseEase(value:Object):void
{
this._openCloseEase = value;
}
/**
* @private
*/
protected var _actualDirection:String;
/**
* @private
*/
protected var _primaryDirection:String = RelativePosition.BOTTOM;
/**
* The preferred position of the pop-up, relative to the source. If
* there is not enough space to position pop-up at the preferred
* position, it may be positioned elsewhere.
*
* @default feathers.layout.RelativePosition.BOTTOM
*
* @see feathers.layout.RelativePosition#BOTTOM
* @see feathers.layout.RelativePosition#TOP
*/
public function get primaryDirection():String
{
return this._primaryDirection;
}
/**
* @private
*/
public function set primaryDirection(value:String):void
{
if(value === "up")
{
value = RelativePosition.TOP;
}
else if(value === "down")
{
value = RelativePosition.BOTTOM;
}
this._primaryDirection = value;
}
/**
* @private
*/
protected var _fitContentMinWidthToOrigin:Boolean = true;
/**
* If enabled, the pop-up content's <code>minWidth</code> property will
* be set to the <code>width</code> property of the origin, if it is
* smaller.
*
* @default true
*/
public function get fitContentMinWidthToOrigin():Boolean
{
return this._fitContentMinWidthToOrigin;
}
/**
* @private
*/
public function set fitContentMinWidthToOrigin(value:Boolean):void
{
this._fitContentMinWidthToOrigin = value;
}
/**
* @private
*/
protected var _lastOriginX:Number;
/**
* @private
*/
protected var _lastOriginY:Number;
/**
* @inheritDoc
*/
public function open(content:DisplayObject, source:DisplayObject):void
{
if(this.isOpen)
{
throw new IllegalOperationError("Pop-up content is already open. Close the previous content before opening new content.");
}
//make sure the content is scaled the same as the source
var matrix:Matrix = Pool.getMatrix();
source.getTransformationMatrix(PopUpManager.root, matrix);
content.scaleX = matrixToScaleX(matrix)
content.scaleY = matrixToScaleY(matrix);
Pool.putMatrix(matrix);
this.content = content;
this.source = source;
PopUpManager.addPopUp(content, this._isModal, false, this._overlayFactory);
if(content is IFeathersControl)
{
content.addEventListener(FeathersEventType.RESIZE, content_resizeHandler);
}
content.addEventListener(Event.REMOVED_FROM_STAGE, content_removedFromStageHandler);
this.layout();
if(this._openCloseTween !== null)
{
this._openCloseTween.advanceTime(this._openCloseTween.totalTime);
}
if(this._openCloseDuration > 0)
{
this._delegate = new RenderDelegate(content);
this._delegate.scaleX = content.scaleX;
this._delegate.scaleY = content.scaleY;
//temporarily hide the content while the delegate is displayed
content.visible = false;
PopUpManager.addPopUp(this._delegate, false, false);
this._delegate.x = content.x;
if(this._actualDirection === RelativePosition.TOP)
{
this._delegate.y = content.y + content.height;
}
else //bottom
{
this._delegate.y = content.y - content.height;
}
var mask:Quad = new Quad(1, 1, 0xff00ff);
mask.width = content.width / content.scaleX;
mask.height = 0;
this._delegate.mask = mask;
mask.height = 0;
this._openCloseTween = new Tween(this._delegate, this._openCloseDuration, this._openCloseEase);
this._openCloseTweenTarget = content;
this._openCloseTween.animate("y", content.y);
this._openCloseTween.onUpdate = openCloseTween_onUpdate;
this._openCloseTween.onComplete = openTween_onComplete;
Starling.juggler.add(this._openCloseTween);
}
var stage:Stage = this.source.stage;
stage.addEventListener(TouchEvent.TOUCH, stage_touchHandler);
stage.addEventListener(ResizeEvent.RESIZE, stage_resizeHandler);
stage.addEventListener(Event.ENTER_FRAME, stage_enterFrameHandler);
//using priority here is a hack so that objects higher up in the
//display list have a chance to cancel the event first.
var priority:int = -getDisplayObjectDepthFromStage(this.content);
Starling.current.nativeStage.addEventListener(KeyboardEvent.KEY_DOWN, nativeStage_keyDownHandler, false, priority, true);
this.dispatchEventWith(Event.OPEN);
}
/**
* @inheritDoc
*/
public function close():void
{
if(!this.isOpen)
{
return;
}
if(this._openCloseTween !== null)
{
this._openCloseTween.advanceTime(this._openCloseTween.totalTime);
}
var content:DisplayObject = this.content;
this.source = null;
this.content = null;
var stage:Stage = content.stage;
stage.removeEventListener(TouchEvent.TOUCH, stage_touchHandler);
stage.removeEventListener(ResizeEvent.RESIZE, stage_resizeHandler);
stage.removeEventListener(Event.ENTER_FRAME, stage_enterFrameHandler);
stage.starling.nativeStage.removeEventListener(KeyboardEvent.KEY_DOWN, nativeStage_keyDownHandler);
if(content is IFeathersControl)
{
content.removeEventListener(FeathersEventType.RESIZE, content_resizeHandler);
}
content.removeEventListener(Event.REMOVED_FROM_STAGE, content_removedFromStageHandler);
if(content.parent)
{
content.removeFromParent(false);
}
if(this._openCloseDuration > 0)
{
this._delegate = new RenderDelegate(content);
this._delegate.scaleX = content.scaleX;
this._delegate.scaleY = content.scaleY;
PopUpManager.addPopUp(this._delegate, false, false);
this._delegate.x = content.x;
this._delegate.y = content.y;
var mask:Quad = new Quad(1, 1, 0xff00ff);
mask.width = content.width / content.scaleX;
mask.height = content.height / content.scaleY;
this._delegate.mask = mask;
this._openCloseTween = new Tween(this._delegate, this._openCloseDuration, this._openCloseEase);
this._openCloseTweenTarget = content;
if(this._actualDirection === RelativePosition.TOP)
{
this._openCloseTween.animate("y", content.y + content.height);
}
else
{
this._openCloseTween.animate("y", content.y - content.height);
}
this._openCloseTween.onUpdate = openCloseTween_onUpdate;
this._openCloseTween.onComplete = closeTween_onComplete;
Starling.juggler.add(this._openCloseTween);
}
else
{
this.dispatchEventWith(Event.CLOSE);
}
}
/**
* @inheritDoc
*/
public function dispose():void
{
this.openCloseDuration = 0;
this.close();
}
/**
* @private
*/
protected function layout():void
{
if(this.source is IValidating)
{
IValidating(this.source).validate();
if(!this.isOpen)
{
//it's possible that the source will close its pop-up during
//validation, so we should check for that.
return;
}
}
var originBoundsInParent:Rectangle = this.source.getBounds(PopUpManager.root);
var sourceWidth:Number = originBoundsInParent.width;
var hasSetBounds:Boolean = false;
var uiContent:IFeathersControl = this.content as IFeathersControl;
if(this._fitContentMinWidthToOrigin && uiContent && uiContent.minWidth < sourceWidth)
{
uiContent.minWidth = sourceWidth;
hasSetBounds = true;
}
if(this.content is IValidating)
{
uiContent.validate();
}
if(!hasSetBounds && this._fitContentMinWidthToOrigin && this.content.width < sourceWidth)
{
this.content.width = sourceWidth;
}
var stage:Stage = this.source.stage;
//we need to be sure that the source is properly positioned before
//positioning the content relative to it.
var validationQueue:ValidationQueue = ValidationQueue.forStarling(stage.starling);
if(validationQueue && !validationQueue.isValidating)
{
//force a COMPLETE validation of everything
//but only if we're not already doing that...
validationQueue.advanceTime(0);
}
originBoundsInParent = this.source.getBounds(PopUpManager.root);
this._lastOriginX = originBoundsInParent.x;
this._lastOriginY = originBoundsInParent.y;
var stageDimensionsInParent:Point = new Point(stage.stageWidth, stage.stageHeight);
PopUpManager.root.globalToLocal(stageDimensionsInParent, stageDimensionsInParent);
var downSpace:Number = (stageDimensionsInParent.y - this.content.height) - (originBoundsInParent.y + originBoundsInParent.height + this._gap);
//skip this if the primary direction is up
if(this._primaryDirection == RelativePosition.BOTTOM && downSpace >= 0)
{
layoutBelow(originBoundsInParent, stageDimensionsInParent);
return;
}
var upSpace:Number = originBoundsInParent.y - this._gap - this.content.height;
if(upSpace >= 0)
{
layoutAbove(originBoundsInParent, stageDimensionsInParent);
return;
}
//do what we skipped earlier if the primary direction is up
if(this._primaryDirection == RelativePosition.TOP && downSpace >= 0)
{
layoutBelow(originBoundsInParent, stageDimensionsInParent);
return;
}
//worst case: pick the side that has the most available space
if(upSpace >= downSpace)
{
layoutAbove(originBoundsInParent, stageDimensionsInParent);
}
else
{
layoutBelow(originBoundsInParent, stageDimensionsInParent);
}
//the content is too big for the space, so we need to adjust it to
//fit properly
var newMaxHeight:Number = stageDimensionsInParent.y - (originBoundsInParent.y + originBoundsInParent.height);
if(uiContent)
{
if(uiContent.maxHeight > newMaxHeight)
{
uiContent.maxHeight = newMaxHeight;
}
}
else if(this.content.height > newMaxHeight)
{
this.content.height = newMaxHeight;
}
}
/**
* @private
*/
protected function layoutAbove(originBoundsInParent:Rectangle, stageDimensionsInParent:Point):void
{
this._actualDirection = RelativePosition.TOP;
this.content.x = this.calculateXPosition(originBoundsInParent, stageDimensionsInParent);
this.content.y = originBoundsInParent.y - this.content.height - this._gap;
}
/**
* @private
*/
protected function layoutBelow(originBoundsInParent:Rectangle, stageDimensionsInParent:Point):void
{
this._actualDirection = RelativePosition.BOTTOM;
this.content.x = this.calculateXPosition(originBoundsInParent, stageDimensionsInParent);
this.content.y = originBoundsInParent.y + originBoundsInParent.height + this._gap;
}
/**
* @private
*/
protected function calculateXPosition(originBoundsInParent:Rectangle, stageDimensionsInParent:Point):Number
{
var idealXPosition:Number = originBoundsInParent.x;
var fallbackXPosition:Number = idealXPosition + originBoundsInParent.width - this.content.width;
var maxXPosition:Number = stageDimensionsInParent.x - this.content.width;
var xPosition:Number = idealXPosition;
if(xPosition > maxXPosition)
{
if(fallbackXPosition >= 0)
{
xPosition = fallbackXPosition;
}
else
{
xPosition = maxXPosition;
}
}
if(xPosition < 0)
{
xPosition = 0;
}
return xPosition;
}
/**
* @private
*/
protected function openCloseTween_onUpdate():void
{
var mask:DisplayObject = this._delegate.mask;
if(this._actualDirection === RelativePosition.TOP)
{
mask.height = (this._openCloseTweenTarget.height - (this._delegate.y - this._openCloseTweenTarget.y)) / this._openCloseTweenTarget.scaleY;
mask.y = 0;
}
else
{
mask.height = (this._openCloseTweenTarget.height - (this._openCloseTweenTarget.y - this._delegate.y)) / this._openCloseTweenTarget.scaleY;
mask.y = (this._openCloseTweenTarget.height / this._openCloseTweenTarget.scaleY) - mask.height;
}
}
/**
* @private
*/
protected function openCloseTween_onComplete():void
{
this._openCloseTween = null;
this._delegate.removeFromParent(true);
this._delegate = null;
}
/**
* @private
*/
protected function openTween_onComplete():void
{
this.openCloseTween_onComplete();
this.content.visible = true;
}
/**
* @private
*/
protected function closeTween_onComplete():void
{
this.openCloseTween_onComplete();
this.dispatchEventWith(Event.CLOSE);
}
/**
* @private
*/
protected function content_resizeHandler(event:Event):void
{
this.layout();
}
/**
* @private
*/
protected function stage_enterFrameHandler(event:Event):void
{
var rect:Rectangle = Pool.getRectangle();
this.source.getBounds(PopUpManager.root, rect);
var rectX:Number = rect.x;
var rectY:Number = rect.y;
Pool.putRectangle(rect);
if(rectY != this._lastOriginX || rectY != this._lastOriginY)
{
this.layout();
}
}
/**
* @private
*/
protected function content_removedFromStageHandler(event:Event):void
{
this.close();
}
/**
* @private
*/
protected function nativeStage_keyDownHandler(event:KeyboardEvent):void
{
if(event.isDefaultPrevented())
{
//someone else already handled this one
return;
}
if(event.keyCode != Keyboard.BACK && event.keyCode != Keyboard.ESCAPE)
{
return;
}
//don't let the OS handle the event
event.preventDefault();
this.close();
}
/**
* @private
*/
protected function stage_resizeHandler(event:ResizeEvent):void
{
this.layout();
}
/**
* @private
*/
protected function stage_touchHandler(event:TouchEvent):void
{
var target:DisplayObject = DisplayObject(event.target);
if(this.content == target || (this.content is DisplayObjectContainer && DisplayObjectContainer(this.content).contains(target)))
{
return;
}
if(this.source == target || (this.source is DisplayObjectContainer && DisplayObjectContainer(this.source).contains(target)))
{
return;
}
if(!PopUpManager.isTopLevelPopUp(this.content))
{
return;
}
//any began touch is okay here. we don't need to check all touches
var stage:Stage = Stage(event.currentTarget);
var touch:Touch = event.getTouch(stage, TouchPhase.BEGAN);
if(!touch)
{
return;
}
this.close();
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package mx.charts.series.renderData
{
import mx.charts.chartClasses.RenderData;
/**
* Represents all the information needed by the PlotSeries to render.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public class PlotSeriesRenderData extends RenderData
{
include "../../../core/Version.as";
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
* @param cache The list of PlotSeriesItem objects representing the items in the dataProvider.
* @param filteredCache The list of PlotSeriesItem objects representing the items in the dataProvider that remain after filtering.
* @param radius The radius of the individual PlotSeriesItem objects.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function PlotSeriesRenderData(cache:Array /* of PlotSeriesItem */ = null,
filteredCache:Array /* of PlotSeriesItem */ = null,
radius:Number = 0)
{
super(cache, filteredCache);
this.radius = radius;
}
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
//----------------------------------
// radius
//----------------------------------
[Inspectable(environment="none")]
/**
* The radius of the individual PlotSeriesItem objects.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public var radius:Number;
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* @private
*/
override public function clone():RenderData
{
return new PlotSeriesRenderData(cache, filteredCache, radius);
}
}
}
|
/*****************************************************
*
* Copyright 2009 Adobe Systems Incorporated. All Rights Reserved.
*
*****************************************************
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
*
* The Initial Developer of the Original Code is Adobe Systems Incorporated.
* Portions created by Adobe Systems Incorporated are Copyright (C) 2009 Adobe Systems
* Incorporated. All Rights Reserved.
*
*****************************************************/
package org.osmf.elements
{
import __AS3__.vec.Vector;
import flash.errors.IllegalOperationError;
import flash.external.ExternalInterface;
import flash.utils.Dictionary;
import org.osmf.elements.htmlClasses.HTMLAudioTrait;
import org.osmf.elements.htmlClasses.HTMLLoadTrait;
import org.osmf.elements.htmlClasses.HTMLPlayTrait;
import org.osmf.elements.htmlClasses.HTMLTimeTrait;
import org.osmf.events.LoadEvent;
import org.osmf.events.MediaError;
import org.osmf.events.MediaErrorCodes;
import org.osmf.events.MediaErrorEvent;
import org.osmf.media.MediaElement;
import org.osmf.media.MediaResourceBase;
import org.osmf.media.URLResource;
import org.osmf.traits.LoadState;
import org.osmf.traits.MediaTraitBase;
import org.osmf.traits.MediaTraitType;
import org.osmf.utils.OSMFStrings;
/**
* HTMLElement is a media element that represents a piece of media external
* to the Flash SWF, and within an HTML region. It serves as a bridge between
* the OSMF APIs for controlling media, and a corresponding (external)
* JavaScript implementation.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public class HTMLElement extends MediaElement
{
// Public API
//
/**
* @private
*/
public function set scriptPath(value:String):void
{
_scriptPath = value;
}
/**
* @private
*/
public function getPropertyCallback(property:String):*
{
var result:*;
var playable:HTMLPlayTrait = switchableTraits[MediaTraitType.PLAY] as HTMLPlayTrait;
var temporal:HTMLTimeTrait = switchableTraits[MediaTraitType.TIME] as HTMLTimeTrait;
var audible:HTMLAudioTrait = switchableTraits[MediaTraitType.AUDIO] as HTMLAudioTrait;
// All property names start with a capital, for they translate
// to 'getXxxx' in JavaScript.
switch (property)
{
// MediaElement core:
case "Resource":
if (resource is URLResource)
{
result = URLResource(resource).url;
}
break;
// LoadTrait:
case "LoadState":
result = loadTrait.loadState;
break;
// PlayTrait:
case "Playable":
result = hasTrait(MediaTraitType.PLAY);
break;
case "PlayState":
result = playable ? playable.playState : null;
break;
case "CanPause":
result = playable ? playable.canPause : false;
break;
// TimeTrait:
case "Temporal":
result = hasTrait(MediaTraitType.TIME);
break;
case "Duration":
result = temporal ? temporal.duration : NaN;
break;
case "CurrentTime":
result = temporal ? temporal.currentTime : NaN;
break;
// AudioTrait:
case "Volume":
result = audible ? audible.volume : NaN;
break;
case "Muted":
result = audible ? audible.muted : false;
break;
case "Pan":
result = audible ? audible.pan : NaN;
break;
}
return result;
}
/**
* @private
*/
public function setPropertyCallback(property:String, value:*):void
{
settingAProperty = true;
var playable:HTMLPlayTrait = switchableTraits[MediaTraitType.PLAY] as HTMLPlayTrait;
var temporal:HTMLTimeTrait = switchableTraits[MediaTraitType.TIME] as HTMLTimeTrait;
var audible:HTMLAudioTrait = switchableTraits[MediaTraitType.AUDIO] as HTMLAudioTrait;
// All property names start with a capital, for they translate
// to 'setXxxx' in JavaScript.
switch (property)
{
// Load Trait
case "LoadState":
var newLoadState:String = value;
if (loadTrait)
{
loadTrait.loadState = newLoadState;
if (newLoadState == LoadState.LOAD_ERROR)
{
dispatchEvent
( new MediaErrorEvent
( MediaErrorEvent.MEDIA_ERROR
, false
, false
, new MediaError(MediaErrorCodes.MEDIA_LOAD_FAILED)
)
);
}
}
break;
// Play Trait:
case "Playable":
setTraitEnabled(MediaTraitType.PLAY, value as Boolean);
break;
case "CanPause":
if (playable)
{
playable.canPause = value;
}
break;
case "PlayState":
if (playable)
{
playable.playState = value;
}
// Time Trait:
case "Temporal":
setTraitEnabled(MediaTraitType.TIME, value as Boolean);
break;
case "Duration":
if (temporal)
{
temporal.duration = value as Number;
}
break;
case "CurrentTime":
if (temporal)
{
temporal.currentTime = value as Number;
}
break;
// AudioTrait
case "Audible":
setTraitEnabled(MediaTraitType.AUDIO, value as Boolean);
break;
case "Volume":
if (audible)
{
audible.volume = value as Number;
}
break;
case "Muted":
if (audible)
{
audible.muted = value as Boolean;
}
break;
case "Pan":
if (audible)
{
audible.pan = value as Number;
}
break;
// If the property is unknown, throw an exception:
default:
throw new IllegalOperationError
( "Property '"
+ property
+ "' assigned from JavaScript is not supported on a MediaElement."
);
break;
}
settingAProperty = false;
}
/**
* @private
*/
internal var settingAProperty:Boolean;
/**
* @private
*/
public function invokeJavaScriptMethod(methodName:String, ...arguments):*
{
requireScriptPath;
arguments.unshift(_scriptPath + "__" + methodName + "__");
var result:* = ExternalInterface.call.apply(this, arguments);
return result;
}
/**
* @private
*/
private function setTraitEnabled(type:String, enabled:Boolean):void
{
if (switchableTraitTypes.indexOf(type) == -1)
{
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
}
var trait:MediaTraitBase = switchableTraits[type];
if (trait == null && enabled == true)
{
// Instantiate the correct trait implementation:
switch(type)
{
case MediaTraitType.PLAY:
trait = new HTMLPlayTrait(this);
break;
case MediaTraitType.TIME:
trait = new HTMLTimeTrait(this);
break;
case MediaTraitType.AUDIO:
trait = new HTMLAudioTrait(this);
break;
}
switchableTraits[type] = trait;
updateTraits();
}
else if (trait != null && enabled == false)
{
// Remove the current trait implementation:
delete switchableTraits[type];
updateTraits();
}
}
// Overrides
//
/**
* @private
*/
override public function set resource(value:MediaResourceBase):void
{
if (resource != value)
{
super.resource = value;
// LoadTrait cannot have its resource reset anymore. As a
// result, we need to consruct a new trait on the elements
// resource being set:
if (loadTrait)
{
loadTrait.unload();
loadTrait.removeEventListener
( LoadEvent.LOAD_STATE_CHANGE
, onLoadStateChange
);
}
loadTrait = new HTMLLoadTrait(this);
{
addTrait(MediaTraitType.LOAD, loadTrait);
loadTrait.addEventListener
( LoadEvent.LOAD_STATE_CHANGE
, onLoadStateChange
, false, int.MAX_VALUE
);
}
}
}
// Private
//
private function onLoadStateChange(event:LoadEvent):void
{
updateTraits();
}
private function updateTraits():void
{
var type:String;
if (loadTrait && loadTrait.loadState == LoadState.READY)
{
// Make sure that the constructed trait objects are
// being reflected on being loaded:
for (var typeObject:Object in switchableTraits)
{
type = String(typeObject);
var trait:MediaTraitBase = switchableTraits[type];
if (hasTrait(type) == false)
{
addTrait(type, trait);
}
}
}
else
{
// Don't expose any traits if not loaded (except for the
// LoadTrait):
for each (type in traitTypes)
{
if (type != MediaTraitType.LOAD)
{
removeTrait(type);
}
}
}
}
private function get requireScriptPath():*
{
if (_scriptPath == null)
{
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.NULL_SCRIPT_PATH));
}
return undefined;
}
private var loadTrait:HTMLLoadTrait;
private var switchableTraits:Dictionary = new Dictionary();
private var _scriptPath:String;
/* static */
private static const switchableTraitTypes:Vector.<String> = new Vector.<String>(3);
switchableTraitTypes[0] = MediaTraitType.PLAY;
switchableTraitTypes[1] = MediaTraitType.TIME;
switchableTraitTypes[2] = MediaTraitType.AUDIO;
}
} |
package kabam.rotmg.packages.view {
import com.company.assembleegameclient.util.TextureRedrawer;
import com.company.util.AssetLibrary;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.Sprite;
import kabam.rotmg.text.view.TextFieldDisplayConcrete;
import kabam.rotmg.text.view.stringBuilder.StaticStringBuilder;
public class GoldDisplay extends Sprite {
public function GoldDisplay() {
text = new TextFieldDisplayConcrete().setSize(18).setColor(0xffffff);
super();
}
internal var graphic:DisplayObject;
internal var text:TextFieldDisplayConcrete;
public function init():void {
var _local1:BitmapData = AssetLibrary.getImageFromSet("lofiObj3", 225);
_local1 = TextureRedrawer.redraw(_local1, 40, true, 0);
this.graphic = new Bitmap(_local1);
addChild(this.graphic);
addChild(this.text);
this.graphic.x = -this.graphic.width - 8;
this.graphic.y = -this.graphic.height / 2 - 6;
this.text.textChanged.add(this.onTextChanged);
}
public function setGold(_arg_1:int):void {
this.text.setStringBuilder(new StaticStringBuilder(String(_arg_1)));
}
private function onTextChanged():void {
this.text.x = this.graphic.x - this.text.width + 4;
this.text.y = -this.text.height / 2 - 6;
}
}
}
|
/////////////////////////////////////////////////////////////////////////////////////
//
// Simplified BSD License
// ======================
//
// Copyright 2013-2014 Pascal ECHEMANN. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those
// of the authors and should not be interpreted as representing official policies,
// either expressed or implied, of the copyright holders.
//
/////////////////////////////////////////////////////////////////////////////////////
package hummingbird.testSuiteStarling {
// -----------------------------------------------------------
// HummingbirdStarlingSuite.as
// -----------------------------------------------------------
/**
* @author Pascal ECHEMANN
* @version 1.0.1, 16/03/2014 17:067
* @see http://www.flashapi.org/
*/
import hummingbird.testSuiteStarling.cases.AdaptersStarlingTestCase;
import hummingbird.testSuiteStarling.cases.ApplicationContextStarlingTestCase;
import hummingbird.testSuiteStarling.cases.ComponentsStarlingTestCase;
import hummingbird.testSuiteStarling.cases.ViewsManagmentStarlingTestCase;
/**
* The <code>HummingbirdStarlingSuite</code> class represents the test suite for
* the Starling Hummingbird Framework.
*/
[Suite (order="4")]
[RunWith("org.flexunit.runners.Suite")]
public class HummingbirdStarlingSuite {
//--------------------------------------------------------------------------
//
// Public properties
//
//--------------------------------------------------------------------------
/**
* The test case for the Starling Hummingbird Framework application context
* managment.
*/
public var test1:ApplicationContextStarlingTestCase;
/**
* The test case for the Starling Hummingbird Framework components.
*/
public var test2:ComponentsStarlingTestCase;
/**
* The test case for the Starling Hummingbird Framework views managment.
*/
public var test3:ViewsManagmentStarlingTestCase;
/**
* The test case for the Starling Hummingbird Framework views adptation.
*/
public var test4:AdaptersStarlingTestCase;
}
} |
package Mobile.ScrollList
{
import flash.events.Event;
import flash.utils.getQualifiedClassName;
public class EventWithParams extends Event
{
public var params:Object;
public function EventWithParams(param1:String, param2:Object = null, param3:Boolean = false, param4:Boolean = false)
{
// method body index: 199 method index: 199
super(param1,param3,param4);
this.params = param2;
}
override public function clone() : Event
{
// method body index: 200 method index: 200
return new EventWithParams(type,this.params,bubbles,cancelable);
}
override public function toString() : String
{
// method body index: 201 method index: 201
return formatToString(getQualifiedClassName(this),"type","bubbles","cancelable","eventPhase","params");
}
}
}
|
/*
* Copyright (c) 2009 the original author or authors
*
* Permission is hereby granted to use, modify, and distribute this file
* in accordance with the terms of the license agreement accompanying it.
*/
package org.robotlegs.starling.core
{
import starling.events.EventDispatcher;
/**
* The Robotlegs Context contract
*/
public interface IContext
{
/**
* The <code>IContext</code>'s <code>EventDispatcher</code>
*/
function get eventDispatcher():EventDispatcher;
}
} |
/**
* ColorMatrix class, which provides special color properties
* called "_contrast", "_brightness", "_saturation"
* using Tweener AS3 (http://code.google.com/p/tweener/).
*
* Based on Mario Klingemanns awesome AS2 ColorMatrix v1.2
* (http://www.quasimondo.com/archives/000565.php)
*
* @author Jens Krause [www.websector.de]
* @date 08/28/07
* @see http://www.websector.de/blog/2007/08/28/tweener-as3-extension-for-color-properties-_brightness-_contrast-and-_saturation/
*
*/
package caurina.transitions
{
import flash.filters.ColorMatrixFilter;
public class ColorMatrix
{
//
// Luminance conversion constants
private static const R_LUM:Number = 0.212671;
private static const G_LUM:Number = 0.715160;
private static const B_LUM: Number = 0.072169;
//
// min / max values for special tween properties called "_contrast"
private static const MIN_CONTRAST: Number = -200;
private static const MAX_CONTRAST: Number = 500;
private static const STANDARD_CONTRAST: Number = 0;
//
// min / max values for special tween properties called "_brightness"
private static const MIN_BRIGHTNESS: Number = -100;
private static const MAX_BRIGHTNESS: Number = 100;
private static const STANDARD_BRIGHTNESS: Number = 0;
//
// min / max values for special tween properties called "_saturation"
private static const MIN_SATURATION: Number = -300;
private static const MAX_SATURATION: Number = 300;
private static const STANDARD_SATURATION: Number = 100;
//
// standard matrix
private static const IDENTITY:Array = [ 1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,1,0 ];
//
// matrix
public var matrix:Array;
/**
* Constructor of ColorMatrix
*
* @param mat Object A ColorMatrix instance or an array
*
*/
function ColorMatrix (mat:Object = null)
{
if (mat is ColorMatrix)
{
matrix = mat.matrix.concat();
}
else if (mat is Array)
{
matrix = mat.concat();
}
else
{
reset();
}
}
/**
* Resets the matrix to its IDENTITY
*
*/
public function reset():void
{
matrix = IDENTITY.concat();
}
/**
* Clones the instance of ColorMatrix
*
*/
public function clone():ColorMatrix
{
return new ColorMatrix( matrix );
}
///////////////////////////////////////////////////////////
// brightness
///////////////////////////////////////////////////////////
/**
* Calculate an average of particular indexes of its matrix
*
* @return Number Value of a brightness value for using Tweener
*
*/
public function getBrightness (): Number
{
// average of "brightness"-indexes within matrix
var value: Number = (matrix[4] + matrix[9] + matrix[14]) / 3;
// convert back to a "valid" tween property between min and max values
if (value != 0) value = value * 100 / 255;
return Math.round(value);
}
/**
* Changes matrix to alter brightness
*
* @param Number Value of Tweeners brightness property
*
*/
public function setBrightness (value: Number):void
{
var brightness: Number = checkValue(MIN_BRIGHTNESS, MAX_BRIGHTNESS, value);
// converts tween property to a valid value for the matrix
brightness = 255 * brightness / 100;
var mat:Array = [ 1,0,0,0, brightness,
0,1,0,0, brightness,
0,0,1,0, brightness,
0,0,0,1, 0 ];
concat(mat);
}
///////////////////////////////////////////////////////////
// contrast
///////////////////////////////////////////////////////////
/**
* Calculate an average of particular indexes of its matrix
*
* @return Number Value of a contrast value for using Tweener
*
*/
public function getContrast (): Number
{
// average of "contrast"-indexes within matrix
var value: Number = (matrix[0] + matrix[6] + matrix[12]) / 3;
// converts back to a "valid" tween property between min and max values
value = (value - 1) * 100;
return value;
}
/**
* Changes matrix to alter contrast
*
* @param Number Value of Tweeners brightness property
*
*/
public function setContrast (value: Number):void
{
var contrast: Number = checkValue(MIN_CONTRAST, MAX_CONTRAST, value);
// convert tween property to a valid value for the matrix
contrast /= 100;
var scale: Number = contrast + 1;
var offset : Number = 128 * (1 - scale);
var mat: Array = [ scale, 0, 0, 0, offset,
0, scale, 0, 0, offset,
0, 0, scale, 0, offset,
0, 0, 0, 1, 0 ];
concat(mat);
}
///////////////////////////////////////////////////////////
// saturation
///////////////////////////////////////////////////////////
/**
* Calculate an average of particular indexes of its matrix
*
* @return Number Value of a saturation value for using Tweener
*
*/
public function getSaturation (): Number
{
//
// uses 3 "saturation"-indexes within matrix - once per color channel - ignore the others...
var s1: Number = 1 - matrix[1] / G_LUM;
var s2: Number = 1 - matrix[2] / B_LUM;
var s5: Number = 1 - matrix[5] / R_LUM;
// average of these "saturation"-indexes
var value: Number;
value = Math.round((s1 + s2 + s5) / 3);
value *= 100;
return value;
}
/**
* Changes matrix to alter contrast
*
* @param Number Value of Tweeners saturation property
*
*/
public function setSaturation (value: Number): void
{
var saturation: Number = checkValue(MIN_SATURATION, MAX_SATURATION, value);
saturation /= 100;
var isValue: Number = 1-saturation;
var irlum: Number = isValue * R_LUM;
var iglum: Number = isValue * G_LUM;
var iblum: Number = isValue * B_LUM;
var mat:Array = [ irlum + saturation, iglum, iblum, 0, 0,
irlum, iglum + saturation, iblum, 0, 0,
irlum, iglum, iblum + saturation, 0, 0,
0, 0, 0, 1, 0 ];
concat(mat);
}
/**
* Concatenates the elements of a matrix specified in the parameter with the elements in an array and creates a new matrix
*
* @param Array Altered Matrix
*
*/
public function concat(mat:Array):void
{
var temp:Array = new Array ();
var i:Number = 0;
for (var y:Number = 0; y < 4; y++ )
{
for (var x:Number = 0; x < 5; x++ )
{
temp[i + x] = mat[i] * matrix[x] +
mat[i+1] * matrix[x + 5] +
mat[i+2] * matrix[x + 10] +
mat[i+3] * matrix[x + 15] +
(x == 4 ? mat[i+4] : 0);
}
i+=5;
}
matrix = temp;
}
/**
* Instanciates a ColorMatrixFilter using ColorMatrix matrix
*
* @return ColorMatrixFilter ColorMatrixFilter using the matrix of a ColorMatrix instance
*
*/
public function get filter():ColorMatrixFilter
{
return new ColorMatrixFilter(matrix);
}
/**
* Helper method to check a value for min. and max. values within a specified range
*
* @param Number min. value of its range
* @param Number max. value of its range
* @param Number checked value
*/
private function checkValue(minValue: Number, maxValue: Number, value: Number):Number
{
return Math.min(maxValue, Math.max(minValue, value));
}
}
} |
class dummy
{
int x;
dummy(int new_x)
{
x=new_x;
}
}
void alert(const string &in, const string &in) {}
void main()
{
alert('Result', '' + bad.x + '');
dummy bad(15);
alert('Result', '' + bad.x + '');
}
|
class ClassA
{
public function test() : void
{
trace("A");
}
}
class ClassB extends ClassA
{
public override function test() : void
{
trace("B");
super.test();
}
}
var b = new ClassB();
b.test();
|
package stateTypes {
/**
* ...
* @author notSafeForDev
*/
public class BooleanState extends State {
public function BooleanState(_defaultValue : Boolean) {
super(_defaultValue, BooleanStateReference);
}
public function getValue() : Boolean {
return value;
}
public function setValue(_value : Boolean) : void {
changeValue(_value);
}
}
} |
/*
* Copyright 2010-2011 Research In Motion Limited.
*
* 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 webworks.access {
import webworks.config.ConfigConstants;
public class Access {
//-------------------------------------
// properties
//-------------------------------------
private var _uri:String;
private var _allowSubDomain:Boolean;
private var _features:Array;
private var _isLocal:Boolean;
public function Access(uri:String, allowSubDomain:Boolean, features:Array)
{
super();
_allowSubDomain = allowSubDomain;
_features = features;
if (uri == ConfigConstants.WIDGET_LOCAL_DOMAIN) {
_isLocal = true;
_uri = "";
} else {
_isLocal = false;
_uri = uri;
}
}
//-----------------------------------------------------------------------------
//
// Methods
//
//-----------------------------------------------------------------------------
public function getURI():String {
return _uri;
}
public function allowSubDomain():Boolean {
return _allowSubDomain;
}
public function getFeatures():Array {
return _features;
}
public function isLocal():Boolean {
return _isLocal;
}
}
}
|
package test {
public class ASCompleteTest {
public function ASCompleteTest() {
[].$(EntryPoint)
}
}
} |
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.adobe.serialization.json {
public class JSONToken {
private var _type:int;
private var _value:Object;
/**
* Creates a new JSONToken with a specific token type and value.
*
* @param type The JSONTokenType of the token
* @param value The value of the token
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
_type = type;
_value = value;
}
/**
* Returns the type of the token.
*
* @see com.adobe.serialization.json.JSONTokenType
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function get type():int {
return _type;
}
/**
* Sets the type of the token.
*
* @see com.adobe.serialization.json.JSONTokenType
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function set type( value:int ):void {
_type = value;
}
/**
* Gets the value of the token
*
* @see com.adobe.serialization.json.JSONTokenType
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function get value():Object {
return _value;
}
/**
* Sets the value of the token
*
* @see com.adobe.serialization.json.JSONTokenType
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function set value ( v:Object ):void {
_value = v;
}
}
}
|
dynamic class gfx.data.DataProvider extends Array
{
var isDataProvider: Boolean = true;
var cleanUpEvents;
var dispatchEvent;
var length;
var slice;
var splice;
function DataProvider(total)
{
super();
gfx.events.EventDispatcher.initialize(this);
}
static function initialize(data)
{
if (gfx.data.DataProvider.instance == undefined)
{
gfx.data.DataProvider.instance = new gfx.data.DataProvider();
}
var __reg3 = ["indexOf", "requestItemAt", "requestItemRange", "invalidate", "toString", "cleanUp", "isDataProvider"];
var __reg2 = 0;
while (__reg2 < __reg3.length)
{
data[__reg3[__reg2]] = gfx.data.DataProvider.instance[__reg3[__reg2]];
++__reg2;
}
gfx.events.EventDispatcher.initialize(data);
_global.ASSetPropFlags(data, __reg3, 1);
_global.ASSetPropFlags(data, "addEventListener,removeEventListener,hasEventListener,removeAllEventListeners,dispatchEvent,dispatchQueue,cleanUpEvents", 1);
}
function indexOf(value, scope, callBack)
{
var __reg2 = 0;
__reg2 = 0;
while (__reg2 < this.length)
{
if (this[__reg2] == value)
{
break;
}
++__reg2;
}
var __reg4 = __reg2 == this.length ? -1 : __reg2;
if (callBack)
{
scope[callBack].call(scope, __reg4);
}
return __reg4;
}
function requestItemAt(index, scope, callBack)
{
var __reg2 = this[index];
if (callBack)
{
scope[callBack].call(scope, __reg2);
}
return __reg2;
}
function requestItemRange(startIndex, endIndex, scope, callBack)
{
var __reg2 = this.slice(startIndex, endIndex + 1);
if (callBack)
{
scope[callBack].call(scope, __reg2);
}
return __reg2;
}
function invalidate(length)
{
this.dispatchEvent({type: "change"});
}
function cleanUp()
{
this.splice(0, this.length);
this.cleanUpEvents();
}
function toString()
{
return "[DataProvider (" + this.length + ")]";
}
}
|
/*
Particles builder: Alpha
*/
package bitfade.intros.particles.builders {
public class Alpha {
import flash.display.*
import flash.geom.*
import bitfade.easing.*
public static function build(minPSize:uint = 2,maxPSize:uint = 64,pRangeMax:uint = 32,maxAlpha:Number = 1,solid:Boolean = false,color:uint = 0):Vector.<BitmapData> {
var half:uint = pRangeMax >> 1
var pGfx:Vector.<BitmapData> = new Vector.<BitmapData>(pRangeMax+1,true)
var circle:Shape = new Shape();
var cg:Graphics = circle.graphics
var gradM = new Matrix();
var ps:uint
var alpha:Number = 0
var ratio:Number
for (var idx:uint = 0;idx<=pRangeMax;idx++) {
ps = uint(bitfade.easing.Cubic.In(idx,minPSize,maxPSize-minPSize,pRangeMax))
pGfx[idx] = new BitmapData(ps,ps,true,0x000000);
gradM.createGradientBox(ps,ps,0,0,0);
if (idx < half) {
alpha = 0.3+0.7*(idx/half)
} else {
alpha = 0.1+0.9*(pRangeMax-idx)/half
}
alpha *= maxAlpha
ratio = uint(bitfade.easing.Quad.Out(idx,255,-254,pRangeMax))
if (solid) ratio = 255
cg.clear()
cg.lineStyle(1,0,0);
cg.beginGradientFill(
GradientType.RADIAL,
[color,color,color],
[alpha,alpha,0],
[0,ratio,255],
gradM,
SpreadMethod.PAD
);
cg.drawCircle(ps/2,ps/2,ps/2)
cg.endFill()
pGfx[idx].draw(circle,null,null,null,pGfx[idx].rect)
}
return pGfx
}
}
} |
package visuals.ui.dialogs
{
import com.playata.framework.display.Sprite;
import com.playata.framework.display.lib.flash.FlashDisplayObjectContainer;
import com.playata.framework.display.lib.flash.FlashLabel;
import com.playata.framework.display.lib.flash.FlashLabelArea;
import com.playata.framework.display.lib.flash.FlashSprite;
import com.playata.framework.display.lib.flash.FlashTextInput;
import com.playata.framework.display.ui.controls.ILabel;
import com.playata.framework.display.ui.controls.ILabelArea;
import com.playata.framework.display.ui.controls.ITextInput;
import flash.display.MovieClip;
import visuals.ui.base.SymbolUiButtonDefaultGeneric;
import visuals.ui.base.SymbolUiCheckboxGeneric;
import visuals.ui.elements.backgrounds.SymbolSlice9BackgroundDialogGeneric;
import visuals.ui.elements.buttons.SymbolButtonCloseGeneric;
import visuals.ui.elements.generic.SymbolTextfieldBackgroundWideGeneric;
public class SymbolDialogDeleteAccountGeneric extends Sprite
{
private var _nativeObject:SymbolDialogDeleteAccount = null;
public var dialogBackground:SymbolSlice9BackgroundDialogGeneric = null;
public var textfieldBackground:SymbolTextfieldBackgroundWideGeneric = null;
public var txtDialogTitle:ILabel = null;
public var btnClose:SymbolButtonCloseGeneric = null;
public var inputPassword:ITextInput = null;
public var txtPasswordCaption:ILabel = null;
public var txtInfo:ILabelArea = null;
public var txtReactivationInfo:ILabelArea = null;
public var ckbReactivationCode:SymbolUiCheckboxGeneric = null;
public var btnDelete:SymbolUiButtonDefaultGeneric = null;
public function SymbolDialogDeleteAccountGeneric(param1:MovieClip = null)
{
if(param1)
{
_nativeObject = param1 as SymbolDialogDeleteAccount;
}
else
{
_nativeObject = new SymbolDialogDeleteAccount();
}
super(null,FlashSprite.fromNative(_nativeObject));
var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer;
dialogBackground = new SymbolSlice9BackgroundDialogGeneric(_nativeObject.dialogBackground);
textfieldBackground = new SymbolTextfieldBackgroundWideGeneric(_nativeObject.textfieldBackground);
txtDialogTitle = FlashLabel.fromNative(_nativeObject.txtDialogTitle);
btnClose = new SymbolButtonCloseGeneric(_nativeObject.btnClose);
inputPassword = FlashTextInput.fromNative(_nativeObject.inputPassword);
txtPasswordCaption = FlashLabel.fromNative(_nativeObject.txtPasswordCaption);
txtInfo = FlashLabelArea.fromNative(_nativeObject.txtInfo);
txtReactivationInfo = FlashLabelArea.fromNative(_nativeObject.txtReactivationInfo);
ckbReactivationCode = new SymbolUiCheckboxGeneric(_nativeObject.ckbReactivationCode);
btnDelete = new SymbolUiButtonDefaultGeneric(_nativeObject.btnDelete);
}
public function setNativeInstance(param1:SymbolDialogDeleteAccount) : void
{
FlashSprite.setNativeInstance(_sprite,param1);
_nativeObject = param1;
syncInstances();
}
public function syncInstances() : void
{
if(_nativeObject.dialogBackground)
{
dialogBackground.setNativeInstance(_nativeObject.dialogBackground);
}
if(_nativeObject.textfieldBackground)
{
textfieldBackground.setNativeInstance(_nativeObject.textfieldBackground);
}
FlashLabel.setNativeInstance(txtDialogTitle,_nativeObject.txtDialogTitle);
if(_nativeObject.btnClose)
{
btnClose.setNativeInstance(_nativeObject.btnClose);
}
FlashTextInput.setNativeInstance(inputPassword,_nativeObject.inputPassword);
FlashLabel.setNativeInstance(txtPasswordCaption,_nativeObject.txtPasswordCaption);
FlashLabelArea.setNativeInstance(txtInfo,_nativeObject.txtInfo);
FlashLabelArea.setNativeInstance(txtReactivationInfo,_nativeObject.txtReactivationInfo);
if(_nativeObject.ckbReactivationCode)
{
ckbReactivationCode.setNativeInstance(_nativeObject.ckbReactivationCode);
}
if(_nativeObject.btnDelete)
{
btnDelete.setNativeInstance(_nativeObject.btnDelete);
}
}
}
}
|
package com.ankamagames.dofus.network.messages.game.context.roleplay.breach.meeting
{
import com.ankamagames.dofus.network.types.game.character.CharacterMinimalInformations;
import com.ankamagames.jerakine.network.CustomDataWrapper;
import com.ankamagames.jerakine.network.ICustomDataInput;
import com.ankamagames.jerakine.network.ICustomDataOutput;
import com.ankamagames.jerakine.network.INetworkMessage;
import com.ankamagames.jerakine.network.NetworkMessage;
import com.ankamagames.jerakine.network.utils.FuncTree;
import flash.utils.ByteArray;
public class BreachKickResponseMessage extends NetworkMessage implements INetworkMessage
{
public static const protocolId:uint = 5114;
private var _isInitialized:Boolean = false;
public var target:CharacterMinimalInformations;
public var kicked:Boolean = false;
private var _targettree:FuncTree;
public function BreachKickResponseMessage()
{
this.target = new CharacterMinimalInformations();
super();
}
override public function get isInitialized() : Boolean
{
return this._isInitialized;
}
override public function getMessageId() : uint
{
return 5114;
}
public function initBreachKickResponseMessage(target:CharacterMinimalInformations = null, kicked:Boolean = false) : BreachKickResponseMessage
{
this.target = target;
this.kicked = kicked;
this._isInitialized = true;
return this;
}
override public function reset() : void
{
this.target = new CharacterMinimalInformations();
this._isInitialized = false;
}
override public function pack(output:ICustomDataOutput) : void
{
var data:ByteArray = new ByteArray();
this.serialize(new CustomDataWrapper(data));
writePacket(output,this.getMessageId(),data);
}
override public function unpack(input:ICustomDataInput, length:uint) : void
{
this.deserialize(input);
}
override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree
{
var tree:FuncTree = new FuncTree();
tree.setRoot(input);
this.deserializeAsync(tree);
return tree;
}
public function serialize(output:ICustomDataOutput) : void
{
this.serializeAs_BreachKickResponseMessage(output);
}
public function serializeAs_BreachKickResponseMessage(output:ICustomDataOutput) : void
{
this.target.serializeAs_CharacterMinimalInformations(output);
output.writeBoolean(this.kicked);
}
public function deserialize(input:ICustomDataInput) : void
{
this.deserializeAs_BreachKickResponseMessage(input);
}
public function deserializeAs_BreachKickResponseMessage(input:ICustomDataInput) : void
{
this.target = new CharacterMinimalInformations();
this.target.deserialize(input);
this._kickedFunc(input);
}
public function deserializeAsync(tree:FuncTree) : void
{
this.deserializeAsyncAs_BreachKickResponseMessage(tree);
}
public function deserializeAsyncAs_BreachKickResponseMessage(tree:FuncTree) : void
{
this._targettree = tree.addChild(this._targettreeFunc);
tree.addChild(this._kickedFunc);
}
private function _targettreeFunc(input:ICustomDataInput) : void
{
this.target = new CharacterMinimalInformations();
this.target.deserializeAsync(this._targettree);
}
private function _kickedFunc(input:ICustomDataInput) : void
{
this.kicked = input.readBoolean();
}
}
}
|
package common
{
import flash.geom.Vector3D;
import object.RGameEnt;
public class ROBJECTINFO
{
public var m_ObjectID:int;
public var m_ObjectType:int;
public var m_CurrLoc:Vector3D;
public var m_CurrPose:Vector3D;
public var m_CurrState:int;
public var m_ParentObject:RGameEnt;
public var m_ObjectProperty:int;
public var m_userId:int;
public var m_reserve:int;
public function ROBJECTINFO()
{
super();
this.m_CurrLoc = new Vector3D(0,0,0);
this.m_CurrPose = new Vector3D(0,0,0);
this.m_ParentObject = null;
}
}
}
|
// Action script...
// [Initial MovieClip Action of sprite 20529]
#initclip 50
if (!dofus.graphics.gapi.ui.DocumentRoadSign)
{
if (!dofus)
{
_global.dofus = new Object();
} // end if
if (!dofus.graphics)
{
_global.dofus.graphics = new Object();
} // end if
if (!dofus.graphics.gapi)
{
_global.dofus.graphics.gapi = new Object();
} // end if
if (!dofus.graphics.gapi.ui)
{
_global.dofus.graphics.gapi.ui = new Object();
} // end if
var _loc1 = (_global.dofus.graphics.gapi.ui.DocumentRoadSign = function ()
{
super();
}).prototype;
_loc1.__set__document = function (oDoc)
{
this._oDoc = oDoc;
//return (this.document());
};
_loc1.init = function ()
{
super.init(false, dofus.graphics.gapi.ui.DocumentRoadSign.CLASS_NAME);
};
_loc1.callClose = function ()
{
this.api.network.Documents.leave();
return (true);
};
_loc1.createChildren = function ()
{
this._txtCore.wordWrap = true;
this._txtCore.multiline = true;
this._txtCore.embedFonts = true;
this.addToQueue({object: this, method: this.addListeners});
this.addToQueue({object: this, method: this.updateData});
this._mcSmall._visible = false;
};
_loc1.addListeners = function ()
{
this._btnClose.addEventListener("click", this);
this._bgHidder.addEventListener("click", this);
};
_loc1.updateData = function ()
{
this.setCssStyle(this._oDoc.getPage(0).cssFile);
if (this._lblTitle.text == undefined)
{
return;
} // end if
if (this._oDoc.title.substr(0, 2) == "//")
{
this._mcSmall._visible = false;
this._lblTitle.text = "";
}
else
{
this._mcSmall._visible = true;
this._lblTitle.text = this._oDoc.title;
} // end else if
};
_loc1.setCssStyle = function (sCssFile)
{
var _loc3 = new TextField.StyleSheet();
_loc3.owner = this;
_loc3.onLoad = function ()
{
this.owner.layoutContent(this);
};
_loc3.load(sCssFile);
};
_loc1.layoutContent = function (ssStyle)
{
this._txtCore.styleSheet = ssStyle;
this._txtCore.htmlText = this._oDoc.getPage(0).text;
};
_loc1.click = function (oEvent)
{
switch (oEvent.target._name)
{
case "_bgHidder":
case "_btnClose":
{
this.callClose();
break;
}
} // End of switch
};
_loc1.addProperty("document", function ()
{
}, _loc1.__set__document);
ASSetPropFlags(_loc1, null, 1);
(_global.dofus.graphics.gapi.ui.DocumentRoadSign = function ()
{
super();
}).CLASS_NAME = "DocumentRoadSign";
} // end if
#endinitclip
|
/**
* VERSION: 1.84
* DATE: 2011-03-23
* AS3
* UPDATES AND DOCS AT: http://www.greensock.com/loadermax/
**/
package com.greensock.loading {
import com.greensock.loading.core.LoaderItem;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLLoader;
/** Dispatched when the loader's <code>httpStatus</code> value changes. **/
[Event(name="httpStatus", type="com.greensock.events.LoaderEvent")]
/** Dispatched when the loader experiences a SECURITY_ERROR while loading or auditing its size. **/
[Event(name="securityError", type="com.greensock.events.LoaderEvent")]
/**
* Loads generic data which can be text (the default), binary data, or URL-encoded variables. <br /><br />
*
* If the <code>format</code> vars property is "text", the <code>content</code> will be a String containing the text of the loaded file.<br /><br />
* If the <code>format</code> vars property is "binary", the <code>content</code> will be a <code>ByteArray</code> object containing the raw binary data. (See also: BinaryDataLoader)<br /><br />
* If the <code>format</code> vars property is "variables", the <code>content</code> will be a <code>URLVariables</code> object containing the URL-encoded variables<br /><br />
*
* <strong>OPTIONAL VARS PROPERTIES</strong><br />
* The following special properties can be passed into the DataLoader constructor via its <code>vars</code>
* parameter which can be either a generic object or a <code><a href="data/DataLoaderVars.html">DataLoaderVars</a></code> object:<br />
* <ul>
* <li><strong> name : String</strong> - A name that is used to identify the loader instance. This name can be fed to the <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> methods or traced at any time. Each loader's name should be unique. If you don't define one, a unique name will be created automatically, like "loader21".</li>
* <li><strong> format : String</strong> - Controls whether the downloaded data is received as text (<code>"text"</code>), raw binary data (<code>"binary"</code>), or URL-encoded variables (<code>"variables"</code>). </li>
* <li><strong> alternateURL : String</strong> - If you define an <code>alternateURL</code>, the loader will initially try to load from its original <code>url</code> and if it fails, it will automatically (and permanently) change the loader's <code>url</code> to the <code>alternateURL</code> and try again. Think of it as a fallback or backup <code>url</code>. It is perfectly acceptable to use the same <code>alternateURL</code> for multiple loaders (maybe a default image for various ImageLoaders for example).</li>
* <li><strong> noCache : Boolean</strong> - If <code>true</code>, a "gsCacheBusterID" parameter will be appended to the url with a random set of numbers to prevent caching (don't worry, this info is ignored when you <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> by <code>url</code> or when you're running locally)</li>
* <li><strong> estimatedBytes : uint</strong> - Initially, the loader's <code>bytesTotal</code> is set to the <code>estimatedBytes</code> value (or <code>LoaderMax.defaultEstimatedBytes</code> if one isn't defined). Then, when the loader begins loading and it can accurately determine the bytesTotal, it will do so. Setting <code>estimatedBytes</code> is optional, but the more accurate the value, the more accurate your loaders' overall progress will be initially. If the loader is inserted into a LoaderMax instance (for queue management), its <code>auditSize</code> feature can attempt to automatically determine the <code>bytesTotal</code> at runtime (there is a slight performance penalty for this, however - see LoaderMax's documentation for details).</li>
* <li><strong> requireWithRoot : DisplayObject</strong> - LoaderMax supports <i>subloading</i>, where an object can be factored into a parent's loading progress. If you want LoaderMax to require this DataLoader as part of its parent SWFLoader's progress, you must set the <code>requireWithRoot</code> property to your swf's <code>root</code>. For example, <code>var loader:DataLoader = new DataLoader("text.txt", {name:"myText", requireWithRoot:this.root});</code></li>
* <li><strong> allowMalformedURL : Boolean</strong> - Normally, the URL will be parsed and any variables in the query string (like "?name=test&state=il&gender=m") will be placed into a URLVariables object which is added to the URLRequest. This avoids a few bugs in Flash, but if you need to keep the entire URL intact (no parsing into URLVariables), set <code>allowMalformedURL:true</code>. For example, if your URL has duplicate variables in the query string like <code>http://www.greensock.com/?c=S&c=SE&c=SW</code>, it is technically considered a malformed URL and a URLVariables object can't properly contain all the duplicates, so in this case you'd want to set <code>allowMalformedURL</code> to <code>true</code>.</li>
* <li><strong> autoDispose : Boolean</strong> - When <code>autoDispose</code> is <code>true</code>, the loader will be disposed immediately after it completes (it calls the <code>dispose()</code> method internally after dispatching its <code>COMPLETE</code> event). This will remove any listeners that were defined in the vars object (like onComplete, onProgress, onError, onInit). Once a loader is disposed, it can no longer be found with <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> - it is essentially destroyed but its content is not unloaded (you must call <code>unload()</code> or <code>dispose(true)</code> to unload its content). The default <code>autoDispose</code> value is <code>false</code>.
*
* <br /><br />----EVENT HANDLER SHORTCUTS----</li>
* <li><strong> onOpen : Function</strong> - A handler function for <code>LoaderEvent.OPEN</code> events which are dispatched when the loader begins loading. Make sure your onOpen function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onProgress : Function</strong> - A handler function for <code>LoaderEvent.PROGRESS</code> events which are dispatched whenever the <code>bytesLoaded</code> changes. Make sure your onProgress function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). You can use the LoaderEvent's <code>target.progress</code> to get the loader's progress value or use its <code>target.bytesLoaded</code> and <code>target.bytesTotal</code>.</li>
* <li><strong> onComplete : Function</strong> - A handler function for <code>LoaderEvent.COMPLETE</code> events which are dispatched when the loader has finished loading successfully. Make sure your onComplete function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onCancel : Function</strong> - A handler function for <code>LoaderEvent.CANCEL</code> events which are dispatched when loading is aborted due to either a failure or because another loader was prioritized or <code>cancel()</code> was manually called. Make sure your onCancel function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onError : Function</strong> - A handler function for <code>LoaderEvent.ERROR</code> events which are dispatched whenever the loader experiences an error (typically an IO_ERROR or SECURITY_ERROR). An error doesn't necessarily mean the loader failed, however - to listen for when a loader fails, use the <code>onFail</code> special property. Make sure your onError function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onFail : Function</strong> - A handler function for <code>LoaderEvent.FAIL</code> events which are dispatched whenever the loader fails and its <code>status</code> changes to <code>LoaderStatus.FAILED</code>. Make sure your onFail function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onIOError : Function</strong> - A handler function for <code>LoaderEvent.IO_ERROR</code> events which will also call the onError handler, so you can use that as more of a catch-all whereas <code>onIOError</code> is specifically for LoaderEvent.IO_ERROR events. Make sure your onIOError function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onHTTPStatus : Function</strong> - A handler function for <code>LoaderEvent.HTTP_STATUS</code> events. Make sure your onHTTPStatus function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). You can determine the httpStatus code using the LoaderEvent's <code>target.httpStatus</code> (LoaderItems keep track of their <code>httpStatus</code> when possible, although certain environments prevent Flash from getting httpStatus information).</li>
* </ul><br />
*
* <strong>Note:</strong> Using a <code><a href="data/DataLoaderVars.html">DataLoaderVars</a></code> instance
* instead of a generic object to define your <code>vars</code> is a bit more verbose but provides
* code hinting and improved debugging because it enforces strict data typing. Use whichever one you prefer.<br /><br />
*
* @example Example AS3 code:<listing version="3.0">
import com.greensock.loading.~~;
import com.greensock.events.LoaderEvent;
import flash.utils.ByteArray;
import flash.net.URLVariables;
//create a DataLoader for loading text (the default format)
var loader:DataLoader = new DataLoader("assets/data.txt", {name:"myText", requireWithRoot:this.root, estimatedBytes:900});
//start loading
loader.load();
//Or you could put the DataLoader into a LoaderMax. Create one first...
var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
//append the DataLoader and several other loaders
queue.append( loader );
queue.append( new DataLoader("assets/variables.txt", {name:"myVariables", format:"variables"}) );
queue.append( new DataLoader("assets/image1.png", {name:"myBinary", format:"binary", estimatedBytes:3500}) );
//start loading the LoaderMax queue
queue.load();
function progressHandler(event:LoaderEvent):void {
trace("progress: " + event.target.progress);
}
function completeHandler(event:LoaderEvent):void {
var text:String = LoaderMax.getContent("myText");
var variables:URLVariables = LoaderMax.getContent("myVariables");
var binary:ByteArray = LoaderMax.getContent("myBinary");
trace("complete. myText: " + text + ", myVariables.var1: " + variables.var1 + ", myBinary.length: " + binary.length);
}
function errorHandler(event:LoaderEvent):void {
trace("error occured with " + event.target + ": " + event.text);
}
</listing>
*
* <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.
*
* @see com.greensock.loading.data.DataLoaderVars
*
* @author Jack Doyle, jack@greensock.com
*/
public class DataLoader extends LoaderItem {
/** @private **/
private static var _classActivated:Boolean = _activateClass("DataLoader", DataLoader, "txt,js");
/** @private **/
protected var _loader:URLLoader;
/**
* Constructor
*
* @param urlOrRequest The url (<code>String</code>) or <code>URLRequest</code> from which the loader should get its content.
* @param vars An object containing optional configuration details. For example: <code>new DataLoader("text/data.txt", {name:"data", onComplete:completeHandler, onProgress:progressHandler})</code>.<br /><br />
*
* The following special properties can be passed into the constructor via the <code>vars</code> parameter
* which can be either a generic object or a <code><a href="data/DataLoaderVars.html">DataLoaderVars</a></code> object:<br />
* <ul>
* <li><strong> name : String</strong> - A name that is used to identify the loader instance. This name can be fed to the <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> methods or traced at any time. Each loader's name should be unique. If you don't define one, a unique name will be created automatically, like "loader21".</li>
* <li><strong> format : String</strong> - Controls whether the downloaded data is received as text (<code>"text"</code>), raw binary data (<code>"binary"</code>), or URL-encoded variables (<code>"variables"</code>). </li>
* <li><strong> alternateURL : String</strong> - If you define an <code>alternateURL</code>, the loader will initially try to load from its original <code>url</code> and if it fails, it will automatically (and permanently) change the loader's <code>url</code> to the <code>alternateURL</code> and try again. Think of it as a fallback or backup <code>url</code>. It is perfectly acceptable to use the same <code>alternateURL</code> for multiple loaders (maybe a default image for various ImageLoaders for example).</li>
* <li><strong> noCache : Boolean</strong> - If <code>true</code>, a "gsCacheBusterID" parameter will be appended to the url with a random set of numbers to prevent caching (don't worry, this info is ignored when you <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> by <code>url</code> or when you're running locally)</li>
* <li><strong> estimatedBytes : uint</strong> - Initially, the loader's <code>bytesTotal</code> is set to the <code>estimatedBytes</code> value (or <code>LoaderMax.defaultEstimatedBytes</code> if one isn't defined). Then, when the loader begins loading and it can accurately determine the bytesTotal, it will do so. Setting <code>estimatedBytes</code> is optional, but the more accurate the value, the more accurate your loaders' overall progress will be initially. If the loader is inserted into a LoaderMax instance (for queue management), its <code>auditSize</code> feature can attempt to automatically determine the <code>bytesTotal</code> at runtime (there is a slight performance penalty for this, however - see LoaderMax's documentation for details).</li>
* <li><strong> requireWithRoot : DisplayObject</strong> - LoaderMax supports <i>subloading</i>, where an object can be factored into a parent's loading progress. If you want LoaderMax to require this DataLoader as part of its parent SWFLoader's progress, you must set the <code>requireWithRoot</code> property to your swf's <code>root</code>. For example, <code>var loader:DataLoader = new DataLoader("text.txt", {name:"myText", requireWithRoot:this.root});</code></li>
* <li><strong> allowMalformedURL : Boolean</strong> - Normally, the URL will be parsed and any variables in the query string (like "?name=test&state=il&gender=m") will be placed into a URLVariables object which is added to the URLRequest. This avoids a few bugs in Flash, but if you need to keep the entire URL intact (no parsing into URLVariables), set <code>allowMalformedURL:true</code>. For example, if your URL has duplicate variables in the query string like <code>http://www.greensock.com/?c=S&c=SE&c=SW</code>, it is technically considered a malformed URL and a URLVariables object can't properly contain all the duplicates, so in this case you'd want to set <code>allowMalformedURL</code> to <code>true</code>.</li>
* <li><strong> autoDispose : Boolean</strong> - When <code>autoDispose</code> is <code>true</code>, the loader will be disposed immediately after it completes (it calls the <code>dispose()</code> method internally after dispatching its <code>COMPLETE</code> event). This will remove any listeners that were defined in the vars object (like onComplete, onProgress, onError, onInit). Once a loader is disposed, it can no longer be found with <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> - it is essentially destroyed but its content is not unloaded (you must call <code>unload()</code> or <code>dispose(true)</code> to unload its content). The default <code>autoDispose</code> value is <code>false</code>.
*
* <br /><br />----EVENT HANDLER SHORTCUTS----</li>
* <li><strong> onOpen : Function</strong> - A handler function for <code>LoaderEvent.OPEN</code> events which are dispatched when the loader begins loading. Make sure your onOpen function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onProgress : Function</strong> - A handler function for <code>LoaderEvent.PROGRESS</code> events which are dispatched whenever the <code>bytesLoaded</code> changes. Make sure your onProgress function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). You can use the LoaderEvent's <code>target.progress</code> to get the loader's progress value or use its <code>target.bytesLoaded</code> and <code>target.bytesTotal</code>.</li>
* <li><strong> onComplete : Function</strong> - A handler function for <code>LoaderEvent.COMPLETE</code> events which are dispatched when the loader has finished loading successfully. Make sure your onComplete function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onCancel : Function</strong> - A handler function for <code>LoaderEvent.CANCEL</code> events which are dispatched when loading is aborted due to either a failure or because another loader was prioritized or <code>cancel()</code> was manually called. Make sure your onCancel function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onError : Function</strong> - A handler function for <code>LoaderEvent.ERROR</code> events which are dispatched whenever the loader experiences an error (typically an IO_ERROR or SECURITY_ERROR). An error doesn't necessarily mean the loader failed, however - to listen for when a loader fails, use the <code>onFail</code> special property. Make sure your onError function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onFail : Function</strong> - A handler function for <code>LoaderEvent.FAIL</code> events which are dispatched whenever the loader fails and its <code>status</code> changes to <code>LoaderStatus.FAILED</code>. Make sure your onFail function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onIOError : Function</strong> - A handler function for <code>LoaderEvent.IO_ERROR</code> events which will also call the onError handler, so you can use that as more of a catch-all whereas <code>onIOError</code> is specifically for LoaderEvent.IO_ERROR events. Make sure your onIOError function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).</li>
* <li><strong> onHTTPStatus : Function</strong> - A handler function for <code>LoaderEvent.HTTP_STATUS</code> events. Make sure your onHTTPStatus function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). You can determine the httpStatus code using the LoaderEvent's <code>target.httpStatus</code> (LoaderItems keep track of their <code>httpStatus</code> when possible, although certain environments prevent Flash from getting httpStatus information).</li>
* </ul>
* @see com.greensock.loading.data.DataLoaderVars
*/
public function DataLoader(urlOrRequest:*, vars:Object=null) {
super(urlOrRequest, vars);
_type = "DataLoader";
_loader = new URLLoader(null);
if ("format" in this.vars) {
_loader.dataFormat = String(this.vars.format);
}
_loader.addEventListener(ProgressEvent.PROGRESS, _progressHandler, false, 0, true);
_loader.addEventListener(Event.COMPLETE, _receiveDataHandler, false, 0, true);
_loader.addEventListener("ioError", _failHandler, false, 0, true);
_loader.addEventListener("securityError", _failHandler, false, 0, true);
_loader.addEventListener("httpStatus", _httpStatusHandler, false, 0, true);
}
/** @private **/
override protected function _load():void {
_prepRequest();
_loader.load(_request);
}
/** @private scrubLevel: 0 = cancel, 1 = unload, 2 = dispose, 3 = flush **/
override protected function _dump(scrubLevel:int=0, newStatus:int=0, suppressEvents:Boolean=false):void {
if (_status == LoaderStatus.LOADING) {
try {
_loader.close();
} catch (error:Error) {
}
}
super._dump(scrubLevel, newStatus, suppressEvents);
}
//---- EVENT HANDLERS ------------------------------------------------------------------------------------
/** @private Don't use _completeHandler so that subclasses can set _content differently and still call super._completeHandler() (otherwise setting _content in the _completeHandler would always override the _content previously set in sublcasses). **/
protected function _receiveDataHandler(event:Event):void {
_content = _loader.data;
super._completeHandler(event);
}
//---- GETTERS / SETTERS -------------------------------------------------------------------------
}
} |
package org.openPyro.aurora.skinClasses{
import org.openPyro.core.UIControl;
import org.openPyro.painters.GradientFillPainter;
import org.openPyro.painters.Stroke;
public class GradientRectSkin extends UIControl
{
protected var _gradientRotation:Number = 0;
protected var gradientFill:GradientFillPainter;
public function GradientRectSkin(gradientFill:GradientFillPainter = null)
{
if(!gradientFill){
this.gradientFill = new GradientFillPainter([0x999999,0xdfdfdf],[.6,1],[1,255],_gradientRotation);
}
else{
this.gradientFill = gradientFill;
}
this.backgroundPainter = this.gradientFill;
}
public function set gradientRotation(r:Number):void
{
_gradientRotation = r;
gradientFill.rotation = _gradientRotation;
this.invalidateDisplayList();
}
protected var _stroke:Stroke = new Stroke(1,0x777777);
public function set stroke(str:Stroke):void{
_stroke = str;
gradientFill.stroke = str;
this.invalidateDisplayList();
}
public function get stroke():Stroke
{
return _stroke;
}
}
} |
package com.ankamagames.dofus.types.characteristicContextual
{
import com.ankamagames.berilia.types.event.BeriliaEvent;
import com.ankamagames.jerakine.entities.interfaces.IEntity;
import flash.display.Sprite;
public class CharacteristicContextual extends Sprite
{
private var _referedEntity:IEntity;
public var gameContext:uint;
public function CharacteristicContextual()
{
super();
mouseChildren = false;
mouseEnabled = false;
}
public function get referedEntity() : IEntity
{
return this._referedEntity;
}
public function set referedEntity(oEntity:IEntity) : void
{
this._referedEntity = oEntity;
}
public function remove() : void
{
dispatchEvent(new BeriliaEvent(BeriliaEvent.REMOVE_COMPONENT));
}
}
}
|
// Billboard example.
// This sample demonstrates:
// - Populating a 3D scene with billboard sets and several shadow casting spotlights
// - Parenting scene nodes to allow more intuitive creation of groups of objects
// - Examining rendering performance with a somewhat large object and light count
#include "Scripts/Utilities/Sample.as"
Scene@ scene_;
Node@ cameraNode;
float yaw = 0.0f;
float pitch = 0.0f;
bool drawDebug = false;
void Start()
{
// Execute the common startup for samples
SampleStart();
// Create the scene content
CreateScene();
// Create the UI content
CreateInstructions();
// Setup the viewport for displaying the scene
SetupViewport();
// Hook up to the frame update and render post-update events
SubscribeToEvents();
}
void CreateScene()
{
scene_ = Scene();
// Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
// Also create a DebugRenderer component so that we can draw debug geometry
scene_.CreateComponent("Octree");
scene_.CreateComponent("DebugRenderer");
// Create a Zone component for ambient lighting & fog control
Node@ zoneNode = scene_.CreateChild("Zone");
Zone@ zone = zoneNode.CreateComponent("Zone");
zone.boundingBox = BoundingBox(-1000.0f, 1000.0f);
zone.ambientColor = Color(0.1f, 0.1f, 0.1f);
zone.fogStart = 100.0f;
zone.fogEnd = 300.0f;
// Create a directional light without shadows
Node@ lightNode = scene_.CreateChild("DirectionalLight");
lightNode.direction = Vector3(0.5f, -1.0f, 0.5f);
Light@ light = lightNode.CreateComponent("Light");
light.lightType = LIGHT_DIRECTIONAL;
light.color = Color(0.2f, 0.2f, 0.2f);
light.specularIntensity = 1.0f;
// Create a "floor" consisting of several tiles
for (int y = -5; y <= 5; ++y)
{
for (int x = -5; x <= 5; ++x)
{
Node@ floorNode = scene_.CreateChild("FloorTile");
floorNode.position = Vector3(x * 20.5f, -0.5f, y * 20.5f);
floorNode.scale = Vector3(20.0f, 1.0f, 20.f);
StaticModel@ floorObject = floorNode.CreateComponent("StaticModel");
floorObject.model = cache.GetResource("Model", "Models/Box.mdl");
floorObject.material = cache.GetResource("Material", "Materials/Stone.xml");
}
}
// Create groups of mushrooms, which act as shadow casters
const uint NUM_MUSHROOMGROUPS = 25;
const uint NUM_MUSHROOMS = 25;
for (uint i = 0; i < NUM_MUSHROOMGROUPS; ++i)
{
// First create a scene node for the group. The individual mushrooms nodes will be created as children
Node@ groupNode = scene_.CreateChild("MushroomGroup");
groupNode.position = Vector3(Random(190.0f) - 95.0f, 0.0f, Random(190.0f) - 95.0f);
for (uint j = 0; j < NUM_MUSHROOMS; ++j)
{
Node@ mushroomNode = groupNode.CreateChild("Mushroom");
mushroomNode.position = Vector3(Random(25.0f) - 12.5f, 0.0f, Random(25.0f) - 12.5f);
mushroomNode.rotation = Quaternion(0.0f, Random() * 360.0f, 0.0f);
mushroomNode.SetScale(1.0f + Random() * 4.0f);
StaticModel@ mushroomObject = mushroomNode.CreateComponent("StaticModel");
mushroomObject.model = cache.GetResource("Model", "Models/Mushroom.mdl");
mushroomObject.material = cache.GetResource("Material", "Materials/Mushroom.xml");
mushroomObject.castShadows = true;
}
}
// Create billboard sets (floating smoke)
const uint NUM_BILLBOARDNODES = 25;
const uint NUM_BILLBOARDS = 10;
for (uint i = 0; i < NUM_BILLBOARDNODES; ++i)
{
Node@ smokeNode = scene_.CreateChild("Smoke");
smokeNode.position = Vector3(Random(200.0f) - 100.0f, Random(20.0f) + 10.0f, Random(200.0f) - 100.0f);
BillboardSet@ billboardObject = smokeNode.CreateComponent("BillboardSet");
billboardObject.numBillboards = NUM_BILLBOARDS;
billboardObject.material = cache.GetResource("Material", "Materials/LitSmoke.xml");
billboardObject.sorted = true;
for (uint j = 0; j < NUM_BILLBOARDS; ++j)
{
Billboard@ bb = billboardObject.billboards[j];
bb.position = Vector3(Random(12.0f) - 6.0f, Random(8.0f) - 4.0f, Random(12.0f) - 6.0f);
bb.size = Vector2(Random(2.0f) + 3.0f, Random(2.0f) + 3.0f);
bb.rotation = Random() * 360.0f;
bb.enabled = true;
}
// After modifying the billboards, they need to be "commited" so that the BillboardSet updates its internals
billboardObject.Commit();
}
// Create shadow casting spotlights
const uint NUM_LIGHTS = 9;
for (uint i = 0; i < NUM_LIGHTS; ++i)
{
Node@ lightNode = scene_.CreateChild("SpotLight");
Light@ light = lightNode.CreateComponent("Light");
float angle = 0.0f;
Vector3 position((i % 3) * 60.0f - 60.0f, 45.0f, (i / 3) * 60.0f - 60.0f);
Color color(((i + 1) & 1) * 0.5f + 0.5f, (((i + 1) >> 1) & 1) * 0.5f + 0.5f, (((i + 1) >> 2) & 1) * 0.5f + 0.5f);
lightNode.position = position;
lightNode.direction = Vector3(Sin(angle), -1.5f, Cos(angle));
light.lightType = LIGHT_SPOT;
light.range = 90.0f;
light.rampTexture = cache.GetResource("Texture2D", "Textures/RampExtreme.png");
light.fov = 45.0f;
light.color = color;
light.specularIntensity = 1.0f;
light.castShadows = true;
light.shadowBias = BiasParameters(0.00002f, 0.0f);
// Configure shadow fading for the lights. When they are far away enough, the lights eventually become unshadowed for
// better GPU performance. Note that we could also set the maximum distance for each object to cast shadows
light.shadowFadeDistance = 100.0f; // Fade start distance
light.shadowDistance = 125.0f; // Fade end distance, shadows are disabled
// Set half resolution for the shadow maps for increased performance
light.shadowResolution = 0.5f;
// The spot lights will not have anything near them, so move the near plane of the shadow camera farther
// for better shadow depth resolution
light.shadowNearFarRatio = 0.01f;
}
// Create the camera. Limit far clip distance to match the fog
cameraNode = scene_.CreateChild("Camera");
Camera@ camera = cameraNode.CreateComponent("Camera");
camera.farClip = 300.0f;
// Set an initial position for the camera scene node above the plane
cameraNode.position = Vector3(0.0f, 5.0f, 0.0f);
}
void CreateInstructions()
{
// Construct new Text object, set string to display and font to use
Text@ instructionText = ui.root.CreateChild("Text");
instructionText.text =
"Use WASD keys and mouse to move\n"
"Space to toggle debug geometry";
instructionText.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15);
// The text has multiple rows. Center them in relation to each other
instructionText.textAlignment = HA_CENTER;
// Position the text relative to the screen center
instructionText.horizontalAlignment = HA_CENTER;
instructionText.verticalAlignment = VA_CENTER;
instructionText.SetPosition(0, ui.root.height / 4);
}
void SetupViewport()
{
// Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
Viewport@ viewport = Viewport(scene_, cameraNode.GetComponent("Camera"));
renderer.viewports[0] = viewport;
}
void SubscribeToEvents()
{
// Subscribe HandleUpdate() function for processing update events
SubscribeToEvent("Update", "HandleUpdate");
// Subscribe HandlePostRenderUpdate() function for processing the post-render update event, during which we request
// debug geometry
SubscribeToEvent("PostRenderUpdate", "HandlePostRenderUpdate");
}
void MoveCamera(float timeStep)
{
// Do not move if the UI has a focused element (the console)
if (ui.focusElement !is null)
return;
// Movement speed as world units per second
const float MOVE_SPEED = 20.0f;
// Mouse sensitivity as degrees per pixel
const float MOUSE_SENSITIVITY = 0.1f;
// Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
IntVector2 mouseMove = input.mouseMove;
yaw += MOUSE_SENSITIVITY * mouseMove.x;
pitch += MOUSE_SENSITIVITY * mouseMove.y;
pitch = Clamp(pitch, -90.0f, 90.0f);
// Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
cameraNode.rotation = Quaternion(pitch, yaw, 0.0f);
// Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
if (input.keyDown['W'])
cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
if (input.keyDown['S'])
cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
if (input.keyDown['A'])
cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
if (input.keyDown['D'])
cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
// Toggle debug geometry with space
if (input.keyPress[KEY_SPACE])
drawDebug = !drawDebug;
}
void AnimateScene(float timeStep)
{
// Get the light and billboard scene nodes
Array<Node@> lightNodes = scene_.GetChildrenWithComponent("Light");
Array<Node@> billboardNodes = scene_.GetChildrenWithComponent("BillboardSet");
const float LIGHT_ROTATION_SPEED = 20.0f;
const float BILLBOARD_ROTATION_SPEED = 50.0f;
// Rotate the lights around the world Y-axis
for (uint i = 0; i < lightNodes.length; ++i)
lightNodes[i].Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), true);
// Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
for (uint i = 0; i < billboardNodes.length; ++i)
{
BillboardSet@ billboardObject = billboardNodes[i].GetComponent("BillboardSet");
for (uint j = 0; j < billboardObject.numBillboards; ++j)
{
Billboard@ bb = billboardObject.billboards[j];
bb.rotation += BILLBOARD_ROTATION_SPEED * timeStep;
}
billboardObject.Commit();
}
}
void HandleUpdate(StringHash eventType, VariantMap& eventData)
{
// Take the frame time step, which is stored as a float
float timeStep = eventData["TimeStep"].GetFloat();
// Move the camera and animate the scene, scale movement with time step
MoveCamera(timeStep);
AnimateScene(timeStep);
}
void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
{
// If draw debug mode is enabled, draw viewport debug geometry. This time use depth test, as otherwise the result becomes
// hard to interpret due to large object count
if (drawDebug)
renderer.DrawDebugGeometry(true);
}
|
package screens
{
import feathers.controls.Alert;
import feathers.controls.Button;
import feathers.controls.ImageLoader;
import feathers.controls.Label;
import feathers.controls.PanelScreen;
import feathers.controls.ScrollContainer;
import feathers.controls.TextInput;
import feathers.controls.text.TextFieldTextRenderer;
import feathers.core.ITextRenderer;
import feathers.data.ListCollection;
import feathers.layout.AnchorLayout;
import feathers.layout.AnchorLayoutData;
import feathers.layout.HorizontalAlign;
import feathers.layout.VerticalLayout;
import feathers.layout.VerticalLayoutData;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLRequestMethod;
import flash.text.TextFormat;
import starling.events.Event;
import utils.ProfileManager;
import utils.Responses;
import utils.RoundedRect;
public class LoginScreen extends PanelScreen
{
public static const GO_HOME:String = "goHomeScreen";
public static const GO_REGISTER:String = "goRegister";
private var alert:Alert;
private var emailInput:TextInput;
private var passwordInput:TextInput;
override protected function initialize():void
{
super.initialize();
this.layout = new AnchorLayout();
this.title = "Welcome";
var myLayout:VerticalLayout = new VerticalLayout();
myLayout.horizontalAlign = HorizontalAlign.CENTER;
myLayout.gap = 12;
var mainGroup:ScrollContainer = new ScrollContainer();
mainGroup.layoutData = new AnchorLayoutData(10, 10, 10, 10, NaN, NaN);
mainGroup.layout = myLayout;
mainGroup.padding = 12;
mainGroup.backgroundSkin = RoundedRect.createRoundedRect(0x00695C);
this.addChild(mainGroup);
var icon:ImageLoader = new ImageLoader();
icon.source = "assets/icons/account.png";
icon.width = icon.height = 110;
mainGroup.addChild(icon);
var label1:Label = new Label();
label1.layoutData = new VerticalLayoutData(100, NaN);
label1.text = "Email";
mainGroup.addChild(label1);
emailInput = new TextInput();
emailInput.layoutData = new VerticalLayoutData(100, NaN);
emailInput.prompt = "Type your Email Address";
mainGroup.addChild(emailInput);
var label2:Label = new Label();
label2.layoutData = new VerticalLayoutData(100, NaN);
label2.text = "Password";
mainGroup.addChild(label2);
passwordInput = new TextInput();
passwordInput.layoutData = new VerticalLayoutData(100, NaN);
passwordInput.prompt = "Type your Password";
passwordInput.displayAsPassword = true;
mainGroup.addChild(passwordInput);
var loginBtn:Button = new Button();
loginBtn.addEventListener(starling.events.Event.TRIGGERED, login);
loginBtn.layoutData = new VerticalLayoutData(100, NaN);
loginBtn.styleNameList.add("white-button");
loginBtn.label = "Sign In";
mainGroup.addChild(loginBtn);
var registerBtn:Button = new Button();
registerBtn.addEventListener(starling.events.Event.TRIGGERED, function ():void
{
dispatchEventWith(GO_REGISTER);
});
registerBtn.label = "New User? <u>Register here</u>";
registerBtn.height = 40;
registerBtn.styleProvider = null;
registerBtn.labelFactory = function ():ITextRenderer
{
var renderer:TextFieldTextRenderer = new TextFieldTextRenderer();
renderer.isHTML = true;
renderer.textFormat = new TextFormat("_sans", 16, 0xFFFFFF);
return renderer;
};
mainGroup.addChild(registerBtn);
}
private function login():void
{
if (emailInput.text == "" || passwordInput.text == "") {
alert = Alert.show("Email and Password are required fields.", "Error", new ListCollection([{label: "OK"}]));
} else {
var myObject:Object = new Object();
myObject.email = emailInput.text;
myObject.password = passwordInput.text;
myObject.returnSecureToken = true; //We ask for a refreshToken in our response
var header:URLRequestHeader = new URLRequestHeader("Content-Type", "application/json");
var request:URLRequest = new URLRequest(Firebase.EMAIL_PASSWORD_LOGIN);
request.method = URLRequestMethod.POST;
request.data = JSON.stringify(myObject);
request.requestHeaders.push(header);
var loginLoader:URLLoader = new URLLoader();
loginLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loginLoader.addEventListener(flash.events.Event.COMPLETE, loginComplete);
loginLoader.load(request);
}
}
private function loginComplete(event:flash.events.Event):void
{
//The user has successfully logged in to our Firebase project, now we are going to get an access_token.
var rawData:Object = JSON.parse(event.currentTarget.data);
var header:URLRequestHeader = new URLRequestHeader("Content-Type", "application/json");
var myObject:Object = new Object();
myObject.grant_type = "refresh_token";
myObject.refresh_token = rawData.refreshToken; //Here we use the refreshToken previously mentioned
var request:URLRequest = new URLRequest(Firebase.FIREBASE_AUTH_TOKEN_URL);
request.method = URLRequestMethod.POST;
request.data = JSON.stringify(myObject);
request.requestHeaders.push(header);
var loader:URLLoader = new URLLoader();
loader.addEventListener(flash.events.Event.COMPLETE, authComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.load(request);
}
private function authComplete(event:flash.events.Event):void
{
var rawData:Object = JSON.parse(event.currentTarget.data);
Firebase.LOGGED_USER_DATA = rawData;
Firebase.FIREBASE_AUTH_TOKEN = rawData.access_token;
ProfileManager.saveProfile(rawData);
this.dispatchEventWith(GO_HOME);
}
private function resetPassword():void
{
var myObject:Object = new Object();
myObject.email = emailInput.text;
myObject.requestType = "PASSWORD_RESET";
var header:URLRequestHeader = new URLRequestHeader("Content-Type", "application/json");
var request:URLRequest = new URLRequest(Firebase.RESET_PASSWORD);
request.method = URLRequestMethod.POST;
request.data = JSON.stringify(myObject);
request.requestHeaders.push(header);
var resetLoader:URLLoader = new URLLoader();
resetLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
resetLoader.addEventListener(flash.events.Event.COMPLETE, function ():void
{
//Recover password email has been sent
alert = Alert.show("A recovery message has been sent to your email address.", "Password Reset", new ListCollection([{label: "OK"}]));
});
resetLoader.load(request);
}
private function errorHandler(event:IOErrorEvent):void
{
var rawData:Object = JSON.parse(event.currentTarget.data);
trace(event.currentTarget.data);
if (rawData.error.message == "INVALID_PASSWORD") {
//If the user has an account we offer him to recover his password
alert = Alert.show(rawData.error.message, "Error", new ListCollection(
[
{label: "Reset Pass", triggered: resetPassword},
{label: "OK"}
]));
} else {
alert = Alert.show(Responses[rawData.error.message], "Error", new ListCollection([{label: "OK"}]));
}
}
}
} |
package {
import flash.display.MovieClip;
import flash.utils.*;
import flash.events.Event;
import flash.events.TimerEvent;
import se.svt.caspar.template.CasparTemplate;
import flash.text.TextField;
public class CountDown_L3 extends CasparTemplate {
public var CountDownMovie:MovieClip;
private var targetTime:Number = 0;
var clockTimer:Timer = new Timer(1000);
public function CountDown_L3(){
clockTimer.addEventListener(TimerEvent.TIMER, RefreshClock);
clockTimer.start();
RefreshClock(null);
}
public override function SetData(xmlData:XML):void
{
for each(var element:XML in xmlData.elements()){
if(element.@id == "ProgramTitle"){
CountDownMovie.ProgramTitle.text = String(element.data.@value);
}
if(element.@id == "ProgramStartTime"){
targetTime = Number(element.data.@value) * 1000;
}
}
RefreshClock(null);
//super.SetData(xmlData);
}
private function RefreshClock(event:TimerEvent):void{
var cDate = new Date();
var cTime = cDate.getTime();
var tLeft = targetTime - cTime;
var secsLeft = Math.floor(tLeft/1000);
CountDownMovie.CountDownTime.text = toTimeString(tLeft);
}
public function toTimeString(remainder:Number):String
{
if (remainder < 1) return "00:00";
var numHours:Number = Math.floor(remainder / 3600000);
remainder = remainder - (numHours * 3600000);
var numMinutes:Number = Math.floor(remainder / 60000);
remainder = remainder - (numMinutes * 60000);
var numSeconds:Number = Math.floor(remainder / 1000);
remainder = remainder - (numSeconds * 1000);
return (numHours > 0 ? toPadString(Math.min(9999, numHours)) + ":" : "") + toPadString(numMinutes) + ":" + toPadString(numSeconds);
}
public function toPadString(value:Number):String
{
var str:String = value.toString();
while (str.length < 2)
str = "0" + str;
return str;
}
}
}
|
package view.scene.common
{
import flash.display.*;
import flash.geom.*;
import flash.events.MouseEvent;
import flash.events.Event;
import mx.core.UIComponent;
import mx.controls.*;
import org.libspark.thread.*;
import org.libspark.thread.utils.*;
import org.libspark.thread.threads.between.BeTweenAS3Thread;
import view.RaidHelpView;
import view.scene.BaseScene;
import model.Story;
import view.image.common.StoryFrameImage;
import view.image.common.StoryImage;
import view.ClousureThread;
import controller.LobbyCtrl;
/**
* ストーリー表示クラス
*
*/
public class StoryClip extends BaseScene
{
// テキストエリア
// private var _textArea:TextArea = new TextArea();
private var _storyTextArea:StoryTextArea = new StoryTextArea();
private var _storyImage:StoryImage;
// ストーリー
private var _story:Story;
// 終了ボタン
// private var _exitButton:Button = new Button();
// 背景フレーム
private var _frame:StoryFrameImage = new StoryFrameImage();
// テキスト
private var _html:String;
// フェードベース
private var _fade:Fade = new Fade(0.2, 0.9);
private var _bgContainer:UIComponent = new UIComponent();
private static const _EXIT_BUTTON_X:int = 925; // 終了ボタンX
private static const _EXIT_BUTTON_Y:int = 700; // 終了ボタンY
private static const _IMAGE_X:int = 20;
private static const _IMAGE_Y:int = 96;
private static const _RUBY_AREA_X:int = 865; // 中身の文字のX
private static const _RUBY_AREA_Y:int = 637; // 終了ボタンY
private static const URL:String = "/public/image/story/";
// 挿絵
/**
* コンストラクタ
*
*/
public function StoryClip(s:Story)
{
_story = s;
}
public override function init():void
{
LobbyCtrl.instance.stopBGM(1);
LobbyCtrl.instance.playStoryBGM();
Voice.playStoryVoice(_story.id);
_storyTextArea.setData(_story.title, _story.content);
// log.writeLog(log.LV_FATAL, this, "init ", URL+_story.image);
_storyImage = new StoryImage(URL+_story.image);
_bgContainer.x = _IMAGE_X;
_bgContainer.y = _IMAGE_Y;
addChild(_bgContainer);
addChild(_frame);
addChild(_storyTextArea);
addChild(_frame.readMark);
_frame.addEventListener(StoryFrameImage.CLICK_EXIT, exitHandler);
_storyTextArea.addEventListener(MouseEvent.CLICK, _storyTextArea.clickHandler);
_storyTextArea.setReadMarkImage(_frame.readMark);
_storyImage.getShowThread(_bgContainer).start();
}
public override function final():void
{
}
// 表示用スレッドを返す
public override function getShowThread(stage:DisplayObjectContainer, at:int = -1, type:String=""):Thread
{
log.writeLog(log.LV_FATAL, this, "getshow", stage);
_depthAt = at;
RaidHelpView.instance.isUpdate = false;
var pExec:SerialExecutor = new SerialExecutor();
pExec.addThread(_fade.getShowThread(stage, at));
pExec.addThread(new ShowThread(_story, this, stage));
return pExec;
}
// 非表示スレッドを返す
public override function getHideThread(type:String=""):Thread
{
_frame.removeEventListener(StoryFrameImage.CLICK_EXIT, exitHandler);
_storyTextArea.removeEventListener(MouseEvent.CLICK, _storyTextArea.clickHandler);
var sExec:SerialExecutor = new SerialExecutor();
var pExec:ParallelExecutor = new ParallelExecutor();
pExec.addThread(_fade.getHideThread());
pExec.addThread(new HideThread(this));
sExec.addThread(pExec);
sExec.addThread(new ClousureThread(function():void{RaidHelpView.instance.isUpdate = true}));
return sExec;
}
public function exitHandler(e:Event):void
{
LobbyCtrl.instance.stopStoryBGM(1);
LobbyCtrl.instance.playBGM();
getHideThread().start();
}
}
}
import flash.display.Sprite;
import flash.display.DisplayObjectContainer;
import org.libspark.thread.Thread;
import view.BaseShowThread;
import model.Story;
import view.BaseHideThread;
import view.scene.common.StoryClip;
class ShowThread extends BaseShowThread
{
private var _story:Story;
public function ShowThread(s:Story, sc:StoryClip, stage:DisplayObjectContainer)
{
log.writeLog(log.LV_FATAL, this, "aaaaaaaaaStory", s);
_story = s;
super(sc, stage);
}
protected override function run():void
{
// ストーリーの準備を待つ
if (_story.loaded == false)
{
_story.wait();
}
next(close);
}
}
class HideThread extends BaseHideThread
{
public function HideThread(f:StoryClip)
{
super(f);
}
}
|
package com.codeazur.as3swf.data.abc.exporters.js.builders.arguments
{
import com.codeazur.as3swf.data.abc.ABC;
import com.codeazur.as3swf.data.abc.bytecode.ABCParameter;
import com.codeazur.as3swf.data.abc.exporters.builders.IABCAttributeBuilder;
import com.codeazur.as3swf.data.abc.exporters.builders.IABCExpression;
import com.codeazur.utils.StringUtils;
import flash.utils.ByteArray;
/**
* @author Simon Richardson - simon@ustwo.co.uk
*/
public class JSPrimaryArgumentBuilder implements IABCAttributeBuilder {
public var expression:IABCExpression;
private var _argument:ABCParameter;
public function JSPrimaryArgumentBuilder() {
}
public static function create(expression:IABCExpression):JSPrimaryArgumentBuilder {
const builder:JSPrimaryArgumentBuilder = new JSPrimaryArgumentBuilder();
builder.expression = expression;
return builder;
}
public function write(data:ByteArray):void {
expression.write(data);
}
public function get argument():ABCParameter { return _argument; }
public function set argument(value:ABCParameter) : void { _argument = value; }
public function get name():String { return "JSNullArgumentBuilder"; }
public function toString(indent:uint=0):String {
var str:String = ABC.toStringCommon(name, indent);
if(argument) {
str += "\n" + StringUtils.repeat(indent + 2) + "Argument:";
str += "\n" + argument.toString(indent + 4);
}
return str;
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// 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.flex.collections
{
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
import flash.utils.IExternalizable;
import flash.utils.getQualifiedClassName;
import mx.collections.ICollectionView;
import mx.collections.IList;
import mx.core.IPropertyChangeNotifier;
import mx.events.CollectionEvent;
import mx.events.CollectionEventKind;
import mx.events.PropertyChangeEvent;
import mx.events.PropertyChangeEventKind;
import mx.resources.IResourceManager;
import mx.resources.ResourceManager;
import mx.utils.ArrayUtil;
import mx.utils.UIDUtil;
//--------------------------------------
// Events
//--------------------------------------
/**
* Dispatched when the IList has been updated in some way.
*
* @eventType mx.events.CollectionEvent.COLLECTION_CHANGE
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Event(name="collectionChange", type="mx.events.CollectionEvent")]
//--------------------------------------
// Other metadata
//--------------------------------------
[RemoteClass(alias="flex.messaging.io.ArrayList")]
[ResourceBundle("collections")]
[DefaultProperty("source")]
/**
* The ArrayList class is a simple implementation of IList
* that uses a backing Array as the source of the data.
*
* Items in the backing Array can be accessed and manipulated
* using the methods and properties of the <code>IList</code>
* interface. Operations on an ArrayList instance modify the
* data source; for example, if you use the <code>removeItemAt()</code>
* method on an ArrayList, you remove the item from the underlying
* Array.
*
* This base class will not throw ItemPendingErrors but it
* is possible that a subclass might.
*
* <pre>
* <mx:ArrayList
* <b>Properties</b>
* source="null"
* />
* </pre>
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public class ArrayList extends EventDispatcher
implements IList, IExternalizable, IPropertyChangeNotifier
{
//include "../core/Version.as";
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Construct a new ArrayList using the specified array as its source.
* If no source is specified an empty array will be used.
*
* @param source The Array to use as a source for the ArrayList.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function ArrayList(source:Array = null)
{
super();
disableEvents();
this.source = source;
enableEvents();
}
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
/**
* @private
* Used for accessing localized Error messages.
*/
private var resourceManager:IResourceManager =
ResourceManager.getInstance();
/**
* @private
* Indicates if events should be dispatched.
* calls to enableEvents() and disableEvents() effect the value when == 0
* events should be dispatched.
*/
private var _dispatchEvents:int = 0;
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
//----------------------------------
// length
//----------------------------------
[Bindable("collectionChange")]
/**
* Get the number of items in the list. An ArrayList should always
* know its length so it shouldn't return -1, though a subclass may
* override that behavior.
*
* @return int representing the length of the source.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get length():int
{
if (source)
return source.length;
else
return 0;
}
//----------------------------------
// source
//----------------------------------
/**
* @private
* Storage for the source Array.
*/
private var _source:Array;
/**
* The source array for this ArrayList.
* Any changes done through the IList interface will be reflected in the
* source array.
* If no source array was supplied the ArrayList will create one internally.
* Changes made directly to the underlying Array (e.g., calling
* <code>theList.source.pop()</code> will not cause <code>CollectionEvents</code>
* to be dispatched.
*
* @return An Array that represents the underlying source.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get source():Array
{
return _source;
}
public function set source(s:Array):void
{
var i:int;
var len:int;
if (_source && _source.length)
{
len = _source.length;
for (i = 0; i < len; i++)
{
stopTrackUpdates(_source[i]);
}
}
_source = s ? s : [];
len = _source.length;
for (i = 0; i < len; i++)
{
startTrackUpdates(_source[i]);
}
if (_dispatchEvents == 0)
{
var event:CollectionEvent =
new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
event.kind = CollectionEventKind.RESET;
dispatchEvent(event);
}
}
//----------------------------------
// uid -- mx.core.IPropertyChangeNotifier
//----------------------------------
/**
* @private
* Storage for the UID String.
*/
private var _uid:String;
/**
* Provides access to the unique id for this list.
*
* @return String representing the internal uid.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get uid():String
{
if (!_uid) {
_uid = UIDUtil.createUID();
}
return _uid;
}
public function set uid(value:String):void
{
_uid = value;
}
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* Get the item at the specified index.
*
* @param index the index in the list from which to retrieve the item
* @param prefetch int indicating both the direction and amount of items
* to fetch during the request should the item not be local.
* @return the item at that index, null if there is none
* @throws ItemPendingError if the data for that index needs to be
* loaded from a remote location
* @throws RangeError if the index < 0 or index >= length
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function getItemAt(index:int, prefetch:int = 0):Object
{
if (index < 0 || index >= length)
{
var message:String = resourceManager.getString(
"collections", "outOfBounds", [ index ]);
throw new RangeError(message);
}
return source[index];
}
/**
* Place the item at the specified index.
* If an item was already at that index the new item will replace it and it
* will be returned.
*
* @param item the new value for the index
* @param index the index at which to place the item
* @return the item that was replaced, null if none
* @throws RangeError if index is less than 0 or greater than or equal to length
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function setItemAt(item:Object, index:int):Object
{
if (index < 0 || index >= length)
{
var message:String = resourceManager.getString(
"collections", "outOfBounds", [ index ]);
throw new RangeError(message);
}
var oldItem:Object = source[index];
source[index] = item;
stopTrackUpdates(oldItem);
startTrackUpdates(item);
//dispatch the appropriate events
if (_dispatchEvents == 0)
{
var hasCollectionListener:Boolean =
hasEventListener(CollectionEvent.COLLECTION_CHANGE);
var hasPropertyListener:Boolean =
hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE);
var updateInfo:PropertyChangeEvent;
if (hasCollectionListener || hasPropertyListener)
{
updateInfo = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
updateInfo.kind = PropertyChangeEventKind.UPDATE;
updateInfo.oldValue = oldItem;
updateInfo.newValue = item;
updateInfo.property = index;
}
if (hasCollectionListener)
{
var event:CollectionEvent =
new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
event.kind = CollectionEventKind.REPLACE;
event.location = index;
event.items.push(updateInfo);
dispatchEvent(event);
}
if (hasPropertyListener)
{
dispatchEvent(updateInfo);
}
}
return oldItem;
}
/**
* Add the specified item to the end of the list.
* Equivalent to addItemAt(item, length);
*
* @param item the item to add
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function addItem(item:Object):void
{
addItemAt(item, length);
}
/**
* Add the item at the specified index.
* Any item that was after this index is moved out by one.
*
* @param item the item to place at the index
* @param index the index at which to place the item
* @throws RangeError if index is less than 0 or greater than the length
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function addItemAt(item:Object, index:int):void
{
if (index < 0 || index > length)
{
var message:String = resourceManager.getString(
"collections", "outOfBounds", [ index ]);
throw new RangeError(message);
}
source.splice(index, 0, item);
startTrackUpdates(item);
internalDispatchEvent(CollectionEventKind.ADD, item, index);
}
/**
* @copy mx.collections.ListCollectionView#addAll()
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function addAll(addList:IList):void
{
addAllAt(addList, length);
}
/**
* @copy mx.collections.ListCollectionView#addAllAt()
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function addAllAt(addList:IList, index:int):void
{
var length:int = addList.length;
for (var i:int = 0; i < length; i++)
{
this.addItemAt(addList.getItemAt(i), i+index);
}
}
/**
* Return the index of the item if it is in the list such that
* getItemAt(index) == item.
* Note that in this implementation the search is linear and is therefore
* O(n).
*
* @param item the item to find
* @return the index of the item, -1 if the item is not in the list.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function getItemIndex(item:Object):int
{
return ArrayUtil.getItemIndex(item, source);
}
/**
* Removes the specified item from this list, should it exist.
*
* @param item Object reference to the item that should be removed.
* @return Boolean indicating if the item was removed.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function removeItem(item:Object):Boolean
{
var index:int = getItemIndex(item);
var result:Boolean = index >= 0;
if (result)
removeItemAt(index);
return result;
}
/**
* Remove the item at the specified index and return it.
* Any items that were after this index are now one index earlier.
*
* @param index The index from which to remove the item.
* @return The item that was removed.
* @throws RangeError if index < 0 or index >= length.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function removeItemAt(index:int):Object
{
if (index < 0 || index >= length)
{
var message:String = resourceManager.getString(
"collections", "outOfBounds", [ index ]);
throw new RangeError(message);
}
var removed:Object = source.splice(index, 1)[0];
stopTrackUpdates(removed);
internalDispatchEvent(CollectionEventKind.REMOVE, removed, index);
return removed;
}
/**
* Remove all items from the list.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function removeAll():void
{
if (length > 0)
{
var len:int = length;
for (var i:int = 0; i < len; i++)
{
stopTrackUpdates(source[i]);
}
source.splice(0, length);
internalDispatchEvent(CollectionEventKind.RESET);
}
}
/**
* Notify the view that an item has been updated.
* This is useful if the contents of the view do not implement
* <code>IEventDispatcher</code>.
* If a property is specified the view may be able to optimize its
* notification mechanism.
* Otherwise it may choose to simply refresh the whole view.
*
* @param item The item within the view that was updated.
*
* @param property A String, QName, or int
* specifying the property that was updated.
*
* @param oldValue The old value of that property.
* (If property was null, this can be the old value of the item.)
*
* @param newValue The new value of that property.
* (If property was null, there's no need to specify this
* as the item is assumed to be the new value.)
*
* @see mx.events.CollectionEvent
* @see mx.core.IPropertyChangeNotifier
* @see mx.events.PropertyChangeEvent
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function itemUpdated(item:Object, property:Object = null,
oldValue:Object = null,
newValue:Object = null):void
{
var event:PropertyChangeEvent =
new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
event.kind = PropertyChangeEventKind.UPDATE;
event.source = item;
event.property = property;
event.oldValue = oldValue;
event.newValue = newValue;
//This handler was intended to handle events from child objects, not to be called directly
//itemUpdateHandler(event);
internalDispatchEvent(CollectionEventKind.UPDATE, event);
// need to dispatch object event now
if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
{
dispatchPropertyChangeEventClone( event, item );
}
}
/**
* Return an Array that is populated in the same order as the IList
* implementation.
*
* @return An Array populated in the same order as the IList
* implementation.
*
* @throws ItemPendingError if the data is not yet completely loaded
* from a remote location
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function toArray():Array
{
return source.concat();
}
/**
* Ensures that only the source property is seralized.
* @private
*/
public function readExternal(input:IDataInput):void
{
source = input.readObject();
}
/**
* Ensures that only the source property is serialized.
* @private
*/
public function writeExternal(output:IDataOutput):void
{
output.writeObject(_source);
}
/**
* Pretty prints the contents of this ArrayList to a string and returns it.
*
* @return A String containing the contents of the ArrayList.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
override public function toString():String
{
if (source)
return source.toString();
else
return getQualifiedClassName(this);
}
//--------------------------------------------------------------------------
//
// Internal Methods
//
//--------------------------------------------------------------------------
/**
* Dispatches a PropertyChangeEvent clone either from a child object whose event needs to be redispatched
* or when a PropertyChangeEvent is faked inside of this class for the purposes of informing the view
* of an update to underlying data.
*
* @param event The PropertyChangeEvent to be cloned and dispatched
* @param item The item within the view that was updated.
*
* @see mx.core.IPropertyChangeNotifier
* @see mx.events.PropertyChangeEvent
*/
private function dispatchPropertyChangeEventClone( event:PropertyChangeEvent, item:Object ):void {
var objEvent:PropertyChangeEvent = PropertyChangeEvent(event.clone());
var index:int = getItemIndex( item );
objEvent.property = index.toString() + "." + event.property;
dispatchEvent(objEvent);
}
/**
* Enables event dispatch for this list.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
private function enableEvents():void
{
_dispatchEvents++;
if (_dispatchEvents > 0)
_dispatchEvents = 0;
}
/**
* Disables event dispatch for this list.
* To re-enable events call enableEvents(), enableEvents() must be called
* a matching number of times as disableEvents().
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
private function disableEvents():void
{
_dispatchEvents--;
}
/**
* Dispatches a collection event with the specified information.
*
* @param kind String indicates what the kind property of the event should be
* @param item Object reference to the item that was added or removed
* @param location int indicating where in the source the item was added.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
private function internalDispatchEvent(kind:String, item:Object = null, location:int = -1):void
{
if (_dispatchEvents == 0)
{
if (hasEventListener(CollectionEvent.COLLECTION_CHANGE))
{
var event:CollectionEvent =
new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
event.kind = kind;
event.items.push(item);
event.location = location;
dispatchEvent(event);
}
// now dispatch a complementary PropertyChangeEvent
if (hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE) &&
(kind == CollectionEventKind.ADD || kind == CollectionEventKind.REMOVE))
{
var objEvent:PropertyChangeEvent =
new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
objEvent.property = location;
if (kind == CollectionEventKind.ADD)
objEvent.newValue = item;
else
objEvent.oldValue = item;
dispatchEvent(objEvent);
}
}
}
/**
* Called when any of the contained items in the list dispatch an
* ObjectChange event.
* Wraps it in a <code>CollectionEventKind.UPDATE</code> object.
*
* @param event The event object for the ObjectChange event.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
protected function itemUpdateHandler(event:PropertyChangeEvent):void
{
internalDispatchEvent(CollectionEventKind.UPDATE, event);
// need to dispatch object event now
if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
{
dispatchPropertyChangeEventClone( event, event.target );
}
}
/**
* If the item is an IEventDispatcher, watch it for updates.
* This method is called by the <code>addItemAt()</code> method,
* and when the source is initially assigned.
*
* @param item The item passed to the <code>addItemAt()</code> method.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
protected function startTrackUpdates(item:Object):void
{
if (item && (item is IEventDispatcher))
{
IEventDispatcher(item).addEventListener(
PropertyChangeEvent.PROPERTY_CHANGE,
itemUpdateHandler, false, 0, true);
}
}
/**
* If the item is an IEventDispatcher, stop watching it for updates.
* This method is called by the <code>removeItemAt()</code> and
* <code>removeAll()</code> methods, and before a new
* source is assigned.
*
* @param item The item passed to the <code>removeItemAt()</code> method.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
protected function stopTrackUpdates(item:Object):void
{
if (item && item is IEventDispatcher)
{
IEventDispatcher(item).removeEventListener(
PropertyChangeEvent.PROPERTY_CHANGE,
itemUpdateHandler);
}
}
}
}
|
package {
import com.myavatareditor.avatarcore.*;
import com.myavatareditor.avatarcore.display.*;
import com.myavatareditor.avatarcore.xml.*;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
// make sure dependent classes are compiled within SWF
Mirror; Constrain;
/**
* Document class for the feature editing example showing how Adjust
* objects can be changed to modify the appearances of Avatar
* Features. This examples also shows how the sprites that represent
* those features can be directly manipulated through mouse interaction.
*/
public class FeatureEditing extends Sprite {
private var avatarXML:XML =
<Avatar xmlns="com.myavatareditor.avatarcore">
<Feature name="Head">
<art src="Head" zIndex="0" />
<adjust />
</Feature>
<Feature name="Hair" parentName="Head">
<art src="Hair" zIndex="4" />
<adjust y="-40" />
</Feature>
<Feature name="Ears" parentName="Head">
<art src="Ear" zIndex="-1" />
<adjust x="-40" />
<behaviors>
<Mirror />
</behaviors>
</Feature>
<Feature name="Eyes" parentName="Head">
<art src="Eye" zIndex="1" />
<adjust x="-10" y="-20" />
<behaviors>
<Mirror />
</behaviors>
</Feature>
<Feature name="Nose" parentName="Head">
<art src="Nose" zIndex="10" />
<adjust y="10" />
</Feature>
<Feature name="Mouth" parentName="Head">
<art src="Mouth" zIndex="2" />
<adjust y="40" />
</Feature>
</Avatar>;
// for creating and displaying Avatar
private var xmlParser:XMLDefinitionParser = new XMLDefinitionParser();
private var avatarDisplay:AvatarDisplay;
// for manipulating Avatar Features
private var moveTool:MoveFeatureTool = new MoveFeatureTool();
private var scaleTool:ScaleFeatureTool = new ScaleFeatureTool();
private var rotateTool:RotateFeatureTool = new RotateFeatureTool();
private var currentTool:IFeatureTool;
// Timeline objects
public var toolSelection:MovieClip;
public function FeatureEditing() {
// create the avatar character
var avatar:Avatar = xmlParser.parse(avatarXML) as Avatar;
avatarDisplay = new AvatarDisplay(avatar);
avatarDisplay.x = 150;
avatarDisplay.y = 150;
addChildAt(avatarDisplay, 0);
// the default tool is the move tool
currentTool = moveTool;
// listen for a change in tool selection
toolSelection.addEventListener(MouseEvent.CLICK, toolChangedHandler, false, 0, true);
// listen for a selection of an ArtSprite
avatarDisplay.addEventListener(MouseEvent.MOUSE_DOWN, pressArtSpriteHandler, false, 0, true);
}
private function toolChangedHandler(event:MouseEvent):void {
// depending on which radio button was selected, change
// the value of currentTool to match the tool that
// relates to that button
switch (event.target.name){
case "scaleRadio":{
currentTool = scaleTool;
break;
}
case "rotateRadio":{
currentTool = rotateTool;
break;
}
case "moveRadio":
default:{
currentTool = moveTool;
break;
}
}
}
private function pressArtSpriteHandler(event:MouseEvent):void {
// use global event handlers to recognize all mouse movements
// and releases even if ouside the stage
stage.addEventListener(MouseEvent.MOUSE_MOVE, whileUsingArtSpriteHandler, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, releaseArtSpriteHandler, false, 0, true);
// intialize the current tool when an art sprite is clicked
currentTool.startAction(event.target as ArtSprite);
}
private function whileUsingArtSpriteHandler(event:MouseEvent):void {
// while using the current tool
currentTool.whileAction();
}
private function releaseArtSpriteHandler(event:MouseEvent):void {
// remove global movie event handlers
stage.removeEventListener(MouseEvent.MOUSE_MOVE, whileUsingArtSpriteHandler, false);
stage.removeEventListener(MouseEvent.MOUSE_UP, releaseArtSpriteHandler, false);
// complete the action of the current tool
currentTool.endAction();
}
}
} |
/*
* Copyright 2007-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springextensions.actionscript.eventbus {
import org.as3commons.eventbus.IEventBus;
import org.springextensions.actionscript.context.IApplicationContext;
/**
* Describes an object that handles the logic of linking up two eventbuses between application contexts.
* @author Roland Zwaga
*/
public interface IEventBusShareManager {
/**
*
* @param childContext
* @param parentEventBus
* @param settings
*/
function addChildContextEventBusListener(childContext:IApplicationContext, parentEventBus:IEventBus, settings:EventBusShareSettings):void;
}
}
|
/* 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="";
// var VERSION = "ECMA_1";
Assert.expectEq(
"slice no args on empty vector",
"",
new<String>[].slice().toString());
Assert.expectEq(
"slice startIndex only",
"6,7,8,9",
new<int>[0,1,2,3,4,5,6,7,8,9].slice(6).toString());
Assert.expectEq(
"slice -1 to -1",
"",
new<int>[0,1,2,3,4,5,6,7,8,9].slice(-1,-1).toString());
Assert.expectEq(
"slice -2 to -1",
"8",
new<int>[0,1,2,3,4,5,6,7,8,9].slice(-2,-1).toString());
Assert.expectEq(
"verify return type",
true,
new<Number>[3.14,2.73,9999,.0001,1e13].slice(3,-1) is Vector.<Number>)
|
package com.ankamagames.jerakine.pools
{
import flash.geom.Rectangle;
public class PoolableRectangle extends Rectangle implements Poolable
{
public function PoolableRectangle(x:Number = 0, y:Number = 0, width:Number = 0, height:Number = 0)
{
super(x,y,width,height);
}
public function renew(x:Number = 0, y:Number = 0, width:Number = 0, height:Number = 0) : PoolableRectangle
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
return this;
}
public function free() : void
{
}
public function extend(toUnion:Rectangle) : void
{
var tmp:Rectangle = this.union(toUnion);
x = tmp.x;
y = tmp.y;
width = tmp.width;
height = tmp.height;
}
}
}
|
// Action script...
// [Initial MovieClip Action of sprite 20772]
#initclip 37
if (!dofus.graphics.gapi.controls.Smileys)
{
if (!dofus)
{
_global.dofus = new Object();
} // end if
if (!dofus.graphics)
{
_global.dofus.graphics = new Object();
} // end if
if (!dofus.graphics.gapi)
{
_global.dofus.graphics.gapi = new Object();
} // end if
if (!dofus.graphics.gapi.controls)
{
_global.dofus.graphics.gapi.controls = new Object();
} // end if
var _loc1 = (_global.dofus.graphics.gapi.controls.Smileys = function ()
{
super();
}).prototype;
_loc1.update = function ()
{
this.initData();
};
_loc1.init = function ()
{
super.init(false, dofus.graphics.gapi.controls.Smileys.CLASS_NAME);
};
_loc1.createChildren = function ()
{
this.addToQueue({object: this, method: this.addListeners});
this.addToQueue({object: this, method: this.initData});
};
_loc1.addListeners = function ()
{
this._cgSmileys.addEventListener("selectItem", this);
this._cgEmotes.addEventListener("selectItem", this);
this._cgEmotes.addEventListener("overItem", this);
this._cgEmotes.addEventListener("outItem", this);
this._ldrStreaming.addEventListener("initialization", this);
};
_loc1.initData = function ()
{
var _loc2 = new ank.utils.ExtendedArray();
if (this.api.config.isStreaming)
{
this._ldrStreaming.contentPath = dofus.Constants.SMILEYS_ICONS_PATH + "all.swf";
}
else
{
var _loc3 = 1;
while (++_loc3, _loc3 <= 15)
{
var _loc4 = new Object();
_loc4.iconFile = dofus.Constants.SMILEYS_ICONS_PATH + _loc3 + ".swf";
_loc4.index = _loc3;
_loc2.push(_loc4);
} // end while
this._cgSmileys.dataProvider = _loc2;
} // end else if
var _loc5 = new ank.utils.ExtendedArray();
var _loc6 = this.api.datacenter.Player.Emotes.getItems();
for (var k in _loc6)
{
var _loc7 = new Object();
var _loc8 = Number(k);
_loc7.iconFile = dofus.Constants.EMOTES_ICONS_PATH + _loc8 + ".swf";
_loc7.index = _loc8;
_loc5.push(_loc7);
_loc5.sortOn("index", Array.NUMERIC);
} // end of for...in
this._cgEmotes.dataProvider = _loc5;
};
_loc1.attachSmileys = function ()
{
var _loc2 = 0;
var _loc3 = 0;
var _loc4 = 16;
var _loc5 = 4;
var _loc7 = 1;
while (++_loc7, _loc7 <= 15)
{
var _loc8 = this._ldrStreaming.content.attachMovie(String(_loc7), "smiley" + _loc7, _loc7);
if (_loc8._width > _loc8._height)
{
var _loc6 = _loc8._height / _loc8._width;
_loc8._height = _loc6 * _loc4;
_loc8._width = _loc4;
}
else
{
_loc6 = _loc8._width / _loc8._height;
_loc8._width = _loc6 * _loc4;
_loc8._height = _loc4;
} // end else if
_loc8._x = _loc2 * (_loc4 + _loc5);
_loc8._y = _loc3 * (_loc4 + _loc5);
_loc8.contentData = {index: _loc7};
var ref = this;
_loc8.onRelease = function ()
{
ref.selectItem({target: this, owner: {_name: "_cgSmileys"}});
};
_loc8.onRollOver = function ()
{
this._parent.attachMovie("over", "over", -1);
this._parent.over._x = this._x;
this._parent.over._y = this._y;
};
_loc8.onReleaseOutside = _loc8.onRollOut = function ()
{
this._parent.createEmptyMovieClip("over", -1);
};
++_loc2;
if (_loc2 == 5)
{
_loc2 = 0;
++_loc3;
} // end if
} // end while
};
_loc1.initialization = function (oEvent)
{
this.attachSmileys();
};
_loc1.selectItem = function (oEvent)
{
var _loc3 = oEvent.target.contentData;
if (_loc3 == undefined)
{
return;
} // end if
switch (oEvent.owner._name)
{
case "_cgSmileys":
{
this.dispatchEvent({type: "selectSmiley", index: _loc3.index});
break;
}
case "_cgEmotes":
{
this.dispatchEvent({type: "selectEmote", index: _loc3.index});
break;
}
} // End of switch
};
_loc1.overItem = function (oEvent)
{
var _loc3 = oEvent.target.contentData;
if (_loc3 != undefined)
{
var _loc4 = this.api.lang.getEmoteText(_loc3.index);
var _loc5 = _loc4.n;
var _loc6 = _loc4.s != undefined ? (" (/" + _loc4.s + ")") : ("");
this.gapi.showTooltip(_loc5 + _loc6, oEvent.target, -20);
} // end if
};
_loc1.outItem = function (oEvent)
{
this.gapi.hideTooltip();
};
ASSetPropFlags(_loc1, null, 1);
(_global.dofus.graphics.gapi.controls.Smileys = function ()
{
super();
}).CLASS_NAME = "Smileys";
} // end if
#endinitclip
|
package player.commands
{
public class RequestGohomeCommand extends BasePlayerCommand
{
public function RequestGohomeCommand()
{
super();
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package {
import flash.display.Sprite;
import flashx.textLayout.compose.StandardFlowComposer;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.SelectionManager;
/** Simple example of a text component where the text is selectable but not editable. */
public class SelectText extends Sprite
{
public function SelectText()
{
var markup:String = "<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'><p><span>Hello, World</span></p></TextFlow>";
var textFlow:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT);
textFlow.flowComposer.addController(new ContainerController(this, 200, 50));
textFlow.flowComposer.updateAllControllers();
textFlow.interactionManager = new SelectionManager();
}
}
}
|
package ui.flows
{
import wyverntail.core.Flow;
import wyverntail.ogmo.Level;
public class RootFlow extends Flow
{
private var _frontEndFlow :FrontEndFlow;
private var _inGameFlow :InGameFlow;
public function RootFlow(game :Game)
{
_frontEndFlow = new FrontEndFlow(this, game);
_inGameFlow = new InGameFlow(this, game);
}
override protected function handleEnterState(oldState :int, newState :int) :void
{
switch (newState)
{
case FlowStates.FRONT_END_FLOW:
{
_child = _frontEndFlow;
if (oldState == FlowStates.INIT)
{
// first time entry
_child.changeState(FlowStates.LEGAL_SCREEN);
}
else
{
_child.changeState(FlowStates.TITLE_SCREEN);
}
}
break;
case FlowStates.IN_GAME_FLOW:
{
_child = _inGameFlow;
_inGameFlow.changeState(FlowStates.LOADING);
}
break;
}
}
override public function handleChildDone() :void
{
switch (_state)
{
case FlowStates.IN_GAME_FLOW:
{
changeState(FlowStates.FRONT_END_FLOW);
}
break;
}
}
override public function handleSignal(signal :int, sender :Object, args :Object) :Boolean
{
if (signal == Signals.APP_EXIT)
{
changeState(FlowStates.EXIT);
}
return super.handleSignal(signal, sender, args);
}
} // class
} // package
|
package flash.text {
import flash.events.EventDispatcher;
public dynamic class StyleSheet extends EventDispatcher {
public function get styleNames():Array;
public function StyleSheet();
public function clear():void;
public function getStyle(styleName:String):Object;
public function parseCSS(CSSText:String):void;
public function setStyle(styleName:String, styleObject:Object):void;
public function transform(formatObject:Object):TextFormat;
}
}
|
package org.openapitools.client.model {
import org.openapitools.common.ListWrapper;
public class ClassesByClassList implements ListWrapper {
// This declaration below of _ClassesByClass_obj_class is to force flash compiler to include this class
private var _classesByClass_obj_class: org.openapitools.client.model.ClassesByClass = null;
[XmlElements(name="classesByClass", type="org.openapitools.client.model.ClassesByClass")]
public var classesByClass: Array = new Array();
public function getList(): Array{
return classesByClass;
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2006-2007 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package mx.utils
{
import flash.utils.getQualifiedClassName;
import mx.resources.IResourceManager;
import mx.resources.ResourceManager;
import mx.utils.StringUtil;
[ExcludeClass]
[ResourceBundle("messaging")]
[ResourceBundle("rpc")]
/**
* @private
*/
public class Translator
{
//--------------------------------------------------------------------------
//
// Class constants
//
//--------------------------------------------------------------------------
/**
* @private
*/
private static const TRANSLATORS:Object = {};
//--------------------------------------------------------------------------
//
// Class variables
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//
// Class methods
//
//--------------------------------------------------------------------------
/**
* Assumes the bundle name is the name of the second package
* (e.g foo in mx.foo).
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static function getDefaultInstanceFor(source:Class):Translator
{
var qualifiedName:String = getQualifiedClassName(source);
var firstSeparator:int = qualifiedName.indexOf(".");
var startIndex:int = firstSeparator + 1;
var secondSeparator:int = qualifiedName.indexOf(".", startIndex);
if (secondSeparator < 0)
secondSeparator = qualifiedName.indexOf(":", startIndex);
var bundleName:String =
qualifiedName.slice(startIndex, secondSeparator);
return getInstanceFor(bundleName);
}
/**
* @private
*/
public static function getInstanceFor(bundleName:String):Translator
{
var result:Translator = TRANSLATORS[bundleName];
if (!result)
{
result = new Translator(bundleName);
TRANSLATORS[bundleName] = result;
}
return result;
}
/**
* @private
*/
public static function getMessagingInstance():Translator
{
return getInstanceFor("messaging");
}
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function Translator(bundleName:String)
{
super();
this.bundleName = bundleName;
}
//----------------------------------
// resourceManager
//----------------------------------
/**
* @private
* Storage for the resourceManager instance.
*/
private var _resourceManager:IResourceManager = ResourceManager.getInstance();
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
/**
* @private
*/
private var bundleName:String;
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* @private
*/
public function textOf(key:String, ... rest):String
{
return _resourceManager.getString(bundleName, key, rest);
}
}
}
|
package com.lorentz.SVG.drawing
{
import com.lorentz.SVG.utils.ArcUtils;
import com.lorentz.SVG.utils.Bezier;
import com.lorentz.SVG.utils.FlashPlayerUtils;
import flash.display.GraphicsPathCommand;
import flash.geom.Point;
public class GraphicsPathDrawer implements IDrawer
{
public var commands:Vector.<int>;
public var pathData:Vector.<Number>;
private var _penX:Number = 0;
public function get penX():Number {
return _penX;
}
private var _penY:Number = 0;
public function get penY():Number {
return _penY;
}
public function GraphicsPathDrawer()
{
commands = new Vector.<int>();
pathData = new Vector.<Number>();
}
public function moveTo(x:Number, y:Number):void
{
commands.push(GraphicsPathCommand.MOVE_TO);
pathData.push(x, y);
_penX = x; _penY = y;
}
public function lineTo(x:Number, y:Number):void
{
commands.push(GraphicsPathCommand.LINE_TO);
pathData.push(x, y);
_penX = x; _penY = y;
}
public function curveTo(cx:Number, cy:Number, x:Number, y:Number):void
{
commands.push(GraphicsPathCommand.CURVE_TO);
pathData.push(cx, cy, x, y);
_penX = x; _penY = y;
}
public function cubicCurveTo(cx1:Number, cy1:Number, cx2:Number, cy2:Number, x:Number, y:Number):void
{
if(FlashPlayerUtils.supportsCubicCurves)
{
commands.push(GraphicsPathCommand["CUBIC_CURVE_TO"]);
pathData.push(cx1, cy1, cx2, cy2, x, y);
_penX = x; _penY = y;
} else {
//Convert cubic curve to quadratic curves
var anchor1:Point = new Point(_penX, _penY);
var control1:Point = new Point(cx1, cy1);
var control2:Point = new Point(cx2, cy2);
var anchor2:Point = new Point(x, y);
var bezier:Bezier = new Bezier(anchor1, control1, control2, anchor2);
for each (var quadP:Object in bezier.QPts)
curveTo(quadP.c.x, quadP.c.y, quadP.p.x, quadP.p.y);
}
}
public function arcTo(rx:Number, ry:Number, angle:Number, largeArcFlag:Boolean, sweepFlag:Boolean, x:Number, y:Number):void
{
var ellipticalArc:Object = ArcUtils.computeSvgArc(rx, ry, angle, largeArcFlag, sweepFlag, x, y, _penX, _penY);
var curves:Array = ArcUtils.convertToCurves(ellipticalArc.cx, ellipticalArc.cy, ellipticalArc.startAngle, ellipticalArc.arc, ellipticalArc.radius, ellipticalArc.yRadius, ellipticalArc.xAxisRotation);
// Loop for drawing arc segments
for (var i:int = 0; i<curves.length; i++)
curveTo(curves[i].c.x, curves[i].c.y, curves[i].p.x, curves[i].p.y);
}
}
} |
package cc.milkshape.framework.forms.widgets
{
import com.bourre.plugin.Plugin;
public class WidgetFormTextarea extends WidgetFormText
{
public function WidgetFormTextarea(owner:Plugin = null, name:String = null)
{
super(owner, WidgetFormList.TEXTAREA, name, new TextareaClp());
}
public function get text():String
{
return (view as TextareaClp).label.text;
}
}
} |
package kabam.rotmg.ui.view {
import com.company.assembleegameclient.screens.AccountScreen;
import com.company.assembleegameclient.screens.TitleMenuOption;
import com.company.assembleegameclient.ui.SoundIcon;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.filters.DropShadowFilter;
import flash.text.TextFieldAutoSize;
import kabam.rotmg.account.transfer.view.KabamLoginView;
import kabam.rotmg.core.StaticInjectorContext;
import kabam.rotmg.dialogs.control.OpenDialogSignal;
import kabam.rotmg.text.model.TextKey;
import kabam.rotmg.text.view.TextFieldDisplayConcrete;
import kabam.rotmg.text.view.stringBuilder.LineBuilder;
import kabam.rotmg.text.view.stringBuilder.StaticStringBuilder;
import kabam.rotmg.ui.model.EnvironmentData;
import kabam.rotmg.ui.view.components.DarkLayer;
import kabam.rotmg.ui.view.components.MapBackground;
import kabam.rotmg.ui.view.components.MenuOptionsBar;
import org.osflash.signals.Signal;
import org.osflash.signals.natives.NativeMappedSignal;
public class TitleView extends Sprite {
public static const MIDDLE_OF_BOTTOM_BAND:Number = 589.45;
internal static var TitleScreenGraphic:Class = TitleView_TitleScreenGraphic;
public static var queueEmailConfirmation:Boolean = false;
public static var queuePasswordPrompt:Boolean = false;
public static var queuePasswordPromptFull:Boolean = false;
public static var queueRegistrationPrompt:Boolean = false;
private var versionText:TextFieldDisplayConcrete;
private var copyrightText:TextFieldDisplayConcrete;
private var menuOptionsBar:MenuOptionsBar;
private var data:EnvironmentData;
public var playClicked:Signal;
public var serversClicked:Signal;
public var accountClicked:Signal;
public var legendsClicked:Signal;
public var languagesClicked:Signal;
public var supportClicked:Signal;
public var kabamTransferClicked:Signal;
public var editorClicked:Signal;
public var textureEditorClicked:Signal;
public var quitClicked:Signal;
public var optionalButtonsAdded:Signal;
private var migrateButton:TitleMenuOption;
public function TitleView() {
this.menuOptionsBar = this.makeMenuOptionsBar();
this.optionalButtonsAdded = new Signal();
super();
addChild(new MapBackground());
addChild(new DarkLayer());
addChild(new TitleScreenGraphic());
addChild(this.menuOptionsBar);
addChild(new AccountScreen());
this.makeChildren();
addChild(new SoundIcon());
}
public function openKabamTransferView():void {
var _local1:OpenDialogSignal = StaticInjectorContext.getInjector().getInstance(OpenDialogSignal);
_local1.dispatch(new KabamLoginView());
}
private function makeMenuOptionsBar():MenuOptionsBar {
var _local1:TitleMenuOption = ButtonFactory.getPlayButton();
var _local2:TitleMenuOption = ButtonFactory.getServersButton();
var _local3:TitleMenuOption = ButtonFactory.getAccountButton();
var _local4:TitleMenuOption = ButtonFactory.getLegendsButton();
var _local5:TitleMenuOption = ButtonFactory.getSupportButton();
var _local6:TitleMenuOption = ButtonFactory.getTextureEditorButton();
this.playClicked = _local1.clicked;
this.serversClicked = _local2.clicked;
this.accountClicked = _local3.clicked;
this.legendsClicked = _local4.clicked;
this.supportClicked = _local5.clicked;
this.textureEditorClicked = _local6.clicked;
var _local7:MenuOptionsBar = new MenuOptionsBar();
_local7.addButton(_local1, MenuOptionsBar.CENTER);
_local7.addButton(_local2, MenuOptionsBar.LEFT);
_local7.addButton(_local5, MenuOptionsBar.LEFT);
_local7.addButton(_local3, MenuOptionsBar.RIGHT);
_local7.addButton(_local4, MenuOptionsBar.RIGHT);
_local7.addButton(_local6, MenuOptionsBar.LEFT);
return (_local7);
}
private function makeChildren():void {
this.versionText = this.makeText().setHTML(true).setAutoSize(TextFieldAutoSize.LEFT).setVerticalAlign(TextFieldDisplayConcrete.MIDDLE);
this.versionText.y = MIDDLE_OF_BOTTOM_BAND;
addChild(this.versionText);
this.copyrightText = this.makeText().setHTML(true).setAutoSize(TextFieldAutoSize.RIGHT).setVerticalAlign(TextFieldDisplayConcrete.MIDDLE);
this.copyrightText.setStringBuilder(new LineBuilder().setParams(TextKey.COPYRIGHT));
this.copyrightText.filters = [new DropShadowFilter(0, 0, 0)];
this.copyrightText.x = 800;
this.copyrightText.y = MIDDLE_OF_BOTTOM_BAND;
addChild(this.copyrightText);
}
public function makeText():TextFieldDisplayConcrete {
var _local1:TextFieldDisplayConcrete = new TextFieldDisplayConcrete().setSize(12).setColor(0xB2B2B2);
_local1.filters = [new DropShadowFilter(0, 0, 0)];
return (_local1);
}
public function initialize(_arg1:EnvironmentData):void {
this.data = _arg1;
this.updateVersionText();
this.handleOptionalButtons();
}
public function putNoticeTagToOption(_arg1:TitleMenuOption, _arg2:String, _arg3:int = 14, _arg4:uint = 10092390, _arg5:Boolean = true):void {
_arg1.createNoticeTag(_arg2, _arg3, _arg4, _arg5);
}
private function updateVersionText():void {
this.versionText.setStringBuilder(new StaticStringBuilder(this.data.buildLabel));
}
private function handleOptionalButtons():void {
((this.data.canMapEdit) && (this.createEditorButton()));
//((this.data.isDesktop) && (this.createQuitButton()));
this.optionalButtonsAdded.dispatch();
}
private function createQuitButton():void {
var _local1:TitleMenuOption = ButtonFactory.getQuitButton();
this.menuOptionsBar.addButton(_local1, MenuOptionsBar.RIGHT);
this.quitClicked = _local1.clicked;
}
private function createEditorButton():void {
var _local1:TitleMenuOption = ButtonFactory.getEditorButton();
this.menuOptionsBar.addButton(_local1, MenuOptionsBar.RIGHT);
this.editorClicked = _local1.clicked;
}
private function makeMigrateButton():void {
this.migrateButton = new TitleMenuOption("Want to migrate your Kabam.com account?", 16, false);
this.migrateButton.setAutoSize(TextFieldAutoSize.CENTER);
this.kabamTransferClicked = new NativeMappedSignal(this.migrateButton, MouseEvent.CLICK);
this.migrateButton.setTextKey("Want to migrate your Kabam.com account?");
this.migrateButton.x = 400;
this.migrateButton.y = 500;
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package spark.components
{
/* import flash.display.DisplayObject;
import flash.display.InteractiveObject;
import flash.display.StageDisplayState;
import flash.events.ContextMenuEvent;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.FullScreenEvent;
import flash.events.SoftKeyboardEvent;
import flash.events.UncaughtErrorEvent;
import flash.external.ExternalInterface;
import flash.geom.Rectangle;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.system.Capabilities;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.utils.Dictionary;
import flash.utils.setInterval; */
/*
import mx.core.EventPriority;
import mx.core.IInvalidating;
import mx.core.InteractionMode;
import mx.core.Singleton;
import mx.core.UIComponentGlobals;
import mx.managers.FocusManager;
import mx.managers.IActiveWindowManager;
import mx.managers.ILayoutManager;
import mx.managers.ISystemManager;
import mx.managers.SystemManager;
import mx.managers.ToolTipManager;
import mx.utils.BitFlagUtil;
import mx.utils.DensityUtil;
import mx.utils.LoaderUtil;
import mx.utils.Platform;
import spark.layouts.supportClasses.LayoutBase; */
COMPILE::SWF {
import flash.system.ApplicationDomain;
import flash.utils.getQualifiedClassName;
}
import mx.core.mx_internal;
import mx.core.FlexGlobals;
import mx.core.IUIComponent;
import mx.events.utils.MouseEventConverter;
import mx.managers.ISystemManager;
COMPILE::JS {
import org.apache.royale.core.ElementWrapper;
import org.apache.royale.events.ElementEvents;
}
import org.apache.royale.binding.ContainerDataBinding;
import org.apache.royale.core.AllCSSValuesImpl;
import org.apache.royale.core.IFlexInfo;
import org.apache.royale.core.ILayoutHost;
import org.apache.royale.core.IParent;
import org.apache.royale.core.IPopUpHost;
import org.apache.royale.core.IPopUpHostParent;
import org.apache.royale.core.IRenderedObject;
import org.apache.royale.core.IStatesImpl;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.IValuesImpl;
import org.apache.royale.core.ValuesManager;
import org.apache.royale.events.IEventDispatcher;
import org.apache.royale.reflection.beads.ClassAliasBead;
import spark.core.ISparkLayoutHost;
use namespace mx_internal;
//--------------------------------------
// Events
//--------------------------------------
/**
* Dispatched after the Application has been initialized,
* processed by the LayoutManager, and attached to the display list.
*
* @eventType mx.events.FlexEvent.APPLICATION_COMPLETE
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
[Event(name="applicationComplete", type="mx.events.FlexEvent")]
/**
* Dispatched when an HTTPService call fails.
*
* @eventType flash.events.ErrorEvent.ERROR
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
[Event(name="error", type="flash.events.ErrorEvent")]
/**
* Dispatched when an uncaught error is caught by the Global Exception Handler
*
* @eventType flash.events.UncaughtErrorEvent.UNCAUGHT_ERROR
*
* @langversion 3.0
* @playerversion Flash 10.1
* @playerversion AIR 2.0
* @productversion Flex 4.5
*/
[Event(name="uncaughtError", type="flash.events.UncaughtErrorEvent")]
//--------------------------------------
// Styles
//--------------------------------------
/**
* The background color of the application. This color is used as the stage color for the
* application and the background color for the HTML embed tag.
*
* @default 0x464646
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
[Style(name="backgroundColor", type="uint", format="Color", inherit="no")]
/**
* Height in pixels left for os top status bar display.
* <p>Status bar height is set by default to 20 pixels (at 160 DPI) for iOS7, on the following default skins: </p>
* <ul>
* <li>>skins.spark.ApplicationSkin</li>
* <li>spark.skins.mobile.TabbedViewNavigatorApplicationSkin</li>
* <li>spark.skins.mobile.ViewNavigatorApplicationSkin</li>
* </ul>
*/
[Style(name="osStatusBarHeight", type="Number", format="Length", inherit="no", theme="mobile")]
//--------------------------------------
// Excluded APIs
//--------------------------------------
[Exclude(name="direction", kind="property")]
[Exclude(name="tabIndex", kind="property")]
[Exclude(name="toolTip", kind="property")]
[Exclude(name="x", kind="property")]
[Exclude(name="y", kind="property")]
//--------------------------------------
// Other metadata
//--------------------------------------
/**
* The frameworks must be initialized by SystemManager.
* This factoryClass will be automatically subclassed by any
* MXML applications that don't explicitly specify a different
* factoryClass.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
[Frame(factoryClass="mx.managers.SystemManager")]
//[ResourceBundle("components")]
/**
* Flex defines a default, or Application, container that lets you start
* adding content to your application without explicitly defining
* another container.
*
* <p>The Application container has the following default characteristics:</p>
* <table class="innertable">
* <tr>
* <th>Characteristic</th>
* <th>Description</th>
* </tr>
* <tr>
* <td>Default size</td>
* <td>375 pixels high and 500 pixels wide in the Standalone Flash Player,
* and all available space in a browser</td>
* </tr>
* <tr>
* <td>Minimum size</td>
* <td>0 pixels wide and 0 pixels high</td>
* </tr>
* <tr>
* <td>Maximum size</td>
* <td>No limit</td>
* </tr>
* <tr>
* <td>Default skin class</td>
* <td>spark.skins.spark.ApplicationSkin</td>
* </tr>
* </table>
*
* @mxml
*
* <p>The <code><s:Application></code> tag inherits all of the tag
* attributes of its superclass and adds the following tag attributes:</p>
*
* <pre>
* <s:Application
* <strong>Properties</strong>
* applicationDPI=<i>Device dependent</i>"
* backgroundColor="0xFFFFFF"
* colorCorrection="default"
* controlBarContent="null"
* controlBarLayout="HorizontalLayout"
* controlBarVisible="true"
* frameRate="24"
* pageTitle""
* preloader="<i>No default</i>"
* preloaderChromeColor="<i>No default</i>"
* resizeForSoftKeyboard=true"
* runtimeDPIProvider="RuntimeDPIProvider"
* scriptRecursionLimit="1000"
* scriptTimeLimit="60"
* splashScreenImage=""
* splashScreenMinimumDisplayTime="1000"
* splashScreenScaleMode="none"
* usePreloader="true"
* viewSourceURL=""
* xmlns:<i>No default</i>="<i>No default</i>"
*
* <strong>Events</strong>
* applicationComplete="<i>No default</i>"
* error="<i>No default</i>"
* />
* </pre>
*
* @see spark.skins.spark.ApplicationSkin
* @includeExample examples/ApplicationContainerExample.mxml
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public class Application extends SkinnableContainer implements IStrand, IParent, IEventDispatcher, IPopUpHost, IPopUpHostParent, IRenderedObject, IFlexInfo
{
// include "../core/Version.as";
//--------------------------------------------------------------------------
//
// Class constants
//
//--------------------------------------------------------------------------
/**
* @private
*/
// private static const CONTROLBAR_PROPERTY_FLAG:uint = 1 << 0;
/**
* @private
*/
// private static const LAYOUT_PROPERTY_FLAG:uint = 1 << 1;
/**
* @private
*/
// private static const VISIBLE_PROPERTY_FLAG:uint = 1 << 2;
//--------------------------------------------------------------------------
//
// Class properties
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public function Application()
{
/* UIComponentGlobals.layoutManager = ILayoutManager(
Singleton.getInstance("mx.managers::ILayoutManager"));
UIComponentGlobals.layoutManager.usePhasedInstantiation = true;
*/
if (!FlexGlobals.topLevelApplication)
FlexGlobals.topLevelApplication = this;
super();
/* showInAutomationHierarchy = true;
initResizeBehavior(); */
this.valuesImpl = new AllCSSValuesImpl();
addBead(new ContainerDataBinding());
addBead(new ClassAliasBead());
COMPILE::JS
{
ElementWrapper.converterMap["MouseEvent"] = MouseEventConverter.convert;
}
}
private var _info:Object;
/**
* An Object containing information generated
* by the compiler that is useful at startup time.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function info():Object
{
COMPILE::SWF
{
if (!_info)
{
var mainClassName:String = getQualifiedClassName(this);
var initClassName:String = "_" + mainClassName + "_FlexInit";
var c:Class = ApplicationDomain.currentDomain.getDefinition(initClassName) as Class;
_info = c.info();
}
}
return _info;
}
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
/**
* The org.apache.royale.core.IValuesImpl that will
* determine the default values and other values
* for the application. The most common choice
* is org.apache.royale.core.SimpleCSSValuesImpl.
*
* @see org.apache.royale.core.SimpleCSSValuesImpl
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function set valuesImpl(value:IValuesImpl):void
{
ValuesManager.valuesImpl = value;
ValuesManager.valuesImpl.init(this);
}
/**
* @private
* Variable that determines whether this application is running on iOS.
*/
// private var isIOS:Boolean = false;
/**
* @private
* This variable stores the last object that received the SOFT_KEYBOARD_ACTIVATE
* event.
*/
// private var softKeyboardTarget:Object = null;
/**
* @private
* Flag set to true if the application has temporarily set its explicit
* width and height to deal with orientation.
*/
// private var explicitSizingForOrientation:Boolean = false;
/**
* @private
* Caches the application's width and height values for better resizing
* of the screen during orientation changes. Keys are composed of the width and
* height values in a string of the form "w:h", e.g. "1004:768" and represent
* the screen dimensions before the orientation change. Values are
* objects containing width and height properties that represent the screen dimensions
* after the orientation change.
*/
// private var cachedDimensions:Dictionary;
/**
* @private
* Previous width of the application prior to an orientation change
*/
// private var previousWidth:Number;
/**
* @private
* Previous height of the application prior to an orientation change
*/
// private var previousHeight:Number;
/**
* @private
* Flag to determine if the keyboard is active during an orientation change,
* to minimize renders during the orientation change.
*/
// private var keyboardActiveInOrientationChange:Boolean = false;
/**
* @private
*/
// private var resizeHandlerAdded:Boolean = false;
/**
* @private
*/
// private var percentBoundsChanged:Boolean;
/**
* @private
* Placeholder for Preloader object reference.
*/
// private var preloadObj:Object;
/**
* @private
* This flag indicates whether the width of the Application instance
* can change or has been explicitly set by the developer.
* When the stage is resized we use this flag to know whether the
* width of the Application should be modified.
*/
// private var resizeWidth:Boolean = true;
/**
* @private
* This flag indicates whether the height of the Application instance
* can change or has been explicitly set by the developer.
* When the stage is resized we use this flag to know whether the
* height of the Application should be modified.
*/
// private var resizeHeight:Boolean = true;
/**
* @private
*/
// private static var _softKeyboardBehavior:String = null;
/**
* @private
*/
// mx_internal var isSoftKeyboardActive:Boolean = false;
/**
* @private
*/
// private var synchronousResize:Boolean = false;
/**
* @private
* (Possibly null) reference to the View Source context menu item,
* so that we can update it for runtime localization.
*/
// private var viewSourceCMI:ContextMenuItem;
/**
* @private
* Return the density scaling factor for the application
*/
/* private function get scaleFactor():Number
{
if (systemManager)
return (systemManager as SystemManager).densityScale;
return 1;
} */
//----------------------------------
// colorCorrection
//----------------------------------
// [Inspectable(enumeration="default,off,on", defaultValue="default" )]
/**
* The value of the stage's <code>colorCorrection</code> property.
* If this application does not have access to the stage's <code>colorCorrection</code> property,
* the value of the <code>colorCorrection</code> property is <code>null</code>.
*
* <p>Only the main application is allowed to set the <code>colorCorrection</code>
* property. If a nested application's needs to set the color correction property, it
* must set it by referencing the main application's instance.</p>
*
* @default ColorCorrection.DEFAULT
*
* @see flash.display.ColorCorrection
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
/* public function get colorCorrection():String
{
try
{
var sm:ISystemManager = systemManager;
if (sm && sm.stage)
return sm.stage.colorCorrection;
}
catch (e:SecurityError)
{
// ignore error if this application is not allow
// to view the colorCorrection property.
}
return null;
}
*/
/**
* @private
*/
/* public function set colorCorrection(value:String):void
{
// Since only the main application is allowed to change the value this property, there
// is no need to catch security violations like in the getter.
var sm:ISystemManager = systemManager;
if (sm && sm.stage && sm.isTopLevelRoot())
sm.stage.colorCorrection = value;
} */
/**
* @private
* Several properties are proxied to controlBarGroup. However, when controlBarGroup
* is not around, we need to store values set on SkinnableContainer. This object
* stores those values. If controlBarGroup is around, the values are stored
* on the controlBarGroup directly. However, we need to know what values
* have been set by the developer on the SkinnableContainer (versus set on
* the controlBarGroup or defaults of the controlBarGroup) as those are values
* we want to carry around if the controlBarGroup changes (via a new skin).
* In order to store this info effeciently, controlBarGroupProperties becomes
* a uint to store a series of BitFlags. These bits represent whether a
* property has been explicitely set on this SkinnableContainer. When the
* controlBarGroup is not around, controlBarGroupProperties is a typeless
* object to store these proxied properties. When controlBarGroup is around,
* controlBarGroupProperties stores booleans as to whether these properties
* have been explicitely set or not.
*/
// private var controlBarGroupProperties:Object = { visible: true };
//----------------------------------
// controlBarGroup
//----------------------------------
// [SkinPart(required="false")]
/**
* The skin part that defines the appearance of the
* control bar area of the container.
* By default, the ApplicationSkin class defines the control bar area to appear at the top
* of the content area of the Application container with a grey background.
*
* @see spark.skins.spark.ApplicationSkin
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
// public var controlBarGroup:Group;
//----------------------------------
// controlBarContent
//----------------------------------
// [ArrayElementType("mx.core.IVisualElement")]
/**
* The set of components to include in the control bar area of the
* Application container.
* The location and appearance of the control bar area of the Application container
* is determined by the spark.skins.spark.ApplicationSkin class.
* By default, the ApplicationSkin class defines the control bar area to appear at the top
* of the content area of the Application container with a grey background.
* Create a custom skin to change the default appearance of the control bar.
*
* @default null
*
* @see spark.skins.spark.ApplicationSkin
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
/* public function get controlBarContent():Array
{
if (controlBarGroup)
return controlBarGroup.getMXMLContent();
else
return controlBarGroupProperties.controlBarContent;
} */
/**
* @private
*/
/* public function set controlBarContent(value:Array):void
{
if (controlBarGroup)
{
controlBarGroup.mxmlContent = value;
controlBarGroupProperties = BitFlagUtil.update(controlBarGroupProperties as uint,
CONTROLBAR_PROPERTY_FLAG, value != null);
}
else
controlBarGroupProperties.controlBarContent = value;
invalidateSkinState();
} */
//----------------------------------
// controlBarLayout
//----------------------------------
/**
* Defines the layout of the control bar area of the container.
*
* @default HorizontalLayout
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
/* public function get controlBarLayout():LayoutBase
{
return (controlBarGroup)
? controlBarGroup.layout
: controlBarGroupProperties.layout;
}
public function set controlBarLayout(value:LayoutBase):void
{
if (controlBarGroup)
{
controlBarGroup.layout = value;
controlBarGroupProperties = BitFlagUtil.update(controlBarGroupProperties as uint,
LAYOUT_PROPERTY_FLAG, true);
}
else
controlBarGroupProperties.layout = value;
} */
//----------------------------------
// controlBarVisible
//----------------------------------
/**
* If <code>true</code>, the control bar is visible.
* The flag has no affect if there is no value set for
* the <code>controlBarContent</code> property.
*
* <p><b>Note:</b> The Application container does not monitor the
* <code>controlBarGroup</code> property.
* If other code makes it invisible, the Application container might
* not update correctly.</p>
*
* @default true
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public function get controlBarVisible():Boolean
{
/*return (controlBarGroup)
? controlBarGroup.visible
: controlBarGroupProperties.visible;*/
trace("Application::controlBarVisible not implemented")
return true;
}
public function set controlBarVisible(value:Boolean):void
{
/* if (controlBarGroup)
{
controlBarGroup.visible = value;
controlBarGroupProperties = BitFlagUtil.update(controlBarGroupProperties as uint,
VISIBLE_PROPERTY_FLAG, value);
}
else
controlBarGroupProperties.visible = value;
invalidateSkinState();
if (skin)
skin.invalidateSize(); */
trace("Application::controlBarVisible not implemented")
}
//--------------------------------------------------------------------------
//
// Compile-time pseudo-properties
//
//--------------------------------------------------------------------------
// These declarations correspond to the MXML-compile-time attributes
// allowed on the <Application> tag. These attributes affect the MXML
// compiler, but they aren't actually used in the runtime framework.
// The declarations appear here in order to provide metadata about these
// attributes for Flash Builder.
//----------------------------------
// frameRate
//----------------------------------
// [Inspectable(defaultValue="24")]
/**
* Specifies the frame rate of the application.
*
* <p><b>Note:</b> This property cannot be set by ActionScript code; it must be set in MXML code.</p>
*
* @default 24
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
// public var frameRate:Number;
//----------------------------------
// pageTitle
//----------------------------------
/**
* Specifies a string that appears in the title bar of the browser.
* This property provides the same functionality as the
* HTML <code><title></code> tag.
*
* <p><b>Note:</b> This property cannot be set by ActionScript code; it must be set in MXML code.
* The value set in MXML code is designed to be used by a tool to update the HTML templates
* provided with the SDK.</p>
*
* @default ""
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
// public var pageTitle:String;
//----------------------------------
// preloader
//----------------------------------
// [Inspectable(defaultValue="mx.preloaders.DownloadProgressBar")]
/**
* The application container supports an application preloader that
* uses a download progress bar to show the download and initialization progress
* of an application SWF file.
* By default, the application preloader is enabled.
* The preloader tracks how many bytes have been downloaded and continually
* updates the progress bar.
*
* <p>Use this property to specify the path of a
* component that defines a custom progress indicator.
* To create a custom progress indicator, you typically create a subclass of the
* SparkDownloadProgressBar or DownloadProgressBar class, or create a subclass of
* the flash.display.Sprite class that implements the
* mx.preloaders.IPreloaderDisplay interface. </p>
*
* <p><b>Note:</b> This property cannot be set by ActionScript code; it must be set in MXML code.</p>
*
* @see mx.preloaders.SparkDownloadProgressBar
* @see mx.preloaders.DownloadProgressBar
* @see flash.display.Sprite
* @see mx.preloaders.IPreloaderDisplay
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
// public var preloader:Object;
//----------------------------------
// preloaderChromeColor
//----------------------------------
// [Inspectable(defaultValue="0xCCCCCC", format="Color")]
/**
* Specifies the chrome color used by the default preloader component. This property
* has the same effect as the <code>chromeColor</code> style used by Spark skins.
* Typically this property should be set to the same value as the
* Application container's <code>chromeColor</code> style property.
*
* <p>Note: This property cannot be set by ActionScript code; it must be set in MXML code.</p>
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
/* This property is not directly read by the download progress bar (preloader)
* component. It is here so that it gets picked up by the compiler and included
* in the info() structure for the generated system manager. The download progress bar
* grabs the value directly from the info() structure. */
// public var preloaderChromeColor:uint;
//----------------------------------
// scriptRecursionLimit
//----------------------------------
// [Inspectable(defaultValue="1000")]
/**
* Specifies the maximum depth of Flash Player or AIR
* call stack before the player stops.
* This is essentially the stack overflow limit.
*
* <p><b>Note:</b> This property cannot be set by ActionScript code; it must be set in MXML code.</p>
*
* @default 1000
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
// public var scriptRecursionLimit:int;
//----------------------------------
// scriptTimeLimit
//----------------------------------
// [Inspectable(defaultValue="60")]
/**
* Specifies the maximum duration, in seconds, that an ActionScript
* event handler can execute before Flash Player or AIR assumes
* that it is hung, and aborts it.
* The maximum allowable value that you can set is 60 seconds.
*
* @default 60
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
// public var scriptTimeLimit:Number;
//----------------------------------
// splashScreenImage
//----------------------------------
/**
* The image class for the SplashScreen preloader.
* Typically you set this property to either an embedded resource
* or the name of a <code>SplashScreenImage</code> class defined in a separate MXML file.
* Example of setting splashScreenImage to an embedded image:
*
* <pre>splashScreenImage="@Embed('Default.png')"</pre>
*
* <p><b>Note:</b> The property has effect only when the <code>preloader</code>
* property is set to spark.preloaders.SplashScreen.
* The spark.preloaders.SplashScreen class is the default preloader for Mobile Flex applications.
* This property cannot be set by ActionScript code; it must be set in MXML code.</p>
*
* <p><b>Note:</b> You must add the frameworks\libs\mobile\mobilecomponents.swc to the
* library path of the application to support the splash screen in a desktop application.</p>
*
* @see spark.preloaders.SplashScreen
* @see #splashScreenScaleMode
* @see #splashScreenMinimumDisplayTime
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
/* public function get splashScreenImage():Class
{
// When set through mxml, the compiler uses the value in the generated loader class.
return systemManager.info()["splashScreenImage"];
} */
/**
* @private
*/
/* public function set splashScreenImage(value:Class):void
{
systemManager.info()["splashScreenImage"] = value;
} */
//----------------------------------
// splashScreenScaleMode
//----------------------------------
// [Inspectable(enumeration="none,letterbox,stretch,zoom", defaultValue="none")]
/**
* The splash screen image scale mode:
*
* <ul>
* <li>A value of <code>none</code> implies that the image size is set
* to match its intrinsic size.</li>
*
* <li>A value of <code>stretch</code> sets the width and the height of the image to the
* stage width and height, possibly changing the content aspect ratio.</li>
*
* <li>A value of <code>letterbox</code> sets the width and height of the image
* as close to the stage width and height as possible while maintaining aspect ratio.
* The image is stretched to a maximum of the stage bounds,
* with spacing added inside the stage to maintain the aspect ratio if necessary.</li>
*
* <li>A value of <code>zoom</code> is similar to <code>letterbox</code>, except
* that <code>zoom</code> stretches the image past the bounds of the stage,
* to remove the spacing required to maintain aspect ratio.
* This setting has the effect of using the entire bounds of the stage, but also
* possibly cropping some of the image.</li>
* </ul>
*
* <p>The portion of the stage that is not covered by the image shows
* in the Application container's <code>backgroundColor</code>.</p>
*
* <p><b>Note:</b> The property has effect only when the <code>splashScreenImage</code> property
* is set and the <code>preloader</code> property is set to spark.preloaders.SplashScreen.
* The spark.preloaders.SplashScreen class is the default preloader for Mobile Flex applications.
* This property cannot be set by ActionScript code; it must be set in MXML code.</p>
*
* <p><b>Note:</b> You must add the frameworks\libs\mobile\mobilecomponents.swc to the
* library path of the application to support the splash screen in a desktop application.</p>
*
* @default "none"
* @see #splashScreenImage
* @see #splashScreenMinimumDisplayTime
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
// public var splashScreenScaleMode:String;
//----------------------------------
// splashScreenMinimumDisplayTime
//----------------------------------
/**
* Minimum amount of time, in milliseconds, to show the splash screen image.
* Specify the splash screen image by using the <code>splashScreenImage</code> property.
*
* <p><b>Note:</b> The property has effect only when the <code>splashScreenImage</code> property
* is set and the <code>preloader</code> property is set to spark.preloaders.SplashScreen.
* The spark.preloaders.SplashScreen class is the default preloader for Mobile Flex applications.
* This property cannot be set by ActionScript code; it must be set in MXML code.</p>
*
* <p><b>Note:</b> You must add the frameworks\libs\mobile\mobilecomponents.swc to the
* library path of the application to support the splash screen in a desktop application.</p>
*
* @default 1000
*
* @see #splashScreenImage
* @see #splashScreenScaleMode
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
// public var splashScreenMinimumDisplayTime:Number;
//----------------------------------
// applicationDPI
//----------------------------------
/**
* Storage for the applicationDPI property.
*
* @private
*/
/* private var _applicationDPI:Number = NaN;
[Inspectable(category="General", enumeration="120,160,240,320,480,640")]
*/
/**
* The DPI of the application.
*
* By default, this is the DPI of the device that the application is currently running on.
*
* When set in MXML, Flex will scale the Application to match its DPI to the
* <code>runtimeDPI</code>.
*
* This property cannot be set by ActionScript code; it must be set in MXML code.
*
* @see #runtimeDPI
* @see mx.core.DPIClassification
*
* @langversion 3.0
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
/* public function get applicationDPI():Number
{
if (isNaN(_applicationDPI))
{
var value:String = systemManager.info()["applicationDPI"];
_applicationDPI = value ? Number(value) : runtimeDPI;
}
return _applicationDPI;
} */
/**
* @private
*/
/* public function set applicationDPI(value:Number):void
{
// Can't change at run-time so do nothing here.
// The compiler will propagate the MXML value to the
// systemManager's info object.
} */
//----------------------------------
// runtimeDPI
//----------------------------------
/**
* The DPI of the device the application is currently running on.
*
* Flex rounds the value to one of the <code>DPIClassification</code> choices.
*
* @see #applicationDPI
* @see mx.core.DPIClassification
*
* @langversion 3.0
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
/* public function get runtimeDPI():Number
{
return DensityUtil.getRuntimeDPI();
} */
//----------------------------------
// runtimeDPIProvider
//----------------------------------
/**
* A class that extends RuntimeDPIProvider and overrides the default Flex
* calculations for <code>runtimeDPI</code>.
*
* <p>Flex's default mappings are:
* <table class="innertable">
* <tr><td>160 DPI</td><td><140 DPI</td></tr>
* <tr><td>160 DPI</td><td>>=140 DPI and <=200 DPI</td></tr>
* <tr><td>240 DPI</td><td>>=200 DPI and <=280 DPI</td></tr>
* <tr><td>320 DPI</td><td>>=280 DPI and <=400 DPI</td></tr>
* <tr><td>480 DPI</td><td>>=400 DPI and <=560 DPI</td></tr>
* <tr><td>640 DPI</td><td>>=640 DPI</td></tr>
* </table>
* </p>
*
* This property cannot be set by ActionScript code; it must be set in MXML code.
*
* @default spark.components.RuntimeDPIProvider
*
* @see #applicationDPI
* @see #runtimeDPI
* @see mx.core.DPIClassification
* @see mx.core.RuntimeDPIProvider
*
* @langversion 3.0
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
/* public function get runtimeDPIProvider():Class
{
return systemManager.info()["runtimeDPIProvider"];
} */
/**
* @private
*/
/* public function set runtimeDPIProvider(value:Class):void
{
// Can't change at run-time so do nothing here.
// The compiler will propagate the MXML value to the
// systemManager's info object.
} */
//----------------------------------
// usePreloader
//----------------------------------
// [Inspectable(defaultValue="true")]
/**
* If <code>true</code>, specifies to display the application preloader.
*
* <p><b>Note:</b> This property cannot be set by ActionScript code; it must be set in MXML code.</p>
*
* @default true
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
// public var usePreloader:Boolean;
//--------------------------------------------------------------------------
//
// Overridden properties (to block metadata from superclasses)
//
//--------------------------------------------------------------------------
//----------------------------------
// id
//----------------------------------
// [Inspectable(environment="none")]
/**
* @private
*/
/* override public function get id():String
{
if (!super.id &&
this == FlexGlobals.topLevelApplication &&
ExternalInterface.available)
{
return ExternalInterface.objectID;
}
return super.id;
} */
//----------------------------------
// percentHeight
//----------------------------------
/**
* @private
*/
/* override public function set percentHeight(value:Number):void
{
if (value != super.percentHeight)
{
super.percentHeight = value;
percentBoundsChanged = true;
invalidateProperties();
}
} */
//----------------------------------
// percentWidth
//----------------------------------
/**
* @private
*/
/* override public function set percentWidth(value:Number):void
{
if (value != super.percentWidth)
{
super.percentWidth = value;
percentBoundsChanged = true;
invalidateProperties();
}
} */
//----------------------------------
// tabIndex
//----------------------------------
// [Inspectable(environment="none")]
/**
* @private
*/
// override public function set tabIndex(value:int):void
// {
// }
//----------------------------------
// toolTip
//----------------------------------
// [Inspectable(environment="none")]
/**
* @private
*/
/* override public function set toolTip(value:String):void
{
} */
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
//----------------------------------
// aspectRatio
//----------------------------------
/**
* Returns the aspect ratio of the top level stage based on its width
* and height. If the width of the stage is greater than the height,
* the stage is considered to be in "landscape" orientation. Otherwise,
* portrait is returned.
*
* @return This method will return "landscape" if the application is
* in a landsacpe orientation, and "portrait" otherwise.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
/* public function get aspectRatio():String
{
var actualHeight:Number = height;
// If the application has resized itself in response to the
// softKeyboard becoming visible, we need to compare against
// the height without the keyboard active
if (isSoftKeyboardActive && softKeyboardBehavior == "none" && resizeForSoftKeyboard)
actualHeight += softKeyboardRect.height;
return width > actualHeight ? "landscape" : "portrait";
} */
//----------------------------------
// parameters
//----------------------------------
private var _parameters:Object;
/**
* The parameters property returns an Object containing name-value
* pairs representing the parameters provided to this Application.
*
* <p>You can use a for-in loop to extract all the names and values
* from the parameters Object.</p>
*
* <p>There are two sources of parameters: the query string of the
* Application's URL, and the value of the FlashVars HTML parameter
* (this affects only the main Application).</p>
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get parameters():Object
{
COMPILE::SWF
{
return loaderInfo.parameters;
}
COMPILE::JS
{
if (!_parameters)
{
_parameters = {};
var query:String = location.search.substring(1);
if(query)
{
var vars:Array = query.split("&");
for (var i:int=0;i<vars.length;i++) {
var pair:Array = vars[i].split("=");
_parameters[pair[0]] = decodeURIComponent(pair[1]);
}
}
}
return _parameters;
}
}
public function set parameters(value:Object):void
{
// do nothing in SWF. It is determined by loaderInfo.
COMPILE::JS
{
_parameters = value;
}
}
//----------------------------------
// resizeForSoftKeyboard
//----------------------------------
// private var _resizeForSoftKeyboard:Boolean = false;
/**
* Some devices do not support a hardware keyboard.
* Instead, these devices use a keyboard that opens on
* the screen when necessary.
* The screen keyboard, also called a soft or virtual keyboard,
* closes after the user enters the information, or when the user cancels the operation.
* A value of <code>true</code> means the application
* is resized when the soft keyboard is open or
* closed.
*
* <p>To enable application resizing, you must also set the
* <code><softKeyboardBehavior></code> attribute in the
* application's xml descriptor file to <code>none</code>.</p>
*
* @default false
*
* @langversion 3.0
* @playerversion AIR 2.5
* @productversion Flex 4.5
*/
/* public function get resizeForSoftKeyboard():Boolean
{
return _resizeForSoftKeyboard;
}
public function set resizeForSoftKeyboard(value:Boolean):void
{
if (_resizeForSoftKeyboard != value)
{
_resizeForSoftKeyboard = value;
}
} */
//----------------------------------
// url
//----------------------------------
/**
* @private
* Storage for the url property.
* This variable is set in the initialize().
*/
mx_internal var _url:String;
/**
* The URL from which this Application's SWF file was loaded.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public function get url():String
{
return _url;
}
//----------------------------------
// viewSourceURL
//----------------------------------
/**
* @private
* Storage for viewSourceURL property.
*/
// private var _viewSourceURL:String;
/**
* URL where the application's source can be viewed. Setting this
* property inserts a "View Source" menu item into the application's
* default context menu. Selecting the menu item opens the
* <code>viewSourceURL</code> in a new window.
*
* <p>You must set the <code>viewSourceURL</code> property
* using MXML, not using ActionScript, as the following example shows:</p>
*
* <pre>
* <Application viewSourceURL="http://path/to/source">
* ...
* </Application></pre>
*
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
/* public function get viewSourceURL():String
{
return _viewSourceURL;
} */
/**
* @private
*/
/* public function set viewSourceURL(value:String):void
{
_viewSourceURL = value;
} */
//--------------------------------------------------------------------------
//
// Overridden methods: UIComponent
//
//--------------------------------------------------------------------------
/**
* @private
*/
/* override protected function invalidateParentSizeAndDisplayList():void
{
if (!includeInLayout)
return;
var p:IInvalidating = parent as IInvalidating;
if (!p)
{
if (parent is ISystemManager)
ISystemManager(parent).invalidateParentSizeAndDisplayList();
return;
}
super.invalidateParentSizeAndDisplayList();
} */
/**
* @private
*/
override public function initialize():void
{
// trace("FxApp initialize FxApp");
/*
var sm:ISystemManager = systemManager;
// add listener if one is already attached
if (hasEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR))
systemManager.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorRedispatcher);
// Determine if we are running on an iOS device
isIOS = Platform.isIOS;
// To prevent a flicker described in SDK-30133, a flex application listens
// for orientationChanging events dispatched by iOS AIR applications.
// In the handler, the stage's width and height are swapped, and a validation
// pass is forced to allow the application to resize and re-layout itself before the
// orientation change animation occurs
if (isIOS && sm && sm.stage && sm.isTopLevelRoot())
{
sm.stage.addEventListener("orientationChanging", stage_orientationChangingHandler);
sm.stage.addEventListener("orientationChange", stage_orientationChange);
sm.stage.addEventListener(FullScreenEvent.FULL_SCREEN, stage_fullScreenHandler) ;
// if full screen app, clear status bar height
if ( sm.stage.displayState == StageDisplayState.FULL_SCREEN || sm.stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE ) {
setStyle("osStatusBarHeight", 0);
}
}
*/
// Flex: _url = LoaderUtil.normalizeURL(sm.loaderInfo);
COMPILE::SWF
{
_url = loaderInfo.url;
}
COMPILE::JS
{
_url = document.URL;
}
/*
_parameters = sm.loaderInfo.parameters;
initManagers(sm);
// Setup the default context menu here. This allows the application
// developer to override it in the initialize event, if desired.
initContextMenu();
*/
super.initialize();
/*
// Stick a timer here so that we will execute script every 1.5s
// no matter what.
// This is strictly for the debugger to be able to halt.
// Note: isDebugger is true only with a Debugger Player.
if (sm.isTopLevel() && Capabilities.isDebugger == true)
setInterval(debugTickler, 1500);
*/
}
/**
* @private
* This is the event handler for the stage's orientationChanging event. It
* cancels the orientation animation and manually swaps the width and height
* of the application to allow the application to validate itself before
* the orientation change occurs. The orientaitonChanging is only listened
* for on iOS devices.
*/
/* private function stage_orientationChangingHandler(event:Event):void
{
var sm:ISystemManager = systemManager;
// Manually update orientation width and height if the application's explicit
// sizes aren't set. If they are, we assume the application will handle
// orientation on their own.
// SDK-30625: check stage for null since the Application may not be on-screen yet
// if orientation changes during start-up.
if (!stage || !isNaN(explicitWidth) || !isNaN(explicitHeight))
return;
if (!cachedDimensions)
cachedDimensions = new Dictionary();
// remember the current dimensions
previousWidth = width;
previousHeight = height;
var key:String = width + ":" + height;
// On some platforms (e.g. iOS and Playbook) if the soft keyboard is up
// it deactivates before orientation change and reactivates after it;
// the value of isSoftKeyboardActive thus changes during orientation change.
// We are remembering the initial value of isSoftKeyboardActivate in this
// situation for use in avoiding excessive resizing during the orientation change.
keyboardActiveInOrientationChange = isSoftKeyboardActive;
// if we're rotating 180 degrees don't do any screen resizing
var beforeOrientation:String = event["beforeOrientation"];
var afterOrientation:String = event["afterOrientation"];
if ((beforeOrientation == "default" && afterOrientation == "upsideDown") ||
(beforeOrientation == "upsideDown" && afterOrientation == "default") ||
(beforeOrientation == "rotatedLeft" && afterOrientation == "rotatedRight") ||
(beforeOrientation == "rotatedRight" && afterOrientation == "rotatedLeft"))
return;
var newWidth:Number;
var newHeight:Number;
// if we have a cached value, use it
if (cachedDimensions[key])
{
newWidth = cachedDimensions[key].width;
newHeight = cachedDimensions[key].height;
}
else // no cached value; just swap the numbers for now
{
// use stageHeight as the new width if you can get it
newWidth = stage ? stage.stageHeight / scaleFactor : height;
newHeight = width;
}
setActualSize(newWidth, newHeight);
// Indicate that the width and height have changed because of orientation
explicitSizingForOrientation = true;
// Force a validation
validateNow();
} */
/**
* @private
* Handler for the stage orientation change event. At this point, we need
* to undo the explicit width and height that was set when the application is
* reoriented on an iOS device. See stage_orientationChangingHandler for more
* information.
*/
/* private function stage_orientationChange(event:Event):void
{
// SDK-30625: check stage for null since the Application may not be on-screen yet
// if orientation changes during start-up.
if (!stage || !explicitSizingForOrientation)
return;
// update cache if keyboard was not previously active
if (!keyboardActiveInOrientationChange)
{
updateScreenSizeCache(stage.stageWidth / scaleFactor, stage.stageHeight / scaleFactor);
}
explicitSizingForOrientation = false;
} */
/** @private previous value of osStatusBarHeight on iOS when switch to full screen
*
*/
// protected var savedOsStatusBarHeight: Number = 0;
/**
* @private
* Handler to temporarily remove osStatusBarHeight is stage is set to full screen
* only of iOS devices
*/
/* protected function stage_fullScreenHandler(event: FullScreenEvent): void {
if (stage.displayState == StageDisplayState.FULL_SCREEN || stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE) {
var statusBarHeight : Number = getStyle("osStatusBarHeight");
if (statusBarHeight > 0) {
savedOsStatusBarHeight = statusBarHeight;
setStyle("osStatusBarHeight", 0) ;
}
}
else
{
if (savedOsStatusBarHeight > 0) {
setStyle("osStatusBarHeight", savedOsStatusBarHeight);
savedOsStatusBarHeight = 0;
}
}
} */
/**
* @private
* Update the screen size cache with the new values. The previous values are
* pulled from the values currently set in the cache.
* Note that if the old and new width/height values are unchanged no values are
* cached under the assumption that this was a 180 degree rotation.
*
*/
/* private function updateScreenSizeCache(newWidth:Number, newHeight:Number):void
{
// same dimensions, probably 180 degree rotation; don't cache
if (previousWidth == newWidth && previousHeight == newHeight)
return;
var key:String = previousWidth + ":" + previousHeight;
if (cachedDimensions[key])
{
// update the cached values if they are different
cachedDimensions[key].width = newWidth;
cachedDimensions[key].height = newHeight;
}
else
{
var orientationChangeKey:String = previousWidth + ":" + previousHeight;
var reverseOrientationChangeKey:String = newWidth + ":" + newHeight;
// cache values both ways, i.e. old -> new and new -> old
cachedDimensions[orientationChangeKey] = {
width:newWidth,
height:newHeight
};
cachedDimensions[reverseOrientationChangeKey] = {
width:previousWidth,
height:previousHeight
};
}
} */
/**
* @private
*/
override protected function createChildren():void
{
COMPILE::JS
{
ElementEvents.elementEvents["focusin"] = 1;
ElementEvents.elementEvents["focusout"] = 1;
}
super.createChildren();
/*
// Only listen for softKeyboard events
// if the runtime supports a soft keyboard
if (softKeyboardBehavior != "")
{
addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_ACTIVATE,
softKeyboardActivateHandler, true,
EventPriority.DEFAULT, true);
addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE,
softKeyboardDeactivateHandler, true,
EventPriority.DEFAULT, true);
// Listen for the deactivate event so we can close the softKeyboard
var nativeApp:Object = FlexGlobals.topLevelApplication.
systemManager.getDefinitionByName("flash.desktop.NativeApplication");
if (nativeApp && nativeApp["nativeApplication"])
EventDispatcher(nativeApp["nativeApplication"]).
addEventListener(Event.DEACTIVATE, nativeApplication_deactivateHandler);
}*/
}
/**
* @private
*/
/* override protected function commitProperties():void
{
super.commitProperties();
resizeWidth = isNaN(explicitWidth);
resizeHeight = isNaN(explicitHeight);
if (resizeWidth || resizeHeight)
{
resizeHandler(new Event(Event.RESIZE));
if (!resizeHandlerAdded)
{
// weak reference
systemManager.addEventListener(Event.RESIZE, resizeHandler, false, 0, true);
resizeHandlerAdded = true;
}
}
else
{
if (resizeHandlerAdded)
{
systemManager.removeEventListener(Event.RESIZE, resizeHandler);
resizeHandlerAdded = false;
}
}
if (percentBoundsChanged)
{
updateBounds();
percentBoundsChanged = false;
}
}
*/
/**
* @private
*/
/* override protected function resourcesChanged():void
{
super.resourcesChanged();
// "View Source" on the context menu
if (viewSourceCMI)
{
viewSourceCMI.caption = resourceManager.getString("components", "viewSource");
}
} */
/**
* @private
*/
/* override protected function partAdded(partName:String, instance:Object):void
{
super.partAdded(partName, instance);
if (instance == controlBarGroup)
{
// copy proxied values from controlBarGroupProperties (if set) to contentGroup
var newControlBarGroupProperties:uint = 0;
if (controlBarGroupProperties.controlBarContent !== undefined)
{
controlBarGroup.mxmlContent = controlBarGroupProperties.controlBarContent;
newControlBarGroupProperties = BitFlagUtil.update(newControlBarGroupProperties,
CONTROLBAR_PROPERTY_FLAG, true);
}
if (controlBarGroupProperties.layout !== undefined)
{
controlBarGroup.layout = controlBarGroupProperties.layout;
newControlBarGroupProperties = BitFlagUtil.update(newControlBarGroupProperties,
LAYOUT_PROPERTY_FLAG, true);
}
if (controlBarGroupProperties.visible !== undefined)
{
controlBarGroup.visible = controlBarGroupProperties.visible;
newControlBarGroupProperties = BitFlagUtil.update(newControlBarGroupProperties,
VISIBLE_PROPERTY_FLAG, true);
}
controlBarGroupProperties = newControlBarGroupProperties;
}
} */
/**
* @private
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
/* override protected function partRemoved(partName:String, instance:Object):void
{
super.partRemoved(partName, instance);
if (instance == controlBarGroup)
{
// copy proxied values from contentGroup (if explicitely set) to contentGroupProperties
var newControlBarGroupProperties:Object = {};
if (BitFlagUtil.isSet(controlBarGroupProperties as uint, CONTROLBAR_PROPERTY_FLAG))
newControlBarGroupProperties.controlBarContent = controlBarGroup.getMXMLContent();
if (BitFlagUtil.isSet(controlBarGroupProperties as uint, LAYOUT_PROPERTY_FLAG))
newControlBarGroupProperties.layout = controlBarGroup.layout;
if (BitFlagUtil.isSet(controlBarGroupProperties as uint, VISIBLE_PROPERTY_FLAG))
newControlBarGroupProperties.visible = controlBarGroup.visible;
controlBarGroupProperties = newControlBarGroupProperties;
controlBarGroup.mxmlContent = null;
controlBarGroup.layout = null;
}
} */
/**
* @private
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
/* override protected function getCurrentSkinState():String
{
var state:String = enabled ? "normal" : "disabled";
if (controlBarGroup)
{
if (BitFlagUtil.isSet(controlBarGroupProperties as uint, CONTROLBAR_PROPERTY_FLAG) &&
BitFlagUtil.isSet(controlBarGroupProperties as uint, VISIBLE_PROPERTY_FLAG))
state += "WithControlBar";
}
else
{
if (controlBarGroupProperties.controlBarContent &&
controlBarGroupProperties.visible)
state += "WithControlBar";
}
return state;
} */
/**
* @private
*/
/* override public function styleChanged(styleProp:String):void
{
super.styleChanged(styleProp);
if (!styleProp || styleProp == "styleName" || styleProp == "interactionMode")
{
// Turn off tooltip support for all mobile applications
ToolTipManager.enabled = getStyle("interactionMode") != InteractionMode.TOUCH;
}
} */
//----------------------------------
// unscaledHeight
//----------------------------------
/**
* @private
*/
/* override mx_internal function setUnscaledHeight(value:Number):void
{
// we invalidate so we can properly add/remove the resize
// event handler (SDK-12664)
invalidateProperties();
super.setUnscaledHeight(value);
} */
//----------------------------------
// unscaledWidth
//----------------------------------
/**
* @private
*/
/* override mx_internal function setUnscaledWidth(value:Number):void
{
// we invalidate so we can properly add/remove the resize
// event handler (SDK-12664)
invalidateProperties();
super.setUnscaledWidth(value);
} */
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* @private
* This is here so we get the this pointer set to Application.
*/
/* private function debugTickler():void
{
// We need some bytes of code in order to have a place to break.
var i:int = 0;
} */
/**
* @private
*/
/* private function initManagers(sm:ISystemManager):void
{
if (sm.isTopLevel())
{
focusManager = new FocusManager(this);
var awm:IActiveWindowManager =
IActiveWindowManager(sm.getImplementation("mx.managers::IActiveWindowManager"));
if (awm)
awm.activate(this);
else
focusManager.activate();
}
} */
/**
* @private
* Disable all the built-in items except "Print...".
*/
/* private function initContextMenu():void
{
// context menu already set
// nothing to init
if (flexContextMenu != null)
{
// make sure we set it back on systemManager b/c it may have been overridden by now
if (systemManager is InteractiveObject)
InteractiveObject(systemManager).contextMenu = contextMenu as ContextMenu;
return;
}
var defaultMenu:ContextMenu = new ContextMenu();
defaultMenu.hideBuiltInItems();
defaultMenu.builtInItems.print = true;
if (_viewSourceURL)
{
// don't worry! this gets updated in resourcesChanged()
const caption:String = resourceManager.getString("components", "viewSource");
viewSourceCMI = new ContextMenuItem(caption, true);
viewSourceCMI.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
// Append custom option, validating customItems first as in the
// mobile context this is null.
if (defaultMenu.customItems)
defaultMenu.customItems.push(viewSourceCMI);
}
contextMenu = defaultMenu;
if (systemManager is InteractiveObject)
InteractiveObject(systemManager).contextMenu = defaultMenu;
} */
/**
* @private
* Check to see if we're able to synchronize our size with the stage
* immediately rather than deferring (dependent on WATSON 2200950).
*/
/* private function initResizeBehavior():void
{
var version:Array = Capabilities.version.split(' ')[1].split(',');
synchronousResize = (parseFloat(version[0]) > 10 ||
(parseFloat(version[0]) == 10 && parseFloat(version[1]) >= 1)) && !Platform.isAir;
} */
/**
* @private
* Called if resizeForSoftKeyboard is true and the softKeyboard
* has been activated.
*/
/* private function softKeyboardActivateHandler(event:SoftKeyboardEvent):void
{
// Add a listener for the softKeyboard deactivate event to the event target
event.target.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE,
softKeyboardDeactivateHandler);
if (this === FlexGlobals.topLevelApplication)
{
if (softKeyboardTarget && softKeyboardTarget != event.target)
clearSoftKeyboardTarget();
softKeyboardTarget = event.target;
// If the display object that activates the softkeyboard is removed without
// losing focus, the runtime may not dispatch a deactivate event. So the
// framework adds a REMOVE_FROM_STAGE event listener to the target and manually
// clears the focus.
softKeyboardTarget.addEventListener(Event.REMOVED_FROM_STAGE,
softKeyboardTarget_removeFromStageHandler,
false, EventPriority.DEFAULT, true);
// On iOS, if the softKeyboard target is removed from the stage as a result
// of a user input with another focusable component, the application will not
// receive a SOFT_KEYBOARD_DEACTIVATE event, only the target will.
if (isIOS)
{
softKeyboardTarget.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE,
softKeyboardDeactivateHandler, false,
EventPriority.DEFAULT, true);
}
// Get the keyboard size
var keyboardRect:Rectangle = softKeyboardRect;
if (keyboardRect.height > 0)
isSoftKeyboardActive = true;
if (softKeyboardBehavior == "none" && resizeForSoftKeyboard)
{
var appHeight:Number = (stage.stageHeight - keyboardRect.height) / scaleFactor;
var appWidth:Number = stage.stageWidth / scaleFactor;
if (appHeight != height || appWidth != width)
{
setActualSize(appWidth, appHeight);
validateNow(); // Validate so that other listeners like Scroller get the updated dimensions
}
// update the screen size cache
if (keyboardActiveInOrientationChange)
{
keyboardActiveInOrientationChange = false;
updateScreenSizeCache(appWidth, appHeight);
}
}
}
} */
/**
* @private
* Called if resizeForSoftKeyboard is true and the softKeyboard
* has been deactivated.
*/
/* private function softKeyboardDeactivateHandler(event:SoftKeyboardEvent):void
{
if (this === FlexGlobals.topLevelApplication && isSoftKeyboardActive)
{
if (softKeyboardTarget)
clearSoftKeyboardTarget();
isSoftKeyboardActive = false;
if (softKeyboardBehavior == "none" && resizeForSoftKeyboard && !keyboardActiveInOrientationChange)
{
// Restore the original values
setActualSize(stage.stageWidth / scaleFactor, stage.stageHeight / scaleFactor);
validateNow(); // Validate so that other listeners like Scroller get the updated dimensions
}
}
} */
/**
* @private
*/
/* private function nativeApplication_deactivateHandler(event:Event):void
{
// Close the softKeyboard if we deactivate the application. This works
// around an iOS bug where the SoftKeyboard.DEACTIVATE event isn't
// dispatched when the application is deactivated.
if (isSoftKeyboardActive)
{
stage.focus = null;
softKeyboardDeactivateHandler(null);
}
} */
/**
* @private
* Called when a softKeyboard activation target is removed from the
* stage. If the target has stage focus, then the focus is set to null.
* This will cause a SOFT_KEYBOARD_DEACTIVATE event to be dispatched.
*/
/* private function softKeyboardTarget_removeFromStageHandler(event:Event):void
{
if (stage.focus == softKeyboardTarget)
stage.focus = null;
// clearSoftKeyboardTarget() is called in response to the SOFT_KEYBOARD_DEACTIVATE
// event and will clear the removeFromStage listener and softKeyboardDeactivate
// events from the target.
} */
/**
* @private
* This method clears the cached softKeyboard target and removes the
* removeFromStage handler that is added in the softKeyboardActivateHandler
* method.
*/
/* private function clearSoftKeyboardTarget():void
{
if (softKeyboardTarget)
{
if (isIOS)
{
softKeyboardTarget.removeEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE,
softKeyboardDeactivateHandler);
}
softKeyboardTarget.removeEventListener(Event.REMOVED_FROM_STAGE, softKeyboardTarget_removeFromStageHandler);
softKeyboardTarget = null;
}
} */
/**
* Helper function to get the AIR application descriptor attribute called "softKeyboardBehavior".
*/
/* mx_internal static function get softKeyboardBehavior():String
{
if (_softKeyboardBehavior != null)
{
return _softKeyboardBehavior;
}
else
{
// Since we might not be running on AIR, need to get the class by name.
// Also, make sure to cache the value so we only run this once
var nativeApp:Object = FlexGlobals.topLevelApplication.systemManager.getDefinitionByName("flash.desktop.NativeApplication");
if (nativeApp)
{
try
{
var appXML:XML = XML(nativeApp["nativeApplication"]["applicationDescriptor"]);
var ns:Namespace = appXML.namespace();
_softKeyboardBehavior = String(appXML..ns::softKeyboardBehavior);
}
catch (e:Error)
{
// TODO (aharui): Marshall this someday?
_softKeyboardBehavior = "";
}
}
else
{
_softKeyboardBehavior = "";
}
return _softKeyboardBehavior;
}
} */
//--------------------------------------------------------------------------
//
// Event handlers
//
//--------------------------------------------------------------------------
/**
* @private
* Triggered by a resize event of the stage.
* Sets the new width and height.
* After the SystemManager performs its function,
* it is only necessary to notify the children of the change.
*/
/* private function resizeHandler(event:Event):void
{
// don't run while keyboard is up and orientation is changing
if (keyboardActiveInOrientationChange)
return;
// If we're already due to update our bounds on the next
// commitProperties pass, avoid the redundancy.
if (!percentBoundsChanged)
{
updateBounds();
// Update immediately when stage resizes so that we may appear
// in synch with the stage rather than visually "catching up".
if (synchronousResize)
UIComponentGlobals.layoutManager.validateNow();
}
} */
/**
* @private
* Called when the "View Source" item in the application's context menu is
* selected.
*/
/* protected function menuItemSelectHandler(event:Event):void
{
navigateToURL(new URLRequest(_viewSourceURL), "_blank");
} */
/**
* @private
* Sets the new width and height after the Stage has resized
* or when percentHeight or percentWidth has changed.
*/
/* private function updateBounds():void
{
// When user has not specified any width/height,
// application assumes the size of the stage.
// If developer has specified width/height,
// the application will not resize.
// If developer has specified percent width/height,
// application will resize to the required value
// based on the current SystemManager's width/height.
// If developer has specified min/max values,
// then application will not resize beyond those values.
// ignore updateBounds while orientation is changing
if (keyboardActiveInOrientationChange)
return;
var w:Number;
var h:Number
if (resizeWidth)
{
if (isNaN(percentWidth))
{
w = DisplayObject(systemManager).width;
}
else
{
super.percentWidth = Math.max(percentWidth, 0);
super.percentWidth = Math.min(percentWidth, 100);
w = percentWidth*DisplayObject(systemManager).width/100;
}
if (!isNaN(explicitMaxWidth))
w = Math.min(w, explicitMaxWidth);
if (!isNaN(explicitMinWidth))
w = Math.max(w, explicitMinWidth);
}
else
{
w = width;
}
if (resizeHeight)
{
if (isNaN(percentHeight))
{
h = DisplayObject(systemManager).height;
}
else
{
super.percentHeight = Math.max(percentHeight, 0);
super.percentHeight = Math.min(percentHeight, 100);
h = percentHeight*DisplayObject(systemManager).height/100;
}
if (!isNaN(explicitMaxHeight))
h = Math.min(h, explicitMaxHeight);
if (!isNaN(explicitMinHeight))
h = Math.max(h, explicitMinHeight);
}
else
{
h = height;
}
if (w != width || h != height)
{
invalidateProperties();
invalidateSize();
}
setActualSize(w, h);
invalidateDisplayList();
} */
/**
* @private
*/
/* override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
{
// this can get called before we know our systemManager. Hook it up later in initialize()
if (type == UncaughtErrorEvent.UNCAUGHT_ERROR && systemManager)
systemManager.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorRedispatcher);
super.addEventListener(type, listener, useCapture, priority, useWeakReference)
} */
/**
* @private
*/
/* override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
{
super.removeEventListener(type, listener, useCapture);
if (type == UncaughtErrorEvent.UNCAUGHT_ERROR && systemManager)
systemManager.loaderInfo.uncaughtErrorEvents.removeEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorRedispatcher);
}
private function uncaughtErrorRedispatcher(event:Event):void
{
if (!dispatchEvent(event))
event.preventDefault();
}
mx_internal var _softKeyboardRect:Rectangle;
mx_internal function get softKeyboardRect():Rectangle
{
if (_softKeyboardRect == null)
return stage.softKeyboardRect;
return _softKeyboardRect;
}*/
override public function setActualSize(w:Number, h:Number):void
{
super.setActualSize(w, h);
var lh:ISparkLayoutHost = getLayoutHost() as ISparkLayoutHost;
var g:IUIComponent = (lh ? lh.displayView as IUIComponent : null);
if (g && g != this)
{
// TODO: If Applicaiton has no explicit or percent sizes, then
// this function is used to set the default size of the app.
// Unfortunatley, setActualSize() [non-explicit width/height]
// is overridden during LayoutBase.layout() when it gets
// measured sizes. So legacy code has this function
// setting explicit sizes on contentView (and now displayView).
// This is not ideal, since displayView then has explicit sizes
// that always stick (hence, why this function doesn't do it
// in SkinnableContainerBase).
//
// g.setActualSize(w, h);
g.width = w;
g.height = h;
}
}
//--------------------------------------------------------------------------
//
// IPopUpHost
//
//--------------------------------------------------------------------------
/**
* Application can host popups but in the strandChildren
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function get popUpParent():IPopUpHostParent
{
COMPILE::JS
{
return systemManager as IPopUpHostParent;
}
COMPILE::SWF
{
return strandChildren as IPopUpHostParent;
}
}
override public function get systemManager():ISystemManager
{
return parent as ISystemManager;
}
/**
*/
public function get popUpHost():IPopUpHost
{
return this;
}
}
}
|
package laya.media {
import laya.events.EventDispatcher;
import laya.utils.Handler;
/**
* <code>SoundChannel</code> 用来控制程序中的声音。
*/
public class SoundChannel extends EventDispatcher {
/**
* 声音地址。
*/
public var url:String;
/**
* 循环次数。
*/
public var loops:int;
/**
* 开始时间。
*/
public var startTime:Number;
/**
* 表示声音是否已暂停。
*/
public var isStopped:Boolean = false;
/**
* 播放完成处理器。
*/
public var completeHandler:Handler;
public function set volume(v:Number):void {
}
/**
* 音量。
*/
public function get volume():Number {
return 1;
}
/**
* 获取当前播放时间。
*/
public function get position():Number {
return 0;
}
/**
* 播放。
*/
public function play():void {
}
/**
* 停止。
*/
public function stop():void {
}
/**
* private
*/
protected function __runComplete(handler:Handler):void
{
if (handler)
{
handler.run();
}
}
}
} |
// Action script...
// [Initial MovieClip Action of sprite 20688]
#initclip 209
if (!dofus.graphics.gapi.ui.HouseIndoor)
{
if (!dofus)
{
_global.dofus = new Object();
} // end if
if (!dofus.graphics)
{
_global.dofus.graphics = new Object();
} // end if
if (!dofus.graphics.gapi)
{
_global.dofus.graphics.gapi = new Object();
} // end if
if (!dofus.graphics.gapi.ui)
{
_global.dofus.graphics.gapi.ui = new Object();
} // end if
var _loc1 = (_global.dofus.graphics.gapi.ui.HouseIndoor = function ()
{
super();
}).prototype;
_loc1.__set__house = function (oHouse)
{
this._oHouse = oHouse;
oHouse.addEventListener("forsale", this);
oHouse.addEventListener("locked", this);
this._mcForSale._visible = oHouse.isForSale;
this._mcLock._visible = oHouse.isLocked;
//return (this.house());
};
_loc1.__set__skills = function (aSkills)
{
this._aSkills = aSkills;
//return (this.skills());
};
_loc1.init = function ()
{
super.init(false, dofus.graphics.gapi.ui.HouseIndoor.CLASS_NAME);
};
_loc1.createChildren = function ()
{
this._mcHouse.onRelease = this.click;
if (this._oHouse == undefined)
{
this._mcForSale._visible = false;
this._mcLock._visible = false;
} // end if
};
_loc1.click = function ()
{
var _loc2 = this._parent.gapi.createPopupMenu();
var _loc3 = this._parent._oHouse;
var _loc4 = this._parent.api;
_loc2.addStaticItem(_loc3.name);
for (var k in this._parent._aSkills)
{
var _loc5 = this._parent._aSkills[k];
var _loc6 = _loc5.getState(true, _loc3.localOwner, _loc3.isForSale, _loc3.isLocked, true);
if (_loc6 != "X")
{
_loc2.addItem(_loc5.description, _loc4.kernel.GameManager, _loc4.kernel.GameManager.useSkill, [_loc5.id], _loc6 == "V");
} // end if
} // end of for...in
if (_loc4.datacenter.Player.guildInfos != undefined && _loc4.datacenter.Player.guildInfos.isValid)
{
_loc2.addItem(_loc4.lang.getText("GUILD_HOUSE_CONFIGURATION"), this._parent, this._parent.guildHouse);
} // end if
_loc2.show(_root._xmouse, _root._ymouse);
};
_loc1.guildHouse = function ()
{
this.api.ui.loadUIComponent("GuildHouseRights", "GuildHouseRights", {house: this._oHouse});
};
_loc1.forsale = function (oEvent)
{
this._mcForSale._visible = oEvent.value;
};
_loc1.locked = function (oEvent)
{
this._mcLock._visible = oEvent.value;
};
_loc1.addProperty("skills", function ()
{
}, _loc1.__set__skills);
_loc1.addProperty("house", function ()
{
}, _loc1.__set__house);
ASSetPropFlags(_loc1, null, 1);
(_global.dofus.graphics.gapi.ui.HouseIndoor = function ()
{
super();
}).CLASS_NAME = "HouseIndoor";
} // end if
#endinitclip
|
//----------------------------------------------------------------------------------------------------
// SiOPM All Pass filter
// Copyright (c) 2009 keim All rights reserved.
// Distributed under BSD-style license (see org.si.license.txt).
//----------------------------------------------------------------------------------------------------
package org.si.sion.effector {
/** APF. */
public class SiFilterAllPass extends SiFilterBase
{
// constructor
//------------------------------------------------------------
/** constructor.
* @param freq cutoff frequency[Hz].
* @param band band width [oct].
*/
public function SiFilterAllPass(freq:Number=3000, band:Number=1)
{
setParameters(freq, band);
}
// operations
//------------------------------------------------------------
/** set parameters
* @param freq cutoff frequency[Hz].
* @param band band width [oct].
*/
public function setParameters(freq:Number=3000, band:Number=1) : void {
var omg:Number = freq * 0.00014247585730565955, // 2*pi/44100
cos:Number = Math.cos(omg), sin:Number = Math.sin(omg),
alp:Number = sin * sinh(0.34657359027997264 * band * omg / sin), // log(2)*0.5
ia0:Number = 1 / (1+alp);
_b1 = _a1 = -2*cos * ia0;
_b0 = _a2 = (1-alp) * ia0;
_b2 = 1;
}
// overrided funcitons
//------------------------------------------------------------
/** @private */
override public function initialize() : void
{
setParameters();
}
/** @private */
override public function mmlCallback(args:Vector.<Number>) : void
{
setParameters((!isNaN(args[0])) ? args[0] : 3000,
(!isNaN(args[1])) ? args[1] : 1);
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package mx.containers
{
[ExcludeClass]
/**
* @private
* States of a BoxDivider.
*/
public final class DividerState
{
include "../core/Version.as";
//--------------------------------------------------------------------------
//
// Class constants
//
//--------------------------------------------------------------------------
/**
* @private
*/
public static const DOWN:String = "down";
/**
* @private
*/
public static const OVER:String = "over";
/**
* @private
*/
public static const UP:String = "up";
}
}
|
package fightLib.command
{
import fightLib.FightLibCommandEvent;
public class WaittingCommand extends BaseFightLibCommand
{
protected var _finishFun:Function;
public function WaittingCommand(param1:Function)
{
super();
this._finishFun = param1;
}
override public function finish() : void
{
if(this._finishFun != null)
{
this._finishFun();
}
super.finish();
}
override public function excute() : void
{
super.excute();
dispatchEvent(new FightLibCommandEvent(FightLibCommandEvent.WAIT));
}
override public function dispose() : void
{
this._finishFun = null;
super.dispose();
}
}
}
|
// makeswf -v 7 -s 200x150 -r 1 -o removesprite-depths.swf removesprite-depths.as
trace ("Check RemoveSprite action with various depths");
depths = [-2000000, -20000, -10000, -1, 0, 1000000, 2000000 ];
for (i = 0; i < depths.length; i++) {
x = createEmptyMovieClip ("movie" + depths[i], depths[i]);
trace (this["movie" + depths[i]] + " @ " + x.getDepth ());
asm {
push "x"
getvariable
removemovieclip
};
trace (this["movie" + depths[i]] + " @ " + x.getDepth ());
}
loadMovie ("FSCommand:quit", "");
|
package fl.video
{
import flash.net.*;
import flash.events.TimerEvent;
import flash.events.NetStatusEvent;
import flash.utils.Timer;
import flash.utils.getTimer;
/**
* The NCManagerNative class is a subclass of the NCManager class and supports
* native bandwidth detection, which some Flash Video Streaming Service providers
* may support. Check with your FVSS provider to see whether they support native bandwidth
* detection. Native bandwidth detection means that the bandwidth detection is built in
* to the streaming server and performs better.
*
* <p>When an NCManagerNative object is
* used, the main.asc file is not required on the server. If bandwidth detection is not required,
* the NCManagerNative object allows
* connection to any version of the Flash Media Server (FMS) without the main.asc file.</p>
*
* <p>To use this instead of the default fl.video.NCManager, put the following code
* in Frame 1 of your FLA file:</p>
*
* <listing version="3.0">
* import fl.video.~~;
* VideoPlayer.iNCManagerClass = fl.video.NCManagerNative;
* </listing>
*
* @see NCManager
* @tiptext NCManagerNative class
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
public class NCManagerNative extends NCManager implements INCManager
{
/**
* Length of the stream, in milliseconds. After the <code>VideoPlayer.ncConnected()</code> method
* is called, if it returns undefined, <code>null</code> or less than 0,
* then the VideoPlayer object knows that there is no stream length information.
* If stream length information is returned, it overrides any existing steam length information
* including information set by the <code>totalTime</code> parameter of the
* <code>VideoPlayer.play()</code> method, the
* <code>VideoPlayer.load()</code> method or information received from the FLV file's metadata.
*
* @see INCManager#streamLength
* @tiptext streamLength property
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
public function get streamLength () : Number;
/**
* Creates a new NCManagerNative instance.
* @tiptext NCManagerNative constructor
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
public function NCManagerNative ();
/**
* Overridden to create ConnectClientNative instead of ConnectClient.
*
* @private
*
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
function connectRTMP () : Boolean;
/**
* Overridden to avoid call to getStreamLength
* @private
* @tiptext onConnected method
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
function onConnected (p_nc:NetConnection, p_bw:Number) : void;
/**
* overriden to call run() when _autoSenseBW is on, and to immediately
* call onConnected() if it is not, instead of waiting for a call to
* onBWDone from the server, like NCManager does.
*
* @private
*
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
function connectOnStatus (e:NetStatusEvent) : void;
/**
* netStatus event listener when reconnecting
*
* @private
*
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
function reconnectOnStatus (e:NetStatusEvent) : void;
}
}
|
/*
* PROJECT: FLARToolKit
* --------------------------------------------------------------------------------
* This work is based on the NyARToolKit developed by
* R.Iizuka (nyatla)
* http://nyatla.jp/nyatoolkit/
*
* The FLARToolKit is ActionScript 3.0 version ARToolkit class library.
* Copyright (C)2008 Saqoosha
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this framework; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For further information please contact.
* http://www.libspark.org/wiki/saqoosha/FLARToolKit
* <saq(at)saqoosha.net>
*
*/
package org.libspark.flartoolkit.support.away3d_2 {
import away3d.cameras.*;
import away3d.cameras.lenses.*;
import away3d.core.math.*;
import org.libspark.flartoolkit.core.FLARMat;
import org.libspark.flartoolkit.core.param.FLARParam;
import org.libspark.flartoolkit.core.types.FLARIntSize;
import org.libspark.flartoolkit.utils.ArrayUtil;
public class FLARCamera3D extends Camera3D {
private var _projectionMatrix:Matrix3D;
public function FLARCamera3D(init:Object = null) {
super(init);
lens = new PerspectiveLens();
}
public function setParam(param:FLARParam):void
{
var m_projection:Array = new Array(16);
var trans_mat:FLARMat = new FLARMat(3,4);
var icpara_mat:FLARMat = new FLARMat(3,4);
var p:Array = ArrayUtil.createJaggedArray(3, 3);
var q:Array = ArrayUtil.createJaggedArray(4, 4);
var i:int;
var j:int;
const size:FLARIntSize = param.getScreenSize();
const width:int = size.w;
const height:int = size.h;
param.getPerspectiveProjectionMatrix().decompMat(icpara_mat, trans_mat);
var icpara:Array = icpara_mat.getArray();
var trans:Array = trans_mat.getArray();
for (i = 0; i < 4; i++) {
icpara[1][i] = (height - 1) * (icpara[2][i]) - icpara[1][i];
}
for(i = 0; i < 3; i++) {
for(j = 0; j < 3; j++) {
p[i][j] = icpara[i][j] / icpara[2][2];
}
}
var div:Number = zoom*focus;
q[0][0] = 2.0 * p[0][0]/div;
q[0][1] = 2.0 * p[0][1]/div;
q[0][2] = -(2.0 * p[0][2] - (width - 1))/div;
q[0][3] = 0.0;
q[1][0] = 0.0;
q[1][1] = 2.0 * p[1][1]/div;
q[1][2] = -(2.0 * p[1][2] - (height - 1))/div;
q[1][3] = 0.0;
q[2][0] = 0.0;
q[2][1] = 0.0;
q[2][2] = 1.0;
q[2][3] = 0.0;
q[3][0] = 0.0;
q[3][1] = 0.0;
q[3][2] = 0.0;
q[3][3] = 1.0;
for (i = 0; i < 4; i++) { // Row.
// First 3 columns of the current row.
for (j = 0; j < 3; j++) { // Column.
m_projection[i*4 + j] = q[i][0] * trans[0][j] + q[i][1] * trans[1][j] + q[i][2] * trans[2][j];
}
// Fourth column of the current row.
m_projection[i*4 + 3] = q[i][0] * trans[0][3] + q[i][1] * trans[1][3] + q[i][2] * trans[2][3] + q[i][3];
}
var m:Matrix3D = _projectionMatrix = new Matrix3D();
m.sxx = m_projection[0];
m.sxy = m_projection[1];
m.sxz = m_projection[2];
m.tx = m_projection[3];
m.syx = m_projection[4];
m.syy = m_projection[5];
m.syz = m_projection[6];
m.ty = m_projection[7];
m.szx = m_projection[8];
m.szy = m_projection[9];
m.szz = m_projection[10];
m.tz = m_projection[11];
m.swx = m_projection[12];
m.swy = m_projection[13];
m.swz = m_projection[14];
m.tw = m_projection[15];
}
public override function get viewMatrix():Matrix3D
{
invViewMatrix.inverse(_projectionMatrix)
return _projectionMatrix;
}
}
} |
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is [Open Source Virtual Machine.].
*
* The Initial Developer of the Original Code is
* Adobe System Incorporated.
* Portions created by the Initial Developer are Copyright (C) 2005-2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Adobe AS3 Team
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// ActionScript file
package LatticeAmbiguous {
public class ImplFG implements IFuncF, IFuncG {
public function f() : String {
return "IFuncF::f"
}
public function g() : String {
return "IFuncG::g"
}
}
}
|
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is [Open Source Virtual Machine.].
*
* The Initial Developer of the Original Code is
* Adobe System Incorporated.
* Portions created by the Initial Developer are Copyright (C) 2005-2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Adobe AS3 Team
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var SECTION = "Definitions"; // provide a document reference (ie, ECMA section)
var VERSION = "AS3"; // Version of JavaScript or ECMA
var TITLE = "Interface Definition"; // Provide ECMA section title or a description
var BUGNUMBER = "";
startTest(); // leave this alone
//-----------------------------------------------------------------------------
import Example_1_1_6.*;
var eg = new ExampleTest();
AddTestCase("simple implements, method call", "hello, world", eg.doHello());
AddTestCase("simple implements, method call", "goodmorning, world", eg.doGoodMorning());
test(); // leave this alone. this executes the test cases and
// displays results.
|
////////////////////////////////////////////////////////////////////////////////
// Copyright 2016 Michael Schmalle - Teoti Graphix, LLC
//
// 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: Michael Schmalle, Principal Architect
// mschmalle at teotigraphix dot com
////////////////////////////////////////////////////////////////////////////////
package t4b.model
{
import com.teotigraphix.app.configuration.ApplicationDescriptor;
import com.teotigraphix.app.configuration.IApplicationPermissions;
import t4b.configuration.ApplicationSettings;
import t4b.controller.CommandLauncher;
import t4b.controller.ScreenLauncher;
import t4b.controller.UIController;
public interface IApplicationModel
{
function get applicationSettings():ApplicationSettings;
function get descriptor():ApplicationDescriptor;
function get permissions():IApplicationPermissions;
function get screens():ScreenLauncher;
function get commands():CommandLauncher;
function get ui():UIController;
function get configuration():ConfigurationModel;
function get osc():OSCModel;
}
}
|
package
{
/**
* Button widget; when clicked, calls a function.
* @author jjp
*/
public class Button extends EntitySidebarImg
{
private var dgOnClick:Function;
public function Button(sidebar:Sidebar, bmp:*, dgOnClick: Function)
{
super(sidebar, bmp);
this.dgOnClick = dgOnClick;
}
override public function OnClick():void
{
this.dgOnClick();
}
}
} |
package as3lib.core.convert
{
/**
* 解析颜色(十六进制或HTML)为uint的字符串表示。
*/
public function toColor(str:String):uint
{
if (str.substr(0, 2) == '0x')
{
str = str.substr(2);
}else if (str.substr(0, 1) == '#')
{
str = str.substr(1);
}
return parseInt(str, 16);
}
} |
package org.yellcorp.lib.color.vector
{
import org.yellcorp.lib.geom.Vector3;
public class VectorBlend
{
public static function multiply(a:Vector3, b:Vector3, out:Vector3 = null):Vector3
{
if (!out) out = new Vector3();
out.x = a.x * b.x;
out.y = a.y * b.y;
out.z = a.z * b.z;
return out;
}
public static function screen(a:Vector3, b:Vector3, out:Vector3 = null):Vector3
{
if (!out) out = new Vector3();
out.x = 1 - (1 - a.x) * (1 - b.x);
out.y = 1 - (1 - a.y) * (1 - b.y);
out.z = 1 - (1 - a.z) * (1 - b.z);
return out;
}
public static function difference(a:Vector3, b:Vector3, out:Vector3 = null):Vector3
{
if (!out) out = new Vector3();
out.x = Math.abs(a.x - b.x);
out.y = Math.abs(a.y - b.y);
out.z = Math.abs(a.z - b.z);
return out;
}
}
}
|
package com.ankamagames.dofus.network.messages.game.context.fight
{
import com.ankamagames.jerakine.network.CustomDataWrapper;
import com.ankamagames.jerakine.network.ICustomDataInput;
import com.ankamagames.jerakine.network.ICustomDataOutput;
import com.ankamagames.jerakine.network.INetworkMessage;
import com.ankamagames.jerakine.network.NetworkMessage;
import com.ankamagames.jerakine.network.utils.FuncTree;
import flash.utils.ByteArray;
public class GameFightOptionStateUpdateMessage extends NetworkMessage implements INetworkMessage
{
public static const protocolId:uint = 4968;
private var _isInitialized:Boolean = false;
public var fightId:uint = 0;
public var teamId:uint = 2;
public var option:uint = 3;
public var state:Boolean = false;
public function GameFightOptionStateUpdateMessage()
{
super();
}
override public function get isInitialized() : Boolean
{
return this._isInitialized;
}
override public function getMessageId() : uint
{
return 4968;
}
public function initGameFightOptionStateUpdateMessage(fightId:uint = 0, teamId:uint = 2, option:uint = 3, state:Boolean = false) : GameFightOptionStateUpdateMessage
{
this.fightId = fightId;
this.teamId = teamId;
this.option = option;
this.state = state;
this._isInitialized = true;
return this;
}
override public function reset() : void
{
this.fightId = 0;
this.teamId = 2;
this.option = 3;
this.state = false;
this._isInitialized = false;
}
override public function pack(output:ICustomDataOutput) : void
{
var data:ByteArray = new ByteArray();
this.serialize(new CustomDataWrapper(data));
writePacket(output,this.getMessageId(),data);
}
override public function unpack(input:ICustomDataInput, length:uint) : void
{
this.deserialize(input);
}
override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree
{
var tree:FuncTree = new FuncTree();
tree.setRoot(input);
this.deserializeAsync(tree);
return tree;
}
public function serialize(output:ICustomDataOutput) : void
{
this.serializeAs_GameFightOptionStateUpdateMessage(output);
}
public function serializeAs_GameFightOptionStateUpdateMessage(output:ICustomDataOutput) : void
{
if(this.fightId < 0)
{
throw new Error("Forbidden value (" + this.fightId + ") on element fightId.");
}
output.writeVarShort(this.fightId);
output.writeByte(this.teamId);
output.writeByte(this.option);
output.writeBoolean(this.state);
}
public function deserialize(input:ICustomDataInput) : void
{
this.deserializeAs_GameFightOptionStateUpdateMessage(input);
}
public function deserializeAs_GameFightOptionStateUpdateMessage(input:ICustomDataInput) : void
{
this._fightIdFunc(input);
this._teamIdFunc(input);
this._optionFunc(input);
this._stateFunc(input);
}
public function deserializeAsync(tree:FuncTree) : void
{
this.deserializeAsyncAs_GameFightOptionStateUpdateMessage(tree);
}
public function deserializeAsyncAs_GameFightOptionStateUpdateMessage(tree:FuncTree) : void
{
tree.addChild(this._fightIdFunc);
tree.addChild(this._teamIdFunc);
tree.addChild(this._optionFunc);
tree.addChild(this._stateFunc);
}
private function _fightIdFunc(input:ICustomDataInput) : void
{
this.fightId = input.readVarUhShort();
if(this.fightId < 0)
{
throw new Error("Forbidden value (" + this.fightId + ") on element of GameFightOptionStateUpdateMessage.fightId.");
}
}
private function _teamIdFunc(input:ICustomDataInput) : void
{
this.teamId = input.readByte();
if(this.teamId < 0)
{
throw new Error("Forbidden value (" + this.teamId + ") on element of GameFightOptionStateUpdateMessage.teamId.");
}
}
private function _optionFunc(input:ICustomDataInput) : void
{
this.option = input.readByte();
if(this.option < 0)
{
throw new Error("Forbidden value (" + this.option + ") on element of GameFightOptionStateUpdateMessage.option.");
}
}
private function _stateFunc(input:ICustomDataInput) : void
{
this.state = input.readBoolean();
}
}
}
|
package ddt.view.chat.chatBall
{
import com.pickgliss.ui.ComponentFactory;
import flash.geom.Point;
import flash.utils.Timer;
public class ChatBallPlayer extends ChatBallBase
{
private var _currentPaopaoType:int = 0;
private var _field2:ChatBallTextAreaBuff;
public function ChatBallPlayer()
{
super();
this.init();
}
private function init() : void
{
_field = new ChatBallTextAreaPlayer();
this._field2 = new ChatBallTextAreaBuff();
}
override protected function get field() : ChatBallTextAreaBase
{
if(this._currentPaopaoType != 9)
{
return _field;
}
return this._field2;
}
override public function setText(param1:String, param2:int = 0) : void
{
clear();
if(param2 == 9)
{
_popupTimer = new Timer(2700,1);
}
else
{
_popupTimer = new Timer(4000,1);
}
if(this._currentPaopaoType != param2 || paopaoMC == null)
{
this._currentPaopaoType = param2;
this.newPaopao();
}
var _loc3_:int = this.globalToLocal(new Point(500,10)).x;
this.field.x = _loc3_ < 0?Number(0):Number(_loc3_);
this.field.text = param1;
fitSize(this.field);
this.show();
}
override public function show() : void
{
super.show();
beginPopDelay();
}
override public function hide() : void
{
super.hide();
if(this.field && this.field.parent)
{
this.field.parent.removeChild(this.field);
}
}
override public function set width(param1:Number) : void
{
super.width = param1;
}
private function newPaopao() : void
{
if(paopao)
{
removeChild(paopao);
}
if(this._currentPaopaoType != 9)
{
paopaoMC = ComponentFactory.Instance.creat("ChatBall1600" + String(this._currentPaopaoType));
}
else
{
paopaoMC = ComponentFactory.Instance.creat("SpecificBall001");
}
_chatballBackground = new ChatBallBackground(paopaoMC);
addChild(paopao);
}
override public function dispose() : void
{
this._field2.dispose();
super.dispose();
}
}
}
|
/**
* GODPAPER Confidential,Copyright 2015. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
obtaining
* a copy of this software and associated documentation files (the
"Software"),
* to deal in the Software without restriction, including without
limitation
* the rights to use, copy, modify, merge, publish, distribute,
sub-license,
* 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 feathers.examples.mxml.consts
{
import com.probertson.data.SQLRunner;
import flash.filesystem.File;
import feathers.controls.ScreenNavigator;
import feathers.examples.mxml.model.DoodleModel;
import feathers.examples.mxml.model.LiteralModel;
import feathers.examples.mxml.model.PhotographModel;
import feathers.examples.mxml.utils.SingletonFactory;
//--------------------------------------------------------------------------
//
// Imports
//
//--------------------------------------------------------------------------
/**
* GlobalVariables.as class.
* @author yangboz
* @langVersion 3.0
* @playerVersion 11.2+
* @airVersion 3.2+
* Created Mar 4, 2015 12:29:29 PM
* @history 05/00/12,
*/
public class GlobalVariables
{
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
public static var screenNavigator:ScreenNavigator;
//
// SQLite setup code:
// define database file location
public static var dbFile:File = File.applicationStorageDirectory.resolvePath("TeeDatabase.db");
// create the SQLRunner
public static var sqlRunner:SQLRunner = new SQLRunner(dbFile);
//
public static var model_doodle:DoodleModel = SingletonFactory.produce(DoodleModel);
public static var model_literal:LiteralModel = SingletonFactory.produce(LiteralModel);
public static var model_photograph:PhotographModel = SingletonFactory.produce(PhotographModel);
//----------------------------------
// CONSTANTS
//----------------------------------
//--------------------------------------------------------------------------
//
// Public properties
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//
// Protected properties
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
public function GlobalVariables()
{
}
//--------------------------------------------------------------------------
//
// Public methods
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//
// Protected methods
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//
// Private methods
//
//--------------------------------------------------------------------------
}
} |
package ru.nacid.base.services.skins.commands
{
import ru.nacid.base.services.Command;
import ru.nacid.base.services.lan.data.UrlStorage;
import ru.nacid.base.services.lan.loaders.DataLoader;
import ru.nacid.base.services.skins.Sm;
import ru.nacid.utils.encoders.data.Csv;
import ru.nacid.utils.encoders.interfaces.IEncoder;
/**
* LoadSkinsMap.as
* Created On: 21.8 14:45
*
* @author Nikolay nacid Bondarev
* @url https://github.com/nacid/Sand
*
*
* Copyright 2012 Nikolay nacid Bondarev
*
* 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.
*
*/
public class LoadSkinsMap extends DataLoader
{
protected function get trueString():String
{
return 'TRUE';
}
protected function get falseString():String
{
return 'FALSE';
}
protected var mapDir:String;
protected var manager:Sm;
public function LoadSkinsMap($skinsDir:String, $mapFile:String)
{
manager=Sm.instance;
priority=Command.HIGHER_PRIORITY;
symbol='LoadSkinsMap';
makeRequest(urls.readAlias($skinsDir), $mapFile);
}
protected function makeRequest($alias:UrlStorage, $mapFile:String):void
{
url=$alias.host.concat($mapFile);
mapDir=$alias.host;
data=$alias.data;
}
override protected function createEncoder():IEncoder
{
return new Csv;
}
override protected function onResponse():void
{
var skins:Object=encoder.decodeObject(responseData);
for each (var skinDesc:Object in skins)
{
manager.addSkin(skinDesc.type, skinDesc.id, mapDir.concat(skinDesc.url), skinDesc.embed == trueString ? true : false);
}
notifyComplete();
}
}
}
|
package com.marpies.ane.gameservices {
/**
* Class representing local player.
*/
public class GSPlayer {
private var mId:String;
private var mAlias:String;
private var mDisplayName:String;
private var mIconImageUri:String;
private var mHiResImageUri:String;
/**
* @private
*/
public function GSPlayer() {
}
/**
* @private
*/
public function toString():String {
return "{GSPlayer | id: " + mId + " alias: " + mAlias + " displayName: " + mDisplayName + "}";
}
/**
* @private
*/
internal static function fromJSON( json:Object ):GSPlayer {
var player:GSPlayer = new GSPlayer();
player.mId = json.playerId;
player.mAlias = json.alias;
player.mDisplayName = json.displayName;
player.mIconImageUri = json.iconImageUri;
player.mHiResImageUri = json.hiResImageUri;
return player;
}
/**
*
*
* Getters / Setters
*
*
*/
/**
* Player's id, as assigned by Google Play or Game Center.
*/
public function get id():String {
return mId;
}
/**
* Player's alias.
*/
public function get alias():String {
return mAlias;
}
/**
* Player's display name.
*/
public function get displayName():String {
return mDisplayName;
}
/**
* <strong>Android only</strong>: The URI for loading this player's icon-size profile image.
*/
public function get iconImageUri():String {
return mIconImageUri;
}
/**
* <strong>Android only</strong>: The URI for loading this player's hi-res profile image.
*/
public function get hiResImageUri():String {
return mHiResImageUri;
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.