CombinedText stringlengths 4 3.42M |
|---|
//----------------------------------------------------------------------------------------------------
// NES Emulator
// Copyright (c) 2009 keim All rights reserved.
// Distributed under BSD-style license (see org.si.license.txt).
//--------------------------------------------------------------------------------
package org.si.sound.nsf {
public class NES {
static public var cpu:CPU = new CPU();
static public var apu:APU = new APU();
static public var ppu:PPU = new PPU();
static public var pad:PAD = new PAD();
static public var rom:ROM;
static public var map:Mapper;
static public var cfg:NESconfig;
}
}
|
package proxy
{
import UI.abstract.utils.CommonPool;
import _45degrees.com.friendsofed.isometric.Data;
import _45degrees.com.friendsofed.isometric.Point3D;
import _astar.Node;
import flash.geom.Point;
import net.CodeEvent;
import net.TcpPacket;
import org.puremvc.as3.patterns.proxy.Proxy;
public class PlayerProxy extends Proxy
{
public static const NAME:String = "PlayerProxy";
private var socketProxy:SocketProxy;
//这几个输出传到游戏里,只能用作赋值,不能被保存使用
private static var helpPos:Point3D = new Point3D();
private static var data1:Data = new Data();
private static var helpPoint:Point = new Point();
private static var helpArray:Array = new Array();
public function PlayerProxy()
{
super(NAME);
socketProxy = facade.retrieveProxy(SocketProxy.NAME) as SocketProxy;
socketProxy.socketClient.addEventListener(CodeEvent.CODE2,loginReturn);
socketProxy.socketClient.addEventListener(CodeEvent.CODE4,thingEnterGame);
socketProxy.socketClient.addEventListener(CodeEvent.CODE5,thingMove);
socketProxy.socketClient.addEventListener(CodeEvent.CODE6,thingOutGame);
socketProxy.socketClient.addEventListener(CodeEvent.CODE8,attackReturn);
socketProxy.socketClient.addEventListener(CodeEvent.CODE9,outScene);
socketProxy.socketClient.addEventListener(CodeEvent.CODE11,skillResult);
socketProxy.socketClient.addEventListener(CodeEvent.CODE12,skillDamage);
socketProxy.socketClient.addEventListener(CodeEvent.CODE13,monsterFollowUser);
socketProxy.socketClient.addEventListener(CodeEvent.CODE14,monsterGoBack);
socketProxy.socketClient.addEventListener(CodeEvent.CODE15,addBuff);
socketProxy.socketClient.addEventListener(CodeEvent.CODE16,delBuff);
socketProxy.socketClient.addEventListener(CodeEvent.CODE17,refreshBuff);
socketProxy.socketClient.addEventListener(CodeEvent.CODE18,flashTo);
socketProxy.socketClient.addEventListener(CodeEvent.CODE19,dead);
socketProxy.socketClient.addEventListener(CodeEvent.CODE20,life);
socketProxy.socketClient.addEventListener(CodeEvent.CODE21,skillComplete);
socketProxy.socketClient.addEventListener(CodeEvent.CODE22,readSkillComplete);
socketProxy.socketClient.addEventListener(CodeEvent.CODE23,startLoading);
socketProxy.socketClient.addEventListener(CodeEvent.CODE26,affectBySkill);
socketProxy.socketClient.addEventListener(CodeEvent.CODE27,flyThingOutGame);
socketProxy.socketClient.addEventListener(CodeEvent.CODE28,flyThingChangeTarget);
socketProxy.socketClient.addEventListener(CodeEvent.CODE29,omnislashComplete);
socketProxy.socketClient.addEventListener(CodeEvent.CODE30,omnislashChange);
}
/**
* 移动
*/
public function move(x:Number,y:Number,z:Number,dir:int,path:Array):void{
var packet:TcpPacket = TcpPacket.fromPool(CodeEvent.CODE3);
packet.writeDouble(x);
//trace(x+","+z);
packet.writeDouble(y);
packet.writeDouble(z);
packet.writeByte(dir);
//这个path的数组,不能被清理,因为移动的玩家还需要这个数组
var length:int = path.length;
packet.writeInt(length);
for(var i:int = 0;i<length;i++){
var node:Node = path[i];
packet.writeInt(node.x);
packet.writeInt(node.y);
}
//var point:Point = IsoUtils.isoToScreen(new Point3D(x,y,z));
//trace(point.x+":"+point.y);
//trace(Point.distance(point,new Point(path[1].x,path[1].y)));
socketProxy.socketClient.send(packet);
}
/**
* 攻击
*/
public function attack(skillId:int,type:int,target:*,dir:int = 0,attackNum:int = 0,attackAndSkillNum:int = 0):void{
var packet:TcpPacket = TcpPacket.fromPool(CodeEvent.CODE7);
packet.writeInt(skillId);
packet.writeInt(type);
if(type == 2){
//这个暂时先不清理,game->player->这里的,应该game里面清理
var point:Point3D = target as Point3D;
packet.writeDouble(point.x);
packet.writeDouble(point.y);
packet.writeDouble(point.z);
}else{
packet.writeInt(target);
}
packet.writeByte(dir);
packet.writeInt(attackNum);
packet.writeInt(attackAndSkillNum);
socketProxy.socketClient.send(packet);
}
/**
* 切换场景
*/
public function changeScene(sceneId:int):void{
var packet:TcpPacket = TcpPacket.fromPool(CodeEvent.CODE10);
packet.writeInt(sceneId);
socketProxy.socketClient.send(packet);
}
/**
* 自己进入场景
*/
private function loginReturn(event:CodeEvent):void{
var x:int = event.data.readInt();
var z:int = event.data.readInt();
var dir:int = event.data.readByte();
//var data1:Data = new Data();
data1.moveV = event.data.readDouble();
data1.jumpVerticalV = event.data.readDouble();
data1.jumpVerticalA = event.data.readDouble();
data1.attackSpeed = event.data.readDouble();
data1.hp = event.data.readInt();
data1.maxHp = event.data.readInt();
data1.att = event.data.readInt();
data1.def = event.data.readInt();
var dead:int = event.data.readByte();
var serverId:int = event.data.readInt();
var monsterId:int = event.data.readInt();
var sceneId:int = event.data.readInt();
var campId:int = event.data.readInt();
//var playerPoint:Point = new Point();
helpPoint.x = x;
helpPoint.y = z;
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.sceneId = sceneId;
helpObj.serverId = serverId;
helpObj.monsterId = monsterId;
helpObj.data = data1;
helpObj.dir = dir;
helpObj.playerPoint = helpPoint;
helpObj.dead = dead;
helpObj.campId = campId;
sendNotification(NotiConst.ENTER_GAME,helpObj);
}
/**
* 玩家攻击返回
*/
private function attackReturn(event:CodeEvent):void{
var id:int = event.data.readInt();
var skillId:int = event.data.readInt();
var type:int = event.data.readInt();
var targetId:int = 0;
if(type == 2){
helpPos.x = event.data.readDouble();
helpPos.y = event.data.readDouble();
helpPos.z = event.data.readDouble();
}else{
targetId = event.data.readInt();
if(targetId != 0){
helpPos.x = event.data.readDouble();
helpPos.y = event.data.readDouble();
helpPos.z = event.data.readDouble();
}
}
var dir:int = event.data.readByte();
var complete:int = event.data.readByte();
var flyThingId:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
helpObj.skillId = skillId;
helpObj.position = helpPos;
helpObj.targetId = targetId;
helpObj.dir = dir;
helpObj.complete = complete;
helpObj.flyThingId = flyThingId;
sendNotification(NotiConst.ATTACK,helpObj);
}
/**
* 其他玩家进入
*/
private function thingEnterGame(event:CodeEvent):void{
var id:int = event.data.readInt();
var monsterId:int = event.data.readInt();
var x:Number = event.data.readDouble();
var y:Number = event.data.readDouble();
var z:Number = event.data.readDouble();
var dir:int = event.data.readByte();
//var data1:Data = new Data();
data1.moveV = event.data.readDouble();
data1.jumpVerticalV = event.data.readDouble();
data1.jumpVerticalA = event.data.readDouble();
data1.attackSpeed = event.data.readDouble();
data1.hp = event.data.readInt();
data1.maxHp = event.data.readInt();
data1.att = event.data.readInt();
data1.def = event.data.readInt();
var dead:int = event.data.readByte();
var campId:int = event.data.readInt();
var enemy:int = event.data.readByte();
//var point:Point3D = new Point3D(x,y,z);
helpPos.setValue(x,y,z);
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
helpObj.position = helpPos;
helpObj.data = data1;
helpObj.dir = dir;
helpObj.monsterId = monsterId;
helpObj.dead = dead;
helpObj.campId = campId;
helpObj.enemy = enemy;
sendNotification(NotiConst.ADD_THING,helpObj);
}
/**
* 其他玩家移动
*/
private function thingMove(event:CodeEvent):void{
//if(!Game1.grid){
// return;
//}
var id:int = event.data.readInt();
var x:Number = event.data.readDouble();
var y:Number = event.data.readDouble();
var z:Number = event.data.readDouble();
var dir:int = event.data.readByte();
var length:int = event.data.readInt();
//这个最后会传到玩家那,被使用
var path:Array = CommonPool.fromPoolArray();
for(var i:int = 0;i<length;i++){
var nodeX:int = event.data.readInt();
var nodeY:int = event.data.readInt();
var node:Node = GlobalData.grid.getNode(nodeX,nodeY);
//node.x = event.data.readInt();
//node.y = event.data.readInt();
path[path.length] = node;
}
var nowNode:Node;
if(event.data.bytesAvailable > 0){
var nodeXX:int = event.data.readInt();
var nodeYY:int = event.data.readInt();
nowNode = GlobalData.grid.getNode(nodeXX,nodeYY);
//nowNode.x = event.data.readInt();
//nowNode.y = event.data.readInt();
}
//var point:Point3D = new Point3D(x,y,z);
helpPos.setValue(x,y,z);
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
helpObj.position = helpPos;
helpObj.path = path;
helpObj.dir = dir;
helpObj.nowNode = nowNode;
sendNotification(NotiConst.THING_MOVE,helpObj);
}
/**
* 其他玩家离开
*/
private function thingOutGame(event:CodeEvent):void{
var id:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
sendNotification(NotiConst.REMOVE_THING,helpObj);
}
/**
* 自己离开场景
*/
private function outScene(event:CodeEvent):void{
sendNotification(NotiConst.OUT_SCENE);
}
private function skillResult(event:CodeEvent):void{
var result:int = event.data.readInt();
var skillId:int = event.data.readInt();
var attackNum:int = event.data.readInt();
var attackAndSkillNum:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.result = result;
helpObj.skillId = skillId;
helpObj.attackNum = attackNum;
helpObj.attackAndSkillNum = attackAndSkillNum;
var type:int = event.data.readInt();
helpObj.type = type;
var x:Number;
var y:Number;
var z:Number;
if(type == 2){
x = event.data.readDouble();
y = event.data.readDouble();
z = event.data.readDouble();
helpPos.setValue(x,y,z);
helpObj.position = helpPos;
}else{
var targetId:int = event.data.readInt();
helpObj.targetId = targetId;
//是玩家或者怪物
if(helpObj.result == 1 && helpObj.targetId != 0){
x = event.data.readDouble();
y = event.data.readDouble();
z = event.data.readDouble();
helpPos.setValue(x,y,z);
helpObj.position = helpPos;
}
}
if(helpObj.result == 1){
var flyThingId:int = event.data.readInt();
helpObj.flyThingId = flyThingId;
}
sendNotification(NotiConst.SKILL_RESULT,helpObj);
}
private function skillDamage(event:CodeEvent):void{
var type:int = event.data.readInt();
var skillId:int = event.data.readInt();
var serverId:int = event.data.readInt();
var damage:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.type = type;
helpObj.skillId = skillId;
helpObj.serverId = serverId;
helpObj.damage = damage;
sendNotification(NotiConst.SKILL_DAMAGE,helpObj);
}
private function monsterFollowUser(event:CodeEvent):void{
var id:int = event.data.readInt();
var x:Number = event.data.readDouble();
var y:Number = event.data.readDouble();
var z:Number = event.data.readDouble();
var dir:int = event.data.readByte();
var toId:int = event.data.readInt();
//var point:Point3D = new Point3D(x,y,z);
helpPos.setValue(x,y,z);
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
helpObj.position = helpPos;
helpObj.dir = dir;
helpObj.toTargetId = toId;
sendNotification(NotiConst.MONSTER_FOLLOW_USER,helpObj);
}
private function monsterGoBack(event:CodeEvent):void{
//if(!Game1.grid){
// return;
//}
var id:int = event.data.readInt();
var x:Number = event.data.readDouble();
var y:Number = event.data.readDouble();
var z:Number = event.data.readDouble();
var dir:int = event.data.readByte();
var nodeX:int = event.data.readInt();
var nodeY:int = event.data.readInt();
var node:Node = GlobalData.grid.getNode(nodeX,nodeY);
//var point:Point3D = new Point3D(x,y,z);
helpPos.setValue(x,y,z);
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
helpObj.position = helpPos;
helpObj.dir = dir;
helpObj.node = node;
sendNotification(NotiConst.MONSTER_GO_BACK,helpObj);
}
//这里可以传到加buff那一个长度,这样所有的buff对象就可以被充分利用了
private function addBuff(event:CodeEvent):void{
var targetId:int = event.data.readInt();
var length:int = event.data.readInt();
for(var i:int = 0;i<length;i++){
if(!helpArray[i]){
helpArray[i] = new Object();
}
helpArray[i]["id"] = event.data.readInt();
helpArray[i]["attackId"] = event.data.readInt();
helpArray[i]["duration"] = event.data.readInt();
}
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.targetId = targetId;
helpObj.buffArray = helpArray;
helpObj.length = length;
sendNotification(NotiConst.ADD_BUFF,helpObj);
}
private function delBuff(event:CodeEvent):void{
var targetId:int = event.data.readInt();
var length:int = event.data.readInt();
for(var i:int = 0;i<length;i++){
if(!helpArray[i]){
helpArray[i] = new Object();
}
helpArray[i]["id"] = event.data.readInt();
helpArray[i]["attackId"] = event.data.readInt();
}
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.targetId = targetId;
helpObj.buffArray = helpArray;
helpObj.length = length;
sendNotification(NotiConst.DEL_BUFF,helpObj);
}
private function refreshBuff(event:CodeEvent):void{
var targetId:int = event.data.readInt();
var length:int = event.data.readInt();
for(var i:int = 0;i<length;i++){
if(!helpArray[i]){
helpArray[i] = new Object();
}
helpArray[i]["id"] = event.data.readInt();
helpArray[i]["attackId"] = event.data.readInt();
helpArray[i]["duration"] = event.data.readInt();
}
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.targetId = targetId;
helpObj.buffArray = helpArray;
helpObj.length = length;
sendNotification(NotiConst.REFRESH_BUFF,helpObj);
}
private function flashTo(event:CodeEvent):void{
var targetId:int = event.data.readInt();
var x:Number = event.data.readDouble();
var y:Number = event.data.readDouble();
var z:Number = event.data.readDouble();
var dir:int = event.data.readByte();
var skillId:int = event.data.readInt();
var isClearUseSkill:int = event.data.readInt();
//var point:Point3D = new Point3D(x,y,z);
helpPos.setValue(x,y,z);
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.targetId = targetId;
helpObj.position = helpPos;
helpObj.dir = dir;
helpObj.skillId = skillId;
helpObj.isClearUseSkill = isClearUseSkill;
sendNotification(NotiConst.FLASH,helpObj);
}
private function dead(event:CodeEvent):void{
var targetId:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.targetId = targetId;
sendNotification(NotiConst.DEAD,helpObj);
}
private function life(event:CodeEvent):void{
var targetId:int = event.data.readInt();
var hp:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.targetId = targetId;
helpObj.hp = hp;
sendNotification(NotiConst.LIFE,helpObj);
}
private function skillComplete(event:CodeEvent):void{
var targetId:int = event.data.readInt();
var skillId:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.targetId = targetId;
helpObj.skillId = skillId;
sendNotification(NotiConst.SKILL_COMPLETE,helpObj);
}
private function readSkillComplete(event:CodeEvent):void{
sendNotification(NotiConst.READ_SKILL_COMPLETE);
}
private function startLoading(event:CodeEvent):void{
var monsterId:int = event.data.readInt();
var sceneId:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.sceneId = sceneId;
helpObj.monsterId = monsterId;
sendNotification(NotiConst.START_LOADING,helpObj);
}
/**
* 切换场景
*/
public function loadingOk():void{
var packet:TcpPacket = TcpPacket.fromPool(CodeEvent.CODE24);
socketProxy.socketClient.send(packet);
}
public function cancelBuff(buffId:int):void{
var packet:TcpPacket = TcpPacket.fromPool(CodeEvent.CODE25);
packet.writeInt(buffId);
socketProxy.socketClient.send(packet);
}
private function affectBySkill(event:CodeEvent):void{
var targetId:int = event.data.readInt();
var skillId:int = event.data.readInt();
var x:Number = event.data.readDouble();
var y:Number = event.data.readDouble();
var z:Number = event.data.readDouble();
helpPos.setValue(x,y,z);
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.targetId = targetId;
helpObj.skillId = skillId;
helpObj.toPosition = helpPos;
sendNotification(NotiConst.AFFECT_BY_SKILL,helpObj);
}
/**
* 飞行道具离开场景
*/
private function flyThingOutGame(event:CodeEvent):void{
var id:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
sendNotification(NotiConst.REMOVE_FLY_THING,helpObj);
}
/**
* 飞行道具改变目标
*/
private function flyThingChangeTarget(event:CodeEvent):void{
var id:int = event.data.readInt();
var targetId:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
helpObj.targetId = targetId;
sendNotification(NotiConst.FLY_THING_CHANGE_TARGET,helpObj);
}
private function omnislashComplete(event:CodeEvent):void{
var id:int = event.data.readInt();
var skillId:int = event.data.readInt();
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
helpObj.skillId = skillId;
sendNotification(NotiConst.OMNISLASH_COMPLETE,helpObj);
}
private function omnislashChange(event:CodeEvent):void{
var id:int = event.data.readInt();
var skillId:int = event.data.readInt();
var targetId:int = event.data.readInt();
var x:Number = event.data.readDouble();
var y:Number = event.data.readDouble();
var z:Number = event.data.readDouble();
helpPos.setValue(x,y,z);
var helpObj:Object = CommonPool.fromPoolObject();
helpObj.id = id;
helpObj.skillId = skillId;
helpObj.targetId = targetId;
helpObj.toPosition = helpPos;
sendNotification(NotiConst.OMNISLASH_CHANGE,helpObj);
}
}
} |
package sk.yoz.ycanvas.demo.explorer.modes.onboard
{
import flash.display.BitmapData;
import flash.events.IEventDispatcher;
import sk.yoz.ycanvas.demo.explorer.modes.Layer;
import sk.yoz.ycanvas.demo.explorer.modes.Partition;
public class OnBoardPartition extends Partition
{
private static var BACKGROUND:BitmapData;
public function OnBoardPartition(layer:Layer, x:int, y:int,
requestedWidth:uint, requestedHeight:uint, dispatcher:IEventDispatcher)
{
if(!BACKGROUND)
BACKGROUND = new BitmapData(requestedWidth, requestedHeight, false, 0xffffff);
super(layer, x, y, requestedWidth, requestedHeight, dispatcher);
}
override protected function get url():String
{
return "http://onboard.yoz.sk/board/_default_/"
+ layer.level + "/" + x + "." + y + "."
+ (layer.level == 1 ? "png" : "jpeg");
}
override protected function updateTexture():void
{
var bitmapData:BitmapData = BACKGROUND.clone();
this.bitmapData && bitmapData.draw(this.bitmapData);
texture = bitmapData;
}
}
} |
package com.company.assembleegameclient.mapeditor {
import com.company.assembleegameclient.ui.Scrollbar;
import com.company.util.GraphicsUtil;
import flash.display.CapsStyle;
import flash.display.GraphicsPath;
import flash.display.GraphicsSolidFill;
import flash.display.GraphicsStroke;
import flash.display.IGraphicsData;
import flash.display.JointStyle;
import flash.display.LineScaleMode;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
class Chooser extends Sprite {
public static const WIDTH:int = 136;
public static const HEIGHT:int = 430;
private static const SCROLLBAR_WIDTH:int = 20;
public var layer_:int;
public var selected_:Element;
protected var elementSprite_:Sprite;
protected var scrollBar_:Scrollbar;
private var mask_:Shape;
private var elements_:Vector.<Element>;
private var outlineFill_:GraphicsSolidFill = new GraphicsSolidFill(0xFFFFFF, 1);
private var lineStyle_:GraphicsStroke = new GraphicsStroke(1, false, LineScaleMode.NORMAL, CapsStyle.NONE, JointStyle.ROUND, 3, outlineFill_);
private var backgroundFill_:GraphicsSolidFill = new GraphicsSolidFill(0x363636, 1);
private var path_:GraphicsPath = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
private const graphicsData_:Vector.<IGraphicsData> = new <IGraphicsData>[lineStyle_, backgroundFill_, path_, GraphicsUtil.END_FILL, GraphicsUtil.END_STROKE];
public function Chooser(_arg1:int) {
this.elements_ = new Vector.<Element>();
super();
this.layer_ = _arg1;
this.drawBackground();
this.elementSprite_ = new Sprite();
this.elementSprite_.x = 4;
this.elementSprite_.y = 6;
addChild(this.elementSprite_);
this.scrollBar_ = new Scrollbar(SCROLLBAR_WIDTH, (HEIGHT - 8), 0.1, this);
this.scrollBar_.x = ((WIDTH - SCROLLBAR_WIDTH) - 6);
this.scrollBar_.y = 4;
this.scrollBar_.addEventListener(Event.CHANGE, this.onScrollBarChange);
var _local2:Shape = new Shape();
_local2.graphics.beginFill(0);
_local2.graphics.drawRect(0, 2, ((Chooser.WIDTH - SCROLLBAR_WIDTH) - 4), (Chooser.HEIGHT - 4));
addChild(_local2);
this.elementSprite_.mask = _local2;
addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage);
}
public function selectedType():int {
return (this.selected_.type_);
}
public function setSelectedType(_arg1:int):void {
var _local2:Element;
for each (_local2 in this.elements_) {
if (_local2.type_ == _arg1) {
this.setSelected(_local2);
return;
}
}
}
protected function addElement(_arg1:Element):void {
var _local2:int;
_local2 = this.elements_.length;
_arg1.x = ((((_local2 % 2)) == 0) ? 0 : (2 + Element.WIDTH));
_arg1.y = ((int((_local2 / 2)) * Element.HEIGHT) + 6);
this.elementSprite_.addChild(_arg1);
if (_local2 == 0) {
this.setSelected(_arg1);
}
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
this.elements_.push(_arg1);
}
protected function removeElements():void {
this.elements_ = new Vector.<Element>();
removeChild(this.elementSprite_);
this.elementSprite_ = new Sprite();
this.elementSprite_.x = 4;
this.elementSprite_.y = 6;
var _local1:Shape = new Shape();
_local1.graphics.beginFill(0);
_local1.graphics.drawRect(0, 2, ((Chooser.WIDTH - SCROLLBAR_WIDTH) - 4), (Chooser.HEIGHT - 4));
addChild(_local1);
this.elementSprite_.mask = _local1;
addChild(this.elementSprite_);
}
protected function onMouseDown(_arg1:MouseEvent):void {
var _local2:Element = (_arg1.currentTarget as Element);
this.setSelected(_local2);
}
protected function setSelected(_arg1:Element):void {
if (this.selected_ != null) {
this.selected_.setSelected(false);
}
this.selected_ = _arg1;
this.selected_.setSelected(true);
}
protected function onScrollBarChange(_arg1:Event):void {
this.elementSprite_.y = (6 - (this.scrollBar_.pos() * ((this.elementSprite_.height + 12) - HEIGHT)));
}
protected function onAddedToStage(_arg1:Event):void {
this.scrollBar_.setIndicatorSize(HEIGHT, this.elementSprite_.height);
addChild(this.scrollBar_);
}
protected function onRemovedFromStage(_arg1:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
}
private function drawBackground():void {
GraphicsUtil.clearPath(this.path_);
GraphicsUtil.drawCutEdgeRect(0, 0, WIDTH, HEIGHT, 4, [1, 1, 1, 1], this.path_);
graphics.drawGraphicsData(this.graphicsData_);
}
}
}
|
/*
Copyright 2012-2013 Renaun Erickson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@author Renaun Erickson / renaun.com / @renaun
*/
package renaun.html.stub
{
[JavaScript(export="false", name="Uint16Array")]
public class Uint16Array3 extends Array
{
public function Uint16Array3(buffer:ArrayBuffer, startOffest:int, length:int)
{
}
}
} |
package {
import org.as3commons.collections.framework.IRecursiveIterator;
import org.as3commons.collections.iterators.RecursiveFilterIterator;
import flash.display.Sprite;
public class RecursiveFilterIteratorExample extends Sprite {
public function RecursiveFilterIteratorExample() {
var root : Node = new Node(0);
var child1 : Node = new Node(1);
child1.children = [new Node(2), new Node(3)];
var child2 : Node = new Node(4);
child2.children = [new Node(5), new Node(6)];
var child3 : Node = new Node(7);
var child4 : Node = new Node(8);
child4.children = [new Node(9), new Node(10)];
child3.children = [child4, new Node(11)];
root.children = [child1, child2, child3];
var iterator : IRecursiveIterator;
var item : Node;
// All items
iterator = new RecursiveFilterIterator(root, null, null);
while (iterator.hasNext()) {
item = iterator.next();
trace (prefix(iterator.depth) + item);
}
// Node 1
// .......Node 2
// .......Node 3
// Node 4
// .......Node 5
// .......Node 6
// Node 7
// .......Node 8
// ..............Node 9
// ..............Node 10
// .......Node 11
// Only odd items
iterator = new RecursiveFilterIterator(
root, oddFilter, null
);
while (iterator.hasNext()) {
item = iterator.next();
trace (prefix(iterator.depth) + item);
}
// Node 1
// .......Node 3
// Node 7
// .......Node 11
// Only even items
iterator = new RecursiveFilterIterator(
root, evenFilter, null
);
while (iterator.hasNext()) {
item = iterator.next();
trace (prefix(iterator.depth) + item);
}
// Node 4
// .......Node 6
// All items + only children of odd items
iterator = new RecursiveFilterIterator(
root, null, oddFilter
);
while (iterator.hasNext()) {
item = iterator.next();
trace (prefix(iterator.depth) + item);
}
// Node 1
// .......Node 2
// .......Node 3
// Node 4
// Node 7
// .......Node 8
// .......Node 11
// All items + only children of even items
iterator = new RecursiveFilterIterator(
root, null, evenFilter
);
while (iterator.hasNext()) {
item = iterator.next();
trace (prefix(iterator.depth) + item);
}
// Node 1
// Node 4
// .......Node 5
// .......Node 6
// Node 7
// Only items > 5
iterator = new RecursiveFilterIterator(
root, greater5Filter, null
);
while (iterator.hasNext()) {
item = iterator.next();
trace (prefix(iterator.depth) + item);
}
// Node 7
// .......Node 8
// ..............Node 9
// ..............Node 10
// .......Node 11
// All items + only children of items > 5
iterator = new RecursiveFilterIterator(
root, null, greater5Filter
);
while (iterator.hasNext()) {
item = iterator.next();
trace (prefix(iterator.depth) + item);
}
// Node 1
// Node 4
// Node 7
// .......Node 8
// ..............Node 9
// ..............Node 10
// .......Node 11
}
private function oddFilter(item : *) : Boolean {
// lets pass only odd numbers
return Node(item).number % 2 == 1;
}
private function evenFilter(item : *) : Boolean {
// lets pass only even numbers
return Node(item).number % 2 == 0;
}
private function greater5Filter(item : *) : Boolean {
// lets pass only items > 5
return Node(item).number > 5;
}
private function prefix(depth : uint) : String {
var prefix : String = "";
for (var i : uint = 0; i < depth; i++) prefix += ".......";
return prefix;
}
}
}
import org.as3commons.collections.framework.IIterable;
import org.as3commons.collections.framework.IIterator;
import org.as3commons.collections.iterators.ArrayIterator;
internal class Node implements IIterable {
public var number : uint;
public var children : Array;
public function Node(theNumber : uint) {
number = theNumber;
children = new Array();
}
public function iterator(cursor : * = undefined) : IIterator {
return new ArrayIterator(children);
}
public function toString() : String {
return "Node " + number.toString();
}
}
|
package {
import com.ayanray.loaders.AssetLoader;
import flash.display.Sprite;
import flash.net.NetStream;
public class VideoTest extends Sprite
{
private var netStream:NetStream;
public function VideoTest()
{
var obj:Object = {"assets/video/teleport.flv": {onComplete: loadComplete, onMetaData: metaDataHandler, extra: {name: "Teleport"}}};
new AssetLoader( obj );
}
private function onError(obj:Object):void
{
trace(obj.extra.name, "has thrown an error");
}
private function loadComplete(obj:Object):void
{
trace("Load complete");
netStream = obj.netStream as NetStream;
this.addChild(obj.asset);
}
private function metaDataHandler(obj:Object):void
{
this.getChildAt(0).width = obj.metaData.width;
this.getChildAt(0).height = obj.metaData.height;
trace("Meta Data // Width:", obj.metaData.width, "Height:", obj.metaData.height);
}
private function cuePointHandler(obj:Object):void
{
trace("CuePoint:", obj.cuePoint.name, "\t" + obj.cuePoint.time);
}
}
}
|
class mx.controls.scrollClasses.ScrollBar extends mx.core.UIComponent
{
var isScrolling, scrollTrack_mc, scrollThumb_mc, __get__scrollPosition, __get__pageScrollSize, __get__lineScrollSize, __height, tabEnabled, focusEnabled, boundingBox_mc, setSkin, upArrow_mc, _minHeight, _minWidth, downArrow_mc, createObject, createClassObject, enabled, __get__virtualHeight, __set__scrollPosition, _height, dispatchEvent, minMode, maxMode, plusMode, minusMode, _parent, getStyle, scrolling, _ymouse, __set__lineScrollSize, __set__pageScrollSize;
function ScrollBar()
{
super();
} // End of the function
function get scrollPosition()
{
return (_scrollPosition);
} // End of the function
function set scrollPosition(pos)
{
_scrollPosition = pos;
if (isScrolling != true)
{
pos = Math.min(pos, maxPos);
pos = Math.max(pos, minPos);
var _loc3 = (pos - minPos) * (scrollTrack_mc.height - scrollThumb_mc._height) / (maxPos - minPos) + scrollTrack_mc.top;
scrollThumb_mc.move(0, _loc3);
} // end if
//return (this.scrollPosition());
null;
} // End of the function
function get pageScrollSize()
{
return (largeScroll);
} // End of the function
function set pageScrollSize(lScroll)
{
largeScroll = lScroll;
//return (this.pageScrollSize());
null;
} // End of the function
function set lineScrollSize(sScroll)
{
smallScroll = sScroll;
//return (this.lineScrollSize());
null;
} // End of the function
function get lineScrollSize()
{
return (smallScroll);
} // End of the function
function get virtualHeight()
{
return (__height);
} // End of the function
function init(Void)
{
super.init();
_scrollPosition = 0;
tabEnabled = false;
focusEnabled = false;
boundingBox_mc._visible = false;
boundingBox_mc._width = boundingBox_mc._height = 0;
} // End of the function
function createChildren(Void)
{
if (scrollTrack_mc == undefined)
{
this.setSkin(mx.controls.scrollClasses.ScrollBar.skinIDTrack, scrollTrackName);
} // end if
scrollTrack_mc.visible = false;
var _loc3 = new Object();
_loc3.enabled = false;
_loc3.preset = mx.controls.SimpleButton.falseDisabled;
_loc3.initProperties = 0;
_loc3.autoRepeat = true;
_loc3.tabEnabled = false;
var _loc2;
if (upArrow_mc == undefined)
{
_loc2 = this.createButton(upArrowName, "upArrow_mc", mx.controls.scrollClasses.ScrollBar.skinIDUpArrow, _loc3);
} // end if
_loc2.buttonDownHandler = onUpArrow;
_loc2.clickHandler = onScrollChanged;
_minHeight = _loc2.height;
_minWidth = _loc2.width;
if (downArrow_mc == undefined)
{
_loc2 = this.createButton(downArrowName, "downArrow_mc", mx.controls.scrollClasses.ScrollBar.skinIDDownArrow, _loc3);
} // end if
_loc2.buttonDownHandler = onDownArrow;
_loc2.clickHandler = onScrollChanged;
_minHeight = _minHeight + _loc2.height;
} // End of the function
function createButton(linkageName, id, skinID, o)
{
if (skinID == mx.controls.scrollClasses.ScrollBar.skinIDUpArrow)
{
o.falseUpSkin = upArrowUpName;
o.falseDownSkin = upArrowDownName;
o.falseOverSkin = upArrowOverName;
}
else
{
o.falseUpSkin = downArrowUpName;
o.falseDownSkin = downArrowDownName;
o.falseOverSkin = downArrowOverName;
} // end else if
var _loc3 = this.createObject(linkageName, id, skinID, o);
this[id].visible = false;
this[id].useHandCursor = false;
return (_loc3);
} // End of the function
function createThumb(Void)
{
var _loc2 = new Object();
_loc2.validateNow = true;
_loc2.tabEnabled = false;
_loc2.leftSkin = thumbTopName;
_loc2.middleSkin = thumbMiddleName;
_loc2.rightSkin = thumbBottomName;
_loc2.gripSkin = thumbGripName;
this.createClassObject(mx.controls.scrollClasses.ScrollThumb, "scrollThumb_mc", mx.controls.scrollClasses.ScrollBar.skinIDThumb, _loc2);
} // End of the function
function setScrollProperties(pSize, mnPos, mxPos, ls)
{
var _loc4;
var _loc2 = scrollTrack_mc;
pageSize = pSize;
largeScroll = ls != undefined && ls > 0 ? (ls) : (pSize);
minPos = Math.max(mnPos, 0);
maxPos = Math.max(mxPos, 0);
_scrollPosition = Math.max(minPos, _scrollPosition);
_scrollPosition = Math.min(maxPos, _scrollPosition);
if (maxPos - minPos > 0 && enabled)
{
var _loc5 = _scrollPosition;
if (!initializing)
{
upArrow_mc.enabled = true;
downArrow_mc.enabled = true;
} // end if
_loc2.onPress = _loc2.onDragOver = startTrackScroller;
_loc2.onRelease = releaseScrolling;
_loc2.onDragOut = _loc2.stopScrolling = stopScrolling;
_loc2.onReleaseOutside = releaseScrolling;
_loc2.useHandCursor = false;
if (scrollThumb_mc == undefined)
{
this.createThumb();
} // end if
var _loc3 = scrollThumb_mc;
if (scrollTrackOverName.length > 0)
{
_loc2.onRollOver = trackOver;
_loc2.onRollOut = trackOut;
} // end if
_loc4 = pageSize / (maxPos - minPos + pageSize) * _loc2.height;
if (_loc4 < _loc3.minHeight)
{
if (_loc2.height < _loc3.minHeight)
{
_loc3.__set__visible(false);
}
else
{
_loc4 = _loc3.minHeight;
_loc3.__set__visible(true);
_loc3.setSize(_minWidth, _loc3.minHeight + 0);
} // end else if
}
else
{
_loc3.__set__visible(true);
_loc3.setSize(_minWidth, _loc4);
} // end else if
_loc3.setRange(upArrow_mc.__get__height() + 0, this.__get__virtualHeight() - downArrow_mc.__get__height() - _loc3.__get__height(), minPos, maxPos);
_loc5 = Math.min(_loc5, maxPos);
this.__set__scrollPosition(Math.max(_loc5, minPos));
}
else
{
scrollThumb_mc.__set__visible(false);
if (!initializing)
{
upArrow_mc.enabled = false;
downArrow_mc.enabled = false;
} // end if
delete _loc2.onPress;
delete _loc2.onDragOver;
delete _loc2.onRelease;
delete _loc2.onDragOut;
delete _loc2.onRollOver;
delete _loc2.onRollOut;
delete _loc2.onReleaseOutside;
} // end else if
if (initializing)
{
scrollThumb_mc.__set__visible(false);
} // end if
} // End of the function
function setEnabled(enabledFlag)
{
super.setEnabled(enabledFlag);
this.setScrollProperties(pageSize, minPos, maxPos, largeScroll);
} // End of the function
function draw(Void)
{
if (initializing)
{
initializing = false;
scrollTrack_mc.visible = true;
upArrow_mc.__set__visible(true);
downArrow_mc.__set__visible(true);
} // end if
this.size();
} // End of the function
function size(Void)
{
if (_height == 1)
{
return;
} // end if
if (upArrow_mc == undefined)
{
return;
} // end if
var _loc3 = upArrow_mc.__get__height();
var _loc2 = downArrow_mc.__get__height();
upArrow_mc.move(0, 0);
var _loc4 = scrollTrack_mc;
_loc4._y = _loc3;
_loc4._height = this.__get__virtualHeight() - _loc3 - _loc2;
downArrow_mc.move(0, this.__get__virtualHeight() - _loc2);
this.setScrollProperties(pageSize, minPos, maxPos, largeScroll);
} // End of the function
function dispatchScrollEvent(detail)
{
this.dispatchEvent({type: "scroll", detail: detail});
} // End of the function
function isScrollBarKey(k)
{
if (k == 36)
{
if (this.__get__scrollPosition() != 0)
{
this.__set__scrollPosition(0);
this.dispatchScrollEvent(minMode);
} // end if
return (true);
}
else if (k == 35)
{
if (this.__get__scrollPosition() < maxPos)
{
this.__set__scrollPosition(maxPos);
this.dispatchScrollEvent(maxMode);
} // end if
return (true);
} // end else if
return (false);
} // End of the function
function scrollIt(inc, mode)
{
var _loc3 = smallScroll;
if (inc != "Line")
{
_loc3 = largeScroll == 0 ? (pageSize) : (largeScroll);
} // end if
var _loc2 = _scrollPosition + mode * _loc3;
if (_loc2 > maxPos)
{
_loc2 = maxPos;
}
else if (_loc2 < minPos)
{
_loc2 = minPos;
} // end else if
if (this.__get__scrollPosition() != _loc2)
{
this.__set__scrollPosition(_loc2);
var _loc4 = mode < 0 ? (minusMode) : (plusMode);
this.dispatchScrollEvent(inc + _loc4);
} // end if
} // End of the function
function startTrackScroller(Void)
{
_parent.pressFocus();
if (_parent.scrollTrackDownName.length > 0)
{
if (_parent.scrollTrackDown_mc == undefined)
{
_parent.setSkin(mx.controls.scrollClasses.ScrollBar.skinIDTrackDown, scrollTrackDownName);
}
else
{
_parent.scrollTrackDown_mc.visible = true;
} // end if
} // end else if
_parent.trackScroller();
_parent.scrolling = setInterval(_parent, "scrollInterval", this.getStyle("repeatDelay"), "Page", -1);
} // End of the function
function scrollInterval(inc, mode)
{
clearInterval(scrolling);
if (inc == "Page")
{
this.trackScroller();
}
else
{
this.scrollIt(inc, mode);
} // end else if
scrolling = setInterval(this, "scrollInterval", this.getStyle("repeatInterval"), inc, mode);
} // End of the function
function trackScroller(Void)
{
if (scrollThumb_mc._y + scrollThumb_mc.__get__height() < _ymouse)
{
this.scrollIt("Page", 1);
}
else if (scrollThumb_mc._y > _ymouse)
{
this.scrollIt("Page", -1);
} // end else if
} // End of the function
function dispatchScrollChangedEvent(Void)
{
this.dispatchEvent({type: "scrollChanged"});
} // End of the function
function stopScrolling(Void)
{
clearInterval(_parent.scrolling);
_parent.scrollTrackDown_mc.visible = false;
} // End of the function
function releaseScrolling(Void)
{
_parent.releaseFocus();
this.stopScrolling();
_parent.dispatchScrollChangedEvent();
} // End of the function
function trackOver(Void)
{
if (_parent.scrollTrackOverName.length > 0)
{
if (_parent.scrollTrackOver_mc == undefined)
{
_parent.setSkin(mx.controls.scrollClasses.ScrollBar.skinIDTrackOver, scrollTrackOverName);
}
else
{
_parent.scrollTrackOver_mc.visible = true;
} // end if
} // end else if
} // End of the function
function trackOut(Void)
{
_parent.scrollTrackOver_mc.visible = false;
} // End of the function
function onUpArrow(Void)
{
_parent.scrollIt("Line", -1);
} // End of the function
function onDownArrow(Void)
{
_parent.scrollIt("Line", 1);
} // End of the function
function onScrollChanged(Void)
{
_parent.dispatchScrollChangedEvent();
} // End of the function
static var symbolOwner = mx.core.UIComponent;
var className = "ScrollBar";
var minPos = 0;
var maxPos = 0;
var pageSize = 0;
var largeScroll = 0;
var smallScroll = 1;
var _scrollPosition = 0;
var scrollTrackName = "ScrollTrack";
var scrollTrackOverName = "";
var scrollTrackDownName = "";
var upArrowName = "BtnUpArrow";
var upArrowUpName = "ScrollUpArrowUp";
var upArrowOverName = "ScrollUpArrowOver";
var upArrowDownName = "ScrollUpArrowDown";
var downArrowName = "BtnDownArrow";
var downArrowUpName = "ScrollDownArrowUp";
var downArrowOverName = "ScrollDownArrowOver";
var downArrowDownName = "ScrollDownArrowDown";
var thumbTopName = "ScrollThumbTopUp";
var thumbMiddleName = "ScrollThumbMiddleUp";
var thumbBottomName = "ScrollThumbBottomUp";
var thumbGripName = "ScrollThumbGripUp";
static var skinIDTrack = 0;
static var skinIDTrackOver = 1;
static var skinIDTrackDown = 2;
static var skinIDUpArrow = 3;
static var skinIDDownArrow = 4;
static var skinIDThumb = 5;
var idNames = new Array("scrollTrack_mc", "scrollTrackOver_mc", "scrollTrackDown_mc", "upArrow_mc", "downArrow_mc");
var clipParameters = {minPos: 1, maxPos: 1, pageSize: 1, scrollPosition: 1, lineScrollSize: 1, pageScrollSize: 1, visible: 1, enabled: 1};
static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.scrollClasses.ScrollBar.prototype.clipParameters, mx.core.UIComponent.prototype.clipParameters);
var initializing = true;
} // End of Class
|
namespace Object
{
shared Object@ getObject(u16 id)
{
Object@[]@ objects = Object::getObjects();
for (uint i = 0; i < objects.size(); i++)
{
Object@ object = objects[i];
if (object.getID() == id)
{
return object;
}
}
return null;
}
shared Object@ getObjectByIndex(int index)
{
Object@[]@ objects = Object::getObjects();
if (index >= 0 && index < objects.size())
{
return objects[index];
}
return null;
}
shared void AddObject(Object@ object)
{
Object@[]@ objects = Object::getObjects();
objects.push_back(object);
getRules().set("objects", @objects);
object.OnInit();
if (!isClient())
{
object.SerializeInit();
}
}
shared void RemoveObject(Object@ object)
{
Object::RemoveObject(object.getID());
}
shared void RemoveObject(u16 id)
{
Object@[]@ objects = Object::getObjects();
for (uint i = 0; i < objects.size(); i++)
{
Object@ object = objects[i];
if (object.getID() == id)
{
object.OnRemove();
objects.removeAt(i);
if (!isClient())
{
CBitStream bs;
bs.write_u16(i);
object.SerializeRemove(bs);
}
return;
}
}
}
shared void RemoveObjectByIndex(uint index)
{
Object@ object = Object::getObjectByIndex(index);
if (object is null) return;
object.OnRemove();
Object@[]@ objects = Object::getObjects();
objects.removeAt(index);
if (!isClient())
{
CBitStream bs;
bs.write_u16(index);
object.SerializeRemove(bs);
}
}
shared bool objectExists(u16 id)
{
return Object::getObject(id) !is null;
}
shared Object@[]@ getObjects()
{
Object@[]@ objects;
if (!getRules().get("objects", @objects))
{
@objects = array<Object@>();
getRules().set("objects", @objects);
}
return objects;
}
shared uint getObjectCount()
{
return Object::getObjects().size();
}
shared uint getVisibleObjectCount()
{
uint count = 0;
Object@[]@ objects = Object::getObjects();
for (uint i = 0; i < objects.size(); i++)
{
Object@ object = objects[i];
if (object.isVisible())
{
count++;
}
}
return count;
}
shared void ClearObjects()
{
Object@[]@ objects = Object::getObjects();
for (int i = objects.size() - 1; i >= 0; i--)
{
Object@ object = objects[i];
object.OnRemove();
CBitStream bs;
bs.write_u16(i);
object.SerializeRemove(bs);
}
getRules().clear("objects");
}
shared bool saferead(CBitStream@ bs, Object@ &out object)
{
u16 id;
if (!bs.saferead_u16(id)) return false;
@object = Object::getObject(id);
return object !is null;
}
}
|
package org.qrcode.input
{
import org.qrcode.QRbitstream;
import org.qrcode.enum.QRCodeEncodeType;
import org.qrcode.specs.QRSpecs;
import org.qrcode.utils.QRUtil;
public class QRInputItem
{
public static const STRUCTURE_HEADER_BITS:int = 20;
public static const MAX_STRUCTURED_SYMBOLS:int = 16;
public var mode:int;
public var size:int;
public var data:Array;
public var bstream:QRbitstream;
public function QRInputItem(mode:int, size:int, data:Array, bstream:QRbitstream = null)
{
var setData:Array = data.slice(0,size);
if (setData.length < size) {
setData = QRUtil.array_merge(setData,QRUtil.array_fill(0,size-setData.length,0x00));
}
if(!QRInput.check(mode, size, setData)) {
throw new Error('Error m:'+mode+',s:'+size+',d:'+setData.join(','));
}
this.mode = mode;
this.size = size;
this.data = setData;
this.bstream = bstream;
}
public function encodeModeNum(version:int):int
{
try {
var words:int = this.size / 3;
var bs:QRbitstream = new QRbitstream();
var val:int = 0x01;
bs.appendNum(4, val);
bs.appendNum(QRSpecs.lengthIndicator(QRCodeEncodeType.QRCODE_ENCODE_NUMERIC, version), size);
for(var i:int=0; i<words; i++) {
val = (this.data[i*3].toString().charCodeAt() - "0".charCodeAt()) * 100;
val += (this.data[i*3+1].toString().charCodeAt() - "0".charCodeAt()) * 10;
val += (this.data[i*3+2].toString().charCodeAt() - "0".charCodeAt());
bs.appendNum(10, val);
}
if(this.size - words * 3 == 1) {
val = (this.data[words*3]).toString().charCodeAt() - '0'.charCodeAt();
bs.appendNum(4, val);
} else if(this.size - words * 3 == 2) {
val = ((this.data[words*3 ]).toString().charCodeAt() - '0'.charCodeAt()) * 10;
val += this.data[words*3+1].toString().charCodeAt() - '0'.charCodeAt();
bs.appendNum(7, val);
}
this.bstream = bs;
return 0;
} catch (e:Error) {
return -1;
}
return 0;
}
public function encodeModeAn(version:int):int
{
try {
var words:int = this.size / 2;
var bs:QRbitstream = new QRbitstream();
bs.appendNum(4, 0x02);
bs.appendNum(QRSpecs.lengthIndicator(QRCodeEncodeType.QRCODE_ENCODE_ALPHA_NUMERIC, version), this.size);
for(var i:int=0; i<words; i++) {
var val:int = QRInput.lookAnTable(this.data[i*2].toString().charCodeAt()) * 45;
val += QRInput.lookAnTable(this.data[i*2+1].toString().charCodeAt());
bs.appendNum(11, val);
}
if(this.size & 1) {
val = QRInput.lookAnTable(this.data[words * 2].toString().charCodeAt());
bs.appendNum(6, val);
}
this.bstream = bs;
return 0;
} catch (e:Error) {
return -1;
}
return 0;
}
public function encodeMode8(version:int):int
{
try {
var bs:QRbitstream = new QRbitstream();
bs.appendNum(4, 0x4);
bs.appendNum(QRSpecs.lengthIndicator(QRCodeEncodeType.QRCODE_ENCODE_BYTES, version), this.size);
for(var i:int=0; i<this.size; i++) {
bs.appendNum(8, this.data[i].toString().charCodeAt());
}
this.bstream = bs;
return 0;
} catch (e:Error) {
return -1;
}
return 0;
}
public function encodeModeKanji(version:int):int
{
try {
var bs:QRbitstream = new QRbitstream();
bs.appendNum(4, 0x8);
bs.appendNum(QRSpecs.lengthIndicator(QRCodeEncodeType.QRCODE_ENCODE_KANJI, version), this.size / 2);
for(var i:int=0; i<this.size; i+=2) {
var val:int = (this.data[i].toString().charCodeAt() << 8) | this.data[i+1].toString().charCodeAt();
if(val <= 0x9ffc) {
val -= 0x8140;
} else {
val -= 0xc140;
}
var h:int = (val >> 8) * 0xc0;
val = (val & 0xff) + h;
bs.appendNum(13, val);
}
this.bstream = bs;
return 0;
} catch (e:Error) {
return -1;
}
return 0;
}
public function encodeModeStructure():int
{
try {
var bs:QRbitstream = new QRbitstream();
bs.appendNum(4, 0x03);
bs.appendNum(4, this.data[1].toString().charCodeAt() - 1);
bs.appendNum(4, this.data[0].toString().charCodeAt() - 1);
bs.appendNum(8, this.data[2].toString().charCodeAt());
this.bstream = bs;
return 0;
} catch (e:Error) {
return -1;
}
return 0;
}
public function estimateBitStreamSizeOfEntry(version:int):int
{
var bits:int = 0;
if(version == 0)
version = 1;
switch(this.mode) {
case QRCodeEncodeType.QRCODE_ENCODE_NUMERIC:
bits = QRInput.estimateBitsModeNum(this.size);
break;
case QRCodeEncodeType.QRCODE_ENCODE_ALPHA_NUMERIC:
bits = QRInput.estimateBitsModeAn(this.size);
break;
case QRCodeEncodeType.QRCODE_ENCODE_BYTES:
bits = QRInput.estimateBitsMode8(this.size);
break;
case QRCodeEncodeType.QRCODE_ENCODE_KANJI:
bits = QRInput.estimateBitsModeKanji(this.size);
break;
case QRCodeEncodeType.QRCODE_ENCODE_STRUCTURE:
return STRUCTURE_HEADER_BITS;
default:
return 0;
}
var l:int = QRSpecs.lengthIndicator(this.mode, version);
var m:int = 1 << l;
var num:int = (this.size + m - 1) / m;
bits += num * (4 + l);
return bits;
}
public function encodeBitStream(version:int):int
{
try {
this.bstream = null;
var words:int = QRSpecs.maximumWords(this.mode, version);
if(this.size > words) {
var st1:QRInputItem = new QRInputItem(this.mode, words, this.data);
var st2:QRInputItem = new QRInputItem(this.mode, this.size - words, this.data.slice(words));
st1.encodeBitStream(version);
st2.encodeBitStream(version);
this.bstream = new QRbitstream();
this.bstream.append(st1.bstream);
this.bstream.append(st2.bstream);
} else {
var ret:int = 0;
switch(this.mode) {
case QRCodeEncodeType.QRCODE_ENCODE_NUMERIC:
ret = this.encodeModeNum(version);
break;
case QRCodeEncodeType.QRCODE_ENCODE_ALPHA_NUMERIC:
ret = this.encodeModeAn(version);
break;
case QRCodeEncodeType.QRCODE_ENCODE_BYTES:
ret = this.encodeMode8(version);
break;
case QRCodeEncodeType.QRCODE_ENCODE_KANJI:
ret = this.encodeModeKanji(version);
case QRCodeEncodeType.QRCODE_ENCODE_STRUCTURE:
ret = this.encodeModeStructure();
default:
return 0;
}
if(ret < 0)
return -1;
}
return this.bstream.size;
} catch (e:Error) {
return -1;
}
return 0;
}
}
}
|
package visuals.ui.elements.goal
{
import com.playata.framework.display.Sprite;
import com.playata.framework.display.lib.flash.FlashDisplayObjectContainer;
import com.playata.framework.display.lib.flash.FlashSprite;
import flash.display.MovieClip;
public class SymbolGoalHighlightGeneric extends Sprite
{
private var _nativeObject:SymbolGoalHighlight = null;
public function SymbolGoalHighlightGeneric(param1:MovieClip = null)
{
if(param1)
{
_nativeObject = param1 as SymbolGoalHighlight;
}
else
{
_nativeObject = new SymbolGoalHighlight();
}
super(null,FlashSprite.fromNative(_nativeObject));
var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer;
}
public function setNativeInstance(param1:SymbolGoalHighlight) : void
{
FlashSprite.setNativeInstance(_sprite,param1);
_nativeObject = param1;
syncInstances();
}
public function syncInstances() : void
{
}
}
}
|
package
{
import net.flashpunk.Entity;
import net.flashpunk.graphics.Backdrop;
import net.flashpunk.FP;
import net.flashpunk.tweens.misc.Alarm;
/**
* ...
* @author Jordan Magnuson
*/
public class TimedPhotoController extends PhotoController
{
public function TimedPhotoController(photoArray:Array, x:Number = 0, y:Number = 0, displayTime:Number = 300, startDelay:Number = 300, fadeDuration:Number = 120, maxAlpha:Number = 1, flipped:Boolean = false, pixelateCellSize:Number = 1 )
{
super(photoArray, x, y, displayTime, startDelay, loop, fadeIn, maxAlpha, flipped);
this.fadeInDuration = fadeDuration;
this.fadeOutDuration = fadeDuration;
this.pixelateCellSize = pixelateCellSize;
currentPhoto = new PhotoBackdrop(photoArray[currentIndex], x, y, false, fadeInDuration, fadeOutDuration, maxAlpha, flipped, Math.floor(pixelateCellSize));
startAlarm = new Alarm(startDelay, start);
nextPhotoAlarm = new Alarm(displayTime, nextPhoto);
//nextPhotoAlarm = new Alarm(this.displayTime, nextPhoto);
}
override public function added():void
{
FP.world.add(currentPhoto);
currentIndex++;
if (startDelay > 0)
{
//trace('timed photo setting start alarm for ' + startDelay)
addTween(startAlarm, true);
}
else
{
//trace('timed photo starting right away')
start();
}
}
override public function start():void
{
//trace('slideshow started!');
addTween(nextPhotoAlarm, true);
nextPhoto();
}
override public function nextPhoto(fadeIn:Boolean = true):void
{
if (Global.startDepixelating && pixelateCellSize > 1)
pixelateCellSize -= Global.depixelatePerPhoto;
if (pixelateCellSize < 0)
pixelateCellSize = 1;
if (maxAlpha < 1)
maxAlpha += Global.increaseAlphaAmount;
trace('timedphoto max aplha: ' + maxAlpha);
if (finished && !loop)
{
return;
}
if (currentIndex < photoArray.length)
{
lastPhoto = currentPhoto;
lastPhoto.fadeOut();
FP.world.add(currentPhoto = new PhotoBackdrop(photoArray[currentIndex], x, y, fadeIn, fadeInDuration, fadeOutDuration, maxAlpha, flipped, Math.floor(pixelateCellSize)));
}
else
{
finished = true;
currentIndex = 0;
if (loop)
{
lastPhoto = currentPhoto;
lastPhoto.fadeOut();
FP.world.add(currentPhoto = new PhotoBackdrop(photoArray[currentIndex], x, y, fadeIn, fadeInDuration, fadeOutDuration, maxAlpha, flipped, Math.floor(pixelateCellSize)));
//nextPhotoAlarm.reset(displayTime);
}
}
currentIndex++;
nextPhotoAlarm.reset(displayTime);
}
}
} |
package mx.collaboration.xmpp.protocol.extensions
{
import mx.collections.ArrayCollection;
import mx.collections.IViewCursor;
import mx.collaboration.xmpp.protocol.packets.PacketExtension;
public class Authentication extends PacketExtension
{
public static var ELEMENT_NAME:String = "query";
public static var NAMESPACE_URI:String = "jabber:iq:auth";
public var username:String;
public var password:String;
public var digest:String;
public var resource:String;
public function Authentication()
{
_elementName = ELEMENT_NAME;
_namespaceUri = NAMESPACE_URI;
}
override public function processExtension( element:XML ):void
{
this.element = element;
var auth:Namespace = new Namespace( NAMESPACE_URI );
if( element.auth::username.length() > 0 ) username = element.auth::username;
if( element.auth::password.length() > 0 ) password = element.auth::password;
if( element.auth::digest.length() > 0 ) digest = element.auth::digest;
if( element.auth::resource.length() > 0 ) resource = element.auth::resource;
}
override public function toXML():XML
{
var x:XML = <query></query>
x.@xmlns = NAMESPACE_URI;
if( username ) x.username = username;
if( password ) x.password = password;
if( digest ) x.digest = digest;
if( resource ) x.resource = resource;
return x;
}
}
} |
//
// C:\Users\Manju-pc\AppData\Local\FlashDevelop\Apps\ascsdk\27.0.0\frameworks\libs\air\airglobal.swc\flash\utils\IExternalizable
//
package flash.utils
{
import flash.utils.IDataOutput;
import flash.utils.IDataInput;
public interface IExternalizable
{
function readExternal (input:IDataInput) : void;
function writeExternal (output:IDataOutput) : void;
}
}
|
package Testing.Abstractions {
import Testing.Types.InstructionType;
import UI.ColorText;
import UI.HighlightFormat;
import Testing.Types.AbstractArg;
/**
* ...
* @author Nicholas "PleasingFungus" Feinberg
*/
public class PopAbstraction extends InstructionAbstraction {
public function PopAbstraction(value:int) {
super(InstructionType.POP, new Vector.<int>, value);
}
override public function toString():String {
return type.name + " " + value;
}
override public function toFormat():HighlightFormat {
return new HighlightFormat(type.name +" {}", ColorText.singleVec(new ColorText(U.DESTINATION.color, value.toString())));
}
override public function getAbstractArgs():Vector.<AbstractArg> {
var abstractArgs:Vector.<AbstractArg> = new Vector.<AbstractArg>;
abstractArgs.push(new AbstractArg(value, C.INT_NULL, false, true));
return abstractArgs;
}
}
} |
package {
public interface BeforeInterfaceContextualGenerator_issue2473_9 {
function foo(v:So$(EntryPoint)me):void;
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package flashx.textLayout.ui.rulers
{
import mx.skins.RectangularBorder;
public class ParagraphPropertyMarkerSkin extends RectangularBorder
{
public function ParagraphPropertyMarkerSkin()
{
super();
}
override protected function updateDisplayList(w:Number, h:Number):void
{
super.updateDisplayList(w, h);
var propKind:String = getStyle("propkind");
var rightToLeftPar:Boolean = getStyle("rightToLeftPar");
var t:Number = 0;
var b:Number = h;
graphics.clear();
graphics.beginFill(0x000000);
if (rightToLeftPar)
{
switch(propKind) {
case "textIndent":
b = (h - 1) / 2;
graphics.moveTo(w, 0);
graphics.lineTo(w, b);
graphics.lineTo(0, b);
graphics.lineTo(w, 0);
break;
case "paragraphStartIndent":
graphics.moveTo(0, 0);
graphics.lineTo(0, h);
graphics.lineTo(w, h / 2);
graphics.lineTo(0, 0);
break;
case "paragraphEndIndent":
t = h - (h - 1) / 2;
graphics.moveTo(w, h);
graphics.lineTo(0, t);
graphics.lineTo(w, t);
graphics.lineTo(w, h);
break;
}
}
else
{
switch(propKind) {
case "textIndent":
b = (h - 1) / 2;
graphics.moveTo(0, 0);
graphics.lineTo(w, b);
graphics.lineTo(0, b);
graphics.lineTo(0, 0);
break;
case "paragraphStartIndent":
t = h - (h - 1) / 2;
graphics.moveTo(0, h);
graphics.lineTo(0, t);
graphics.lineTo(w, t);
graphics.lineTo(0, h);
break;
case "paragraphEndIndent":
graphics.moveTo(w, 0);
graphics.lineTo(w, h);
graphics.lineTo(0, h / 2);
graphics.lineTo(w, 0);
break;
}
}
graphics.endFill();
// this makes the whole rect hittable
graphics.lineStyle();
graphics.beginFill(0x0000ff, 0);
graphics.drawRect(0, t, w, b);
graphics.endFill();
}
}
}
|
package ddt.view.caddyII.bead
{
import bagAndInfo.cell.BaseCell;
import com.pickgliss.ui.ComponentFactory;
import com.pickgliss.ui.core.Disposeable;
import com.pickgliss.ui.text.FilterFrameText;
import com.pickgliss.utils.ObjectUtils;
import ddt.command.NumberSelecter;
import ddt.data.goods.ItemTemplateInfo;
import ddt.manager.ItemManager;
import flash.display.Bitmap;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
public class QuickBuyItem extends Sprite implements Disposeable
{
private static const HammerJumpStep:int = 5;
private static const PotJumpStep:int = 1;
private static const HammerTemplateID:int = 11456;
private static const PotTemplateID:int = 112047;
private var _bg:Bitmap;
private var _cell:BaseCell;
private var _selectNumber:NumberSelecter;
private var _count:int;
private var _countField:FilterFrameText;
private var _countPos:Point;
private var _selsected:Boolean = false;
private var _selectedBitmap:Bitmap;
public function QuickBuyItem()
{
super();
this.initView();
this.initEvents();
}
private function initView() : void
{
this._countPos = ComponentFactory.Instance.creatCustomObject("caddyII.bead.QuickBuyItem.CountPos");
this._bg = ComponentFactory.Instance.creatBitmap("asset.bead.quickCellBG");
var _loc1_:Point = ComponentFactory.Instance.creatCustomObject("bead.quickCellSize");
var _loc2_:Shape = new Shape();
_loc2_.graphics.beginFill(16777215,0);
_loc2_.graphics.drawRect(0,0,_loc1_.x,_loc1_.y);
_loc2_.graphics.endFill();
this._cell = ComponentFactory.Instance.creatCustomObject("bead.quickCell",[_loc2_]);
this._selectNumber = ComponentFactory.Instance.creatCustomObject("bead.numberSelecter",[0]);
this._selectNumber.number = 0;
this._countField = ComponentFactory.Instance.creatComponentByStylename("caddy.QuickBuy.ItemCountField");
this._selectedBitmap = ComponentFactory.Instance.creatBitmap("asset.caddy.QuickBuy.Selected");
addChild(this._selectedBitmap);
addChild(this._bg);
addChild(this._cell);
addChild(this._selectNumber);
addChild(this._countField);
}
private function initEvents() : void
{
this._selectNumber.addEventListener(Event.CHANGE,this._numberChange);
this._selectNumber.addEventListener(NumberSelecter.NUMBER_CLOSE,this._numberClose);
}
private function removeEvents() : void
{
this._selectNumber.removeEventListener(Event.CHANGE,this._numberChange);
this._selectNumber.removeEventListener(NumberSelecter.NUMBER_CLOSE,this._numberClose);
}
private function _numberChange(param1:Event) : void
{
if(this._cell.info.TemplateID == HammerTemplateID)
{
this._countField.text = String(HammerJumpStep * this._selectNumber.number);
this._countField.x = this._countPos.x - this._countField.width;
this._countField.y = this._countPos.y - this._countField.height;
}
else if(this._cell.info.TemplateID == PotTemplateID)
{
this._countField.text = String(PotJumpStep * this._selectNumber.number);
this._countField.x = this._countPos.x - this._countField.width;
this._countField.y = this._countPos.y - this._countField.height;
}
dispatchEvent(new Event(Event.CHANGE));
}
private function _numberClose(param1:Event) : void
{
dispatchEvent(new Event(NumberSelecter.NUMBER_CLOSE));
}
public function setFocus() : void
{
this._selectNumber.setFocus();
}
public function set itemID(param1:int) : void
{
this._cell.info = ItemManager.Instance.getTemplateById(param1);
if(this._cell.info.TemplateID == HammerTemplateID)
{
this._countField.text = String(HammerJumpStep * this._selectNumber.number);
this._countField.x = this._countPos.x - this._countField.width;
this._countField.y = this._countPos.y - this._countField.height;
}
else if(this._cell.info.TemplateID == PotTemplateID)
{
this._countField.text = String(PotJumpStep * this._selectNumber.number);
this._countField.x = this._countPos.x - this._countField.width;
this._countField.y = this._countPos.y - this._countField.height;
}
}
public function get info() : ItemTemplateInfo
{
return this._cell.info;
}
public function set count(param1:int) : void
{
this._selectNumber.number = param1;
}
public function get count() : int
{
return this._selectNumber.number;
}
public function get selected() : Boolean
{
return this._selsected;
}
public function set selected(param1:Boolean) : void
{
if(this._selsected != param1)
{
this._selsected = param1;
this._selectedBitmap.visible = this._selsected;
}
}
public function dispose() : void
{
this.removeEvents();
if(this._bg)
{
ObjectUtils.disposeObject(this._bg);
}
this._bg = null;
if(this._cell)
{
ObjectUtils.disposeObject(this._cell);
}
this._cell = null;
if(this._selectNumber)
{
ObjectUtils.disposeObject(this._selectNumber);
}
this._selectNumber = null;
if(this._selectedBitmap)
{
ObjectUtils.disposeObject(this._selectedBitmap);
}
this._selectedBitmap = null;
if(parent)
{
parent.removeChild(this);
}
}
}
}
|
// =================================================================================================
//
// CadetEngine Framework
// Copyright 2012 Unwrong Ltd. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================
package cadet.core
{
import flash.utils.getTimer;
import cadet.events.ComponentEvent;
import core.app.managers.DependencyManager;
import core.events.PropertyChangeEvent;
public class CadetScene extends ComponentContainer implements ICadetScene
{
private var _framerate :int = 60;
private var _timeScale :Number = 1;
private var _runMode :Boolean = false;
private var lastFrameTime :int = getTimer();
private var steppableComponents :Vector.<IComponent>;
private var initOnRunComponents :Vector.<IComponent>;
protected var _dependencyManager :DependencyManager;
protected var _userData :Object;
public function CadetScene()
{
_dependencyManager = new DependencyManager();
name = "Scene";
_scene = this;
steppableComponents = new Vector.<IComponent>();
initOnRunComponents = new Vector.<IComponent>();
addEventListener(ComponentEvent.ADDED_TO_SCENE, componentAddedToSceneHandler);
}
private function componentAddedToSceneHandler( event:ComponentEvent ):void
{
var component:IComponent = event.component;
var onAList:Boolean = false;
if ( component is ISteppableComponent ) {
steppableComponents.push(component);
onAList = true;
}
if ( component is IInitialisableComponent ) {
initOnRunComponents.push(component);
onAList = true;
// if scene already running, init the component
if ( runMode ) {
IInitialisableComponent(component).init();
}
}
if ( onAList ) {
component.addEventListener(ComponentEvent.REMOVED_FROM_SCENE, componentRemovedHandler);
}
}
private function componentRemovedHandler( event:ComponentEvent ):void
{
var component:IComponent = event.component;
var steppableIndex:int = steppableComponents.indexOf(component);
var initOnRunIndex:int = initOnRunComponents.indexOf(component);
if ( steppableIndex != -1 ) {
steppableComponents.splice(steppableIndex, 1);
}
if ( initOnRunIndex != -1 ) {
initOnRunComponents.splice(initOnRunIndex, 1);
}
component.removeEventListener(ComponentEvent.REMOVED_FROM_SCENE, componentRemovedHandler);
}
public function step():void
{
if (!runMode) {
for each ( var iORComponent:IInitialisableComponent in initOnRunComponents ) {
iORComponent.init();
}
runMode = true;
}
var timeStep:Number = 1/_framerate;
var currentTime:int = getTimer();
var elapsed:int = currentTime - lastFrameTime;
if ( elapsed < (timeStep*1000) ) {
return;
}
var dt:Number = timeStep * timeScale;
for each ( var steppableComponent:ISteppableComponent in steppableComponents ) {
steppableComponent.step(dt);
}
validateNow();
lastFrameTime = currentTime;
}
[Serializable][Inspectable( toolTip="This value should be set to match the framerate of SWF the scene will be playing within.")]
public function set framerate( value:int ):void
{
_framerate = value;
dispatchEvent( new PropertyChangeEvent( "propertyChange_framerate", null, _framerate ) );
}
public function get framerate():int { return _framerate; }
[Serializable][Inspectable(toolTip="This value scales the amount of time elapsing per step of the Cadet Scene. Eg 0.5 = half speed.")]
public function set timeScale( value:Number ):void
{
_timeScale = value;
dispatchEvent( new PropertyChangeEvent( "propertyChange_timescale", null, _timeScale ) );
}
public function get timeScale():Number { return _timeScale; }
override protected function childAdded(child:IComponent, index:uint):void
{
super.childAdded(child, index);
child.scene = this;
}
[Serializable]
public function set dependencyManager( value:DependencyManager ):void
{
_dependencyManager = value;
}
public function get dependencyManager():DependencyManager { return _dependencyManager; }
[Serializable( type="rawObject" )]
public function set userData( value:Object ):void
{
_userData = value;
}
public function get userData():Object
{
return _userData;
}
// runMode is set to "true" the first time the scene is "stepped" and all IInitialisableComponents are initialised.
// Certain Processes and Behaviours may require the scene to behave differently at edit time and runtime,
// for instance, a process might remove it's edit time Skins at runtime and generate them procedurally.
// The default value is false.
public function get runMode():Boolean
{
return _runMode;
}
public function set runMode( value:Boolean ):void
{
_runMode = value;
}
// Allow the scene to re-initialise components
public function reset():void
{
_runMode = false;
}
}
}
|
package game.view.smallMap
{
import flash.display.Graphics;
import phy.object.SmallObject;
public class SmallBomb extends SmallObject
{
private var _movieTime:Number = 0.8;
public function SmallBomb()
{
super();
_radius = 3;
_color = 16750848;
}
override public function onFrame(param1:int) : void
{
_elapsed = _elapsed + param1;
if(_elapsed >= this._movieTime * 1000)
{
_elapsed = 0;
}
this.draw();
}
override protected function draw() : void
{
var _loc1_:Graphics = graphics;
_loc1_.clear();
var _loc2_:Number = _elapsed / (this._movieTime * 1000);
_loc1_.beginFill(_color,_loc2_);
_loc1_.drawCircle(0,0,_radius);
_loc1_.endFill();
}
}
}
|
// Pyromancer logic (based on Waterman)
#include "PyromancerCommon.as";
#include "ThrowCommon.as";
#include "KnockedCommon.as";
#include "Hitters.as";
#include "RunnerCommon.as";
#include "ShieldCommon.as";
#include "Help.as";
#include "BombCommon.as";
const int FLETCH_COOLDOWN = 45;
const int PICKUP_COOLDOWN = 15;
const int fletch_num_arrows = 1;
const int STAB_DELAY = 10;
const int STAB_TIME = 22;
//const int RUNE_COOLDOWN = 2500; //handled on PyromancerCreateRune.as
//const int RUNE_RANGE = 50.0f;
void onInit(CBlob@ this)
{
PyromancerInfo pyromancer;
this.set("pyromancerInfo", @pyromancer);
this.set_s8("charge_time", 0);
this.set_bool("playedfire",false);
this.set_u8("charge_state", PyromancerParams::not_aiming);
this.set_bool("has_arrow", false);
this.set_f32("gib health", -3.0f);
this.Tag("player");
this.Tag("flesh");
//centered on arrows
//this.set_Vec2f("inventory offset", Vec2f(0.0f, 122.0f));
//centered on items
this.set_Vec2f("inventory offset", Vec2f(0.0f, 0.0f));
//no spinning
this.getShape().SetRotationsAllowed(false);
this.getSprite().SetEmitSound("../FireRoarQuiet.ogg");
this.addCommandID("shoot firebolt");
this.getShape().getConsts().net_threshold_multiplier = 0.5f;
//this.addCommandID("shoot firerune"); //handled on PyromancerCreateRune.as
//add a command ID for each arrow type
AddIconToken( "$Firewalk$", "pSpellIcons.png", Vec2f(16,16), 0 );
AddIconToken( "$Firebolt$", "pSpellIcons.png", Vec2f(16,16), 1 );
AddIconToken( "$Flaming$", "pSpellIcons.png", Vec2f(16,16), 2 );
SetHelp( this, "help self action", "pyromancer", "$Firebolt$ Shoot firebolts $LMB$", "", 5 );
SetHelp( this, "help self action2", "pyromancer", "$Flaming$ Flame Rune $RMB$", "" );
//SetHelp( this, "help show", "pyromancer", "$Firewalk$ Blink using V", "" );
this.getCurrentScript().runFlags |= Script::tick_not_attached;
this.getCurrentScript().removeIfTag = "dead";
}
void onSetPlayer(CBlob@ this, CPlayer@ player)
{
if (player !is null)
{
player.SetScoreboardVars("ScoreboardIcons.png", 10, Vec2f(16,16));
}
}
void ManageBow(CBlob@ this, PyromancerInfo@ pyromancer, RunnerMoveVars@ moveVars)
{
CSprite@ sprite = this.getSprite();
bool ismyplayer = this.isMyPlayer();
bool hasarrow = true;
s8 charge_time = pyromancer.charge_time;
u8 charge_state = pyromancer.charge_state;
const bool pressed_action2 = this.isKeyPressed(key_action2);
Vec2f pos = this.getPosition();
if (charge_state == PyromancerParams::legolas_charging) // fast arrows
{
charge_state = PyromancerParams::legolas_ready;
}
//charged - no else (we want to check the very same tick)
if (charge_state == PyromancerParams::legolas_ready) // fast arrows
{
moveVars.walkFactor *= 0.75f;
pyromancer.legolas_time--;
if (pyromancer.legolas_time == 0)
{
bool pressed = this.isKeyPressed(key_action1);
charge_state = pressed ? PyromancerParams::readying : PyromancerParams::not_aiming;
charge_time = 0;
//didn't fire
if (pyromancer.legolas_arrows == PyromancerParams::legolas_arrows_count)
{
Sound::Play("/Stun", pos, 1.0f, this.getSexNum() == 0 ? 1.0f : 2.0f);
setKnocked(this, 15);
}
else if (pressed)
{
sprite.RewindEmitSound();
sprite.SetEmitSoundPaused(false);
}
}
else if (this.isKeyJustPressed(key_action1) ||
(pyromancer.legolas_arrows == PyromancerParams::legolas_arrows_count &&
!this.isKeyPressed(key_action1) &&
this.wasKeyPressed(key_action1)))
{
ClientFire(this, charge_time, hasarrow, pyromancer.arrow_type, true);
charge_state = PyromancerParams::legolas_charging;
charge_time = PyromancerParams::shoot_period - PyromancerParams::legolas_charge_time;
Sound::Play("FireBolt.ogg", pos);
pyromancer.legolas_arrows--;
if (pyromancer.legolas_arrows == 0)
{
charge_state = PyromancerParams::readying;
charge_time = 5;
sprite.RewindEmitSound();
sprite.SetEmitSoundPaused(false);
}
}
}
else if (this.isKeyPressed(key_action1))
{
const bool just_action1 = this.isKeyJustPressed(key_action1);
// printf("charge_state " + charge_state );
if ((just_action1 || this.wasKeyPressed(key_action2) && !pressed_action2) &&
(charge_state == PyromancerParams::not_aiming || charge_state == PyromancerParams::fired))
{
charge_state = PyromancerParams::readying;
pyromancer.arrow_type = ArrowType::normal;
charge_time = 0;
sprite.PlayRandomSound("FireBolt");
sprite.RewindEmitSound();
sprite.SetEmitSoundPaused(false);
if (!ismyplayer) // lower the volume of other players charging - ooo good idea
{
sprite.SetEmitSoundVolume(0.5f);
}
}
else if (charge_state == PyromancerParams::readying)
{
charge_time++;
if (charge_time > PyromancerParams::ready_time)
{
charge_time = 1;
charge_state = PyromancerParams::charging;
}
}
else if (charge_state == PyromancerParams::charging)
{
charge_time++;
if (charge_time >= PyromancerParams::legolas_period)
{
// Legolas state
Sound::Play("AnimeSword.ogg", pos, ismyplayer ? 1.3f : 0.7f);
Sound::Play("FireRoar.ogg", pos);
charge_state = PyromancerParams::legolas_charging;
charge_time = PyromancerParams::shoot_period - PyromancerParams::legolas_charge_time;
pyromancer.legolas_arrows = PyromancerParams::legolas_arrows_count;
pyromancer.legolas_time = PyromancerParams::legolas_time;
}
if (charge_time >= PyromancerParams::shoot_period)
sprite.SetEmitSoundPaused(true);
}
else if (charge_state == PyromancerParams::no_arrows)
{
if (charge_time < PyromancerParams::ready_time)
{
charge_time++;
}
}
}
else
{
if (charge_state > PyromancerParams::readying)
{
if (charge_state < PyromancerParams::fired)
{
if (pyromancer.charge_time >= PyromancerParams::shoot_period-10)ClientFire(this, charge_time, hasarrow, pyromancer.arrow_type, false);
charge_time = PyromancerParams::fired_time;
charge_state = PyromancerParams::fired;
}
else //fired..
{
charge_time--;
if (charge_time <= 0)
{
charge_state = PyromancerParams::not_aiming;
charge_time = 0;
}
}
}
else
{
charge_state = PyromancerParams::not_aiming; //set to not aiming either way
charge_time = 0;
}
sprite.SetEmitSoundPaused(true);
}
// my player!
if (ismyplayer)
{
// set cursor
if (!getHUD().hasButtons())
{
int frame = 0;
// print("pyromancer.charge_time " + pyromancer.charge_time + " / " + PyromancerParams::shoot_period );
if (pyromancer.charge_state == PyromancerParams::readying)
{
frame = 1 + float(pyromancer.charge_time) / float(PyromancerParams::shoot_period + PyromancerParams::ready_time) * 7;
}
else if (pyromancer.charge_state == PyromancerParams::charging)
{
if (pyromancer.charge_time <= PyromancerParams::shoot_period)
{
frame = float(PyromancerParams::ready_time + pyromancer.charge_time) / float(PyromancerParams::shoot_period) * 7;
}
else
frame = 9;
}
else if (pyromancer.charge_state == PyromancerParams::legolas_ready)
{
frame = 10;
}
else if (pyromancer.charge_state == PyromancerParams::legolas_charging)
{
frame = 9;
}
getHUD().SetCursorFrame(frame);
}
// activate/throw
if (this.isKeyJustPressed(key_action3))
{
client_SendThrowOrActivateCommand(this);
}
// pick up arrow
if (pyromancer.fletch_cooldown > 0)
{
pyromancer.fletch_cooldown--;
}
}
pyromancer.charge_time = charge_time;
pyromancer.charge_state = charge_state;
pyromancer.has_arrow = hasarrow;
}
void onTick(CBlob@ this)
{
PyromancerInfo@ pyromancer;
if (!this.get("pyromancerInfo", @pyromancer))
{
return;
}
if (isKnocked(this))
{
pyromancer.grappling = false;
pyromancer.charge_state = 0;
pyromancer.charge_time = 0;
return;
}
/* //handled on PyromancerCreateRune.as
if (pyromancer.secondary_cooldown > 0)
{
pyromancer.secondary_cooldown--;
}
if (getKnocked(this) <= 0)
if (this.isKeyPressed(key_action2) && !this.isKeyPressed(key_action1))
{
if (pyromancer.secondary_cooldown <= 0)
{
if (ShootFireRune(this))
{
pyromancer.secondary_cooldown = RUNE_COOLDOWN;
}
}
}
*/
else
{
this.Untag("flaming");
this.SetLight(false);
}
// vvvvvvvvvvvvvv CLIENT-SIDE ONLY vvvvvvvvvvvvvvvvvvv
if (!getNet().isClient()) return;
if (this.isInInventory()) return;
RunnerMoveVars@ moveVars;
if (!this.get("moveVars", @moveVars))
{
return;
}
ManageBow(this, pyromancer, moveVars);
}
bool canSend(CBlob@ this)
{
return (this.isMyPlayer() || this.getPlayer() is null || this.getPlayer().isBot());
}
void ClientFire(CBlob@ this, const s8 charge_time, const bool hasarrow, const u8 arrow_type, const bool legolas)
{
//time to fire!
if (canSend(this)) // client-logic
{
f32 arrowspeed;
if (charge_time < PyromancerParams::ready_time / 2 + PyromancerParams::shoot_period_1)
{
arrowspeed = PyromancerParams::shoot_max_vel * (1.0f / 3.0f);
}
else if (charge_time < PyromancerParams::ready_time / 2 + PyromancerParams::shoot_period_2)
{
arrowspeed = PyromancerParams::shoot_max_vel * (4.0f / 5.0f);
}
else
{
arrowspeed = PyromancerParams::shoot_max_vel;
}
ShootFirebolt(this, this.getPosition() + Vec2f(0.0f, -2.0f), this.getAimPos() + Vec2f(0.0f, -2.0f), arrowspeed, arrow_type, legolas);
}
}
void ShootFirebolt(CBlob @this, Vec2f arrowPos, Vec2f aimpos, f32 arrowspeed, const u8 arrow_type, const bool legolas = true)
{
if (canSend(this))
{
// player or bot
Vec2f arrowVel = (aimpos - arrowPos);
arrowVel.Normalize();
arrowVel *= arrowspeed;
//print("arrowspeed " + arrowspeed);
CBitStream params;
params.write_Vec2f(arrowPos);
params.write_Vec2f(arrowVel);
params.write_u8(arrow_type);
params.write_bool(legolas);
this.SendCommand(this.getCommandID("shoot firebolt"), params);
}
}
//handled on PyromancerCreateRune.as
/*
bool ShootFireRune(CBlob @this)
{
if (canSend(this))
{
Vec2f pos = this.getAimPos();
Vec2f caster_pos = this.getPosition();
if ((pos - caster_pos).Length() > RUNE_RANGE) {
return false;
}
if (this.getMap().isTileSolid(pos)) {
return false;
}
CBitStream params;
params.write_Vec2f(pos);
this.SendCommand(this.getCommandID("shoot firerune"), params);
return true;
}
return false;
}
*/
CBlob@ CreateFireBolt(CBlob@ this, Vec2f arrowPos, Vec2f arrowVel, u8 arrowType)
{
CBlob @blob = server_CreateBlob("firebolt", this.getTeamNum(), this.getPosition());
this.getSprite().PlaySound("FireBolt.ogg");
if (blob !is null)
{
blob.setVelocity(arrowVel);
}
return blob;
}
CBlob@ CreateFireBall(CBlob@ this, Vec2f arrowPos, Vec2f arrowVel, u8 arrowType)
{
CBlob @blob = server_CreateBlob("fireball", this.getTeamNum(), this.getPosition());
this.getSprite().PlaySound("FireBall.ogg");
if (blob !is null)
{
blob.setVelocity(arrowVel);
}
return blob;
}
//handled on PyromancerCreateRune.as
/*
CBlob@ CreateFireRune(CBlob@ this, Vec2f pos)
{
CBlob @blob = server_CreateBlob("firerune", this.getTeamNum(), pos);
this.getSprite().PlaySound("FireBall.ogg");
return blob;
}
*/
void onCommand(CBlob@ this, u8 cmd, CBitStream @params)
{
if (cmd == this.getCommandID("shoot firebolt"))
{
Vec2f arrowPos = params.read_Vec2f();
Vec2f arrowVel = params.read_Vec2f();
u8 arrowType = params.read_u8();
bool legolas = params.read_bool();
PyromancerInfo@ pyromancer;
if (!this.get("pyromancerInfo", @pyromancer))
{
return;
}
pyromancer.arrow_type = arrowType;
if (legolas)
{
if (getNet().isServer())
{
CBlob@ arrow = CreateFireBall(this, arrowPos, arrowVel*1.2, arrowType);
}
this.getSprite().PlaySound("FireBolt.ogg");
}
else
{
if (getNet().isServer())
{
CreateFireBolt(this, arrowPos, arrowVel, arrowType);
}
}
this.getSprite().PlaySound("FireBolt.ogg");
}
//handled on PyromancerCreateRune.as
/*
else if (cmd == this.getCommandID("shoot firerune"))
{
Vec2f pos = params.read_Vec2f();
if (getNet().isServer())
{
CreateFireRune(this, pos);
}
}
*/
}
void onCreateInventoryMenu(CBlob@ this, CBlob@ forBlob, CGridMenu @gridmenu)
{
}
// auto-switch to appropriate arrow when picked up
void onAddToInventory(CBlob@ this, CBlob@ blob)
{
} |
/*
Copyright (c) 2009 Trevor McCauley
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.myavatareditor.fla.editor {
public class CharacteristicsGlasses extends AbstractCharacteristicsGUI {
public function CharacteristicsGlasses(editor:EditorSWF){
super(editor);
pageCount = 1;
itemCount = 9;
pageIndex = 0;
currProp = "glasses";
colorID = currProp;
optionIDs = ["Y","Size"];
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// 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.beads
{
import mx.core.IFlexDisplayObject;
import mx.core.IUIComponent;
import mx.managers.PopUpManager;
import spark.components.Button;
import spark.components.supportClasses.DropDownListButton;
import spark.components.DropDownList;
import org.apache.royale.core.IBead;
import org.apache.royale.core.IChild;
import org.apache.royale.core.IContainer;
import org.apache.royale.core.ILayoutChild;
import org.apache.royale.core.IPopUpHost;
import org.apache.royale.core.ISelectionModel;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.IStrandWithModel;
import org.apache.royale.core.IStyleableObject;
import org.apache.royale.core.IUIBase;
import org.apache.royale.events.Event;
import org.apache.royale.events.IEventDispatcher;
import org.apache.royale.html.beads.IDropDownListView;
import org.apache.royale.html.util.getLabelFromData;
/**
* @private
* The DropDownListView for emulation.
*/
public class DropDownListView extends SkinnableContainerView implements IDropDownListView
{
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function DropDownListView()
{
super();
}
/**
* @royalesuppresspublicvarwarning
*/
public var label:Button;
protected var selectionModel:ISelectionModel;
/**
*/
override public function set strand(value:IStrand):void
{
super.strand = value;
selectionModel = (value as IStrandWithModel).model as ISelectionModel;
selectionModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
selectionModel.addEventListener("dataProviderChanged", selectionChangeHandler);
(value as IEventDispatcher).addEventListener("initComplete", selectionChangeHandler);
// remove the DataGroup. It will be the dropdown
var chost:IContainer = host as IContainer;
chost.strandChildren.removeElement(viewport.contentView);
label = new DropDownListButton();
if (selectionModel.selectedIndex == -1)
label.label = (host as DropDownList).prompt;
chost.strandChildren.addElement(label);
value.addBead(new DropDownListLayout());
}
protected function selectionChangeHandler(event:Event):void
{
if (selectionModel.selectedItem == null)
{
label.label = (host as DropDownList).prompt;
}
else
{
}
label.label = getLabelFromData(selectionModel,selectionModel.selectedItem);
}
/**
* The dropdown/popup that displays the set of choices.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function get popUp():IStrand
{
return viewport.contentView as IStrand;
}
private var _popUpVisible:Boolean;
/**
* A flag that indicates whether the dropdown/popup is
* visible.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.0
*/
public function get popUpVisible():Boolean
{
return _popUpVisible;
}
/**
* @private
*/
public function set popUpVisible(value:Boolean):void
{
if (value != _popUpVisible)
{
_popUpVisible = value;
var popUpDisplayObject:IFlexDisplayObject = popUp as IFlexDisplayObject;
if (value)
{
PopUpManager.addPopUp(popUpDisplayObject, _strand);
(popUpDisplayObject as IStyleableObject).className = "DropDownDataGroup";
(popUp as IUIComponent).setActualSize((popUp as IUIComponent).width, 100);
}
else
{
PopUpManager.removePopUp(popUpDisplayObject);
}
}
}
}
}
import spark.components.Button;
import spark.components.DropDownList;
import spark.components.beads.DropDownListView;
import org.apache.royale.core.LayoutBase;
// this layouts out the one Label/Button.
class DropDownListLayout extends LayoutBase
{
override public function layout():Boolean
{
var list:DropDownList = host as DropDownList;
var view:DropDownListView = list.view as DropDownListView;
var w:Number = list.width;
if (list.isWidthSizedToContent())
w = list.measuredWidth;
var h:Number = list.height;
if (list.isHeightSizedToContent())
h = list.measuredHeight;
view.label.setActualSize(w, h);
return false;
}
}
|
/* Automatically generated by IntelliJ IDEA from Java, revision needed before production use */
/*
* Copyright (c) 2008, Vaclav Slovacek. All Rights Reserved.
*
* Product: UIProtocol Java
*
* This source-code is released under following license:
* - no release outside i2home project is allowed
* - this copyright notice must be placed unmodified in every file derived from this source code
*/
//@todo make compatible with actionscript
package uidocument.commons.api.document {
/**
* Type of executed action deciding whether the action will be executed only on client side via model updates
*/
public final class ActionType {
/*
defaultmodels static final var CLIENT:ActionType;
defaultmodels static final var SERVER:ActionType;
*/
}
}
|
package dynamics.boost
{
import assets.Assets;
import dragonBones.Armature;
import dragonBones.objects.DragonBonesData;
import dragonBones.starling.StarlingArmatureDisplay;
import dragonBones.starling.StarlingFactory;
import dynamics.GameObjectFactory;
import dynamics.IPoolable;
import dynamics.boost.BaseBoost;
import screens.game.GameScreen;
import starling.display.Image;
import starling.events.Event;
public class Potion extends BaseBoost implements IPoolable
{
static private const POOL:Vector.<Potion> = new Vector.<Potion>();
static private const SPEED_MODIFIER:Number = 0.2;
static private const ANIMATION_IDLE:String = "idle";
private var _armature:Armature;
private var _display:StarlingArmatureDisplay;
static public function getNew():Potion
{
if (POOL.length <= 0)
return new Potion();
else
return POOL.pop();
}
public function Potion()
{
super();
_armature = GameObjectFactory.gfxFactory.buildArmature("Potion");
_display = _armature.display as StarlingArmatureDisplay;
addChild(_display);
}
override public function init(speed:int, startX:int, startY:int):void
{
super.init(speed, startX, startY);
_speed *= SPEED_MODIFIER;
_armature.animation.play(ANIMATION_IDLE);
}
override public function update(deltaTime:Number):void
{
_armature.advanceTime(deltaTime);
if (x > GameScreen.BLOCK_WIDTH)
x -= _speed * deltaTime / SPEED_MODIFIER;
else
x -= _speed * deltaTime;
}
override public function onPickUp():void
{
Game.instance.playSound("potion");
GameScreen.instance.magic.boost(1000);
}
/* INTERFACE dynamics.IPoolable */
override public function toPool():void
{
_armature.animation.gotoAndStopByProgress(ANIMATION_IDLE);
x = 0;
y = 0;
_speed = 0;
_startX = 0;
_startY = 0;
POOL.push(this);
}
override public function get preview():Image
{
var result:Image = new Image(Assets.instance.manager.getTexture("potionPreview"));
return result;
}
override public function get internalName():String
{
return GameObjectFactory.BOOST_POTION;
}
override public function get speed():int
{
return super.speed;
}
override public function set speed(value:int):void
{
super.speed = value * SPEED_MODIFIER;
}
}
} |
package org.openapitools.client.model {
[XmlRootNode(name="PipelineRunartifacts")]
public class PipelineRunartifacts {
[XmlElement(name="name")]
public var name: String = null;
[XmlElement(name="size")]
public var size: Number = 0;
[XmlElement(name="url")]
public var url: String = null;
[XmlElement(name="_class")]
public var class: String = null;
public function toString(): String {
var str: String = "PipelineRunartifacts: ";
str += " (name: " + name + ")";
str += " (size: " + size + ")";
str += " (url: " + url + ")";
str += " (class: " + class + ")";
return str;
}
}
}
|
package com.company.assembleegameclient.map {
import com.company.assembleegameclient.game.AGameSprite;
import com.company.assembleegameclient.map.mapoverlay.MapOverlay;
import com.company.assembleegameclient.map.partyoverlay.PartyOverlay;
import com.company.assembleegameclient.objects.BasicObject;
import com.company.assembleegameclient.objects.Character;
import com.company.assembleegameclient.objects.GameObject;
import com.company.assembleegameclient.objects.Party;
import com.company.assembleegameclient.objects.particles.ParticleEffect;
import com.company.assembleegameclient.parameters.Parameters;
import com.company.assembleegameclient.util.ConditionEffect;
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.GraphicsBitmapFill;
import flash.display.Sprite;
import flash.filters.ColorMatrixFilter;
import flash.geom.ColorTransform;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.utils.Dictionary;
import kabam.rotmg.assets.EmbeddedAssets;
import kabam.rotmg.core.StaticInjectorContext;
import kabam.rotmg.game.model.GameModel;
import kabam.rotmg.stage3D.GraphicsFillExtra;
import kabam.rotmg.stage3D.Render3D;
import kabam.rotmg.stage3D.Renderer;
import kabam.rotmg.stage3D.graphic3D.Program3DFactory;
import kabam.rotmg.stage3D.graphic3D.TextureFactory;
import kabam.rotmg.ui.signals.RealmOryxSignal;
public class Map extends AbstractMap {
public static const CLOTH_BAZAAR:String = "Cloth Bazaar";
public static const NEXUS:String = "Nexus";
public static const DAILY_QUEST_ROOM:String = "Daily Quest Room";
public static const DAILY_LOGIN_ROOM:String = "Daily Login Room";
public static const PET_YARD_1:String = "Pet Yard";
public static const PET_YARD_2:String = "Pet Yard 2";
public static const PET_YARD_3:String = "Pet Yard 3";
public static const PET_YARD_4:String = "Pet Yard 4";
public static const PET_YARD_5:String = "Pet Yard 5";
public static const REALM:String = "Realm of the Mad God";
public static const ORYX_CHAMBER:String = "Oryx\'s Chamber";
public static const GUILD_HALL:String = "Guild Hall";
public static const GUILD_HALL_2:String = "Guild Hall 2";
public static const GUILD_HALL_3:String = "Guild Hall 3";
public static const GUILD_HALL_4:String = "Guild Hall 4";
public static const GUILD_HALL_5:String = "Guild Hall 5";
public static const NEXUS_EXPLANATION:String = "Nexus_Explanation";
public static const VAULT:String = "Vault";
private static const VISIBLE_SORT_FIELDS:Array = ["sortVal_", "objectId_"];
private static const VISIBLE_SORT_PARAMS:Array = [16, 16];
protected static const BLIND_FILTER:ColorMatrixFilter = new ColorMatrixFilter([0.05, 0.05, 0.05, 0, 0, 0.05, 0.05, 0.05, 0, 0, 0.05, 0.05, 0.05, 0, 0, 0.05, 0.05, 0.05, 1, 0]);
public static var forceSoftwareRender:Boolean = false;
public static var texture:BitmapData;
protected static var BREATH_CT:ColorTransform = new ColorTransform(1, 0.215686274509804, 0, 0);
public function Map(_arg_1:AGameSprite) {
objsToAdd_ = new Vector.<BasicObject>();
idsToRemove_ = new Vector.<int>();
forceSoftwareMap = new Dictionary();
darkness = new EmbeddedAssets.DarknessBackground();
bgCont = new Sprite();
graphicsData_ = new Vector.<GraphicsBitmapFill>();
visible_ = [];
visibleUnder_ = [];
visibleSquares_ = new Vector.<Square>();
topSquares_ = new Vector.<Square>();
super();
gs_ = _arg_1;
mapHitArea = new Sprite();
mapOverlay_ = new MapOverlay();
partyOverlay_ = new PartyOverlay(this);
party_ = new Party(this);
quest_ = new Quest(this);
StaticInjectorContext.getInjector().getInstance(GameModel).gameObjects = goDict_;
}
public var visible_:Array;
public var visibleUnder_:Array;
public var visibleSquares_:Vector.<Square>;
public var topSquares_:Vector.<Square>;
private var inUpdate_:Boolean = false;
private var objsToAdd_:Vector.<BasicObject>;
private var idsToRemove_:Vector.<int>;
private var forceSoftwareMap:Dictionary;
private var darkness:DisplayObject;
private var bgCont:Sprite;
private var oryxObjectId:int;
private var graphicsData_:Vector.<GraphicsBitmapFill>;
override public function calcVulnerables():void {
var _local1:GameObject = null;
this.vulnEnemyDict_.length = 0;
this.vulnPlayerDict_.length = 0;
for each(_local1 in goDict_) {
if (_local1.props_.isEnemy_) {
if (!_local1.dead_ && !_local1.isInvincible) {
if (!(_local1.props_.isCube_ && Parameters.data.fameBlockCubes)) {
if (!(!_local1.props_.isGod_ && Parameters.data.fameBlockGodsOnly)) {
if ((_local1.condition_[0] & ConditionEffect.PROJ_NOHIT_BITMASK) == 0) {
vulnEnemyDict_.push(_local1);
}
}
}
}
} else if (_local1.props_.isPlayer_) {
if (!_local1.isPaused && !_local1.isInvincible && !_local1.isStasis && !_local1.dead_) {
vulnPlayerDict_.push(_local1);
}
}
}
}
override public function setProps(_arg_1:int, _arg_2:int, _arg_3:String, _arg_4:int, _arg_5:Boolean, _arg_6:Boolean):void {
mapWidth = _arg_1;
mapHeight = _arg_2;
name_ = _arg_3;
back_ = _arg_4;
allowPlayerTeleport_ = _arg_5;
showDisplays_ = _arg_6;
this.forceSoftwareRenderCheck(name_);
}
override public function setHitAreaProps(_arg_1:int, _arg_2:int):void {
mapHitArea.graphics.beginFill(0xff0000, 0);
mapHitArea.graphics.drawRect(-_arg_1 / 2, -_arg_2 / 2 - 20, _arg_1, _arg_2);
}
override public function initialize():void {
squares.length = mapWidth * mapHeight;
addChild(map_);
addChild(mapHitArea);
addChild(mapOverlay_);
addChild(partyOverlay_);
isPetYard = name_.substr(0, 8) == "Pet Yard";
isQuestRoom = name_.indexOf("Quest") != -1;
}
override public function dispose():void {
var _local2:* = null;
var _local1:* = null;
var _local3:* = null;
gs_ = null;
background_ = null;
map_ = null;
mapHitArea.graphics.clear();
mapHitArea = null;
mapOverlay_ = null;
partyOverlay_ = null;
squares.length = 0;
squares = null;
for each(_local1 in goDict_) {
_local1.dispose();
}
goDict_ = null;
for each(_local3 in boDict_) {
_local3.dispose();
}
boDict_ = null;
merchLookup_ = null;
player_ = null;
party_ = null;
quest_ = null;
this.objsToAdd_ = null;
this.idsToRemove_ = null;
TextureFactory.disposeTextures();
GraphicsFillExtra.dispose();
Program3DFactory.getInstance().dispose();
}
override public function update(_arg1:int, _arg2:int):void {
var _local3:BasicObject;
var _local4:int;
this.inUpdate_ = true;
for each (_local3 in goDict_) {
if (_local3 && this.idsToRemove_ != null
&& this.idsToRemove_.indexOf(_local3.objectId_) == -1
&& !_local3.update(_arg1, _arg2)) {
this.idsToRemove_.push(_local3.objectId_);
}
}
for each (_local3 in boDict_) {
if (_local3 && this.idsToRemove_ != null
&& this.idsToRemove_.indexOf(_local3.objectId_) == -1
&& !_local3.update(_arg1, _arg2)) {
this.idsToRemove_.push(_local3.objectId_);
}
}
this.inUpdate_ = false;
for each (_local3 in this.objsToAdd_) {
this.internalAddObj(_local3);
}
this.objsToAdd_.length = 0;
for each (_local4 in this.idsToRemove_) {
this.internalRemoveObj(_local4);
}
this.idsToRemove_.length = 0;
party_.update(_arg1, _arg2);
}
override public function pSTopW(_arg_1:Number, _arg_2:Number):Point {
var _local3:* = null;
var _local5:int = 0;
var _local4:* = this.visibleSquares_;
for each(_local3 in this.visibleSquares_) {
if (_local3.faces_.length != 0 && _local3.faces_[0].face.contains(_arg_1, _arg_2)) {
return new Point(_local3.centerX_, _local3.centerY_);
}
}
return null;
}
override public function setGroundTile(_arg_1:int, _arg_2:int, _arg_3:uint):void {
var _local9:int = 0;
var _local8:int = 0;
var _local4:Square = null;
var _local7:Square = this.getSquare(_arg_1, _arg_2);
_local7.setTileType(_arg_3);
var _local6:int = _arg_1 < mapWidth - 1 ? _arg_1 + 1 : _arg_1;
var _local5:int = _arg_2 < mapHeight - 1 ? _arg_2 + 1 : _arg_2;
var _local10:int = _arg_1 > 0 ? _arg_1 - 1 : _arg_1;
while (_local10 <= _local6) {
_local9 = _arg_2 > 0 ? _arg_2 - 1 : _arg_2;
while (_local9 <= _local5) {
_local8 = _local10 + _local9 * mapWidth;
_local4 = squares[_local8];
if (_local4 != null && (_local4.props_.hasEdge_ || _local4.tileType != _arg_3)) {
_local4.faces_.length = 0;
}
_local9++;
}
_local10++;
}
}
override public function addObj(_arg_1:BasicObject, _arg_2:Number, _arg_3:Number):void {
_arg_1.x_ = _arg_2;
_arg_1.y_ = _arg_3;
if (_arg_1 is ParticleEffect) {
(_arg_1 as ParticleEffect).reducedDrawEnabled = !Parameters.data.particleEffect;
}
if (this.inUpdate_) {
this.objsToAdd_.push(_arg_1);
} else {
this.internalAddObj(_arg_1);
}
}
override public function removeObj(_arg_1:int):void {
if (this.inUpdate_) {
this.idsToRemove_.push(_arg_1);
} else {
this.internalRemoveObj(_arg_1);
}
}
override public function draw(camera:Camera, time:int):void {
var screenRect:Rectangle = camera.clipRect_;
x = -screenRect.x * 800 / WebMain.STAGE.stageWidth * Parameters.data.mscale;
y = -screenRect.y * 600 / WebMain.STAGE.stageHeight * Parameters.data.mscale;
WebMain.STAGE.stage3Ds[0].x = 400 - WebMain.STAGE.stageWidth / 2;
WebMain.STAGE.stage3Ds[0].y = 300 - WebMain.STAGE.stageHeight / 2;
var filter:uint = 0;
var render3D:Render3D = null;
var square:Square = null;
var go:GameObject = null;
var bo:BasicObject = null;
var yi:int = 0;
this.visible_.length = 0;
this.visibleUnder_.length = 0;
this.visibleSquares_.length = 0;
this.topSquares_.length = 0;
this.graphicsData_.length = 0;
var len:int = Parameters.data.renderDistance - 1;
for (var xi:int = -len; xi <= len; xi++)
for (yi = -len; yi <= len; yi++)
if (xi * xi + yi * yi <= len * len) {
square = this.lookupSquare(xi + this.player_.x_, yi + this.player_.y_);
if (square != null) {
square.lastVisible_ = time;
square.draw(this.graphicsData_, camera, time);
this.visibleSquares_.push(square);
if (square.topFace_ != null)
this.topSquares_.push(square);
}
}
for each (go in this.goDict_) {
go.drawn_ = false;
if (!go.dead_) {
square = go.square;
if (!(square == null || square.lastVisible_ != time)) {
go.drawn_ = true;
go.computeSortVal(camera); // gets computed regardless for posS_
if (go.objectId_ == player_.objectId_)
go.sortVal_ = 9999;
if (go.props_.drawUnder_) {
if (go.props_.drawOnGround_)
go.draw(this.graphicsData_, camera, time);
else
this.visibleUnder_.push(go);
} else
this.visible_.push(go);
}
}
}
for each (bo in this.boDict_) {
bo.drawn_ = false;
square = bo.square;
if (!(square == null || square.lastVisible_ != time)) {
bo.drawn_ = true;
bo.computeSortVal(camera);
this.visible_.push(bo);
}
}
if (this.visibleUnder_.length > 0) {
if (!Parameters.data.disableSorting)
this.visibleUnder_.sortOn(VISIBLE_SORT_FIELDS, VISIBLE_SORT_PARAMS);
for each (bo in this.visibleUnder_)
bo.draw(this.graphicsData_, camera, time);
}
if (!Parameters.data.disableSorting)
this.visible_.sortOn(VISIBLE_SORT_FIELDS, VISIBLE_SORT_PARAMS);
for each (bo in this.visible_)
bo.draw(this.graphicsData_, camera, time);
if (this.topSquares_.length > 0)
for each(square in this.topSquares_)
square.drawTop(this.graphicsData_, camera, time);
if (Renderer.inGame) {
filter = this.getFilterIndex();
render3D = StaticInjectorContext.getInjector().getInstance(Render3D);
render3D.dispatch(this.graphicsData_, filter);
if (time % 149 == 0)
GraphicsFillExtra.manageSize();
}
this.mapOverlay_.draw(camera, time);
this.partyOverlay_.draw(camera, time);
}
public function internalAddObj(_arg_1:BasicObject):void {
if (!_arg_1.addTo(this, _arg_1.x_, _arg_1.y_)) {
return;
}
var _local2:Dictionary = _arg_1 is GameObject ? goDict_ : boDict_;
if (_local2[_arg_1.objectId_] != null) {
if (!isPetYard) {
return;
}
}
if (name_ == "Oryx\'s Chamber" && this.oryxObjectId == 0) {
if (_arg_1 is Character && (_arg_1 as Character).getName() == "Oryx the Mad God") {
this.oryxObjectId = _arg_1.objectId_;
}
}
_local2[_arg_1.objectId_] = _arg_1;
}
public function internalRemoveObj(_arg_1:int):void {
var _local2:Dictionary = goDict_;
var _local3:BasicObject = _local2[_arg_1];
if (_local3 == null) {
_local2 = boDict_;
_local3 = _local2[_arg_1];
if (_local3 == null) {
return;
}
delete boDict_[_arg_1];
} else delete goDict_[_arg_1];
_local3.removeFromMap();
if (name_ == "Oryx\'s Chamber" && _arg_1 == this.oryxObjectId) {
StaticInjectorContext.getInjector().getInstance(RealmOryxSignal).dispatch();
}
}
public function getSquare(_arg1:Number, _arg2:Number):Square {
if ((((((((_arg1 < 0)) || ((_arg1 >= mapWidth)))) || ((_arg2 < 0)))) || ((_arg2 >= mapHeight)))) {
return (null);
}
var _local3:int = (int(_arg1) + (int(_arg2) * mapWidth));
var _local4:Square = squares[_local3];
if (_local4 == null) {
_local4 = new Square(this, int(_arg1), int(_arg2));
squares[_local3] = _local4;
}
return (_local4);
}
public function lookupSquare(_arg1:int, _arg2:int):Square {
if ((((((((_arg1 < 0)) || ((_arg1 >= mapWidth)))) || ((_arg2 < 0)))) || ((_arg2 >= mapHeight)))) {
return (null);
}
return (squares[(_arg1 + (_arg2 * mapWidth))]);
}
private function forceSoftwareRenderCheck(_arg_1:String):void {
forceSoftwareRender = this.forceSoftwareMap[_arg_1] != null || WebMain.STAGE != null && WebMain.STAGE.stage3Ds[0].context3D == null;
}
private function getFilterIndex() : uint {
var index:int = 0;
if (player_ != null && (player_.condition_[0] & ConditionEffect.MAP_FILTER_BITMASK) != 0) {
if (player_.isPaused)
index = 1;
else if (player_.isBlind)
index = 2;
else if (player_.isDrunk)
index = 3;
}
return index;
}
}
}
|
//Copyright 2010 SRT Solutions
//
//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 System.Linq
{
import System.Collection.Generic.IEnumerable;
import System.Collection.Generic.IEnumerator;
import System.Collection.Generic.IEqualityComparer;
public class IntersectEnumerator implements IEnumerator
{
private var first:IEnumerator;
private var second:IEnumerable;
private var secondCache:Array = null;
private var comparer:IEqualityComparer = null;
private var current:* = null;
private var invert:Boolean;
public function IntersectEnumerator(first:IEnumerable, second:IEnumerable, comparer:IEqualityComparer, invert:Boolean=false)
{
this.first = first.getEnumerator();
this.second = second;
this.comparer = comparer;
this.invert = invert;
}
private function populateSecondCache():void {
if(secondCache != null)
return;
secondCache = second.toArray();
}
public function MoveNext():Boolean
{
populateSecondCache();
while(first.MoveNext())
{
var possibleCurrent:* = first.Current();
var inBoth:Boolean = inSecond(possibleCurrent);
if(invert ? !inBoth : inBoth)
{
current = possibleCurrent;
return true;
}
}
return false;
}
private function inSecond(item:*):Boolean {
if(comparer == null)
return secondCache.indexOf(item) >= 0;
for each(var firstItem:* in secondCache)
if(comparer.Equals(firstItem, item))
return true;
return false;
}
public function Current():*
{
return current;
}
public function Reset():void
{
first.Reset();
secondCache = null;
current = null;
}
}
} |
/*
Copyright (c) 2010 Trevor McCauley
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.myavatareditor.avatarcore {
import com.myavatareditor.avatarcore.Collection;
import com.myavatareditor.avatarcore.events.FeatureDefinitionEvent;
import flash.events.Event;
/**
* Dispatched when a new FeatureDefinition instance is added to the
* Library.
*/
[Event(name="featureDefinitionEventAdded", type="com.myavatareditor.avatarcore.events.FeatureDefinitionEvent")]
/**
* Dispatched when an existing FeatureDefinition instance within the
* Library is changed.
*/
[Event(name="featureDefinitionEventChanged", type="com.myavatareditor.avatarcore.events.FeatureDefinitionEvent")]
/**
* Dispatched when an existing FeatureDefinition instance within the
* Library is removed.
*/
[Event(name="featureDefinitionEventRemoved", type="com.myavatareditor.avatarcore.events.FeatureDefinitionEvent")]
/**
* A collection of FeatureDefinition objects to be associated with an Avatar
* object's Feature objects. At any time an avatar can change its library to
* another allowing it to completely change it's appearance. Libraries are
* not required for avatars; avatars can optionally reference Art, Color, and
* Adjust objects directly. Using library reduces redundancy between available
* assets and those used by avatars. Libraries also allow avatar editors to
* know what characteristics are available to avatars as users modify them.
* @author Trevor McCauley; www.senocular.com
*/
public class Library extends Collection {
/**
* When true, events are not dispatched. This is useful
* for batch operations where events are not necessary
* such as cloning.
*/
protected function get suppressEvents():Boolean { return _suppressEvents; }
protected function set suppressEvents(value:Boolean):void {
_suppressEvents = value;
}
private var _suppressEvents:Boolean = false;
/**
* Constructor for new Library instances.
*/
public function Library(name:String = null) {
this.name = name;
super();
}
/**
* Returns string version of this Library instance.
*/
override public function toString():String {
return "[Library name=\"" + name + "\"]";
}
/**
* Creates and returns a copy of the Library object.
* @return A copy of this Library object.
*/
override public function clone(copyInto:Object = null):Object {
suppressEvents = true;
try {
var copy:Library = (copyInto) ? copyInto as Library : new Library();
if (copy == null) return null;
super.clone(copy);
}catch (err:*){
// errors pass through. Errors must be
// handled however, to allow suppressEvents
// to be restored to false
throw(err);
}finally{
suppressEvents = false;
}
return copy;
}
/**
* Custom addItem for Library objects that dispatches the appropriate
* ADDED or ADDED events
* depending on whether or not the item already exists within the
* library collection.
* @param item
* @return
*/
public override function addItem(item:*):* {
var eventType:String;
// remove existing item by name without events
// assumes (forces) requireUniqueNames true
var itemName:String = (Collection.nameKey in item) ? item[Collection.nameKey] : null;
if (itemName && super.removeItemByName(itemName)) {
eventType = FeatureDefinitionEvent.CHANGED;
}else {
eventType = FeatureDefinitionEvent.ADDED;
}
var added:* = super.addItem(item);
if (added is FeatureDefinition) {
var definition:FeatureDefinition = added as FeatureDefinition;
// remove definition from any previous library
// definitions require one library for the
// interaction of updates through redraw()
var oldLibrary:Library = definition.library;
if (oldLibrary && oldLibrary != this){
oldLibrary.removeItem(definition);
}
// link definition to this library
definition.library = this;
dispatchEvent(new FeatureDefinitionEvent(eventType, false, false, added as FeatureDefinition));
}
return added;
}
/**
* Custom removeItem for Library objects that dispatches the
* REMOVED event for FeatureDefinition objects
* removed from the library collection.
* @param item The item to remove.
* @return The item removed.
*/
public override function removeItem(item:*):* {
var removed:* = super.removeItem(item);
if (removed is FeatureDefinition) {
dispatchEvent(new FeatureDefinitionEvent(FeatureDefinitionEvent.REMOVED, false, false, removed as FeatureDefinition));
}
return removed;
}
/**
* Invokes a FeatureDefinitionEvent.CHANGED event to indicate to
* objects that the definition has changed. This mirrors the
* behavior of FeatureDefinition.redraw() which is typically called
* instead of this method.
* @param definition The FeatureDefinition within the Library
* instance that needs to be redrawn.
* @param originalName The original name for the definition of a cause
* for the redraw includes changing the name. Since links are made through
* names, an original name helps identify old references.
* @see FeatureDefinition#redraw()
* @private
*/
internal function redrawFeatureDefinition(definition:FeatureDefinition, originalName:String = null):void {
if (definition == null) return;
dispatchEvent(new FeatureDefinitionEvent(FeatureDefinitionEvent.CHANGED, false, false, definition, originalName));
}
/**
* @inheritDoc
*/
override public function dispatchEvent(event:Event):Boolean {
return (suppressEvents) ? false : super.dispatchEvent(event);
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// 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.core
{
import org.apache.royale.core.IContentViewHost;
import org.apache.royale.core.ILayoutParent;
import org.apache.royale.core.ILayoutHost;
import org.apache.royale.core.ILayoutView;
import org.apache.royale.core.UIBase;
import org.apache.royale.core.ValuesManager;
import org.apache.royale.events.Event;
import org.apache.royale.events.ValueChangeEvent;
import org.apache.royale.events.ValueEvent;
import org.apache.royale.states.State;
import org.apache.royale.utils.MXMLDataInterpreter;
import org.apache.royale.utils.loadBeadFromValuesManager;
COMPILE::JS
{
import org.apache.royale.html.util.addElementToWrapper;
}
/**
* Indicates that the state change has completed. All properties
* that need to change have been changed, and all transitinos
* that need to run have completed. However, any deferred work
* may not be completed, and the screen may not be updated until
* code stops executing.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
[Event(name="stateChangeComplete", type="org.apache.royale.events.Event")]
/**
* Indicates that the initialization of the container is complete.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
[Event(name="initComplete", type="org.apache.royale.events.Event")]
/**
* Indicates that the children of the container is have been added.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
[Event(name="childrenAdded", type="org.apache.royale.events.Event")]
/**
* The GroupBase class is the base class for most simple containers
* in Royale. It is usable as the root tag of MXML
* documents and UI controls and containers are added to it.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
public class GroupBase extends UIBase implements IStatesObject, IContainer, ILayoutParent, ILayoutView, IContentViewHost
{
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
public function GroupBase()
{
super();
}
/**
* @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
*/
COMPILE::JS
override protected function createElement():WrappedHTMLElement
{
return addElementToWrapper(this,'div');
}
override public function addedToParent():void
{
super.addedToParent();
// Load the layout bead if it hasn't already been loaded.
loadBeadFromValuesManager(IBeadLayout, "iBeadLayout", this);
}
/*
* IContainer
*/
/**
* @private
*/
public function childrenAdded():void
{
dispatchEvent(new ValueEvent("childrenAdded"));
}
/*
* Utility
*/
/**
* Dispatches a "layoutNeeded" event
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
public function layoutNeeded():void
{
dispatchEvent( new Event("layoutNeeded") );
}
/*
* ILayoutParent
*/
/**
* Returns the ILayoutHost which is its view. From ILayoutParent.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
* @royaleignorecoercion org.apache.royale.core.ILayoutHost
*/
public function getLayoutHost():ILayoutHost
{
return view as ILayoutHost;
}
/**
* @copy org.apache.royale.core.IContentViewHost#strandChildren
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
public function get strandChildren():IParent
{
return this;
}
private var _states:Array;
/**
* The array of view states. These should
* be instances of org.apache.royale.states.State.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
public function get states():Array
{
return _states;
}
/**
* @private
* @royaleignorecoercion Class
* @royaleignorecoercion org.apache.royale.core.IBead
*/
public function set states(value:Array):void
{
_states = value;
_currentState = _states[0].name;
try{
loadBeadFromValuesManager(IStatesImpl, "iStatesImpl", this);
}
//TODO: Need to handle this case more gracefully
catch(e:Error)
{
COMPILE::SWF
{
trace(e.message);
}
}
}
/**
* <code>true</code> if the array of states
* contains a state with this name.
*
* @param state The state namem.
* @return True if state in state array
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
public function hasState(state:String):Boolean
{
for each (var s:State in _states)
{
if (s.name == state)
return true;
}
return false;
}
private var _currentState:String;
[Bindable("currentStateChange")]
/**
* The name of the current state.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
public function get currentState():String
{
return _currentState;
}
/**
* @private
*/
public function set currentState(value:String):void
{
var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value)
_currentState = value;
dispatchEvent(event);
}
private var _transitions:Array;
/**
* The array of transitions.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
*/
public function get transitions():Array
{
return _transitions;
}
/**
* @private
*/
public function set transitions(value:Array):void
{
_transitions = value;
}
/**
* @private
*/
override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
super.addElement(c, dispatchEvent);
if (dispatchEvent)
this.dispatchEvent(new ValueEvent("childrenAdded", c));
}
/**
* @private
*/
override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
super.addElementAt(c, index, dispatchEvent);
if (dispatchEvent)
this.dispatchEvent(new ValueEvent("childrenAdded", c));
}
/**
* @private
*/
override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
super.removeElement(c, dispatchEvent);
//TODO This should possibly be ultimately refactored to be more PAYG
if (dispatchEvent)
this.dispatchEvent(new ValueEvent("childrenRemoved", c));
}
}
}
|
package integration.proxyMapMediatorProtectionTests {
import integration.aframworkHelpers.ProxyMapCleaner;
import integration.aGenericTestObjects.GenericTestModule;
import integration.aGenericTestObjects.model.GenericTestProxy;
import integration.aGenericTestObjects.model.IGenericTestProxy;
import integration.aGenericTestObjects.view.GenericViewObject;
import integration.aGenericTestObjects.view.GenericViewObjectMediator_withInject;
import integration.aGenericTestObjects.view.GenericViewObjectMediator_withInterfaceInject;
import mvcexpress.MvcExpress;
import org.flexunit.Assert;
import utils.AsyncUtil;
public class ProxyMapMediatorProtectionTests {
private var module:GenericTestModule;
[Before]
public function runBeforeEveryTest():void {
module = new GenericTestModule("ProxyMapMediatorProtection_test");
}
[After]
public function runAfterEveryTest():void {
MvcExpress.pendingInjectsTimeOut = 0;
module.disposeModule();
ProxyMapCleaner.clear();
MvcExpress.usePureMediators = false;
}
//----------------------------------
//----------------------------------
// NOT PURE MEDIATORS
//----------------------------------
//----------------------------------
[Test(expects="Error")]
public function proxyMapMediatorProtection_notMappedProxyInjectedIntoMediator_fails():void {
var testProxy:GenericTestProxy = new GenericTestProxy();
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test]
public function proxyMapMediatorProtection_injectAsClassProxyMappedProxyClassIntoMediator_fails():void {
var testProxy:GenericTestProxy = new GenericTestProxy();
module.proxymap_map(testProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_injectAsClassProxyMappedInjectedAsProxyIntoMediator_fails():void {
var testProxy:GenericTestProxy = new GenericTestProxy();
module.proxymap_map(testProxy, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_injectAsMediatorClassProxyMappedInjectedAsProxyIntoMediator_fails():void {
var testProxy:GenericTestProxy = new GenericTestProxy()
module.proxymap_map(testProxy, null, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_injectAsProxyMappedInjectedAsInterfaceIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy()
module.proxymap_map(testProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test]
public function proxyMapMediatorProtection_injectAsClassProxyMappedInjectedAsInterfaceIntoMediator_fails():void {
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.proxymap_map(testProxy, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test]
public function proxyMapMediatorProtection_injectAsMediatorAndInjectClassProxyMappedInjectedAsInterfaceIntoMediator_isOK():void {
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.proxymap_map(testProxy, null, IGenericTestProxy, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test]
public function proxyMapMediatorProtection_injectAsMediatorClassProxyMappedInjectedAsInterfaceIntoMediator_isOK():void {
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.proxymap_map(testProxy, null, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
//----------------------------------
// pending proxy injected into
//----------------------------------
[Test(async)]
public function proxyMapMediatorProtection_pendingInjectAsClassProxyMappedInjectedAsProxyIntoMediator_fails():void {
GenericViewObjectMediator_withInject.ASYNC_REGISTER_FUNCTION = AsyncUtil.asyncHandler(this, callBackSuccess, null, 200, callBackFail);
MvcExpress.pendingInjectsTimeOut = 500;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
module.proxymap_map(testProxy);
}
[Test(async)]
public function proxyMapMediatorProtection_pendingInjectAsClassProxyMappedInjectedAsInterfaceIntoMediator_fails():void {
GenericViewObjectMediator_withInterfaceInject.ASYNC_REGISTER_FUNCTION = AsyncUtil.asyncHandler(this, callBackSuccess, null, 200, callBackFail);
MvcExpress.pendingInjectsTimeOut = 500;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
module.proxymap_map(testProxy, null, IGenericTestProxy);
}
[Test(async)]
public function proxyMapMediatorProtection_pendingInjectAsClassProxyMappedInjectedAsMediatorInterfaceIntoMediator_isOK():void {
GenericViewObjectMediator_withInterfaceInject.ASYNC_REGISTER_FUNCTION = AsyncUtil.asyncHandler(this, callBackSuccess, null, 200, callBackFail);
MvcExpress.pendingInjectsTimeOut = 500;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
module.proxymap_map(testProxy, null, null, IGenericTestProxy);
}
//-------------
// lazy map
//-------------
[Test]
public function proxyMapMediatorProtection_lazyInjectAsClassProxyMappedInjectedAsProxyIntoMediator_fails():void {
//
module.proxymap_lazyMap(GenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
}
[Test]
public function proxyMapMediatorProtection_lazyInjectAsClassProxyMappedInjectedAsInterfaceIntoMediator_fails():void {
//
module.proxymap_lazyMap(GenericTestProxy, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test]
public function proxyMapMediatorProtection_lazyInjectAsMediatorClassProxyMappedInjectedAsInterfaceIntoMediator_isOK():void {
//
module.proxymap_lazyMap(GenericTestProxy, null, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
//----------------------------------
//----------------------------------
// PURE MEDIATORS
//----------------------------------
//----------------------------------
[Test(expects="Error")]
public function proxyMapMediatorProtection_pure_notMappedProxyInjectedIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy();
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_pure_injectAsClassProxyMappedProxyClassIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy();
module.proxymap_map(testProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_pure_injectAsClassProxyMappedInjectedAsProxyIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy();
module.proxymap_map(testProxy, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_pure_injectAsMediatorClassProxyMappedInjectedAsProxyIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy()
module.proxymap_map(testProxy, null, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_pure_injectAsProxyMappedInjectedAsInterfaceIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy()
module.proxymap_map(testProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_pure_injectAsClassProxyMappedInjectedAsInterfaceIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.proxymap_map(testProxy, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test]
public function proxyMapMediatorProtection_pure_injectAsMediatorAndInjectClassProxyMappedInjectedAsInterfaceIntoMediator_isOK():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.proxymap_map(testProxy, null, IGenericTestProxy, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test]
public function proxyMapMediatorProtection_pure_injectAsMediatorClassProxyMappedInjectedAsInterfaceIntoMediator_isOK():void {
MvcExpress.usePureMediators = true;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.proxymap_map(testProxy, null, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
//----------------------------------
// pending proxy injected into
//----------------------------------
[Test(async, expects="Error")]
public function proxyMapMediatorProtection_pure_pendingInjectAsClassProxyMappedInjectedAsProxyIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
GenericViewObjectMediator_withInterfaceInject.ASYNC_REGISTER_FUNCTION = AsyncUtil.asyncHandler(this, callBackSuccess, null, 200, callBackFail);
MvcExpress.pendingInjectsTimeOut = 500;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
module.proxymap_map(testProxy);
}
[Test(async, expects="Error")]
public function proxyMapMediatorProtection_pure_pendingInjectAsClassProxyMappedInjectedAsInterfaceIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
GenericViewObjectMediator_withInterfaceInject.ASYNC_REGISTER_FUNCTION = AsyncUtil.asyncHandler(this, callBackSuccess, null, 200, callBackFail);
MvcExpress.pendingInjectsTimeOut = 500;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
module.proxymap_map(testProxy, null, IGenericTestProxy);
}
[Test(async)]
public function proxyMapMediatorProtection_pure_pendingInjectAsClassProxyMappedInjectedAsMediatorInterfaceIntoMediator_isOK():void {
MvcExpress.usePureMediators = true;
GenericViewObjectMediator_withInterfaceInject.ASYNC_REGISTER_FUNCTION = AsyncUtil.asyncHandler(this, callBackSuccess, null, 200, callBackFail);
MvcExpress.pendingInjectsTimeOut = 500;
var testProxy:GenericTestProxy = new GenericTestProxy()
//
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
module.proxymap_map(testProxy, null, null, IGenericTestProxy);
}
//-------------
// lazy map
//-------------
[Test(expects="Error")]
public function proxyMapMediatorProtection_pure_lazyInjectAsClassProxyMappedInjectedAsProxyIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
//
module.proxymap_lazyMap(GenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInject);
}
[Test(expects="Error")]
public function proxyMapMediatorProtection_pure_lazyInjectAsClassProxyMappedInjectedAsInterfaceIntoMediator_fails():void {
MvcExpress.usePureMediators = true;
//
module.proxymap_lazyMap(GenericTestProxy, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
[Test]
public function proxyMapMediatorProtection_pure_lazyInjectAsMediatorClassProxyMappedInjectedAsInterfaceIntoMediator_isOK():void {
MvcExpress.usePureMediators = true;
//
module.proxymap_lazyMap(GenericTestProxy, null, null, IGenericTestProxy);
module.mediatorMap_mediateWith(new GenericViewObject(), GenericViewObjectMediator_withInterfaceInject);
}
//---------------------------------------------------
//-------------------------------------------------------
//---------------------------------------------------
private function callBackFail(obj:* = null):void {
GenericViewObjectMediator_withInterfaceInject.ASYNC_REGISTER_FUNCTION = null;
Assert.fail("CallBack should not be called...");
}
public function callBackSuccess(obj:* = null):void {
GenericViewObjectMediator_withInterfaceInject.ASYNC_REGISTER_FUNCTION = null;
}
}
}
|
/*
* Copyright (c) 2014-2017 Object Builder <https://github.com/ottools/ObjectBuilder>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package ob.utils
{
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.utils.Dictionary;
import nail.errors.NullArgumentError;
import ob.commands.ProgressBarID;
import otlib.core.otlib_internal;
import otlib.events.ProgressEvent;
import otlib.resources.Resources;
import otlib.sprites.Sprite;
import otlib.sprites.SpriteStorage;
import otlib.things.ThingType;
import otlib.things.ThingTypeStorage;
use namespace otlib_internal;
[Event(name="progress", type="otlib.events.ProgressEvent")]
[Event(name="complete", type="flash.events.Event")]
public class SpritesOptimizer extends EventDispatcher
{
//--------------------------------------------------------------------------
// PROPERTIES
//--------------------------------------------------------------------------
private var m_dat:ThingTypeStorage;
private var m_spr:SpriteStorage;
private var m_finished:Boolean;
private var m_oldIDs:Vector.<Sprite>;
private var m_newIDs:Dictionary;
private var m_removedCount:uint;
private var m_oldCount:uint;
private var m_newCount:uint;
//--------------------------------------
// Getters / Setters
//--------------------------------------
public function get removedCount():uint { return m_removedCount; }
public function get oldCount():uint { return m_oldCount; }
public function get newCount():uint { return m_newCount; }
//--------------------------------------------------------------------------
// CONSTRUCTOR
//--------------------------------------------------------------------------
public function SpritesOptimizer(dat:ThingTypeStorage, spr:SpriteStorage)
{
if (!dat)
throw new NullArgumentError("dat");
if (!spr)
throw new NullArgumentError("spr");
m_dat = dat;
m_spr = spr;
}
//--------------------------------------------------------------------------
// METHODS
//--------------------------------------------------------------------------
//--------------------------------------
// Public
//--------------------------------------
public function start(unusedSprites:Boolean, emptySprites:Boolean):void
{
if (m_finished) return;
if (unusedSprites || emptySprites)
{
dispatchProgress(0, 5, Resources.getString("startingTheOptimization"));
var length:uint = m_spr.spritesCount + 1;
var i:int = 0;
var freeIDs:Vector.<Boolean> = new Vector.<Boolean>(length, true);
var usedList:Vector.<Boolean> = new Vector.<Boolean>(length, true);
m_oldIDs = new Vector.<Sprite>(length, true);
if (unusedSprites)
{
dispatchProgress(1, 5, Resources.getString("searchingForUnusedSprites"));
// scan items
scanList(m_dat.items, usedList);
// scan outfits
scanList(m_dat.outfits, usedList);
// scan effects
scanList(m_dat.effects, usedList);
// scan missiles
scanList(m_dat.missiles, usedList);
// =====================================================================
// gets all unused/empty ids.
dispatchProgress(2, 5, Resources.getString("gettingFreeIds"));
for (i = 1; i < length; i++)
{
m_oldIDs[i] = m_spr.getSprite(i);
if (!usedList[i] && (!m_oldIDs[i].isEmpty || emptySprites))
freeIDs[i] = true;
}
}
else
{
// =====================================================================
// gets all empty ids.
dispatchProgress(2, 5, Resources.getString("gettingFreeIds"));
for (i = 1; i < length; i++)
{
m_oldIDs[i] = m_spr.getSprite(i);
if (m_spr.isEmptySprite(i))
freeIDs[i] = true;
}
}
// =====================================================================
// replaces all free ids and organizes indices.
m_newIDs = new Dictionary();
dispatchProgress(3, 5, Resources.getString("organizingSprites"));
var index:int = 1;
var count:uint = 0;
for (i = 1; i < length; i++, index++)
{
while (index < length && freeIDs[index])
{
index++;
count++;
}
if (index > m_spr.spritesCount) break;
var sprite:Sprite = m_oldIDs[index];
sprite.id = i;
m_newIDs[i] = sprite;
}
// =====================================================================
// updates the ids of all lists.
dispatchProgress(4, 5, Resources.getString("updatingObjects"));
if (count > 0)
{
// set items
setNewIDs(m_dat.items);
// set outfits
setNewIDs(m_dat.outfits);
// set effects
setNewIDs(m_dat.effects);
// set missiles
setNewIDs(m_dat.missiles);
// =====================================================================
// sets new values to the sprite storage.
dispatchProgress(5, 5, Resources.getString("finalizingTheOptimization"));
m_newIDs[0] = m_spr._sprites[0];
m_dat._changed = true;
m_spr._sprites = m_newIDs;
m_spr._spritesCount = m_spr._spritesCount - count;
m_spr._changed = true;
}
m_removedCount = count;
m_oldCount = length - 1;
m_newCount = m_spr._spritesCount;
}
m_finished = true;
dispatchEvent(new Event(Event.COMPLETE));
}
private function scanList(list:Dictionary, usedList:Vector.<Boolean>):void
{
for each (var thing:ThingType in list)
{
var spriteIDs:Vector.<uint> = thing.spriteIndex;
for (var i:int = spriteIDs.length - 1; i >= 0; i--)
usedList[ spriteIDs[i] ] = true;
}
}
private function setNewIDs(list:Dictionary):void
{
for each (var thing:ThingType in list)
{
var spriteIDs:Vector.<uint> = thing.spriteIndex;
for (var i:int = spriteIDs.length - 1; i >= 0; i--)
{
if (spriteIDs[i] != 0)
spriteIDs[i] = m_oldIDs[ spriteIDs[i] ].id;
}
}
}
private function dispatchProgress(current:uint, target:uint, label:String):void
{
dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS,
ProgressBarID.FIND,
current,
target,
label));
}
}
}
|
// Decompiled by AS3 Sorcerer 6.08
// www.as3sorcerer.com
//kabam.rotmg.chat.view.ChatListMediator
package kabam.rotmg.chat.view
{
import robotlegs.bender.bundles.mvcs.Mediator;
import kabam.rotmg.chat.model.ChatModel;
import kabam.rotmg.chat.control.ShowChatInputSignal;
import kabam.rotmg.chat.control.ScrollListSignal;
import kabam.rotmg.chat.control.AddChatSignal;
import kabam.rotmg.application.api.ApplicationSetup;
import kabam.rotmg.chat.model.ChatMessage;
import com.company.assembleegameclient.parameters.Parameters;
public class ChatListMediator extends Mediator
{
[Inject]
public var view:ChatList;
[Inject]
public var model:ChatModel;
[Inject]
public var showChatInput:ShowChatInputSignal;
[Inject]
public var scrollList:ScrollListSignal;
[Inject]
public var addChat:AddChatSignal;
[Inject]
public var itemFactory:ChatListItemFactory;
[Inject]
public var setup:ApplicationSetup;
override public function initialize():void
{
var _local_1:ChatMessage;
this.view.setup(this.model);
for each (_local_1 in this.model.chatMessages)
{
this.view.addMessage(this.itemFactory.make(_local_1, true));
}
this.view.scrollToCurrent();
this.showChatInput.add(this.onShowChatInput);
this.scrollList.add(this.onScrollList);
this.addChat.add(this.onAddChat);
this.onAddChat(ChatMessage.make(Parameters.CLIENT_CHAT_NAME, this.getChatLabel()));
}
override public function destroy():void
{
this.showChatInput.remove(this.onShowChatInput);
this.scrollList.remove(this.onScrollList);
this.addChat.remove(this.onAddChat);
}
private function onShowChatInput(_arg_1:Boolean, _arg_2:String):void
{
this.view.y = (this.model.bounds.height - ((_arg_1) ? this.model.lineHeight : 0));
}
private function onScrollList(_arg_1:int):void
{
if (_arg_1 > 0)
{
this.view.pageDown();
}
else
{
if (_arg_1 < 0)
{
this.view.pageUp();
}
}
}
private function onAddChat(_arg_1:ChatMessage):void
{
this.view.addMessage(this.itemFactory.make(_arg_1));
}
private function getChatLabel():String
{
var _local_1:String = this.setup.getBuildLabel();
return (_local_1.replace(/<font .+>(.+)<\/font>/g, "$1"));
}
}
}//package kabam.rotmg.chat.view
|
/**
* Morn UI Version 3.0 http://www.mornui.com/
* Feedback yungvip@163.com weixin:yungzhu
*/
package morn.core.components {
import morn.core.utils.StringUtils;
/**VBox容器*/
public class VBox extends LayoutBox {
public static const NONE:String = "none";
public static const LEFT:String = "left";
public static const CENTER:String = "center";
public static const RIGHT:String = "right";
public function VBox() {
}
override protected function changeItems():void {
var items:Array = [];
var maxWidth:Number = 0;
for (var i:int = 0, n:int = numChildren; i < n; i++) {
//TODO:LAYA.JS
var item:Component = getChildAt(i) as Component;
if (item) {
items.push(item);
maxWidth = Math.max(maxWidth, item.displayWidth);
}
}
items.sortOn(["y"], Array.NUMERIC);
var top:Number = 0;
for each (item in items) {
item.y = _maxY = top;
top += item.displayHeight + _space;
if (_align == LEFT) {
item.x = 0;
} else if (_align == CENTER) {
item.x = (maxWidth - item.displayWidth) * 0.5;
} else if (_align == RIGHT) {
item.x = maxWidth - item.displayWidth;
}
}
changeSize();
}
}
} |
package com.codeazur.as3swf.data.actions.swf5
{
import com.codeazur.as3swf.data.actions.*;
public class ActionAdd2 extends Action implements IAction
{
public static const CODE:uint = 0x47;
public function ActionAdd2(code:uint, length:uint, pos:uint) {
super(code, length, pos);
}
override public function toString(indent:uint = 0):String {
return "[ActionAdd2]";
}
override public function toBytecode(indent:uint, context:ActionExecutionContext):String {
return toBytecodeLabel(indent) + "add2";
}
}
}
|
package {
internal class Spectrum {
import com.unhurdle.spectrum.const.ColorStop;ColorStop;
import com.unhurdle.spectrum.const.Scale;Scale;
import com.unhurdle.spectrum.Application;Application;
import com.unhurdle.spectrum.ButtonGroup;ButtonGroup;
import com.unhurdle.spectrum.typography.Typography;Typography;
import com.unhurdle.spectrum.renderers.MenuItemRenderer;MenuItemRenderer;
import com.unhurdle.spectrum.renderers.ListItemRenderer;ListItemRenderer;
import com.unhurdle.spectrum.renderers.TreeItemRenderer;TreeItemRenderer;
import com.unhurdle.spectrum.renderers.TreeItemRendererBase;TreeItemRendererBase;
import com.unhurdle.spectrum.renderers.AddTableRowForArrayListData;AddTableRowForArrayListData;
import com.unhurdle.spectrum.renderers.RemoveTableRowForArrayListData;RemoveTableRowForArrayListData;
import com.unhurdle.spectrum.renderers.TableItemRenderer;TableItemRenderer;
import com.unhurdle.spectrum.renderers.UpdateTableRowForArrayListData;UpdateTableRowForArrayListData;
import com.unhurdle.spectrum.renderers.BreadcrumbsItemRenderer;BreadcrumbsItemRenderer;
import com.unhurdle.spectrum.renderers.AssetListItemRenderer;AssetListItemRenderer;
import com.unhurdle.spectrum.renderers.TableItemRendererFactoryForCollectionView;TableItemRendererFactoryForCollectionView;
import com.unhurdle.spectrum.controllers.TableCellSelectionMouseController;TableCellSelectionMouseController;
import com.unhurdle.spectrum.controllers.ItemRendererMouseController;ItemRendererMouseController;
import com.unhurdle.spectrum.model.TableModel;TableModel;
import com.unhurdle.spectrum.model.TableArrayListSelectionModel;TableArrayListSelectionModel;
import com.unhurdle.spectrum.TBodyContentArea; TBodyContentArea;
import com.unhurdle.spectrum.ThemeManager;ThemeManager;
import com.unhurdle.spectrum.beads.KeyboardNavigateableHandler; KeyboardNavigateableHandler;
import com.unhurdle.spectrum.beads.KeyboardNavigateableForTreeHandler; KeyboardNavigateableForTreeHandler;
}
}
|
// SWF hand-edited with JPEXS.
// This can also be done in the Flash editor, when switching the ActionScript version to ActionScript 1.0 in File -> Publish Properties.
function /:f1()
{
trace("// Inside function");
trace("");
trace("// ghi - defined outside function");
trace(ghi + /:ghi);
trace("");
var _root.v123 = "123";
trace("// var _root.v123 = \'123\'");
trace(_root.v123 + /:v123);
trace("");
var _loc2_ = {};
with(_loc2_)
{
trace("// Inside function -> with({})");
trace("");
var /:v456 = "456";
trace("// var /:v456 = \'456\'");
trace(/:v456 + _root.v456);
trace("");
};
tellTarget("_root")
{
trace("// Inside function -> tellTarget(_root)");
var /:v789 = "789";
trace("// var /:v789 = \'789\'");
trace(/:v789 + _root.v789);
trace("");
}
var _root.mno;
}
function f2()
{
var /:pqr = "PQR";
var g = g;
g();
}
function g()
{
trace("// var /:pqr = \'PQR\';\n// this[\'/:pqr\']");
trace(this["/:pqr"]);
trace("");
}
var /:abc = "ABC";
trace("// var /:abc = \'ABC\'");
trace(/:abc + _root.abc);
trace("");
var /ruffle/:def = "DEF";
trace("// var /ruffle/:def = \'DEF\'");
trace(/ruffle/:def + _root.ruffle.def);
trace("");
_root.ruffle = {};
trace("_root.ruffle = {};");
trace("");
var /ruffle/:def = "DEF";
trace("// var /ruffle/:def = \'DEF\'");
trace(/ruffle/:def + _root.ruffle.def);
trace("");
var abc = "XYZ";
trace("// var abc = \'XYZ\';\n// /:abc + abc");
trace(/:abc + abc);
trace("");
var /:ghi;
trace("// var /:ghi;\n// _root.hasOwnProperty(\'ghi\')");
trace(_root.hasOwnProperty("ghi"));
trace("");
var _root.ghi = "GHI";
var /:ghi;
trace("// var _root.ghi = \'GHI\';\n// var /:ghi");
trace(/:ghi + _root.ghi);
trace("");
var _root.o = {};
with(_root.o)
{
trace("// Inside with({})");
trace("");
var /:jkl = "JKL";
trace("// var /:jkl = \'JKL\'");
trace(/:jkl + _root.jkl);
trace("");
};
f1();
trace("// Outside function - tracing all variables defined inside function");
trace(/:v123 + _root.v456 + _root.v789);
trace("");
trace("// _root.hasOwnProperty(\'mno\') - defined inside function");
trace(_root.hasOwnProperty("mno"));
trace("");
f2();
|
////////////////////////////////////////////////////////////////////////////////
//
// 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.messaging.messages
{
[RemoteClass(alias="flex.messaging.messages.SOAPMessage")]
/**
* SOAPMessages are similar to HTTPRequestMessages. However,
* they always contain a SOAP XML envelope request body
* that will always be sent using HTTP POST.
* They also allow a SOAP action to be specified.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion BlazeDS 4
* @productversion LCDS 3
*/
public class SOAPMessage extends HTTPRequestMessage
{
//--------------------------------------------------------------------------
//
// Static Constants
//
//--------------------------------------------------------------------------
/**
* The HTTP header that stores the SOAP action for the SOAPMessage.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion BlazeDS 4
* @productversion LCDS 3
*/
public static const SOAP_ACTION_HEADER:String = "SOAPAction";
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructs an uninitialized SOAPMessage.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion BlazeDS 4
* @productversion LCDS 3
*/
public function SOAPMessage()
{
super();
method = "POST";
contentType = CONTENT_TYPE_SOAP_XML;
}
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* Provides access to the name of the remote method/operation that
* will be called.
*
* @return Returns the name of the remote method/operation that
* will be called.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion BlazeDS 4
* @productversion LCDS 3
*/
public function getSOAPAction():String
{
return (httpHeaders != null) ? httpHeaders[SOAP_ACTION_HEADER] : null;
}
/**
* @private
*/
public function setSOAPAction(value:String):void
{
if (value != null)
{
if (value.indexOf('"') < 0)
{
var str:String = '"';
str += value;
str += '"';
value = str.toString();
}
if (httpHeaders == null)
httpHeaders = {};
httpHeaders[SOAP_ACTION_HEADER] = value;
}
}
}
}
|
// =================================================================================================
//
// Starling Framework - Particle System Extension
// Copyright 2011 Gamua OG. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================
package starling.extensions
{
public class ColorArgb
{
public var red:Number;
public var green:Number;
public var blue:Number;
public var alpha:Number;
public static function fromRgb(color:uint):ColorArgb
{
var rgb:ColorArgb = new ColorArgb();
rgb.fromRgb(color);
return rgb;
}
public static function fromArgb(color:uint):ColorArgb
{
var argb:ColorArgb = new ColorArgb();
argb.fromArgb(color);
return argb;
}
public function ColorArgb(red:Number = 0, green:Number = 0, blue:Number = 0, alpha:Number = 0)
{
this.red = red;
this.green = green;
this.blue = blue;
this.alpha = alpha;
}
public function toRgb():uint
{
var r:Number = red;
if (r < 0.0)
r = 0.0;
else if (r > 1.0)
r = 1.0;
var g:Number = green;
if (g < 0.0)
g = 0.0;
else if (g > 1.0)
g = 1.0;
var b:Number = blue;
if (b < 0.0)
b = 0.0;
else if (b > 1.0)
b = 1.0;
return int(r * 255) << 16 | int(g * 255) << 8 | int(b * 255);
}
public function toArgb():uint
{
var a:Number = alpha;
if (a < 0.0)
a = 0.0;
else if (a > 1.0)
a = 1.0;
var r:Number = red;
if (r < 0.0)
r = 0.0;
else if (r > 1.0)
r = 1.0;
var g:Number = green;
if (g < 0.0)
g = 0.0;
else if (g > 1.0)
g = 1.0;
var b:Number = blue;
if (b < 0.0)
b = 0.0;
else if (b > 1.0)
b = 1.0;
return int(a * 255) << 24 | int(r * 255) << 16 | int(g * 255) << 8 | int(b * 255);
}
public function fromRgb(color:uint):void
{
red = (color >> 16 & 0xFF) / 255.0;
green = (color >> 8 & 0xFF) / 255.0;
blue = (color & 0xFF) / 255.0;
}
public function fromArgb(color:uint):void
{
red = (color >> 16 & 0xFF) / 255.0;
green = (color >> 8 & 0xFF) / 255.0;
blue = (color & 0xFF) / 255.0;
alpha = (color >> 24 & 0xFF) / 255.0;
}
public function copyFrom(argb:ColorArgb):void
{
red = argb.red;
green = argb.green;
blue = argb.blue;
alpha = argb.alpha;
}
/**
* JSON 序列化时调用该方法
* @param k
* @return
*
*/
public function toJSON(k:*):String
{
return toArgb().toString();
}
}
}
|
package feedback
{
import flash.events.Event;
public class FeedbackEvent extends Event
{
public static const FEEDBACK_REPLY_ADD:String = "feedbackReplyAdd";
public static const FEEDBACK_REPLY_REMOVE:String = "feedbackReplyRemove";
public static const FEEDBACK_StopReply:String = "feedbackStopReply";
public var data:Object;
public function FeedbackEvent(param1:String, param2:Object)
{
this.data = param2;
super(param1);
}
}
}
|
package nid.ui.controls.vkb
{
/**
* ...
* @author Nidin P Vinayakan
*/
public class KeyBoardTypes
{
static public const NUMBER_PAD:String = "number_pad";
static public const NUMERIC:String = "numeric";
static public const NUMERIC_ALT:String = "numeric_alt";
static public const ALPHABETS_LOWER:String = "alphabets_lower";
static public const ALPHABETS_UPPER:String = "alphabets_upper";
}
} |
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.geom.Matrix;
import flash.geom.Point;
import org.purepdf.elements.images.ImageElement;
import org.purepdf.pdf.PageSize;
import org.purepdf.pdf.PdfBlendMode;
import org.purepdf.pdf.PdfContentByte;
import org.purepdf.pdf.PdfGState;
import org.purepdf.pdf.PdfViewPreferences;
public class ImageBitmapData extends DefaultBasicExample
{
[Embed(source="assets/image1.jpg")] private var cls: Class;
public function ImageBitmapData(d_list:Array=null)
{
super(["Load and put a bitmapdata into a pdf document","and apply some transformations to it"]);
}
override protected function execute(event:Event=null):void
{
super.execute();
var bmp: Bitmap = Bitmap( new cls() );
var bitmap: BitmapData = bmp.bitmapData;
// Create a transformation matrix for the image
var pos: Point = new Point( PageSize.A4.width/2 + bitmap.width/2, PageSize.A4.height/2 + bitmap.height/2 );
createDocument("BitmapData example", PageSize.A4 );
document.setViewerPreferences( PdfViewPreferences.CenterWindow );
document.open();
// Create the image element
var image: ImageElement;
image = ImageElement.getBitmapDataInstance( bitmap );
image.scalePercent( 100, -100 );
image.setAbsolutePosition( 0, bitmap.height );
// Write the image to the document
var cb: PdfContentByte = document.getDirectContent();
cb.setTransform( new Matrix( 1, 0, 0, -1, 0, document.pageSize.height ) );
var gstate: PdfGState;
var m: Matrix;
var rad: Number;
for( var k: int = 0; k < 10; ++ k )
{
cb.saveState();
rad = radians( k*36 );
m = new Matrix( 1, 0, 0, 1, 0, 0 );
m.translate( - bitmap.width / 2, - bitmap.height / 2 );
m.rotate( rad );
m.translate( PageSize.A4.width/2 + (Math.cos(rad)*200), PageSize.A4.height/2 + (Math.sin(rad)*200) );
gstate = new PdfGState();
gstate.setBlendMode( PdfBlendMode.COLORDODGE );
gstate.setFillOpacity( 0.3 );
cb.setGState( gstate );
cb.concatMatrix( m );
cb.addImage( image );
cb.restoreState();
}
document.close();
save();
}
static public function radians( degree: Number ): Number
{
return degree * ( Math.PI / 180 );
}
}
} |
/*
Copyright 2012-2013 Renaun Erickson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@author Renaun Erickson / renaun.com / @renaun
*/
package tests
{
import flash.system.Capabilities;
import flash.text.TextField;
public class TestRunner
{
public function TestRunner()
{
}
private var currentTest:ITestable;
public var textField:TextField;
public var testGroup:Vector.<ITestable>;
public var separator:String = (Capabilities.playerType == "js") ? "<br/>" : "\n";
public function runTests(testGroup:Vector.<ITestable>):void
{
this.testGroup = testGroup;
currentTest = this.testGroup.pop();
currentTest.output = out;
out("Running Tests .... " + currentTest.name);
currentTest.stepHandler = processTest;
currentTest.buildup();
}
private function out(msg:String):void
{
textField.appendText(separator + msg);
}
private function processTest(stepValue:String):void
{
if (stepValue == "buildup")
{
currentTest.run();
}
else if (stepValue == "run")
{
textField.appendText(separator + currentTest.name + ": " + currentTest.hasPassed());
if (!currentTest.hasPassed())
currentTest.teardown();
}
else if (stepValue == "teardown")
{
currentTest = testGroup.pop();
currentTest.stepHandler = processTest;
currentTest.buildup();
}
}
}
} |
package flash.__native
{
import flash.display.BitmapData;
import flash.display.Graphics;
import flash.display.GraphicsPath;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.text.TextFormat;
/**
* ...
* @author lizhi
*/
public class IRenderer
{
public function IRenderer()
{
}
public function createPath():GraphicsPath{
return null;
}
public function getCssColor(color:uint,alpha:Number,ct:ColorTransform,toarr:Array):Object{
return null;
}
public function renderGraphics(ctx:CanvasRenderingContext2D,g:Graphics,m:Matrix,blendMode:String,colorTransform:ColorTransform):void{
}
public function renderImage(ctx:CanvasRenderingContext2D,img:BitmapData,m:Matrix,blendMode:String,colorTransform:ColorTransform):void{
}
public function renderText(ctx:CanvasRenderingContext2D,txt:String,textFormat:TextFormat, m:Matrix, blendMode:String, colorTransform:ColorTransform,x:Number,y:Number):void{
}
public function finish(ctx:CanvasRenderingContext2D):void{
}
public function start(ctx:CanvasRenderingContext2D):void{
}
}
} |
package com.unhurdle.spectrum
{
import org.apache.royale.core.IBead;
import org.apache.royale.core.IPopUpHost;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.IUIBase;
import org.apache.royale.events.IEventDispatcher;
import org.apache.royale.events.MouseEvent;
import org.apache.royale.geom.Point;
import org.apache.royale.utils.PointUtils;
import org.apache.royale.utils.UIUtils;
import com.unhurdle.spectrum.Tooltip;
public class TooltipBead implements IBead
{
public function TooltipBead()
{
}
public static const LEFT:String = "left";
public static const RIGHT:String = "right";
public static const BOTTOM:String = "bottom";
public static const TOP:String = "top";
private var _toolTip:String;
protected var tt:Tooltip;
protected var host:IPopUpHost;
private var _direction:String = TOP;
public function get toolTip():String
{
return _toolTip;
}
public function set toolTip(value:String):void
{
_toolTip = value;
}
public function set direction(value:String):void
{
_direction = value;
if (tt)
{
tt.direction = value;
}
}
public function get direction():String
{
return _direction;
}
protected var _strand:IStrand;
public function set strand(value:IStrand):void
{
_strand = value;
IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OVER, rollOverHandler, false);
}
protected function rollOverHandler(event:MouseEvent):void
{
if (!toolTip || tt)
return;
IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OUT, rollOutHandler, false);
var comp:IUIBase = _strand as IUIBase
host = UIUtils.findPopUpHost(comp);
if (tt)
host.popUpParent.removeElement(tt);
tt = new Tooltip();
tt.direction = _direction;
tt.style = {"position": "absolute"};
tt.text = toolTip;
host.popUpParent.addElement(tt, false); // don't trigger a layout
var pt:Point = determinePosition(_strand as IUIBase, tt);
tt.x = pt.x;
tt.y = pt.y;
tt.isOpen = true;
}
protected function determinePosition(comp:IUIBase, tooltip:Tooltip):Point
{
var pt:Point = new Point();
if (_direction == LEFT) {
pt.x = -tooltip.width;
pt.y = (comp.height - tooltip.height) / 2;
} else if (_direction == TOP) {
pt.x = (comp.width - tooltip.width) / 2;
pt.y = -tooltip.height;
} else if (_direction == RIGHT) {
pt.x = comp.width;
pt.y = (comp.height - tooltip.height) / 2;
} else
{
pt.x = (comp.width - tooltip.width) / 2;
pt.y = tooltip.height;
}
pt = PointUtils.localToGlobal(pt, comp);
return pt;
}
protected function rollOutHandler(event:MouseEvent):void
{
IEventDispatcher(_strand).removeEventListener(MouseEvent.MOUSE_OUT, rollOutHandler, false);
var comp:IUIBase = _strand as IUIBase;
if (tt) {
host.popUpParent.removeElement(tt);
tt = null;
}
}
}
}
|
package game.forest
{
import game.Item;
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.graphics.Image;
public class ForestPalm extends Item
{
/**
* Graphics
*/
[Embed(source = '../../../assets/forest/forest_palm01.png')] private const SPRITE01:Class;
[Embed(source = '../../../assets/forest/forest_palm02.png')] private const SPRITE02:Class;
public var mySpriteCollection:Array = new Array(SPRITE01, SPRITE02);
public function ForestPalm()
{
// Random image
rawSprite = chooseSprite(mySpriteCollection);
super(rawSprite, 'mid', true);
type = 'tall_palm';
}
override public function update():void
{
super.update();
}
}
} |
// Decompiled by AS3 Sorcerer 6.08
// www.as3sorcerer.com
//com.company.assembleegameclient.ui.panels.PortalPanel
package com.company.assembleegameclient.ui.panels
{
import org.osflash.signals.Signal;
import kabam.rotmg.ui.view.SignalWaiter;
import com.company.assembleegameclient.objects.Portal;
import kabam.rotmg.text.view.TextFieldDisplayConcrete;
import com.company.assembleegameclient.ui.DeprecatedTextButton;
import flash.text.TextFormatAlign;
import flash.filters.DropShadowFilter;
import kabam.rotmg.text.model.TextKey;
import flash.text.TextFieldAutoSize;
import kabam.rotmg.text.view.stringBuilder.LineBuilder;
import flash.events.Event;
import com.company.assembleegameclient.game.GameSprite;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import com.company.assembleegameclient.parameters.Parameters;
import com.company.assembleegameclient.objects.ObjectLibrary;
import com.company.assembleegameclient.tutorial.doneAction;
import com.company.assembleegameclient.tutorial.Tutorial;
import com.company.assembleegameclient.objects.PortalNameParser;
import kabam.rotmg.text.view.stringBuilder.StringBuilder;
public class PortalPanel extends Panel
{
public const exitGameSignal:Signal = new Signal();
private const LOCKED:String = "Locked ";
private const TEXT_PATTERN:RegExp = /\{"text":"(.+)"}/;
private const waiter:SignalWaiter = new SignalWaiter();
public var owner_:Portal;
private var nameText_:TextFieldDisplayConcrete;
private var _enterButton_:DeprecatedTextButton;
private var fullText_:TextFieldDisplayConcrete;
public function PortalPanel(_arg_1:GameSprite, _arg_2:Portal)
{
super(_arg_1);
this.owner_ = _arg_2;
this.nameText_ = new TextFieldDisplayConcrete().setSize(18).setColor(0xFFFFFF).setBold(true).setTextWidth(WIDTH).setWordWrap(true).setHorizontalAlign(TextFormatAlign.CENTER);
this.nameText_.filters = [new DropShadowFilter(0, 0, 0)];
addChild(this.nameText_);
this.waiter.push(this.nameText_.textChanged);
this._enterButton_ = new DeprecatedTextButton(16, TextKey.PANEL_ENTER);
addChild(this._enterButton_);
this.waiter.push(this._enterButton_.textChanged);
this.fullText_ = new TextFieldDisplayConcrete().setSize(18).setColor(0xFF0000).setHTML(true).setBold(true).setAutoSize(TextFieldAutoSize.CENTER);
var _local_3:String = ((this.owner_.lockedPortal_) ? TextKey.PORTAL_PANEL_LOCKED : TextKey.PORTAL_PANEL_FULL);
this.fullText_.setStringBuilder(new LineBuilder().setParams(_local_3).setPrefix('<p align="center">').setPostfix("</p>"));
this.fullText_.filters = [new DropShadowFilter(0, 0, 0)];
this.fullText_.textChanged.addOnce(this.alignUI);
addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage);
this.waiter.complete.addOnce(this.alignUI);
}
private function alignUI():void
{
this.nameText_.y = 6;
this._enterButton_.x = ((WIDTH / 2) - (this._enterButton_.width / 2));
this._enterButton_.y = ((HEIGHT - this._enterButton_.height) - 4);
this.fullText_.y = (HEIGHT - 30);
this.fullText_.x = (WIDTH / 2);
}
private function onAddedToStage(_arg_1:Event):void
{
stage.addEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown);
}
private function onRemovedFromStage(_arg_1:Event):void
{
this._enterButton_.removeEventListener(MouseEvent.CLICK, this.onEnterSpriteClick);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown);
}
public function onEnterSpriteClick(_arg_1:MouseEvent):void
{
this.enterPortal();
}
private function onKeyDown(_arg_1:KeyboardEvent):void
{
if (((_arg_1.keyCode == Parameters.data_.interact) && (stage.focus == null)))
{
this.enterPortal();
}
}
private function enterPortal():void
{
doneAction(gs_, Tutorial.ENTER_PORTAL_ACTION);
gs_.gsc_.usePortal(this.owner_.objectId_);
this.exitGameSignal.dispatch();
}
override public function draw():void
{
this.updateNameText();
if ((((!(this.owner_.lockedPortal_)) && (this.owner_.active_)) && (contains(this.fullText_))))
{
removeChild(this.fullText_);
addChild(this._enterButton_);
}
else
{
if ((((this.owner_.lockedPortal_) || (!(this.owner_.active_))) && (contains(this._enterButton_))))
{
removeChild(this._enterButton_);
addChild(this.fullText_);
}
}
}
private function updateNameText():void
{
var _local_1:String = this.getName();
var _local_2:StringBuilder = new PortalNameParser().makeBuilder(_local_1);
this.nameText_.setStringBuilder(_local_2);
this.nameText_.x = ((WIDTH - this.nameText_.width) * 0.5);
this.nameText_.y = ((this.nameText_.height > 30) ? 0 : 6);
}
private function getName():String
{
var _local_1:String = this.owner_.getName();
if (((this.owner_.lockedPortal_) && (_local_1.indexOf(this.LOCKED) == 0)))
{
return (_local_1.substr(this.LOCKED.length));
}
return (this.parseJson(_local_1));
}
private function parseJson(_arg_1:String):String
{
var _local_2:Array = _arg_1.match(this.TEXT_PATTERN);
return ((_local_2) ? _local_2[1] : _arg_1);
}
public function get enterButton_():DeprecatedTextButton
{
return (this._enterButton_);
}
}
}//package com.company.assembleegameclient.ui.panels
|
/*
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
package Box2D.Common.Math
{
/**
* A transform contains translation and rotation. It is used to represent
* the position and orientation of rigid frames.
*/
public class b2Transform
{
public var position:b2Vec2 = new b2Vec2;
public var R:b2Mat22 = new b2Mat22();
/**
* The default constructor does nothing (for performance).
*/
public function b2Transform(pos:b2Vec2 = null, r:b2Mat22 = null):void
{
if (pos)
{
position.SetV(pos);
R.SetM(r);
}
}
/**
* Initialize using a position vector and a rotation matrix.
*/
public function Initialize(pos:b2Vec2, r:b2Mat22):void
{
position.SetV(pos);
R.SetM(r);
}
/**
* Set this to the identity transform.
*/
public function SetIdentity():void
{
position.SetZero();
R.SetIdentity();
}
public function Set(x:b2Transform):void
{
position.SetV(x.position);
R.SetM(x.R);
}
/**
* Calculate the angle that the rotation matrix represents.
*/
public function GetAngle():Number
{
return Math.atan2(R.col1.y, R.col1.x);
}
};
} |
class mx.video.FPADManager
{
var _owner, _uriParam, _parseResults, _url, xml, xmlOnLoad, rtmpURL;
function FPADManager(owner)
{
_owner = owner;
} // End of the function
function connectXML(urlPrefix, uriParam, urlSuffix, uriParamParseResults)
{
_uriParam = uriParam;
_parseResults = uriParamParseResults;
_url = urlPrefix + "uri=" + _parseResults.protocol;
if (_parseResults.serverName != undefined)
{
_url = _url + ("/" + _parseResults.serverName);
} // end if
if (_parseResults.portNumber != undefined)
{
_url = _url + (":" + _parseResults.portNumber);
} // end if
if (_parseResults.wrappedURL != undefined)
{
_url = _url + ("/?" + _parseResults.wrappedURL);
} // end if
_url = _url + ("/" + _parseResults.appName);
_url = _url + urlSuffix;
xml = new XML();
xml.onLoad = mx.utils.Delegate.create(this, xmlOnLoad);
xml.load(_url);
return (false);
} // End of the function
null[] = (Error)() == null ? (null, throw , function (success)
{
try
{
if (!success)
{
_owner.helperDone(this, false);
}
else
{
var _loc5 = xml.firstChild;
var _loc8 = false;
while (_loc5 != null)
{
if (_loc5.nodeType == mx.video.FPADManager.ELEMENT_NODE)
{
_loc8 = true;
if (_loc5.nodeName.toLowerCase() == "fpad")
{
break;
} // end if
} // end if
_loc5 = _loc5.nextSibling;
} // end while
if (!_loc8)
{
throw new mx.video.VideoError(mx.video.VideoError.INVALID_XML, "URL: \"" + _url + "\" No root node found; if url is for an flv it must have .flv extension and take no parameters");
}
else if (_loc5 == null)
{
throw new mx.video.VideoError(mx.video.VideoError.INVALID_XML, "URL: \"" + _url + "\" Root node not fpad");
} // end else if
var _loc7;
for (var _loc6 = 0; _loc6 < _loc5.childNodes.length; ++_loc6)
{
var _loc3 = _loc5.childNodes[_loc6];
if (_loc3.nodeType != mx.video.FPADManager.ELEMENT_NODE)
{
continue;
} // end if
if (_loc3.nodeName.toLowerCase() == "proxy")
{
for (var _loc2 = 0; _loc2 < _loc3.childNodes.length; ++_loc2)
{
var _loc4 = _loc3.childNodes[_loc2];
if (_loc4.nodeType == mx.video.FPADManager.TEXT_NODE)
{
_loc7 = this.trim(_loc4.nodeValue);
break;
} // end if
} // end of for
break;
} // end if
} // end of for
if (_loc7 == undefined || _loc7 == "")
{
throw new mx.video.VideoError(mx.video.VideoError.INVALID_XML, "URL: \"" + _url + "\" fpad xml requires proxy tag.");
} // end if
rtmpURL = _parseResults.protocol + "/" + _loc7 + "/?" + _uriParam;
_owner.helperDone(this, true);
} // end else if
} // End of try
catch ()
{
} // End of catch
}) : (var err = (Error)(), _owner.helperDone(this, false), throw err, "xmlOnLoad");
function trim(str)
{
for (var _loc2 = 0; _loc2 < str.length; ++_loc2)
{
var _loc1 = str.charAt(_loc2);
if (_loc1 != " " && _loc1 != "\t" && _loc1 != "\r" && _loc1 != "\n")
{
break;
} // end if
} // end of for
if (_loc2 >= str.length)
{
return ("");
} // end if
for (var _loc4 = str.length - 1; _loc4 > _loc2; --_loc4)
{
_loc1 = str.charAt(_loc4);
if (_loc1 != " " && _loc1 != "\t" && _loc1 != "\r" && _loc1 != "\n")
{
break;
} // end if
} // end of for
return (str.slice(_loc2, _loc4 + 1));
} // End of the function
static var version = "1.0.1.10";
static var shortVersion = "1.0.1";
static var ELEMENT_NODE = 1;
static var TEXT_NODE = 3;
} // End of Class
|
/**
* Copyright 2008 Marvin Herman Froeder
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*
*/
package com.adobe.example
{
public class Calculator
{
public function multiply(
numberOne : Number,
numberTwo : Number ) : Number
{
trace("multiply: "+numberOne+" * "+numberTwo);
return numberOne * numberTwo;
}
}
} |
/**
MIT License
Copyright (c) 2020 Xamarin
Copyright (c) 2020 Eli Aloni (https://github.com/elix22)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "Scripts/Weapon.as"
class Missile : Weapon
{
Missile()
{
ReloadDuration = 3000;
Damage = 8;
}
void OnFire(bool player) override
{
for (int i = 0; i < 6; i++)
{
LaunchSingleMissile( i*0.2f,i % 2 == 0, player: player);
// await Node.RunActionsAsync(new DelayTime(0.2f));
}
}
void LaunchSingleMissile(float delayLaunchTime,bool left, bool player)
{
Node @ carrier = node;
Vector3 carrierPos = carrier.position;
Node @ bulletNode = CreateRigidBullet(player);
bulletNode.position = Vector3(carrierPos.x + 0.7f * (left ? -1 : 1), carrierPos.y + 0.3f, carrierPos.z);
Node @ bulletModelNode = bulletNode.CreateChild();
bulletModelNode.scale = Vector3(1.0f, 2.0f, 1.0f) / 2.5f;
bulletNode.SetScale(0.3f);
// Trace-effect using particles
ParticleEmitter2D@ particleEmitter = bulletNode.CreateComponent("ParticleEmitter2D");
ParticleEffect2D@ particleEffect = cache.GetResource("ParticleEffect2D","Particles/MissileTrace.pex");
particleEmitter.effect = particleEffect;
particleEmitter = bulletNode.CreateComponent("ParticleEmitter2D");
particleEffect = cache.GetResource("ParticleEffect2D","Particles/Explosion.pex");
particleEmitter.effect = particleEffect;
// Route (Bezier)
float directionY = player ? 1 : -1;
float directionX = left ? -1 : 1;
BezierConfig bezierConfig;
bezierConfig.ControlPoint1 = Vector3(-directionX, 2.0f * directionY, 0);
bezierConfig.ControlPoint2 = Vector3(Random(-2, 2) * directionX, 4 * directionY, 0);
bezierConfig.EndPosition = Vector3(Random(-1, 1) * directionX, 12 * directionY, 0);
ActionGroup group;
group.Push(Sequence(DelayTime(delayLaunchTime),BezierBy(1.0f,bezierConfig)),bulletNode);
//group.Push(BezierBy(1.0f,bezierConfig),bulletNode);
group.Push(DelayTime(2.0f),bulletNode);
actionManager.AddActions(group,CALLBACK(this.bulletNodeRemove));
}
void bulletNodeRemove(ActionID @ actionID)
{
actionID.DeleteTargets();
// log.Warning("missle remove");
}
void OnHit(GameObject @ target, bool killed, Node @ bulletNode) override
{
Weapon::OnHit(target, killed, bulletNode);
Node @ explosionNode = scene.CreateChild();
SoundSource @ soundSource = explosionNode.CreateComponent("SoundSource");
Sound@ sound = cache.GetResource("Sound", "Sounds/SmallExplosion.wav");
if (sound !is null)
{
soundSource.Play(sound);
soundSource.gain = 0.2f;
}
explosionNode.position = target.node.worldPosition;
explosionNode.SetScale(1.0f);
ParticleEmitter2D @ particleEmitter = explosionNode.CreateComponent("ParticleEmitter2D");
ParticleEffect2D@ particleEffect = cache.GetResource("ParticleEffect2D", "Particles/MissileTrace.pex");
particleEmitter.effect = particleEffect;
actionManager.AddAction(Sequence(ScaleTo(0.5f, 0.0f), DelayTime(0.5f)),explosionNode,CALLBACK(this.explosionNodeRemove));
}
void explosionNodeRemove(ActionID @ actionID)
{
actionID.DeleteTargets();
}
} |
package com.greensock.core
{
import flash.display.Shape;
import flash.events.Event;
import flash.utils.getTimer;
public class Animation extends Object
{
public function Animation(param1:Number = 0, param2:Object = null)
{
super();
this.vars = param2 || {};
if(this.vars._isGSVars)
{
this.vars = this.vars.vars;
}
_duration = _totalDuration = (param1) || (0);
_delay = (Number(this.vars.delay)) || (0);
_timeScale = 1;
_totalTime = _time = 0;
data = this.vars.data;
_rawPrevTime = -1;
if(_rootTimeline == null)
{
if(_rootFrame == -1)
{
_rootFrame = 0;
_rootFramesTimeline = new SimpleTimeline();
_rootTimeline = new SimpleTimeline();
_rootTimeline._startTime = getTimer() / 1000;
_rootFramesTimeline._startTime = 0;
_rootTimeline._active = _rootFramesTimeline._active = true;
ticker.addEventListener("enterFrame",_updateRoot,false,0,true);
}
else
{
return;
}
}
var _loc3_:SimpleTimeline = this.vars.useFrames?_rootFramesTimeline:_rootTimeline;
_loc3_.insert(this,_loc3_._time);
_reversed = this.vars.reversed == true;
if(this.vars.paused)
{
paused(true);
}
}
public static var _rootFramesTimeline:SimpleTimeline;
public static var _rootTimeline:SimpleTimeline;
public static var ticker:Shape = new Shape();
protected static var _rootFrame:Number = -1;
public static function _updateRoot(param1:Event = null) : void
{
_rootFrame++;
_rootTimeline.render((getTimer() / 1000 - _rootTimeline._startTime) * _rootTimeline._timeScale,false,false);
_rootFramesTimeline.render((_rootFrame - _rootFramesTimeline._startTime) * _rootFramesTimeline._timeScale,false,false);
ticker.dispatchEvent(_tickEvent);
}
protected static var _tickEvent:Event = new Event("tick");
public static const version:Number = 12;
public function delay(param1:Number = NaN) : *
{
if(!arguments.length)
{
return _delay;
}
if(_timeline.smoothChildTiming)
{
startTime(_startTime + param1 - _delay);
}
_delay = param1;
return this;
}
public var _delay:Number;
public function totalDuration(param1:Number = NaN) : *
{
_dirty = false;
return !arguments.length?_totalDuration:duration(param1);
}
public function _enabled(param1:Boolean, param2:Boolean = false) : Boolean
{
_gc = !param1;
_active = Boolean(param1 && !_paused && _totalTime > 0 && _totalTime < _totalDuration);
if(!param2)
{
if((param1) && timeline == null)
{
_timeline.insert(this,_startTime - _delay);
}
else if(!param1 && !(timeline == null))
{
_timeline._remove(this,true);
}
}
return false;
}
public function timeScale(param1:Number = NaN) : *
{
var _loc3_:* = NaN;
if(!arguments.length)
{
return _timeScale;
}
var param1:Number = (param1) || (1.0E-6);
if((_timeline) && (_timeline.smoothChildTiming))
{
_loc3_ = (_pauseTime) || _pauseTime == 0?_pauseTime:_timeline._totalTime;
_startTime = _loc3_ - (_loc3_ - _startTime) * _timeScale / param1;
}
_timeScale = param1;
return _uncache(false);
}
public var _prev:Animation;
public function duration(param1:Number = NaN) : *
{
if(!arguments.length)
{
_dirty = false;
return _duration;
}
_duration = _totalDuration = param1;
_uncache(true);
if(_timeline.smoothChildTiming)
{
if(_active)
{
if(param1 != 0)
{
totalTime(_totalTime * param1 / _duration,true);
}
}
}
return this;
}
public function restart(param1:Boolean = false, param2:Boolean = true) : *
{
reversed(false);
paused(false);
return totalTime(param1?-_delay:0,param2);
}
public function render(param1:Number, param2:Boolean = false, param3:Boolean = false) : void
{
}
public var _reversed:Boolean;
public var _active:Boolean;
public var _timeline:SimpleTimeline;
public var _rawPrevTime:Number;
public var data;
public var vars:Object;
public function resume(param1:* = null, param2:Boolean = true) : *
{
if(arguments.length)
{
seek(param1,param2);
}
return paused(false);
}
public function paused(param1:Boolean = false) : *
{
if(!arguments.length)
{
return _paused;
}
if(param1 != _paused)
{
if(_timeline)
{
if(!param1)
{
if(_timeline.smoothChildTiming)
{
_startTime = _startTime + (_timeline.rawTime() - _pauseTime);
_uncache(false);
}
}
_pauseTime = param1?_timeline.rawTime():NaN;
_paused = param1;
_active = !_paused && _totalTime > 0 && _totalTime < _totalDuration;
}
}
if(_gc)
{
if(!param1)
{
_enabled(true,false);
}
}
return this;
}
public function totalTime(param1:Number = NaN, param2:Boolean = false) : *
{
var _loc4_:SimpleTimeline = null;
if(!arguments.length)
{
return _totalTime;
}
if(_timeline)
{
if(param1 < 0)
{
param1 = param1 + totalDuration();
}
if(_timeline.smoothChildTiming)
{
if(_dirty)
{
totalDuration();
}
if(param1 > _totalDuration)
{
param1 = _totalDuration;
}
_startTime = (_paused?_pauseTime:_timeline._time) - (!_reversed?param1:_totalDuration - param1) / _timeScale;
if(!_timeline._dirty)
{
_uncache(false);
}
if(!_timeline._active)
{
_loc4_ = _timeline;
while(_loc4_._timeline)
{
_loc4_.totalTime(_loc4_._totalTime,true);
_loc4_ = _loc4_._timeline;
}
}
}
if(_gc)
{
_enabled(true,false);
}
if(_totalTime != param1)
{
render(param1,param2,false);
}
}
return this;
}
public var _totalTime:Number;
public var _time:Number;
public function play(param1:* = null, param2:Boolean = true) : *
{
if(arguments.length)
{
seek(param1,param2);
}
reversed(false);
return paused(false);
}
public function invalidate() : *
{
return this;
}
public function _kill(param1:Object = null, param2:Object = null) : Boolean
{
return _enabled(false,false);
}
public var timeline:SimpleTimeline;
public var _initted:Boolean;
public function reversed(param1:Boolean = false) : *
{
if(!arguments.length)
{
return _reversed;
}
if(param1 != _reversed)
{
_reversed = param1;
totalTime(_totalTime,true);
}
return this;
}
public var _paused:Boolean;
public function startTime(param1:Number = NaN) : *
{
if(!arguments.length)
{
return _startTime;
}
if(param1 != _startTime)
{
_startTime = param1;
if(timeline)
{
if(timeline._sortChildren)
{
timeline.insert(this,param1 - _delay);
}
}
}
return this;
}
public var _startTime:Number;
protected function _uncache(param1:Boolean) : *
{
var _loc2_:Animation = param1?this:timeline;
while(_loc2_)
{
_loc2_._dirty = true;
_loc2_ = _loc2_.timeline;
}
return this;
}
public var _dirty:Boolean;
public var _next:Animation;
public function time(param1:Number = NaN, param2:Boolean = false) : *
{
if(!arguments.length)
{
return _time;
}
if(_dirty)
{
totalDuration();
}
if(param1 > _duration)
{
param1 = _duration;
}
return totalTime(param1,param2);
}
public function kill(param1:Object = null, param2:Object = null) : *
{
_kill(param1,param2);
return this;
}
public function reverse(param1:* = null, param2:Boolean = true) : *
{
if(arguments.length)
{
seek(param1 || totalDuration(),param2);
}
reversed(true);
return paused(false);
}
protected var _onUpdate:Function;
public var _pauseTime:Number;
public var _duration:Number;
public function seek(param1:*, param2:Boolean = true) : *
{
return totalTime(Number(param1),param2);
}
public var _totalDuration:Number;
public var _gc:Boolean;
public function pause(param1:* = null, param2:Boolean = true) : *
{
if(arguments.length)
{
seek(param1,param2);
}
return paused(true);
}
public var _timeScale:Number;
public function eventCallback(param1:String, param2:Function = null, param3:Array = null) : *
{
var _loc5_:* = 0;
if(param1 == null)
{
return null;
}
if(param1.substr(0,2) == "on")
{
if(arguments.length == 1)
{
return vars[param1];
}
if(param2 == null)
{
delete vars[param1];
true;
}
else
{
vars[param1] = param2;
vars[param1 + "Params"] = param3;
if(param3)
{
_loc5_ = param3.length;
while(--_loc5_ > -1)
{
if(param3[_loc5_] == "{self}")
{
param3 = vars[param1 + "Params"] = param3.concat();
param3[_loc5_] = this;
}
}
}
}
if(param1 == "onUpdate")
{
_onUpdate = param2;
}
}
return this;
}
}
}
|
package com.lorentz.SVG.data.filters
{
import com.lorentz.SVG.utils.ICloneable;
import flash.filters.BitmapFilter;
public interface ISVGFilter extends ICloneable
{
function getFlashFilter():BitmapFilter;
}
} |
package com.kappaLab.asound.generators
{
public class FMSynthesis extends OSC
{
private var _modulerPhase:Number;
private var _modulerPhasePerByte:Number
private var _modulerGain:Number;
private var _modulerFrequency:Number;
private var _baseFrequency:Number;
public function FMSynthesis(
baseFrequency:Number = 96,
modulerFrequency:Number = 60,
modulerGain:Number = 1000)
{
super(baseFrequency)
_baseFrequency = baseFrequency
this.modulerFrequency = modulerFrequency
this.modulerGain = modulerGain
_modulerPhase = 0
}
override public function process():void
{
var n:int = LATENCY
for (var i:int = 0; i < n; i++)
{
_modulerPhase = (_modulerPhase + _modulerPhasePerByte) % PI2;
_frequency = _baseFrequency + (Math.sin(_modulerPhase) * _modulerGain)
_phase = (_phase + (PI2 * _frequency / SAMPLE_RATE)) % PI2;
/*same process
modulerPhase = (modulerPhase + modulerPhasePerByte) % PI2;
_frequency = _baseFrequency + Math.sin(modulerPhase) * _modulerGain;;
phasePerByte = PI2 * _frequency / SAMPLE_RATE;
phase = (phase + phasePerByte) % PI2;
*/
_sample[i] = Math.sin(_phase);
}
}
public function resetPhase():void
{
_modulerPhase = 0
_phase = 0
}
override public function get frequency():Number { return _frequency; }
override public function set frequency(value:Number):void
{
_frequency = value;
}
public function get modulerGain():Number { return _modulerGain; }
public function set modulerGain(value:Number):void
{
_modulerGain = value;
}
public function get modulerFrequency():Number { return _modulerFrequency; }
public function set modulerFrequency(value:Number):void
{
_modulerFrequency = value;
_modulerPhasePerByte = PI2 * value / SAMPLE_RATE;
}
public function get baseFrequency():Number { return _baseFrequency; }
public function set baseFrequency(value:Number):void
{
_baseFrequency = value;
}
public function get modulerPhase():Number { return _modulerPhase; }
public function get modulerPhasePerByte():Number { return _modulerPhasePerByte; }
}
} |
// makeswf -v 7 -r 1 -o test-7.swf test.as
#include "values.as"
trace (_root._target);
createEmptyMovieClip ("foo", 0);
trace (foo._target);
foo.createEmptyMovieClip ("foo", 0);
trace (foo.foo._target);
for (var i = 0; i < values.length; i++) {
trace (names[i] + " = " + values[i]._target);
}
loadMovie ("FSCommand:quit", "");
|
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package mx.rpc.xml
{
import flash.utils.ByteArray;
import flash.utils.Dictionary;
import mx.utils.Base64Encoder;
import mx.utils.Base64Decoder;
import mx.utils.HexEncoder;
import mx.utils.HexDecoder;
import mx.utils.StringUtil;
[ExcludeClass]
/**
* FIXME: Derivations and restrictions need to be considered in addition
* to base schema types
*
* @private
*/
public class SchemaMarshaller //implements IXMLTypeMarshaller
{
public function SchemaMarshaller(constants:SchemaConstants, datatypes:SchemaDatatypes)
{
super();
this.constants = constants;
this.datatypes = datatypes;
registerMarshallers();
}
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
/**
* Determines whether this marshaller will throw errors for input that
* violates the specified format or restrictions for the associated type.
* Type errors are still thrown for unexpected input types.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get validating():Boolean
{
return _validating;
}
public function set validating(value:Boolean):void
{
_validating = value;
}
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* This function converts an ActionScript value to a String for XML
* simple content based on a built-in XML Schema type. If a type is not
* provided, the <code>anyType</code> is assumed.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function marshall(value:*, type:QName = null, restriction:XML = null):*
{
if (type == null)
type = datatypes.anyTypeQName;
var marshaller:Function = marshallers[type.localName];
var result:*;
if (marshaller != null)
result = marshaller(value, type, restriction);
else
throw new TypeError("Cannot marshall type '" + type + "' to simple content.");
return result;
}
/**
* This function converts XML simple content (formatted based on a built-in
* XML Schema type) to an ActionScript value. If a type is not provided,
* the <code>anyType</code> is assumed.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function unmarshall(value:*, type:QName = null, restriction:XML = null):*
{
// First, get the simple content as a String
var rawValue:String;
if (value is XML)
{
var xml:XML = value as XML;
if (xml.nodeKind() == "element")
{
var nilAttribute:String = xml.attribute(constants.nilQName).toString();
if (nilAttribute == "true")
rawValue = null;
else
rawValue = xml.text().toString();
}
else
{
rawValue = xml.toString();
}
}
else if (value is XMLList)
{
var list:XMLList = value as XMLList;
rawValue = list.text().toString();
}
else if (value != null)
{
rawValue = value.toString();
}
if (type == null)
type = datatypes.anyTypeQName;
var unmarshaller:Function = unmarshallers[type.localName];
if (unmarshaller != null)
var value:* = unmarshaller(rawValue, type, restriction);
else
throw new TypeError("Cannot unmarshall type '" + type + "' from XML.");
return value;
}
/**
* In the case of XML Schema ur-types such as <code>anyType</code> and
* <code>anySimpleType</code> we try to guess what the equivalent XML Schema
* simple datatype should be based on the ActionScript type. As a last
* resort, the <code>string</code> datatype is used.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function marshallAny(value:*, type:QName = null, restriction:XML = null):*
{
if (value === undefined)
return undefined;
else if (value == null)
return null;
var localName:String = guessSimpleType(value);
if (type != null)
type = new QName(type.uri, localName);
else
type = new QName(constants.xsdURI, localName);
var marshaller:Function = marshallers[type.localName];
if (marshaller != null)
{
return marshaller(value, type);
}
else
{
throw new TypeError("Cannot marshall type '" + type + "' to simple content.");
}
}
public function marshallBase64Binary(value:*, type:QName = null, restriction:XML = null):String
{
var ba:ByteArray = value as ByteArray;
var result:String;
if (ba != null)
{
var encoder:Base64Encoder = new Base64Encoder();
encoder.insertNewLines = false;
encoder.encodeBytes(ba);
result = encoder.drain();
}
else
{
return null;
}
return result;
}
/**
* The boolean schema type allows the string values 'true' or
* '1' for true values and 'false' or '0' for false values. This
* marshaller, by default, represents values using 'true' or false.
* If a String value of '1' or '0' is passed, however, it is preserved.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function marshallBoolean(value:*, type:QName = null, restriction:XML = null):String
{
var result:String;
if (value != null)
{
if (value is Boolean)
{
result = (value as Boolean) ? "true" : "false";
}
else if (value is Number)
{
result = (value == 1) ? "true" : "false";
}
else if (value is Object)
{
var s:String = Object(value).toString();
if (s == "true" || s == "false" || s == "1" || s == "0")
result = s;
else
throw new Error("String '" + value + "' is not a Boolean.");
}
}
return result;
}
public function marshallDatetime(value:*, type:QName = null, restriction:XML = null):String
{
var result:String;
var date:Date;
if (value is Number)
{
date = new Date();
date.time = value as Number;
value = date;
}
if (value is Date)
{
var n:Number;
date = value as Date;
result = "";
if (type == datatypes.dateTimeQName
|| type == datatypes.dateQName)
{
// Year
result = result.concat(date.getUTCFullYear(), "-");
// Month
n = date.getUTCMonth() + 1; // ActionScript UTC month starts from 0
if (n < 10)
result = result.concat("0");
result = result.concat(n, "-");
// Day
n = date.getUTCDate();
if (n < 10)
result = result.concat("0");
result = result.concat(n);
}
if (type == datatypes.dateTimeQName)
{
result = result.concat("T");
}
// Time
if (type == datatypes.dateTimeQName
|| type == datatypes.timeQName)
{
n = date.getUTCHours();
if (n < 10)
result = result.concat("0");
result = result.concat(n, ":");
n = date.getUTCMinutes();
if (n < 10)
result = result.concat("0");
result = result.concat(n, ":");
n = date.getUTCSeconds();
if (n < 10)
result = result.concat("0");
result = result.concat(n);
// Milliseconds are optional so we write them if > 0
n = date.getUTCMilliseconds();
if (n > 0)
{
result = result.concat(".");
if (n < 10)
result = result.concat("00");
else if (n < 100)
result = result.concat("0");
result = result.concat(n);
}
}
// Always send dates, times and dateTimes in UTC from the player.
result = result.concat("Z");
}
else if (value is String)
{
result = value as String;
}
return result;
}
/**
* FIXME: Handle precision and exponent restrictions.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function marshallDecimal(value:*, type:QName = null, restriction:XML = null):String
{
var result:String;
var number:Number;
if (value is Number)
{
number = value as Number;
}
else
{
var str:String = whitespaceCollapse(value);
number = Number(str);
}
// Check for Infinity, -Infinity and NaN as these are not valid
// values for the XML Schema decimal type.
result = specialNumber(number);
if (result != null)
{
if (validating)
{
throw new Error("Invalid decimal value '" + value + "'.");
}
else
{
// As a last resort, we just go with the original input
result = whitespaceCollapse(value);
}
}
else
{
// We have a normal number
result = number.toString();
}
return result;
}
/**
* FIXME: Handle precision and exponent restrictions.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function marshallDouble(value:*, type:QName = null, restriction:XML = null):String
{
var result:String;
var number:Number = Number(value);
// Check for Infinity, -Infinity and NaN
result = specialNumber(number);
if (result == null)
result = number.toString();
return result;
}
public function marshallDuration(value:*, type:QName = null, restriction:XML = null):String
{
return whitespaceCollapse(value);
}
/**
* FIXME: Handle precision and exponent restrictions.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function marshallFloat(value:*, type:QName = null, restriction:XML = null):String
{
var result:String;
// First, check that we have a suitable input for Number
var number:Number;
if (value is Number)
{
number = value as Number;
}
else
{
var str:String = whitespaceCollapse(value);
number = Number(str);
}
// Check for Infinity, -Infinity and NaN
result = specialNumber(number);
if (result == null)
{
if (validating)
{
if (number > 0)
{
if (number > FLOAT_MAX_VALUE)
throw new RangeError("The value '" + value + "' is too large for a single-precision floating point value.");
else if (number < FLOAT_MIN_VALUE)
throw new RangeError("The value '" + value + "' is too small for a single-precision floating point value.");
}
else
{
if (-number > FLOAT_MAX_VALUE)
throw new RangeError("The absolute value of '" + value + "' is too large for a single-precision floating point value.");
else if (-number < FLOAT_MIN_VALUE)
throw new RangeError("The absolute value of '" + value + "' is too small for a single-precision floating point value.");
}
}
result = number.toString();
}
return result;
}
public function marshallGregorian(value:*, type:QName = null, restriction:XML = null):String
{
var date:Date;
var n:Number;
if (value is Date)
date = value as Date;
else if (value is Number)
n = value as Number;
else
value = whitespaceCollapse(value);
var result:String = "";
var hyphen:int;
// Year
if (type == datatypes.gYearMonthQName
|| type == datatypes.gYearQName)
{
var year:String;
if (value is Date)
{
n = date.getUTCFullYear();
}
else if (value is String)
{
year = value as String;
// We may have CCYY, -CCYY, CCYY-MM or -CCYY-MM
hyphen = year.indexOf("-", 1);
if (hyphen > 0)
year = year.substring(0, hyphen);
n = parseInt(year);
}
// Check for NaN or 0000 as these are not valid years.
if (isNaN(n) || n == 0)
{
if (validating)
{
throw new Error("Invalid year supplied for type " + type.localName + " in value " + value);
}
else
{
// Abort trying to process this value
return whitespaceCollapse(value);
}
}
else
{
// Get a String representation of the year, though this value
// is potentially unbounded so we use Number.toFixed instead
// of int().
year = n.toFixed(0);
// Pad early years with leading 0s up to 000x but
// we keep in mind that negative years such as -894 are valid.
if (year.indexOf("-") == 0)
{
while (year.length < 5)
year = year.substring(0, 1) + "0" + year.substring(1);
}
else
{
while (year.length < 4)
year = "0" + year;
}
result = result.concat(year);
}
if (type != datatypes.gYearQName)
result = result.concat("-");
}
// Month
if (type == datatypes.gYearMonthQName
|| type == datatypes.gMonthDayQName
|| type == datatypes.gMonthQName)
{
if (type != datatypes.gYearMonthQName)
result = result.concat("--");
var month:String;
if (value is Date)
n = date.getUTCMonth() + 1; // ActionScript UTC month starts at 0
else
{
month = value.toString();
if (type == datatypes.gMonthDayQName)
{
// We must have --MM-DD
hyphen = month.indexOf("--", 0);
if (hyphen == 0)
month = month.substring(2, 4);
else if (validating)
throw new Error("Invalid month supplied for " + type.localName + " in value " + value + ". The format must be '--MM-DD'.");
else
{
// Abort trying to process this value
return whitespaceCollapse(value);
}
}
else if (type == datatypes.gYearMonthQName)
{
hyphen = month.indexOf("-", 1);
// We must have CCYY-MM or -CCYY-MM
if (hyphen > 0)
month = month.substring(hyphen + 1, hyphen + 3);
else if (validating)
throw new Error("Invalid month supplied for " + type.localName + " in value " + value + ". The format must be '--CCYY-MM'.");
else
{
// Abort trying to process this value
return whitespaceCollapse(value);
}
}
else
{
// We may have --MM-- (but we allow just MM too)
hyphen = month.indexOf("--", 0);
if (hyphen > 0)
month = month.substring(2, 4);
}
n = parseInt(month);
}
// Check for NaN or values not in the range of 1 to 12
// as these are not valid months
if (isNaN(n) || n <= 0 || n > 12)
{
if (validating)
throw new Error("Invalid month supplied for type " + type.localName + " in value " + value);
else
{
// Abort trying to process this value
return whitespaceCollapse(value);
}
}
else
{
n = int(n);
if (n < 10)
result = result.concat("0");
result = result.concat(n);
}
if (type == datatypes.gMonthDayQName)
{
result = result.concat("-");
}
}
// Day
if (type == datatypes.gMonthDayQName
|| type == datatypes.gDayQName)
{
if (type == datatypes.gDayQName)
result = result.concat("---");
if (value is Date)
n = date.getUTCDate();
else if (value is String)
{
var day:String = value as String;
if (type == datatypes.gMonthDayQName)
{
//We must have --MM-DD
hyphen = day.indexOf("--", 0);
if (hyphen == 0)
day = day.substring(5, 7);
else if (validating)
throw new Error("Invalid day supplied for gMonthDay in value " + value + ". The format must be '--MM-DD'.");
else
{
// Abort trying to process this value
return whitespaceCollapse(value);
}
}
else
{
//We might have ---DD (but we allow just DD too)
hyphen = day.indexOf("---", 0);
if (hyphen == 0)
day = day.substring(3, 5);
}
n = parseInt(day);
}
// Check for NaN or values not in the range of 1 to 31
// as these are not valid days
if (isNaN(n) || n <= 0 || n > 31)
{
if (validating)
throw new Error("Invalid day supplied for type " + type.localName + " in value " + value);
else
// Abort trying to process this value
return whitespaceCollapse(value);
}
else
{
n = int(n);
if (n < 10)
result = result.concat("0");
result = result.concat(n);
}
}
return result;
}
/**
* The schema type hexBinary represents arbitrary hex-encoded binary data.
* Each binary octet is encoded as a character tuple consisting of two
* hexadecimal digits (which is treated case insensitively although
* capital letters A-F are always used on encoding). These tuples are
* added to a String to serialize the binary data.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function marshallHexBinary(value:*, type:QName = null, restriction:XML = null):String
{
var ba:ByteArray = value as ByteArray;
var valueString:String;
if (ba != null)
{
var encoder:HexEncoder = new HexEncoder();
encoder.encode(ba);
valueString = encoder.drain();
}
else
{
throw new Error("Cannot marshall value as hex binary.");
}
return valueString;
}
/**
* The schema type integer is dervied from the decimal type via restrictions
* by fixing the value of fractionDigits to be 0 and disallowing the
* trailing decimal point. The schema types long, int, short, byte are
* derived from integer by restricting the maxInclusive and minInclusive
* properties. Other types such as nonPositiveInteger, negativeInteger,
* nonNegativeInteger, positiveInteger, unsignedLong, unsignedInt,
* unsignedShort and unsignedByte are also dervied from integer through
* similar restrictions.
*
* This method first calls parses the <code>value</code> as a Number. It
* then uses <code>Math.floor()</code> on the number to remove any fraction
* digits and then checks that the result is within the specified
* <code>min</code> and <code>max</code> for the type. Note that decimal
* values are not rounded. This method handles integers longer than 32-bit
* so ActionScript int or uint types are not used internally.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function marshallInteger(value:*, type:QName = null, restriction:XML = null):String
{
var result:String;
var number:Number;
if (value is Number)
number = value as Number
else
number = Number(whitespaceCollapse(value));
var min:Number = -Number.MAX_VALUE;
var max:Number = Number.MAX_VALUE;
if (type == datatypes.longQName)
{
min = LONG_MIN_VALUE
max = LONG_MAX_VALUE;
}
else if (type == datatypes.intQName)
{
min = int.MIN_VALUE;
max = int.MAX_VALUE;
}
else if (type == datatypes.shortQName)
{
min = SHORT_MIN_VALUE
max = SHORT_MAX_VALUE;
}
else if (type == datatypes.byteQName)
{
min = BYTE_MIN_VALUE
max = BYTE_MAX_VALUE;
}
else if (type == datatypes.unsignedLongQName)
{
min = 0;
max = ULONG_MAX_VALUE;
}
else if (type == datatypes.unsignedIntQName)
{
min = 0;
max = uint.MAX_VALUE;
}
else if (type == datatypes.unsignedShortQName)
{
min = 0;
max = USHORT_MAX_VALUE;
}
else if (type == datatypes.unsignedByteQName)
{
min = 0;
max = UBYTE_MAX_VALUE;
}
else if (type == datatypes.positiveIntegerQName)
{
min = 1;
max = Number.MAX_VALUE;
}
else if (type == datatypes.nonNegativeIntegerQName)
{
min = 0;
max = Number.MAX_VALUE;
}
else if (type == datatypes.negativeIntegerQName)
{
min = -Number.MAX_VALUE;
max = -1;
}
else if (type == datatypes.nonPositiveIntegerQName)
{
min = -Number.MAX_VALUE;
max = 0;
}
else if (type == datatypes.integerQName)
{
min = -Number.MAX_VALUE;
max = Number.MAX_VALUE;
}
var integer:Number = Math.floor(number);
if (integer >= min)
{
if (integer > max)
{
if (validating)
{
throw new RangeError("The value '" + value + "' is too large for " + type.localName);
}
else
{
// As a last resort, we just go with the original input
return whitespaceCollapse(value);
}
}
}
else
{
if (validating)
{
throw new RangeError("The value '" + value + "' is too small for " + type.localName);
}
else
{
// As a last resort, we just go with the original input
return whitespaceCollapse(value);
}
}
result = integer.toString();
return result;
}
public function marshallString(value:*, type:QName = null, restriction:XML = null):String
{
if (value != null)
{
if (value is XML || value is XMLList)
{
// for XML and XMLList objects, use toXMLString() to include the
// root tag for xml instances with simple content (toString() would
// only return the simple content inside the tag).
return value.toXMLString();
}
else if (value is Object)
{
return Object(value).toString();
}
}
return null;
}
public function unmarshallAny(value:*, type:QName = null, restriction:XML = null):*
{
if (value === undefined)
return undefined;
else if (value == null)
return null;
var result:*;
var unmarshaller:Function;
var s:String = whitespaceCollapse(value);
if (s == "")
{
unmarshaller = unmarshallers[datatypes.stringQName.localName];
}
else if (isNaN(Number(s))
|| (s.charAt(0) == '0')
|| ((s.charAt(0) == '-') && (s.charAt(1) == '0'))
|| s.charAt(s.length - 1) == 'E')
{
var lowerS:String = s.toLowerCase();
if (lowerS == "true" || lowerS == "false")
{
unmarshaller = unmarshallers[datatypes.booleanQName.localName];
}
else
{
unmarshaller = unmarshallers[datatypes.stringQName.localName];
}
}
else
{
unmarshaller = unmarshallers[datatypes.doubleQName.localName];
}
result = unmarshaller(value, type, restriction);
return result;
}
public function unmarshallBase64Binary(value:*, type:QName = null, restriction:XML = null):ByteArray
{
if (value == null)
return null;
var data:String = whitespaceCollapse(value);
var decoder:Base64Decoder = new Base64Decoder();
decoder.decode(data);
return decoder.drain();
}
public function unmarshallBoolean(value:*, type:QName = null, restriction:XML = null):Boolean
{
if (value == null)
return false;
var bool:String = whitespaceCollapse(value).toLowerCase();
if (bool == "true" || bool == "1")
return true;
return false;
}
public function unmarshallDate(value:*, type:QName = null, restriction:XML = null):Object
{
if (value == null)
return null;
var date:Date;
var index:int;
var datePart:String = whitespaceCollapse(value);
if (datePart != null)
{
// dateLexicalRep ::= yearFrag '-' monthFrag '-' dayFrag timezoneFrag?
// yearFrag ::= '-'? (([1-9] digit digit digit+)) | ('0' digit digit digit))
index = datePart.indexOf("-", 1);
var year:uint = uint(datePart.substring(0, index++));
// monthFrag ::= ('0' [1-9]) | ('1' [0-2])
var month:uint = uint(datePart.substring(index, index + 2));
index += 3;
// dayFrag ::= (0 [1-9]) | ([12] digit) | ('3' [01])
var day:uint = uint(datePart.substring(index, index + 2));
index += 2;
// timezoneFrag ::= 'Z' | (('+' | '-') ('0' digit | '1' [0-4]) ':' minuteFrag)
if (datePart.charAt(index) == "Z") // UTC.
{
date = new Date(Date.UTC(year, month - 1, day));
}
else if (datePart.length > 10) // UTC offset.
{
// Start at UTC.
date = new Date(Date.UTC(year, month - 1, day));
// (('+' | '-') ('0' digit | '1' [0-4]) ':' minuteFrag)
var offsetDirection:String = datePart.charAt(index++);
var hours:int = int(datePart.substring(index, index + 2));
index += 3;
// minuteFrag ::= [0-5] digit
var minutes:int = int(datePart.substring(index, index + 2));
// Done with parse; apply offset.
var millis:Number = (hours * 3600000) + (minutes * 60000);
if (offsetDirection == "+")
{
date.time -= millis;
}
else // "-"
{
date.time += millis;
}
}
else // Treat as local time.
{
date = new Date(year, month - 1, day);
}
}
return date;
}
/**
* Handles dateTime and time types.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function unmarshallDatetime(value:*, type:QName = null, restriction:XML = null):Object
{
if (value == null)
return null;
var date:Date;
var rawValue:String = whitespaceCollapse(value);
var datePart:String;
var timePart:String;
var utc:Boolean;
var offset:Boolean;
var index:int;
var sep:int = rawValue.indexOf("T");
if (sep != -1)
{
datePart = rawValue.substring(0, sep);
timePart = rawValue.substring(sep + 1);
}
else // It's a time (no date part).
{
timePart = rawValue;
}
// Parse the time first to get the timezone/offset. E.g. 24:00:00.000
// timeLexicalRep ::= ((hourFrag ':' minuteFrag ':' secondFrag) | endOfDayFrag) timezoneFrag?
// hourFrag ::= ([01] digit) | ('2' [0-3])
var hours:int = int(timePart.substring(0, 2));
// minuteFrag ::= [0-5] digit
var minutes:int = int(timePart.substring(3, 5));
// secondFrag ::= ([0-5] digit) ('.' digit+)?
var millisStart:int = timePart.indexOf(".", 6);
var seconds:int = int(timePart.substring(6, 8));
// Handle millis and timezone next.
// timezoneFrag ::= 'Z' | (('+' | '-') ('0' digit | '1' [0-4]) ':' minuteFrag)
var tzIndex:int = timePart.indexOf("Z", 8);
var offsetDirection:int;
var offsetMillis:Number;
if (tzIndex == -1)
{
if ((tzIndex = timePart.indexOf("+", 8)) != -1)
offsetDirection = 1; // Positive.
else if ((tzIndex = timePart.indexOf("-", 8)) != -1)
offsetDirection = -1; // Negative.
if (tzIndex != -1)
{
index = tzIndex + 1;
var offsetHours:int = int(timePart.substring(index, index + 2));
index += 3;
var offsetMinutes:int = int(timePart.substring(index, index + 2));
offsetMillis = (offsetHours * 3600000) + (offsetMinutes * 60000);
utc = true;
offset = true;
}
}
else
{
utc = true;
}
var millis:int = 0;
if (millisStart != -1)
{
var fractionalSecond:Number;
if (tzIndex != -1)
fractionalSecond = Number(timePart.substring(millisStart, tzIndex));
else
fractionalSecond = Number(timePart.substring(millisStart));
millis = int(Math.floor(fractionalSecond*1000));
}
// Now parse the datePart if it exists.
if (datePart != null)
{
// dateLexicalRep ::= yearFrag '-' monthFrag '-' dayFrag timezoneFrag?
// yearFrag ::= '-'? (([1-9] digit digit digit+)) | ('0' digit digit digit))
index = datePart.indexOf("-", 1);
var year:uint = uint(datePart.substring(0, index++));
// monthFrag ::= ('0' [1-9]) | ('1' [0-2])
var month:uint = uint(datePart.substring(index, index + 2));
index += 3;
// dayFrag ::= (0 [1-9]) | ([12] digit) | ('3' [01])
var day:uint = uint(datePart.substring(index, index + 2));
if (utc)
date = new Date(Date.UTC(year, month - 1, day));
else
date = new Date(year, month - 1, day);
}
else
{
if (utc)
{
var now:Date = new Date();
date = new Date(Date.UTC(now.fullYearUTC, now.monthUTC, now.dateUTC));
}
else
{
date = new Date();
}
}
// Apply the time part.
if (utc)
{
date.setUTCHours(hours, minutes, seconds, millis);
if (offset)
{
if (offsetDirection > 0)
date.time -= offsetMillis;
else
date.time += offsetMillis;
}
}
else
{
date.setHours(hours, minutes, seconds, millis);
}
return date;
}
public function unmarshallDecimal(value:*, type:QName = null, restriction:XML = null):Number
{
return unmarshallDouble(value, type);
}
public function unmarshallDouble(value:*, type:QName = null, restriction:XML = null):Number
{
var result:Number;
if (value != null)
{
var s:String = whitespaceCollapse(value);
if (s == "INF")
{
result = Number.POSITIVE_INFINITY;
}
else if (s == "-INF")
{
result = Number.NEGATIVE_INFINITY;
}
else
{
result = Number(s);
}
}
return result;
}
public function unmarshallDuration(value:*, type:QName = null, restriction:XML = null):*
{
return whitespaceCollapse(value);
}
public function unmarshallFloat(value:*, type:QName = null, restriction:XML = null):Number
{
return unmarshallDouble(value, type, restriction);
}
// FIXME: Should we always return String for all gregorian types?
public function unmarshallGregorian(value:*, type:QName = null, restriction:XML = null):*
{
var rawValue:String = whitespaceCollapse(value);
var result:* = rawValue;
// FIXME: Consider timezone, if provided, for gregorian date info
if (type == datatypes.gYearQName)
{
result = uint(rawValue.substring(0, 4));
}
/*
// FIXME: Should we leave YearMonth and MonthDay as String?
else if (type == datatypes.gYearMonthQName)
{
result = rawValue.substring(0, 7);
}
else if (type == datatypes.gMonthDayQName)
{
result = rawValue.substring(2, 5);
}
*/
else if (type == datatypes.gMonthQName)
{
result = uint(rawValue.substring(2, 4));
}
else if (type == datatypes.gDayQName)
{
result = uint(rawValue.substring(3, 5));
}
return result;
}
public function unmarshallHexBinary(value:*, type:QName = null, restriction:XML = null):ByteArray
{
if (value != null)
{
var data:String = whitespaceCollapse(value);
var decoder:HexDecoder = new HexDecoder();
decoder.decode(data);
return decoder.drain();
}
return null;
}
public function unmarshallInteger(value:*, type:QName = null, restriction:XML = null):Number
{
return parseInt(value);
}
public function unmarshallString(value:*, type:QName = null, restriction:XML = null):String
{
var result:String;
if (value != null)
{
result = value.toString();
}
return result;
}
public static function guessSimpleType(value:*):*
{
var localName:String = "string";
if (value is uint)
{
localName = "unsignedInt";
}
else if (value is int)
{
localName = "int";
}
else if (value is Number)
{
localName = "double";
}
else if (value is Boolean)
{
localName = "boolean";
}
else if (value is String)
{
localName = "string";
}
else if (value is ByteArray)
{
if (byteArrayAsBase64Binary)
localName = "base64Binary";
else
localName = "hexBinary";
}
else if (value is Date)
{
localName = "dateTime";
}
return localName;
}
private static function specialNumber(value:Number):String
{
if (value == Number.NEGATIVE_INFINITY)
return "-INF";
else if (value == Number.POSITIVE_INFINITY)
return "INF";
else if (isNaN(value))
return "NaN";
else
return null;
}
/**
* For simple types with the whitespace restriction <code>collapse</code>
* all occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return)
* are replaced with #x20 (space), then consecutive spaces are collapsed
* to a single space, then finally the leading and trailing spaces are
* trimmed.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
private static function whitespaceCollapse(value:*):String
{
if (value == null)
return null;
var s:String = value.toString();
s = s.replace(whitespaceCollapsePattern, " ");
s = s.replace(whitespaceTrimPattern, "");
return s;
}
/**
* For simple types with the whitespace restriction <code>replace</code>
* all occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return)
* are replaced with #x20 (space).
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
private static function whitespaceReplace(value:*):String
{
if (value == null)
return null;
var s:String = value.toString();
s = s.replace(whitespaceReplacePattern, " ");
return s;
}
private function registerMarshallers():void
{
marshallers = {};
marshallers[datatypes.booleanQName.localName] = marshallBoolean;
// Special built-in schema datatypes
marshallers[datatypes.anyTypeQName.localName] = marshallAny;
marshallers[datatypes.anySimpleTypeQName.localName] = marshallAny;
marshallers[datatypes.anyAtomicTypeQName.localName] = marshallAny;
// Primitive datatypes
marshallers[datatypes.stringQName.localName] = marshallString;
marshallers[datatypes.booleanQName.localName] = marshallBoolean;
marshallers[datatypes.decimalQName.localName] = marshallDecimal;
marshallers[datatypes.precisionDecimal.localName] = marshallDecimal;
marshallers[datatypes.floatQName.localName] = marshallFloat;
marshallers[datatypes.doubleQName.localName] = marshallDouble;
marshallers[datatypes.durationQName.localName] = marshallDuration;
marshallers[datatypes.dateTimeQName.localName] = marshallDatetime;
marshallers[datatypes.timeQName.localName] = marshallDatetime;
marshallers[datatypes.dateQName.localName] = marshallDatetime;
marshallers[datatypes.gYearMonthQName.localName] = marshallGregorian;
marshallers[datatypes.gYearQName.localName] = marshallGregorian;
marshallers[datatypes.gMonthDayQName.localName] = marshallGregorian;
marshallers[datatypes.gDayQName.localName] = marshallGregorian;
marshallers[datatypes.gMonthQName.localName] = marshallGregorian;
marshallers[datatypes.hexBinaryQName.localName] = marshallHexBinary;
marshallers[datatypes.base64BinaryQName.localName] = marshallBase64Binary;
marshallers[datatypes.anyURIQName.localName] = marshallString;
marshallers[datatypes.QNameQName.localName] = marshallString;
marshallers[datatypes.NOTATIONQName.localName] = marshallString;
// Other built-in datatypes
marshallers[datatypes.normalizedStringQName.localName] = marshallString;
marshallers[datatypes.tokenQName.localName] = marshallString;
marshallers[datatypes.languageQName.localName] = marshallString;
marshallers[datatypes.NMTOKENQName.localName] = marshallString;
marshallers[datatypes.NMTOKENSQName.localName] = marshallString;
marshallers[datatypes.NameQName.localName] = marshallString;
marshallers[datatypes.NCNameQName.localName] = marshallString;
marshallers[datatypes.IDQName.localName] = marshallString;
marshallers[datatypes.IDREF.localName] = marshallString;
marshallers[datatypes.IDREFS.localName] = marshallString;
marshallers[datatypes.ENTITY.localName] = marshallString;
marshallers[datatypes.ENTITIES.localName] = marshallString;
marshallers[datatypes.integerQName.localName] = marshallInteger;
marshallers[datatypes.nonPositiveIntegerQName.localName] = marshallInteger;
marshallers[datatypes.negativeIntegerQName.localName] = marshallInteger;
marshallers[datatypes.longQName.localName] = marshallInteger;
marshallers[datatypes.intQName.localName] = marshallInteger;
marshallers[datatypes.shortQName.localName] = marshallInteger;
marshallers[datatypes.byteQName.localName] = marshallInteger;
marshallers[datatypes.nonNegativeIntegerQName.localName] = marshallInteger;
marshallers[datatypes.unsignedLongQName.localName] = marshallInteger;
marshallers[datatypes.unsignedIntQName.localName] = marshallInteger;
marshallers[datatypes.unsignedShortQName.localName] = marshallInteger;
marshallers[datatypes.unsignedByteQName.localName] = marshallInteger;
marshallers[datatypes.positiveIntegerQName.localName] = marshallInteger;
marshallers[datatypes.yearMonthDurationQName.localName] = marshallDatetime;
marshallers[datatypes.dayTimeDurationQName.localName] = marshallDatetime;
// 1999
if (datatypes.timeInstantQName != null)
marshallers[datatypes.timeInstantQName.localName] = marshallDatetime;
unmarshallers = {};
unmarshallers[datatypes.booleanQName.localName] = unmarshallBoolean;
// Special built-in schema datatypes
unmarshallers[datatypes.anyTypeQName.localName] = unmarshallAny;
unmarshallers[datatypes.anySimpleTypeQName.localName] = unmarshallAny;
unmarshallers[datatypes.anyAtomicTypeQName.localName] = unmarshallAny;
// Primitive datatypes
unmarshallers[datatypes.stringQName.localName] = unmarshallString;
unmarshallers[datatypes.booleanQName.localName] = unmarshallBoolean;
unmarshallers[datatypes.decimalQName.localName] = unmarshallDecimal;
unmarshallers[datatypes.precisionDecimal.localName] = unmarshallDecimal;
unmarshallers[datatypes.floatQName.localName] = unmarshallFloat;
unmarshallers[datatypes.doubleQName.localName] = unmarshallDouble;
unmarshallers[datatypes.durationQName.localName] = unmarshallDuration;
unmarshallers[datatypes.dateTimeQName.localName] = unmarshallDatetime;
unmarshallers[datatypes.timeQName.localName] = unmarshallDatetime;
unmarshallers[datatypes.dateQName.localName] = unmarshallDate;
unmarshallers[datatypes.gYearMonthQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.gYearQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.gMonthDayQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.gDayQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.gMonthQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.hexBinaryQName.localName] = unmarshallHexBinary;
unmarshallers[datatypes.base64BinaryQName.localName] = unmarshallBase64Binary;
unmarshallers[datatypes.anyURIQName.localName] = unmarshallString;
unmarshallers[datatypes.QNameQName.localName] = unmarshallString;
unmarshallers[datatypes.NOTATIONQName.localName] = unmarshallString;
// Other built-in datatypes
unmarshallers[datatypes.normalizedStringQName.localName] = unmarshallString;
unmarshallers[datatypes.tokenQName.localName] = unmarshallString;
unmarshallers[datatypes.languageQName.localName] = unmarshallString;
unmarshallers[datatypes.NMTOKENQName.localName] = unmarshallString;
unmarshallers[datatypes.NMTOKENSQName.localName] = unmarshallString;
unmarshallers[datatypes.NameQName.localName] = unmarshallString;
unmarshallers[datatypes.NCNameQName.localName] = unmarshallString;
unmarshallers[datatypes.IDQName.localName] = unmarshallString;
unmarshallers[datatypes.IDREF.localName] = unmarshallString;
unmarshallers[datatypes.IDREFS.localName] = unmarshallString;
unmarshallers[datatypes.ENTITY.localName] = unmarshallString;
unmarshallers[datatypes.ENTITIES.localName] = unmarshallString;
unmarshallers[datatypes.integerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.nonPositiveIntegerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.negativeIntegerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.longQName.localName] = unmarshallInteger;
unmarshallers[datatypes.intQName.localName] = unmarshallInteger;
unmarshallers[datatypes.shortQName.localName] = unmarshallInteger;
unmarshallers[datatypes.byteQName.localName] = unmarshallInteger;
unmarshallers[datatypes.nonNegativeIntegerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.unsignedLongQName.localName] = unmarshallInteger;
unmarshallers[datatypes.unsignedIntQName.localName] = unmarshallInteger;
unmarshallers[datatypes.unsignedShortQName.localName] = unmarshallInteger;
unmarshallers[datatypes.unsignedByteQName.localName] = unmarshallInteger;
unmarshallers[datatypes.positiveIntegerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.yearMonthDurationQName.localName] = unmarshallDatetime;
unmarshallers[datatypes.dayTimeDurationQName.localName] = unmarshallDatetime;
// 1999
if (datatypes.timeInstantQName != null)
unmarshallers[datatypes.timeInstantQName.localName] = unmarshallDatetime;
}
/**
* A Boolean flag to determines whether ActionScript ByteArrays should be
* serialized as base64Binary or hexBinary when specific XML Schema type
* information has not been provided. The default is true meaning
* base64Binary.
*
* @see flash.utils.ByteArray
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static var byteArrayAsBase64Binary:Boolean = true;
/**
* A RegEx pattern to help replace all whitespace characters in the content
* of certain simple types with #x20 (space) characters. The XML Schema
* specification defines whitespace as #x9 (tab), #xA (line feed) and
* #xD (carriage return).
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static var whitespaceReplacePattern:RegExp = new RegExp("[\t\r\n]", "g");
/**
* A RegEx pattern to help collapse all consecutive whitespace characters in
* the content of certain simple types to a single #x20 (space) character.
* The XML Schema specification defines whitespace as #x9 (tab),
* #xA (line feed) and #xD (carriage return).
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static var whitespaceCollapsePattern:RegExp = new RegExp("[ \t\r\n]+", "g");
/**
* A RegEx pattern to help trim all leading and trailing spaces in the
* content of certain simple types. For whitespace <code>collapse</code>,
* this RegEx is executed after the whitespaceCollapsePattern RegEx has
* been executed.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static var whitespaceTrimPattern:RegExp = new RegExp("^[ ]+|[ ]+$", "g");
public static const FLOAT_MAX_VALUE:Number = (Math.pow(2, 24) - 1) * Math.pow(2, 104);
public static const FLOAT_MIN_VALUE:Number = Math.pow(2, -149);
public static const LONG_MAX_VALUE:Number = 9223372036854775807;
public static const LONG_MIN_VALUE:Number = -9223372036854775808;
public static const SHORT_MAX_VALUE:Number = 32767;
public static const SHORT_MIN_VALUE:Number = -32768;
public static const BYTE_MAX_VALUE:Number = 127;
public static const BYTE_MIN_VALUE:Number = -128;
public static const ULONG_MAX_VALUE:Number = 18446744073709551615;
public static const USHORT_MAX_VALUE:Number = 65535;
public static const UBYTE_MAX_VALUE:Number = 255;
private var marshallers:Object;
private var unmarshallers:Object;
private var constants:SchemaConstants;
private var datatypes:SchemaDatatypes;
private var _validating:Boolean;
}
}
|
package gov.lbl.aercalc.util
{
import flash.desktop.NativeApplication;
import flash.system.Capabilities;
public class AboutInfo
{
public function AboutInfo()
{
}
public static function get applicationVersion():String
{
var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
var air:Namespace = appXML.namespaceDeclarations()[0];
var version:String = appXML.air::versionNumber;
if (version.indexOf("v") == 0) version = version.substr(1);
return version;
}
public static function get flashPlayerVersion():String
{
return Capabilities.version
}
}
}
|
/**
* ByteString
*
* An ASN1 type for a ByteString, represented with a ByteArray
* Copyright (c) 2007 Henri Torgemane
*
* See LICENSE.txt for full license information.
*/
package com.hurlant.util.der
{
import flash.utils.ByteArray;
import com.hurlant.util.Hex;
public class ByteString extends ByteArray implements IAsn1Type
{
private var type:uint;
private var len:uint;
public function ByteString(type:uint = 0x04, length:uint = 0x00) {
this.type = type;
this.len = length;
}
public function getLength():uint
{
return len;
}
public function getType():uint
{
return type;
}
public function toDER():ByteArray {
return DER.wrapDER(type, this);
}
override public function toString():String {
return DER.indent+"ByteString["+type+"]["+len+"]["+Hex.fromArray(this)+"]";
}
}
} |
/**
* VERSION: 1.672
* DATE: 2011-08-29
* AS3 (AS2 version is also available)
* UPDATES AND DOCS AT: http://www.greensock.com
**/
package com.greensock.core {
/**
* SimpleTimeline is the base class for the TimelineLite and TimelineMax classes. It provides the
* most basic timeline functionality and is used for the root timelines in TweenLite. It is meant
* to be very fast and lightweight. <br /><br />
*
* <b>Copyright 2011, GreenSock. All rights reserved.</b> This work is subject to the terms in <a href="http://www.greensock.com/terms_of_use.html">http://www.greensock.com/terms_of_use.html</a> or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
*
* @author Jack Doyle, jack@greensock.com
*/
public class SimpleTimeline extends TweenCore {
/** @private **/
protected var _firstChild:TweenCore;
/** @private **/
protected var _lastChild:TweenCore;
/** If a timeline's autoRemoveChildren is true, its children will be removed and made eligible for garbage collection as soon as they complete. This is the default behavior for the main/root timeline. **/
public var autoRemoveChildren:Boolean;
public function SimpleTimeline(vars:Object=null) {
super(0, vars);
}
/**
* Inserts a TweenLite, TweenMax, TimelineLite, or TimelineMax instance into the timeline at a specific time.
*
* @param tween TweenLite, TweenMax, TimelineLite, or TimelineMax instance to insert
* @param time The time in seconds (or frames for frames-based timelines) at which the tween/timeline should be inserted. For example, myTimeline.insert(myTween, 3) would insert myTween 3-seconds into the timeline.
* @return TweenLite, TweenMax, TimelineLite, or TimelineMax instance that was inserted
*/
public function insert(tween:TweenCore, time:*=0):TweenCore {
var prevTimeline:SimpleTimeline = tween.timeline;
if (!tween.cachedOrphan && prevTimeline) {
prevTimeline.remove(tween, true); //removes from existing timeline so that it can be properly added to this one.
}
tween.timeline = this;
tween.cachedStartTime = Number(time) + tween.delay;
if (tween.gc) {
tween.setEnabled(true, true);
}
if (tween.cachedPaused && prevTimeline != this) { //we only adjust the cachedPauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order).
tween.cachedPauseTime = tween.cachedStartTime + ((this.rawTime - tween.cachedStartTime) / tween.cachedTimeScale);
}
if (_lastChild) {
_lastChild.nextNode = tween;
} else {
_firstChild = tween;
}
tween.prevNode = _lastChild;
_lastChild = tween;
tween.nextNode = null;
tween.cachedOrphan = false;
return tween;
}
/** @private **/
public function remove(tween:TweenCore, skipDisable:Boolean=false):void {
if (tween.cachedOrphan) {
return; //already removed!
} else if (!skipDisable) {
tween.setEnabled(false, true);
}
if (tween.nextNode) {
tween.nextNode.prevNode = tween.prevNode;
} else if (_lastChild == tween) {
_lastChild = tween.prevNode;
}
if (tween.prevNode) {
tween.prevNode.nextNode = tween.nextNode;
} else if (_firstChild == tween) {
_firstChild = tween.nextNode;
}
tween.cachedOrphan = true;
//don't null nextNode and prevNode, otherwise the chain could break in rendering loops.
}
/** @private **/
override public function renderTime(time:Number, suppressEvents:Boolean=false, force:Boolean=false):void {
var tween:TweenCore = _firstChild, dur:Number, next:TweenCore;
this.cachedTotalTime = time;
this.cachedTime = time;
while (tween) {
next = tween.nextNode; //record it here because the value could change after rendering...
if (tween.active || (time >= tween.cachedStartTime && !tween.cachedPaused && !tween.gc)) {
if (!tween.cachedReversed) {
tween.renderTime((time - tween.cachedStartTime) * tween.cachedTimeScale, suppressEvents, false);
} else {
dur = (tween.cacheIsDirty) ? tween.totalDuration : tween.cachedTotalDuration;
tween.renderTime(dur - ((time - tween.cachedStartTime) * tween.cachedTimeScale), suppressEvents, false);
}
}
tween = next;
}
}
//---- GETTERS / SETTERS ------------------------------------------------------------------------------
/**
* @private
* Reports the totalTime of the timeline without capping the number at the totalDuration (max) and zero (minimum) which can be useful when
* unpausing tweens/timelines. Imagine a case where a paused tween is in a timeline that has already reached the end, but then
* the tween gets unpaused - it needs a way to place itself accurately in time AFTER what was previously the timeline's end time.
* In a SimpleTimeline, rawTime is always the same as cachedTotalTime, but in TimelineLite and TimelineMax, it can be different.
*
* @return The totalTime of the timeline without capping the number at the totalDuration (max) and zero (minimum)
*/
public function get rawTime():Number {
return this.cachedTotalTime;
}
}
} |
package ru.inspirit.analysis
{
import flash.utils.Endian;
import com.joa_ebert.apparat.memory.Memory;
import com.joa_ebert.apparat.memory.MemoryMath;
import cmodule.fft.CLibInit;
import flash.utils.ByteArray;
/**
* released under MIT License (X11)
* http://www.opensource.org/licenses/mit-license.php
*
* Eugene Zatepyakin
* http://blog.inspirit.ru
* http://code.google.com/p/in-spirit/wiki/ASFFT
*/
public final class FFT
{
public static const REAL_RAW_DATA:int = 0;
public static const IMAGINARY_RAW_DATA:int = 1;
public static const REAL_FFT_DATA:int = 2;
public static const IMAGINARY_FFT_DATA:int = 3;
public static const TEMP_DATA:int = 7;
//public static const SPECTRUM_DATA:int = 4;
protected const DATA_POINTERS:Vector.<int> = new Vector.<int>(8, true);
protected var FFT_LIB:Object;
protected var alchemyRAM:ByteArray;
protected var realDataPtr:int;
protected var imagDataPtr:int;
protected var realFFTDataPtr:int;
protected var imagFFTDataPtr:int;
protected var amplFFTDataPtr:int;
protected var phaseFFTDataPtr:int;
protected var drawDataPtr:int;
protected var shiftedDataPtr:int;
protected var length:int;
protected var numChannels:int;
protected var specLength:int;
public function FFT():void
{
FFT_LIB = (new CLibInit()).init();
var ns:Namespace = new Namespace( "cmodule.fft" );
alchemyRAM = (ns::gstate).ds;
getMemoryPointers();
}
/**
* Init FFT instance of specified length
* also you may choose to work with STEREO (2 channels) or MONO (1 channel)
*/
public function init(length:int = 2048, numChannels:int = 1):int
{
this.numChannels = numChannels;
this.length = MemoryMath.nextPow2(length);
FFT_LIB.initSignalBuffers(this.length, this.numChannels);
specLength = (this.length >> 1) + 1;
return this.length;
}
/**
* Perform forward FFT
*/
public function forwardFFT():void
{
FFT_LIB.analyzeSignal(1, 0, 0, 0);
}
/**
* Perform inverse FFT
*/
public function inverseFFT():void
{
FFT_LIB.analyzeSignal(0, 0, 1, 0);
}
/**
* Calculate Spectrum (amgnitude) of Real and Imaginary FFT parts
* see getSpectrumData method for more info
*/
public function calculateSpectrum(normalizeSpectrum:Boolean = false):void
{
FFT_LIB.analyzeSignal(0, 1, 0, normalizeSpectrum ? 1 : 0);
}
/**
* Result Spectrum length
*/
public function get spectrumLength():int
{
return specLength * numChannels;
}
/**
* the lib assumes that the input data is formated [left, right, left, right, ...]
* the way it is presented in Sound raw data
*/
public function setStereoRAWDataByteArray(data:ByteArray):void
{
alchemyRAM.position = Memory.readInt(shiftedDataPtr);
alchemyRAM.writeBytes(data);
FFT_LIB.splitChannels();
}
/**
* Use it if you are working with Sound raw data [left, right, left, right, ...]
* It will format data before return
* May be used after calling inverseFFT to get modified sound signal
* Please note data that comes from Alchemy is always LITTLE_ENDIAN
*/
public function getStereoRAWDataByteArray(endian:String = Endian.LITTLE_ENDIAN):ByteArray
{
FFT_LIB.mergeChannels();
var pos:int = Memory.readInt(shiftedDataPtr);
var ba:ByteArray = new ByteArray();
ba.endian = endian;
ba.writeBytes(alchemyRAM, pos, (length << 1) << 2);
ba.position = 0;
return ba;
}
public function setLeftChannelDataByteArray(data:ByteArray, dataType:int = 0):void
{
var pos:int = Memory.readInt(DATA_POINTERS[dataType]);
alchemyRAM.position = pos;
alchemyRAM.writeBytes(data);
}
public function setRightChannelDataByteArray(data:ByteArray, dataType:int = 0):void
{
var pos:int = Memory.readInt(DATA_POINTERS[dataType]) + (length << 2);
alchemyRAM.position = pos;
alchemyRAM.writeBytes(data);
}
public function setLeftChannelDataVector(data:Vector.<Number>, dataType:int = 0):void
{
var pos:int = Memory.readInt(DATA_POINTERS[dataType]);
var len:int = length;
var ind1:int = -1;
var ind2:int = 0;
for(; ind2 < len; ++ind2)
{
Memory.writeFloat(data[++ind1], pos + (ind2 << 2));
}
}
public function setRightChannelDataVector(data:Vector.<Number>, dataType:int = 0):void
{
var pos:int = Memory.readInt(DATA_POINTERS[dataType]) + (length << 2);
var len:int = length;
var ind1:int = -1;
var ind2:int = 0;
for(; ind2 < len; ++ind2)
{
Memory.writeFloat(data[++ind1], pos + (ind2 << 2));
}
}
public function getLeftChannelDataByteArray(dataType:int = 0, endian:String = Endian.LITTLE_ENDIAN):ByteArray
{
var pos:int = Memory.readInt(DATA_POINTERS[dataType]);
var ba:ByteArray = new ByteArray();
ba.endian = endian;
ba.writeBytes(alchemyRAM, pos, length << 2);
ba.position = 0;
return ba;
}
public function getRightChannelDataByteArray(dataType:int = 0, endian:String = Endian.LITTLE_ENDIAN):ByteArray
{
var pos:int = Memory.readInt(DATA_POINTERS[dataType]) + (length << 2);
var ba:ByteArray = new ByteArray();
ba.endian = endian;
ba.writeBytes(alchemyRAM, pos, length << 2);
ba.position = 0;
return ba;
}
public function getLeftChannelDataVector(dataType:int = 0):Vector.<Number>
{
var pos:int = Memory.readInt(DATA_POINTERS[dataType]);
var len:int = length;
var ind1:int = -1;
var ind2:int = 0;
var data:Vector.<Number> = new Vector.<Number>(len, true);
for(; ind2 < len; ++ind2)
{
data[++ind1] = Memory.readFloat(pos + (ind2 << 2));
}
return data;
}
public function getRightChannelDataVector(dataType:int = 0):Vector.<Number>
{
var pos:int = Memory.readInt(DATA_POINTERS[dataType]) + (length << 2);
var len:int = length;
var ind1:int = -1;
var ind2:int = 0;
var data:Vector.<Number> = new Vector.<Number>(len, true);
for(; ind2 < len; ++ind2)
{
data[++ind1] = Memory.readFloat(pos + (ind2 << 2));
}
return data;
}
/**
* Note: spectum size is (SignalLength / 2 + 1) wide
* if you work with 2 channels it will double
* half for the left channel and half for the right
*/
public function getSpectrumData():ByteArray
{
var ba:ByteArray = new ByteArray();
ba.endian = Endian.LITTLE_ENDIAN;
var pos:int = Memory.readInt(amplFFTDataPtr);
ba.writeBytes(alchemyRAM, pos, (specLength * numChannels) << 2);
ba.position = 0;
return ba;
}
/**
* Get access to core Alchemy Lib object
* needed for FFTSpectrumAnalyzer class
*/
public function get core():Object
{
return FFT_LIB;
}
/**
* get access to Alchemy Lib Memory ByteArray
*/
public function get coreMemory():ByteArray
{
return alchemyRAM;
}
/**
* get memory offset for read/write specified data to/from Alchemy
*/
public function getDataMemoryOffset(dataType:int):int
{
return Memory.readInt(DATA_POINTERS[dataType]);
}
/**
* return number of channels in use
*/
public function get numberOfChannels():int
{
return numChannels;
}
/**
* return provided at init length
*/
public function get signalLength():int
{
return length;
}
/**
* Clear all allocated buffers
* Should be caled before reiniting instance with new settings
*/
public function clear():void
{
FFT_LIB.freeBuffers();
}
protected function getMemoryPointers():void
{
var ptrs:Array = FFT_LIB.getBufferPointers();
DATA_POINTERS[0] = realDataPtr = ptrs[0];
DATA_POINTERS[1] = imagDataPtr = ptrs[1];
DATA_POINTERS[2] = realFFTDataPtr = ptrs[2];
DATA_POINTERS[3] = imagFFTDataPtr = ptrs[3];
DATA_POINTERS[4] = amplFFTDataPtr = ptrs[4];
DATA_POINTERS[5] = phaseFFTDataPtr = ptrs[7];
DATA_POINTERS[6] = drawDataPtr = ptrs[5];
DATA_POINTERS[7] = shiftedDataPtr = ptrs[6];
}
}
}
|
package com.heyi.player.interfaces
{
import flash.geom.*;
import flash.net.*;
import flash.display.BitmapData;
import starling.display.DisplayObject;
/**
* 媒体播放器接口
*
* @author 8088
*/
public interface IMediaPlayer
{
/**
* 启动
*/
function start():void;
/**
* 播放
* @param ...rest
*/
function play(...rest):void;
/**
* 重播
*/
function replay():void;
/**
* 暂停
*/
function pause():void;
/**
* 如果暂停回复播放,如果播放则return
*/
function resume():void;
/**
* 搜索
* @param time 时间,单位:秒
*/
function seek(time:Number):void;
/**
* 停止播放
* - 恢复到没有开始的状态
*/
function stop():void;
/**
* 结束播放
* - 播放结束
*/
function end():void;
/**
* 销毁
*/
function destroy():void;
/**
* 获取已加载的比例
* @return
*/
function getLoadedFraction():Number;
/**
* 获取默认的媒体显示对象
* - 视频播放器 默认显示对象为video
* - 音频播放器 默认显示对象为sprite
* - 漫画播放器 默认显示对象为bitmap
* - 动画播放器 默认显示对象为movieclip
* @return
*/
function getDefaultMediaSurface():DisplayObject;
/**
* 重置流
* @param reconnect 是否重新链接
*/
function resetStream(reconnect:Boolean = true):void;
/**
* 重置宽高
* @param width
* @param height
*/
function resize(width:Number, height:Number):void;
/**
* 不可恢复的错误
* @param err 错误信息
*/
function unrecoverableError(err:String = null):void;
/**
* 获取播放器标识
* @return
*/
function get id():String;
/**
* 设置播放器标识
* @param value 播放器标识
*/
function set id(value:String):void;
/**
* 获取媒体数据
* @return
function get data():MediaInfo;
*/
/**
* 设置媒体数据
* @param data
function set data(value:MediaInfo):void;
*/
/**
* 获取音量
* @return
*/
function get volume():Number;
/**
* 设置音量
* @param value 音量
*/
function set volume(value:Number):void;
/**
* 获取语种
*/
function get language():String
/**
* 获取语种
* @param value 语言
*/
function set language(value:String):void
/**
* 获取当前媒体支持的多语言种类
*/
function get multiLanguage():Array
/**
* 获取清晰度
*/
function get quality():String
/**
* 设置清晰度
* - 播放器统一的 标识:1080p、720p、480p、320p ... auto
* - 各产品或皮肤各自匹配对应的标识
* @param value 清晰度标识
*/
function set quality(value:String):void
/**
* 获取当前媒体支持的多清晰度。
*/
function get multiQuality():Array
/**
* 获取时间
* - 只读
* @return
*/
function get time():Number;
/**
* 获取持续时长
* - 只读
* - 点播为总时长、直播为直播持续时间段,单位都是秒
* @return
*/
function get duration():Number;
/**
* 获取已载入的字节数
* - 只读
* @return
*/
function get bytesLoaded():Number;
/**
* 获取总字节数
* - 只读
* @return
*/
function get bytesTotal():Number;
/**
* 获取媒体播放器状态
* - 只读。
* @return
*/
function get state():String;
/**
* 获取缩放
* @return
*/
function get scale():Number;
/**
* 设置缩放
* @param value 缩放取值范围0~1
*/
function set scale(value:Number):void;
/**
* 获取比例
* @return
*/
function get proportion():Number;
/**
* 设置比例
* @param value 媒体需要展现的比例值(宽/高)
*/
function set proportion(value:Number):void;
// IVideoPlayer..
/**
* 检测stageVideo 是否可用
* @return
*/
function isStageVideoAvailable():Boolean;
/**
* 检测是否为tag流
* @return
*/
function isTagStreaming():Boolean;
/**
* 获取流对象
*/
function get stream():NetStream;
/**
* 捕获帧,用于抓屏
* @return
*/
function captureFrame():BitmapData;
/**
* 获取媒体文件播放的帧速率(Frames Per Second)
* @return
*/
function getFPS():Number;
}
}
|
/*
Copyright aswing.org, see the LICENCE.txt.
*/
package devoron.aswing3d.skinbuilder{
import devoron.aswing3d.*;
import org.aswing.border.EmptyBorder;
import org.aswing.lookandfeel.plaf.UIResource;
import org.aswing.error.ImpMissError;
import org.aswing.Insets;
public class SkinEmptyBorder extends EmptyBorder implements UIResource{
public function SkinEmptyBorder(top:int=0, left:int=0, bottom:int=0, right:int=0){
super(null, new Insets(top, left, bottom, right));
}
}
} |
package com.tuarua.fre {
import flash.system.Capabilities;
[RemoteClass(alias="com.tuarua.fre.ANEError")]
public class ANEError extends Error {
private var _stackTrace:String;
private var _source:String;
private var _type:String;
private static const errorTypesCSharp:Array = [
"FreSharp.Exceptions.Ok",
"FreSharp.Exceptions.NoSuchNameException",
"FreSharp.Exceptions.FreInvalidObjectException",
"FreSharp.Exceptions.FreTypeMismatchException",
"FreSharp.Exceptions.FreActionscriptErrorException",
"FreSharp.Exceptions.FreInvalidArgumentException",
"FreSharp.Exceptions.FreReadOnlyException",
"FreSharp.Exceptions.FreWrongThreadException",
"FreSharp.Exceptions.FreIllegalStateException",
"FreSharp.Exceptions.FreInsufficientMemoryException"
];
private static const errorTypesKotlin:Array = [
"FreKotlin.Exceptions.Ok",
"FreKotlin.Exceptions.FRENoSuchNameException",
"FreKotlin.Exceptions.FREInvalidObjectException",
"FreKotlin.Exceptions.FRETypeMismatchException",
"FreKotlin.Exceptions.FREASErrorException",
"FreKotlin.Exceptions.FreInvalidArgumentException",
"FreKotlin.Exceptions.FREReadOnlyException",
"FreKotlin.Exceptions.FREWrongThreadException",
"FreKotlin.Exceptions.FreIllegalStateException",
"FreKotlin.Exceptions.FreInsufficientMemoryException"
];
private static const errorTypesSwift:Array = [
"ok",
"noSuchName",
"invalidObject",
"typeMismatch",
"actionscriptError",
"invalidArgument",
"readOnly",
"wrongThread",
"illegalState",
"insufficientMemory"
];
public function ANEError(message:String, errorID:int, type:String, source:String, stackTrace:String) {
_stackTrace = stackTrace;
_source = source;
_type = type;
super(message, getErrorID(_type));
}
override public function get errorID():int {
return super.errorID;
}
override public function getStackTrace():String {
return _stackTrace;
}
private function getErrorID(thetype:String):int {
var val:int;
if (Capabilities.os.toLowerCase().indexOf("win") == 0) {
val = errorTypesCSharp.indexOf(thetype);
}else if (Capabilities.os.toLowerCase().indexOf("linux") == 0){
val = errorTypesKotlin.indexOf(thetype);
} else {
val = errorTypesSwift.indexOf(thetype);
}
if (val == -1) val = 10;
return val;
}
//noinspection ReservedWordAsName
public function get type():String {
return _type;
}
public function get source():String {
return _source;
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// 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
{
import mx.charts.chartClasses.DataTip;
import mx.charts.chartClasses.DataTransform;
import mx.charts.chartClasses.PolarChart;
import mx.charts.chartClasses.Series;
import mx.charts.series.PieSeries;
import mx.charts.styles.HaloDefaults;
import mx.core.IFlexModuleFactory;
import mx.core.mx_internal;
import mx.graphics.SolidColor;
import mx.graphics.SolidColorStroke;
import mx.graphics.Stroke;
import mx.styles.CSSStyleDeclaration;
use namespace mx_internal;
//--------------------------------------
// Styles
//--------------------------------------
include "styles/metadata/TextStyles.as"
/**
* Determines the size of the hole in the center of the pie chart.
* This property is a percentage value of the center circle's radius
* compared to the entire pie's radius.
* The default value is 0 percent.
* Use this property to create a doughnut-shaped chart.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Style(name="innerRadius", type="Number", inherit="no")]
//--------------------------------------
// Other metadata
//--------------------------------------
[DefaultBindingProperty(destination="dataProvider")]
[DefaultTriggerEvent("itemClick")]
[IconFile("PieChart.png")]
/**
* The PieChart control represents a data series as a standard pie chart.
* The data for the data provider determines the size of each wedge
* in the pie chart relative to the other wedges.
* You can use the PieSeries class to create
* standard pie charts, doughnut charts, or stacked pie charts.
*
* <p>The PieChart control expects its <code>series</code> property
* to contain an Array of PieSeries objects.</p>
*
* @mxml
*
* <p>The <code><mx:PieChart></code> tag inherits all the properties
* of its parent classes, and adds the following properties:
*
* <pre>
* <mx:PieChart
* <strong>Styles</strong>
* innerRadius="0"
* textAlign="left"
* />
* </pre>
*
* @includeExample examples/PieChartExample.mxml
*
* @see mx.charts.series.PieSeries
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public class PieChart extends PolarChart
{
include "../core/Version.as";
//--------------------------------------------------------------------------
//
// Class initialization
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function PieChart()
{
super();
dataTipMode = "single";
var aa:LinearAxis = new LinearAxis();
aa.minimum = 0;
aa.maximum = 100;
angularAxis = aa;
}
//--------------------------------------------------------------------------
//
// Variables
//
//--------------------------------------------------------------------------
/**
* @private
*/
private var _moduleFactoryInitialized:Boolean = false;
/**
* @private
*/
private var _seriesWidth:Number;
/**
* @private
*/
private var _innerRadius:Number;
//--------------------------------------------------------------------------
//
// Overridden properties
//
//--------------------------------------------------------------------------
//----------------------------------
// legendData
//----------------------------------
/**
* @private
*/
override public function get legendData():Array /* of LegendData */
{
var keyItems:Array /* of LegendData */ = [];
if (series.length > 0)
keyItems = [ series[0].legendData ];
return keyItems;
}
//--------------------------------------------------------------------------
//
// Overridden methods: UIComponent
//
//--------------------------------------------------------------------------
/**
* @private
*/
private function initStyles():Boolean
{
HaloDefaults.init(styleManager);
var pieChartStyle:CSSStyleDeclaration = styleManager.getStyleDeclaration("mx.charts.PieChart");
pieChartStyle.setStyle("fill", new SolidColor(0xFFFFFF, 0));
pieChartStyle.setStyle("calloutStroke", new SolidColorStroke(0x888888,2));
return true;
}
/**
* A module factory is used as context for using embedded fonts and for finding the style manager that controls the styles for this component.
*
* @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)
return;
_moduleFactoryInitialized = true;
// our style settings
initStyles();
}
/**
* @private
*/
override public function styleChanged(styleProp:String):void
{
if (styleProp == null || styleProp == "innerRadius")
invalidateSeries();
super.styleChanged(styleProp);
}
//--------------------------------------------------------------------------
//
// Overridden methods: ChartBase
//
//--------------------------------------------------------------------------
/**
* @private
*/
override protected function customizeSeries(seriesGlyph:Series, i:uint):void
{
if (seriesGlyph is PieSeries)
{
PieSeries(seriesGlyph).setStyle("innerRadius",
_innerRadius + i * _seriesWidth);
PieSeries(seriesGlyph).outerRadius =
_innerRadius + (i + 1) *_seriesWidth;
}
}
/**
* @private
*/
override protected function applySeriesSet(seriesSet:Array /* of Series */,
transform:DataTransform):Array /* of Series */
{
_innerRadius = getStyle("innerRadius");
_innerRadius = isNaN(_innerRadius) ? 0 : _innerRadius;
_seriesWidth = (1 - _innerRadius) / seriesSet.length;
return super.applySeriesSet(seriesSet, transform);
}
}
}
|
package pl.brun.lib.events {
import flash.events.Event;
/**
* [Event(name="signal", type="pl.brun.lib.events.SignalEvent")]
*
* @author Marek Brun
*/
public class SignalEvent extends Event {
public static const SIGNAL:String = 'signal';
public function SignalEvent(type:String) {
super(type);
}
}
}
|
package cmodule.lua_wrapper
{
import avm2.intrinsics.memory.li32;
import avm2.intrinsics.memory.sf64;
import avm2.intrinsics.memory.si32;
public final class FSM_math_ceil extends Machine
{
public static const intRegCount:int = 4;
public static const NumberRegCount:int = 1;
public var i0:int;
public var i1:int;
public var i2:int;
public var f0:Number;
public var i3:int;
public function FSM_math_ceil()
{
super();
}
public static function start() : void
{
var _loc1_:FSM_math_ceil = null;
_loc1_ = new FSM_math_ceil();
gstate.gworker = _loc1_;
}
override public final function work() : void
{
switch(state)
{
case 0:
mstate.esp -= 4;
si32(mstate.ebp,mstate.esp);
mstate.ebp = mstate.esp;
mstate.esp -= 0;
this.i0 = 1;
mstate.esp -= 8;
this.i1 = li32(mstate.ebp + 8);
si32(this.i1,mstate.esp);
si32(this.i0,mstate.esp + 4);
state = 1;
mstate.esp -= 4;
FSM_luaL_checknumber.start();
return;
case 1:
this.f0 = mstate.st0;
mstate.esp += 8;
this.f0 = Math.ceil(this.f0);
this.i2 = li32(this.i1 + 8);
sf64(this.f0,this.i2);
this.i3 = 3;
si32(this.i3,this.i2 + 8);
this.i2 = li32(this.i1 + 8);
this.i2 += 12;
si32(this.i2,this.i1 + 8);
mstate.eax = this.i0;
mstate.esp = mstate.ebp;
mstate.ebp = li32(mstate.esp);
mstate.esp += 4;
mstate.esp += 4;
mstate.gworker = caller;
return;
default:
throw "Invalid state in _math_ceil";
}
}
}
}
|
package com.unhurdle.spectrum
{
COMPILE::JS{
import org.apache.royale.core.WrappedHTMLElement;
}
import org.apache.royale.events.Event;
import com.unhurdle.spectrum.includes.ActionButtonInclude;
public class PagePagination extends SpectrumBase
{
/**
* <inject_html>
* <link rel="stylesheet" href="assets/css/components/pagination/dist.css">
* </inject_html>
*
*/
public function PagePagination()
{
super();
toggle(valueToSelector("listing"),true);
}
override protected function getSelector():String{
return "spectrum-Pagination";
}
private var prev:HTMLLinkElement;
private var next:HTMLLinkElement;
override protected function getTag():String{
return "nav";
}
COMPILE::JS
override protected function createElement():WrappedHTMLElement{
var elem:WrappedHTMLElement = super.createElement();
var buttonBase:String = "spectrum-Button spectrum-Button--primary spectrum-Button--quiet ";
prev = newElement("a",buttonBase+appendSelector("-prevButton")) as HTMLLinkElement
var prevSpan:TextNode = new TextNode("");
prevSpan.element = newElement("span","spectrum-Button-label") as HTMLSpanElement;
prevSpan.text = "prev";
prev.appendChild(prevSpan.element);
prev.addEventListener("click",prevPage);
elem.appendChild(prev);
next = newElement("a",buttonBase + appendSelector("-nextButton")) as HTMLLinkElement
var nextSpan:TextNode = new TextNode("");
nextSpan.element = newElement("span","spectrum-Button-label") as HTMLSpanElement;
nextSpan.text = "next";
next.appendChild(nextSpan.element);
next.addEventListener("click",nextPage);
elem.appendChild(next);
return elem;
}
private var _href:String;
public function get href():String
{
return _href;
}
public function set href(value:String):void
{
if(value){
_href = value;
} else {
_href = "";
}
}
private var _selected:Boolean = false;
public function get selected():Boolean
{
return _selected;
}
public function set selected(value:Boolean):void
{
if(value){
_selected = value;
COMPILE::JS{
findChild(element.children);
}
}
}
private function findChild(children:NodeList):void{
for each(var selectedChild:Element in children){
if(selectedChild.text && selectedChild.text == "" + selectedPage){
selectedChild.classList.add("is-selected");
}
else{
if(selectedChild.classList && selectedChild.classList.contains("is-selected")){
selectedChild.classList.remove("is-selected");
}
else
{
if(selectedChild.children && selectedChild.children.length){
findChild(selectedChild.children)
}
}
}
}
}
private function prevPage():void{
selectedPage > 1? selectedPage--: selectedPage = 1;
}
private function nextPage():void{
selectedPage < pagesNum? selectedPage++: selectedPage = pagesNum;
}
private function enableOrDisable():void{
selectedPage == 1? prev.classList.add("is-disabled"): prev.classList.remove("is-disabled");
selectedPage == pagesNum? next.classList.add("is-disabled"): next.classList.remove("is-disabled");
}
private var _selectedPage:Number = 2;
public function get selectedPage():Number
{
return _selectedPage;
}
public function set selectedPage(val:Number):void
{
if(val){
_selectedPage = val;
selected = true;
enableOrDisable();
}
}
private var _pagesNum:int;
public function get pagesNum():int
{
return _pagesNum;
}
public function set pagesNum(val:int):void
{
if(val != _pagesNum){
_pagesNum = val;
for(var i:int=0;i<val;i++){
//TODO use ActionButton?
var actionButtonSelector:String = ActionButtonInclude.getSelector();
var link:HTMLElement = newElement("a",actionButtonSelector);
link.classList.toggle(actionButtonSelector + "--quiet");
var node:TextNode = new TextNode("span");
node.className = actionButtonSelector + "-label";
node.text = "" + (i + 1);
link.appendChild(node.element);
link.addEventListener("click",changeValue);
COMPILE::JS{
element.insertBefore(link,next);
}
}
}
}
private function changeValue(ev:Event):void
{
COMPILE::JS{
selectedPage = Number(ev.target.textContent);
}
}
}
} |
// =================================================================================================
//
// Starling Framework
// Copyright 2012 Gamua OG. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================
package starling.core
{
import flash.display.Sprite;
import flash.display.Stage3D;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display3D.Context3D;
import flash.display3D.Context3DCompareMode;
import flash.display3D.Context3DTriangleFace;
import flash.display3D.Program3D;
import flash.errors.IllegalOperationError;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.TouchEvent;
import flash.geom.Rectangle;
import flash.system.Capabilities;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.ui.Mouse;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.utils.ByteArray;
import flash.utils.Dictionary;
import flash.utils.getTimer;
import flash.utils.setTimeout;
import starling.animation.Juggler;
import starling.display.DisplayObject;
import starling.display.Stage;
import starling.events.EventDispatcher;
import starling.events.ResizeEvent;
import starling.events.TouchPhase;
import starling.events.TouchProcessor;
import starling.utils.HAlign;
import starling.utils.VAlign;
/** Dispatched when a new render context is created. */
[Event(name="context3DCreate", type="starling.events.Event")]
/** Dispatched when the root class has been created. */
[Event(name="rootCreated", type="starling.events.Event")]
/** The Starling class represents the core of the Starling framework.
*
* <p>The Starling framework makes it possible to create 2D applications and games that make
* use of the Stage3D architecture introduced in Flash Player 11. It implements a display tree
* system that is very similar to that of conventional Flash, while leveraging modern GPUs
* to speed up rendering.</p>
*
* <p>The Starling class represents the link between the conventional Flash display tree and
* the Starling display tree. To create a Starling-powered application, you have to create
* an instance of the Starling class:</p>
*
* <pre>var starling:Starling = new Starling(Game, stage);</pre>
*
* <p>The first parameter has to be a Starling display object class, e.g. a subclass of
* <code>starling.display.Sprite</code>. In the sample above, the class "Game" is the
* application root. An instance of "Game" will be created as soon as Starling is initialized.
* The second parameter is the conventional (Flash) stage object. Per default, Starling will
* display its contents directly below the stage.</p>
*
* <p>It is recommended to store the Starling instance as a member variable, to make sure
* that the Garbage Collector does not destroy it. After creating the Starling object, you
* have to start it up like this:</p>
*
* <pre>starling.start();</pre>
*
* <p>It will now render the contents of the "Game" class in the frame rate that is set up for
* the application (as defined in the Flash stage).</p>
*
* <strong>Accessing the Starling object</strong>
*
* <p>From within your application, you can access the current Starling object anytime
* through the static method <code>Starling.current</code>. It will return the active Starling
* instance (most applications will only have one Starling object, anyway).</p>
*
* <strong>Viewport</strong>
*
* <p>The area the Starling content is rendered into is, per default, the complete size of the
* stage. You can, however, use the "viewPort" property to change it. This can be useful
* when you want to render only into a part of the screen, or if the player size changes. For
* the latter, you can listen to the RESIZE-event dispatched by the Starling
* stage.</p>
*
* <strong>Native overlay</strong>
*
* <p>Sometimes you will want to display native Flash content on top of Starling. That's what the
* <code>nativeOverlay</code> property is for. It returns a Flash Sprite lying directly
* on top of the Starling content. You can add conventional Flash objects to that overlay.</p>
*
* <p>Beware, though, that conventional Flash content on top of 3D content can lead to
* performance penalties on some (mobile) platforms. For that reason, always remove all child
* objects from the overlay when you don't need them any longer. Starling will remove the
* overlay from the display list when it's empty.</p>
*
* <strong>Multitouch</strong>
*
* <p>Starling supports multitouch input on devices that provide it. During development,
* where most of us are working with a conventional mouse and keyboard, Starling can simulate
* multitouch events with the help of the "Shift" and "Ctrl" (Mac: "Cmd") keys. Activate
* this feature by enabling the <code>simulateMultitouch</code> property.</p>
*
* <strong>Handling a lost render context</strong>
*
* <p>On some operating systems and under certain conditions (e.g. returning from system
* sleep), Starling's stage3D render context may be lost. Starling can recover from a lost
* context if the class property "handleLostContext" is set to "true". Keep in mind, however,
* that this comes at the price of increased memory consumption; Starling will cache textures
* in RAM to be able to restore them when the context is lost.</p>
*
* <p>In case you want to react to a context loss, Starling dispatches an event with
* the type "Event.CONTEXT3D_CREATE" when the context is restored. You can recreate any
* invalid resources in a corresponding event listener.</p>
*
* <strong>Sharing a 3D Context</strong>
*
* <p>Per default, Starling handles the Stage3D context itself. If you want to combine
* Starling with another Stage3D engine, however, this may not be what you want. In this case,
* you can make use of the <code>shareContext</code> property:</p>
*
* <ol>
* <li>Manually create and configure a context3D object that both frameworks can work with
* (through <code>stage3D.requestContext3D</code> and
* <code>context.configureBackBuffer</code>).</li>
* <li>Initialize Starling with the stage3D instance that contains that configured context.
* This will automatically enable <code>shareContext</code>.</li>
* <li>Call <code>start()</code> on your Starling instance (as usual). This will make
* Starling queue input events (keyboard/mouse/touch).</li>
* <li>Create a game loop (e.g. using the native <code>ENTER_FRAME</code> event) and let it
* call Starling's <code>nextFrame</code> as well as the equivalent method of the other
* Stage3D engine. Surround those calls with <code>context.clear()</code> and
* <code>context.present()</code>.</li>
* </ol>
*
* <p>The Starling wiki contains a <a href="http://goo.gl/BsXzw">tutorial</a> with more
* information about this topic.</p>
*
*/
public class Starling extends EventDispatcher
{
/** The version of the Starling framework. */
public static const VERSION:String = "1.4.1";
/** The key for the shader programs stored in 'contextData' */
private static const PROGRAM_DATA_NAME:String = "Starling.programs";
// members
private var mStage3D:Stage3D;
private var mStage:Stage; // starling.display.stage!
private var mRootClass:Class;
private var mRoot:DisplayObject;
private var mJuggler:Juggler;
private var mSupport:RenderSupport;
private var mTouchProcessor:TouchProcessor;
private var mAntiAliasing:int;
private var mSimulateMultitouch:Boolean;
private var mEnableErrorChecking:Boolean;
private var mLastFrameTimestamp:Number;
private var mLeftMouseDown:Boolean;
private var mStatsDisplay:StatsDisplay;
private var mShareContext:Boolean;
private var mProfile:String;
private var mSupportHighResolutions:Boolean;
private var mContext:Context3D;
private var mStarted:Boolean;
private var mRendering:Boolean;
private var mContextValid:Boolean;
private var mViewPort:Rectangle;
private var mPreviousViewPort:Rectangle;
private var mClippedViewPort:Rectangle;
private var mNativeStage:flash.display.Stage;
private var mNativeOverlay:flash.display.Sprite;
private var mNativeStageContentScaleFactor:Number;
private static var sCurrent:Starling;
private static var sHandleLostContext:Boolean;
private static var sContextData:Dictionary = new Dictionary(true);
// construction
/** Creates a new Starling instance.
* @param rootClass A subclass of a Starling display object. It will be created as soon as
* initialization is finished and will become the first child of the
* Starling stage.
* @param stage The Flash (2D) stage.
* @param viewPort A rectangle describing the area into which the content will be
* rendered. @default stage size
* @param stage3D The Stage3D object into which the content will be rendered. If it
* already contains a context, <code>sharedContext</code> will be set
* to <code>true</code>. @default the first available Stage3D.
* @param renderMode Use this parameter to force "software" rendering.
* @param profile The Context3DProfile that should be requested.
*/
public function Starling(rootClass:Class, stage:flash.display.Stage,
viewPort:Rectangle=null, stage3D:Stage3D=null,
renderMode:String="auto", profile:String="baselineConstrained")
{
if (stage == null) throw new ArgumentError("Stage must not be null");
if (rootClass == null) throw new ArgumentError("Root class must not be null");
if (viewPort == null) viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
if (stage3D == null) stage3D = stage.stage3Ds[0];
makeCurrent();
mRootClass = rootClass;
mViewPort = viewPort;
mPreviousViewPort = new Rectangle();
mStage3D = stage3D;
mStage = new Stage(viewPort.width, viewPort.height, stage.color);
mNativeOverlay = new Sprite();
mNativeStage = stage;
mNativeStage.addChild(mNativeOverlay);
mNativeStageContentScaleFactor = 1.0;
mTouchProcessor = new TouchProcessor(mStage);
mJuggler = new Juggler();
mAntiAliasing = 0;
mSimulateMultitouch = false;
mEnableErrorChecking = false;
mProfile = profile;
mSupportHighResolutions = false;
mLastFrameTimestamp = getTimer() / 1000.0;
mSupport = new RenderSupport();
// for context data, we actually reference by stage3D, since it survives a context loss
sContextData[stage3D] = new Dictionary();
sContextData[stage3D][PROGRAM_DATA_NAME] = new Dictionary();
// all other modes are problematic in Starling, so we force those here
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
// register touch/mouse event handlers
for each (var touchEventType:String in touchEventTypes)
stage.addEventListener(touchEventType, onTouch, false, 0, true);
// register other event handlers
stage.addEventListener(Event.ENTER_FRAME, onEnterFrame, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, onKey, false, 0, true);
stage.addEventListener(Event.RESIZE, onResize, false, 0, true);
stage.addEventListener(Event.MOUSE_LEAVE, onMouseLeave, false, 0, true);
mStage3D.addEventListener(Event.CONTEXT3D_CREATE, onContextCreated, false, 10, true);
mStage3D.addEventListener(ErrorEvent.ERROR, onStage3DError, false, 10, true);
if (mStage3D.context3D && mStage3D.context3D.driverInfo != "Disposed")
{
mShareContext = true;
setTimeout(initialize, 1); // we don't call it right away, because Starling should
// behave the same way with or without a shared context
}
else
{
mShareContext = false;
try
{
// "Context3DProfile" is only available starting with Flash Player 11.4/AIR 3.4.
// to stay compatible with older versions, we check if the parameter is available.
var requestContext3D:Function = mStage3D.requestContext3D;
if (requestContext3D.length == 1) requestContext3D(renderMode);
else requestContext3D(renderMode, profile);
}
catch (e:Error)
{
showFatalError("Context3D error: " + e.message);
}
}
}
/** Disposes all children of the stage and the render context; removes all registered
* event listeners. */
public function dispose():void
{
stop(true);
mNativeStage.removeEventListener(Event.ENTER_FRAME, onEnterFrame, false);
mNativeStage.removeEventListener(KeyboardEvent.KEY_DOWN, onKey, false);
mNativeStage.removeEventListener(KeyboardEvent.KEY_UP, onKey, false);
mNativeStage.removeEventListener(Event.RESIZE, onResize, false);
mNativeStage.removeEventListener(Event.MOUSE_LEAVE, onMouseLeave, false);
mNativeStage.removeChild(mNativeOverlay);
mStage3D.removeEventListener(Event.CONTEXT3D_CREATE, onContextCreated, false);
mStage3D.removeEventListener(ErrorEvent.ERROR, onStage3DError, false);
for each (var touchEventType:String in touchEventTypes)
mNativeStage.removeEventListener(touchEventType, onTouch, false);
if (mStage) mStage.dispose();
if (mSupport) mSupport.dispose();
if (mTouchProcessor) mTouchProcessor.dispose();
if (sCurrent == this) sCurrent = null;
if (mContext && !mShareContext)
{
// Per default, the context is recreated as long as there are listeners on it.
// Beginning with AIR 3.6, we can avoid that with an additional parameter.
var disposeContext3D:Function = mContext.dispose;
if (disposeContext3D.length == 1) disposeContext3D(false);
else disposeContext3D();
}
}
// functions
private function initialize():void
{
makeCurrent();
initializeGraphicsAPI();
initializeRoot();
mTouchProcessor.simulateMultitouch = mSimulateMultitouch;
mLastFrameTimestamp = getTimer() / 1000.0;
}
private function initializeGraphicsAPI():void
{
mContext = mStage3D.context3D;
mContext.enableErrorChecking = mEnableErrorChecking;
contextData[PROGRAM_DATA_NAME] = new Dictionary();
updateViewPort(true);
trace("[Starling] Initialization complete.");
trace("[Starling] Display Driver:", mContext.driverInfo);
dispatchEventWith(starling.events.Event.CONTEXT3D_CREATE, false, mContext);
}
private function initializeRoot():void
{
if (mRoot == null)
{
mRoot = new mRootClass() as DisplayObject;
if (mRoot == null) throw new Error("Invalid root class: " + mRootClass);
mStage.addChildAt(mRoot, 0);
dispatchEventWith(starling.events.Event.ROOT_CREATED, false, mRoot);
}
}
/** Calls <code>advanceTime()</code> (with the time that has passed since the last frame)
* and <code>render()</code>. */
public function nextFrame():void
{
var now:Number = getTimer() / 1000.0;
var passedTime:Number = now - mLastFrameTimestamp;
mLastFrameTimestamp = now;
advanceTime(passedTime);
render();
}
/** Dispatches ENTER_FRAME events on the display list, advances the Juggler
* and processes touches. */
public function advanceTime(passedTime:Number):void
{
if (!mContextValid)
return;
makeCurrent();
mTouchProcessor.advanceTime(passedTime);
mStage.advanceTime(passedTime);
mJuggler.advanceTime(passedTime);
}
/** Renders the complete display list. Before rendering, the context is cleared; afterwards,
* it is presented. This can be avoided by enabling <code>shareContext</code>.*/
public function render():void
{
if (!mContextValid)
return;
makeCurrent();
updateViewPort();
updateNativeOverlay();
mSupport.nextFrame();
if (!mShareContext)
RenderSupport.clear(mStage.color, 1.0);
var scaleX:Number = mViewPort.width / mStage.stageWidth;
var scaleY:Number = mViewPort.height / mStage.stageHeight;
mContext.setDepthTest(false, Context3DCompareMode.ALWAYS);
mContext.setCulling(Context3DTriangleFace.NONE);
mSupport.renderTarget = null; // back buffer
mSupport.setOrthographicProjection(
mViewPort.x < 0 ? -mViewPort.x / scaleX : 0.0,
mViewPort.y < 0 ? -mViewPort.y / scaleY : 0.0,
mClippedViewPort.width / scaleX,
mClippedViewPort.height / scaleY);
mStage.render(mSupport, 1.0);
mSupport.finishQuadBatch();
if (mStatsDisplay)
mStatsDisplay.drawCount = mSupport.drawCount;
if (!mShareContext)
mContext.present();
}
private function updateViewPort(forceUpdate:Boolean=false):void
{
// the last set viewport is stored in a variable; that way, people can modify the
// viewPort directly (without a copy) and we still know if it has changed.
if (forceUpdate || mPreviousViewPort.width != mViewPort.width ||
mPreviousViewPort.height != mViewPort.height ||
mPreviousViewPort.x != mViewPort.x || mPreviousViewPort.y != mViewPort.y)
{
mPreviousViewPort.setTo(mViewPort.x, mViewPort.y, mViewPort.width, mViewPort.height);
// Constrained mode requires that the viewport is within the native stage bounds;
// thus, we use a clipped viewport when configuring the back buffer. (In baseline
// mode, that's not necessary, but it does not hurt either.)
mClippedViewPort = mViewPort.intersection(
new Rectangle(0, 0, mNativeStage.stageWidth, mNativeStage.stageHeight));
if (!mShareContext)
{
// setting x and y might move the context to invalid bounds (since changing
// the size happens in a separate operation) -- so we have no choice but to
// set the backbuffer to a very small size first, to be on the safe side.
if (mProfile == "baselineConstrained")
configureBackBuffer(32, 32, mAntiAliasing, false);
mStage3D.x = mClippedViewPort.x;
mStage3D.y = mClippedViewPort.y;
configureBackBuffer(mClippedViewPort.width, mClippedViewPort.height,
mAntiAliasing, false, mSupportHighResolutions);
if (mSupportHighResolutions && "contentsScaleFactor" in mNativeStage)
mNativeStageContentScaleFactor = mNativeStage["contentsScaleFactor"];
else
mNativeStageContentScaleFactor = 1.0;
}
}
}
/** Configures the back buffer while automatically keeping backwards compatibility with
* AIR versions that do not support the "wantsBestResolution" argument. */
private function configureBackBuffer(width:int, height:int, antiAlias:int,
enableDepthAndStencil:Boolean,
wantsBestResolution:Boolean=false):void
{
var configureBackBuffer:Function = mContext.configureBackBuffer;
var methodArgs:Array = [width, height, antiAlias, enableDepthAndStencil];
if (configureBackBuffer.length > 4) methodArgs.push(wantsBestResolution);
configureBackBuffer.apply(mContext, methodArgs);
}
private function updateNativeOverlay():void
{
mNativeOverlay.x = mViewPort.x;
mNativeOverlay.y = mViewPort.y;
mNativeOverlay.scaleX = mViewPort.width / mStage.stageWidth;
mNativeOverlay.scaleY = mViewPort.height / mStage.stageHeight;
}
private function showFatalError(message:String):void
{
var textField:TextField = new TextField();
var textFormat:TextFormat = new TextFormat("Verdana", 12, 0xFFFFFF);
textFormat.align = TextFormatAlign.CENTER;
textField.defaultTextFormat = textFormat;
textField.wordWrap = true;
textField.width = mStage.stageWidth * 0.75;
textField.autoSize = TextFieldAutoSize.CENTER;
textField.text = message;
textField.x = (mStage.stageWidth - textField.width) / 2;
textField.y = (mStage.stageHeight - textField.height) / 2;
textField.background = true;
textField.backgroundColor = 0x440000;
nativeOverlay.addChild(textField);
}
/** Make this Starling instance the <code>current</code> one. */
public function makeCurrent():void
{
sCurrent = this;
}
/** As soon as Starling is started, it will queue input events (keyboard/mouse/touch);
* furthermore, the method <code>nextFrame</code> will be called once per Flash Player
* frame. (Except when <code>shareContext</code> is enabled: in that case, you have to
* call that method manually.) */
public function start():void
{
mStarted = mRendering = true;
mLastFrameTimestamp = getTimer() / 1000.0;
}
/** Stops all logic and input processing, effectively freezing the app in its current state.
* Per default, rendering will continue: that's because the classic display list
* is only updated when stage3D is. (If Starling stopped rendering, conventional Flash
* contents would freeze, as well.)
*
* <p>However, if you don't need classic Flash contents, you can stop rendering, too.
* On some mobile systems (e.g. iOS), you are even required to do so if you have
* activated background code execution.</p>
*/
public function stop(suspendRendering:Boolean=false):void
{
mStarted = false;
mRendering = !suspendRendering;
}
// event handlers
private function onStage3DError(event:ErrorEvent):void
{
if (event.errorID == 3702)
{
var mode:String = Capabilities.playerType == "Desktop" ? "renderMode" : "wmode";
showFatalError("Context3D not available! Possible reasons: wrong " + mode +
" or missing device support.");
}
else
showFatalError("Stage3D error: " + event.text);
}
private function onContextCreated(event:Event):void
{
if (!Starling.handleLostContext && mContext)
{
stop();
event.stopImmediatePropagation();
showFatalError("Fatal error: The application lost the device context!");
trace("[Starling] The device context was lost. " +
"Enable 'Starling.handleLostContext' to avoid this error.");
}
else
{
initialize();
}
}
private function onEnterFrame(event:Event):void
{
mContextValid = (mContext && mContext.driverInfo != "Disposed");
// On mobile, the native display list is only updated on stage3D draw calls.
// Thus, we render even when Starling is paused.
if (!mShareContext)
{
if (mStarted) nextFrame();
else if (mRendering) render();
}
}
private function onKey(event:KeyboardEvent):void
{
if (!mStarted) return;
var keyEvent:starling.events.KeyboardEvent = new starling.events.KeyboardEvent(
event.type, event.charCode, event.keyCode, event.keyLocation,
event.ctrlKey, event.altKey, event.shiftKey);
makeCurrent();
mStage.broadcastEvent(keyEvent);
if (keyEvent.isDefaultPrevented())
event.preventDefault();
}
private function onResize(event:Event):void
{
makeCurrent();
var stage:flash.display.Stage = event.target as flash.display.Stage;
mStage.dispatchEvent(new ResizeEvent(Event.RESIZE, stage.stageWidth, stage.stageHeight));
}
private function onMouseLeave(event:Event):void
{
mTouchProcessor.enqueueMouseLeftStage();
}
private function onTouch(event:Event):void
{
if (!mStarted) return;
var globalX:Number;
var globalY:Number;
var touchID:int;
var phase:String;
var pressure:Number = 1.0;
var width:Number = 1.0;
var height:Number = 1.0;
// figure out general touch properties
if (event is MouseEvent)
{
var mouseEvent:MouseEvent = event as MouseEvent;
globalX = mouseEvent.stageX;
globalY = mouseEvent.stageY;
touchID = 0;
// MouseEvent.buttonDown returns true for both left and right button (AIR supports
// the right mouse button). We only want to react on the left button for now,
// so we have to save the state for the left button manually.
if (event.type == MouseEvent.MOUSE_DOWN) mLeftMouseDown = true;
else if (event.type == MouseEvent.MOUSE_UP) mLeftMouseDown = false;
}
else
{
var touchEvent:TouchEvent = event as TouchEvent;
// On a system that supports both mouse and touch input, the primary touch point
// is dispatched as mouse event as well. Since we don't want to listen to that
// event twice, we ignore the primary touch in that case.
if (Mouse.supportsCursor && touchEvent.isPrimaryTouchPoint) return;
else
{
globalX = touchEvent.stageX;
globalY = touchEvent.stageY;
touchID = touchEvent.touchPointID;
pressure = touchEvent.pressure;
width = touchEvent.sizeX;
height = touchEvent.sizeY;
}
}
// figure out touch phase
switch (event.type)
{
case TouchEvent.TOUCH_BEGIN: phase = TouchPhase.BEGAN; break;
case TouchEvent.TOUCH_MOVE: phase = TouchPhase.MOVED; break;
case TouchEvent.TOUCH_END: phase = TouchPhase.ENDED; break;
case MouseEvent.MOUSE_DOWN: phase = TouchPhase.BEGAN; break;
case MouseEvent.MOUSE_UP: phase = TouchPhase.ENDED; break;
case MouseEvent.MOUSE_MOVE:
phase = (mLeftMouseDown ? TouchPhase.MOVED : TouchPhase.HOVER); break;
}
// move position into viewport bounds
globalX = mStage.stageWidth * (globalX - mViewPort.x) / mViewPort.width;
globalY = mStage.stageHeight * (globalY - mViewPort.y) / mViewPort.height;
// enqueue touch in touch processor
mTouchProcessor.enqueue(touchID, phase, globalX, globalY, pressure, width, height);
// allow objects that depend on mouse-over state to be updated immediately
if (event.type == MouseEvent.MOUSE_UP)
mTouchProcessor.enqueue(touchID, TouchPhase.HOVER, globalX, globalY);
}
private function get touchEventTypes():Array
{
var types:Array = [];
if (multitouchEnabled)
types.push(TouchEvent.TOUCH_BEGIN, TouchEvent.TOUCH_MOVE, TouchEvent.TOUCH_END);
if (!multitouchEnabled || Mouse.supportsCursor)
types.push(MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_MOVE, MouseEvent.MOUSE_UP);
return types;
}
// program management
/** Registers a compiled shader-program under a certain name.
* If the name was already used, the previous program is overwritten. */
public function registerProgram(name:String, vertexShader:ByteArray,
fragmentShader:ByteArray):Program3D
{
deleteProgram(name);
var program:Program3D = mContext.createProgram();
program.upload(vertexShader, fragmentShader);
programs[name] = program;
return program;
}
/** Compiles a shader-program and registers it under a certain name.
* If the name was already used, the previous program is overwritten. */
public function registerProgramFromSource(name:String, vertexShader:String,
fragmentShader:String):Program3D
{
deleteProgram(name);
var program:Program3D = RenderSupport.assembleAgal(vertexShader, fragmentShader);
programs[name] = program;
return program;
}
/** Deletes the vertex- and fragment-programs of a certain name. */
public function deleteProgram(name:String):void
{
var program:Program3D = getProgram(name);
if (program)
{
program.dispose();
delete programs[name];
}
}
/** Returns the vertex- and fragment-programs registered under a certain name. */
public function getProgram(name:String):Program3D
{
return programs[name] as Program3D;
}
/** Indicates if a set of vertex- and fragment-programs is registered under a certain name. */
public function hasProgram(name:String):Boolean
{
return name in programs;
}
private function get programs():Dictionary { return contextData[PROGRAM_DATA_NAME]; }
// properties
/** Indicates if this Starling instance is started. */
public function get isStarted():Boolean { return mStarted; }
/** The default juggler of this instance. Will be advanced once per frame. */
public function get juggler():Juggler { return mJuggler; }
/** The render context of this instance. */
public function get context():Context3D { return mContext; }
/** A dictionary that can be used to save custom data related to the current context.
* If you need to share data that is bound to a specific stage3D instance
* (e.g. textures), use this dictionary instead of creating a static class variable.
* The Dictionary is actually bound to the stage3D instance, thus it survives a
* context loss. */
public function get contextData():Dictionary
{
return sContextData[mStage3D] as Dictionary;
}
/** Returns the actual width (in pixels) of the back buffer. This can differ from the
* width of the viewPort rectangle if it is partly outside the native stage. */
public function get backBufferWidth():int { return mClippedViewPort.width; }
/** Returns the actual height (in pixels) of the back buffer. This can differ from the
* height of the viewPort rectangle if it is partly outside the native stage. */
public function get backBufferHeight():int { return mClippedViewPort.height; }
/** Indicates if multitouch simulation with "Shift" and "Ctrl"/"Cmd"-keys is enabled.
* @default false */
public function get simulateMultitouch():Boolean { return mSimulateMultitouch; }
public function set simulateMultitouch(value:Boolean):void
{
mSimulateMultitouch = value;
if (mContext) mTouchProcessor.simulateMultitouch = value;
}
/** Indicates if Stage3D render methods will report errors. Activate only when needed,
* as this has a negative impact on performance. @default false */
public function get enableErrorChecking():Boolean { return mEnableErrorChecking; }
public function set enableErrorChecking(value:Boolean):void
{
mEnableErrorChecking = value;
if (mContext) mContext.enableErrorChecking = value;
}
/** The antialiasing level. 0 - no antialasing, 16 - maximum antialiasing. @default 0 */
public function get antiAliasing():int { return mAntiAliasing; }
public function set antiAliasing(value:int):void
{
if (mAntiAliasing != value)
{
mAntiAliasing = value;
if (mContextValid) updateViewPort(true);
}
}
/** The viewport into which Starling contents will be rendered. */
public function get viewPort():Rectangle { return mViewPort; }
public function set viewPort(value:Rectangle):void { mViewPort = value.clone(); }
/** The ratio between viewPort width and stage width. Useful for choosing a different
* set of textures depending on the display resolution. */
public function get contentScaleFactor():Number
{
return (mViewPort.width * mNativeStageContentScaleFactor) / mStage.stageWidth;
}
/** A Flash Sprite placed directly on top of the Starling content. Use it to display native
* Flash components. */
public function get nativeOverlay():Sprite { return mNativeOverlay; }
/** Indicates if a small statistics box (with FPS, memory usage and draw count) is displayed. */
public function get showStats():Boolean { return mStatsDisplay && mStatsDisplay.parent; }
public function set showStats(value:Boolean):void
{
if (value == showStats) return;
if (value)
{
if (mStatsDisplay) mStage.addChild(mStatsDisplay);
else showStatsAt();
}
else mStatsDisplay.removeFromParent();
}
/** Displays the statistics box at a certain position. */
public function showStatsAt(hAlign:String="left", vAlign:String="top", scale:Number=1):void
{
if (mContext == null)
{
// Starling is not yet ready - we postpone this until it's initialized.
addEventListener(starling.events.Event.ROOT_CREATED, onRootCreated);
}
else
{
if (mStatsDisplay == null)
{
mStatsDisplay = new StatsDisplay();
mStatsDisplay.touchable = false;
mStage.addChild(mStatsDisplay);
}
var stageWidth:int = mStage.stageWidth;
var stageHeight:int = mStage.stageHeight;
mStatsDisplay.scaleX = mStatsDisplay.scaleY = scale;
if (hAlign == HAlign.LEFT) mStatsDisplay.x = 0;
else if (hAlign == HAlign.RIGHT) mStatsDisplay.x = stageWidth - mStatsDisplay.width;
else mStatsDisplay.x = int((stageWidth - mStatsDisplay.width) / 2);
if (vAlign == VAlign.TOP) mStatsDisplay.y = 0;
else if (vAlign == VAlign.BOTTOM) mStatsDisplay.y = stageHeight - mStatsDisplay.height;
else mStatsDisplay.y = int((stageHeight - mStatsDisplay.height) / 2);
}
function onRootCreated():void
{
showStatsAt(hAlign, vAlign, scale);
removeEventListener(starling.events.Event.ROOT_CREATED, onRootCreated);
}
}
/** The Starling stage object, which is the root of the display tree that is rendered. */
public function get stage():Stage { return mStage; }
/** The Flash Stage3D object Starling renders into. */
public function get stage3D():Stage3D { return mStage3D; }
/** The Flash (2D) stage object Starling renders beneath. */
public function get nativeStage():flash.display.Stage { return mNativeStage; }
/** The instance of the root class provided in the constructor. Available as soon as
* the event 'ROOT_CREATED' has been dispatched. */
public function get root():DisplayObject { return mRoot; }
/** Indicates if the Context3D render calls are managed externally to Starling,
* to allow other frameworks to share the Stage3D instance. @default false */
public function get shareContext() : Boolean { return mShareContext; }
public function set shareContext(value : Boolean) : void { mShareContext = value; }
/** The Context3D profile as requested in the constructor. Beware that if you are
* using a shared context, this might not be accurate. */
public function get profile():String { return mProfile; }
/** Indicates that if the device supports HiDPI screens Starling will attempt to allocate
* a larger back buffer than indicated via the viewPort size. Note that this is used
* on Desktop only; mobile AIR apps still use the "requestedDisplayResolution" parameter
* the application descriptor XML. */
public function get supportHighResolutions():Boolean { return mSupportHighResolutions; }
public function set supportHighResolutions(value:Boolean):void
{
if (mSupportHighResolutions != value)
{
mSupportHighResolutions = value;
if (mContextValid) updateViewPort(true);
}
}
/** The TouchProcessor is passed all mouse and touch input and is responsible for
* dispatching TouchEvents to the Starling display tree. If you want to handle these
* types of input manually, pass your own custom subclass to this property. */
public function get touchProcessor():TouchProcessor { return mTouchProcessor; }
public function set touchProcessor(value:TouchProcessor):void
{
if (value != mTouchProcessor)
{
mTouchProcessor.dispose();
mTouchProcessor = value;
}
}
// static properties
/** The currently active Starling instance. */
public static function get current():Starling { return sCurrent; }
/** The render context of the currently active Starling instance. */
public static function get context():Context3D { return sCurrent ? sCurrent.context : null; }
/** The default juggler of the currently active Starling instance. */
public static function get juggler():Juggler { return sCurrent ? sCurrent.juggler : null; }
/** The contentScaleFactor of the currently active Starling instance. */
public static function get contentScaleFactor():Number
{
return sCurrent ? sCurrent.contentScaleFactor : 1.0;
}
/** Indicates if multitouch input should be supported. */
public static function get multitouchEnabled():Boolean
{
return Multitouch.inputMode == MultitouchInputMode.TOUCH_POINT;
}
public static function set multitouchEnabled(value:Boolean):void
{
if (sCurrent) throw new IllegalOperationError(
"'multitouchEnabled' must be set before Starling instance is created");
else
Multitouch.inputMode = value ? MultitouchInputMode.TOUCH_POINT :
MultitouchInputMode.NONE;
}
/** Indicates if Starling should automatically recover from a lost device context.
* On some systems, an upcoming screensaver or entering sleep mode may
* invalidate the render context. This setting indicates if Starling should recover from
* such incidents. Beware that this has a huge impact on memory consumption!
* It is recommended to enable this setting on Android and Windows, but to deactivate it
* on iOS and Mac OS X. @default false */
public static function get handleLostContext():Boolean { return sHandleLostContext; }
public static function set handleLostContext(value:Boolean):void
{
if (sCurrent) throw new IllegalOperationError(
"'handleLostContext' must be set before Starling instance is created");
else
sHandleLostContext = value;
}
}
}
|
/**
* Created by max.rozdobudko@gmail.com on 21.10.2019.
*/
package com.github.airext.keyboard {
import com.github.airext.keyboard.enum.AutoCapitalization;
import com.github.airext.keyboard.enum.AutoCorrection;
import com.github.airext.keyboard.enum.NativeKeyboardType;
import com.github.airext.keyboard.enum.ReturnKeyType;
import com.github.airext.keyboard.enum.SpellChecking;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.net.registerClassAlias;
/**
* The appearance of native keyboard could be changed with an instance of this class.
*/
public class NativeKeyboardTextParams extends EventDispatcher {
//--------------------------------------------------------------------------
//
// Static initialization
//
//--------------------------------------------------------------------------
{
registerClassAlias("com.github.airext.keyboard.NativeKeyboardTextParams", NativeKeyboardTextParams);
}
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
public function NativeKeyboardTextParams() {
super();
}
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
//-------------------------------------
// text
//-------------------------------------
private var _text: String = null;
/**
* Specifies initial text to display in a text field above native keyboard
*/
[Bindable(event="textChanged")]
public function get text(): String {
return _text;
}
public function set text(value: String): void {
if (value == _text) return;
_text = value;
dispatchEvent(new Event("textChanged"));
}
//-------------------------------------
// isSecureTextEntry
//-------------------------------------
private var _isSecureTextEntry: Boolean = false;
[Bindable(event="isSecureTextEntryChanged")]
/**
* Indicates if input should be secured.
*/
public function get isSecureTextEntry(): Boolean {
return _isSecureTextEntry;
}
public function set isSecureTextEntry(value: Boolean): void {
if (value == _isSecureTextEntry) return;
_isSecureTextEntry = value;
dispatchEvent(new Event("isSecureTextEntryChanged"));
}
//-------------------------------------
// maxCharactersCount
//-------------------------------------
private var _maxCharactersCount: int;
[Bindable(event="maxCharactersCountChanged")]
/**
* Indicates how mach characters user able to enter.
*/
public function get maxCharactersCount(): int {
return _maxCharactersCount;
}
public function set maxCharactersCount(value: int): void {
if (value == _maxCharactersCount) return;
_maxCharactersCount = value;
dispatchEvent(new Event("maxCharactersCountChanged"));
}
//-------------------------------------
// keyboardType
//-------------------------------------
private var _keyboardType: NativeKeyboardType;
[Bindable(event="keyboardTypeChanged")]
/**
* Keyboard type.
*/
public function get keyboardType(): NativeKeyboardType {
return _keyboardType || NativeKeyboardType.Default;
}
public function set keyboardType(value: NativeKeyboardType): void {
if (value == _keyboardType) return;
_keyboardType = value;
dispatchEvent(new Event("keyboardTypeChanged"));
}
//-------------------------------------
// returnKeyType
//-------------------------------------
private var _returnKeyType: ReturnKeyType;
[Bindable(event="returnKeyTypeChanged")]
/**
* Return button type.
*/
public function get returnKeyType(): ReturnKeyType {
return _returnKeyType || ReturnKeyType.Done;
}
public function set returnKeyType(value: ReturnKeyType): void {
if (value == _returnKeyType) return;
_returnKeyType = value;
dispatchEvent(new Event("returnKeyTypeChanged"));
}
//-------------------------------------
// autoCapitalization
//-------------------------------------
private var _autoCapitalization: AutoCapitalization;
[Bindable(event="autoCapitalizationChanged")]
/**
* Auto capitalization type.
*/
public function get autoCapitalization(): AutoCapitalization {
return _autoCapitalization || AutoCapitalization.None;
}
public function set autoCapitalization(value: AutoCapitalization): void {
if (value == _autoCapitalization) return;
_autoCapitalization = value;
dispatchEvent(new Event("autoCapitalizationChanged"));
}
//-------------------------------------
// autoCorrection
//-------------------------------------
private var _autoCorrection: AutoCorrection;
[Bindable(event="autoCorrectionChanged")]
/**
* Auto correction type.
*/
public function get autoCorrection(): AutoCorrection {
return _autoCorrection || AutoCorrection.Default;
}
public function set autoCorrection(value: AutoCorrection): void {
if (value == _autoCorrection) return;
_autoCorrection = value;
dispatchEvent(new Event("autoCorrectionChanged"));
}
//-------------------------------------
// spellChecking
//-------------------------------------
private var _spellChecking: SpellChecking;
[Bindable(event="spellCheckingChanged")]
/**
* Spell checking type.
*/
public function get spellChecking(): SpellChecking {
return _spellChecking || SpellChecking.Default;
}
public function set spellChecking(value: SpellChecking): void {
if (value == _spellChecking) return;
_spellChecking = value;
dispatchEvent(new Event("spellCheckingChanged"));
}
//-------------------------------------
// characterFilter
//-------------------------------------
private var _characterFilter: String;
[Bindable(event="characterFilterChanged")]
/**
* Indicates a set of characters that could be entered to text field.
* If value is <code>null</code> or an empty string, any character could be typed.
*
* The default value is <code>null</code>.
*/
public function get characterFilter(): String {
return _characterFilter;
}
public function set characterFilter(value: String): void {
if (value == _characterFilter) return;
_characterFilter = value;
dispatchEvent(new Event("characterFilterChanged"));
}
//--------------------------------------------------------------------------
//
// Description
//
//--------------------------------------------------------------------------
override public function toString(): String {
return "[NativeKeyboardTextParams(text=\""+text+"\", isSecureTextEntry=\""+isSecureTextEntry+"\", maxCharactersCount=\""+maxCharactersCount+"\", keyboardType=\""+keyboardType+"\", returnKeyType=\""+returnKeyType+"\", autoCapitalization=\""+autoCapitalization+"\", autoCorrection=\""+autoCorrection+"\", spellChecking=\""+spellChecking+"\")]";
}
}
}
|
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
var x = [0, 10, 15, 30, "hello"];
print(x.toString());
|
package com.myflexhero.network
{
import com.myflexhero.network.core.ILayer;
public class Layer extends Data implements ILayer
{
private var _movable:Boolean = true;
private var _editable:Boolean = true;
public function Layer(id:Object, name:String = null)
{
super(id);
this.label = name;
return;
}
public function get movable() : Boolean
{
return this._movable;
}
public function set editable(editable:Boolean) : void
{
var _loc_2:* = this._editable;
this._editable = editable;
this.dispatchPropertyChangeEvent("editable", _loc_2, editable);
return;
}
public function get editable() : Boolean
{
return this._editable;
}
public function set movable(movable:Boolean) : void
{
var _loc_2:* = this._movable;
this._movable = movable;
this.dispatchPropertyChangeEvent("movable", _loc_2, movable);
return;
}
}
} |
package org.papervision3d.events
{
import flash.events.Event;
public class FileLoadEvent extends Event
{
public static const LOAD_COMPLETE:String = "loadComplete";
public static const LOAD_ERROR:String = "loadError";
public static const SECURITY_LOAD_ERROR:String = "securityLoadError";
public static const COLLADA_MATERIALS_DONE:String = "colladaMaterialsDone";
public static const LOAD_PROGRESS:String = "loadProgress";
public static const ANIMATIONS_COMPLETE:String = "animationsComplete";
public static const ANIMATIONS_PROGRESS:String = "animationsProgress";
public var file:String = "";
public var bytesLoaded:Number = -1;
public var bytesTotal:Number = -1;
public var message:String = "";
public var dataObj:Object = null;
public function FileLoadEvent(param1:String, param2:String = "", param3:Number = -1, param4:Number = -1, param5:String = "", param6:Object = null, param7:Boolean = false, param8:Boolean = false)
{
super(param1,param7,param8);
this.file = param2;
this.bytesLoaded = param3;
this.bytesTotal = param4;
this.message = param5;
this.dataObj = param6;
}
override public function clone() : Event
{
return new FileLoadEvent(type,this.file,this.bytesLoaded,this.bytesTotal,this.message,this.dataObj,bubbles,cancelable);
}
}
}
|
package com.codeazur.as3swf.tags
{
import com.codeazur.as3swf.SWFData;
import com.codeazur.as3swf.data.SWFSymbol;
import com.codeazur.utils.StringUtils;
public class TagExportAssets implements ITag
{
public static const TYPE:uint = 56;
protected var _symbols:Vector.<SWFSymbol>;
public function TagExportAssets() {
_symbols = new Vector.<SWFSymbol>();
}
public function get symbols():Vector.<SWFSymbol> { return _symbols; }
public function parse(data:SWFData, length:uint, version:uint, async:Boolean = false):void {
var numSymbols:uint = data.readUI16();
for (var i:uint = 0; i < numSymbols; i++) {
_symbols.push(data.readSYMBOL());
}
}
public function publish(data:SWFData, version:uint):void {
var body:SWFData = new SWFData();
var numSymbols:uint = _symbols.length;
body.writeUI16(numSymbols);
for (var i:uint = 0; i < numSymbols; i++) {
body.writeSYMBOL(_symbols[i]);
}
data.writeTagHeader(type, body.length);
data.writeBytes(body);
}
public function get type():uint { return TYPE; }
public function get name():String { return "ExportAssets"; }
public function get version():uint { return 5; }
public function get level():uint { return 1; }
public function toString(indent:uint = 0):String {
var str:String = Tag.toStringCommon(type, name, indent);
if (_symbols.length > 0) {
str += "\n" + StringUtils.repeat(indent + 2) + "Assets:";
for (var i:uint = 0; i < _symbols.length; i++) {
str += "\n" + StringUtils.repeat(indent + 4) + "[" + i + "] " + _symbols[i].toString();
}
}
return str;
}
}
}
|
/**
* @author jaco
*
* created on 3/1/2010 11:53:19 AM
*/
package it.pixeldump.svg.text {
import flash.display.GraphicsPath;
import flash.geom.Point;
import flash.text.TextFormatAlign;
import it.pixeldump.svg.font.SvgGlyph;
import it.pixeldump.utils.geom.GeomUtil;
import it.pixeldump.utils.geom.BezierCubic;
/**
* text on a cubic spline
*/
public class SplineText extends SvgText {
private static const SFX:Array = [TextFormatAlign.LEFT,
TextFormatAlign.CENTER,
TextFormatAlign.RIGHT,
TextFormatAlign.JUSTIFY];
private var _spline:BezierCubic;
private var _graphicsPaths:Vector.<GraphicsPath>;
private var _offset:Number = 0;
private var tStep:Number;
private var scaleFactor:Number;
private var spLength:Number;
private var twScaled:Number;
private var offsetResult:Object;
private var offsetEnd:Object;
private var glyphPositions:Object;
/**
*
*/
public function get spline():BezierCubic {
return _spline;
}
public function set spline(v:BezierCubic):void {
_spline = v;
}
/**
*
*/
public function get graphicsPaths():Vector.<GraphicsPath> {
return buildGraphicsPath();
}
/**
*
*/
public function get offset():Number {
return _offset;
}
public function set offset(v:Number):void {
_offset = v;
}
// ---------------------------------------
/**
* the constructor
*/
function SplineText(spline:BezierCubic){
_spline = spline;
}
/**
*
*/
private function buildGraphicsPath():Vector.<GraphicsPath> {
if(SFX.indexOf(_align) == -1){
throw new Error("no valid alignment given, please choose one from TextFormatAlign constants");
return;
}
updateForDistributions(NaN);
var functName:String = "charDistributions_" +_align;
this["charDistributions_" +_align]();
var gl:Vector.<SvgGlyph> = glyphs;
var cCount:uint = gl.length;
_graphicsPaths = new Vector.<GraphicsPath>();
for(var i:int = 0; i < cCount; i++){
var sg:SvgGlyph = gl[i];
if(sg.glyphName == "space") continue;
var p:Point = glyphPositions.points[i];
var sa:Number = glyphPositions.angles[i];
var gp:GraphicsPath = new GraphicsPath();
gp.commands = sg.graphicsPath.commands;
if(sa) gp.data = GeomUtil.rotateCoords(sg.graphicsPath.data, new Point(0, 0), sa);
gp.data = GeomUtil.scaleCoords(gp.data, glyphPositions.scaleFactor, glyphPositions.scaleFactor, p.x, p.y);
_graphicsPaths.push(gp);
}
return _graphicsPaths;
}
private function charDistributions_left():void {
updateForDistributions(_offset, true);
updateGlyphPositions();
}
private function charDistributions_right():void {
var ofst:Number = spLength - twScaled - _offset;
updateForDistributions(ofst);
updateGlyphPositions();
}
private function charDistributions_center():void {
var ofst:Number = (spLength - twScaled) / 2;
updateForDistributions(ofst);
updateGlyphPositions();
}
private function charDistributions_justify():void {
updateForDistributions(0);
updateGlyphPositions();
}
private function updateForDistributions(ofst:Number = NaN, forceLeft:Boolean = false):void {
scaleFactor = 1 / (_svgFont.fontInfo.unitsPerEm / _fontSize);
spLength = _spline.getBezierLength();
twScaled = textWidth * scaleFactor;
if(isNaN(ofst)) return;
if(!ofst && !forceLeft){
offsetResult = new Object();
offsetResult.t = 0;
offsetEnd = new Object();
offsetEnd.t = 1;
}
else {
offsetResult = _spline.getDataAtCubicBezierLength(ofst);
offsetEnd = _spline.getDataAtCubicBezierLength(ofst + twScaled);
}
if(twScaled + ofst < spLength) tStep = (offsetEnd.t - offsetResult.t) / twScaled;
else tStep = (1 - offsetResult.t) / twScaled;
tStep *= scaleFactor;
}
private function updateGlyphPositions():void {
var kerningValue:Number = (1000 / _svgFont.fontInfo.unitsPerEm) * _kerning;
glyphPositions = new Object();
glyphPositions.points = new Vector.<Point>();
glyphPositions.angles = new Vector.<Number>();
glyphPositions.scaleFactor = scaleFactor;
var gl:Vector.<SvgGlyph> = glyphs;
var cCount:uint = gl.length;
var currentAdvanceX:Number = 0;
for(var i:int = 0; i < cCount; i++){
var sg:SvgGlyph = gl[i];
var t:Number = offsetResult.t + currentAdvanceX * tStep;
var p:Point = _spline.getPointAt(t);
var angle:Number = -_spline.getSlope(t);
glyphPositions.points.push(p);
glyphPositions.angles.push(angle);
currentAdvanceX += sg.advance + kerningValue;
}
}
} // class
} // pkg
|
package serverProto.fight
{
import com.netease.protobuf.Message;
import com.netease.protobuf.fieldDescriptors.FieldDescriptor$TYPE_INT32;
import com.netease.protobuf.WireType;
import com.netease.protobuf.WritingBuffer;
import com.netease.protobuf.WriteUtils;
import flash.utils.IDataInput;
import com.netease.protobuf.ReadUtils;
import flash.errors.IOError;
public final class ProtoEffectTimeInfo extends Message
{
public static const EFFECT_ID:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("serverProto.fight.ProtoEffectTimeInfo.effect_id","effectId",1 << 3 | WireType.VARINT);
public static const EFFECT_POS:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("serverProto.fight.ProtoEffectTimeInfo.effect_pos","effectPos",2 << 3 | WireType.VARINT);
public static const EFFECT_FRAME_COUNT:FieldDescriptor$TYPE_INT32 = new FieldDescriptor$TYPE_INT32("serverProto.fight.ProtoEffectTimeInfo.effect_frame_count","effectFrameCount",3 << 3 | WireType.VARINT);
private var effect_id$field:int;
private var hasField$0:uint = 0;
private var effect_pos$field:int;
private var effect_frame_count$field:int;
public function ProtoEffectTimeInfo()
{
super();
}
public function clearEffectId() : void
{
this.hasField$0 = this.hasField$0 & 4.294967294E9;
this.effect_id$field = new int();
}
public function get hasEffectId() : Boolean
{
return (this.hasField$0 & 1) != 0;
}
public function set effectId(param1:int) : void
{
this.hasField$0 = this.hasField$0 | 1;
this.effect_id$field = param1;
}
public function get effectId() : int
{
return this.effect_id$field;
}
public function clearEffectPos() : void
{
this.hasField$0 = this.hasField$0 & 4.294967293E9;
this.effect_pos$field = new int();
}
public function get hasEffectPos() : Boolean
{
return (this.hasField$0 & 2) != 0;
}
public function set effectPos(param1:int) : void
{
this.hasField$0 = this.hasField$0 | 2;
this.effect_pos$field = param1;
}
public function get effectPos() : int
{
return this.effect_pos$field;
}
public function clearEffectFrameCount() : void
{
this.hasField$0 = this.hasField$0 & 4.294967291E9;
this.effect_frame_count$field = new int();
}
public function get hasEffectFrameCount() : Boolean
{
return (this.hasField$0 & 4) != 0;
}
public function set effectFrameCount(param1:int) : void
{
this.hasField$0 = this.hasField$0 | 4;
this.effect_frame_count$field = param1;
}
public function get effectFrameCount() : int
{
return this.effect_frame_count$field;
}
override final function writeToBuffer(param1:WritingBuffer) : void
{
var _loc2_:* = undefined;
if(this.hasEffectId)
{
WriteUtils.writeTag(param1,WireType.VARINT,1);
WriteUtils.write$TYPE_INT32(param1,this.effect_id$field);
}
if(this.hasEffectPos)
{
WriteUtils.writeTag(param1,WireType.VARINT,2);
WriteUtils.write$TYPE_INT32(param1,this.effect_pos$field);
}
if(this.hasEffectFrameCount)
{
WriteUtils.writeTag(param1,WireType.VARINT,3);
WriteUtils.write$TYPE_INT32(param1,this.effect_frame_count$field);
}
for(_loc2_ in this)
{
super.writeUnknown(param1,_loc2_);
}
}
override final function readFromSlice(param1:IDataInput, param2:uint) : void
{
/*
* Decompilation error
* Code may be obfuscated
* Tip: You can try enabling "Automatic deobfuscation" in Settings
* Error type: IndexOutOfBoundsException (Index: 3, Size: 3)
*/
throw new flash.errors.IllegalOperationError("Not decompiled due to error");
}
}
}
|
/**
* Created with IntelliJ IDEA.
* User: mobitile
* Date: 7/26/13
* Time: 2:46 PM
* To change this template use File | Settings | File Templates.
*/
package skein.locale.core
{
public interface Parser {
function known(data: Object): Boolean;
function parse(data: Object, BundleContentType: Class): Vector.<Bundle>;
}
}
|
////////////////////////////////////////////////////////////////////////////////
// Copyright 2010 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 org.as3commons.asblocks.parser.core
{
import flash.errors.IllegalOperationError;
import org.as3commons.asblocks.ASBlocksSyntaxError;
/**
* A linked list token implementation.
*
* @author Michael Schmalle
* @copyright Teoti Graphix, LLC
* @productversion 1.0
*/
public class LinkedListToken extends Token
{
//--------------------------------------------------------------------------
//
// Public :: Properties
//
//--------------------------------------------------------------------------
//----------------------------------
// channel
//----------------------------------
/**
* @private
*/
private var _channel:String;
/**
* doc
*/
public function get channel():String
{
if (_channel == null)
{
if (text == "\n" || text == "\n" || text == " ")
return "hidden";
}
return _channel;
}
/**
* @private
*/
public function set channel(value:String):void
{
_channel = value;
}
//----------------------------------
// previous
//----------------------------------
/**
* @private
*/
internal var _previous:LinkedListToken;
/**
* doc
*/
public function get previous():LinkedListToken
{
return _previous;
}
/**
* @private
*/
public function set previous(value:LinkedListToken):void
{
if (this == value)
throw new ASBlocksSyntaxError("Loop detected");
_previous = value;
if (_previous)
{
_previous._next = this;
}
}
//----------------------------------
// next
//----------------------------------
/**
* @private
*/
internal var _next:LinkedListToken;
/**
* doc
*/
public function get next():LinkedListToken
{
return _next;
}
/**
* @private
*/
public function set next(value:LinkedListToken):void
{
if (this == value)
throw new ASBlocksSyntaxError("Loop detected");
_next = value;
if (_next)
{
_next._previous = this;
}
}
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*/
public function LinkedListToken(kind:String,
text:String,
line:int = -1,
column:int = -1)
{
super(text, line, column);
this.kind = kind;
}
//--------------------------------------------------------------------------
//
// Public :: Properties
//
//--------------------------------------------------------------------------
/**
* @private
*/
public function append(insert:LinkedListToken):void
{
if (insert.previous)
throw new IllegalOperationError("append(" + insert + ") : previous was not null");
if (insert.next)
throw new IllegalOperationError("append(" + next + ") : previous was not null");
insert._next = _next;
insert._previous = this;
if (_next)
{
_next._previous = insert;
}
_next = insert;
}
/**
* @private
*/
public function prepend(insert:LinkedListToken):void
{
if (insert.previous)
throw new IllegalOperationError("prepend(" + insert + ") : previous was not null");
if (insert.next)
throw new IllegalOperationError("prepend(" + next + ") : previous was not null");
insert._previous = _previous;
insert._next = this;
if (_previous)
{
_previous._next = insert;
}
_previous = insert;
}
/**
* @private
*/
public function remove():void
{
if (_previous)
{
_previous._next = _next;
}
if (_next)
{
_next._previous = _previous;
}
_next = null;
_previous = null;
}
}
} |
package caurina.transitions.properties {
/**
* properties.FilterShortcuts
* Special properties for the Tweener class to handle MovieClip filters
* The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways.
*
* @author Zeh Fernando, Nate Chatellier, Arthur Debert
* @version 1.0.0
*/
import flash.display.BitmapData;
import flash.filters.BevelFilter;
import flash.filters.BitmapFilter;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.filters.ConvolutionFilter;
import flash.filters.DisplacementMapFilter;
import flash.filters.DropShadowFilter;
import flash.filters.GlowFilter;
import flash.filters.GradientBevelFilter;
import flash.filters.GradientGlowFilter;
import flash.geom.Point;
import caurina.transitions.Tweener;
import caurina.transitions.AuxFunctions;
public class FilterShortcuts {
/**
* There's no constructor.
*/
public function FilterShortcuts () {
trace ("This is an static class and should not be instantiated.")
}
/**
* Registers all the special properties to the Tweener class, so the Tweener knows what to do with them.
*/
public static function init(): void {
// Filter tweening splitter properties
Tweener.registerSpecialPropertySplitter("_filter", _filter_splitter);
// Shortcuts - BevelFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/BevelFilter.html
Tweener.registerSpecialProperty("_Bevel_angle", _filter_property_get, _filter_property_set, [BevelFilter, "angle"]);
Tweener.registerSpecialProperty("_Bevel_blurX", _filter_property_get, _filter_property_set, [BevelFilter, "blurX"]);
Tweener.registerSpecialProperty("_Bevel_blurY", _filter_property_get, _filter_property_set, [BevelFilter, "blurY"]);
Tweener.registerSpecialProperty("_Bevel_distance", _filter_property_get, _filter_property_set, [BevelFilter, "distance"]);
Tweener.registerSpecialProperty("_Bevel_highlightAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "highlightAlpha"]);
Tweener.registerSpecialPropertySplitter("_Bevel_highlightColor", _generic_color_splitter, ["_Bevel_highlightColor_r", "_Bevel_highlightColor_g", "_Bevel_highlightColor_b"]);
Tweener.registerSpecialProperty("_Bevel_highlightColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "r"]);
Tweener.registerSpecialProperty("_Bevel_highlightColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "g"]);
Tweener.registerSpecialProperty("_Bevel_highlightColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "b"]);
Tweener.registerSpecialProperty("_Bevel_knockout", _filter_property_get, _filter_property_set, [BevelFilter, "knockout"]);
Tweener.registerSpecialProperty("_Bevel_quality", _filter_property_get, _filter_property_set, [BevelFilter, "quality"]);
Tweener.registerSpecialProperty("_Bevel_shadowAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "shadowAlpha"]);
Tweener.registerSpecialPropertySplitter("_Bevel_shadowColor", _generic_color_splitter, ["_Bevel_shadowColor_r", "_Bevel_shadowColor_g", "_Bevel_shadowColor_b"]);
Tweener.registerSpecialProperty("_Bevel_shadowColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "r"]);
Tweener.registerSpecialProperty("_Bevel_shadowColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "g"]);
Tweener.registerSpecialProperty("_Bevel_shadowColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "b"]);
Tweener.registerSpecialProperty("_Bevel_strength", _filter_property_get, _filter_property_set, [BevelFilter, "strength"]);
Tweener.registerSpecialProperty("_Bevel_type", _filter_property_get, _filter_property_set, [BevelFilter, "type"]);
// Shortcuts - BlurFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/BlurFilter.html
Tweener.registerSpecialProperty("_Blur_blurX", _filter_property_get, _filter_property_set, [BlurFilter, "blurX"]);
Tweener.registerSpecialProperty("_Blur_blurY", _filter_property_get, _filter_property_set, [BlurFilter, "blurY"]);
Tweener.registerSpecialProperty("_Blur_quality", _filter_property_get, _filter_property_set, [BlurFilter, "quality"]);
// Shortcuts - ColorMatrixFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/ColorMatrixFilter.html
Tweener.registerSpecialPropertySplitter("_ColorMatrix_matrix", _generic_matrix_splitter, [[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0],
["_ColorMatrix_matrix_rr", "_ColorMatrix_matrix_rg", "_ColorMatrix_matrix_rb", "_ColorMatrix_matrix_ra", "_ColorMatrix_matrix_ro",
"_ColorMatrix_matrix_gr", "_ColorMatrix_matrix_gg", "_ColorMatrix_matrix_gb", "_ColorMatrix_matrix_ga", "_ColorMatrix_matrix_go",
"_ColorMatrix_matrix_br", "_ColorMatrix_matrix_bg", "_ColorMatrix_matrix_bb", "_ColorMatrix_matrix_ba", "_ColorMatrix_matrix_bo",
"_ColorMatrix_matrix_ar", "_ColorMatrix_matrix_ag", "_ColorMatrix_matrix_ab", "_ColorMatrix_matrix_aa", "_ColorMatrix_matrix_ao"]]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_rr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 0]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_rg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 1]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_rb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 2]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ra", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 3]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ro", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 4]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_gr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 5]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_gg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 6]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_gb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 7]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ga", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 8]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_go", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 9]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_br", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 10]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_bg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 11]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_bb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 12]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ba", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 13]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_bo", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 14]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ar", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 15]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ag", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 16]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ab", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 17]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_aa", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 18]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ao", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 19]);
// Shortcuts - ConvolutionFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/ConvolutionFilter.html
Tweener.registerSpecialProperty("_Convolution_alpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "alpha"]);
Tweener.registerSpecialProperty("_Convolution_bias", _filter_property_get, _filter_property_set, [ConvolutionFilter, "bias"]);
Tweener.registerSpecialProperty("_Convolution_clamp", _filter_property_get, _filter_property_set, [ConvolutionFilter, "clamp"]);
Tweener.registerSpecialPropertySplitter("_Convolution_color", _generic_color_splitter, ["_Convolution_color_r", "_Convolution_color_g", "_Convolution_color_b"]);
Tweener.registerSpecialProperty("_Convolution_color_r", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "r"]);
Tweener.registerSpecialProperty("_Convolution_color_g", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "g"]);
Tweener.registerSpecialProperty("_Convolution_color_b", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "b"]);
Tweener.registerSpecialProperty("_Convolution_divisor", _filter_property_get, _filter_property_set, [ConvolutionFilter, "divisor"]);
//Tweener.registerSpecialPropertySplitter("_Convolution_matrix", _generic_array_splitter, ["_Convolution_matrix_array"]);
//Tweener.registerSpecialProperty("_Convolution_matrix_array", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrix", "array"]);
Tweener.registerSpecialProperty("_Convolution_matrixX", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixX"]);
Tweener.registerSpecialProperty("_Convolution_matrixY", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixY"]);
Tweener.registerSpecialProperty("_Convolution_preserveAlpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "preserveAlpha"]);
// Shortcuts - DisplacementMapFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/DisplacementMapFilter.html
Tweener.registerSpecialProperty("_DisplacementMap_alpha", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "alpha"]);
Tweener.registerSpecialPropertySplitter("_DisplacementMap_color", _generic_color_splitter, ["_DisplacementMap_color_r", "_DisplacementMap_color_r", "_DisplacementMap_color_r"]);
Tweener.registerSpecialProperty("_DisplacementMap_color_r", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "r"]);
Tweener.registerSpecialProperty("_DisplacementMap_color_g", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "g"]);
Tweener.registerSpecialProperty("_DisplacementMap_color_b", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "b"]);
Tweener.registerSpecialProperty("_DisplacementMap_componentX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentX"]);
Tweener.registerSpecialProperty("_DisplacementMap_componentY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentY"]);
Tweener.registerSpecialProperty("_DisplacementMap_mapBitmap", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapBitmap"]);
Tweener.registerSpecialPropertySplitter("_DisplacementMap_mapPoint",_generic_point_splitter, ["_DisplacementMap_mapPoint_x", "_DisplacementMap_mapPoint_y"]);
Tweener.registerSpecialProperty("_DisplacementMap_mapPoint_x", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint", "point", "x"]);
Tweener.registerSpecialProperty("_DisplacementMap_mapPoint_y", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint", "point", "y"]);
Tweener.registerSpecialProperty("_DisplacementMap_mode", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mode"]);
Tweener.registerSpecialProperty("_DisplacementMap_scaleX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleX"]);
Tweener.registerSpecialProperty("_DisplacementMap_scaleY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleY"]);
// Shortcuts - DropShadowFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/DropShadowFilter.html
Tweener.registerSpecialProperty("_DropShadow_alpha", _filter_property_get, _filter_property_set, [DropShadowFilter, "alpha"]);
Tweener.registerSpecialProperty("_DropShadow_angle", _filter_property_get, _filter_property_set, [DropShadowFilter, "angle"]);
Tweener.registerSpecialProperty("_DropShadow_blurX", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurX"]);
Tweener.registerSpecialProperty("_DropShadow_blurY", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurY"]);
Tweener.registerSpecialPropertySplitter("_DropShadow_color", _generic_color_splitter, ["_DropShadow_color_r", "_DropShadow_color_g", "_DropShadow_color_b"]);
Tweener.registerSpecialProperty("_DropShadow_color_r", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "r"]);
Tweener.registerSpecialProperty("_DropShadow_color_g", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "g"]);
Tweener.registerSpecialProperty("_DropShadow_color_b", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "b"]);
Tweener.registerSpecialProperty("_DropShadow_distance", _filter_property_get, _filter_property_set, [DropShadowFilter, "distance"]);
Tweener.registerSpecialProperty("_DropShadow_hideObject", _filter_property_get, _filter_property_set, [DropShadowFilter, "hideObject"]);
Tweener.registerSpecialProperty("_DropShadow_inner", _filter_property_get, _filter_property_set, [DropShadowFilter, "inner"]);
Tweener.registerSpecialProperty("_DropShadow_knockout", _filter_property_get, _filter_property_set, [DropShadowFilter, "knockout"]);
Tweener.registerSpecialProperty("_DropShadow_quality", _filter_property_get, _filter_property_set, [DropShadowFilter, "quality"]);
Tweener.registerSpecialProperty("_DropShadow_strength", _filter_property_get, _filter_property_set, [DropShadowFilter, "strength"]);
// Shortcuts - GlowFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/GlowFilter.html
Tweener.registerSpecialProperty("_Glow_alpha", _filter_property_get, _filter_property_set, [GlowFilter, "alpha"]);
Tweener.registerSpecialProperty("_Glow_blurX", _filter_property_get, _filter_property_set, [GlowFilter, "blurX"]);
Tweener.registerSpecialProperty("_Glow_blurY", _filter_property_get, _filter_property_set, [GlowFilter, "blurY"]);
Tweener.registerSpecialPropertySplitter("_Glow_color", _generic_color_splitter, ["_Glow_color_r", "_Glow_color_g", "_Glow_color_b"]);
Tweener.registerSpecialProperty("_Glow_color_r", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "r"]);
Tweener.registerSpecialProperty("_Glow_color_g", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "g"]);
Tweener.registerSpecialProperty("_Glow_color_b", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "b"]);
Tweener.registerSpecialProperty("_Glow_inner", _filter_property_get, _filter_property_set, [GlowFilter, "inner"]);
Tweener.registerSpecialProperty("_Glow_knockout", _filter_property_get, _filter_property_set, [GlowFilter, "knockout"]);
Tweener.registerSpecialProperty("_Glow_quality", _filter_property_get, _filter_property_set, [GlowFilter, "quality"]);
Tweener.registerSpecialProperty("_Glow_strength", _filter_property_get, _filter_property_set, [GlowFilter, "strength"]);
// Shortcuts - GradientBevelFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/GradientBevelFilter.html
// .alphas (array)
Tweener.registerSpecialProperty("_GradientBevel_angle", _filter_property_get, _filter_property_set, [GradientBevelFilter, "angle"]);
Tweener.registerSpecialProperty("_GradientBevel_blurX", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurX"]);
Tweener.registerSpecialProperty("_GradientBevel_blurY", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurY"]);
// .colors (array)
Tweener.registerSpecialProperty("_GradientBevel_distance", _filter_property_get, _filter_property_set, [GradientBevelFilter, "distance"]);
Tweener.registerSpecialProperty("_GradientBevel_quality", _filter_property_get, _filter_property_set, [GradientBevelFilter, "quality"]);
// .ratios(array)
Tweener.registerSpecialProperty("_GradientBevel_strength", _filter_property_get, _filter_property_set, [GradientBevelFilter, "strength"]);
Tweener.registerSpecialProperty("_GradientBevel_type", _filter_property_get, _filter_property_set, [GradientBevelFilter, "type"]);
// Shortcuts - GradientGlowFilter
// http://livedocs.adobe.com/flex/2/langref/flash/filters/GradientGlowFilter.html
// .alphas (array)
Tweener.registerSpecialProperty("_GradientGlow_angle", _filter_property_get, _filter_property_set, [GradientGlowFilter, "angle"]);
Tweener.registerSpecialProperty("_GradientGlow_blurX", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurX"]);
Tweener.registerSpecialProperty("_GradientGlow_blurY", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurY"]);
// .colors (array)
Tweener.registerSpecialProperty("_GradientGlow_distance", _filter_property_get, _filter_property_set, [GradientGlowFilter, "distance"]);
Tweener.registerSpecialProperty("_GradientGlow_knockout", _filter_property_get, _filter_property_set, [GradientGlowFilter, "knockout"]);
Tweener.registerSpecialProperty("_GradientGlow_quality", _filter_property_get, _filter_property_set, [GradientGlowFilter, "quality"]);
// .ratios (array)
Tweener.registerSpecialProperty("_GradientGlow_strength", _filter_property_get, _filter_property_set, [GradientGlowFilter, "strength"]);
Tweener.registerSpecialProperty("_GradientGlow_type", _filter_property_get, _filter_property_set, [GradientGlowFilter, "type"]);
}
// ==================================================================================================================================
// PROPERTY GROUPING/SPLITTING functions --------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------------------
// generic splitters
/**
* A generic color splitter - from 0xrrggbb to r, g, b with the name of the parameters passed
*
* @param p_value Number The original _color value
* @return Array An array containing the .name and .value of all new properties
*/
public static function _generic_color_splitter (p_value:Number, p_parameters:Array):Array {
var nArray:Array = new Array();
nArray.push({name:p_parameters[0], value:AuxFunctions.numberToR(p_value)});
nArray.push({name:p_parameters[1], value:AuxFunctions.numberToG(p_value)});
nArray.push({name:p_parameters[2], value:AuxFunctions.numberToB(p_value)});
return nArray;
}
/**
* A generic mapPoint splitter - from Point to x, y with the name of the parameters passed
*
* @param p_value Point The original point
* @return Array An array containing the .name and .value of all new properties
*/
public static function _generic_point_splitter (p_value:Point, p_parameters:Array):Array {
var nArray:Array = new Array();
nArray.push({name:p_parameters[0], value:p_value.x});
nArray.push({name:p_parameters[1], value:p_value.y});
return nArray;
}
/**
* A generic matrix splitter - from [] to items with the name of the parameters passed
*
* @param p_value Array The original matrix
* @return Array An array containing the .name and .value of all new properties
*/
public static function _generic_matrix_splitter (p_value:Array, p_parameters:Array):Array {
if (p_value == null) p_value = p_parameters[0].concat();
var nArray:Array = new Array();
for (var i:Number = 0; i < p_value.length; i++) {
nArray.push({name:p_parameters[1][i], value:p_value[i]});
}
return nArray;
}
/**
* A generic array splitter - from [] to items with the index passed back
*
* @param p_value Array The original array value
* @return Array An array containing the .name and .value of all new properties
*/
/*
public static function _generic_array_splitter (p_value:Array, p_parameters:Array):Array {
if (p_value == null) p_value = p_parameters[0].concat();
var nArray:Array = new Array();
for (var i:Number = 0; i < p_value.length; i++) {
nArray.push({name:p_parameters[1][i], value:p_value[i], arrayIndex:i});
}
return nArray;
}
*/
// ----------------------------------------------------------------------------------------------------------------------------------
// filters
/**
* Splits the _filter, _blur, etc parameter into specific filter variables
*
* @param p_value BitmapFilter A BitmapFilter instance
* @return Array An array containing the .name and .value of all new properties
*/
public static function _filter_splitter (p_value:BitmapFilter, p_parameters:Array, p_extra:Object = null):Array {
var nArray:Array = new Array();
if (p_value is BevelFilter) {
nArray.push({name:"_Bevel_angle", value:BevelFilter(p_value).angle});
nArray.push({name:"_Bevel_blurX", value:BevelFilter(p_value).blurX});
nArray.push({name:"_Bevel_blurY", value:BevelFilter(p_value).blurY});
nArray.push({name:"_Bevel_distance", value:BevelFilter(p_value).distance});
nArray.push({name:"_Bevel_highlightAlpha", value:BevelFilter(p_value).highlightAlpha});
nArray.push({name:"_Bevel_highlightColor", value:BevelFilter(p_value).highlightColor});
nArray.push({name:"_Bevel_knockout", value:BevelFilter(p_value).knockout});
nArray.push({name:"_Bevel_quality", value:BevelFilter(p_value).quality});
nArray.push({name:"_Bevel_shadowAlpha", value:BevelFilter(p_value).shadowAlpha});
nArray.push({name:"_Bevel_shadowColor", value:BevelFilter(p_value).shadowColor});
nArray.push({name:"_Bevel_strength", value:BevelFilter(p_value).strength});
nArray.push({name:"_Bevel_type", value:BevelFilter(p_value).type});
} else if (p_value is BlurFilter) {
nArray.push({name:"_Blur_blurX", value:BlurFilter(p_value).blurX});
nArray.push({name:"_Blur_blurY", value:BlurFilter(p_value).blurY});
nArray.push({name:"_Blur_quality", value:BlurFilter(p_value).quality});
} else if (p_value is ColorMatrixFilter) {
nArray.push({name:"_ColorMatrix_matrix", value:ColorMatrixFilter(p_value).matrix});
} else if (p_value is ConvolutionFilter) {
nArray.push({name:"_Convolution_alpha", value:ConvolutionFilter(p_value).alpha});
nArray.push({name:"_Convolution_bias", value:ConvolutionFilter(p_value).bias});
nArray.push({name:"_Convolution_clamp", value:ConvolutionFilter(p_value).clamp});
nArray.push({name:"_Convolution_color", value:ConvolutionFilter(p_value).color});
// .matrix
nArray.push({name:"_Convolution_divisor", value:ConvolutionFilter(p_value).divisor});
nArray.push({name:"_Convolution_matrixX", value:ConvolutionFilter(p_value).matrixX});
nArray.push({name:"_Convolution_matrixY", value:ConvolutionFilter(p_value).matrixY});
nArray.push({name:"_Convolution_preserveAlpha", value:ConvolutionFilter(p_value).preserveAlpha});
} else if (p_value is DisplacementMapFilter) {
nArray.push({name:"_DisplacementMap_alpha", value:DisplacementMapFilter(p_value).alpha});
nArray.push({name:"_DisplacementMap_color", value:DisplacementMapFilter(p_value).color});
nArray.push({name:"_DisplacementMap_componentX", value:DisplacementMapFilter(p_value).componentX});
nArray.push({name:"_DisplacementMap_componentY", value:DisplacementMapFilter(p_value).componentY});
nArray.push({name:"_DisplacementMap_mapBitmap", value:DisplacementMapFilter(p_value).mapBitmap});
nArray.push({name:"_DisplacementMap_mapPoint", value:DisplacementMapFilter(p_value).mapPoint});
nArray.push({name:"_DisplacementMap_mode", value:DisplacementMapFilter(p_value).mode});
nArray.push({name:"_DisplacementMap_scaleX", value:DisplacementMapFilter(p_value).scaleX});
nArray.push({name:"_DisplacementMap_scaleY", value:DisplacementMapFilter(p_value).scaleY});
} else if (p_value is DropShadowFilter) {
nArray.push({name:"_DropShadow_alpha", value:DropShadowFilter(p_value).alpha});
nArray.push({name:"_DropShadow_angle", value:DropShadowFilter(p_value).angle});
nArray.push({name:"_DropShadow_blurX", value:DropShadowFilter(p_value).blurX});
nArray.push({name:"_DropShadow_blurY", value:DropShadowFilter(p_value).blurY});
nArray.push({name:"_DropShadow_color", value:DropShadowFilter(p_value).color});
nArray.push({name:"_DropShadow_distance", value:DropShadowFilter(p_value).distance});
nArray.push({name:"_DropShadow_hideObject", value:DropShadowFilter(p_value).hideObject});
nArray.push({name:"_DropShadow_inner", value:DropShadowFilter(p_value).inner});
nArray.push({name:"_DropShadow_knockout", value:DropShadowFilter(p_value).knockout});
nArray.push({name:"_DropShadow_quality", value:DropShadowFilter(p_value).quality});
nArray.push({name:"_DropShadow_strength", value:DropShadowFilter(p_value).strength});
} else if (p_value is GlowFilter) {
nArray.push({name:"_Glow_alpha", value:GlowFilter(p_value).alpha});
nArray.push({name:"_Glow_blurX", value:GlowFilter(p_value).blurX});
nArray.push({name:"_Glow_blurY", value:GlowFilter(p_value).blurY});
nArray.push({name:"_Glow_color", value:GlowFilter(p_value).color});
nArray.push({name:"_Glow_inner", value:GlowFilter(p_value).inner});
nArray.push({name:"_Glow_knockout", value:GlowFilter(p_value).knockout});
nArray.push({name:"_Glow_quality", value:GlowFilter(p_value).quality});
nArray.push({name:"_Glow_strength", value:GlowFilter(p_value).strength});
} else if (p_value is GradientBevelFilter) {
// .alphas (array)
nArray.push({name:"_GradientBevel_angle", value:GradientBevelFilter(p_value).strength});
nArray.push({name:"_GradientBevel_blurX", value:GradientBevelFilter(p_value).blurX});
nArray.push({name:"_GradientBevel_blurY", value:GradientBevelFilter(p_value).blurY});
// .colors (array)
nArray.push({name:"_GradientBevel_distance", value:GradientBevelFilter(p_value).distance});
nArray.push({name:"_GradientBevel_quality", value:GradientBevelFilter(p_value).quality});
// .ratios(array)
nArray.push({name:"_GradientBevel_strength", value:GradientBevelFilter(p_value).strength});
nArray.push({name:"_GradientBevel_type", value:GradientBevelFilter(p_value).type});
} else if (p_value is GradientGlowFilter) {
// .alphas (array)
nArray.push({name:"_GradientGlow_angle", value:GradientGlowFilter(p_value).strength});
nArray.push({name:"_GradientGlow_blurX", value:GradientGlowFilter(p_value).blurX});
nArray.push({name:"_GradientGlow_blurY", value:GradientGlowFilter(p_value).blurY});
// .colors (array)
nArray.push({name:"_GradientGlow_distance", value:GradientGlowFilter(p_value).distance});
nArray.push({name:"_GradientGlow_knockout", value:GradientGlowFilter(p_value).knockout});
nArray.push({name:"_GradientGlow_quality", value:GradientGlowFilter(p_value).quality});
// .ratios(array)
nArray.push({name:"_GradientGlow_strength", value:GradientGlowFilter(p_value).strength});
nArray.push({name:"_GradientGlow_type", value:GradientGlowFilter(p_value).type});
} else {
// ?
trace ("Tweener FilterShortcuts Error :: Unknown filter class used");
}
return nArray;
}
// ==================================================================================================================================
// NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------------------
// filters
/**
* (filters)
* Generic function for the properties of filter objects
*/
public static function _filter_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number {
var f:Array = p_obj.filters;
var i:Number;
var filterClass:Object = p_parameters[0];
var propertyName:String = p_parameters[1];
var splitType:String = p_parameters[2];
for (i = 0; i < f.length; i++) {
if (f[i] is Class(filterClass)) {
if (splitType == "color") {
// Composite, color channel
var colorComponent:String = p_parameters[3];
if (colorComponent == "r") return AuxFunctions.numberToR(f[i][propertyName]);
if (colorComponent == "g") return AuxFunctions.numberToG(f[i][propertyName]);
if (colorComponent == "b") return AuxFunctions.numberToB(f[i][propertyName]);
} else if (splitType == "matrix") {
// Composite, some kind of matrix
return f[i][propertyName][p_parameters[3]];
} else if (splitType == "point") {
// Composite, a point
return f[i][propertyName][p_parameters[3]];
} else {
// Standard property
return (f[i][propertyName]);
}
}
}
// No value found for this property - no filter instance found using this class!
// Must return default desired values
var defaultValues:Object;
switch (filterClass) {
case BevelFilter:
defaultValues = {angle:NaN, blurX:0, blurY:0, distance:0, highlightAlpha:1, highlightColor:NaN, knockout:null, quality:NaN, shadowAlpha:1, shadowColor:NaN, strength:2, type:null};
break;
case BlurFilter:
defaultValues = {blurX:0, blurY:0, quality:NaN};
break;
case ColorMatrixFilter:
defaultValues = {matrix:[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]};
break;
case ConvolutionFilter:
defaultValues = {alpha:0, bias:0, clamp:null, color:NaN, divisor:1, matrix:[1], matrixX:1, matrixY:1, preserveAlpha:null};
break;
case DisplacementMapFilter:
defaultValues = {alpha:0, color:NaN, componentX:null, componentY:null, mapBitmap:null, mapPoint:null, mode:null, scaleX:0, scaleY:0};
break;
case DropShadowFilter:
defaultValues = {distance:0, angle:NaN, color:NaN, alpha:1, blurX:0, blurY:0, strength:1, quality:NaN, inner:null, knockout:null, hideObject:null};
break;
case GlowFilter:
defaultValues = {alpha:1, blurX:0, blurY:0, color:NaN, inner:null, knockout:null, quality:NaN, strength:2};
break;
case GradientBevelFilter:
defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null};
break;
case GradientGlowFilter:
defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null};
break;
}
// When returning NaN, the Tweener engine sets the starting value as being the same as the final value (if not found)
// When returning null, the Tweener engine doesn't tween it at all, just setting it to the final value
// This is DIFFERENT from the default filter applied as default on _filter_property_set because some values shouldn't be tweened
if (splitType == "color") {
// Composite, color channel; always defaults to target value
return NaN;
} else if (splitType == "matrix") {
// Composite, matrix; always defaults to target value
return defaultValues[propertyName][p_parameters[3]];
} else if (splitType == "point") {
// Composite, point; always defaults to target value
return defaultValues[propertyName][p_parameters[3]];
} else {
// Standard property
return defaultValues[propertyName];
}
}
public static function _filter_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void {
var f:Array = p_obj.filters;
var i:Number;
var filterClass:Object = p_parameters[0];
var propertyName:String = p_parameters[1];
var splitType:String = p_parameters[2];
for (i = 0; i < f.length; i++) {
if (f[i] is Class(filterClass)) {
if (splitType == "color") {
// Composite, color channel
var colorComponent:String = p_parameters[3];
if (colorComponent == "r") f[i][propertyName] = (f[i][propertyName] & 0xffff) | (p_value << 16);
if (colorComponent == "g") f[i][propertyName] = (f[i][propertyName] & 0xff00ff) | (p_value << 8);
if (colorComponent == "b") f[i][propertyName] = (f[i][propertyName] & 0xffff00) | p_value;
} else if (splitType == "matrix") {
var mtx:Array = f[i][propertyName];
mtx[p_parameters[3]] = p_value;
f[i][propertyName] = mtx;
} else if (splitType == "point") {
var pt:Point = Point(f[i][propertyName]);
pt[p_parameters[3]] = p_value;
f[i][propertyName] = pt;
} else {
// Standard property
f[i][propertyName] = p_value;
}
p_obj.filters = f;
return;
}
}
// The correct filter class wasn't found, so create a new one that is the equivalent of the object without the filter
if (f == null) f = new Array();
var fi:BitmapFilter;
switch (filterClass) {
case BevelFilter:
fi = new BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, 0, 0);
break;
case BlurFilter:
fi = new BlurFilter(0, 0);
break;
case ColorMatrixFilter:
fi = new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]);
break;
case ConvolutionFilter:
fi = new ConvolutionFilter(1, 1, [1], 1, 0, true, true, 0x000000, 0);
break;
case DisplacementMapFilter:
// Doesn't make much sense to create a new empty DisplacementMapFilter if there's nothing to tween
fi = new DisplacementMapFilter(new BitmapData(10, 10), new Point(0, 0), 0, 1, 0, 0);
break;
case DropShadowFilter:
fi = new DropShadowFilter(0, 45, 0x000000, 1, 0, 0);
break;
case GlowFilter:
fi = new GlowFilter(0xff0000, 1, 0, 0);
break;
case GradientBevelFilter:
fi = new GradientBevelFilter(0, 45, [0xffffff, 0x000000], [1, 1], [32, 223], 0, 0);
break;
case GradientGlowFilter:
fi = new GradientGlowFilter(0, 45, [0xffffff, 0x000000], [1, 1], [32, 223], 0, 0);
break;
}
//fi[propertyName] = p_value;
f.push(fi);
p_obj.filters = f;
_filter_property_set(p_obj, p_value, p_parameters);
}
}
}
|
package gamestone.graphics {
import flash.geom.Point;
import gamestone.display.MySprite;
public class ImgInitParams{
public var id:String;
public var file:String;
public var slices:Array;
public var hasSliceDimensions:Boolean;
public var pivotPoint:Point;
public var startLoading:Boolean = true;
public var groups:Array;
public var className:String;
public var embeded:Boolean;
public function ImgInitParams() {
hasSliceDimensions = false;
slices = [1, 1];
pivotPoint = MySprite.POINT_0;
}
}
} |
package samples.imageSearch
{
public class ImageResult
{
private var _url : String;
private var _thumbnailUrl : String;
private var _description : String;
public function ImageResult(url : String, thumbnailUrl : String, description : String)
{
this._url = url;
this._thumbnailUrl = thumbnailUrl;
this._description = description;
}
public function get url() : String { return _url; }
public function get thumbnailUrl() : String { return _thumbnailUrl; }
public function get description() : String { return _description; }
}
} |
package com.lorentz.SVG.display.base
{
public interface ISVGPreserveAspectRatio
{
function get svgPreserveAspectRatio():String;
function set svgPreserveAspectRatio(value:String):void;
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// 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.automation.tool
{
import flash.utils.Timer;
public class RecordingHandler
{
/*
private static var requestsQueue:Array; // array of request data to be processed one after the other.
// this is to ensure that data will be sent synchronously one after the other.
// please note that in such cases we should not expect request back from the client. (other than
// for the incomplete processing.
// if we expect so, we need to figure out some other methods. // like we can indicate proceed to next only
// after recieveing an x data request from app.
private static var currentDataFromAppToAgent:ApplicationDataToAgent;
private static var responseRecieved:Boolean = false;
private static var currentSocketEvent:SocketResponseEvent;
private static var isInPartDataProcessing:Boolean = false;
public function RecordingHandler()
{
}
public static function addToRecordRequestQueue1(requestObject:RequestData):int
{
// this is to handle the multiple requests which needs to be
// processed for the record operation.
if( !requestsQueue)
requestsQueue = new Array();
return requestsQueue.push(requestObject);
}
public static function processQueuedRecordRequestsFromRecordHandler(socket:CustomSocket ,currentApplicationId:String,fromAgent:Boolean = false):Boolean
{
var processed:Boolean = false;
// we will be getting this request only from the agent,].
// we should only only process the current request and return the fucntion thread
// back to the agent.
// socket transfer is asynchronous.
// by the logic here, we are trying to make it synchronous.
if(requestsQueue)
{
while(requestsQueue.length)
{
// get the current request
var currentRequest:RequestData = requestsQueue.shift();
sendData(socket,currentApplicationId,currentRequest.requestID, currentRequest.requestData);
}
}
return processed;
}
private static function sendRecordData(socket:CustomSocket,currentApplicationId:String, requestIdentifier:String,dataString:String):void
{
if(!dataString)
dataString = ClientSocketHandler.nullValueIndicator;
if(!currentDataFromAppToAgent)
currentDataFromAppToAgent = new ApplicationDataToAgent(currentApplicationId,requestIdentifier,dataString);
else
currentDataFromAppToAgent.init(currentApplicationId,requestIdentifier,dataString);
do
{
if(currentDataFromAppToAgent.willDataBePendingAfterNextSend())
isInPartDataProcessing = true;
else
isInPartDataProcessing = false;
var currentDataToBeSent:String = currentDataFromAppToAgent.getNextFormattedData(requestIdentifier, isInPartDataProcessing);
socket.sendRequestString(currentDataToBeSent, true);
socket.flush();
var responseString:String = socket.getResponse();
var tempTimer:Timer = new Timer(1000, 0);
tempTimer.start();
responseString = socket.getResponse();
// we will only send the data to the socket and wait for the feedback
//responseRecieved = false;
//while(responseRecieved == false)
//{
// var tempTimer:Timer = new Timer(500, 0);
// tempTimer.start();
//}
}while(isInPartDataProcessing)
}
// public static function checkTimer
public static function handleResponse(event:SocketResponseEvent):void
{
// we need to process here only if the current response is from recording
if(event.isInRecordProcessing)
{
responseRecieved = true;
currentSocketEvent =SocketResponseEvent( event.clone());
}
}
*/
}
} |
package assets.components
{
import com.hp.asi.hpic4vc.ui.Hpic4vc_providerProxy;
import com.hp.asi.hpic4vc.ui.Hpic4vc_server_providerProxy;
import com.hp.asi.hpic4vc.ui.model.SmartComponentUpdateModel;
import com.hp.asi.hpic4vc.ui.utils.Helper;
import com.vmware.core.model.IResourceReference;
import com.vmware.flexutil.events.MethodReturnEvent;
import com.vmware.usersession.ServerInfo;
import com.vmware.vsphere.client.util.UserSessionManager;
import flash.events.TimerEvent;
import flash.utils.Timer;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.core.IFactory;
import mx.logging.ILogger;
import mx.logging.Log;
public class Hpic4vc_SoftwareFirmware_StatusMesgMediator extends Hpic4vc_BaseMediator
{
private var _view:Hpic4vc_SmartComponentUpdate_StatusMessages;
private var _proxyServer:Hpic4vc_server_providerProxy;
private var _proxy:Hpic4vc_providerProxy;
private var serviceGuid:String;
private var count:int = 0;
[Bindable]
private var getSmartComponentupdateTimer:Timer;
[Bindable]
public var smartComponentUpdateModel:SmartComponentUpdateModel;
private static var _logger:ILogger = Log.getLogger("Hpic4vc_SoftwareFirmware_StatusMesgMediator");
[View]
/**
* The mediator's view.
*/
public function get view():Hpic4vc_SmartComponentUpdate_StatusMessages {
return _view;
}
/** @private */
public function set view(value:Hpic4vc_SmartComponentUpdate_StatusMessages):void {
_view = value;
_view._mediator = this;
_proxyServer = new Hpic4vc_server_providerProxy();
_proxy = new Hpic4vc_providerProxy();
_view._proxyServer = _proxyServer;
if(_view!=null)
requestData();
}
override protected function clearData():void {
_view = null;
}
override protected function requestData():void {
serviceGuid = (UserSessionManager.instance.userSession.serversInfo[0] as ServerInfo).serviceGuid;
if (_contextObject != null) {
_logger.debug("Requesting HPIC4VC data.");
_proxyServer.getSmartComponentUpdateStatusMessages(_contextObject.uid,onGettingSmartComponentUpdateStatusMessages,_contextObject);
startimer();
} else {
_logger.warn("ContextObject is null, hence not requesting data.");
return;
}
}
private function getSmartComponentUpdateMessages(timer:TimerEvent):void{
if(_view!=null){
if (_contextObject != null) {
_proxyServer.getSmartComponentUpdateStatusMessages(_contextObject.uid,onGettingSmartComponentUpdateStatusMessages,_contextObject);
}
}else {
stopTimer();
}
}
private function startimer():void{
getSmartComponentupdateTimer = new Timer(10000);
getSmartComponentupdateTimer.addEventListener(TimerEvent.TIMER, getSmartComponentUpdateMessages);
getSmartComponentupdateTimer.start();
}
private function stopTimer():void
{
if(getSmartComponentupdateTimer)
{
getSmartComponentupdateTimer.stop();
getSmartComponentupdateTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, getSmartComponentUpdateMessages);
getSmartComponentupdateTimer = null;
}
}
public function selectDeleteHandlerMore(obj:Object):void{
_proxyServer.deleteSelectedComponentJob(_contextObject.uid,obj.toString(),onGettingDeletedMessage,_contextObject);
}
public function onGettingDeletedMessage(event:MethodReturnEvent):void {
var temp:SmartComponentUpdateModel;
if (event != null && event.result) {
temp= event.result as SmartComponentUpdateModel;
if(temp.updateSoftwareComponentMessageModel != null){
Alert.show(temp.updateSoftwareComponentMessageModel.message);
}else {
_view.smartComponentUpdateModel = event.result as SmartComponentUpdateModel;
_view.jobsGroup.dataProvider = _view.smartComponentUpdateModel.jobs;
_view.queueGroup.dataProvider = _view.smartComponentUpdateModel.queue;
(_view.jobsGroup.dataProvider as ArrayCollection).refresh();
(_view.queueGroup.dataProvider as ArrayCollection).refresh();
_view.jobsGroup.invalidateDisplayList();
_view.queueGroup.invalidateDisplayList();
_view.liveStatusUpdateBox.invalidateDisplayList();
}
}
}
private function onGettingSmartComponentUpdateStatusMessages(event:MethodReturnEvent):void {
if (_view != null) {
_logger.debug("Received HPIC4VC server credentials data in onGettingCredentialsPage()");
if (event == null) {
_view.noRecordsFoundLabel = Helper.getString("noRecordsFound");
return;
} else if (event.error != null) {
if (event.error.toString().match("DeliveryInDoubt")) {
_logger.warn("DeliveryInDoubt exception occurred. Count: " + count.toString());
// Re try to request data for not more than 2 times
if (count < 2) {
count ++;
requestData();
return;
} else {
_view.errorFoundLabel = event.error.message;
return;
}
} else {
_view.errorFoundLabel = event.error.message;
return;
}
} else if (event.result == null) {
_view.errorFoundLabel = Helper.getString("noRecordsFound");
return;
}
_view.smartComponentUpdateModel= event.result as SmartComponentUpdateModel;
_view.jobsGroup.dataProvider = null;
_view.queueGroup.dataProvider = null;
var _itemrenderer:IFactory = _view.jobsGroup.itemRenderer;
_view.jobsGroup.itemRenderer = null;
_view.jobsGroup.itemRenderer = _itemrenderer;
_view.jobsGroup.dataProvider = _view.smartComponentUpdateModel.jobs;
_view.queueGroup.dataProvider = _view.smartComponentUpdateModel.queue;
(_view.jobsGroup.dataProvider as ArrayCollection).refresh();
(_view.queueGroup.dataProvider as ArrayCollection).refresh();
_view.jobsGroup.invalidateDisplayList();
_view.queueGroup.invalidateDisplayList();
}
}
}
} |
package com.syndrome.sanguo.battle.mediator
{
import com.syndrome.sanguo.battle.combat_ui.stagegroup.group2D.Scence2DCantainer;
import com.syndrome.sanguo.battle.common.UserInfo;
import net.IProtocolhandler;
/**
* 超时数量展示
*/
public class CountTime implements IProtocolhandler
{
public function CountTime()
{
}
public function handle(message:Object):void
{
var countTimeout:int = message["countTimeout"];
var playerName:String =message["playerName"];
Scence2DCantainer.getInstance().setTimeOutCount(countTimeout , UserInfo.myUserName == playerName);
}
}
} |
/**
* Created with IntelliJ IDEA.
* User: mobitile
* Date: 10/18/13
* Time: 11:36 AM
* To change this template use File | Settings | File Templates.
*/
package skein.rest.core
{
import skein.rest.core.coding.DefaultCoding;
import skein.rest.core.coding.JSONCoding;
import skein.rest.core.coding.WWWFormCoding;
public class Decoder
{
public static function forType(contentType: String): Function {
switch (contentType) {
case "application/json" :
return JSONCoding.decode;
case "application/x-www-form-urlencoded" :
return WWWFormCoding.decode;
default :
return DefaultCoding.decode;
}
}
}
}
|
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////
FIVe3D v2.0 - 2008-04-14
Flash Interactive Vector-based 3D
Mathieu Badimon | five3d.mathieu-badimon.com | www.mathieu-badimon.com | contact@mathieu-badimon.com
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////
package org.papervision3d.typography.fonts {
import org.papervision3d.typography.Font3D;
public class HelveticaLight extends Font3D{
static public var __motifs:Object = {};
static public var __widths:Object = {};
static public var __height:Number = 118;
static public var __initialized:Boolean = false;
static public function initialize():void {
initializeMotifsUppercase();
initializeMotifsLowercase();
initializeMotifsNumbers();
initializeMotifsPunctuation();
initializeWidthsUppercase();
initializeWidthsLowercase();
initializeWidthsNumbers();
initializeWidthsPunctuation();
__initialized = true;
}
////////////////////////////////////////////
override public function get motifs():Object
{
if(!__initialized)initialize();
return __motifs;
}
override public function get widths():Object
{
if(!__initialized)initialize();
return __widths;
}
override public function get height():Number
{
if(!__initialized)initialize();
return __height;
}
////////////////////////////////////////////
static private function initializeMotifsUppercase():void {
__motifs["A"] = [['M',[45.4,68.65]],['L',[17.35,68.65]],['L',[31.65,32.1]],['L',[45.4,68.65]],['M',[28.15,25.3]],['L',[-0.7,96.7]],['L',[6.65,96.7]],['L',[15.25,74.5]],['L',[47.7,74.5]],['L',[56.4,96.7]],['L',[63.7,96.7]],['L',[35.75,25.3]],['L',[28.15,25.3]]];
__motifs["B"] = [['M',[37.4,62.4]],['C',[46.4,62.4,51.25,65.9]],['C',[56.15,69.35,56.2,76.2]],['C',[56.15,81.85,53.55,85.1]],['C',[51.05,88.35,46.8,89.65]],['C',[42.55,91,37.4,90.9]],['L',[14,90.9]],['L',[14,62.4]],['L',[37.4,62.4]],['M',[53.5,44.5]],['C',[53.5,47.9,51.75,50.65]],['C',[50,53.35,46.45,54.95]],['C',[42.85,56.55,37.4,56.6]],['L',[14,56.6]],['L',[14,31.1]],['L',[37.4,31.1]],['C',[45.35,31.1,49.45,34.5]],['C',[53.5,37.85,53.5,44.5]],['M',[57.05,32.4]],['C',[53.85,28.55,48.7,26.9]],['C',[43.5,25.25,37.4,25.3]],['L',[7.25,25.3]],['L',[7.25,96.7]],['L',[37.4,96.7]],['C',[46.05,96.6,51.15,94.5]],['C',[56.35,92.35,58.9,89.1]],['C',[61.45,85.85,62.25,82.45]],['C',[63.05,79,63,76.4]],['C',[62.9,69.35,58.9,64.65]],['C',[54.9,60.05,47.9,59]],['L',[47.9,58.8]],['C',[51.6,58,54.4,55.65]],['C',[57.2,53.3,58.75,49.9]],['C',[60.25,46.6,60.3,42.8]],['C',[60.2,36.2,57.05,32.4]]];
__motifs["C"] = [['M',[60.95,34.25]],['C',[56.75,29.1,50.55,26.45]],['C',[44.35,23.8,37.5,23.8]],['C',[29.05,23.85,22.75,26.9]],['C',[16.4,29.9,12.2,35.1]],['C',[8,40.3,5.9,46.95]],['C',[3.8,53.65,3.8,61]],['C',[3.8,68.4,5.9,75.05]],['C',[8,81.7,12.2,86.95]],['C',[16.4,92.1,22.75,95.15]],['C',[29.05,98.15,37.5,98.2]],['C',[45.9,98.15,52.2,94.65]],['C',[58.5,91.15,62.35,84.75]],['C',[66.2,78.3,67.2,69.5]],['L',[60.4,69.5]],['C',[59.7,75.95,56.8,81.1]],['C',[53.9,86.25,49,89.3]],['C',[44.1,92.35,37.5,92.4]],['C',[30.4,92.35,25.3,89.7]],['C',[20.2,87.05,16.95,82.55]],['C',[13.65,78.05,12.15,72.5]],['C',[10.6,66.9,10.6,61]],['C',[10.6,55.1,12.15,49.55]],['C',[13.65,43.95,16.95,39.45]],['C',[20.2,35,25.3,32.3]],['C',[30.4,29.65,37.5,29.6]],['C',[42.7,29.6,47.25,31.65]],['C',[51.75,33.65,55,37.5]],['C',[58.15,41.4,59.4,46.9]],['L',[66.2,46.9]],['C',[65.2,39.4,60.95,34.25]]];
__motifs["D"] = [['M',[28.5,31.1]],['C',[43.8,30.95,50.9,38.05]],['C',[58,45.15,57.9,61]],['C',[58,76.9,50.9,83.95]],['C',[43.8,91.1,28.5,90.9]],['L',[14,90.9]],['L',[14,31.1]],['L',[28.5,31.1]],['M',[7.25,25.3]],['L',[7.25,96.7]],['L',[31.95,96.7]],['C',[48.05,96.3,56.35,87.4]],['C',[64.65,78.55,64.7,61]],['C',[64.65,43.5,56.35,34.6]],['C',[48.05,25.7,31.95,25.3]],['L',[7.25,25.3]]];
__motifs["E"] = [['M',[56.5,25.3]],['L',[7.25,25.3]],['L',[7.25,96.7]],['L',[57.05,96.7]],['L',[57.05,90.9]],['L',[14,90.9]],['L',[14,62.7]],['L',[53.8,62.7]],['L',[53.8,56.9]],['L',[14,56.9]],['L',[14,31.1]],['L',[56.5,31.1]],['L',[56.5,25.3]]];
__motifs["F"] = [['M',[52.5,25.3]],['L',[7.25,25.3]],['L',[7.25,96.7]],['L',[14,96.7]],['L',[14,62.7]],['L',[48.2,62.7]],['L',[48.2,56.9]],['L',[14,56.9]],['L',[14,31.1]],['L',[52.5,31.1]],['L',[52.5,25.3]]];
__motifs["G"] = [['M',[57.2,39.25]],['C',[60,43.3,60.5,47.5]],['L',[67.3,47.5]],['C',[65.9,39.65,61.75,34.45]],['C',[57.55,29.15,51.3,26.5]],['C',[45.05,23.8,37.5,23.8]],['C',[29.05,23.85,22.75,26.9]],['C',[16.4,29.9,12.2,35.1]],['C',[8,40.3,5.9,46.95]],['C',[3.8,53.6,3.8,60.95]],['C',[3.8,68.4,5.9,75]],['C',[8,81.7,12.2,86.95]],['C',[16.4,92.1,22.75,95.15]],['C',[29.05,98.15,37.5,98.2]],['C',[42.7,98.2,47.4,96.7]],['C',[52.15,95.2,55.95,92]],['C',[59.75,88.8,62.2,83.7]],['L',[62.4,83.7]],['L',[63.3,96.7]],['L',[68.2,96.7]],['L',[68.2,60.35]],['L',[37.9,60.35]],['L',[37.9,66.2]],['L',[62.2,66.2]],['C',[62.3,73.8,59.4,79.7]],['C',[56.55,85.6,51,89]],['C',[45.4,92.35,37.5,92.4]],['C',[30.4,92.35,25.35,89.65]],['C',[20.2,87.05,16.95,82.55]],['C',[13.65,78.05,12.15,72.5]],['C',[10.6,66.9,10.6,60.95]],['C',[10.6,55.05,12.15,49.5]],['C',[13.65,43.9,16.95,39.4]],['C',[20.2,35,25.35,32.3]],['C',[30.4,29.65,37.5,29.6]],['C',[44.35,29.7,49.3,32.45]],['C',[54.3,35.15,57.2,39.25]]];
__motifs["H"] = [['M',[56.4,25.3]],['L',[56.4,56.25]],['L',[14,56.25]],['L',[14,25.3]],['L',[7.25,25.3]],['L',[7.25,96.7]],['L',[14,96.7]],['L',[14,62.1]],['L',[56.4,62.1]],['L',[56.4,96.7]],['L',[63.2,96.7]],['L',[63.2,25.3]],['L',[56.4,25.3]]];
__motifs["I"] = [['M',[7.7,25.3]],['L',[7.7,96.7]],['L',[14.5,96.7]],['L',[14.5,25.3]],['L',[7.7,25.3]]];
__motifs["J"] = [['M',[2.1,73.8]],['C',[1.95,80.1,3.55,85.65]],['C',[5.2,91.2,9.5,94.65]],['C',[13.85,98.1,21.95,98.2]],['C',[29.65,98.2,34.25,95.85]],['C',[38.8,93.55,40.8,88.8]],['C',[42.8,84.05,42.75,76.85]],['L',[42.75,25.3]],['L',[36,25.3]],['L',[36,73.9]],['C',[36.05,80.45,34.85,84.55]],['C',[33.7,88.6,30.75,90.55]],['C',[27.85,92.45,22.6,92.4]],['C',[17.4,92.35,14.5,90.35]],['C',[11.65,88.4,10.5,85.4]],['C',[9.4,82.4,9.15,79.25]],['C',[8.9,76.2,8.9,73.8]],['L',[2.1,73.8]]];
__motifs["K"] = [['M',[55.5,25.3]],['L',[14,63.7]],['L',[14,25.3]],['L',[7.25,25.3]],['L',[7.25,96.7]],['L',[14,96.7]],['L',[14,72.2]],['L',[27.75,59.5]],['L',[57.4,96.7]],['L',[66.2,96.7]],['L',[32.8,54.8]],['L',[64.7,25.3]],['L',[55.5,25.3]]];
__motifs["L"] = [['M',[7.25,25.3]],['L',[7.25,96.7]],['L',[54,96.7]],['L',[54,90.9]],['L',[14,90.9]],['L',[14,25.3]],['L',[7.25,25.3]]];
__motifs["M"] = [['M',[69.5,35.05]],['L',[69.5,96.7]],['L',[76.25,96.7]],['L',[76.25,25.3]],['L',[66.3,25.3]],['L',[41.7,87.9]],['L',[16.95,25.3]],['L',[7,25.3]],['L',[7,96.7]],['L',[13.75,96.7]],['L',[13.75,35.05]],['L',[13.95,35.05]],['L',[38.5,96.7]],['L',[44.85,96.7]],['L',[69.3,35.05]],['L',[69.5,35.05]]];
__motifs["N"] = [['M',[56.5,25.3]],['L',[56.5,85.7]],['L',[56.3,85.7]],['L',[14.7,25.3]],['L',[7.15,25.3]],['L',[7.15,96.7]],['L',[13.9,96.7]],['L',[13.9,36.3]],['L',[14.1,36.3]],['L',[55.7,96.7]],['L',[63.3,96.7]],['L',[63.3,25.3]],['L',[56.5,25.3]]];
__motifs["O"] = [['M',[57.55,39.45]],['C',[60.85,43.95,62.35,49.55]],['C',[63.9,55.1,63.9,61]],['C',[63.9,66.9,62.35,72.5]],['C',[60.85,78.05,57.55,82.55]],['C',[54.3,87.05,49.2,89.7]],['C',[44.15,92.35,37.1,92.4]],['C',[30.05,92.35,24.95,89.7]],['C',[19.8,87.05,16.55,82.55]],['C',[13.3,78.05,11.75,72.5]],['C',[10.2,66.9,10.2,61]],['C',[10.2,55.1,11.75,49.55]],['C',[13.3,43.95,16.55,39.45]],['C',[19.8,35,24.95,32.3]],['C',[30.05,29.65,37.1,29.6]],['C',[44.15,29.65,49.2,32.3]],['C',[54.3,35,57.55,39.45]],['M',[62.3,35.1]],['C',[58.1,29.9,51.8,26.9]],['C',[45.5,23.85,37.1,23.8]],['C',[28.65,23.85,22.35,26.9]],['C',[16,29.9,11.8,35.1]],['C',[7.6,40.3,5.5,46.95]],['C',[3.4,53.65,3.4,61]],['C',[3.4,68.4,5.5,75.05]],['C',[7.6,81.7,11.8,86.95]],['C',[16,92.1,22.35,95.15]],['C',[28.65,98.15,37.1,98.2]],['C',[45.5,98.15,51.8,95.15]],['C',[58.1,92.1,62.3,86.95]],['C',[66.5,81.7,68.6,75.05]],['C',[70.7,68.4,70.7,61]],['C',[70.7,53.65,68.6,46.95]],['C',[66.5,40.3,62.3,35.1]]];
__motifs["P"] = [['M',[53.3,45.65]],['C',[53.2,53.05,48.9,56.65]],['C',[44.6,60.25,37.4,60.25]],['L',[14,60.25]],['L',[14,31.1]],['L',[37.4,31.1]],['C',[44.6,31.1,48.9,34.75]],['C',[53.2,38.35,53.3,45.65]],['M',[57.45,34.7]],['C',[54.85,30.15,50.1,27.75]],['C',[45.35,25.35,38.9,25.3]],['L',[7.25,25.3]],['L',[7.25,96.7]],['L',[14,96.7]],['L',[14,66.1]],['L',[38.9,66.1]],['C',[45.35,66.05,50.1,63.65]],['C',[54.85,61.25,57.45,56.7]],['C',[60.05,52.15,60.1,45.65]],['C',[60.05,39.25,57.45,34.7]]];
__motifs["Q"] = [['M',[57.55,39.45]],['C',[60.85,43.95,62.35,49.55]],['C',[63.9,55.1,63.9,61]],['C',[63.95,68,61.7,74.4]],['C',[59.5,80.85,54.85,85.4]],['L',[44.45,77.5]],['L',[40.9,81.8]],['L',[50.3,88.9]],['C',[47.6,90.65,44.35,91.5]],['C',[41,92.4,37.1,92.4]],['C',[30.05,92.35,24.95,89.7]],['C',[19.8,87.05,16.55,82.55]],['C',[13.3,78.05,11.75,72.5]],['C',[10.2,66.9,10.2,61]],['C',[10.2,55.1,11.75,49.55]],['C',[13.3,43.95,16.55,39.45]],['C',[19.8,35,24.95,32.3]],['C',[30.05,29.65,37.1,29.6]],['C',[44.15,29.65,49.2,32.3]],['C',[54.3,35,57.55,39.45]],['M',[62.3,35.1]],['C',[58.1,29.9,51.8,26.9]],['C',[45.5,23.85,37.1,23.8]],['C',[28.65,23.85,22.35,26.9]],['C',[16,29.9,11.8,35.1]],['C',[7.6,40.3,5.5,46.95]],['C',[3.4,53.65,3.4,61]],['C',[3.4,68.4,5.5,75]],['C',[7.6,81.7,11.8,86.95]],['C',[16,92.1,22.35,95.15]],['C',[28.65,98.15,37.1,98.2]],['C',[42.7,98.2,47.25,96.85]],['C',[51.9,95.5,55.6,92.9]],['L',[66.7,101.3]],['L',[70.1,97.1]],['L',[59.9,89.3]],['C',[65.35,84,68,76.7]],['C',[70.7,69.35,70.7,61]],['C',[70.7,53.65,68.6,46.95]],['C',[66.5,40.3,62.3,35.1]]];
__motifs["R"] = [['M',[54.8,45.35]],['C',[54.75,49.7,52.65,52.75]],['C',[50.55,55.9,47.05,57.55]],['C',[43.6,59.2,39.4,59.2]],['L',[14,59.2]],['L',[14,31.1]],['L',[39.4,31.1]],['C',[47.05,31.15,50.95,34.95]],['C',[54.8,38.75,54.8,45.35]],['M',[58.6,33.35]],['C',[55.65,29.2,50.8,27.25]],['C',[45.85,25.3,39.9,25.3]],['L',[7.25,25.3]],['L',[7.25,96.7]],['L',[14,96.7]],['L',[14,65]],['L',[39.8,65]],['C',[46.15,64.85,49.1,67.9]],['C',[52.1,70.9,53,75.7]],['C',[53.9,80.5,54.1,85.6]],['C',[54.2,87.15,54.3,89.2]],['C',[54.45,91.25,54.8,93.25]],['C',[55.2,95.25,56,96.7]],['L',[63.55,96.7]],['C',[62,94.8,61.4,91.45]],['C',[60.75,88.1,60.55,84.55]],['C',[60.3,81,60.2,78.4]],['C',[60,74.15,58.8,70.7]],['C',[57.6,67.3,55,65.1]],['C',[52.3,62.9,47.7,62.35]],['L',[47.7,62.1]],['C',[52.3,61.15,55.35,58.55]],['C',[58.45,56.05,60,52.2]],['C',[61.55,48.45,61.55,43.9]],['C',[61.45,37.45,58.6,33.35]]];
__motifs["S"] = [['M',[50.1,46]],['L',[56.9,46]],['C',[56.85,38.7,53.2,33.75]],['C',[49.6,28.85,43.6,26.35]],['C',[37.65,23.8,30.5,23.8]],['C',[23,23.9,18.15,25.95]],['C',[13.35,28.05,10.65,31.2]],['C',[8,34.4,6.95,37.8]],['C',[5.85,41.2,5.9,43.9]],['C',[5.95,49.4,8.2,52.85]],['C',[10.45,56.25,14.1,58.15]],['C',[17.7,60.1,21.95,61.1]],['L',[37.9,65]],['C',[41.25,65.8,44.65,67.25]],['C',[48,68.75,50.25,71.3]],['C',[52.5,73.9,52.6,77.9]],['C',[52.55,81.8,50.7,84.55]],['C',[48.9,87.35,45.95,89.05]],['C',[43.05,90.8,39.8,91.6]],['C',[36.55,92.4,33.7,92.4]],['C',[27.1,92.45,21.85,90.7]],['C',[16.5,88.95,13.45,84.75]],['C',[10.3,80.5,10.4,73.2]],['L',[3.6,73.2]],['C',[3.3,81.9,6.9,87.4]],['C',[10.5,92.95,17.05,95.6]],['C',[23.6,98.2,32.1,98.2]],['C',[41.5,98.1,47,95.7]],['C',[52.55,93.35,55.2,89.85]],['C',[57.85,86.4,58.65,83.1]],['C',[59.45,79.75,59.4,77.8]],['C',[59.35,72,56.85,68.35]],['C',[54.35,64.65,50.2,62.45]],['C',[46,60.3,40.85,59]],['L',[23.5,54.7]],['C',[20.55,54,18.1,52.75]],['C',[15.65,51.5,14.2,49.3]],['C',[12.75,47.15,12.7,43.8]],['C',[12.75,38.55,15.3,35.4]],['C',[17.75,32.3,21.85,30.95]],['C',[25.9,29.55,30.6,29.6]],['C',[35.7,29.6,40.05,31.4]],['C',[44.4,33.25,47.1,36.9]],['C',[49.85,40.55,50.1,46]]];
__motifs["T"] = [['M',[56.1,25.3]],['L',[-0.5,25.3]],['L',[-0.5,31.1]],['L',[24.4,31.1]],['L',[24.4,96.7]],['L',[31.2,96.7]],['L',[31.2,31.1]],['L',[56.1,31.1]],['L',[56.1,25.3]]];
__motifs["U"] = [['M',[55.2,25.3]],['L',[55.2,69.5]],['C',[55.25,77.75,52.75,82.85]],['C',[50.25,87.85,45.55,90.15]],['C',[40.8,92.45,34.2,92.4]],['C',[27.65,92.45,22.95,90.15]],['C',[18.2,87.85,15.7,82.85]],['C',[13.25,77.75,13.3,69.5]],['L',[13.3,25.3]],['L',[6.5,25.3]],['L',[6.5,71]],['C',[6.45,78.45,9.3,84.6]],['C',[12.1,90.75,18.2,94.4]],['C',[24.3,98.1,34.2,98.2]],['C',[44.15,98.1,50.25,94.4]],['C',[56.4,90.75,59.25,84.6]],['C',[62.05,78.45,62,71]],['L',[62,25.3]],['L',[55.2,25.3]]];
__motifs["V"] = [['M',[53.05,25.3]],['L',[30.05,89.2]],['L',[29.85,89.2]],['L',[6.65,25.3]],['L',[-0.7,25.3]],['L',[25.85,96.7]],['L',[33.7,96.7]],['L',[60.2,25.3]],['L',[53.05,25.3]]];
__motifs["W"] = [['M',[83.6,25.3]],['L',[67.3,87.8]],['L',[67.1,87.8]],['L',[49.6,25.3]],['L',[41.1,25.3]],['L',[23.7,87.8]],['L',[23.5,87.8]],['L',[7.3,25.3]],['L',[0,25.3]],['L',[19.8,96.7]],['L',[27.2,96.7]],['L',[45.2,32.85]],['L',[45.4,32.85]],['L',[63.5,96.7]],['L',[70.7,96.7]],['L',[90.4,25.3]],['L',[83.6,25.3]]];
__motifs["X"] = [['M',[49.4,25.3]],['L',[28.45,55.2]],['L',[8.3,25.3]],['L',[0.3,25.3]],['L',[24.5,59.9]],['L',[-1.2,96.7]],['L',[6.5,96.7]],['L',[28.45,65.2]],['L',[50.2,96.7]],['L',[58.4,96.7]],['L',[32.55,60.15]],['L',[57,25.3]],['L',[49.4,25.3]]];
__motifs["Y"] = [['M',[54,25.3]],['L',[30.6,61.5]],['L',[7.1,25.3]],['L',[-1,25.3]],['L',[27.1,67.3]],['L',[27.1,96.7]],['L',[33.9,96.7]],['L',[33.9,67.3]],['L',[62.05,25.3]],['L',[54,25.3]]];
__motifs["Z"] = [['M',[55.1,25.3]],['L',[3.7,25.3]],['L',[3.7,31.1]],['L',[47.5,31.1]],['L',[0.5,90.7]],['L',[0.5,96.7]],['L',[56.1,96.7]],['L',[56.1,90.9]],['L',[8.1,90.9]],['L',[55.1,31.3]],['L',[55.1,25.3]]];
}
static private function initializeMotifsLowercase():void {
__motifs["a"] = [['M',[39,68.5]],['L',[39,76.7]],['C',[39,81.75,36.5,85.35]],['C',[34.1,89,30,90.95]],['C',[25.9,92.9,21,92.9]],['C',[18,92.9,15.45,91.65]],['C',[12.8,90.4,11.2,88.15]],['C',[9.55,85.85,9.5,82.7]],['C',[9.55,79,11.75,76.85]],['C',[13.95,74.75,17.55,73.65]],['C',[21.05,72.65,25.25,72.05]],['C',[29.45,71.45,33.5,70.75]],['C',[34.9,70.6,36.5,70.1]],['C',[38.15,69.6,38.8,68.5]],['L',[39,68.5]],['M',[26.3,43.6]],['C',[20.35,43.6,15.75,45.4]],['C',[11.2,47.2,8.5,51.05]],['C',[5.75,54.85,5.4,60.9]],['L',[11.7,60.9]],['C',[11.95,54.6,15.75,51.75]],['C',[19.55,48.85,25.55,48.9]],['C',[29.25,48.85,32.3,49.75]],['C',[35.35,50.65,37.15,52.95]],['C',[38.95,55.3,39,59.5]],['C',[39,62.3,38.1,63.7]],['C',[37.1,65.1,35.35,65.7]],['C',[33.55,66.25,30.9,66.5]],['C',[25.8,67,20.85,67.75]],['C',[15.95,68.45,11.95,69.95]],['C',[8,71.5,5.65,74.65]],['C',[3.25,77.7,3.2,83.1]],['C',[3.25,88.3,5.6,91.6]],['C',[7.9,95,11.8,96.6]],['C',[15.7,98.2,20.5,98.2]],['C',[25.45,98.2,28.8,97]],['C',[32.25,95.7,34.65,93.4]],['C',[37.15,91.05,39.3,87.7]],['L',[39.5,87.7]],['C',[39.45,90.4,40,92.4]],['C',[40.55,94.45,42.15,95.6]],['C',[43.75,96.65,46.9,96.7]],['C',[48.15,96.7,49.05,96.6]],['C',[50,96.5,51.05,96.3]],['L',[51.05,91]],['C',[50.65,91.15,50.1,91.3]],['C',[49.55,91.4,49,91.4]],['C',[47.1,91.4,46.25,90.4]],['C',[45.3,89.4,45.3,87.55]],['L',[45.3,60.2]],['C',[45.2,53.35,42.45,49.75]],['C',[39.6,46.1,35.3,44.85]],['C',[30.95,43.55,26.3,43.6]]];
__motifs["b"] = [['M',[14,60.4]],['C',[15.75,55.45,19.8,52.2]],['C',[23.75,49,30.4,48.9]],['C',[36.4,49,40.15,52.2]],['C',[43.85,55.45,45.6,60.4]],['C',[47.3,65.45,47.3,70.85]],['C',[47.3,76.35,45.6,81.35]],['C',[43.85,86.35,40.15,89.55]],['C',[36.4,92.8,30.4,92.9]],['C',[23.75,92.8,19.8,89.55]],['C',[15.75,86.35,14,81.35]],['C',[12.25,76.35,12.3,70.85]],['C',[12.25,65.45,14,60.4]],['M',[22.95,44.9]],['C',[19.4,46.15,16.65,48.65]],['C',[13.9,51.2,12.5,54.9]],['L',[12.3,54.9]],['L',[12.3,25.3]],['L',[6,25.3]],['L',[6,96.7]],['L',[11.8,96.7]],['L',[11.8,86.9]],['L',[12,86.9]],['C',[14.25,92.2,19.2,95.2]],['C',[24.05,98.15,30.4,98.2]],['C',[38.3,98.1,43.4,94.35]],['C',[48.55,90.65,51.05,84.45]],['C',[53.6,78.3,53.6,70.85]],['C',[53.6,63.5,51.05,57.35]],['C',[48.55,51.15,43.4,47.45]],['C',[38.3,43.65,30.4,43.6]],['C',[26.5,43.6,22.95,44.9]]];
__motifs["c"] = [['M',[27.85,43.6]],['C',[19.9,43.65,14.45,47.4]],['C',[9.05,51.1,6.25,57.25]],['C',[3.4,63.4,3.4,70.85]],['C',[3.4,78.4,6.25,84.55]],['C',[9.05,90.7,14.45,94.4]],['C',[19.9,98.1,27.85,98.2]],['C',[36.5,98.1,42.15,92.85]],['C',[47.75,87.55,49.1,78.2]],['L',[42.8,78.2]],['C',[42.4,82.55,40.3,85.8]],['C',[38.25,89.15,35,91]],['C',[31.75,92.85,27.85,92.9]],['C',[21.8,92.8,17.7,89.6]],['C',[13.7,86.5,11.7,81.45]],['C',[9.7,76.5,9.7,70.85]],['C',[9.7,65.3,11.7,60.3]],['C',[13.7,55.3,17.7,52.15]],['C',[21.8,49,27.85,48.9]],['C',[33.95,48.95,37.55,52.2]],['C',[41.15,55.45,42.45,61.3]],['L',[48.75,61.3]],['C',[47.95,55.4,45.1,51.45]],['C',[42.3,47.55,37.8,45.55]],['C',[33.35,43.6,27.85,43.6]]];
__motifs["d"] = [['M',[11.8,60.4]],['C',[13.55,55.45,17.3,52.2]],['C',[21.05,49,27,48.9]],['C',[33.7,49,37.65,52.2]],['C',[41.65,55.45,43.4,60.4]],['C',[45.15,65.45,45.1,70.85]],['C',[45.15,76.35,43.4,81.35]],['C',[41.65,86.35,37.65,89.55]],['C',[33.7,92.8,27,92.9]],['C',[21.05,92.8,17.3,89.55]],['C',[13.55,86.35,11.8,81.35]],['C',[10.1,76.35,10.1,70.85]],['C',[10.1,65.45,11.8,60.4]],['M',[45.1,25.3]],['L',[45.1,54.9]],['L',[44.9,54.9]],['C',[43.5,51.2,40.75,48.65]],['C',[38.05,46.15,34.45,44.9]],['C',[30.9,43.6,27,43.6]],['C',[19.2,43.65,14,47.45]],['C',[8.9,51.15,6.35,57.35]],['C',[3.8,63.5,3.8,70.85]],['C',[3.8,78.3,6.35,84.45]],['C',[8.9,90.65,14,94.35]],['C',[19.2,98.1,27,98.2]],['C',[30.8,98.15,34.5,96.75]],['C',[38.25,95.35,41.1,92.8]],['C',[44,90.25,45.4,86.9]],['L',[45.6,86.9]],['L',[45.6,96.7]],['L',[51.4,96.7]],['L',[51.4,25.3]],['L',[45.1,25.3]]];
__motifs["e"] = [['M',[17.95,51.6]],['C',[21.6,48.95,26.7,48.9]],['C',[31.85,48.95,35.45,51.55]],['C',[39.05,54.1,41,58.3]],['C',[42.95,62.45,43.1,67.3]],['L',[9.7,67.3]],['C',[10.2,62.5,12.25,58.35]],['C',[14.35,54.15,17.95,51.6]],['M',[26.7,43.6]],['C',[20.55,43.6,16.15,45.9]],['C',[11.7,48.25,8.95,52.1]],['C',[6.1,56.05,4.75,60.9]],['C',[3.4,65.75,3.4,70.9]],['C',[3.4,78.35,5.8,84.55]],['C',[8.25,90.7,13.4,94.4]],['C',[18.55,98.1,26.7,98.2]],['C',[36.45,98.15,41.85,93.35]],['C',[47.25,88.55,49.2,79.7]],['L',[42.9,79.7]],['C',[41.45,85.65,37.5,89.25]],['C',[33.6,92.8,26.7,92.9]],['C',[20.7,92.8,16.95,89.65]],['C',[13.25,86.6,11.45,81.95]],['C',[9.7,77.3,9.7,72.65]],['L',[49.4,72.65]],['C',[49.6,67.1,48.4,61.95]],['C',[47.2,56.8,44.5,52.65]],['C',[41.75,48.5,37.35,46.05]],['C',[32.9,43.6,26.7,43.6]]];
__motifs["f"] = [['M',[0.65,45.1]],['L',[0.65,50.4]],['L',[9.4,50.4]],['L',[9.4,96.7]],['L',[15.7,96.7]],['L',[15.7,50.4]],['L',[25.95,50.4]],['L',[25.95,45.1]],['L',[15.7,45.1]],['L',[15.7,40.6]],['C',[15.7,37.75,16,35.5]],['C',[16.3,33.25,17.7,31.95]],['C',[19.2,30.65,22.6,30.65]],['C',[23.75,30.65,24.85,30.8]],['C',[26,30.9,27.2,31.1]],['L',[27.2,25.7]],['C',[25.75,25.5,24.5,25.4]],['C',[23.25,25.3,21.9,25.3]],['C',[16.9,25.35,14.15,27.25]],['C',[11.45,29.15,10.4,32.55]],['C',[9.35,35.95,9.4,40.4]],['L',[9.4,45.1]],['L',[0.65,45.1]]];
__motifs["g"] = [['M',[11.45,60]],['C',[13.25,55.15,17,52.05]],['C',[20.75,49,26.7,48.9]],['C',[32.6,49,36.35,52.2]],['C',[40,55.4,41.65,60.25]],['C',[43.35,65.1,43.3,70.3]],['C',[43.3,75.65,41.45,80.3]],['C',[39.55,84.95,35.85,87.8]],['C',[32.2,90.7,26.7,90.8]],['C',[20.9,90.7,17.15,87.8]],['C',[13.4,84.9,11.5,80.25]],['C',[9.7,75.6,9.7,70.3]],['C',[9.7,64.85,11.45,60]],['M',[43.3,45.1]],['L',[43.3,54]],['L',[43.1,54]],['C',[41.15,49.6,36.75,46.65]],['C',[32.4,43.7,26.7,43.6]],['C',[19.25,43.65,14.05,47.2]],['C',[8.85,50.65,6.15,56.5]],['C',[3.4,62.4,3.4,69.6]],['C',[3.4,77,5.8,83]],['C',[8.2,89,13.35,92.5]],['C',[18.5,96,26.7,96.1]],['C',[32.3,96,36.6,93.2]],['C',[40.85,90.3,43.1,85.5]],['L',[43.3,85.5]],['L',[43.3,92.5]],['C',[43.35,101.95,39.35,106.95]],['C',[35.35,111.95,26.7,112]],['C',[23.15,112.05,20,111]],['C',[16.85,110.05,14.6,107.75]],['C',[12.35,105.5,11.6,101.7]],['L',[5.3,101.7]],['C',[5.85,107.2,9,110.6]],['C',[12.1,114.1,16.8,115.7]],['C',[21.5,117.3,26.7,117.3]],['C',[35.1,117.25,40.15,114.3]],['C',[45.15,111.3,47.35,105.8]],['C',[49.6,100.2,49.6,92.5]],['L',[49.6,45.1]],['L',[43.3,45.1]]];
__motifs["h"] = [['M',[28.9,43.6]],['C',[25.2,43.6,21.9,44.9]],['C',[18.55,46.2,16.05,48.55]],['C',[13.55,50.85,12.4,54]],['L',[12.2,54]],['L',[12.2,25.3]],['L',[5.9,25.3]],['L',[5.9,96.7]],['L',[12.2,96.7]],['L',[12.2,66.55]],['C',[12.3,61.5,14.25,57.5]],['C',[16.2,53.55,19.8,51.25]],['C',[23.4,48.95,28.4,48.9]],['C',[33.45,48.95,36.35,50.95]],['C',[39.2,53,40.4,56.5]],['C',[41.55,60,41.5,64.45]],['L',[41.5,96.7]],['L',[47.8,96.7]],['L',[47.8,63.5]],['C',[47.85,57.3,46.15,52.85]],['C',[44.4,48.4,40.25,46]],['C',[36.1,43.6,28.9,43.6]]];
__motifs["i"] = [['M',[12.4,35.4]],['L',[12.4,25.3]],['L',[6.1,25.3]],['L',[6.1,35.4]],['L',[12.4,35.4]],['M',[6.1,45.1]],['L',[6.1,96.7]],['L',[12.4,96.7]],['L',[12.4,45.1]],['L',[6.1,45.1]]];
__motifs["j"] = [['M',[12.4,35.4]],['L',[12.4,25.3]],['L',[6.1,25.3]],['L',[6.1,35.4]],['L',[12.4,35.4]],['M',[6.1,45.1]],['L',[6.1,103]],['C',[6.2,106.25,5.1,108.3]],['C',[3.95,110.4,0.4,110.45]],['C',[-0.4,110.55,-1.25,110.5]],['C',[-2.2,110.45,-3,110.35]],['L',[-3,115.6]],['C',[-1.85,115.6,-0.8,115.7]],['C',[0.3,115.8,1.4,115.8]],['C',[5.8,115.75,8.2,113.8]],['C',[10.6,111.85,11.5,108.6]],['C',[12.45,105.4,12.4,101.5]],['L',[12.4,45.1]],['L',[6.1,45.1]]];
__motifs["k"] = [['M',[40.9,45.1]],['L',[12.3,70.15]],['L',[12.3,25.3]],['L',[6,25.3]],['L',[6,96.7]],['L',[12.3,96.7]],['L',[12.3,77.05]],['L',[22.5,68.6]],['L',[42.9,96.7]],['L',[50.8,96.7]],['L',[27.3,64.2]],['L',[49.3,45.1]],['L',[40.9,45.1]]];
__motifs["l"] = [['M',[6.1,25.3]],['L',[6.1,96.7]],['L',[12.4,96.7]],['L',[12.4,25.3]],['L',[6.1,25.3]]];
__motifs["m"] = [['M',[60.25,43.6]],['C',[55.05,43.6,50.65,46.05]],['C',[46.25,48.6,43.8,53.7]],['C',[42.3,48.6,38.3,46.05]],['C',[34.25,43.6,29,43.6]],['C',[22.9,43.6,18.7,46.35]],['C',[14.55,49.1,12.1,53.8]],['L',[11.8,53.8]],['L',[11.8,45.1]],['L',[6,45.1]],['L',[6,96.7]],['L',[12.3,96.7]],['L',[12.3,67.9]],['C',[12.35,62.4,13.9,58.15]],['C',[15.55,53.9,18.9,51.45]],['C',[22.25,48.95,27.75,48.9]],['C',[31.7,48.95,34.1,50.65]],['C',[36.5,52.35,37.55,55.25]],['C',[38.55,58.15,38.55,61.7]],['L',[38.55,96.7]],['L',[44.8,96.7]],['L',[44.8,67.5]],['C',[44.8,62.6,46.05,58.4]],['C',[47.25,54.15,50.35,51.6]],['C',[53.4,48.95,58.85,48.9]],['C',[65.55,48.9,68.3,52.25]],['C',[71.15,55.6,71.05,62]],['L',[71.05,96.7]],['L',[77.35,96.7]],['L',[77.35,61.7]],['C',[77.35,52.55,73.05,48.05]],['C',[68.75,43.6,60.25,43.6]]];
__motifs["n"] = [['M',[28.9,43.6]],['C',[25.2,43.6,21.9,44.9]],['C',[18.55,46.2,16.05,48.55]],['C',[13.55,50.85,12.4,54]],['L',[12.2,54]],['L',[12.2,45.1]],['L',[5.9,45.1]],['L',[5.9,96.7]],['L',[12.2,96.7]],['L',[12.2,66.55]],['C',[12.3,61.5,14.25,57.5]],['C',[16.2,53.55,19.8,51.25]],['C',[23.4,48.95,28.4,48.9]],['C',[33.45,48.95,36.35,50.95]],['C',[39.2,53,40.4,56.5]],['C',[41.55,60,41.5,64.45]],['L',[41.5,96.7]],['L',[47.8,96.7]],['L',[47.8,63.5]],['C',[47.85,57.3,46.15,52.85]],['C',[44.4,48.4,40.25,46]],['C',[36.1,43.6,28.9,43.6]]];
__motifs["o"] = [['M',[17.7,52.15]],['C',[21.8,49,27.85,48.9]],['C',[33.85,49,37.9,52.15]],['C',[41.9,55.3,43.9,60.3]],['C',[45.9,65.3,45.9,70.85]],['C',[45.9,76.5,43.9,81.45]],['C',[41.9,86.5,37.9,89.6]],['C',[33.85,92.8,27.85,92.9]],['C',[21.8,92.8,17.7,89.6]],['C',[13.7,86.5,11.7,81.45]],['C',[9.7,76.5,9.7,70.85]],['C',[9.7,65.3,11.7,60.3]],['C',[13.7,55.3,17.7,52.15]],['M',[14.45,47.4]],['C',[9.05,51.1,6.25,57.25]],['C',[3.4,63.4,3.4,70.85]],['C',[3.4,78.4,6.25,84.55]],['C',[9.05,90.7,14.45,94.4]],['C',[19.9,98.1,27.85,98.2]],['C',[35.75,98.1,41.15,94.4]],['C',[46.6,90.7,49.35,84.55]],['C',[52.2,78.4,52.2,70.85]],['C',[52.2,63.4,49.35,57.25]],['C',[46.6,51.1,41.15,47.4]],['C',[35.75,43.65,27.85,43.6]],['C',[19.9,43.65,14.45,47.4]]];
__motifs["p"] = [['M',[13.9,60]],['C',[15.6,55,19.55,51.95]],['C',[23.5,49,30.4,48.9]],['C',[36.4,49,40.15,52.2]],['C',[43.85,55.45,45.6,60.4]],['C',[47.3,65.45,47.3,70.85]],['C',[47.3,76.35,45.6,81.35]],['C',[43.85,86.35,40.15,89.55]],['C',[36.4,92.8,30.4,92.9]],['C',[23.75,92.8,19.8,89.55]],['C',[15.75,86.35,14,81.35]],['C',[12.25,76.35,12.3,70.85]],['C',[12.25,64.95,13.9,60]],['M',[19.2,46.6]],['C',[14.25,49.6,12,54.9]],['L',[11.8,54.9]],['L',[11.8,45.1]],['L',[6,45.1]],['L',[6,115.8]],['L',[12.3,115.8]],['L',[12.3,86.9]],['L',[12.5,86.9]],['C',[13.9,90.6,16.65,93.15]],['C',[19.4,95.65,22.95,96.9]],['C',[26.5,98.2,30.4,98.2]],['C',[38.3,98.1,43.4,94.35]],['C',[48.55,90.65,51.05,84.45]],['C',[53.6,78.3,53.6,70.85]],['C',[53.6,63.5,51.05,57.35]],['C',[48.55,51.15,43.4,47.45]],['C',[38.3,43.65,30.4,43.6]],['C',[24.05,43.6,19.2,46.6]]];
__motifs["q"] = [['M',[11.8,60.4]],['C',[13.55,55.45,17.3,52.2]],['C',[21.05,49,27,48.9]],['C',[33.7,49,37.65,52.2]],['C',[41.65,55.45,43.4,60.4]],['C',[45.15,65.45,45.1,70.85]],['C',[45.15,76.35,43.4,81.35]],['C',[41.65,86.35,37.65,89.55]],['C',[33.7,92.8,27,92.9]],['C',[21.05,92.8,17.3,89.55]],['C',[13.55,86.35,11.8,81.35]],['C',[10.1,76.35,10.1,70.85]],['C',[10.1,65.45,11.8,60.4]],['M',[45.6,45.1]],['L',[45.6,54.9]],['L',[45.4,54.9]],['C',[44,51.55,41.1,49]],['C',[38.25,46.45,34.5,45.05]],['C',[30.8,43.6,27,43.6]],['C',[19.2,43.65,14,47.45]],['C',[8.9,51.15,6.35,57.35]],['C',[3.8,63.5,3.8,70.85]],['C',[3.8,78.3,6.35,84.45]],['C',[8.9,90.65,14,94.35]],['C',[19.2,98.1,27,98.2]],['C',[30.9,98.2,34.45,96.9]],['C',[38.05,95.65,40.75,93.15]],['C',[43.5,90.6,44.9,86.9]],['L',[45.1,86.9]],['L',[45.1,115.8]],['L',[51.4,115.8]],['L',[51.4,45.1]],['L',[45.6,45.1]]];
__motifs["r"] = [['M',[19.5,47.5]],['C',[14.45,50.85,12,57.15]],['L',[11.8,57.15]],['L',[11.8,45.1]],['L',[6,45.1]],['L',[6,96.7]],['L',[12.3,96.7]],['L',[12.3,69.2]],['C',[12.35,63.75,14.75,59.5]],['C',[17.15,55.2,21.45,52.8]],['C',[25.8,50.4,31.5,50.65]],['L',[31.5,44.35]],['C',[24.45,44.1,19.5,47.5]]];
__motifs["s"] = [['M',[24.3,43.6]],['C',[19.65,43.6,15.25,45]],['C',[10.8,46.45,7.9,49.7]],['C',[5,52.85,4.9,58.1]],['C',[4.95,62.4,6.8,65.1]],['C',[8.65,67.75,11.9,69.3]],['C',[15.15,70.8,19.3,71.9]],['L',[27.4,73.7]],['C',[30.3,74.4,32.85,75.4]],['C',[35.45,76.5,37.05,78.3]],['C',[38.65,80.15,38.7,83.1]],['C',[38.6,86.7,36.4,88.85]],['C',[34.15,91,30.9,91.95]],['C',[27.7,92.95,24.6,92.9]],['C',[18.2,92.9,14.05,89.6]],['C',[9.9,86.4,9.4,80]],['L',[3.15,80]],['C',[4,89.4,9.6,93.8]],['C',[15.25,98.25,24.3,98.2]],['C',[29.25,98.2,33.95,96.65]],['C',[38.65,95.15,41.8,91.7]],['C',[44.9,88.25,45,82.7]],['C',[44.9,78.2,42.8,75.2]],['C',[40.65,72.25,37.35,70.6]],['C',[34,68.9,30.3,68.4]],['L',[21.9,66.5]],['C',[19.7,66,17.2,65]],['C',[14.75,64.05,13,62.3]],['C',[11.3,60.55,11.2,57.8]],['C',[11.25,54.45,13.1,52.5]],['C',[14.95,50.55,17.7,49.75]],['C',[20.5,48.85,23.4,48.9]],['C',[27.05,48.9,30.05,50.05]],['C',[33.05,51.3,34.85,53.8]],['C',[36.7,56.3,36.9,60.2]],['L',[43.2,60.2]],['C',[42.95,54.6,40.45,50.9]],['C',[37.9,47.25,33.7,45.4]],['C',[29.5,43.6,24.3,43.6]]];
__motifs["t"] = [['M',[9.7,29.6]],['L',[9.7,45.1]],['L',[0.75,45.1]],['L',[0.75,50.4]],['L',[9.7,50.4]],['L',[9.7,85.65]],['C',[9.55,92.15,12.1,94.8]],['C',[14.7,97.4,20.9,97.3]],['C',[22.3,97.3,23.75,97.2]],['C',[25.1,97.1,26.5,97.1]],['L',[26.5,91.65]],['C',[23.85,91.95,21.1,91.95]],['C',[17.8,91.7,16.9,90]],['C',[15.9,88.25,16,85.2]],['L',[16,50.4]],['L',[26.5,50.4]],['L',[26.5,45.1]],['L',[16,45.1]],['L',[16,29.6]],['L',[9.7,29.6]]];
__motifs["u"] = [['M',[41.5,45.1]],['L',[41.5,72.2]],['C',[41.5,77.55,39.9,82.25]],['C',[38.25,86.95,34.8,89.85]],['C',[31.4,92.8,26.05,92.9]],['C',[18.6,92.9,15.5,89.3]],['C',[12.3,85.65,12.2,78.7]],['L',[12.2,45.1]],['L',[5.9,45.1]],['L',[5.9,78.6]],['C',[5.8,87.7,10.1,92.9]],['C',[14.35,98.1,24,98.2]],['C',[29.9,98.15,34.55,95.4]],['C',[39.25,92.6,41.8,87.35]],['L',[42,87.35]],['L',[42,96.7]],['L',[47.8,96.7]],['L',[47.8,45.1]],['L',[41.5,45.1]]];
__motifs["v"] = [['M',[0.2,45.1]],['L',[20.1,96.7]],['L',[26.8,96.7]],['L',[46.1,45.1]],['L',[39.6,45.1]],['L',[23.6,90.4]],['L',[23.4,90.4]],['L',[7.2,45.1]],['L',[0.2,45.1]]];
__motifs["w"] = [['M',[66.6,45.1]],['L',[53.35,89.3]],['L',[53.15,89.3]],['L',[40.6,45.1]],['L',[33.5,45.1]],['L',[20.9,89.3]],['L',[20.7,89.3]],['L',[7.5,45.1]],['L',[0.8,45.1]],['L',[17.4,96.7]],['L',[24.25,96.7]],['L',[36.85,53.3]],['L',[37.1,53.3]],['L',[49.8,96.7]],['L',[56.7,96.7]],['L',[73.3,45.1]],['L',[66.6,45.1]]];
__motifs["x"] = [['M',[1.6,45.1]],['L',[20.1,69.9]],['L',[0.1,96.7]],['L',[7.9,96.7]],['L',[23.8,74.95]],['L',[40,96.7]],['L',[48,96.7]],['L',[27.9,69.8]],['L',[46.5,45.1]],['L',[38.55,45.1]],['L',[24.2,64.65]],['L',[9.5,45.1]],['L',[1.6,45.1]]];
__motifs["y"] = [['M',[0.2,45.1]],['L',[20.8,96.5]],['L',[18.6,102.35]],['C',[17.6,104.8,16.55,106.6]],['C',[15.6,108.4,13.95,109.45]],['C',[12.35,110.45,9.6,110.45]],['C',[8.55,110.45,7.45,110.3]],['C',[6.4,110.25,5.25,110]],['L',[5.25,115.3]],['C',[6,115.55,7.15,115.65]],['C',[8.25,115.75,10.1,115.8]],['C',[13.95,115.85,16.3,114.8]],['C',[18.7,113.8,20.3,111.35]],['C',[21.95,108.9,23.7,104.55]],['L',[46.1,45.1]],['L',[39.8,45.1]],['L',[23.9,89.1]],['L',[6.9,45.1]],['L',[0.2,45.1]]];
__motifs["z"] = [['M',[35.2,50.4]],['L',[1.5,91.55]],['L',[1.5,96.7]],['L',[44.6,96.7]],['L',[44.6,91.4]],['L',[9.1,91.4]],['L',[43.2,49.6]],['L',[43.2,45.1]],['L',[3.8,45.1]],['L',[3.8,50.4]],['L',[35.2,50.4]]];
}
static private function initializeMotifsNumbers():void {
__motifs["0"] = [['M',[37.4,34.5]],['C',[41,37.5,42.85,42.2]],['C',[44.7,46.95,45.3,52.2]],['C',[45.95,57.5,45.9,62.1]],['C',[45.95,66.75,45.3,72.05]],['C',[44.7,77.35,42.85,82.05]],['C',[41,86.8,37.4,89.8]],['C',[33.75,92.8,27.85,92.9]],['C',[21.9,92.8,18.2,89.8]],['C',[14.6,86.8,12.75,82.05]],['C',[10.95,77.35,10.3,72.05]],['C',[9.65,66.75,9.7,62.1]],['C',[9.65,57.5,10.3,52.2]],['C',[10.95,46.95,12.75,42.2]],['C',[14.6,37.5,18.2,34.5]],['C',[21.9,31.5,27.85,31.4]],['C',[33.75,31.5,37.4,34.5]],['M',[15.4,29.4]],['C',[10.6,32.7,7.95,38]],['C',[5.35,43.35,4.35,49.65]],['C',[3.35,56,3.4,62.25]],['C',[3.35,68.45,4.35,74.75]],['C',[5.35,81.05,7.95,86.3]],['C',[10.6,91.6,15.4,94.9]],['C',[20.2,98.1,27.85,98.2]],['C',[35.4,98.1,40.25,94.9]],['C',[45,91.6,47.65,86.3]],['C',[50.25,81,51.25,74.7]],['C',[52.25,68.35,52.2,62.1]],['C',[52.25,55.9,51.25,49.6]],['C',[50.25,43.3,47.65,38]],['C',[45,32.7,40.25,29.4]],['C',[35.4,26.2,27.85,26.1]],['C',[20.2,26.2,15.4,29.4]]];
__motifs["1"] = [['M',[28.2,44.7]],['L',[28.2,96.7]],['L',[34.5,96.7]],['L',[34.5,26.7]],['L',[29.45,26.7]],['C',[28.45,33.05,25.95,35.85]],['C',[23.4,38.65,19.3,39.4]],['C',[15.25,40.1,9.7,40.2]],['L',[9.7,44.7]],['L',[28.2,44.7]]];
__motifs["2"] = [['M',[46.5,34.95]],['C',[43.65,30.55,38.75,28.35]],['C',[33.9,26.1,27.75,26.1]],['C',[20.1,26.15,15.1,29.3]],['C',[10.05,32.5,7.6,38.05]],['C',[5.2,43.6,5.3,50.9]],['L',[11.6,50.9]],['C',[11.45,45.65,13.1,41.3]],['C',[14.65,36.9,18.15,34.15]],['C',[21.7,31.45,27.45,31.4]],['C',[31.75,31.4,35.25,33.1]],['C',[38.8,34.8,40.9,37.95]],['C',[43.05,41.15,43.1,45.7]],['C',[43.1,49.85,41.65,52.95]],['C',[40.2,56.05,37.3,58.9]],['C',[32.7,63.25,27.1,66.9]],['C',[21.5,70.55,16.2,74.5]],['C',[10.95,78.4,7.4,83.7]],['C',[3.95,89,3.6,96.7]],['L',[49.7,96.7]],['L',[49.7,90.9]],['L',[10.85,90.9]],['C',[11.5,87.35,13.85,84.45]],['C',[16.2,81.45,19.4,79]],['C',[22.6,76.55,25.95,74.5]],['C',[29.2,72.45,31.85,70.7]],['C',[36.45,67.8,40.45,64.25]],['C',[44.4,60.65,46.9,56.1]],['C',[49.3,51.65,49.4,45.8]],['C',[49.35,39.35,46.5,34.95]]];
__motifs["3"] = [['M',[45.5,33.75]],['C',[42.45,29.85,37.5,27.95]],['C',[32.55,26.1,27,26.1]],['C',[20.15,26.15,15.25,29.1]],['C',[10.3,32.1,7.6,37.3]],['C',[5,42.45,4.9,49.1]],['L',[11.2,49.1]],['C',[11.1,43.85,12.9,39.9]],['C',[14.65,35.9,18.25,33.65]],['C',[21.85,31.45,27.1,31.4]],['C',[31.35,31.4,34.75,32.8]],['C',[38.25,34.15,40.3,37.1]],['C',[42.35,40,42.4,44.6]],['C',[42.3,49,40.15,51.85]],['C',[38,54.65,34.75,56.05]],['C',[31.5,57.35,28.15,57.3]],['L',[22.9,57.3]],['L',[22.9,62.6]],['L',[28.15,62.6]],['C',[32.9,62.6,36.7,64.25]],['C',[40.5,65.9,42.7,69.15]],['C',[44.95,72.5,45,77.4]],['C',[44.95,82.4,42.45,85.85]],['C',[39.9,89.35,35.85,91.1]],['C',[31.8,92.9,27.1,92.9]],['C',[18.55,92.8,13.95,87.8]],['C',[9.4,82.85,9.6,74.4]],['L',[3.3,74.4]],['C',[2.9,81.9,5.85,87.25]],['C',[8.8,92.55,14.35,95.4]],['C',[19.9,98.15,27.2,98.2]],['C',[33.75,98.2,39.2,95.7]],['C',[44.65,93.3,47.95,88.5]],['C',[51.2,83.75,51.3,76.9]],['C',[51.25,69.9,47.5,65.35]],['C',[43.8,60.8,36.9,59.6]],['L',[36.9,59.4]],['C',[42.55,58,45.6,53.85]],['C',[48.65,49.7,48.7,43.9]],['C',[48.6,37.7,45.5,33.75]]];
__motifs["4"] = [['M',[35.3,35.9]],['L',[35.3,74]],['L',[8.7,74]],['L',[35.1,35.9]],['L',[35.3,35.9]],['M',[35.3,79.3]],['L',[35.3,96.7]],['L',[41.1,96.7]],['L',[41.1,79.3]],['L',[51.6,79.3]],['L',[51.6,74]],['L',[41.1,74]],['L',[41.1,26.7]],['L',[35.4,26.7]],['L',[3.05,73.2]],['L',[3.05,79.3]],['L',[35.3,79.3]]];
__motifs["5"] = [['M',[47.45,27.6]],['L',[12.5,27.6]],['L',[5.7,63.9]],['L',[11.1,63.9]],['C',[13.7,59.9,17.85,57.75]],['C',[21.95,55.6,26.7,55.6]],['C',[31.95,55.65,35.95,58.05]],['C',[40,60.35,42.25,64.45]],['C',[44.55,68.6,44.6,73.8]],['C',[44.6,79,42.45,83.25]],['C',[40.35,87.6,36.45,90.2]],['C',[32.5,92.85,27.1,92.9]],['C',[22.25,92.9,18.45,90.85]],['C',[14.65,88.85,12.35,85.25]],['C',[10.1,81.55,9.9,76.7]],['L',[3.6,76.7]],['C',[3.8,83.35,6.85,88.2]],['C',[9.8,93,14.95,95.6]],['C',[20.05,98.15,26.6,98.2]],['C',[33.35,98.15,38.8,95.1]],['C',[44.35,92.05,47.55,86.75]],['C',[50.8,81.4,50.9,74.5]],['C',[50.85,67.4,48,61.95]],['C',[45.1,56.5,39.9,53.45]],['C',[34.6,50.3,27.4,50.25]],['C',[23.25,50.3,19.3,51.95]],['C',[15.35,53.7,12.6,56.75]],['L',[12.4,56.55]],['L',[16.9,33.4]],['L',[47.45,33.4]],['L',[47.45,27.6]]];
__motifs["6"] = [['M',[38.15,58.95]],['C',[41.9,61.4,43.9,65.6]],['C',[45.9,69.75,45.9,74.9]],['C',[45.85,79.8,43.75,83.85]],['C',[41.65,87.95,37.9,90.4]],['C',[34.15,92.85,29.1,92.9]],['C',[23.05,92.85,19.15,90.45]],['C',[15.3,88,13.45,83.95]],['C',[11.6,79.9,11.6,74.9]],['C',[11.6,69.7,13.65,65.55]],['C',[15.7,61.35,19.65,58.9]],['C',[23.5,56.45,29,56.4]],['C',[34.4,56.45,38.15,58.95]],['M',[43.8,30.7]],['C',[38.3,26.1,29,26.1]],['C',[22.15,26.2,17.65,28.95]],['C',[13.05,31.65,10.3,36]],['C',[7.55,40.3,6.2,45.15]],['C',[4.85,49.95,4.4,54.15]],['C',[3.95,58.4,4,61]],['C',[4,74.6,6.6,82.8]],['C',[9.2,91,14.6,94.65]],['C',[20,98.25,28.5,98.2]],['C',[35.45,98.15,40.75,95.1]],['C',[46.1,92,49.1,86.7]],['C',[52.15,81.35,52.2,74.5]],['C',[52.15,67.6,49.3,62.35]],['C',[46.5,57.1,41.3,54.1]],['C',[36.15,51.15,29.1,51.1]],['C',[23.1,51.2,18.05,54.3]],['C',[13.1,57.45,10.5,62.7]],['L',[10.3,62.7]],['C',[10.25,57.85,11.05,52.45]],['C',[11.8,47.1,13.85,42.3]],['C',[15.9,37.5,19.75,34.5]],['C',[23.55,31.5,29.6,31.4]],['C',[35.75,31.5,39.5,35.05]],['C',[43.3,38.55,44.2,44.4]],['L',[50.5,44.4]],['C',[49.3,35.25,43.8,30.7]]];
__motifs["7"] = [['M',[50.1,33.4]],['L',[50.1,27.6]],['L',[5.1,27.6]],['L',[5.1,33.4]],['L',[43.75,33.4]],['C',[34.15,44.35,28.1,54.35]],['C',[22,64.4,18.9,74.7]],['C',[15.75,84.95,15,96.7]],['L',[21.8,96.7]],['C',[22.45,84.5,25.65,74.35]],['C',[28.8,64.25,33.25,56.2]],['C',[37.7,48.25,42.2,42.55]],['C',[46.75,36.85,50.1,33.4]]];
__motifs["8"] = [['M',[36.55,63.5]],['C',[40.65,65.2,43.05,68.6]],['C',[45.5,72.05,45.6,77.1]],['C',[45.55,82.45,43.15,85.95]],['C',[40.75,89.45,36.75,91.2]],['C',[32.75,92.9,27.8,92.9]],['C',[22.85,92.9,18.85,91.15]],['C',[14.8,89.4,12.45,85.85]],['C',[10.05,82.35,10,77.1]],['C',[10.05,71.95,12.5,68.55]],['C',[14.9,65.1,18.9,63.45]],['C',[22.95,61.8,27.8,61.9]],['C',[32.55,61.8,36.55,63.5]],['M',[42.7,43.6]],['C',[42.65,48.1,40.55,51]],['C',[38.5,53.95,35.1,55.35]],['C',[31.7,56.7,27.8,56.6]],['C',[24,56.7,20.6,55.4]],['C',[17.25,54.1,15.05,51.2]],['C',[12.9,48.25,12.8,43.6]],['C',[12.85,39.6,15,36.9]],['C',[17.1,34.15,20.5,32.8]],['C',[23.9,31.4,27.8,31.4]],['C',[32.05,31.4,35.4,32.8]],['C',[38.75,34.15,40.7,36.9]],['C',[42.7,39.6,42.7,43.6]],['M',[45.8,33.7]],['C',[42.7,29.85,37.85,27.95]],['C',[33,26.1,27.7,26.1]],['C',[22.45,26.1,17.65,27.95]],['C',[12.8,29.85,9.7,33.7]],['C',[6.6,37.6,6.5,43.6]],['C',[6.55,49.4,9.45,53.35]],['C',[12.4,57.3,17.9,59]],['L',[17.9,59.2]],['C',[11.4,60.5,7.65,65.35]],['C',[3.9,70.15,3.7,77.1]],['C',[3.75,84.15,7.05,88.85]],['C',[10.3,93.55,15.7,95.85]],['C',[21.2,98.2,27.8,98.2]],['C',[34.4,98.2,39.9,95.85]],['C',[45.3,93.55,48.6,88.85]],['C',[51.8,84.15,51.9,77.1]],['C',[51.85,70,48.15,65.3]],['C',[44.4,60.6,37.6,59.2]],['L',[37.6,59]],['C',[42.95,57.4,45.95,53.35]],['C',[48.95,49.35,49,43.6]],['C',[48.9,37.6,45.8,33.7]]];
__motifs["9"] = [['M',[44,49.4]],['C',[44,54.6,41.95,58.75]],['C',[39.9,62.95,36,65.4]],['C',[32.15,67.85,26.6,67.9]],['C',[21.25,67.85,17.5,65.35]],['C',[13.7,62.9,11.7,58.7]],['C',[9.7,54.55,9.7,49.4]],['C',[9.75,44.5,11.85,40.45]],['C',[13.95,36.35,17.7,33.9]],['C',[21.5,31.45,26.5,31.4]],['C',[32.55,31.45,36.45,33.85]],['C',[40.35,36.3,42.2,40.35]],['C',[44,44.4,44,49.4]],['M',[41,29.65]],['C',[35.6,26.05,27.1,26.1]],['C',[20.15,26.15,14.85,29.2]],['C',[9.5,32.3,6.5,37.6]],['C',[3.45,42.95,3.4,49.85]],['C',[3.45,56.7,6.3,61.95]],['C',[9.15,67.2,14.3,70.2]],['C',[19.5,73.15,26.5,73.2]],['C',[32.5,73.1,37.55,70]],['C',[42.55,66.85,45.1,61.6]],['L',[45.3,61.6]],['C',[45.35,66.5,44.6,71.85]],['C',[43.8,77.2,41.75,82]],['C',[39.7,86.8,35.9,89.8]],['C',[32.1,92.8,26.05,92.9]],['C',[19.85,92.8,16.05,89.3]],['C',[12.25,85.75,11.4,79.9]],['L',[5.1,79.9]],['C',[6.25,89.05,11.75,93.6]],['C',[17.3,98.2,26.6,98.2]],['C',[33.45,98.1,38,95.4]],['C',[42.55,92.65,45.3,88.3]],['C',[48.05,84,49.4,79.15]],['C',[50.8,74.35,51.2,70.15]],['C',[51.65,65.9,51.6,63.3]],['C',[51.6,49.75,49,41.5]],['C',[46.45,33.3,41,29.65]]];
}
static private function initializeMotifsPunctuation():void {
__motifs[" "] = [];
__motifs["!"] = [['M',[16.3,86.1]],['L',[7.9,86.1]],['L',[7.9,96.7]],['L',[16.3,96.7]],['L',[16.3,86.1]],['M',[15.5,25.3]],['L',[8.7,25.3]],['L',[8.7,46.6]],['L',[10.2,78.95]],['L',[13.95,78.95]],['L',[15.5,46.6]],['L',[15.5,25.3]]];
__motifs["\""] = [['M',[22,25.3]],['L',[22,49.65]],['L',[28.3,49.65]],['L',[28.3,25.3]],['L',[22,25.3]],['M',[8.7,25.3]],['L',[8.7,49.65]],['L',[15,49.65]],['L',[15,25.3]],['L',[8.7,25.3]]];
__motifs["#"] = [['M',[36.4,54.3]],['L',[34.2,69.9]],['L',[20.05,69.9]],['L',[22.25,54.3]],['L',[36.4,54.3]],['M',[21,27.6]],['L',[17.85,49.85]],['L',[6.3,49.85]],['L',[6.3,54.3]],['L',[17.3,54.3]],['L',[15.1,69.9]],['L',[3.45,69.9]],['L',[3.45,74.4]],['L',[14.45,74.4]],['L',[11.4,96.7]],['L',[16.35,96.7]],['L',[19.5,74.4]],['L',[33.6,74.4]],['L',[30.45,96.7]],['L',[35.5,96.7]],['L',[38.55,74.4]],['L',[49.65,74.4]],['L',[49.65,69.9]],['L',[39.15,69.9]],['L',[41.35,54.3]],['L',[52.5,54.3]],['L',[52.5,49.85]],['L',[42,49.85]],['L',[45.05,27.6]],['L',[40.1,27.6]],['L',[36.95,49.85]],['L',[22.9,49.85]],['L',[26,27.6]],['L',[21,27.6]]];
__motifs["$"] = [['M',[37.4,66.5]],['C',[41.25,68.05,43.75,70.8]],['C',[46.3,73.6,46.4,78.3]],['C',[46.35,83.45,43.95,86.7]],['C',[41.55,89.9,37.75,91.45]],['C',[33.95,92.95,29.6,92.9]],['L',[29.6,64.1]],['C',[33.6,65,37.4,66.5]],['M',[13.05,35.45]],['C',[15,32.2,18.3,30.65]],['C',[21.65,29.1,25.7,29.1]],['L',[25.7,57]],['C',[21.9,56.15,18.55,54.9]],['C',[15.2,53.65,13.15,51.1]],['C',[11.05,48.6,11,44]],['C',[11.05,38.8,13.05,35.45]],['M',[50.8,45.55]],['C',[50.85,38.95,48,34.05]],['C',[45.1,29.2,40.3,26.55]],['C',[35.45,23.85,29.6,23.8]],['L',[29.6,16]],['L',[25.7,16]],['L',[25.7,23.8]],['C',[19.8,23.85,15.1,26.2]],['C',[10.35,28.55,7.55,32.95]],['C',[4.75,37.3,4.7,43.35]],['C',[4.8,50.2,7.6,54.15]],['C',[10.5,58.1,15.25,60.15]],['C',[19.95,62.15,25.7,63.3]],['L',[25.7,92.9]],['C',[17.75,92,13.55,87.3]],['C',[9.3,82.55,9.2,73.9]],['L',[2.9,73.9]],['C',[3.2,85.25,8.65,91.15]],['C',[14.05,97.05,25.7,98.1]],['L',[25.7,106.7]],['L',[29.6,106.7]],['L',[29.6,98.2]],['C',[35.55,98.25,40.75,95.95]],['C',[46,93.7,49.3,89.25]],['C',[52.6,84.75,52.7,78.2]],['C',[52.6,71.25,49.2,67.25]],['C',[45.9,63.2,40.65,61.1]],['C',[35.4,59,29.6,57.95]],['L',[29.6,29.1]],['C',[36.25,29.2,40.3,33.55]],['C',[44.3,37.9,44.5,45.55]],['L',[50.8,45.55]]];
__motifs["%"] = [['M',[13.1,38.5]],['C',[14,35.2,16.3,32.95]],['C',[18.65,30.7,22.8,30.6]],['C',[26.95,30.7,29.3,32.95]],['C',[31.6,35.2,32.5,38.5]],['C',[33.45,41.8,33.4,45.1]],['C',[33.45,48.3,32.5,51.6]],['C',[31.6,54.85,29.3,57.1]],['C',[26.95,59.3,22.8,59.4]],['C',[18.65,59.3,16.3,57.1]],['C',[14,54.85,13.1,51.6]],['C',[12.15,48.3,12.2,45.1]],['C',[12.15,41.8,13.1,38.5]],['M',[8.5,35.3]],['C',[6.9,39.55,6.9,45]],['C',[6.9,50.4,8.5,54.65]],['C',[10.15,58.9,13.65,61.35]],['C',[17.2,63.85,22.8,63.9]],['C',[28.4,63.85,31.95,61.35]],['C',[35.45,58.9,37.1,54.65]],['C',[38.7,50.4,38.7,45]],['C',[38.7,39.55,37.1,35.3]],['C',[35.45,31.1,31.95,28.65]],['C',[28.4,26.15,22.8,26.1]],['C',[17.2,26.15,13.65,28.65]],['C',[10.15,31.1,8.5,35.3]],['M',[64.3,24.2]],['L',[19,100.05]],['L',[23.8,100.05]],['L',[69,24.2]],['L',[64.3,24.2]],['M',[76.4,72.8]],['C',[77.35,76.15,77.3,79.4]],['C',[77.35,82.65,76.4,85.9]],['C',[75.5,89.2,73.2,91.45]],['C',[70.85,93.6,66.7,93.7]],['C',[62.55,93.6,60.2,91.45]],['C',[57.9,89.2,57,85.9]],['C',[56.05,82.65,56.1,79.4]],['C',[56.05,76.15,57,72.8]],['C',[57.9,69.5,60.2,67.25]],['C',[62.55,65,66.7,64.9]],['C',[70.85,65,73.2,67.25]],['C',[75.5,69.5,76.4,72.8]],['M',[82.6,79.3]],['C',[82.6,73.9,81,69.65]],['C',[79.35,65.4,75.85,62.95]],['C',[72.3,60.45,66.7,60.4]],['C',[61.1,60.45,57.55,62.95]],['C',[54.05,65.4,52.4,69.65]],['C',[50.8,73.9,50.8,79.3]],['C',[50.8,84.75,52.4,89]],['C',[54.05,93.25,57.55,95.65]],['C',[61.1,98.15,66.7,98.2]],['C',[72.3,98.15,75.85,95.65]],['C',[79.35,93.25,81,89]],['C',[82.6,84.75,82.6,79.3]]];
__motifs["&"] = [['M',[17.95,65.45]],['C',[21.35,62.95,24.8,61.1]],['L',[42.6,82.7]],['C',[39.6,87.1,35.3,89.95]],['C',[31.05,92.8,25.7,92.9]],['C',[21.6,92.9,18.05,91.15]],['C',[14.6,89.35,12.4,86.2]],['C',[10.25,83.05,10.2,78.85]],['C',[10.3,74.55,12.45,71.2]],['C',[14.65,67.95,17.95,65.45]],['M',[28.4,30.65]],['C',[32.4,30.65,35.1,33.05]],['C',[37.8,35.35,37.9,39.8]],['C',[37.85,43.3,36.15,45.9]],['C',[34.45,48.6,32,50.65]],['C',[29.45,52.7,26.9,54.2]],['C',[25.3,52.3,23.45,49.9]],['C',[21.6,47.55,20.25,44.95]],['C',[18.95,42.35,18.9,39.8]],['C',[19,35.35,21.7,33.05]],['C',[24.35,30.65,28.4,30.65]],['M',[44.2,39.8]],['C',[44.15,35.45,42.05,32.2]],['C',[39.9,28.95,36.4,27.15]],['C',[32.8,25.35,28.4,25.3]],['C',[23.95,25.35,20.4,27.15]],['C',[16.9,28.95,14.75,32.2]],['C',[12.65,35.45,12.6,39.8]],['C',[12.65,43.25,14,46.2]],['C',[15.4,49.2,17.4,51.85]],['C',[19.4,54.45,21.4,57]],['C',[17.3,59.15,13.35,62.15]],['C',[9.35,65.15,6.7,69.1]],['C',[4,73.1,3.9,78.2]],['C',[3.95,84.65,6.8,89.15]],['C',[9.55,93.6,14.45,95.85]],['C',[19.3,98.2,25.5,98.2]],['C',[31.85,98.1,37.2,95.25]],['C',[42.6,92.35,46.5,87.4]],['L',[54.1,96.7]],['L',[62,96.7]],['L',[50,82.2]],['C',[52.45,77.5,53.3,72.85]],['C',[54.25,68.25,54.2,65.1]],['L',[47.9,65.1]],['C',[47.95,69.05,47.5,71.8]],['C',[47.05,74.6,45.8,77.1]],['L',[30.2,58.3]],['C',[33.8,56.1,36.95,53.5]],['C',[40.15,50.9,42.15,47.6]],['C',[44.15,44.25,44.2,39.8]]];
__motifs["'"] = [['M',[10.8,25.3]],['L',[10.8,49.65]],['L',[17.1,49.65]],['L',[17.1,25.3]],['L',[10.8,25.3]]];
__motifs["("] = [['M',[24.15,23.8]],['L',[19.2,23.8]],['C',[12.6,33.95,8.9,45.65]],['C',[5.15,57.3,5.1,70.1]],['C',[5.1,78.75,6.75,86.4]],['C',[8.4,94.05,11.55,101.3]],['C',[14.7,108.45,19.2,115.8]],['L',[24.15,115.8]],['C',[20.35,109.55,17.5,102.25]],['C',[14.6,95,13,87.35]],['C',[11.4,79.7,11.4,72.4]],['C',[11.35,59.15,14.45,46.85]],['C',[17.55,34.5,24.15,23.8]]];
__motifs[")"] = [['M',[4.9,23.8]],['L',[-0.1,23.8]],['C',[3.7,30.05,6.6,37.35]],['C',[9.45,44.6,11.1,52.25]],['C',[12.7,59.9,12.7,67.2]],['C',[12.75,80.45,9.6,92.75]],['C',[6.55,105.1,-0.1,115.8]],['L',[4.9,115.8]],['C',[11.45,105.65,15.2,93.95]],['C',[18.95,82.3,19,69.5]],['C',[19,60.85,17.35,53.2]],['C',[15.65,45.55,12.5,38.3]],['C',[9.4,31.1,4.9,23.8]]];
__motifs["*"] = [['M',[19.5,25.3]],['L',[15.6,25.3]],['L',[15.6,37.6]],['L',[4.1,33.5]],['L',[2.7,37.25]],['L',[14.15,41.1]],['L',[6.9,50.9]],['L',[10.1,53.2]],['L',[17.4,43.2]],['L',[24.65,53.2]],['L',[27.9,50.9]],['L',[20.65,41.1]],['L',[32.45,37.25]],['L',[30.95,33.5]],['L',[19.5,37.6]],['L',[19.5,25.3]]];
__motifs["+"] = [['M',[27.4,46.35]],['L',[27.4,68.85]],['L',[4.9,68.85]],['L',[4.9,74.2]],['L',[27.4,74.2]],['L',[27.4,96.7]],['L',[32.7,96.7]],['L',[32.7,74.2]],['L',[55.2,74.2]],['L',[55.2,68.85]],['L',[32.7,68.85]],['L',[32.7,46.35]],['L',[27.4,46.35]]];
__motifs[","] = [['M',[9.7,96.7]],['L',[13.9,96.7]],['C',[14,98.4,13.55,100.3]],['C',[13.1,102.25,12,103.9]],['C',[11,105.45,9.35,106.1]],['L',[9.35,110.4]],['C',[12.3,109.5,14.25,107.4]],['C',[16.15,105.3,17.15,102.5]],['C',[18.05,99.75,18.1,96.8]],['L',[18.1,86.1]],['L',[9.7,86.1]],['L',[9.7,96.7]]];
__motifs["-"] = [['M',[31,66.3]],['L',[6,66.3]],['L',[6,72.1]],['L',[31,72.1]],['L',[31,66.3]]];
__motifs["."] = [['M',[18.1,86.1]],['L',[9.7,86.1]],['L',[9.7,96.7]],['L',[18.1,96.7]],['L',[18.1,86.1]]];
__motifs["/"] = [['M',[29.5,23.8]],['L',[-1.3,98.2]],['L',[4.1,98.2]],['L',[34.55,23.8]],['L',[29.5,23.8]]];
__motifs[":"] = [['M',[18.1,86.1]],['L',[9.7,86.1]],['L',[9.7,96.7]],['L',[18.1,96.7]],['L',[18.1,86.1]],['M',[9.7,46.7]],['L',[9.7,57.3]],['L',[18.1,57.3]],['L',[18.1,46.7]],['L',[9.7,46.7]]];
__motifs[";"] = [['M',[9.7,96.7]],['L',[13.9,96.7]],['C',[14,98.4,13.55,100.3]],['C',[13.1,102.25,12,103.9]],['C',[11,105.45,9.35,106.1]],['L',[9.35,110.4]],['C',[12.3,109.5,14.25,107.4]],['C',[16.15,105.3,17.15,102.5]],['C',[18.05,99.75,18.1,96.8]],['L',[18.1,86.1]],['L',[9.7,86.1]],['L',[9.7,96.7]],['M',[9.7,46.7]],['L',[9.7,57.3]],['L',[18.1,57.3]],['L',[18.1,46.7]],['L',[9.7,46.7]]];
__motifs["<"] = [['M',[4.6,74.15]],['L',[55.35,97.55]],['L',[55.35,92]],['L',[10.8,71.4]],['L',[55.35,50.85]],['L',[55.35,45.35]],['L',[4.6,68.7]],['L',[4.6,74.15]]];
__motifs["="] = [['M',[4.9,83.9]],['L',[55.2,83.9]],['L',[55.2,78.6]],['L',[4.9,78.6]],['L',[4.9,83.9]],['M',[4.9,64.25]],['L',[55.2,64.25]],['L',[55.2,58.9]],['L',[4.9,58.9]],['L',[4.9,64.25]]];
__motifs[">"] = [['M',[4.6,97.55]],['L',[55.35,74.15]],['L',[55.35,68.7]],['L',[4.6,45.35]],['L',[4.6,50.85]],['L',[49.15,71.4]],['L',[4.6,92]],['L',[4.6,97.55]]];
__motifs["?"] = [['M',[31.5,96.7]],['L',[31.5,86.1]],['L',[23.1,86.1]],['L',[23.1,96.7]],['L',[31.5,96.7]],['M',[45.6,32.35]],['C',[42.85,28.25,38.3,26.05]],['C',[33.75,23.85,28.15,23.8]],['C',[20.85,23.85,15.8,26.75]],['C',[10.8,29.65,8.1,34.95]],['C',[5.45,40.15,5.4,47.35]],['L',[11.7,47.35]],['C',[11.6,42.1,13.4,38]],['C',[15.15,33.9,18.75,31.55]],['C',[22.35,29.15,27.8,29.1]],['C',[31.75,29.1,34.95,30.85]],['C',[38.2,32.55,40.15,35.55]],['C',[42.05,38.6,42.1,42.6]],['C',[42.05,46.5,40.25,49.7]],['C',[38.45,52.9,35.6,55.5]],['C',[32.45,58.35,30.2,60.7]],['C',[28,63.05,26.6,65.5]],['C',[25.2,67.9,24.6,71.05]],['C',[24,74.25,24.1,78.85]],['L',[30.4,78.85]],['C',[30.5,74.35,30.8,71.8]],['C',[31.1,69.3,32,67.7]],['C',[32.85,66.05,34.7,64.25]],['C',[36.5,62.4,39.7,59.3]],['C',[43.6,55.8,45.95,51.8]],['C',[48.35,47.75,48.4,42.3]],['C',[48.35,36.5,45.6,32.35]]];
__motifs["@"] = [['M',[46.4,47.1]],['C',[48.2,48.4,49.35,50.5]],['C',[50.5,52.6,50.55,55]],['C',[50.5,58.35,49.2,62.35]],['C',[47.95,66.4,45.7,70.05]],['C',[43.45,73.7,40.45,76.05]],['C',[37.4,78.45,33.9,78.5]],['C',[30.2,78.45,27.95,75.9]],['C',[25.65,73.35,25.6,68.75]],['C',[25.6,65.2,26.8,61.25]],['C',[28.05,57.25,30.25,53.75]],['C',[32.5,50.2,35.65,48]],['C',[38.75,45.75,42.65,45.7]],['C',[44.6,45.75,46.4,47.1]],['M',[53.6,48.8]],['C',[51.9,44.35,49.1,42.35]],['C',[46.4,40.35,43,40.4]],['C',[37.65,40.45,33.3,43]],['C',[28.95,45.5,25.85,49.7]],['C',[22.7,53.9,21,58.95]],['C',[19.3,64.1,19.3,69.3]],['C',[19.3,73.3,20.9,76.6]],['C',[22.45,79.85,25.45,81.8]],['C',[28.35,83.75,32.5,83.8]],['C',[36.4,83.7,39.65,81.7]],['C',[42.9,79.7,45.2,77.2]],['L',[45.4,77.2]],['C',[45.8,80.5,47.65,82.2]],['C',[49.5,83.9,52.1,83.9]],['C',[57.8,83.8,63.1,79.95]],['C',[68.35,76.1,71.8,69.6]],['C',[75.15,63.05,75.3,54.9]],['C',[75.2,45.65,70.8,38.65]],['C',[66.4,31.65,58.8,27.75]],['C',[51.15,23.85,41.4,23.8]],['C',[31.1,23.9,22.8,28.75]],['C',[14.55,33.55,9.65,41.85]],['C',[4.8,50.2,4.7,60.7]],['C',[4.8,71.35,9.5,79.8]],['C',[14.3,88.25,22.65,93.2]],['C',[30.95,98.1,41.8,98.2]],['C',[48.15,98.15,54.05,96.05]],['C',[59.95,93.9,64.8,89.9]],['C',[69.65,85.95,72.7,80.4]],['L',[67.6,80.4]],['C',[64.65,84.6,60.5,87.55]],['C',[56.4,90.55,51.55,92.1]],['C',[46.8,93.7,41.8,93.7]],['C',[32.6,93.6,25.5,89.4]],['C',[18.3,85.2,14.2,77.9]],['C',[10.1,70.65,10,61.4]],['C',[10.05,52.1,14.05,44.65]],['C',[18,37.2,25.1,32.8]],['C',[32.2,28.4,41.6,28.3]],['C',[49.4,28.35,55.8,31.45]],['C',[62.2,34.6,66.05,40.45]],['C',[69.85,46.3,69.95,54.6]],['C',[69.95,58.85,68.6,63.2]],['C',[67.25,67.55,64.9,71.2]],['C',[62.5,74.85,59.5,77.1]],['C',[56.5,79.35,53.15,79.4]],['C',[50.75,79.3,50.75,76.9]],['C',[50.7,74.45,51.8,71.1]],['L',[61.4,42.3]],['L',[56.1,42.3]],['L',[53.6,48.8]]];
__motifs["["] = [['M',[23.75,29.1]],['L',[23.75,23.8]],['L',[7.6,23.8]],['L',[7.6,115.8]],['L',[23.75,115.8]],['L',[23.75,110.45]],['L',[13.9,110.45]],['L',[13.9,29.1]],['L',[23.75,29.1]]];
__motifs["\\"] = [['M',[34.55,98.2]],['L',[3.75,23.8]],['L',[-1.3,23.8]],['L',[29.15,98.2]],['L',[34.55,98.2]]];
__motifs["]"] = [['M',[0.4,29.1]],['L',[10.2,29.1]],['L',[10.2,110.45]],['L',[0.4,110.45]],['L',[0.4,115.8]],['L',[16.5,115.8]],['L',[16.5,23.8]],['L',[0.4,23.8]],['L',[0.4,29.1]]];
__motifs["^"] = [['M',[27.4,27.6]],['L',[4.4,72.9]],['L',[10.2,72.9]],['L',[29.9,33.9]],['L',[49.9,72.9]],['L',[55.6,72.9]],['L',[32.6,27.6]],['L',[27.4,27.6]]];
__motifs["_"] = [['M',[50,104.2]],['L',[0,104.2]],['L',[0,109.2]],['L',[50,109.2]],['L',[50,104.2]]];
__motifs["`"] = [['M',[15.2,37.9]],['L',[4.7,23.8]],['L',[-3.1,23.8]],['L',[10.05,37.9]],['L',[15.2,37.9]]];
}
static private function initializeWidthsUppercase():void {
__widths["A"] = 63;
__widths["B"] = 67;
__widths["C"] = 70;
__widths["D"] = 69;
__widths["E"] = 59;
__widths["F"] = 54;
__widths["G"] = 74;
__widths["H"] = 70;
__widths["I"] = 22;
__widths["J"] = 50;
__widths["K"] = 65;
__widths["L"] = 54;
__widths["M"] = 83;
__widths["N"] = 70;
__widths["O"] = 74;
__widths["P"] = 63;
__widths["Q"] = 74;
__widths["R"] = 67;
__widths["S"] = 63;
__widths["T"] = 56;
__widths["U"] = 69;
__widths["V"] = 59;
__widths["W"] = 91;
__widths["X"] = 57;
__widths["Y"] = 61;
__widths["Z"] = 57;
}
static private function initializeWidthsLowercase():void {
__widths["a"] = 52;
__widths["b"] = 57;
__widths["c"] = 52;
__widths["d"] = 57;
__widths["e"] = 52;
__widths["f"] = 26;
__widths["g"] = 56;
__widths["h"] = 54;
__widths["i"] = 19;
__widths["j"] = 19;
__widths["k"] = 50;
__widths["l"] = 19;
__widths["m"] = 83;
__widths["n"] = 54;
__widths["o"] = 56;
__widths["p"] = 57;
__widths["q"] = 57;
__widths["r"] = 32;
__widths["s"] = 48;
__widths["t"] = 30;
__widths["u"] = 54;
__widths["v"] = 46;
__widths["w"] = 74;
__widths["x"] = 48;
__widths["y"] = 46;
__widths["z"] = 46;
}
static private function initializeWidthsNumbers():void {
__widths["0"] = 56;
__widths["1"] = 56;
__widths["2"] = 56;
__widths["3"] = 56;
__widths["4"] = 56;
__widths["5"] = 56;
__widths["6"] = 56;
__widths["7"] = 56;
__widths["8"] = 56;
__widths["9"] = 56;
}
static private function initializeWidthsPunctuation():void {
__widths[" "] = 28;
__widths["!"] = 24;
__widths["\""] = 37;
__widths["#"] = 56;
__widths["$"] = 56;
__widths["%"] = 89;
__widths["&"] = 61;
__widths["'"] = 28;
__widths["("] = 24;
__widths[")"] = 24;
__widths["*"] = 35;
__widths["+"] = 60;
__widths[","] = 28;
__widths["-"] = 37;
__widths["."] = 28;
__widths["/"] = 33;
__widths[":"] = 28;
__widths[";"] = 28;
__widths["<"] = 60;
__widths["="] = 60;
__widths[">"] = 60;
__widths["?"] = 54;
__widths["@"] = 80;
__widths["["] = 24;
__widths["\\"] = 33;
__widths["]"] = 24;
__widths["^"] = 60;
__widths["_"] = 50;
__widths["`"] = 19;
}
}
}
|
package com.dormouse
{
/**
* 处理Promise数组,包装返回新的Promise对象
*
* @author huang.xinghui
*
*/
public class Enumerator
{
public function Enumerator(input:Array, abortOnReject:Boolean) {
this.initializeEnumerator(input, abortOnReject);
}
private var _promise:Promise;
public function get promise():Promise
{
return _promise;
}
private var length:int;
[ArrayElementType("com.dormouse.Promise")]
private var _input:Array;
private var _remaining:int;
private var _abortOnReject:Boolean;
private var _result:Array;
private function initializeEnumerator(input:Array, abortOnReject:Boolean):void {
this._promise = new Promise(function():void {});
this._abortOnReject = abortOnReject;
this._input = input;
this.length = input.length;
this._remaining = input.length;
this._result = new Array(this.length);
this.enumerate();
if (this._remaining === 0) {
this._promise.fullfill(this._result);
}
}
private function enumerate():void {
for (var i:int = 0; this._promise.state === Promise.PENDING && i < this.length; i++) {
this.eachEntry(this._input[i], i);
}
}
private function eachEntry(entry:Promise, i:int):void {
if (entry.state !== Promise.PENDING) {
this.settledAt(entry.state, i, entry.result);
} else {
this.willSettleAt(entry, i);
}
}
private function settledAt(state:int, i:int, value:*):void {
var promise:Promise = this._promise;
if (promise.state === Promise.PENDING) {
this._remaining--;
if (this._abortOnReject && state === Promise.REJECTED) {
promise.reject(value);
} else {
this._result[i] = value;
}
}
if (this._remaining === 0) {
promise.fullfill(this._result);
}
}
private function willSettleAt(promise:Promise, i:int):void {
var enumerator:Enumerator = this;
promise.subscribe(null, function(value:*):void {
enumerator.settledAt(Promise.FULFILLED, i, value);
}, function(reason:*):void {
enumerator.settledAt(Promise.REJECTED, i, reason);
});
}
}
} |
package starling.quadtreeSprite
{
import flash.utils.Dictionary;
import flash.geom.Rectangle;
import starling.core.RenderSupport;
import starling.display.DisplayObject;
import starling.display.Sprite;
import starling.events.Event;
public class QuadtreeSprite extends Sprite
{
private var _quadtree:Quadtree;
private var _viewport:Rectangle;
private var _children:Vector.<DisplayObject>;
private var _childrenPositions:Dictionary;
private var _dirty:Boolean;
public function QuadtreeSprite(worldSpace:Rectangle, maintainOrder:Boolean = false)
{
_quadtree = new Quadtree(worldSpace.left, worldSpace.top, worldSpace.right, worldSpace.bottom);
_viewport = worldSpace.clone();
_children = new Vector.<DisplayObject>();
if (maintainOrder) _childrenPositions = new Dictionary();
_dirty = true;
}
override public function render(support:RenderSupport, parentAlpha:Number):void
{
refresh();
super.render(support, parentAlpha);
}
public function updateChild(child:DisplayObject):void
{
// TO.DO Is it better to save them in a set and update them at the time when the refresh is called?
// Solves the problem of updating a child multiple times per frame.
_quadtree.update(child, child.bounds);
_dirty = true;
}
override public function addChild(child:DisplayObject):DisplayObject
{
addChildAt(child, this.dynamicNumChildren);
return child;
}
override public function addChildAt(child:DisplayObject, index:int):DisplayObject
{
// No need to set the dirty, we can just check if the object intersects.
if (_viewport.intersects(child.bounds)) super.addChildAt(child, this.numChildren);
if (_childrenPositions)
{
_children.splice(index, 0, child);
for (var i:int = index; i < _children.length; i++)
_childrenPositions[_children[i]] = i;
this.invalidate();
}
else
{
// Don't care about the order
_children.push(child);
}
_quadtree.insert(child, child.bounds);
// TO.DO Can this be removed?
_dirty = true;
return child;
}
public function get dynamicNumChildren():int
{
return _children.length;
}
public function dynamicGetChildAt(index:int):DisplayObject
{
return _children[index];
}
override public function removeChild(child:DisplayObject, dispose:Boolean=false):DisplayObject
{
var index:int = _children.indexOf(child);
_children.splice(index, 1);
_quadtree.remove(child);
if (_childrenPositions) delete _childrenPositions[child];
// to remove the need for refresh, remove the child from the container if it's there
if (this.contains(child)) super.removeChild(child, dispose);
return child;
}
public function refresh():void
{
if (!_dirty) return;
_dirty = false;
this.removeChildren();
var visibleObjects:Vector.<Object> = _quadtree.objectsInRectangle(_viewport);
// To maintain the order sort children by their insertion index
if (_childrenPositions)
{
visibleObjects.sort(function(first:DisplayObject, second:DisplayObject):Number
{
return _childrenPositions[first] - _childrenPositions[second];
});
}
for each (var visibleObject:DisplayObject in visibleObjects)
{
super.addChildAt(visibleObject, this.numChildren);
}
this.dispatchEventWith(Event.CHANGE);
}
public function get visibleViewport():Rectangle
{
return _viewport;
}
public function set visibleViewport(viewport:Rectangle):void
{
if (viewport.equals(_viewport)) return;
_viewport = viewport.clone();
_dirty = true;
}
public function get dirty():Boolean
{
return _dirty;
}
public function invalidate():void
{
_dirty = true;
}
}
}
|
package devoron.components.filechooser.rooms
{
import away3d.cameras.Camera3D;
import away3d.cameras.lenses.PerspectiveLens;
import away3d.containers.View3D;
import away3d.debug.Trident;
import away3d.events.AssetEvent;
import away3d.events.LoaderEvent;
import away3d.events.ParserEvent;
import away3d.loaders.AssetLoader;
import away3d.primitives.WireframePlane;
import devoron.airmediator.AirMediator;
import devoron.components.color.ColorChooserForm;
import devoron.components.filechooser.renderers.FileCellRenderer;
import devoron.components.comboboxes.DSComboBox;
import devoron.components.HSVSlider;
import devoron.components.SliderForm;
import devoron.components.WhiteChB;
import devoron.components.DSLabel;
import devoron.utils.searchandreplace.workers.SearchAndReplaceWorker.src.devoron.file.FileInfo;
import devoron.file.LOC;
import devoron.file.NATIVE;
import devoron.geometry.parsers.geometries.ExternalGeometrySubParser;
import devoron.image.utils.ImageDecoder;
import devoron.image.utils.ImageUtil;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.filters.DropShadowFilter;
import flash.geom.Vector3D;
import org.aswing.ASColor;
import org.aswing.AssetIcon;
import org.aswing.border.EmptyBorder;
import org.aswing.decorators.ColorDecorator;
import org.aswing.event.AWEvent;
import org.aswing.event.InteractiveEvent;
import org.aswing.event.ListItemEvent;
import org.aswing.event.PopupEvent;
import org.aswing.ext.Form;
import org.aswing.ext.GeneralGridListCellFactory;
import org.aswing.ext.GridList;
import org.aswing.ext.KnobForm;
import org.aswing.geom.IntDimension;
import org.aswing.Insets;
import org.aswing.JButton;
import org.aswing.JDropDownButton;
import org.aswing.JFrame;
import org.aswing.JFrameTitleBar;
import org.aswing.JList;
import org.aswing.JNumberKnob;
import org.aswing.JNumberStepper;
import org.aswing.JPanel;
import org.aswing.JPopup;
import org.aswing.JScrollPane;
import org.aswing.layout.FlowLayout;
import org.aswing.util.HashMap;
import org.aswing.util.Stack;
import org.aswing.VectorListModel;
/**
* AudioFCH
*
* Render for audio-files in FileChooser.
* @author Devoron
*/
public class FIsRoom3D extends JFrame
{
[Embed(source = "../../../../../assets/icons/sound_editor_icon16.png")]
private const AUDIO_ICON:Class;
private var previewObjectCompleteListener:Function;
private var path:String;
// список уже распарсенных ассетов
public var objectsCash:HashMap;
public var objectsStack:Stack;
public var currentMode:Namespace;
private var running:Boolean = false;
private var enabled:Boolean = true;
private var computedPath:String;
private var view:View3D;
private var loader:AssetLoader;
private var geometryParser:ExternalGeometrySubParser;
private var panePanel:JPanel;
private var trident:Trident;
private var wireframeGrid:WireframePlane;
private var skyboxButtonPanel:JPanel;
private var filesList:GridList;
private var filesModel:VectorListModel;
public function FIsRoom3D()
{
if (CONFIG::air)
{
currentMode = NATIVE;
}
else {
currentMode = LOC;
}
//dialogFrame = new JFrame(null, title, false);
filters = [new DropShadowFilter(4, 45, 0x000000, 0.14, 4, 4, 0.5, 2)];
(getTitleBar() as JFrameTitleBar).setClosableOnly(true);
setBackground(new ASColor(0X0E1012, 1));
setIcon(new AssetIcon(new AUDIO_ICON));
setMinimumSize(new IntDimension(770, 300));
setSize(new IntDimension(770, 300));
setMaximumWidth(770);
setTitle("Room3D");
var cd:ColorDecorator = new ColorDecorator(new ASColor(0x262F2B, 1), new ASColor(0XFFFFFF, 0.24), 4);
cd.setGaps(-2, 1, 1, -2);
setBackgroundDecorator(cd);
//dialogFrame.setBackgroundDecorator(new ColorBackgroundDecorator(new ASColor(0x262F2B, 1), new ASColor(0xFFFFFF, 0.4)));
panePanel = new JPanel();
panePanel.setBorder(new EmptyBorder(null, new Insets(0, 10, 5, 10)));
//panePanel.setLayout(new BorderLayout(10, 2));
//panePanel.setSizeWH(730, 430);
setContentPane(panePanel);
var controlsForm:Form = new Form();
controlsForm.setTextRenderer(DSLabel);
var rotationChB:WhiteChB = new WhiteChB("rotation");
//controlsForm.addLeftHoldRow(0, 20, rotationChB);
var speedSL:SliderForm = new SliderForm("speed", 0, 100);
controlsForm.addLeftHoldRow(0, /*20, */rotationChB, speedSL);
var hsvSL:HSVSlider = new HSVSlider();
hsvSL.setPreferredHeight(12);
hsvSL.setPreferredWidth(181);
hsvSL.addStateListener(hsvSLListener);
controlsForm.addLeftHoldRow(0, new DSLabel("background color"), hsvSL);
skyboxButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0, false));
skyboxButtonPanel.setPreferredHeight(30);
//wireframeGrid.se
var roomTexturesPanel:JPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0, false));
controlsForm.addLeftHoldRow(0, "skyboxes");
controlsForm.addLeftHoldRow(0, skyboxButtonPanel);
controlsForm.addLeftHoldRow(0, "room textures");
controlsForm.addLeftHoldRow(0, roomTexturesPanel);
//width:Number, height:Number, segmentsW:int = 10, segmentsH:int = 10, color:uint = 0xFFFFFF, thickness:Number = 1, orientation:String = "yz"
var gridWST:JNumberStepper = new JNumberStepper();
var gridHST:JNumberStepper = new JNumberStepper();
var gridSegmentW:JNumberStepper = new JNumberStepper();
var gridSegmentH:JNumberStepper = new JNumberStepper();
var gridCCF:ColorChooserForm = new ColorChooserForm("grid color");
var gridThicknessST:JNumberStepper = new JNumberStepper();
var orientationCB:DSComboBox = new DSComboBox();
var showSkyboxesListBtn:JDropDownButton = new JDropDownButton("", new AssetIcon(new AUDIO_ICON), true, createSkyboxesList());
//showSkyboxesListBtn.setPopupAlignment(JDropDownButton.BOTTOM);
showSkyboxesListBtn.setPreferredWidth(35);
showSkyboxesListBtn.setPopupAlignment(JDropDownButton.RIGHT);
showSkyboxesListBtn.setToolTipText("preview helpers");
controlsForm.addLeftHoldRow(0, showSkyboxesListBtn);
/* var angleKF:KnobForm = new KnobForm("angle", KnobForm.X_AXIS, 26);
angleKF.setKnobRadius(20);
controlsForm.addLeftHoldRow(0, 20, angleKF);*/
/*var knobForm:KnobForm = new KnobForm("rotation speed", KnobForm.X_AXIS, 3, KnobForm.RIGHT);
controlsForm.addLeftHoldRow(0, 20, knobForm);
knobForm.setKnobRadius(15);*/
panePanel.append(controlsForm);
objectsStack = new Stack();
objectsCash = new HashMap();
createSimpleWorld();
addEventListener(PopupEvent.POPUP_OPENED, onPopupOpened);
AirMediator.currentMode::getDirectory("F:\\Projects\\projects\\flash\\FileChooserSWF\\assets\\skyboxes", resultHandler, true/*, errorHandler:Function = null*/)
}
protected function createSkyboxesList():JPopup
{
var popup:JPopup = new JPopup();
var cd:ColorDecorator = new ColorDecorator(new ASColor(0x262F2B, 1), new ASColor(0XFFFFFF, 0.24), 4);
cd.setGaps(-2, 1, 0, -1);
popup.setBackgroundDecorator(cd);
//viewsHashMap = new HashMap();
//contentViews = new HashMap();
/*setSize(new IntDimension(250, 200));
setPreferredSize(new IntDimension(250, 200));
setMaximumSize(new IntDimension(250, 200));
setMinimumSize(new IntDimension(250, 200));*/
//var modulForm:Form = new Form(new VerticalCenterLayout());
var modulForm:Form = new Form();
modulForm.setBorder(new EmptyBorder(null, new Insets(0, 2, 0, 2)));
//setContentPane(modulForm);
popup.append(modulForm);
filesModel = new VectorListModel();
filesList = new GridList(filesModel, new GeneralGridListCellFactory(FileCellRenderer), 4, 8);
filesList.doubleClickEnabled = true;
//filesList.addEventListener(ListItemEvent.ITEM_DOUBLE_CLICK, onDoubleClick);
//filesList.addSelectionListener(selectContentViewListener);
//filesList.setPreferredCellWidthWhenNoCount(280);
//filesList.setPreferredCellWidthWhenNoCount(80);
//filesList.addSelectionListener(filesListSelectionHandler);
filesList.setSelectionMode(JList.SINGLE_SELECTION);
var filesPane:JScrollPane = new JScrollPane(filesList);
//filesPane.setPreferredHeight(200);
filesPane.setSize(new IntDimension(200, 100));
filesPane.setMinimumSize(new IntDimension(200, 100));
filesPane.setPreferredSize(new IntDimension(200, 100));
filesPane.setVerticalScrollBarPolicy(JScrollPane.SCROLLBAR_ALWAYS);
//filesPane.setHorizontalScrollBarPolicy(JScrollPane.SCROLLBAR_AS_NEEDED);
filesPane.setHorizontalScrollBarPolicy(JScrollPane.SCROLLBAR_ALWAYS);
//filesPane.buttonMode = true;
modulForm.addRightHoldRow(0, filesPane);
popup.pack();
return popup;
}
private function resultHandler(fi:FileInfo):void
{
gtrace(fi);
//skyboxButtonPanel
var files:Array = fi.directoryListing;
var btn:JButton;
for (var i:int = 0; i < files.length; i++)
{
var bi:Bitmap;
if (!bi)
bi = new Bitmap(new BitmapData(35, 25));
var bd:BitmapData = ImageUtil.scaleBitmapData(bi.bitmapData, 35 / bi.width);
var icon:AssetIcon = new AssetIcon(new Bitmap(bd));
btn = new JButton("", icon);
btn.setSize(new IntDimension(35, 25));
btn.addActionListener(walpaperBtnHandler);
btn.setShiftOffset(0);
//btn.name = String(j);
skyboxButtonPanel.append(btn);
new ImageDecoder((files[i] as FileInfo).data, onSkyboxImageComplete, btn);
}
/*var btn:JButton;
for (var j:int = 0; j < 8; j++)
{
var bi:Bitmap;
if (!bi)
bi = new Bitmap(new BitmapData(35, 25));
var bd:BitmapData = ImageUtil.scaleBitmapData(bi.bitmapData, 35 / bi.width);
var icon:AssetIcon = new AssetIcon(new Bitmap(bd));
btn = new JButton("", icon);
btn.setSize(new IntDimension(35, 25));
btn.addActionListener(walpaperBtnHandler);
btn.setShiftOffset(0);
btn.name = String(j);
//(j < 4 ? p1 : p2).append(btn);
skyboxButtonPanel.append(btn);
}*/
}
private function onSkyboxImageComplete(bd:BitmapData, btn:JButton):void
{
var bd2:BitmapData = ImageUtil.scaleBitmapData(bd, 35 / bd.width);
var icon:AssetIcon = new AssetIcon(new Bitmap(bd2));
btn.setIcon(icon);
}
private function walpaperBtnHandler(e:AWEvent):void
{
}
private function hsvSLListener(e:InteractiveEvent):void
{
//ApplicationBackgroundDecorator.setHSV(hsvSL.getValue());
}
/**
* Построить комнату:
* 1. распарсить объект по ссылке
* 2. добавить объект в комнату
* @param path
*/
public function buildRoom(path:String):void {
AirMediator.currentMode::getFile(path, onLoad, true);
}
private function onPopupOpened(e:PopupEvent):void
{
//stage.addChild(view3D);
panePanel.addChild(view);
}
/*public function omg():void {
var ds:DataStructur;
var transformDSO:DataStructurObject;
var matricies:Vector.<Matrix3D> = currentMatrixEditor.getMatrices();
if (matricies)
{
for (var i:int = 0; i < count; i++)
{
ds = createdObjects[i];
transformDSO = ds.getDataByContainerName("TransformMatrix");
if (transformDSO)
{
transformDSO.active = false;
var transforms:Vector.<Vector3D> = matricies[i].decompose();
transformDSO.positionX = transforms[0].x;
transformDSO.positionYST = transforms[0].y;
transformDSO.positionZST = transforms[0].z;
transformDSO.rotationXST = transforms[1].x;
transformDSO.rotationYST = transforms[1].y;
transformDSO.rotationZST = transforms[1].z;
transformDSO.scaleXST = transforms[2].x;
transformDSO.scaleYST = transforms[2].y;
transformDSO.scaleZST = transforms[2].z;
transformDSO.active = true;
}
}
}
}*/
/**
* Создать примитивный мир, в котором будут отрисовываться preview для
* трёхмерных объектов.
*/
private function createSimpleWorld():void {
var camera:Camera3D = new Camera3D();
camera.position = new Vector3D(0, 0, -50);
//camera2.lookAt(World.meshes[0].position);
view = new View3D(null, camera, null, true);
view.antiAlias = 1;
view.camera.lens = new PerspectiveLens(90);
view.width = 750;
view.height = 280;
view.backgroundAlpha = 0;
//Main_FILE_CHOOSER_FLASH.STAGE.addChild(view3D);
view.alpha = 0;
view.visible = false;
trident = new Trident(70, true);
view.scene.addChild(trident);
view.buttonMode = true;
// сетка
wireframeGrid = new WireframePlane(300, 300, 10, 10, 0x0, 0.7, WireframePlane.ORIENTATION_XZ);
wireframeGrid.color = 0xFFFFFF;
view.scene.addChild(wireframeGrid);
//view2.addEventListener(Event.ENTER_FRAME, onEnterFrame);
/*this.addChild(view2);*/
/*var cube:Mesh = new Mesh(new CubeGeometry(), new ColorMaterial(0x5E8D23));
view2.scene.addChild(cube);
*/
//SingleFileLoader.enableParser(AWDParser);
//var meshParser:MeshParser = new MeshParser();
//loader = new AssetLoader();
/*loader.addEventListener(AssetEvent.ASSET_COMPLETE, onAnimation);
loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onComplete);
loader.addEventListener(LoaderEvent.LOAD_ERROR, onError);*/
}
/* INTERFACE devoron.components.filechooser.FileChooserHelper */
public function getSupportedExtensions():Array
{
return ["awd"];
}
/* INTERFACE devoron.components.filechooser.IFileChooserHelper */
public function getType():String
{
return "audio";
}
public override function isEnabled():Boolean
{
return enabled;
}
public override function setEnabled(b:Boolean):void
{
enabled = b;
if (b == false) {
objectsStack.clear();
if(previewObjectCompleteListener!=null)
previewObjectCompleteListener.call(null, { path:computedPath, icon: null } );
}
}
/*private function workerStateHandler(e:Event):void
{
AirMediator.currentMode::getFile(path, onLoad, true);
}*/
private function onLoad(fi:FileInfo):void
{
/* var mesh:Mesh = new Mesh(e);
view3D.scene.addChild(mesh);
view3D.camera.lookAt(mesh.position);*/
//gtrace("2: получен файл " + fi.nativePath + " " + fi.data.length + " mainToBackSpectrum " + mainToBackSpectrum.state);
// отдать потоку байты аудио-файла и запустить выполнение потока
//MessageChannelState.
//fi.data.shareable = true;
//spectrumWorker.setSharedProperty("bytes", fi.data);
//mainToBackSpectrum.send(fi.nativePath);
//runWorker();
/* parserCls = AllSubParsers.getRelatedParser(id, AllSubParsers.ALL_GEOMETRIES);
if (!parserCls)
dieWithError("Unknown geometry parser");
_geometryParser = new parserCls();
addSubParser(_geometryParser);
_geometryParser.parseAsync(subData);*/
/*parser.addEventListener(ParserEvent.PARSE_ERROR, onEr);
parser.parseAsync({url: "C:\\Users\\Devoron\\Desktop\\asset_rocks.awd"});*/
geometryParser = new ExternalGeometrySubParser();
geometryParser.addEventListener(AssetEvent.GEOMETRY_COMPLETE, onGeometry);
loader.loadData({url: getText(fi.nativePath)/*"C:\\Users\\Devoron\\Desktop\\asset_rocks.awd"*/}, "mesh", null, null, geometryParser);
//onEnterFrame(null);
}
public function getText(str:String):String
{
var text:String = str;
text = text.replace(/\\/g, '/');
//text = text.replace( /\\/g, '\\\\');
return text;
}
private function onEr(e:ParserEvent):void
{
gtrace(e);
}
private function onGeometry(e:AssetEvent):void
{
gtrace("2:Создана геометрия " + e);
//onEnterFrame(e.asset as Geometry);
}
private function computeNext():void {
if (objectsStack.isEmpty()) {
running = false;
}
else {
var obj:Object = objectsStack.pop();
if(obj){
var fi:FileInfo = obj.fi;
var listener:Function = obj.listener;
previewObjectCompleteListener = listener;
path = fi.nativePath;
AirMediator.currentMode::getFile(fi.nativePath, onLoad, true, errorHandler);
gtrace("ЗАПРОС НА ФАЙЛ " + fi.nativePath + " осталось " + objectsStack.size());
}
}
}
private function errorHandler(data:String):void
{
gtrace("2:Ошибка " + data);
}
private function onError(e:LoaderEvent):void
{
gtrace(e);
}
private function onComplete(e:LoaderEvent):void
{
gtrace(e);
}
private function onAnimation(e:AssetEvent):void
{
gtrace(e);
}
}
} |
package utils.display
{
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
public function filterChildrenByProps(container:DisplayObjectContainer, props:Object):Array
{
var filteredChildren:Array = [];
var child:DisplayObject;
for (var i:int = 0, l:int = container.numChildren; i < l; i++)
{
child = container.getChildAt(i);
var isOK:Boolean = true;
for (var prop:String in props)
{
if (child[prop] != props[prop])
{
isOK = false;
break;
}
}
if (isOK)
filteredChildren.push(child);
}
return filteredChildren;
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// 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.beads.views
{
import org.apache.royale.core.IIndexedItemRenderer;
import org.apache.royale.core.IItemRenderer;
import org.apache.royale.core.IRollOverModel;
import org.apache.royale.core.ISelectableItemRenderer;
import org.apache.royale.core.ISelectionModel;
import org.apache.royale.events.Event;
import org.apache.royale.html.beads.VirtualDataContainerView;
import org.apache.royale.utils.getSelectionRenderBead;
/**
* The VirtualListView class creates the visual elements of the org.apache.royale.jewel.List
* component in a way that can be recicled to reuse as the user scrolls the list getting performance improvements
* when dataproviders with lots of items are passed to the component. In This way Royale just create a few
* item renderers visible for the user, instead of one renderer for each item in the data provider.
*
* A List consists of the area to display the data (in the dataGroup), any
* scrollbars, and so forth.
*
* @viewbead
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.7
*/
public class VirtualListView extends VirtualDataContainerView implements IScrollToIndexView
{
public function VirtualListView()
{
super();
}
protected var listModel:ISelectionModel;
protected var lastSelectedIndex:int = -1;
/**
* @private
* @royaleignorecoercion org.apache.royale.core.ISelectionModel
*/
override protected function handleInitComplete(event:Event):void
{
listModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
listModel.addEventListener("selectionChanged", selectionChangeHandler);
listModel.addEventListener("rollOverIndexChanged", rollOverIndexChangeHandler);
listModel.addEventListener("popUpCreated", itemsCreatedHandler);
super.handleInitComplete(event);
}
/**
* @private
* Ensure the list selects the selectedItem if some is set by the user at creation time
*/
override protected function itemsCreatedHandler(event:Event):void
{
//super.itemsCreatedHandler(event);
if(listModel.selectedIndex != -1)
selectionChangeHandler(null);
}
protected var firstElementIndex:int = 1;
/**
* Retrieve the renderer for a given index
* @royaleignorecoercion org.apache.royale.core.IIndexedItemRenderer
* @royaleignorecoercion org.apache.royale.core.IItemRenderer
*/
override public function getItemRendererForIndex(index:int):IItemRenderer
{
if (contentView.numElements == 0)
return null;
var firstIndex:int = (contentView.getElementAt(firstElementIndex) as IIndexedItemRenderer).index;
if (index < firstIndex)
return null;
if (index >= (firstIndex + contentView.numElements))
return null;
return contentView.getElementAt(index - firstIndex + firstElementIndex) as IItemRenderer;
}
/**
* @private
* @royaleignorecoercion org.apache.royale.core.IItemRenderer
*/
protected function selectionChangeHandler(event:Event):void
{
var selectionBead:ISelectableItemRenderer;
var ir:IItemRenderer = dataGroup.getItemRendererForIndex(lastSelectedIndex);
if (ir)
{
selectionBead = getSelectionRenderBead(ir);
if (selectionBead)
selectionBead.selected = false;
}
ir = dataGroup.getItemRendererForIndex(listModel.selectedIndex) as IItemRenderer;
if (ir) {
selectionBead = getSelectionRenderBead(ir);
if (selectionBead)
selectionBead.selected = true;
}
lastSelectedIndex = listModel.selectedIndex;
}
protected var lastRollOverIndex:int = -1;
/**
* @private
* @royaleignorecoercion org.apache.royale.core.IIndexedItemRenderer
* @royaleignorecoercion org.apache.royale.core.IRollOverModel
*/
protected function rollOverIndexChangeHandler(event:Event):void
{
var selectionBead:ISelectableItemRenderer;
var ir:IItemRenderer = dataGroup.getItemRendererForIndex(lastRollOverIndex);
if (ir)
{
selectionBead = getSelectionRenderBead(ir);
if (selectionBead)
selectionBead.hovered = false;
}
ir = dataGroup.getItemRendererForIndex((listModel as IRollOverModel).rollOverIndex);
if (ir) {
selectionBead = getSelectionRenderBead(ir);
if (selectionBead)
selectionBead.hovered = true;
}
lastRollOverIndex = (listModel as IRollOverModel).rollOverIndex;
selectionChangeHandler(null);
}
override protected function dataProviderChangeHandler(event:Event):void
{
}
/**
* Ensures that the data provider item at the given index is visible.
*
* If the item is visible, the <code>verticalScrollPosition</code>
* property is left unchanged even if the item is not the first visible
* item. If the item is not currently visible, the
* <code>verticalScrollPosition</code>
* property is changed make the item the first visible item, unless there
* aren't enough rows to do so because the
* <code>verticalScrollPosition</code> value is limited by the
* <code>maxVerticalScrollPosition</code> property.
*
* @param index The index of the item in the data provider.
*
* @return <code>true</code> if <code>verticalScrollPosition</code> changed.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Royale 0.9.7
*/
public function scrollToIndex(index:int):Boolean
{
// need to be implemented
// var scrollArea:HTMLElement = (_strand as IStyledUIBase).element;
// var oldScroll:Number = scrollArea.scrollTop;
// var totalHeight:Number = 0;
// var pm:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
// if(pm.variableRowHeight)
// {
// //each item render can have its own height
// var n:int = listModel.dataProvider.length;
// var irHeights:Array = [];
// for (var i:int = 0; i <= index; i++)
// {
// var ir:IItemRenderer = dataGroup.getItemRendererForIndex(i) as IItemRenderer;
// totalHeight += ir.element.clientHeight;
// irHeights.push(totalHeight + ir.element.clientHeight - scrollArea.clientHeight);
// }
// scrollArea.scrollTop = Math.min(irHeights[index], totalHeight);
// } else
// {
// var rowHeight:Number;
// // all items renderers with same height
// rowHeight = isNaN(pm.rowHeight) ? ListPresentationModel.DEFAULT_ROW_HEIGHT : rowHeight;
// totalHeight = listModel.dataProvider.length * rowHeight - scrollArea.clientHeight;
// scrollArea.scrollTop = Math.min(index * rowHeight, totalHeight);
// }
// return oldScroll != scrollArea.scrollTop;
return false;
}
}
}
|
package net.richardlord.coral
{
import org.flexunit.Assert;
use namespace coral_internal;
public class Matrix3dUnitTest
{
private var e : Number = 0.000001;
private var matrix1 : Matrix3d;
private var determinant1 : Number;
private var inverse1 : Matrix3d;
private var matrix2 : Matrix3d;
private var determinant2 : Number;
private var inverse2 : Matrix3d;
private var pre1 : Matrix3d;
private var post1 : Matrix3d;
private var result1 : Matrix3d;
private var pre2 : Matrix3d;
private var post2 : Matrix3d;
private var result2 : Matrix3d;
private var transform1 : Matrix3d;
private var point1 : Point3d;
private var vector1 : Vector3d;
private var transformedPoint1 : Point3d;
private var transformedVector1 : Vector3d;
private var transform2 : Matrix3d;
private var point2 : Point3d;
private var vector2 : Vector3d;
private var transformedPoint2 : Point3d;
private var transformedVector2 : Vector3d;
private var transform3 : Matrix3d;
private var point3 : Point3d;
private var vector3 : Vector3d;
private var transformedPoint3 : Point3d;
private var transformedVector3 : Vector3d;
[Before]
public function createData() : void
{
matrix1 = new Matrix3d( 1, 2, 3, 1, 2, 3, 1, 2, 1, 1, 2, 3, 2, 2, 3, 3 );
determinant1 = 10;
inverse1 = new Matrix3d( -0.8, -0.2, -1.4, 1.8, 0.5, 0.5, 0.5, -1, 0.3, -0.3, -0.1, 0.2, -0.1, 0.1, 0.7, -0.4 );
matrix2 = new Matrix3d( 2, -1, 3, 0, 1, 3, 2, 1, -1, -2, -2, 1, 0, 0, 0, 1 );
determinant2 = -1;
inverse2 = new Matrix3d( 2, 8, 11, -19, 0, 1, 1, -2, -1, -5, -7, 12, 0, 0, 0, 1 );
pre1 = new Matrix3d( 1, 2, 3, 4, 2, 3, 3, 2, 1, 2, 4, 4, 4, 1, 2, 1 );
post1 = new Matrix3d( 3, 1, 2, 3, 2, 1, 2, 4, 4, 1, 2, 1, 2, 3, 4, 4 );
result1 = new Matrix3d( 27, 18, 28, 30, 28, 14, 24, 29, 31, 19, 30, 31, 24, 10, 18, 22 );
pre2 = new Matrix3d( 2, 3, 2, 3, 1, 5, 4, 3, 4, 2, 4, 5, 1, 2, 1, 1 );
post2 = new Matrix3d( 3, 2, 4, 3, 2, 1, 2, 3, 4, 2, 3, 1, 3, 4, 2, 1 );
result2 = new Matrix3d( 29, 23, 26, 20, 38, 27, 32, 25, 47, 38, 42, 27, 14, 10, 13, 11 );
transform1 = new Matrix3d( 1, 2, 4, 3, 4, 3, 2, 1, 2, 4, 3, 2, 0, 0, 0, 1 );
point1 = new Point3d( 2, 3, 1 );
transformedPoint1 = new Point3d( 15, 20, 21 );
vector1 = new Vector3d( 2, 3, 1 );
transformedVector1 = new Vector3d( 12, 19, 19 );
transform2 = new Matrix3d( 4, 2, 2, 3, 1, -2, 4, -1, 3, 2, 1, 1, 3, 2, 2, 4 );
point2 = new Point3d( -3, 2, 2 );
transformedPoint2 = new Point3d( -1, 0, -2 );
transformedPoint2.w = 3;
vector2 = new Vector3d( -3, 2, 2 );
transformedVector2 = new Vector3d( -4, 1, -3 );
transformedVector2.w = -1;
transform3 = new Matrix3d( 1, 3, 2, 1, -2, 1, -1, 3, 4, 1, 3, 3, 2, -1, 2, 4 );
point3 = new Point3d( 2, -1, 3 );
point3.w = 2;
transformedPoint3 = new Point3d( 7, -2, 22 );
transformedPoint3.w = 19;
vector3 = new Vector3d( 2, -1, 3 );
vector3.w = 2;
transformedVector3 = new Vector3d( 7, -2, 22 );
transformedVector3.w = 19;
}
[Test]
public function identity() : void
{
Assert.assertTrue( "Identity matrix correct", Matrix3d.IDENTITY.equals( new Matrix3d( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ) ) );
Assert.assertFalse( "Identity matrix new each time", Matrix3d.IDENTITY == Matrix3d.IDENTITY );
Assert.assertTrue( "Identity matrices are equal", Matrix3d.IDENTITY.equals( Matrix3d.IDENTITY ) );
var random : Matrix3d = randomMatrix();
var m:Matrix3d = random.clone();
m.append( Matrix3d.IDENTITY );
Assert.assertTrue( "Identity matrix has no effect", m.equals( random ) );
m = random.clone();
m.prepend( Matrix3d.IDENTITY );
Assert.assertTrue( "Identity matrix has no effect", m.equals( random ) );
}
[Test]
public function zero() : void
{
Assert.assertTrue( "Zero matrix is zero", Matrix3d.ZERO.equals( new Matrix3d( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) ) );
Assert.assertFalse( "Zero matrix new each time", Matrix3d.ZERO == Matrix3d.ZERO );
Assert.assertTrue( "Zero matrices are equal", Matrix3d.ZERO.equals( Matrix3d.ZERO ) );
var random : Matrix3d = randomMatrix();
var m:Matrix3d = random.clone();
m.append( Matrix3d.ZERO );
Assert.assertTrue( "Zero matrix produces zero", m.equals( Matrix3d.ZERO ) );
m = random.clone();
m.prepend( Matrix3d.ZERO );
Assert.assertTrue( "Zero matrix produces zero", m.equals( Matrix3d.ZERO ) );
}
[Test]
public function constructIdentity() : void
{
Assert.assertTrue( "Default constructor is identity", Matrix3d.IDENTITY.equals( new Matrix3d() ) );
}
[Test]
public function construct() : void
{
var a : Vector.<Number> = randomVectorNumber( 16 );
var matrix : Matrix3d = new Matrix3d( a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15] );
Assert.assertEquals( "Construct row 1 column 1 correct", matrix.n11, a[0] );
Assert.assertEquals( "Construct row 1 column 2 correct", matrix.n12, a[1] );
Assert.assertEquals( "Construct row 1 column 3 correct", matrix.n13, a[2] );
Assert.assertEquals( "Construct row 1 column 4 correct", matrix.n14, a[3] );
Assert.assertEquals( "Construct row 2 column 1 correct", matrix.n21, a[4] );
Assert.assertEquals( "Construct row 2 column 2 correct", matrix.n22, a[5] );
Assert.assertEquals( "Construct row 2 column 3 correct", matrix.n23, a[6] );
Assert.assertEquals( "Construct row 2 column 4 correct", matrix.n24, a[7] );
Assert.assertEquals( "Construct row 3 column 1 correct", matrix.n31, a[8] );
Assert.assertEquals( "Construct row 3 column 2 correct", matrix.n32, a[9] );
Assert.assertEquals( "Construct row 3 column 3 correct", matrix.n33, a[10] );
Assert.assertEquals( "Construct row 3 column 4 correct", matrix.n34, a[11] );
Assert.assertEquals( "Construct row 4 column 1 correct", matrix.n41, a[12] );
Assert.assertEquals( "Construct row 4 column 2 correct", matrix.n42, a[13] );
Assert.assertEquals( "Construct row 4 column 3 correct", matrix.n43, a[14] );
Assert.assertEquals( "Construct row 4 column 4 correct", matrix.n44, a[15] );
}
[Test]
public function assign() : void
{
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = new Matrix3d();
var m3 : Matrix3d = m2.assign( m1 );
Assert.assertTrue( "Matrices are equal", m1.equals( m2 ) );
Assert.assertEquals( "Copy returns the copy", m2, m3 );
}
[Test]
public function clone() : void
{
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
Assert.assertEquals( "Clone row 1 column 1 equals", m1.n11, m2.n11 );
Assert.assertEquals( "Clone row 1 column 2 equals", m1.n12, m2.n12 );
Assert.assertEquals( "Clone row 1 column 3 equals", m1.n13, m2.n13 );
Assert.assertEquals( "Clone row 1 column 4 equals", m1.n14, m2.n14 );
Assert.assertEquals( "Clone row 2 column 1 equals", m1.n21, m2.n21 );
Assert.assertEquals( "Clone row 2 column 2 equals", m1.n22, m2.n22 );
Assert.assertEquals( "Clone row 2 column 3 equals", m1.n23, m2.n23 );
Assert.assertEquals( "Clone row 2 column 4 equals", m1.n24, m2.n24 );
Assert.assertEquals( "Clone row 3 column 1 equals", m1.n31, m2.n31 );
Assert.assertEquals( "Clone row 3 column 2 equals", m1.n32, m2.n32 );
Assert.assertEquals( "Clone row 3 column 3 equals", m1.n33, m2.n33 );
Assert.assertEquals( "Clone row 3 column 4 equals", m1.n34, m2.n34 );
Assert.assertEquals( "Clone row 4 column 1 equals", m1.n41, m2.n41 );
Assert.assertEquals( "Clone row 4 column 2 equals", m1.n42, m2.n42 );
Assert.assertEquals( "Clone row 4 column 3 equals", m1.n43, m2.n43 );
Assert.assertEquals( "Clone row 4 column 4 equals", m1.n44, m2.n44 );
Assert.assertFalse( "Cloned matrices are not the same", m1 == m2 );
}
[Test]
public function equals() : void
{
var a : Vector.<Number> = randomVectorNumber( 16 );
var m1 : Matrix3d = new Matrix3d( a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15] );
var m2 : Matrix3d = new Matrix3d( a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15] );
var m3 : Matrix3d = randomMatrix();
Assert.assertTrue( "Equals correct when equal", m1.equals( m2 ) );
Assert.assertFalse( "Equals correct when not equal", m1.equals( m3 ) );
}
[Test]
public function nearEquals() : void
{
var a : Vector.<Number> = randomVectorNumber( 16 );
var m1 : Matrix3d = new Matrix3d( a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15] );
for ( var i : uint = 0; i < 16; ++i )
{
a[i] += ( Math.random() - 0.5 ) * 2 * e;
}
var m2 : Matrix3d = new Matrix3d( a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15] );
var m3 : Matrix3d = randomMatrix();
Assert.assertTrue( "NearEquals correct when equal", m1.nearEquals( m1, e ) );
Assert.assertTrue( "NearEquals correct when near equal", m1.nearEquals( m2, e ) );
Assert.assertFalse( "NearEquals correct when not near equal", m1.nearEquals( m3, e ) );
}
[Test]
public function newScale() : void
{
var x : Number = randomNumber();
var y : Number = randomNumber();
var z : Number = randomNumber();
var m : Matrix3d = Matrix3d.newScale( x, y, z );
var v : Vector3d = randomVector();
var w : Vector3d = m.transformVector( v );
var rv : Vector3d = new Vector3d( v.x * x, v.y * y, v.z * z );
Assert.assertTrue( "Scale vector correct", w.nearEquals( rv, e ) );
var p : Point3d = randomPoint();
var q : Point3d = m.transformPoint( p );
var rp : Point3d = new Point3d( p.x * x, p.y * y, p.z * z );
Assert.assertTrue( "Scale vector correct", q.nearTo( rp, e ) );
}
[Test]
public function newTranslation() : void
{
var x : Number = randomNumber();
var y : Number = randomNumber();
var z : Number = randomNumber();
var m : Matrix3d = Matrix3d.newTranslation( x, y, z );
var v : Vector3d = randomVector();
var w : Vector3d = m.transformVector( v );
Assert.assertTrue( "Scale vector correct", w.equals( v ) );
var p : Point3d = randomPoint();
var q : Point3d = m.transformPoint( p );
var rp : Point3d = new Point3d( p.x + x, p.y + y, p.z + z );
Assert.assertTrue( "Scale vector correct", q.nearTo( rp, e ) );
}
[Test]
public function newRotationBasics() : void
{
var rad : Number = randomNumber();
var v : Vector3d = randomVector();
var p : Point3d = randomPoint();
var m : Matrix3d = Matrix3d.newRotation( rad, v, p );
var w : Vector3d = m.transformVector( v );
Assert.assertTrue( "New rotation doesn't transform own axis", w.nearEquals( v, e ) );
var q : Point3d = m.transformPoint( p );
Assert.assertTrue( "New rotation doesn't transform point on axis", q.nearTo( p, e ) );
p.incrementBy( v );
q = m.transformPoint( p );
Assert.assertTrue( "New rotation doesn't transform point on axis", q.nearTo( p, e ) );
var m2 : Matrix3d = Matrix3d.newRotation( rad, v.unit(), p );
Assert.assertTrue( "New rotation axis length is irrelevant", m.nearEquals( m2, e ) );
p = randomPoint();
m = Matrix3d.newRotation( 2 * Math.PI, v, p );
q = m.transformPoint( p );
Assert.assertTrue( "New rotation 360 degrees doesn't transform point", q.nearTo( p, e ) );
}
[Test]
public function newRotation() : void
{
var p : Point3d = randomPoint();
var m : Matrix3d = Matrix3d.newRotation( Math.PI * 2 / 3, new Vector3d( 1, 1, 1 ), p );
var v : Vector3d = m.transformVector( Vector3d.X_AXIS );
Assert.assertTrue( "New rotation transform on x axis", v.nearEquals( Vector3d.Y_AXIS, e ) );
v = m.transformVector( Vector3d.Y_AXIS );
Assert.assertTrue( "New rotation transform on y axis", v.nearEquals( Vector3d.Z_AXIS, e ) );
v = m.transformVector( Vector3d.Z_AXIS );
Assert.assertTrue( "New rotation transform on z axis", v.nearEquals( Vector3d.X_AXIS, e ) );
var q : Point3d = m.transformPoint( p.add( Vector3d.X_AXIS ) );
Assert.assertTrue( "New rotation transform on p + x axis", q.nearTo( p.add( Vector3d.Y_AXIS ), e ) );
q = m.transformPoint( p.add( Vector3d.Y_AXIS ) );
Assert.assertTrue( "New rotation transform on p + y axis", q.nearTo( p.add( Vector3d.Z_AXIS ), e ) );
q = m.transformPoint( p.add( Vector3d.Z_AXIS ) );
Assert.assertTrue( "New rotation transform on p + z axis", q.nearTo( p.add( Vector3d.X_AXIS ), e ) );
}
[Test]
public function newBasisTransform() : void
{
var x : Vector3d = randomVector();
var y : Vector3d = randomVector();
var z : Vector3d = randomVector();
var a : Vector3d = x.add( y ).add( z );
var m : Matrix3d = Matrix3d.newBasisTransform( x, y, z );
var xT : Vector3d = m.transformVector( x );
var yT : Vector3d = m.transformVector( y );
var zT : Vector3d = m.transformVector( z );
var aT : Vector3d = m.transformVector( a );
Assert.assertTrue( "New basis transform x axis success", Vector3d.X_AXIS.nearEquals( xT, e ) );
Assert.assertTrue( "New basis transform y axis success", Vector3d.Y_AXIS.nearEquals( yT, e ) );
Assert.assertTrue( "New basis transform z axis success", Vector3d.Z_AXIS.nearEquals( zT, e ) );
Assert.assertTrue( "New basis transform z axis success", ( new Vector3d( 1, 1, 1 ) ).nearEquals( aT, e ) );
}
[Test]
public function append() : void
{
post1.append( pre1 );
Assert.assertTrue( "Append 1 success", post1.equals( result1 ) );
post2.append( pre2 );
Assert.assertTrue( "Append 2 success", post2.equals( result2 ) );
}
[Test]
public function appendScale() : void
{
var x : Number = randomNumber();
var y : Number = randomNumber();
var z : Number = randomNumber();
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m1.append( Matrix3d.newScale( x, y, z ) );
var m3 : Matrix3d = m2.appendScale( x, y, z );
Assert.assertTrue( "Append scale success", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Append scale returns self", m2, m3 );
}
[Test]
public function appendTranslation() : void
{
var x : Number = randomNumber();
var y : Number = randomNumber();
var z : Number = randomNumber();
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m1.append( Matrix3d.newTranslation( x, y, z ) );
var m3 : Matrix3d = m2.appendTranslation( x, y, z );
Assert.assertTrue( "Append translation success", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Append translation returns self", m2, m3 );
}
[Test]
public function appendRotation() : void
{
var rad : Number = randomNumber() % ( 2 * Math.PI );
var v : Vector3d = randomVector();
var p : Point3d = randomPoint();
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m1.append( Matrix3d.newRotation( rad, v, p ) );
var m3 : Matrix3d = m2.appendRotation( rad, v, p );
Assert.assertTrue( "Append rotation success", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Append rotation returns self", m2, m3 );
}
[Test]
public function appendBasisTransform() : void
{
var x : Vector3d = randomVector();
var y : Vector3d = randomVector();
var z : Vector3d = randomVector();
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m1.append( Matrix3d.newBasisTransform( x, y, z ) );
var m3 : Matrix3d = m2.appendBasisTransform( x, y, z );
Assert.assertTrue( "Append basis transform success", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Append basis transform returns self", m2, m3 );
}
[Test]
public function prepend() : void
{
pre1.prepend( post1 );
Assert.assertTrue( "Prepend 1 success", pre1.equals( result1 ) );
pre2.prepend( post2 );
Assert.assertTrue( "Prepend 2 success", pre2.equals( result2 ) );
}
[Test]
public function prependScale() : void
{
var x : Number = randomNumber();
var y : Number = randomNumber();
var z : Number = randomNumber();
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m1.prepend( Matrix3d.newScale( x, y, z ) );
var m3 : Matrix3d = m2.prependScale( x, y, z );
Assert.assertTrue( "Prepend scale success", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Prepend scale returns self", m2, m3 );
}
[Test]
public function prependTranslation() : void
{
var x : Number = randomNumber();
var y : Number = randomNumber();
var z : Number = randomNumber();
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m1.prepend( Matrix3d.newTranslation( x, y, z ) );
var m3 : Matrix3d = m2.prependTranslation( x, y, z );
Assert.assertTrue( "Prepend translation success", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Prepend translation returns self", m2, m3 );
}
[Test]
public function prependRotation() : void
{
var rad : Number = randomNumber() % ( 2 * Math.PI );
var v : Vector3d = randomVector();
var p : Point3d = randomPoint();
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m1.prepend( Matrix3d.newRotation( rad, v, p ) );
var m3 : Matrix3d = m2.prependRotation( rad, v, p );
Assert.assertTrue( "Prepend rotation success", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Prepend rotation returns self", m2, m3 );
}
[Test]
public function prependBasisTransform() : void
{
var x : Vector3d = randomVector();
var y : Vector3d = randomVector();
var z : Vector3d = randomVector();
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m1.prepend( Matrix3d.newBasisTransform( x, y, z ) );
var m3 : Matrix3d = m2.prependBasisTransform( x, y, z );
Assert.assertTrue( "Prepend basis transform success", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Prepend basis transform returns self", m2, m3 );
}
[Test]
public function determinant() : void
{
Assert.assertEquals( "Matrix 1 determinant correct", matrix1.determinant, determinant1 );
Assert.assertEquals( "Matrix 2 determinant correct", matrix2.determinant, determinant2 );
}
[Test]
public function invert() : void
{
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = m1.clone();
m2.invert();
m1.append( m2 );
Assert.assertTrue( "Random inverse correct", m1.nearEquals( Matrix3d.IDENTITY, e ) );
matrix1.invert();
Assert.assertTrue( "Matrix 1 inverse correct", matrix1.nearEquals( inverse1, e ) );
matrix2.invert();
Assert.assertTrue( "Matrix 2 inverse correct", matrix2.nearEquals( inverse2, e ) );
}
[Test]
public function inverse() : void
{
var m1 : Matrix3d = randomMatrix();
m1.append( m1.inverse() );
Assert.assertTrue( "Random invert correct", m1.nearEquals( Matrix3d.IDENTITY, e ) );
Assert.assertTrue( "Matrix 1 invert correct", inverse1.nearEquals( matrix1.inverse(), e ) );
Assert.assertTrue( "Matrix 2 invert correct", inverse2.nearEquals( matrix2.inverse(), e ) );
}
[Test]
public function inverseInto() : void
{
var m1 : Matrix3d = randomMatrix();
var m2 : Matrix3d = new Matrix3d();
var r : Matrix3d = m1.inverse( m2 );
m1.invert();
Assert.assertTrue( "Invert into correct", m1.nearEquals( m2, e ) );
Assert.assertEquals( "Invert into returns result", m2, r );
}
[Test]
public function transformVector() : void
{
var v : Vector3d = transform1.transformVector( vector1 );
Assert.assertTrue( "Vector transform one correct", v.equals( transformedVector1 ) );
v = transform2.transformVector( vector2 );
Assert.assertTrue( "Vector transform two correct", v.equals( transformedVector2 ) );
v = transform3.transformVector( vector3 );
Assert.assertTrue( "Vector transform three correct", v.equals( transformedVector3 ) );
}
[Test]
public function transformVectorInto() : void
{
var v : Vector3d = randomVector();
var m : Matrix3d = randomMatrix();
var r1 : Vector3d = new Vector3d();
var r2 : Vector3d = m.transformVector( v, r1 );
var r3 : Vector3d = m.transformVector( v );
Assert.assertTrue( "Vector transform into success", r1.equals( r3 ) );
Assert.assertEquals( "Vector transform into returns result", r1, r2 );
}
[Test]
public function transformVectorSelf() : void
{
var v : Vector3d = randomVector();
var m : Matrix3d = randomMatrix();
var r2 : Vector3d = m.transformVector( v );
var r1 : Vector3d = m.transformVectorSelf( v );
Assert.assertTrue( "Vector transform self success", v.equals( r2 ) );
Assert.assertEquals( "Vector transform self returns self", r1, v );
}
[Test]
public function transformVectors() : void
{
var m : Matrix3d = randomMatrix();
var v : Vector.<Vector3d> = new Vector.<Vector3d>();
v.push( randomVector(), randomVector(), randomVector() );
var t : Vector.<Vector3d> = new Vector.<Vector3d>();
t.push( m.transformVector( v[0] ), m.transformVector( v[1] ), m.transformVector( v[2] ) );
var r : Vector.<Vector3d> = m.transformVectors( v );
Assert.assertTrue( "Vectors transform first Vector3D", r[0].equals( t[0] ) );
Assert.assertTrue( "Vectors transform second Vector3D", r[1].equals( t[1] ) );
Assert.assertTrue( "Vectors transform third Vector3D", r[2].equals( t[2] ) );
}
[Test]
public function transformVectorsInto() : void
{
var m : Matrix3d = randomMatrix();
var v : Vector.<Vector3d> = new Vector.<Vector3d>();
v.push( randomVector(), randomVector(), randomVector() );
var t : Vector.<Vector3d> = new Vector.<Vector3d>();
t.push( m.transformVector( v[0] ), m.transformVector( v[1] ), m.transformVector( v[2] ) );
var r : Vector.<Vector3d> = new Vector.<Vector3d>();
r.push( new Vector3d(), new Vector3d(), new Vector3d() );
m.transformVectors( v, r );
Assert.assertTrue( "Vectors transform into first Vector3D", r[0].equals( t[0] ) );
Assert.assertTrue( "Vectors transform into second Vector3D", r[1].equals( t[1] ) );
Assert.assertTrue( "Vectors transform into third Vector3D", r[2].equals( t[2] ) );
}
[Test]
public function transformVectorsSelf() : void
{
var m : Matrix3d = randomMatrix();
var v : Vector.<Vector3d> = new Vector.<Vector3d>();
v.push( randomVector(), randomVector(), randomVector() );
var t : Vector.<Vector3d> = new Vector.<Vector3d>();
t.push( m.transformVector( v[0] ), m.transformVector( v[1] ), m.transformVector( v[2] ) );
var r : Vector.<Vector3d> = m.transformVectorsSelf( v );
Assert.assertTrue( "Vectors transform first Vector3D", v[0].equals( t[0] ) );
Assert.assertTrue( "Vectors transform second Vector3D", v[1].equals( t[1] ) );
Assert.assertTrue( "Vectors transform third Vector3D", v[2].equals( t[2] ) );
Assert.assertEquals( "TransformVectorsSelf returns the result", v, r );
}
[Test]
public function transformPoint() : void
{
var p : Point3d = transform1.transformPoint( point1 );
Assert.assertTrue( "Point transform one correct", p.equals( transformedPoint1 ) );
p = transform2.transformPoint( point2 );
Assert.assertTrue( "Point transform two correct", p.equals( transformedPoint2 ) );
p = transform3.transformPoint( point3 );
Assert.assertTrue( "Point transform three correct", p.equals( transformedPoint3 ) );
}
[Test]
public function transformPointInto() : void
{
var v : Point3d = randomPoint();
var m : Matrix3d = randomMatrix();
var r1 : Point3d = new Point3d();
var r2 : Point3d = m.transformPoint( v, r1 );
var r3 : Point3d = m.transformPoint( v );
Assert.assertTrue( "Point transform into success", r1.equals( r3 ) );
Assert.assertEquals( "Point transform into returns result", r1, r2 );
}
[Test]
public function transformPointSelf() : void
{
var v : Point3d = randomPoint();
var m : Matrix3d = randomMatrix();
var r2 : Point3d = m.transformPoint( v );
var r1 : Point3d = m.transformPointSelf( v );
Assert.assertTrue( "Point transform self success", v.equals( r2 ) );
Assert.assertEquals( "Point transform self returns self", r1, v );
}
[Test]
public function transformPoints() : void
{
var m : Matrix3d = randomMatrix();
var v : Vector.<Point3d> = new Vector.<Point3d>();
v.push( randomPoint(), randomPoint(), randomPoint() );
var t : Vector.<Point3d> = new Vector.<Point3d>();
t.push( m.transformPoint( v[0] ), m.transformPoint( v[1] ), m.transformPoint( v[2] ) );
var r : Vector.<Point3d> = m.transformPoints( v );
Assert.assertTrue( "Points transform first Point3D", r[0].equals( t[0] ) );
Assert.assertTrue( "Points transform second Point3D", r[1].equals( t[1] ) );
Assert.assertTrue( "Points transform third Point3D", r[2].equals( t[2] ) );
}
[Test]
public function transformPointsInto() : void
{
var m : Matrix3d = randomMatrix();
var v : Vector.<Point3d> = new Vector.<Point3d>();
v.push( randomPoint(), randomPoint(), randomPoint() );
var t : Vector.<Point3d> = new Vector.<Point3d>();
t.push( m.transformPoint( v[0] ), m.transformPoint( v[1] ), m.transformPoint( v[2] ) );
var r : Vector.<Point3d> = new Vector.<Point3d>();
r.push( new Point3d(), new Point3d(), new Point3d() );
m.transformPoints( v, r );
Assert.assertTrue( "Points transform into first Point3D", r[0].equals( t[0] ) );
Assert.assertTrue( "Points transform into second Point3D", r[1].equals( t[1] ) );
Assert.assertTrue( "Points transform into third Point3D", r[2].equals( t[2] ) );
}
[Test]
public function transformPointsSelf() : void
{
var m : Matrix3d = randomMatrix();
var v : Vector.<Point3d> = new Vector.<Point3d>();
v.push( randomPoint(), randomPoint(), randomPoint() );
var t : Vector.<Point3d> = new Vector.<Point3d>();
t.push( m.transformPoint( v[0] ), m.transformPoint( v[1] ), m.transformPoint( v[2] ) );
var r : Vector.<Point3d> = m.transformPointsSelf( v );
Assert.assertTrue( "Points transform first Point3D", v[0].equals( t[0] ) );
Assert.assertTrue( "Points transform second Point3D", v[1].equals( t[1] ) );
Assert.assertTrue( "Points transform third Point3D", v[2].equals( t[2] ) );
Assert.assertEquals( "TransformPointsSelf returns the result", v, r );
}
[Test]
public function getPosition() : void
{
var m : Matrix3d = randomMatrix();
var p : Point3d = m.position;
Assert.assertEquals( "Position x get correct", p.x, m.n14 );
Assert.assertEquals( "Position y get correct", p.y, m.n24 );
Assert.assertEquals( "Position z get correct", p.z, m.n34 );
Assert.assertEquals( "Position w get correct", p.w, m.n44 );
}
[Test]
public function setPosition() : void
{
var m : Matrix3d = randomMatrix();
var p : Point3d = randomPoint();
m.position = p;
Assert.assertEquals( "Position x set correct", p.x, m.n14 );
Assert.assertEquals( "Position y set correct", p.y, m.n24 );
Assert.assertEquals( "Position z set correct", p.z, m.n34 );
Assert.assertEquals( "Position w set correct", p.w, m.n44 );
}
[Test]
public function getRawData16() : void
{
var a : Vector.<Number> = randomVectorNumber( 16 );
var matrix : Matrix3d = new Matrix3d( a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15] );
var rawData : Vector.<Number> = matrix.rawData;
for( var i:uint = 0; i < 16; ++i )
{
Assert.assertEquals( "Get raw data item " + i + " correct", rawData[i], a[i] );
}
}
[Test]
public function setRawData12() : void
{
var a : Vector.<Number> = randomVectorNumber( 12 );
var matrix : Matrix3d = randomMatrix();
matrix.rawData = a;
var correct : Matrix3d = new Matrix3d( a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11] );
Assert.assertTrue( "Set raw data with 12 parameters", matrix.equals( correct ) );
}
[Test]
public function setRawData16() : void
{
var a : Vector.<Number> = randomVectorNumber( 16 );
var matrix : Matrix3d = randomMatrix();
matrix.rawData = a;
var correct : Matrix3d = new Matrix3d( a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15] );
Assert.assertTrue( "Set raw data with 16 parameters", matrix.equals( correct ) );
}
private function randomNumber() : Number
{
return Math.random() * 200 - 100;
}
private function randomVector() : Vector3d
{
return new Vector3d( randomNumber(), randomNumber(), randomNumber() );
}
private function randomPoint() : Point3d
{
return new Point3d( randomNumber(), randomNumber(), randomNumber() );
}
private function randomMatrix() : Matrix3d
{
return new Matrix3d(
randomNumber(), randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(), randomNumber(),
randomNumber(), randomNumber(), randomNumber(), randomNumber()
);
}
private function randomVectorNumber( length : uint ) : Vector.<Number>
{
var vector : Vector.<Number> = new Vector.<Number>();
while ( length-- > 0 )
{
vector.push( randomNumber() );
}
return vector;
}
}
}
|
package com.sticksports.nativeExtensions.gameCenter
{
public class GCLeaderboardPlayerScope
{
public static const global : int = 0;
public static const friends : int = 1;
}
}
|
package com.axiomalaska.integratedlayers.models.layers.data.stations_layer
{
import com.axiomalaska.crks.dto.AmfDataService;
import com.axiomalaska.integratedlayers.models.RequestValue;
import com.axiomalaska.models.VariableType;
import config.AppSettings;
import mx.collections.ArrayCollection;
[Bindable]
[RemoteClass(alias="com.axiom.services.netcdf.data.Station")]
public class Station extends Filterable
{
public var dataAvailable:Boolean;
public var startDate:Date;
public var endDate:Date;
public var latitude:Number;
public var longitude:Number;
public var source:Source;
public var sourceId:int;
public var sensors:Array;
public var sensorIds:Array;
public function createSensorAMFServiceRequest($sensor:Sensor,$priority:Boolean = true,$extra_params:Object = null,$proxyCt:int = NaN):AmfDataService{
var svc:AmfDataService = new AmfDataService();
//svc.url = AppSettings.domain + '/sensorobservations/messagebroker/amf2';
svc.url = AppSettings.domain + '/stationsensorservice/messagebroker/amf2';
svc.destination = 'StationSensorService';
//svc.destination = 'SensorObservationsService';
svc.method = 'getObservations1';
svc.arguments = new ArrayCollection();
var sensArg:RequestValue = new RequestValue();
//sensArg.intValue = 8;
sensArg.intValue = $sensor.id;
sensArg.name = 'sensorId';
sensArg.valueType = VariableType.INT;
(svc.arguments as ArrayCollection).addItem(sensArg);
var stArg:RequestValue = new RequestValue();
//stArg.intValue = 2531;
stArg.intValue = id;
stArg.name = 'stationId';
stArg.valueType = VariableType.INT;
(svc.arguments as ArrayCollection).addItem(stArg);
if($extra_params){
if($extra_params.hasOwnProperty('mostRecent') && $extra_params.mostRecent === true){
var mrArg:RequestValue = new RequestValue();
mrArg.name = 'mostRecent';
(svc.arguments as ArrayCollection).addItem(mrArg);
}
if($extra_params.hasOwnProperty('pastHours')){
var ptArg:RequestValue = new RequestValue();
ptArg.name = 'pastHours';
ptArg.valueType = VariableType.INT;
ptArg.intValue = $extra_params.pastHours;
(svc.arguments as ArrayCollection).addItem(ptArg);
}
if($extra_params.hasOwnProperty('startDate')){
var sdArg:RequestValue = new RequestValue();
sdArg.name = 'startTime';
sdArg.valueType = VariableType.DATE;
sdArg.dateValue = $extra_params.startTime;
(svc.arguments as ArrayCollection).addItem(sdArg);
}
}
return svc;
}
}
} |
package away3d.materials.utils.data
{
import away3d.core.math.Number3D;
public class Ray{
private var _orig:Number3D = new Number3D();
private var _dir:Number3D = new Number3D();
private var _intersect:Number3D = new Number3D();
private var _tu:Number3D = new Number3D();
private var _tv:Number3D = new Number3D();
private var _w:Number3D = new Number3D();
//private var _refresh:Boolean;
//plane
private var _pn:Number3D = new Number3D();
private var _npn:Number3D = new Number3D();
//private var _eps:Number = 1/10000;
function Ray(){
}
/**
* Defines the origin point of the Ray object
*
* @return Number3D The origin point of the Ray object
*/
public function set orig(o:Number3D):void
{
_orig.x = o.x;
_orig.y = o.y;
_orig.z = o.z;
}
public function get orig():Number3D
{
return _orig;
}
/**
* Defines the directional vector of the Ray object
*
* @return Number3D The directional vector
*/
public function set dir(n:Number3D):void
{
_dir.x = n.x;
_dir.y = n.y;
_dir.z = n.z;
}
public function get dir():Number3D
{
return _dir;
}
/**
* Defines the directional normal of the Ray object
*
* @return Number3D The normal of the plane
*/
public function get planeNormal():Number3D
{
return _pn;
}
/**
* Checks ray intersection by mesh.boundingRadius
*
* @return Boolean If the ray intersect the mesh boundery
*/
public function intersectBoundingRadius(pos:Number3D, radius:Number):Boolean
{
var rsx:Number = _orig.x - pos.x;
var rsy:Number = _orig.y - pos.y;
var rsz:Number = _orig.z - pos.z;
var B:Number = rsx*_dir.x + rsy*_dir.y + rsz*_dir.z;
var C:Number = rsx*rsx + rsy*rsy + rsz*rsz - (radius*radius);
return (B * B - C) > 0;
}
public function getIntersect(p0:Number3D, p1:Number3D, v0:Number3D, v1:Number3D, v2:Number3D):Number3D
{
_tu.sub(v1, v0);
_tv.sub(v2, v0);
_pn.x = _tu.y*_tv.z - _tu.z*_tv.y;
_pn.y = _tu.z*_tv.x - _tu.x*_tv.z;
_pn.z = _tu.x*_tv.y - _tu.y*_tv.x;
if (_pn.modulo ==0)
return null;
_dir.sub(p1, p0);
_orig.sub(p0, v0);
_npn.x = -_pn.x;
_npn.y = -_pn.y;
_npn.z = -_pn.z;
var a:Number = _npn.dot( _orig);
if (a ==0)
return null;
var b:Number = _pn.dot( _dir);
var r:Number = a / b;
//no hit
if (r < 0 || r > 1)
return null;
//the ray intersects the plane at.
_intersect.x = p0.x+(_dir.x*r);
_intersect.y = p0.y+(_dir.y*r);
_intersect.z = p0.z+(_dir.z*r);
var uu:Number = _tu.dot(_tu);
var uv:Number = _tu.dot(_tv);
var vv:Number = _tv.dot(_tv);
_w.sub(_intersect, v0);
var wu:Number = _w.dot(_tu);
var wv:Number = _w.dot(_tv);
var d:Number = uv * uv - uu * vv;
var v:Number = (uv * wv - vv * wu) / d;
if (v < 0 || v > 1)
return null;
var t:Number = (uv * wu - uu * wv) / d;
if (t < 0 || (v + t) > 1.0)
return null;
return _intersect;
}
}
} |
package com.ankamagames.dofus.logic.game.common.misc.inventoryView
{
import com.ankamagames.dofus.internalDatacenter.items.ItemWrapper;
import com.ankamagames.dofus.logic.game.common.misc.HookLock;
import com.ankamagames.dofus.logic.game.common.misc.IInventoryView;
import com.ankamagames.dofus.misc.lists.InventoryHookList;
import com.ankamagames.dofus.network.enums.CharacterInventoryPositionEnum;
import com.ankamagames.jerakine.logger.Log;
import com.ankamagames.jerakine.logger.Logger;
import flash.utils.getQualifiedClassName;
public class RoleplayBuffView implements IInventoryView
{
protected static const _log:Logger = Log.getLogger(getQualifiedClassName(RoleplayBuffView));
private var _content:Vector.<ItemWrapper>;
private var _hookLock:HookLock;
public function RoleplayBuffView(hookLock:HookLock)
{
this._hookLock = new HookLock();
super();
this._hookLock = hookLock;
}
public function initialize(items:Vector.<ItemWrapper>) : void
{
var item:ItemWrapper = null;
this._content = new Vector.<ItemWrapper>();
for each(item in items)
{
if(this.isListening(item))
{
this.addItem(item,0,false);
}
}
this.updateView();
}
public function get name() : String
{
return "roleplayBuff";
}
public function get content() : Vector.<ItemWrapper>
{
return this._content;
}
public function addItem(item:ItemWrapper, invisible:int, needUpdateView:Boolean = true) : void
{
this._content.unshift(item);
if(needUpdateView)
{
this.updateView();
}
}
public function removeItem(item:ItemWrapper, invisible:int) : void
{
var idx:int = this.content.indexOf(item);
if(idx == -1)
{
_log.warn("L\'item qui doit être supprimé n\'est pas présent dans la liste");
}
this.content.splice(idx,1);
this.updateView();
}
public function modifyItem(item:ItemWrapper, oldItem:ItemWrapper, invisible:int) : void
{
this.updateView();
}
public function isListening(item:ItemWrapper) : Boolean
{
return item.position == CharacterInventoryPositionEnum.INVENTORY_POSITION_MUTATION || item.position == CharacterInventoryPositionEnum.INVENTORY_POSITION_BOOST_FOOD || item.position == CharacterInventoryPositionEnum.INVENTORY_POSITION_FIRST_BONUS || item.position == CharacterInventoryPositionEnum.INVENTORY_POSITION_SECOND_BONUS || item.position == CharacterInventoryPositionEnum.INVENTORY_POSITION_FIRST_MALUS || item.position == CharacterInventoryPositionEnum.INVENTORY_POSITION_SECOND_MALUS || item.position == CharacterInventoryPositionEnum.INVENTORY_POSITION_ROLEPLAY_BUFFER || item.position == CharacterInventoryPositionEnum.INVENTORY_POSITION_FOLLOWER;
}
public function updateView() : void
{
this._hookLock.addHook(InventoryHookList.RoleplayBuffViewContent,[this.content]);
}
public function empty() : void
{
this._content = new Vector.<ItemWrapper>();
this.updateView();
}
}
}
|
namespace FinishGUI {
const String FINISH_GUI_FONT = "Fonts/PainttheSky-Regular.otf";
const int FINISH_GUI_FONT_SIZE = Helpers::getHeightByPercentage(0.04);
Sprite@ scoreboard;
Array<Text@> scoreboardLines;
void CreateScore()
{
Destroy();
VariantMap data;
data["Hour"] = 0;
SendEvent("HourChange", data);
if (engine.headless) {
return;
}
// Get logo texture
Texture2D@ notesTexture = cache.GetResource("Texture2D", "Textures/notes.png");
if (notesTexture is null) {
return;
}
// Create logo sprite and add to the UI layout
scoreboard = ui.root.CreateChild("Sprite");
// Set logo sprite texture
//scoreboard.texture = notesTexture;
int textureWidth = Helpers::getWidthByPercentage(0.3);
int textureHeight = notesTexture.height * Helpers::getRatio(notesTexture.width, textureWidth);
// Set logo sprite scale
//scoreboard.SetScale(256.0f / textureWidth);
// Set logo sprite size
//scoreboard.SetSize(textureWidth, textureHeight);
scoreboard.position = Vector2(-Helpers::getWidthByPercentage(0.015), -Helpers::getWidthByPercentage(0.015));
// Set logo sprite hot spot
scoreboard.SetHotSpot(textureWidth/2, textureHeight/2);
// Set logo sprite alignment
scoreboard.SetAlignment(HA_CENTER, VA_CENTER);
// Make logo not fully opaque to show the scene underneath
scoreboard.opacity = 1.0f;
// Set a low priority for the logo so that other UI elements can be drawn on top
scoreboard.priority = -100;
UIElement@ lines = scoreboard.CreateChild("UIElement");
// Position the text relative to the screen center
lines.horizontalAlignment = HA_LEFT;
lines.verticalAlignment = VA_TOP;
lines.SetPosition(Helpers::getWidthByPercentage(0.07), Helpers::getWidthByPercentage(0.01));
for (int i = 0; i < 7; i++) {
Text@ oneLine = lines.CreateChild("Text");
oneLine.text = "";//String(i) + "element";
oneLine.SetFont(cache.GetResource("Font", FINISH_GUI_FONT), FINISH_GUI_FONT_SIZE);
oneLine.textAlignment = HA_LEFT; // Center rows in relation to each other
oneLine.color = Color(0.3, 0.8, 0.3);
// Position the text relative to the screen center
oneLine.horizontalAlignment = HA_LEFT;
oneLine.verticalAlignment = VA_TOP;
oneLine.SetPosition(-Helpers::getWidthByPercentage(0.02), i * FINISH_GUI_FONT_SIZE + 2);
scoreboardLines.Push(oneLine);
}
scoreboardLines[0].text = "Day 1 survived!";
int gameTime = NetworkHandler::stats.gameTime;
int minutes = gameTime / 60;
String minutesString = minutes;
if (minutes < 10) {
minutesString = "0" + minutesString;
}
int seconds = gameTime - minutes * 60;
String secondsString = seconds;
if (seconds < 10) {
secondsString = "0" + secondsString;
}
scoreboardLines[2].text = "Game time: " + minutesString + ":" + secondsString;
scoreboardLines[3].text = "Achievements total: " + Achievements::GetTotalAchievementsCount();
scoreboardLines[4].text = "Achievements unlocked: " + Achievements::GetCompletedAchievementsCount();
scoreboardLines[6].text = "Press \"Resume\" to continue exploration!";
}
void Subscribe()
{
SubscribeToEvent("GameFinished", "FinishGUI::HandleGameFinished");
}
void RegisterConsoleCommands()
{
VariantMap data;
data["CONSOLE_COMMAND_NAME"] = "finish";
data["CONSOLE_COMMAND_EVENT"] = "GameFinished";
SendEvent("ConsoleCommandAdd", data);
}
void HandleGameFinished(StringHash eventType, VariantMap& eventData)
{
//NetworkHandler::GameEnd();
CreateScore();
//GUIHandler::Destroy();
DelayedExecute(10.0, false, "void FinishGUI::Destroy()");
SendEvent("ShowPause");
SendEvent("HideMissionGUI");
IncreaseHour();
}
void Destroy()
{
if (scoreboard !is null) {
scoreboard.Remove();
}
}
void IncreaseHour()
{
SendEvent("HourChange");
DelayedExecute(5.0, false, "void FinishGUI::IncreaseHour()");
}
} |
/*
Copyright (c) 2006. Adobe Systems Incorporated.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Adobe Systems Incorporated nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
@ignore
*/package flexlib.scheduling.scheduleClasses
{
/**
*/
public interface IScheduleEntry
{
function get startDate() : Date;
function set startDate( value : Date ) : void;
function get endDate() : Date;
function set endDate ( value : Date ) : void;
}
}
|
/*
Feathers
Copyright 2012-2016 Bowler Hat LLC. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/
package feathers.layout
{
import feathers.core.IFeathersControl;
import feathers.core.IValidating;
import flash.errors.IllegalOperationError;
import flash.geom.Point;
import starling.display.DisplayObject;
import starling.events.Event;
import starling.events.EventDispatcher;
/**
* Dispatched when a property of the layout changes, indicating that a
* redraw is probably needed.
*
* <p>The properties of the event object have the following values:</p>
* <table class="innertable">
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td><code>bubbles</code></td><td>false</td></tr>
* <tr><td><code>currentTarget</code></td><td>The Object that defines the
* event listener that handles the event. For example, if you use
* <code>myButton.addEventListener()</code> to register an event listener,
* myButton is the value of the <code>currentTarget</code>.</td></tr>
* <tr><td><code>data</code></td><td>null</td></tr>
* <tr><td><code>target</code></td><td>The Object that dispatched the event;
* it is not always the Object listening for the event. Use the
* <code>currentTarget</code> property to always access the Object
* listening for the event.</td></tr>
* </table>
*
* @eventType starling.events.Event.CHANGE
*/
[Event(name="change",type="starling.events.Event")]
/**
* For use with the <code>SpinnerList</code> component, positions items from
* top to bottom in a single column and repeats infinitely.
*
* @see ../../../help/vertical-spinner-layout.html How to use VerticalSpinnerLayout with the Feathers SpinnerList component
*/
public class VerticalSpinnerLayout extends EventDispatcher implements ISpinnerLayout, ITrimmedVirtualLayout
{
/**
* @private
* DEPRECATED: Replaced by <code>feathers.layout.HorizontalAlign.LEFT</code>.
*
* <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated
* starting with Feathers 3.0. It will be removed in a future version of
* Feathers according to the standard
* <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p>
*/
public static const HORIZONTAL_ALIGN_LEFT:String = "left";
/**
* @private
* DEPRECATED: Replaced by <code>feathers.layout.HorizontalAlign.CENTER</code>.
*
* <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated
* starting with Feathers 3.0. It will be removed in a future version of
* Feathers according to the standard
* <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p>
*/
public static const HORIZONTAL_ALIGN_CENTER:String = "center";
/**
* @private
* DEPRECATED: Replaced by <code>feathers.layout.HorizontalAlign.RIGHT</code>.
*
* <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated
* starting with Feathers 3.0. It will be removed in a future version of
* Feathers according to the standard
* <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p>
*/
public static const HORIZONTAL_ALIGN_RIGHT:String = "right";
/**
* @private
* DEPRECATED: Replaced by <code>feathers.layout.HorizontalAlign.JUSTIFY</code>.
*
* <p><strong>DEPRECATION WARNING:</strong> This constant is deprecated
* starting with Feathers 3.0. It will be removed in a future version of
* Feathers according to the standard
* <a target="_top" href="../../../help/deprecation-policy.html">Feathers deprecation policy</a>.</p>
*/
public static const HORIZONTAL_ALIGN_JUSTIFY:String = "justify";
/**
* Constructor.
*/
public function VerticalSpinnerLayout()
{
}
/**
* @private
*/
protected var _discoveredItemsCache:Vector.<DisplayObject> = new <DisplayObject>[];
/**
* @private
*/
protected var _gap:Number = 0;
/**
* The space, in pixels, between items.
*
* @default 0
*/
public function get gap():Number
{
return this._gap;
}
/**
* @private
*/
public function set gap(value:Number):void
{
if(this._gap == value)
{
return;
}
this._gap = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* Quickly sets all padding properties to the same value. The
* <code>padding</code> getter always returns the value of
* <code>paddingLeft</code>, but the other padding values may be
* different.
*
* @default 0
*
* @see #paddingRight
* @see #paddingLeft
*/
public function get padding():Number
{
return this._paddingLeft;
}
/**
* @private
*/
public function set padding(value:Number):void
{
this.paddingRight = value;
this.paddingLeft = value;
}
/**
* @private
*/
protected var _paddingRight:Number = 0;
/**
* The minimum space, in pixels, to the right of the items.
*
* @default 0
*/
public function get paddingRight():Number
{
return this._paddingRight;
}
/**
* @private
*/
public function set paddingRight(value:Number):void
{
if(this._paddingRight == value)
{
return;
}
this._paddingRight = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _paddingLeft:Number = 0;
/**
* The minimum space, in pixels, to the left of the items.
*
* @default 0
*/
public function get paddingLeft():Number
{
return this._paddingLeft;
}
/**
* @private
*/
public function set paddingLeft(value:Number):void
{
if(this._paddingLeft == value)
{
return;
}
this._paddingLeft = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _horizontalAlign:String = HorizontalAlign.JUSTIFY;
[Inspectable(type="String",enumeration="left,center,right,justify")]
/**
* The alignment of the items horizontally, on the x-axis.
*
* @default feathers.layout.HorizontalAlign.JUSTIFY
*
* @see feathers.layout.HorizontalAlign#LEFT
* @see feathers.layout.HorizontalAlign#CENTER
* @see feathers.layout.HorizontalAlign#RIGHT
* @see feathers.layout.HorizontalAlign#JUSTIFY
*/
public function get horizontalAlign():String
{
return this._horizontalAlign;
}
/**
* @private
*/
public function set horizontalAlign(value:String):void
{
if(this._horizontalAlign == value)
{
return;
}
this._horizontalAlign = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _useVirtualLayout:Boolean = true;
/**
* @inheritDoc
*
* @default true
*/
public function get useVirtualLayout():Boolean
{
return this._useVirtualLayout;
}
/**
* @private
*/
public function set useVirtualLayout(value:Boolean):void
{
if(this._useVirtualLayout == value)
{
return;
}
this._useVirtualLayout = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _requestedRowCount:int = 0;
/**
* Requests that the layout set the view port dimensions to display a
* specific number of rows (plus gaps and padding), if possible. If the
* explicit height of the view port is set, then this value will be
* ignored. If the view port's minimum and/or maximum height are set,
* the actual number of visible rows may be adjusted to meet those
* requirements. Set this value to <code>0</code> to display as many
* rows as possible.
*
* @default 0
*/
public function get requestedRowCount():int
{
return this._requestedRowCount;
}
/**
* @private
*/
public function set requestedRowCount(value:int):void
{
if(value < 0)
{
throw RangeError("requestedRowCount requires a value >= 0");
}
if(this._requestedRowCount == value)
{
return;
}
this._requestedRowCount = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _beforeVirtualizedItemCount:int = 0;
/**
* @inheritDoc
*/
public function get beforeVirtualizedItemCount():int
{
return this._beforeVirtualizedItemCount;
}
/**
* @private
*/
public function set beforeVirtualizedItemCount(value:int):void
{
if(this._beforeVirtualizedItemCount == value)
{
return;
}
this._beforeVirtualizedItemCount = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _afterVirtualizedItemCount:int = 0;
/**
* @inheritDoc
*/
public function get afterVirtualizedItemCount():int
{
return this._afterVirtualizedItemCount;
}
/**
* @private
*/
public function set afterVirtualizedItemCount(value:int):void
{
if(this._afterVirtualizedItemCount == value)
{
return;
}
this._afterVirtualizedItemCount = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _typicalItem:DisplayObject;
/**
* @inheritDoc
*
* @see #resetTypicalItemDimensionsOnMeasure
* @see #typicalItemWidth
* @see #typicalItemHeight
*/
public function get typicalItem():DisplayObject
{
return this._typicalItem;
}
/**
* @private
*/
public function set typicalItem(value:DisplayObject):void
{
if(this._typicalItem == value)
{
return;
}
this._typicalItem = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _resetTypicalItemDimensionsOnMeasure:Boolean = false;
/**
* If set to <code>true</code>, the width and height of the
* <code>typicalItem</code> will be reset to <code>typicalItemWidth</code>
* and <code>typicalItemHeight</code>, respectively, whenever the
* typical item needs to be measured. The measured dimensions of the
* typical item are used to fill in the blanks of a virtualized layout
* for virtual items that don't have their own display objects to
* measure yet.
*
* @default false
*
* @see #typicalItemWidth
* @see #typicalItemHeight
* @see #typicalItem
*/
public function get resetTypicalItemDimensionsOnMeasure():Boolean
{
return this._resetTypicalItemDimensionsOnMeasure;
}
/**
* @private
*/
public function set resetTypicalItemDimensionsOnMeasure(value:Boolean):void
{
if(this._resetTypicalItemDimensionsOnMeasure == value)
{
return;
}
this._resetTypicalItemDimensionsOnMeasure = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _typicalItemWidth:Number = NaN;
/**
* Used to reset the width, in pixels, of the <code>typicalItem</code>
* for measurement. The measured dimensions of the typical item are used
* to fill in the blanks of a virtualized layout for virtual items that
* don't have their own display objects to measure yet.
*
* <p>This value is only used when <code>resetTypicalItemDimensionsOnMeasure</code>
* is set to <code>true</code>. If <code>resetTypicalItemDimensionsOnMeasure</code>
* is set to <code>false</code>, this value will be ignored and the
* <code>typicalItem</code> dimensions will not be reset before
* measurement.</p>
*
* <p>If <code>typicalItemWidth</code> is set to <code>NaN</code>, the
* typical item will auto-size itself to its preferred width. If you
* pass a valid <code>Number</code> value, the typical item's width will
* be set to a fixed size. May be used in combination with
* <code>typicalItemHeight</code>.</p>
*
* @default NaN
*
* @see #resetTypicalItemDimensionsOnMeasure
* @see #typicalItemHeight
* @see #typicalItem
*/
public function get typicalItemWidth():Number
{
return this._typicalItemWidth;
}
/**
* @private
*/
public function set typicalItemWidth(value:Number):void
{
if(this._typicalItemWidth == value)
{
return;
}
this._typicalItemWidth = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _typicalItemHeight:Number = NaN;
/**
* Used to reset the height, in pixels, of the <code>typicalItem</code>
* for measurement. The measured dimensions of the typical item are used
* to fill in the blanks of a virtualized layout for virtual items that
* don't have their own display objects to measure yet.
*
* <p>This value is only used when <code>resetTypicalItemDimensionsOnMeasure</code>
* is set to <code>true</code>. If <code>resetTypicalItemDimensionsOnMeasure</code>
* is set to <code>false</code>, this value will be ignored and the
* <code>typicalItem</code> dimensions will not be reset before
* measurement.</p>
*
* <p>If <code>typicalItemHeight</code> is set to <code>NaN</code>, the
* typical item will auto-size itself to its preferred height. If you
* pass a valid <code>Number</code> value, the typical item's height will
* be set to a fixed size. May be used in combination with
* <code>typicalItemWidth</code>.</p>
*
* @default NaN
*
* @see #resetTypicalItemDimensionsOnMeasure
* @see #typicalItemWidth
* @see #typicalItem
*/
public function get typicalItemHeight():Number
{
return this._typicalItemHeight;
}
/**
* @private
*/
public function set typicalItemHeight(value:Number):void
{
if(this._typicalItemHeight == value)
{
return;
}
this._typicalItemHeight = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _repeatItems:Boolean = true;
/**
* If set to <code>true</code>, the layout will repeat the items
* infinitely, if there are enough items to allow this behavior. If the
* total height of the items is smaller than the height of the view
* port, the items cannot repeat.
*
* @default true
*/
public function get repeatItems():Boolean
{
return this._repeatItems;
}
/**
* @private
*/
public function set repeatItems(value:Boolean):void
{
if(this._repeatItems == value)
{
return;
}
this._repeatItems = value;
this.dispatchEventWith(Event.CHANGE);
}
/**
* @copy feathers.layout.ISpinnerLayout#snapInterval
*/
public function get snapInterval():Number
{
if(this._typicalItem === null)
{
return 0;
}
return this._typicalItem.height + this._gap;
}
/**
* @inheritDoc
*/
public function get requiresLayoutOnScroll():Boolean
{
return true;
}
/**
* @inheritDoc
*/
public function layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult
{
//this function is very long because it may be called every frame,
//in some situations. testing revealed that splitting this function
//into separate, smaller functions affected performance.
//since the SWC compiler cannot inline functions, we can't use that
//feature either.
//since viewPortBounds can be null, we may need to provide some defaults
var scrollX:Number = viewPortBounds ? viewPortBounds.scrollX : 0;
var scrollY:Number = viewPortBounds ? viewPortBounds.scrollY : 0;
var boundsX:Number = viewPortBounds ? viewPortBounds.x : 0;
var boundsY:Number = viewPortBounds ? viewPortBounds.y : 0;
var minWidth:Number = viewPortBounds ? viewPortBounds.minWidth : 0;
var minHeight:Number = viewPortBounds ? viewPortBounds.minHeight : 0;
var maxWidth:Number = viewPortBounds ? viewPortBounds.maxWidth : Number.POSITIVE_INFINITY;
var maxHeight:Number = viewPortBounds ? viewPortBounds.maxHeight : Number.POSITIVE_INFINITY;
var explicitWidth:Number = viewPortBounds ? viewPortBounds.explicitWidth : NaN;
var explicitHeight:Number = viewPortBounds ? viewPortBounds.explicitHeight : NaN;
if(this._useVirtualLayout)
{
//if the layout is virtualized, we'll need the dimensions of the
//typical item so that we have fallback values when an item is null
this.prepareTypicalItem(explicitWidth - this._paddingLeft - this._paddingRight);
var calculatedTypicalItemWidth:Number = this._typicalItem ? this._typicalItem.width : 0;
var calculatedTypicalItemHeight:Number = this._typicalItem ? this._typicalItem.height : 0;
}
if(!this._useVirtualLayout || this._horizontalAlign != HorizontalAlign.JUSTIFY ||
explicitWidth !== explicitWidth) //isNaN
{
//in some cases, we may need to validate all of the items so
//that we can use their dimensions below.
this.validateItems(items, explicitWidth - this._paddingLeft - this._paddingRight, explicitHeight);
}
//this section prepares some variables needed for the following loop
var maxItemWidth:Number = this._useVirtualLayout ? calculatedTypicalItemWidth : 0;
var positionY:Number = boundsY;
var gap:Number = this._gap;
var itemCount:int = items.length;
var totalItemCount:int = itemCount;
if(this._useVirtualLayout)
{
//if the layout is virtualized, and the items all have the same
//height, we can make our loops smaller by skipping some items
//at the beginning and end. this improves performance.
totalItemCount += this._beforeVirtualizedItemCount + this._afterVirtualizedItemCount;
positionY += (this._beforeVirtualizedItemCount * (calculatedTypicalItemHeight + gap));
}
//this cache is used to save non-null items in virtual layouts. by
//using a smaller array, we can improve performance by spending less
//time in the upcoming loops.
this._discoveredItemsCache.length = 0;
var discoveredItemsCacheLastIndex:int = 0;
//this first loop sets the y position of items, and it calculates
//the total height of all items
for(var i:int = 0; i < itemCount; i++)
{
var item:DisplayObject = items[i];
if(item)
{
//we get here if the item isn't null. it is never null if
//the layout isn't virtualized.
if(item is ILayoutDisplayObject && !ILayoutDisplayObject(item).includeInLayout)
{
continue;
}
item.y = item.pivotY + positionY;
item.height = calculatedTypicalItemHeight;
var itemWidth:Number = item.width;
//we compare with > instead of Math.max() because the rest
//arguments on Math.max() cause extra garbage collection and
//hurt performance
if(itemWidth > maxItemWidth)
{
//we need to know the maximum width of the items in the
//case where the width of the view port needs to be
//calculated by the layout.
maxItemWidth = itemWidth;
}
if(this._useVirtualLayout)
{
this._discoveredItemsCache[discoveredItemsCacheLastIndex] = item;
discoveredItemsCacheLastIndex++;
}
}
positionY += calculatedTypicalItemHeight + gap;
}
if(this._useVirtualLayout)
{
//finish the final calculation of the y position so that it can
//be used for the total height of all items
positionY += (this._afterVirtualizedItemCount * (calculatedTypicalItemHeight + gap));
}
//this array will contain all items that are not null. see the
//comment above where the discoveredItemsCache is initialized for
//details about why this is important.
var discoveredItems:Vector.<DisplayObject> = this._useVirtualLayout ? this._discoveredItemsCache : items;
var discoveredItemCount:int = discoveredItems.length;
var totalWidth:Number = maxItemWidth + this._paddingLeft + this._paddingRight;
//the available width is the width of the viewport. if the explicit
//width is NaN, we need to calculate the viewport width ourselves
//based on the total width of all items.
var availableWidth:Number = explicitWidth;
if(availableWidth !== availableWidth) //isNaN
{
availableWidth = totalWidth;
if(availableWidth < minWidth)
{
availableWidth = minWidth;
}
else if(availableWidth > maxWidth)
{
availableWidth = maxWidth;
}
}
//this is the total height of all items
var totalHeight:Number = positionY - gap - boundsY;
//the available height is the height of the viewport. if the explicit
//height is NaN, we need to calculate the viewport height ourselves
//based on the total height of all items.
var availableHeight:Number = explicitHeight;
if(availableHeight !== availableHeight) //isNaN
{
if(this._requestedRowCount > 0)
{
availableHeight = this._requestedRowCount * (calculatedTypicalItemHeight + gap) - gap;
}
else
{
availableHeight = totalHeight;
}
if(availableHeight < minHeight)
{
availableHeight = minHeight;
}
else if(availableHeight > maxHeight)
{
availableHeight = maxHeight;
}
}
var canRepeatItems:Boolean = this._repeatItems && totalHeight > availableHeight;
if(canRepeatItems)
{
totalHeight += gap;
}
//in this section, we handle vertical alignment. the selected item
//needs to be centered vertically.
var verticalAlignOffsetY:Number = Math.round((availableHeight - calculatedTypicalItemHeight) / 2);
if(!canRepeatItems)
{
totalHeight += 2 * verticalAlignOffsetY;
}
for(i = 0; i < discoveredItemCount; i++)
{
item = discoveredItems[i];
if(item is ILayoutDisplayObject && !ILayoutDisplayObject(item).includeInLayout)
{
continue;
}
item.y += verticalAlignOffsetY;
}
for(i = 0; i < discoveredItemCount; i++)
{
item = discoveredItems[i];
var layoutItem:ILayoutDisplayObject = item as ILayoutDisplayObject;
if(layoutItem && !layoutItem.includeInLayout)
{
continue;
}
//if we're repeating items, then we may need to adjust the y
//position of some items so that they appear inside the viewport
if(canRepeatItems)
{
var adjustedScrollY:Number = scrollY - verticalAlignOffsetY;
if(adjustedScrollY > 0)
{
item.y += totalHeight * int((adjustedScrollY + availableHeight) / totalHeight);
if(item.y >= (scrollY + availableHeight))
{
item.y -= totalHeight;
}
}
else if(adjustedScrollY < 0)
{
item.y += totalHeight * (int(adjustedScrollY / totalHeight) - 1);
if((item.y + item.height) < scrollY)
{
item.y += totalHeight;
}
}
}
//in this section, we handle horizontal alignment
if(this._horizontalAlign == HorizontalAlign.JUSTIFY)
{
//if we justify items horizontally, we can skip percent width
item.x = item.pivotX + boundsX + this._paddingLeft;
item.width = availableWidth - this._paddingLeft - this._paddingRight;
}
else
{
//handle all other horizontal alignment values (we handled
//justify already). the x position of all items is set.
var horizontalAlignWidth:Number = availableWidth;
if(totalWidth > horizontalAlignWidth)
{
horizontalAlignWidth = totalWidth;
}
switch(this._horizontalAlign)
{
case HorizontalAlign.RIGHT:
{
item.x = item.pivotX + boundsX + horizontalAlignWidth - this._paddingRight - item.width;
break;
}
case HorizontalAlign.CENTER:
{
//round to the nearest pixel when dividing by 2 to
//align in the center
item.x = item.pivotX + boundsX + this._paddingLeft + Math.round((horizontalAlignWidth - this._paddingLeft - this._paddingRight - item.width) / 2);
break;
}
default: //left
{
item.x = item.pivotX + boundsX + this._paddingLeft;
}
}
}
}
//we don't want to keep a reference to any of the items, so clear
//this cache
this._discoveredItemsCache.length = 0;
//finally, we want to calculate the result so that the container
//can use it to adjust its viewport and determine the minimum and
//maximum scroll positions (if needed)
if(!result)
{
result = new LayoutBoundsResult();
}
result.contentX = 0;
result.contentWidth = this._horizontalAlign == HorizontalAlign.JUSTIFY ? availableWidth : totalWidth;
if(canRepeatItems)
{
result.contentY = Number.NEGATIVE_INFINITY;
result.contentHeight = Number.POSITIVE_INFINITY;
}
else
{
result.contentY = 0;
result.contentHeight = totalHeight;
}
result.viewPortWidth = availableWidth;
result.viewPortHeight = availableHeight;
return result;
}
/**
* @inheritDoc
*/
public function measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point
{
if(!result)
{
result = new Point();
}
if(!this._useVirtualLayout)
{
throw new IllegalOperationError("measureViewPort() may be called only if useVirtualLayout is true.")
}
var explicitWidth:Number = viewPortBounds ? viewPortBounds.explicitWidth : NaN;
var explicitHeight:Number = viewPortBounds ? viewPortBounds.explicitHeight : NaN;
var needsWidth:Boolean = explicitWidth !== explicitWidth; //isNaN
var needsHeight:Boolean = explicitHeight !== explicitHeight; //isNaN
if(!needsWidth && !needsHeight)
{
result.x = explicitWidth;
result.y = explicitHeight;
return result;
}
var minWidth:Number = viewPortBounds ? viewPortBounds.minWidth : 0;
var minHeight:Number = viewPortBounds ? viewPortBounds.minHeight : 0;
var maxWidth:Number = viewPortBounds ? viewPortBounds.maxWidth : Number.POSITIVE_INFINITY;
var maxHeight:Number = viewPortBounds ? viewPortBounds.maxHeight : Number.POSITIVE_INFINITY;
this.prepareTypicalItem(explicitWidth - this._paddingLeft - this._paddingRight);
var calculatedTypicalItemWidth:Number = this._typicalItem ? this._typicalItem.width : 0;
var calculatedTypicalItemHeight:Number = this._typicalItem ? this._typicalItem.height : 0;
var gap:Number = this._gap;
var positionY:Number = 0;
var maxItemWidth:Number = calculatedTypicalItemWidth;
positionY += ((calculatedTypicalItemHeight + gap) * itemCount);
positionY -= gap;
if(needsWidth)
{
var resultWidth:Number = maxItemWidth + this._paddingLeft + this._paddingRight;
if(resultWidth < minWidth)
{
resultWidth = minWidth;
}
else if(resultWidth > maxWidth)
{
resultWidth = maxWidth;
}
result.x = resultWidth;
}
else
{
result.x = explicitWidth;
}
if(needsHeight)
{
if(this._requestedRowCount > 0)
{
var resultHeight:Number = (calculatedTypicalItemHeight + gap) * this._requestedRowCount - gap;
}
else
{
resultHeight = positionY;
}
if(resultHeight < minHeight)
{
resultHeight = minHeight;
}
else if(resultHeight > maxHeight)
{
resultHeight = maxHeight;
}
result.y = resultHeight;
}
else
{
result.y = explicitHeight;
}
return result;
}
/**
* @inheritDoc
*/
public function getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>
{
if(result)
{
result.length = 0;
}
else
{
result = new <int>[];
}
if(!this._useVirtualLayout)
{
throw new IllegalOperationError("getVisibleIndicesAtScrollPosition() may be called only if useVirtualLayout is true.")
}
this.prepareTypicalItem(width - this._paddingLeft - this._paddingRight);
var calculatedTypicalItemHeight:Number = this._typicalItem ? this._typicalItem.height : 0;
var gap:Number = this._gap;
var resultLastIndex:int = 0;
//we add one extra here because the first item renderer in view may
//be partially obscured, which would reveal an extra item renderer.
var maxVisibleTypicalItemCount:int = Math.ceil(height / (calculatedTypicalItemHeight + gap)) + 1;
var totalItemHeight:Number = itemCount * (calculatedTypicalItemHeight + gap) - gap;
scrollY -= Math.round((height - calculatedTypicalItemHeight) / 2);
var canRepeatItems:Boolean = this._repeatItems && totalItemHeight > height;
if(canRepeatItems)
{
//if we're repeating, then there's an extra gap
totalItemHeight += gap;
scrollY %= totalItemHeight;
if(scrollY < 0)
{
scrollY += totalItemHeight;
}
var minimum:int = scrollY / (calculatedTypicalItemHeight + gap);
var maximum:int = minimum + maxVisibleTypicalItemCount;
}
else
{
minimum = scrollY / (calculatedTypicalItemHeight + gap);
if(minimum < 0)
{
minimum = 0;
}
//if we're scrolling beyond the final item, we should keep the
//indices consistent so that items aren't destroyed and
//recreated unnecessarily
maximum = minimum + maxVisibleTypicalItemCount;
if(maximum >= itemCount)
{
maximum = itemCount - 1;
}
minimum = maximum - maxVisibleTypicalItemCount;
if(minimum < 0)
{
minimum = 0;
}
}
for(var i:int = minimum; i <= maximum; i++)
{
if(!canRepeatItems || (i >= 0 && i < itemCount))
{
result[resultLastIndex] = i;
}
else if(i < 0)
{
result[resultLastIndex] = itemCount + i;
}
else if(i >= itemCount)
{
var loopedI:int = i - itemCount;
if(loopedI === minimum)
{
//we don't want to repeat items!
break;
}
result[resultLastIndex] = loopedI;
}
resultLastIndex++;
}
return result;
}
/**
* @inheritDoc
*/
public function getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>,
x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
{
//normally, this isn't acceptable, but because the selection is
//based on the scroll position, it must work this way.
return this.getScrollPositionForIndex(index, items, x, y, width, height, result);
}
/**
* @inheritDoc
*/
public function getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
{
this.prepareTypicalItem(width - this._paddingLeft - this._paddingRight);
var calculatedTypicalItemHeight:Number = this._typicalItem ? this._typicalItem.height : 0;
if(!result)
{
result = new Point();
}
result.x = 0;
result.y = calculatedTypicalItemHeight * index;
return result;
}
/**
* @private
*/
protected function validateItems(items:Vector.<DisplayObject>, justifyWidth:Number, distributedHeight:Number):void
{
//if the alignment is justified, then we want to set the width of
//each item before validating because setting one dimension may
//cause the other dimension to change, and that will invalidate the
//layout if it happens after validation, causing more invalidation
var isJustified:Boolean = this._horizontalAlign == HorizontalAlign.JUSTIFY;
var mustSetJustifyWidth:Boolean = isJustified && justifyWidth === justifyWidth; //!isNaN
var itemCount:int = items.length;
for(var i:int = 0; i < itemCount; i++)
{
var item:DisplayObject = items[i];
if(!item || (item is ILayoutDisplayObject && !ILayoutDisplayObject(item).includeInLayout))
{
continue;
}
if(mustSetJustifyWidth)
{
item.width = justifyWidth;
}
else if(isJustified && item is IFeathersControl)
{
//the alignment is justified, but we don't yet have a width
//to use, so we need to ensure that we accurately measure
//the items instead of using an old justified width that may
//be wrong now!
item.width = NaN;
}
if(item is IValidating)
{
IValidating(item).validate()
}
}
}
/**
* @private
*/
protected function prepareTypicalItem(justifyWidth:Number):void
{
if(!this._typicalItem)
{
return;
}
if(this._horizontalAlign == HorizontalAlign.JUSTIFY &&
justifyWidth === justifyWidth) //!isNaN
{
this._typicalItem.width = justifyWidth;
}
else if(this._resetTypicalItemDimensionsOnMeasure)
{
this._typicalItem.width = this._typicalItemWidth;
}
if(this._resetTypicalItemDimensionsOnMeasure)
{
this._typicalItem.height = this._typicalItemHeight;
}
if(this._typicalItem is IValidating)
{
IValidating(this._typicalItem).validate();
}
}
}
}
|
package com.azer.android.camera
{
import flash.display.BitmapData;
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
import flash.events.StatusEvent;
import flash.external.ExtensionContext;
import mx.graphics.shaderClasses.ExclusionShader;
public class Camera extends EventDispatcher implements IEventDispatcher
{
private static var extContext:ExtensionContext = null;
public function Camera(target:*=null)
{
if ( !extContext )
{
extContext = ExtensionContext.createExtensionContext("com.azer.android.camera",null);
}
}
public function bmpSave(b:BitmapData,isWriteCustomFolder:Boolean = true):void{
extContext.addEventListener( StatusEvent.STATUS, statusHandler);
extContext.call("saveBitmapData",b,isWriteCustomFolder);
}
public function isImagePickerAvailable() : Boolean
{
return extContext.call("isImagePickerAvailable");
}
public function isCameraAvailable() : Boolean
{
return extContext.call("isCameraAvailable");
}
public function browseForImage(isCameraCapture:Boolean = false):Boolean{
var available:Boolean = false;
if(isCameraCapture){
available = isCameraAvailable();
} else {
available = isImagePickerAvailable();
}
if(available){
extContext.addEventListener( StatusEvent.STATUS, statusHandler);
extContext.call("browseForImage",allowVideoCapture);
}
return available;
}
public function deleteTemporaryFile(path:String = null):void{
extContext.call("deleteTempFile",path);
}
private function statusHandler(e:StatusEvent):void
{
dispatchEvent(e);
}
public function dispose():void{
try{
extContext.dispose();
} catch(e:*){}
extContext = null;
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.