CombinedText
stringlengths
4
3.42M
#include "entity.as" class player : entity { player(const glm::vec3& in position, const glm::quat& in rotation, const glm::vec3& in scale, const string& in mesh, const string& in skeleton) { super(position, rotation, scale); impl_.add_animation_component(mesh, skeleton); impl_.add_character_physics_component(box_shape(glm::vec3(0.6, 1, 0.3)), 10.f, 2.f); auto@ sc = impl_.add_state_component(); sc.emplace("stand", "scripts/character_states/stand.as"); sc.emplace("run", "scripts/character_states/run.as"); sc.emplace("walk_backward", "scripts/character_states/walk_backward.as"); sc.change_state("stand"); } }
/* See LICENSE for copyright and terms of use */ import org.actionstep.NSImage; import org.actionstep.NSView; import org.aib.AIBApplication; import org.aib.palette.PaletteBase; /** * @author Scott Hyndman */ class org.aib.palette.WindowsPalette extends PaletteBase { //****************************************************** //* Construction //****************************************************** public function WindowsPalette() { } //****************************************************** //* Describing the object //****************************************************** /** * Returns a string representation of the <code>WindowsPalette</code> * instance. */ public function description():String { return "WindowsPalette()"; } //****************************************************** //* Implementation of PaletteProtocol //****************************************************** /** * Returns * <code>AIBApplication#stringForKeyPath("Palettes.Windows.Name")</code>. */ public function paletteName():String { return AIBApplication.stringForKeyPath("Palettes.Windows.Name"); } /** * Returns the same value as <code>#paletteName</code>. */ public function buttonTipText():String { return paletteName(); } /** * Returns an image representing the controls palette. */ public function buttonImage():NSImage { return NSImage.imageNamed("Windows"); } /** * Returns a view containing the contents of the controls palette. */ public function paletteContents():NSView { return null; } }
package kabam.rotmg.classes.view { import com.company.assembleegameclient.objects.Player; import com.company.assembleegameclient.parameters.Parameters; import com.company.util.AssetLibrary; import flash.display.Bitmap; import flash.display.DisplayObject; import kabam.rotmg.assets.services.CharacterFactory; import kabam.rotmg.classes.model.CharacterSkin; import kabam.rotmg.classes.model.CharacterSkins; import kabam.rotmg.util.components.LegacyBuyButton; public class CharacterSkinListItemFactory { public function CharacterSkinListItemFactory() { super(); } [Inject] public var characters:CharacterFactory; public function make(param1:CharacterSkins):Vector.<DisplayObject> { var _loc2_:* = undefined; var _loc5_:int = 0; var _loc3_:int = 0; _loc2_ = param1.getListedSkins(); _loc5_ = _loc2_.length; var _loc4_:Vector.<DisplayObject> = new Vector.<DisplayObject>(_loc5_, true); while (_loc3_ < _loc5_) { _loc4_[_loc3_] = this.makeCharacterSkinTile(_loc2_[_loc3_]); _loc3_++; } return _loc4_; } private function makeCharacterSkinTile(param1:CharacterSkin):CharacterSkinListItem { var _loc2_:CharacterSkinListItem = new CharacterSkinListItem(); _loc2_.setSkin(this.makeIcon(param1)); _loc2_.setModel(param1); _loc2_.setLockIcon(AssetLibrary.getImageFromSet("lofiInterface2", 5)); _loc2_.setBuyButton(this.makeBuyButton()); return _loc2_; } private function makeBuyButton():LegacyBuyButton { return new LegacyBuyButton("", 16, 0, 0); } private function makeIcon(param1:CharacterSkin):Bitmap { var _loc3_:Player = Parameters.player; var _loc2_:int = Parameters.skinTypes16.indexOf(param1.id) != -1 ? 50 : 100; if (_loc3_) { return new Bitmap(this.characters.makeIcon(param1.template, _loc2_, _loc3_.getTex1(), _loc3_.getTex2())); } return new Bitmap(this.characters.makeIcon(param1.template, _loc2_)); } } }
/* * PROJECT: FLARToolKit * -------------------------------------------------------------------------------- * This work is based on the NyARToolKit developed by * R.Iizuka (nyatla) * http://nyatla.jp/nyatoolkit/ * * The FLARToolKit is ActionScript 3.0 version ARToolkit class library. * Copyright (C)2008 Saqoosha * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this framework; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * For further information please contact. * http://www.libspark.org/wiki/saqoosha/FLARToolKit * <saq(at)saqoosha.net> * */ package org.libspark.flartoolkit.core.labeling { import flash.display.BitmapData; import flash.geom.Point; import flash.geom.Rectangle; import org.libspark.flartoolkit.core.raster.FLARRaster_BitmapData; import org.libspark.flartoolkit.core.raster.IFLARRaster; import org.libspark.flartoolkit.core.types.FLARIntSize; /** * ARToolKit互換のラベリングクラスです。 ARToolKitと同一な評価結果を返します。 * */ public class FLARLabeling_BitmapData implements IFLARLabeling { public static var minimumLabelSize:Number = 100; private static const WORK_SIZE:int = 1024 * 32; // #define WORK_SIZE 1024*32 private const work_holder:FLARWorkHolder = new FLARWorkHolder(WORK_SIZE); private var _dest_size:FLARIntSize; private var _out_image:FLARLabelingImageBitmapData; private static const ZERO_POINT:Point = new Point(); private static const ONE_POINT:Point = new Point(1, 1); private var tmp_img:BitmapData; private var hSearch:BitmapData; private var hLineRect:Rectangle; public function attachDestination(i_destination_image:IFLARLabelingImage):void { // サイズチェック var size:FLARIntSize = i_destination_image.getSize(); this._out_image = i_destination_image as FLARLabelingImageBitmapData; // NyLabelingImageのイメージ初期化(枠書き) // var img:Array = i_destination_image.getBufferReader().getBuffer() as Array; // int[][] // for (var i:int = 0; i < size.w; i++) { // img[0][i] = 0; // img[size.h - 1][i] = 0; // } // for (i = 0;i < size.h; i++) { // img[i][0] = 0; // img[i][size.w - 1] = 0; // } this.tmp_img = new BitmapData(size.w, size.h, false, 0x0); this.hSearch = new BitmapData(size.w, 1, false, 0x000000); this.hLineRect = new Rectangle(0, 0, 1, 1); // サイズ(参照値)を保存 this._dest_size = size; } public function getAttachedDestination():IFLARLabelingImage { return this._out_image; } /** * static ARInt16 *labeling2( ARUint8 *image, int thresh,int *label_num, int **area, double **pos, int **clip,int **label_ref, int LorR ) 関数の代替品 * ラスタimageをラベリングして、結果を保存します。 Optimize:STEP[1514->1493] * * @param i_raster * @throws FLARException */ public function labeling(image:IFLARRaster):void { // this.tmp_img.applyFilter(image.bitmapData, image.bitmapData.rect, ZERO_POINT, MONO_FILTER); // this.label_img.fillRect(this.label_img.rect, 0x0); // var rect:Rectangle = this.tmp_img.rect; // rect.inflate(-1, -1); // this.label_img.threshold(this.tmp_img, rect, ONE_POINT, '<=', thresh, 0xffffffff, 0xff); // this.label_num = 0; // var labels:Array = this.label_holder.labels; var label_img:BitmapData = this._out_image.bitmapData; label_img.fillRect(label_img.rect, 0x0); var rect:Rectangle = label_img.rect.clone(); rect.inflate(-1, -1); label_img.copyPixels(FLARRaster_BitmapData(image).bitmapData, rect, ONE_POINT); var currentRect:Rectangle = label_img.getColorBoundsRect(0xffffff, 0xffffff, true); hLineRect.y = 0; hLineRect.width = label_img.width; var hSearchRect:Rectangle; var labelRect:Rectangle; var index:int = 0; var label_list:FLARLabelingLabelStack = this._out_image.getLabelStack(); label_list.clear(); // label_list.reserv(256); var labels:Array = label_list.getArray(); var label:FLARLabelingLabel; // SOC: search image for contiguous areas of white (earlier thresholding process // turns dark areas of the image into white pixels), and store as FLARLabelingLabel instances, // which are areas marked for later analysis (for marker outline detection). while (!currentRect.isEmpty()) { hLineRect.y = currentRect.top; // SOC: grab one row of pixels to analyze hSearch.copyPixels(label_img, hLineRect, ZERO_POINT); // SOC: find bounds of all white pixels in this pixel row hSearchRect = hSearch.getColorBoundsRect(0xffffff, 0xffffff, true); // SOC: perform a flood fill starting with the leftmost white pixel in this row; // the color used to flood fill (index) becomes the id for this labeled area. label_img.floodFill(hSearchRect.x, hLineRect.y, ++index); // SOC: get bounds of labeled (flood-filled) area labelRect = label_img.getColorBoundsRect(0xffffff, index, true); // SOC: only store labeled area if it's larger than the minimum size if (labelRect.width * labelRect.height > minimumLabelSize) { // SOC: instantiate new FLARLabelingLabel label = label_list.prePush() as FLARLabelingLabel;//labels[index++]; // SOC: store information about labeled area label.id = index; label.area = labelRect.width * labelRect.height; label.clip_l = labelRect.left; label.clip_r = labelRect.right - 1; label.clip_t = labelRect.top; label.clip_b = labelRect.bottom - 1; label.pos_x = (labelRect.left + labelRect.right - 1) * 0.5; label.pos_y = (labelRect.top + labelRect.bottom - 1) * 0.5; } // SOC: decrease area of analysis for next iteration currentRect = label_img.getColorBoundsRect(0xffffff, 0xffffff, true); } } public function labeling1(i_raster:IFLARRaster):void { var m:int; /* work */ var n:int; var i:int; var j:int; var k:int; var out_image:IFLARLabelingImage = this._out_image; // サイズチェック var in_size:FLARIntSize = i_raster.getSize(); this._dest_size.isEqualSizeO(in_size); const lxsize:int = in_size.w;// lxsize = arUtil_c.arImXsize; const lysize:int = in_size.h;// lysize = arUtil_c.arImYsize; var label_img:Array = out_image.getBufferReader().getBuffer() as Array; // int[][] // 枠作成はインスタンスを作った直後にやってしまう。 //ラベリング情報のリセット(ラベリングインデックスを使用) out_image.reset(true); var label_idxtbl:Array = out_image.getIndexArray(); // int[] var work2_pt:Array; // int[] var wk_max:int = 0; var label_pixel:int; var raster_buf:Array = i_raster.getBufferReader().getBuffer() as Array; // int[][] var line_ptr:Array; // int[] var work2:Array = this.work_holder.work2; // int[][] var label_img_pt0:Array; // int[] var label_img_pt1:Array; // int[] for (j = 1; j < lysize - 1; j++) { // for (int j = 1; j < lysize - 1;j++, pnt += poff*2, pnt2 += 2) { line_ptr = raster_buf[j]; label_img_pt0 = label_img[j]; label_img_pt1 = label_img[j - 1]; for (i = 1; i < lxsize - 1; i++) { // for(int i = 1; i < lxsize-1;i++, pnt+=poff, pnt2++) { // RGBの合計値が閾値より小さいかな? if (line_ptr[i] == 0) { // pnt1 = ShortPointer.wrap(pnt2, -lxsize);//pnt1 =&(pnt2[-lxsize]); if (label_img_pt1[i] > 0) { // if( *pnt1 > 0 ) { label_pixel = label_img_pt1[i]; // *pnt2 = *pnt1; work2_pt = work2[label_pixel - 1]; work2_pt[0]++; // work2[((*pnt2)-1)*7+0] ++; work2_pt[1] += i; // work2[((*pnt2)-1)*7+1] += i; work2_pt[2] += j; // work2[((*pnt2)-1)*7+2] += j; work2_pt[6] = j;// work2[((*pnt2)-1)*7+6] = j; } else if (label_img_pt1[i + 1] > 0) { // }else if(*(pnt1+1) > 0 ) { if (label_img_pt1[i - 1] > 0) { // if( *(pnt1-1) > 0 ) { m = label_idxtbl[label_img_pt1[i + 1] - 1]; // m =work[*(pnt1+1)-1]; n = label_idxtbl[label_img_pt1[i - 1] - 1]; // n =work[*(pnt1-1)-1]; if (m > n) { label_pixel = n; // *pnt2 = n; // wk=IntPointer.wrap(work, 0);//wk = // &(work[0]); for (k = 0;k < wk_max; k++) { if (label_idxtbl[k] == m) { // if( *wk == m ) label_idxtbl[k] = n;// *wk = n; } } } else if (m < n) { label_pixel = m; // *pnt2 = m; // wk=IntPointer.wrap(work,0);//wk = &(work[0]); for (k = 0;k < wk_max; k++) { if (label_idxtbl[k] == n) { // if( *wk == n ){ label_idxtbl[k] = m;// *wk = m; } } } else { label_pixel = m;// *pnt2 = m; } work2_pt = work2[label_pixel - 1]; work2_pt[0]++; work2_pt[1] += i; work2_pt[2] += j; work2_pt[6] = j; } else if ((label_img_pt0[i - 1]) > 0) { // }else if(*(pnt2-1) > 0) { m = label_idxtbl[(label_img_pt1[i + 1]) - 1]; // m =work[*(pnt1+1)-1]; n = label_idxtbl[label_img_pt0[i - 1] - 1]; // n =work[*(pnt2-1)-1]; if (m > n) { label_pixel = n; // *pnt2 = n; for (k = 0; k < wk_max; k++) { if (label_idxtbl[k] == m) { // if( *wk == m ){ label_idxtbl[k] = n;// *wk = n; } } } else if (m < n) { label_pixel = m; // *pnt2 = m; for (k = 0; k < wk_max; k++) { if (label_idxtbl[k] == n) { // if( *wk == n ){ label_idxtbl[k] = m;// *wk = m; } } } else { label_pixel = m;// *pnt2 = m; } work2_pt = work2[label_pixel - 1]; work2_pt[0]++; // work2[((*pnt2)-1)*7+0] ++; work2_pt[1] += i; // work2[((*pnt2)-1)*7+1] += i; work2_pt[2] += j;// work2[((*pnt2)-1)*7+2] += j; } else { label_pixel = label_img_pt1[i + 1]; // *pnt2 = // *(pnt1+1); work2_pt = work2[label_pixel - 1]; work2_pt[0]++; // work2[((*pnt2)-1)*7+0] ++; work2_pt[1] += i; // work2[((*pnt2)-1)*7+1] += i; work2_pt[2] += j; // work2[((*pnt2)-1)*7+2] += j; if (work2_pt[3] > i) { // if( // work2[((*pnt2)-1)*7+3] > // i ){ work2_pt[3] = i;// work2[((*pnt2)-1)*7+3] = i; } work2_pt[6] = j;// work2[((*pnt2)-1)*7+6] = j; } } else if ((label_img_pt1[i - 1]) > 0) { // }else if( // *(pnt1-1) > 0 ) { label_pixel = label_img_pt1[i - 1]; // *pnt2 = // *(pnt1-1); work2_pt = work2[label_pixel - 1]; work2_pt[0]++; // work2[((*pnt2)-1)*7+0] ++; work2_pt[1] += i; // work2[((*pnt2)-1)*7+1] += i; work2_pt[2] += j; // work2[((*pnt2)-1)*7+2] += j; if (work2_pt[4] < i) { // if( work2[((*pnt2)-1)*7+4] <i ){ work2_pt[4] = i;// work2[((*pnt2)-1)*7+4] = i; } work2_pt[6] = j;// work2[((*pnt2)-1)*7+6] = j; } else if (label_img_pt0[i - 1] > 0) { // }else if(*(pnt2-1) > 0) { label_pixel = label_img_pt0[i - 1]; // *pnt2 =*(pnt2-1); work2_pt = work2[label_pixel - 1]; work2_pt[0]++; // work2[((*pnt2)-1)*7+0] ++; work2_pt[1] += i; // work2[((*pnt2)-1)*7+1] += i; work2_pt[2] += j; // work2[((*pnt2)-1)*7+2] += j; if (work2_pt[4] < i) { // if( work2[((*pnt2)-1)*7+4] <i ){ work2_pt[4] = i;// work2[((*pnt2)-1)*7+4] = i; } } else { // 現在地までの領域を予約 this.work_holder.reserv(wk_max); wk_max++; label_idxtbl[wk_max - 1] = wk_max; label_pixel = wk_max; // work[wk_max-1] = *pnt2 = wk_max; work2_pt = work2[wk_max - 1]; work2_pt[0] = 1; work2_pt[1] = i; work2_pt[2] = j; work2_pt[3] = i; work2_pt[4] = i; work2_pt[5] = j; work2_pt[6] = j; } label_img_pt0[i] = label_pixel; } else { label_img_pt0[i] = 0;// *pnt2 = 0; } } } // インデックステーブルとラベル数の計算 var wlabel_num:int = 1; // *label_num = *wlabel_num = j - 1; for (i = 0; i < wk_max; i++) { // for(int i = 1; i <= wk_max; i++,wk++) { label_idxtbl[i] = (label_idxtbl[i] == i + 1) ? wlabel_num++ : label_idxtbl[label_idxtbl[i] - 1];// *wk=(*wk==i)?j++:work[(*wk)-1]; } wlabel_num -= 1; // *label_num = *wlabel_num = j - 1; if (wlabel_num == 0) { // if( *label_num == 0 ) { // 発見数0 out_image.getLabelStack().clear(); return; } // ラベル情報の保存等 var label_list:FLARLabelingLabelStack = out_image.getLabelStack(); // ラベルバッファを予約 label_list.reserv(wlabel_num); // エリアと重心、クリップ領域を計算 var label_pt:FLARLabelingLabel; var labels:Array = label_list.getArray(); // FLARLabelingLabel[] for (i = 0; i < wlabel_num; i++) { label_pt = labels[i]; label_pt.id = i + 1; label_pt.area = 0; label_pt.pos_x = label_pt.pos_y = 0; label_pt.clip_l = lxsize; // wclip[i*4+0] = lxsize; label_pt.clip_t = lysize; // wclip[i*4+2] = lysize; label_pt.clip_r = label_pt.clip_b = 0;// wclip[i*4+3] = 0; } for (i = 0; i < wk_max; i++) { label_pt = labels[label_idxtbl[i] - 1]; work2_pt = work2[i]; label_pt.area += work2_pt[0]; label_pt.pos_x += work2_pt[1]; label_pt.pos_y += work2_pt[2]; if (label_pt.clip_l > work2_pt[3]) { label_pt.clip_l = work2_pt[3]; } if (label_pt.clip_r < work2_pt[4]) { label_pt.clip_r = work2_pt[4]; } if (label_pt.clip_t > work2_pt[5]) { label_pt.clip_t = work2_pt[5]; } if (label_pt.clip_b < work2_pt[6]) { label_pt.clip_b = work2_pt[6]; } } for (i = 0; i < wlabel_num; i++) { // for(int i = 0; i < *label_num; i++ ) { label_pt = labels[i]; label_pt.pos_x /= label_pt.area; label_pt.pos_y /= label_pt.area; } return; } } } import org.libspark.flartoolkit.FLARException; import org.libspark.flartoolkit.utils.ArrayUtil; /** * FLARLabeling_O2のworkとwork2を可変長にするためのクラス * * */ class FLARWorkHolder { private static const ARRAY_APPEND_STEP:int = 256; public var work2:Array; // int[][] private var allocate_size:int; /** * 最大i_holder_size個の動的割り当てバッファを準備する。 * * @param i_holder_size */ public function FLARWorkHolder(i_holder_size:int) { // ポインタだけははじめに確保しておく // this.work2 = new int[i_holder_size][]; this.work2 = ArrayUtil.createJaggedArray(i_holder_size, 0); this.allocate_size = 0; } /** * i_indexで指定した番号までのバッファを準備する。 * * @param i_index */ public function reserv(i_index:int):void { // アロケート済みなら即リターン if (this.allocate_size > i_index) { return; } // 要求されたインデクスは範囲外 if (i_index >= this.work2.length) { throw new FLARException(); } // 追加アロケート範囲を計算 var range:int = i_index + ARRAY_APPEND_STEP; if (range >= this.work2.length) { range = this.work2.length; } // アロケート for (var i:int = this.allocate_size;i < range; i++) { this.work2[i] = new Array(7);//new int[7]; } this.allocate_size = range; } }
package tests { import alternativa.a3d.controller.SimpleFlyController; import alternativa.engine3d.RenderingSystem; import ash.tick.FrameTickProvider; import flash.display.MovieClip; import systems.collisions.EllipsoidCollider; import systems.SystemPriorities; import util.SpawnerBundle; import util.SpawnerBundleLoader; import views.engine3d.MainView3D; import views.ui.bit101.PreloaderBar; /** * ... * @author Glidias */ public class TestBuild3DPreload extends MovieClip { private var _template3D:MainView3D; private var game:TheGame; private var ticker:FrameTickProvider; private var _preloader:PreloaderBar = new PreloaderBar() private var bundleLoader:SpawnerBundleLoader; public function TestBuild3DPreload() { haxe.initSwc(this); game = new TheGame(stage); addChild( _template3D = new MainView3D() ); _template3D.onViewCreate.add(onReady3D); _template3D.visible = false; addChild(_preloader); } private function onReady3D():void { SpawnerBundle.context3D = _template3D.stage3D.context3D; bundleLoader = new SpawnerBundleLoader(stage, onSpawnerBundleLoaded, new <SpawnerBundle>[]); bundleLoader.progressSignal.add( _preloader.setProgress ); bundleLoader.loadBeginSignal.add( _preloader.setLabel ); } private function onSpawnerBundleLoaded():void { removeChild(_preloader); _template3D.visible = true; game.engine.addSystem( new RenderingSystem(_template3D.scene), SystemPriorities.render ); var spectatorPerson:SimpleFlyController =new SimpleFlyController( new EllipsoidCollider(GameSettings.SPECTATOR_RADIUS.x, GameSettings.SPECTATOR_RADIUS.y, GameSettings.SPECTATOR_RADIUS.z), null , stage, _template3D.camera, GameSettings.SPECTATOR_SPEED, GameSettings.SPECTATOR_SPEED_SHIFT_MULT); game.gameStates.spectator.addInstance(spectatorPerson).withPriority(SystemPriorities.postRender); game.engine.addSystem( spectatorPerson, SystemPriorities.postRender ) ; ticker = new FrameTickProvider(stage); ticker.add(tick); ticker.start(); } private function tick(time:Number):void { game.engine.update(time); _template3D.render(); } } }
package com.ankamagames.dofus.network.messages.game.context.roleplay.party { import com.ankamagames.jerakine.network.CustomDataWrapper; import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkMessage; import com.ankamagames.jerakine.network.utils.FuncTree; import flash.utils.ByteArray; public class PartyRefuseInvitationMessage extends AbstractPartyMessage implements INetworkMessage { public static const protocolId:uint = 1520; private var _isInitialized:Boolean = false; public function PartyRefuseInvitationMessage() { super(); } override public function get isInitialized() : Boolean { return super.isInitialized && this._isInitialized; } override public function getMessageId() : uint { return 1520; } public function initPartyRefuseInvitationMessage(partyId:uint = 0) : PartyRefuseInvitationMessage { super.initAbstractPartyMessage(partyId); this._isInitialized = true; return this; } override public function reset() : void { super.reset(); this._isInitialized = false; } override public function pack(output:ICustomDataOutput) : void { var data:ByteArray = new ByteArray(); this.serialize(new CustomDataWrapper(data)); writePacket(output,this.getMessageId(),data); } override public function unpack(input:ICustomDataInput, length:uint) : void { this.deserialize(input); } override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree { var tree:FuncTree = new FuncTree(); tree.setRoot(input); this.deserializeAsync(tree); return tree; } override public function serialize(output:ICustomDataOutput) : void { this.serializeAs_PartyRefuseInvitationMessage(output); } public function serializeAs_PartyRefuseInvitationMessage(output:ICustomDataOutput) : void { super.serializeAs_AbstractPartyMessage(output); } override public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_PartyRefuseInvitationMessage(input); } public function deserializeAs_PartyRefuseInvitationMessage(input:ICustomDataInput) : void { super.deserialize(input); } override public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_PartyRefuseInvitationMessage(tree); } public function deserializeAsyncAs_PartyRefuseInvitationMessage(tree:FuncTree) : void { super.deserializeAsync(tree); } } }
/* * Copyright 2014 Mozilla Foundation * * 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 flash.display { import flash.accessibility.AccessibilityProperties; import flash.events.EventDispatcher; import flash.geom.Point; import flash.geom.Rectangle; import flash.geom.Transform; import flash.geom.Vector3D; [native(cls='DisplayObjectClass')] public class DisplayObject extends EventDispatcher implements IBitmapDrawable { public function DisplayObject() {} public native function get root():DisplayObject; public native function get stage():Stage; public native function get name():String; public native function set name(value:String):void; public native function get parent():DisplayObjectContainer; public native function get mask():DisplayObject; public native function set mask(value:DisplayObject):void; public native function get visible():Boolean; public native function set visible(value:Boolean):void; public native function get x():Number; public native function set x(value:Number):void; public native function get y():Number; public native function set y(value:Number):void; public native function get z():Number; public native function set z(value:Number):void; public native function get scaleX():Number; public native function set scaleX(value:Number):void; public native function get scaleY():Number; public native function set scaleY(value:Number):void; public native function get scaleZ():Number; public native function set scaleZ(value:Number):void; public native function get mouseX():Number; public native function get mouseY():Number; public native function get rotation():Number; public native function set rotation(value:Number):void; public native function get rotationX():Number; public native function set rotationX(value:Number):void; public native function get rotationY():Number; public native function set rotationY(value:Number):void; public native function get rotationZ():Number; public native function set rotationZ(value:Number):void; public native function get alpha():Number; public native function set alpha(value:Number):void; public native function get width():Number; public native function set width(value:Number):void; public native function get height():Number; public native function set height(value:Number):void; public native function get cacheAsBitmap():Boolean; public native function set cacheAsBitmap(value:Boolean):void; public native function get opaqueBackground():Object; public native function set opaqueBackground(value:Object):void; public native function get scrollRect():Rectangle; public native function set scrollRect(value:Rectangle):void; public native function get filters():Array; public native function set filters(value:Array):void; public native function get blendMode():String; public native function set blendMode(value:String):void; public native function get transform():Transform; public native function set transform(value:Transform):void; public native function get scale9Grid():Rectangle; public native function set scale9Grid(innerRectangle:Rectangle):void; public native function get loaderInfo():LoaderInfo; public native function get accessibilityProperties():AccessibilityProperties; public native function set accessibilityProperties(value:AccessibilityProperties):void; public native function set blendShader(value:Shader):void; public native function globalToLocal(point:Point):Point; public native function localToGlobal(point:Point):Point; public native function getBounds(targetCoordinateSpace:DisplayObject):Rectangle; public native function getRect(targetCoordinateSpace:DisplayObject):Rectangle; public function hitTestObject(obj:DisplayObject):Boolean { return _hitTest(false, 0, 0, false, obj); } public function hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean { return _hitTest(true, x, y, shapeFlag, null); } public native function globalToLocal3D(point:Point):Vector3D; public native function local3DToGlobal(point3d:Vector3D):Point; private native function _hitTest(use_xy: Boolean, x: Number, y: Number, useShape: Boolean, hitTestObject: DisplayObject): Boolean; } }
package com.gestureworks.cml.away3d.geometries { import away3d.primitives.CylinderGeometry; import com.gestureworks.cml.away3d.interfaces.IGeometry; import com.gestureworks.cml.core.CMLParser; import com.gestureworks.cml.elements.State; import com.gestureworks.cml.interfaces.ICSS; import com.gestureworks.cml.interfaces.IObject; import com.gestureworks.cml.interfaces.IState; import com.gestureworks.cml.utils.ChildList; import com.gestureworks.cml.utils.StateUtils; import flash.utils.Dictionary; /** * This class creates cylinder geometry that can be applied to a Mesh. It extends the Away3D CylinderGeometry class to add CML support. */ public class CylinderGeometry extends away3d.primitives.CylinderGeometry implements IObject, ICSS, IState, IGeometry { // IObject private var _cmlIndex:int; private var _childList:ChildList; // ICSS private var _className:String; // IState private var _stateId:String; /** * @inheritDoc */ public function CylinderGeometry(topRadius:Number = 50, bottomRadius:Number = 50, height:Number = 100, segmentsW:uint = 16, segmentsH:uint = 1, topClosed:Boolean = true, bottomClosed:Boolean = true, surfaceClosed:Boolean = true, yUp:Boolean = true) { super(topRadius, bottomRadius, height, segmentsW, segmentsH, topClosed, bottomClosed, surfaceClosed, yUp); state = new Dictionary(false); state[0] = new State(false); _childList = new ChildList; } ////////////////////////////////////////////////////////////// // ICML ////////////////////////////////////////////////////////////// /** * @inheritDoc */ public function parseCML(cml:XMLList):XMLList { return CMLParser.parseCML(this, cml); } ////////////////////////////////////////////////////////////// // IOBJECT ////////////////////////////////////////////////////////////// /** * @inheritDoc */ public var state:Dictionary; /** * @inheritDoc */ public function get cmlIndex():int { return _cmlIndex; } public function set cmlIndex(value:int):void { _cmlIndex = value; } /** * @inheritDoc */ public function get childList():ChildList { return _childList; } public function set childList(value:ChildList):void { _childList = value; } /** * @inheritDoc */ public function init():void {} /** * @inheritDoc */ public function postparseCML(cml:XMLList):void {} /** * @inheritDoc */ public function updateProperties(state:*=0):void { CMLParser.updateProperties(this, state); } /** * @inheritDoc */ override public function dispose():void { super.dispose(); } ////////////////////////////////////////////////////////////// // ICSS ////////////////////////////////////////////////////////////// /** * @inheritDoc */ public function get className():String { return _className; } public function set className(value:String):void { _className = value; } ////////////////////////////////////////////////////////////// // ISTATE ////////////////////////////////////////////////////////////// /** * @inheritDoc */ public function get stateId():* { return _stateId; } public function set stateId(value:*):void { _stateId = value; } /** * @inheritDoc */ public function loadState(sId:* = null, recursion:Boolean = false):void { if (StateUtils.loadState(this, sId, recursion)) { _stateId = sId; } } /** * @inheritDoc */ public function saveState(sId:* = null, recursion:Boolean = false):void { StateUtils.saveState(this, sId, recursion); } /** * @inheritDoc */ public function tweenState(sId:*= null, tweenTime:Number = 1):void { if (StateUtils.tweenState(this, sId, tweenTime)) { _stateId = sId; } } } }
package game.states { import flash.geom.Point; import game.Board; import game.Pawn; import game.PawnPool; import org.osflash.signals.Signal; import starling.animation.Transitions; import starling.animation.Tween; import starling.core.Starling; /** * Controller that handles the fall of gems when there are holes. * It also generates/recycles gems at the top of the board. * @author damrem */ public class FallerAndFiller extends AbstractState { public static var verbose:Boolean; /** * Dispatched when the board is filled so that we can set another state (Check). */ public const FILLED:Signal = new Signal(); public static const FALL_SPEED_PX_PER_SEC:Number = Pawn.SIZE * 12; private var nbCompleted:int; public function FallerAndFiller(board:Board) { if (verbose) trace(this + "FallerAndFiller(" + arguments); super(board); } override public function enter(caller:String="other"):void { if (verbose) trace(this + "enter(" + arguments); this.collapse(); this.refill(); this.board.resetHoles(); // for each pawn which has to fall, we start the animation for (var j:int = 0; j < this.board.fallablePawns.length; j++) { this.startFallingPawn(this.board.fallablePawns[j]); } } //private var collapsingPawns:Vector.<Pawn>; private function collapse():void { if (verbose) trace(this + "collapse(" + arguments); var nbCollapsed:int; // for each hole in the board // we check if there is a pawn who could fill it if (verbose) trace("holes:" + this.board.holes); //for (var i:int = this.board.holes.length - 1; i >=0; i--) for (var i:int = 0; i < this.board.holes.length; i++) { var hole:int = this.board.holes[i]; var abovePawn:Pawn = this.board.getPawnAboveHole(hole); if (abovePawn) { nbCollapsed ++; this.board.holes[i] = abovePawn.index; this.board.electPawnForFalling(abovePawn, hole); } } // if any pawn has collapsed, since the holes have changed, we try to collapse again if (nbCollapsed > 0) { this.collapse(); } } private function refill():void { if (verbose) trace(this + "refill(" + arguments); // during one refill, we will register how many pawns we create per column // in order to create them at the proper y coordinate (and not all at the same y) var nbHolesPerCol:Vector.<int> = new <int>[]; for (var j:int = 0; j < Board.WIDTH; j++) { nbHolesPerCol.push(0); } var i:int; var hole:int; var col:int; for (i = 0; i< this.board.holes.length; i++) { hole = this.board.holes[i]; col = this.board.getColFromIndex(hole); nbHolesPerCol[col] ++; } if (verbose) trace("nbHolesPerCol: " + nbHolesPerCol); // for each hole, we generate a pawn above the column for (i = 0; i< this.board.holes.length; i++) { hole = this.board.holes[i]; var pawn:Pawn = PawnPool.loadPawn(hole); //new Pawn(); pawn.setIndex(hole); col = this.board.getColFromIndex(hole); var nbHolesInCol:int = nbHolesPerCol[col]; pawn.x = this.board.getXYFromIndex(hole).x; if (verbose) trace("generated pawn: " + pawn); pawn.y = - Pawn.SIZE * nbHolesInCol + this.board.getRowFromIndex(pawn.index) * Pawn.SIZE; if (verbose) trace("y generated pawn: " + pawn.y); this.board.pawnContainer.addChild(pawn); this.board.electPawnForFalling(pawn, hole); } } private function trash():void { // for each hole in the board: // - we generate a new pawn above the board // - // we take the pawn above (if there's one) who is not movable yet // and we start moving it to this hole. if (verbose) trace("holes: "+this.board.holes); for (var i:int = 0; i < this.board.holes.length; i++) { var holeIndex:int = this.board.holes[i]; // var abovePawn:Pawn = this.board.getPawnAboveHole(holeIndex); if (verbose) trace("abovePawn: " + abovePawn); if (abovePawn) { this.board.electPawnForFalling(abovePawn, holeIndex); } } this.board.resetHoles(); // for each pawn which has to fall, we start the animation for (var j:int = 0; j < this.board.fallablePawns.length; j++) { this.startFallingPawn(this.board.fallablePawns[j]); } } private function startFallingPawn(pawn:Pawn/*xy:Point, onComplete:Function = null, onCompleteArgs:Array = null*/):void { if (verbose) trace(this + "startMovingPawn(" + arguments); var originXY:Point = new Point(pawn.x, pawn.y); var destXY:Point = this.board.getXYFromIndex(pawn.index); var translation:Point = destXY.clone().subtract(originXY); if (verbose) { trace("originXY: "+originXY); trace("destXY: " + destXY); trace("translation: " + translation); trace("--------"); } var tween:Tween = new Tween(pawn, translation.length / FALL_SPEED_PX_PER_SEC, Transitions.EASE_IN); tween.moveTo(destXY.x, destXY.y); tween.onComplete = this.onFallingComplete; tween.onCompleteArgs = [pawn]; Starling.juggler.add(tween); } private function onFallingComplete(pawn:Pawn):void { if (verbose) trace(this + "onFallingComplete(" + arguments); this.nbCompleted ++; if (verbose) trace("completed: " + this.nbCompleted+"/"+this.board.fallablePawns.length); if (this.nbCompleted == this.board.fallablePawns.length) { // there are no more pawns to fall this.board.resetFallablePawns(); this.nbCompleted = 0; // all pawns must be checked this.board.electAllPawnsForMatching(); // it is VERY IMPORTANT to purge the juggler BEFORE dispatching the signal // so that it is avalaible for animating the destructions Starling.juggler.purge(); this.FILLED.dispatch(); } } override public function exit(caller:String="other"):void { if (verbose) trace(this + "exit(" + arguments); if (verbose) trace(this.board.pawns); } } }
package test.request { import net.digitalprimates.fluint.tests.TestCase; import mx.rpc.events.ResultEvent; import flails.request.HTTPClient; import flails.request.ResourcePathBuilder; import flails.request.RemoteClient; import flails.request.RequestConfig; public class RemoteClientTest extends TestCase { override protected function setUp():void { var cleanup:HTTPClient = new HTTPClient(null, null, new RequestConfig()) cleanup.addEventListener("result", asyncHandler(pendUntilComplete, 1000)) cleanup.doGet("/posts/reset"); } public function testIndex():void { var r:RemoteClient = new RemoteClient(new ResourcePathBuilder("posts", "amf")); r.addEventListener("result", asyncHandler(function (e:ResultEvent, data:Object):void { var a:Array = e.result as Array; assertEquals(2, a.length); assertEquals('testFindAll #1', a[0].subject); assertEquals('testFindAll #1 body', a[0].body); assertEquals('testFindAll #2', a[1].subject); assertEquals('testFindAll #2 body', a[1].body); }, 1000)); r.index(); } } }
package ngine.display { import flash.display.Graphics; public final class Shapes { public function Shapes() { }; public static function drawStar(pTarget:Graphics, pX:Number, pY:Number, pPoints:uint, pInnerRadius:Number, pOuterRadius:Number, pAngle:Number = 0):void { if(pPoints <= 2) { throw ArgumentError( "Shapes.drawStar: pPoints is too small, 3 minimum to build polygon!" ); return; } var step:Number = (Math.PI * 2) / pPoints;; var halfStep:Number = step / 2; var start:Number = (pAngle / 180) * Math.PI; pTarget.moveTo(pX + (Math.cos(start) * pOuterRadius), pY - (Math.sin(start) * pOuterRadius)); for (var n:Number = 1; n <= pPoints; ++n) { var dx:Number = pX + Math.cos(start + (step * n) - halfStep) * pInnerRadius; var dy:Number = pY - Math.sin(start + (step * n) - halfStep) * pInnerRadius; pTarget.lineTo(dx, dy); dx = pX + Math.cos(start + (step * n)) * pOuterRadius; dy = pY - Math.sin(start + (step * n)) * pOuterRadius; pTarget.lineTo(dx, dy); } }; public static function drawSpiral(pTarget:Graphics, pRadius:int, pSides:int, pCoils:int):void { pTarget.moveTo(0, 0); var awayStep:Number = pRadius / pSides; var aroundStep:Number = pCoils / pSides; var aroundRadians:Number = aroundStep * 2 * Math.PI; for(var i:int = 1; i <= pSides; i++){ var away:Number = i * awayStep; var around:Number = i * aroundRadians; var x:Number = Math.cos(around) * away; var y:Number = Math.sin(around) * away; pTarget.lineTo(x, y); } }; }; }
//////////////////////////////////////////////////////////////////////////////// // // 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.mdl.itemRenderers { COMPILE::JS { import org.apache.royale.core.WrappedHTMLElement; import org.apache.royale.html.util.addElementToWrapper; } import org.apache.royale.html.supportClasses.MXMLItemRenderer;; /** * The NavigationLinkItemRenderer defines the basic Item Renderer for a MDL NavigationLink List Component. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public class NavigationLinkItemRenderer extends MXMLItemRenderer { /** * constructor. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 */ public function NavigationLinkItemRenderer() { super(); typeNames = "mdl-navigation__link"; // className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user; } private var _href:String = "#"; /** * the navigation link url * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function get href():String { return _href; } public function set href(value:String):void { _href = value; } private var _label:String = ""; /** * The label of the navigation link * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ public function get label():String { return _label; } public function set label(value:String):void { _label = value; } COMPILE::JS private var textNode:Text; /** * Sets the data value and uses the String version of the data for display. * * @param Object data The object being displayed by the itemRenderer instance. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.8 */ override public function set data(value:Object):void { super.data = value; if(value == null) return; if (labelField) { label = String(value[labelField]); } else if(value.label !== undefined) { label = String(value.label); } else { label = String(value); } if(value.href !== undefined) { href = String(value.href); } COMPILE::JS { if(textNode != null) { textNode.nodeValue = label; (element as HTMLElement).setAttribute('href', href); } } } /** * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement * @royaleignorecoercion Text */ COMPILE::JS override protected function createElement():WrappedHTMLElement { var a:WrappedHTMLElement = addElementToWrapper(this,'a'); a.setAttribute('href', href); if(MXMLDescriptor == null) { textNode = document.createTextNode('') as Text; a.appendChild(textNode); } return element; } } }
/* Copyright (c) 2011, 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. */ package com.adobe.utils { import flash.geom.Matrix3D; import flash.geom.Vector3D; public class PerspectiveMatrix3D extends Matrix3D { public function PerspectiveMatrix3D(v:Vector.<Number>=null) { super(v); } public function lookAtLH(eye:Vector3D, at:Vector3D, up:Vector3D):void { _z.copyFrom(at); _z.subtract(eye); _z.normalize(); _z.w = 0.0; _x.copyFrom(up); _crossProductTo(_x,_z); _x.normalize(); _x.w = 0.0; _y.copyFrom(_z); _crossProductTo(_y,_x); _y.w = 0.0; _w.x = _x.dotProduct(eye); _w.y = _y.dotProduct(eye); _w.z = _z.dotProduct(eye); _w.w = 1.0; copyRowFrom(0,_x); copyRowFrom(1,_y); copyRowFrom(2,_z); copyRowFrom(3,_w); } public function lookAtRH(eye:Vector3D, at:Vector3D, up:Vector3D):void { _z.copyFrom(eye); _z.subtract(at); _z.normalize(); _z.w = 0.0; _x.copyFrom(up); _crossProductTo(_x,_z); _x.normalize(); _x.w = 0.0; _y.copyFrom(_z); _crossProductTo(_y,_x); _y.w = 0.0; _w.x = _x.dotProduct(eye); _w.y = _y.dotProduct(eye); _w.z = _z.dotProduct(eye); _w.w = 1.0; copyRowFrom(0,_x); copyRowFrom(1,_y); copyRowFrom(2,_z); copyRowFrom(3,_w); } public function perspectiveLH(width:Number, height:Number, zNear:Number, zFar:Number):void { this.copyRawDataFrom(Vector.<Number>([ 2.0*zNear/width, 0.0, 0.0, 0.0, 0.0, 2.0*zNear/height, 0.0, 0.0, 0.0, 0.0, zFar/(zFar-zNear), 1.0, 0.0, 0.0, zNear*zFar/(zNear-zFar), 0.0 ])); } public function perspectiveRH(width:Number, height:Number, zNear:Number, zFar:Number):void { this.copyRawDataFrom(Vector.<Number>([ 2.0*zNear/width, 0.0, 0.0, 0.0, 0.0, 2.0*zNear/height, 0.0, 0.0, 0.0, 0.0, zFar/(zNear-zFar), -1.0, 0.0, 0.0, zNear*zFar/(zNear-zFar), 0.0 ])); } public function perspectiveFieldOfViewLH(fieldOfViewY:Number, aspectRatio:Number, zNear:Number, zFar:Number):void { var yScale:Number = 1.0/Math.tan(fieldOfViewY/2.0); var xScale:Number = yScale / aspectRatio; this.copyRawDataFrom(Vector.<Number>([ xScale, 0.0, 0.0, 0.0, 0.0, yScale, 0.0, 0.0, 0.0, 0.0, zFar/(zFar-zNear), 1.0, 0.0, 0.0, (zNear*zFar)/(zNear-zFar), 0.0 ])); } public function perspectiveFieldOfViewRH(fieldOfViewY:Number, aspectRatio:Number, zNear:Number, zFar:Number):void { var yScale:Number = 1.0/Math.tan(fieldOfViewY/2.0); var xScale:Number = yScale / aspectRatio; this.copyRawDataFrom(Vector.<Number>([ xScale, 0.0, 0.0, 0.0, 0.0, yScale, 0.0, 0.0, 0.0, 0.0, zFar/(zNear-zFar), -1.0, 0.0, 0.0, (zNear*zFar)/(zNear-zFar), 0.0 ])); } public function perspectiveOffCenterLH(left:Number, right:Number, bottom:Number, top:Number, zNear:Number, zFar:Number):void { this.copyRawDataFrom(Vector.<Number>([ 2.0*zNear/(right-left), 0.0, 0.0, 0.0, 0.0, -2.0*zNear/(bottom-top), 0.0, 0.0, -1.0-2.0*left/(right-left), 1.0+2.0*top/(bottom-top), -zFar/(zNear-zFar), 1.0, 0.0, 0.0, (zNear*zFar)/(zNear-zFar), 0.0 ])); } public function perspectiveOffCenterRH(left:Number, right:Number, bottom:Number, top:Number, zNear:Number, zFar:Number):void { this.copyRawDataFrom(Vector.<Number>([ 2.0*zNear/(right-left), 0.0, 0.0, 0.0, 0.0, -2.0*zNear/(bottom-top), 0.0, 0.0, 1.0+2.0*left/(right-left), -1.0-2.0*top/(bottom-top), zFar/(zNear-zFar), -1.0, 0.0, 0.0, (zNear*zFar)/(zNear-zFar), 0.0 ])); } public function orthoLH(width:Number, height:Number, zNear:Number, zFar:Number):void { this.copyRawDataFrom(Vector.<Number>([ 2.0/width, 0.0, 0.0, 0.0, 0.0, 2.0/height, 0.0, 0.0, 0.0, 0.0, 1.0/(zFar-zNear), 0.0, 0.0, 0.0, zNear/(zNear-zFar), 1.0 ])); } public function orthoRH(width:Number, height:Number, zNear:Number, zFar:Number):void { this.copyRawDataFrom(Vector.<Number>([ 2.0/width, 0.0, 0.0, 0.0, 0.0, 2.0/height, 0.0, 0.0, 0.0, 0.0, 1.0/(zNear-zNear), 0.0, 0.0, 0.0, zNear/(zNear-zFar), 1.0 ])); } public function orthoOffCenterLH(left:Number, right:Number, bottom:Number, top:Number, zNear:Number, zFar:Number):void { this.copyRawDataFrom(Vector.<Number>([ 2.0/(right-left), 0.0, 0.0, 0.0, 0.0, 2.0*zNear/(top-bottom), 0.0, 0.0, -1.0-2.0*left/(right-left), 1.0+2.0*top/(bottom-top), 1.0/(zFar-zNear), 0.0, 0.0, 0.0, zNear/(zNear-zFar), 1.0 ])); } public function orthoOffCenterRH(left:Number, right:Number, bottom:Number, top:Number, zNear:Number, zFar:Number):void { this.copyRawDataFrom(Vector.<Number>([ 2.0/(right-left), 0.0, 0.0, 0.0, 0.0, 2.0*zNear/(top-bottom), 0.0, 0.0, -1.0-2.0*left/(right-left), 1.0+2.0*top/(bottom-top), 1.0/(zNear-zFar), 0.0, 0.0, 0.0, zNear/(zNear-zFar), 1.0 ])); } private var _x:Vector3D = new Vector3D(); private var _y:Vector3D = new Vector3D(); private var _z:Vector3D = new Vector3D(); private var _w:Vector3D = new Vector3D(); private function _crossProductTo(a:Vector3D,b:Vector3D):void { _w.x = a.y * b.z - a.z * b.y; _w.y = a.z * b.x - a.x * b.z; _w.z = a.x * b.y - a.y * b.x; _w.w = 1.0; a.copyFrom(_w); } } }
// Action script... // [Initial MovieClip Action of sprite 20762] #initclip 27 if (!dofus.aks.Basics) { if (!dofus) { _global.dofus = new Object(); } // end if if (!dofus.aks) { _global.dofus.aks = new Object(); } // end if var _loc1 = (_global.dofus.aks.Basics = function (oAKS, oAPI) { super.initialize(oAKS, oAPI); }).prototype; _loc1.autorisedCommand = function (sCommand) { this.aks.send("BA" + sCommand, false, undefined, true); }; _loc1.autorisedMoveCommand = function (nX, nY) { this.aks.send("BaM" + nX + "," + nY, false); }; _loc1.autorisedKickCommand = function (sPlayerName, nTempo, sMessage) { this.aks.send("BaK" + sPlayerName + "|" + nTempo + "|" + sMessage, false); }; _loc1.whoAmI = function () { this.whoIs(""); }; _loc1.whoIs = function (sName) { this.aks.send("BW" + sName); }; _loc1.kick = function (nCellNum) { this.aks.send("BQ" + nCellNum, false); }; _loc1.away = function () { this.aks.send("BYA", false); }; _loc1.invisible = function () { this.aks.send("BYI", false); }; _loc1.getDate = function () { this.aks.send("BD", false); }; _loc1.fileCheckAnswer = function (nCheckID, nFileSize) { this.aks.send("BC" + nCheckID + ";" + nFileSize, false); }; _loc1.sanctionMe = function (nSanctionID, nWordID) { this.aks.send("BK" + nSanctionID + "|" + nWordID, false); }; _loc1.averagePing = function () { this.aks.send("Bp" + this.api.network.getAveragePing() + "|" + this.api.network.getAveragePingPacketsCount() + "|" + this.api.network.getAveragePingBufferSize(), false); }; _loc1.onAuthorizedInterfaceOpen = function (sExtraData) { this.api.kernel.showMessage(this.api.lang.getText("INFORMATIONS"), this.api.lang.getText("A_GIVE_U_RIGHTS", [sExtraData]), "ERROR_BOX"); this.api.datacenter.Player.isAuthorized = true; }; _loc1.onAuthorizedInterfaceClose = function (sExtraData) { this.api.ui.unloadUIComponent("Debug"); this.api.kernel.showMessage(this.api.lang.getText("INFORMATIONS"), this.api.lang.getText("A_REMOVE_U_RIGHTS", [sExtraData]), "ERROR_BOX"); this.api.datacenter.Player.isAuthorized = false; }; _loc1.onAuthorizedCommand = function (bSuccess, sExtraData) { if (bSuccess) { var _loc4 = Number(sExtraData.charAt(0)); var _loc5 = "DEBUG_LOG"; switch (_loc4) { case 1: { _loc5 = "DEBUG_ERROR"; break; } case 2: { _loc5 = "DEBUG_INFO"; break; } } // End of switch if (this.api.ui.getUIComponent("Debug") == undefined) { this.api.ui.loadUIComponent("Debug", "Debug", undefined, {bStayIfPresent: true}); } // end if var _loc6 = sExtraData.substr(1); this.api.kernel.showMessage(undefined, _loc6, _loc5); if (dofus.Constants.SAVING_THE_WORLD) { if (_loc6.indexOf("BotKick inactif") == 0) { dofus.SaveTheWorld.getInstance().nextAction(); } // end if } // end if } else { this.api.kernel.showMessage(undefined, this.api.lang.getText("UNKNOW_COMMAND", ["/a"]), "ERROR_CHAT"); } // end else if }; _loc1.onAuthorizedCommandPrompt = function (sExtraData) { this.api.datacenter.Basics.aks_a_prompt = sExtraData; this.api.ui.getUIComponent("Debug").setPrompt(sExtraData); }; _loc1.onAuthorizedCommandClear = function () { this.api.ui.getUIComponent("Debug").clear(); }; _loc1.onAuthorizedLine = function (sExtraData) { var _loc3 = sExtraData.split("|"); var _loc4 = Number(_loc3[0]); var _loc5 = Number(_loc3[1]); var _loc6 = _loc3[2]; var _loc7 = this.api.datacenter.Basics.aks_a_logs.split("<br/>"); var _loc8 = "<font color=\"#FFFFFF\">" + _loc6 + "</font>"; switch (_loc5) { case 1: { _loc8 = "<font color=\"#FF0000\">" + _loc6 + "</font>"; break; } case 2: { _loc8 = "<font color=\"#00FF00\">" + _loc6 + "</font>"; break; } } // End of switch if (!_global.isNaN(_loc4) && _loc4 < _loc7.length) { _loc7[_loc7.length - _loc4] = _loc8; this.api.datacenter.Basics.aks_a_logs = _loc7.join("<br/>"); this.api.ui.getUIComponent("Debug").refresh(); } // end if }; _loc1.onReferenceTime = function (sExtraData) { var _loc3 = Number(sExtraData); this.api.kernel.NightManager.setReferenceTime(_loc3); }; _loc1.onDate = function (sExtraData) { this.api.datacenter.Basics.lastDateUpdate = getTimer(); var _loc3 = sExtraData.split("|"); this.api.kernel.NightManager.setReferenceDate(Number(_loc3[0]), Number(_loc3[1]), Number(_loc3[2])); }; _loc1.onWhoIs = function (bSuccess, sExtraData) { if (bSuccess) { var _loc4 = sExtraData.split("|"); if (_loc4.length != 4) { return; } // end if var _loc5 = _loc4[0]; var _loc6 = _loc4[1]; var _loc7 = _loc4[2]; var _loc8 = Number(_loc4[3]) != -1 ? (this.api.lang.getMapAreaText(Number(_loc4[3])).n) : (this.api.lang.getText("UNKNOWN_AREA")); if (_loc5.toLowerCase() == this.api.datacenter.Basics.login) { switch (_loc6) { case "1": { this.api.kernel.showMessage(undefined, this.api.lang.getText("I_AM_IN_SINGLE_GAME", [_loc7, _loc5, _loc8]), "INFO_CHAT"); break; } case "2": { this.api.kernel.showMessage(undefined, this.api.lang.getText("I_AM_IN_GAME", [_loc7, _loc5, _loc8]), "INFO_CHAT"); break; } } // End of switch } else { switch (_loc6) { case "1": { this.api.kernel.showMessage(undefined, this.api.lang.getText("IS_IN_SINGLE_GAME", [_loc7, _loc5, _loc8]), "INFO_CHAT"); break; } case "2": { this.api.kernel.showMessage(undefined, this.api.lang.getText("IS_IN_GAME", [_loc7, _loc5, _loc8]), "INFO_CHAT"); break; } } // End of switch } // end else if } else { this.api.kernel.showMessage(undefined, this.api.lang.getText("CANT_FIND_ACCOUNT_OR_CHARACTER", [sExtraData]), "ERROR_CHAT"); } // end else if }; _loc1.onFileCheck = function (sExtraData) { var _loc3 = sExtraData.split(";"); var _loc4 = Number(_loc3[0]); var _loc5 = _loc3[1]; dofus.utils.Api.getInstance().checkFileSize(_loc5, _loc4); }; _loc1.onAveragePing = function (sExtraData) { this.averagePing(); }; _loc1.onSubscriberRestriction = function (sExtraData) { var _loc3 = sExtraData.charAt(0) == "+"; if (_loc3) { var _loc4 = Number(sExtraData.substr(1)); if (_loc4 != 10) { this.api.ui.loadUIComponent("PayZoneDialog2", "PayZoneDialog2", {dialogID: _loc4, name: "El Pemy", gfx: "9059"}); } else { this.api.ui.loadUIComponent("PayZone", "PayZone", {dialogID: _loc4}, {bForceLoad: true}); this.api.datacenter.Basics.payzone_isFirst = false; } // end else if } else { this.api.ui.unloadUIComponent("PayZone"); } // end else if }; ASSetPropFlags(_loc1, null, 1); } // end if #endinitclip
//------------------------------------------------------------------------------ // Copyright (c) 2009-2013 the original author or authors. All Rights Reserved. // // NOTICE: You are permitted to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. //------------------------------------------------------------------------------ package robotlegs.bender.extensions.matching { /** * A Type Matcher matches objects that satisfy type matching rules */ public class TypeMatcher implements ITypeMatcher, ITypeMatcherFactory { /*============================================================================*/ /* Protected Properties */ /*============================================================================*/ protected const _allOfTypes:Vector.<Class> = new Vector.<Class>(); protected const _anyOfTypes:Vector.<Class> = new Vector.<Class>(); protected const _noneOfTypes:Vector.<Class> = new Vector.<Class>(); protected var _typeFilter:ITypeFilter; /*============================================================================*/ /* Public Functions */ /*============================================================================*/ /** * All types that an item must extend or implement */ public function allOf(... types):TypeMatcher { pushAddedTypesTo(types, _allOfTypes); return this; } /** * Any types that an item must extend or implement */ public function anyOf(... types):TypeMatcher { pushAddedTypesTo(types, _anyOfTypes); return this; } /** * Types that an item must not extend or implement */ public function noneOf(... types):TypeMatcher { pushAddedTypesTo(types, _noneOfTypes); return this; } /** * @inheritDoc */ public function createTypeFilter():ITypeFilter { // calling this seals the matcher return _typeFilter ||= buildTypeFilter(); } /** * Locks this type matcher * @return */ public function lock():ITypeMatcherFactory { createTypeFilter(); return this; } /** * @inheritDoc */ public function clone():TypeMatcher { return new TypeMatcher().allOf(_allOfTypes).anyOf(_anyOfTypes).noneOf(_noneOfTypes); } /*============================================================================*/ /* Protected Functions */ /*============================================================================*/ protected function buildTypeFilter():ITypeFilter { if ((_allOfTypes.length == 0) && (_anyOfTypes.length == 0) && (_noneOfTypes.length == 0)) { throw new TypeMatcherError(TypeMatcherError.EMPTY_MATCHER); } return new TypeFilter(_allOfTypes, _anyOfTypes, _noneOfTypes); } protected function pushAddedTypesTo(types:Array, targetSet:Vector.<Class>):void { _typeFilter && throwSealedMatcherError(); pushValuesToClassVector(types, targetSet); } protected function throwSealedMatcherError():void { throw new TypeMatcherError(TypeMatcherError.SEALED_MATCHER); } protected function pushValuesToClassVector(values:Array, vector:Vector.<Class>):void { if (values.length == 1 && (values[0] is Array || values[0] is Vector.<Class>)) { for each (var type:Class in values[0]) { vector.push(type); } } else { for each (type in values) { vector.push(type); } } } } }
import gfx.events.EventDispatcher; import gfx.ui.InputDetails; import gfx.ui.NavigationCode; import Shared.GlobalFunc; import skyui.components.ButtonPanel; import skyui.defines.Input; class TextEntryField extends MovieClip { public var buttonPanel: ButtonPanel; public var TextInputInstance: TextField; private var _acceptButton: Object; private var _cancelButton: Object; public var dispatchEvent: Function; public var dispatchQueue: Function; public var hasEventListener: Function; public var addEventListener: Function; public var removeEventListener: Function; public var removeAllEventListeners: Function; public var cleanUpEvents: Function; public function TextEntryField() { super(); EventDispatcher.initialize(this); } public function handleInput(details: InputDetails, pathToFocus: Array): Boolean { var bHandledInput: Boolean = false; if (GlobalFunc.IsKeyPressed(details)) { if(details.navEquivalent == NavigationCode.ENTER) { onAccept(); bHandledInput = true; } else if(details.navEquivalent == NavigationCode.TAB) { onCancel(); bHandledInput = true; } } if(bHandledInput) { return bHandledInput; } else { var nextClip = pathToFocus.shift(); if (nextClip.handleInput(details, pathToFocus)) { return true; } } return false; } public function SetupButtons(): Void { buttonPanel.clearButtons(); var acceptButton = buttonPanel.addButton({text: "$Accept", controls: _acceptButton}); var cancelButton = buttonPanel.addButton({text: "$Cancel", controls: _cancelButton}); acceptButton.addEventListener("click", this, "onAccept"); cancelButton.addEventListener("click", this, "onCancel"); buttonPanel.updateButtons(true); } public function updateButtons(bInstant: Boolean) { buttonPanel.updateButtons(bInstant); } public function setPlatform(a_platform: Number, a_bPS3Switch: Boolean): Void { if(a_platform == 0) { _acceptButton = Input.Enter; _cancelButton = Input.Tab; } else { _acceptButton = Input.Accept; _cancelButton = Input.Cancel; } buttonPanel.setPlatform(a_platform, a_bPS3Switch); } public function GetValidName(): Boolean { return TextInputInstance.text.length > 0; } public function onAccept(): Void { if (GetValidName()) { dispatchEvent({type: "nameChange", nameChanged: true}); } } public function onCancel(): Void { dispatchEvent({type: "nameChange", nameChanged: false}); } }
package { import flash.geom.Point; import flash.events.TimerEvent; import flash.text.TextFormat; import flash.utils.setTimeout; import flash.utils.Timer; import starling.animation.Transitions; import starling.animation.Tween; import starling.core.Starling; import starling.display.Stage; import starling.display.Image; import starling.display.Sprite; import starling.events.Event; import starling.events.Touch; import starling.events.TouchEvent; import starling.events.TouchPhase; import starling.text.BitmapFont; import starling.text.TextField; import starling.textures.Texture; import starling.textures.TextureSmoothing; import starling.utils.HAlign; import starling.utils.VAlign; public class IntroSelect { static var point:Point; static var introSelectTouchList:Vector.<Touch>; static var logoSprite:Sprite; static var gameLogo:Image; static var logoLetters:Array = ["d","r","o","p","s","y"]; static var logoList:Array = []; static var perpetuaButton:Sprite; static var timedButton:Sprite; static var movesButton:Sprite; static var perpetuaButtonFiller:Image; static var timedButtonFiller:Image; static var movesButtonFiller:Image; static var perpetuaButtonText:TextField; static var timedButtonText:TextField; static var movesButtonText:TextField; static var backButton:Sprite; static var backButtonFiller:Image; static var backButtonText:TextField; static var backTextColor:uint = textColorOff; static var backButtonOn:Boolean = false; static var modeText:TextField; static var modeSubText:TextField; static var perpetuaButtonOn:Boolean = false; static var timedButtonOn:Boolean = false; static var movesButtonOn:Boolean = false; static var timedMode:Boolean = false; static var movesMode:Boolean = false; static var statsIcon:Image; static var optionsIcon:Image; static var gearTouchList:Vector.<Touch>; static var buttonColorOff:uint = Hud.stageColorLight; static var buttonColorOn:uint = Hud.highlightColorList[Hud.colorTheme]; static var textColorOff:uint = Hud.gameTextColor; static var textColorOn:uint = Environment.stageRef.color; static var redBox:Image; static var introSelectMode:int; static function display(stage:Stage) { buttonColorOn = Data.saveObj.highlight; point = new Point(); modeText = new TextField(int(Environment.rectSprite.width), int(Environment.rectSprite.height*0.3), String("MODE"), "Font", int(Environment.rectSprite.height*0.06275), textColorOff, false); if (Screens.gameMode == "timed") { modeText.text = String("HOW MANY\nSECONDS?"); } if (Screens.gameMode == "moves") { modeText.text = String("HOW MANY\nMOVES?"); } modeText.hAlign = HAlign.CENTER; modeText.vAlign = VAlign.TOP; modeText.x = int(Main.screenWidth/2 - modeText.width/2); modeText.y = int((Environment.rectSprite.height*0.0784) + Environment.rectSprite.y); modeText.touchable = false; stage.addChild(modeText); Screens.introSelectScreenObjects.push(modeText); modeSubText = new TextField(int(Environment.rectSprite.width), int(Environment.rectSprite.height*0.0982), String("MODE"), "Font", int(Environment.rectSprite.height*0.0314), Hud.subTextColor, false); if (Screens.gameMode == "timed") { modeSubText.text = String("10 SECONDS ADDED FOR\nEVERY 15 POINTS EARNED"); } if (Screens.gameMode == "moves") { modeSubText.text = String("10 MOVES ADDED FOR\nEVERY 15 POINTS EARNED"); } modeSubText.hAlign = HAlign.CENTER; modeSubText.vAlign = VAlign.TOP; modeSubText.x = int(Main.screenWidth/2 - modeSubText.width/2); modeSubText.y = int((Environment.rectSprite.height*0.2589) + Environment.rectSprite.y); modeSubText.touchable = false; stage.addChild(modeSubText); Screens.introSelectScreenObjects.push(modeSubText); perpetuaButton = new Sprite(); perpetuaButton.x = 0; perpetuaButton.y = int((Environment.rectSprite.height*0.4216) + Environment.rectSprite.y); stage.addChild(perpetuaButton); perpetuaButtonFiller = Atlas.generate("filler"); perpetuaButtonFiller.width = Main.screenWidth + 50; perpetuaButtonFiller.height = int(Environment.rectSprite.height*0.09412); perpetuaButtonFiller.color = buttonColorOff; perpetuaButton.addChild(perpetuaButtonFiller); perpetuaButtonText = new TextField(int(Environment.rectSprite.width*0.625), int(Environment.rectSprite.height*0.09412), String("PERPETUA"), "Font", int(Environment.rectSprite.height*0.06275), textColorOff, false); if (Screens.gameMode == "timed") { perpetuaButtonText.text = String(Score.timedOptions[0]); } if (Screens.gameMode == "moves") { perpetuaButtonText.text = String(Score.movesOptions[0]); } perpetuaButtonText.hAlign = HAlign.CENTER; perpetuaButtonText.vAlign = VAlign.CENTER; perpetuaButtonText.x = int(Main.screenWidth/2 - perpetuaButtonText.width/2); perpetuaButtonText.touchable = false; perpetuaButton.addChild(perpetuaButtonText); Screens.introSelectScreenObjects.push(perpetuaButton); timedButton = new Sprite(); timedButton.x = 0; timedButton.y = perpetuaButton.y + perpetuaButton.height; stage.addChild(timedButton); timedButtonFiller = Atlas.generate("filler"); timedButtonFiller.width = Main.screenWidth + 50; timedButtonFiller.height = int(Environment.rectSprite.height*0.09412); timedButtonFiller.color = buttonColorOff; timedButton.addChild(timedButtonFiller); timedButtonText = new TextField(int(Main.screenWidth*0.625), int(Environment.rectSprite.height*0.09412), String("TIMED"), "Font", int(Environment.rectSprite.height*0.06275), textColorOff, false); if (Screens.gameMode == "timed") { timedButtonText.text = String(Score.timedOptions[1]); } if (Screens.gameMode == "moves") { timedButtonText.text = String(Score.movesOptions[1]); } timedButtonText.hAlign = HAlign.CENTER; timedButtonText.vAlign = VAlign.CENTER; timedButtonText.x = int(Main.screenWidth/2 - timedButtonText.width/2); timedButtonText.touchable = false; timedButton.addChild(timedButtonText); Screens.introSelectScreenObjects.push(timedButton); movesButton = new Sprite(); movesButton.x = 0; movesButton.y = timedButton.y + timedButton.height; stage.addChild(movesButton); movesButtonFiller = Atlas.generate("filler"); movesButtonFiller.width = Main.screenWidth + 50; movesButtonFiller.height = int(Environment.rectSprite.height*0.09412); movesButtonFiller.color = buttonColorOff; movesButton.addChild(movesButtonFiller); movesButtonText = new TextField(int(Main.screenWidth*0.625), int(Environment.rectSprite.height*0.09412), String("MOVES"), "Font", int(Environment.rectSprite.height*0.06275), textColorOff, false); if (Screens.gameMode == "timed") { movesButtonText.text = String(Score.timedOptions[2]); } if (Screens.gameMode == "moves") { movesButtonText.text = String(Score.movesOptions[2]); } movesButtonText.hAlign = HAlign.CENTER; movesButtonText.vAlign = VAlign.CENTER; movesButtonText.x = int(Main.screenWidth/2 - movesButtonText.width/2); movesButtonText.touchable = false; movesButton.addChild(movesButtonText); Screens.introSelectScreenObjects.push(movesButton); backButton = new Sprite(); stage.addChild(backButton); backButtonFiller = Atlas.generate("filler"); backButtonFiller.width = Main.screenWidth + 50; backButtonFiller.height = int(Environment.rectSprite.height*0.09412); backButtonFiller.color = stage.color; backButton.addChild(backButtonFiller); backButtonText = new TextField(int(Main.screenWidth*0.625), int(Environment.rectSprite.height*0.09412), String("BACK"), "Font", int(Environment.rectSprite.height*0.06275), backTextColor, false); backButtonText.hAlign = HAlign.CENTER; backButtonText.vAlign = VAlign.CENTER; backButtonText.x = int(Main.screenWidth/2 - backButtonText.width/2); backButtonText.touchable = false; backButton.x = 0; backButton.y = int((Environment.rectSprite.height*0.6981) + backButtonFiller.height + Environment.rectSprite.y); backButton.addChild(backButtonText); Screens.introSelectScreenObjects.push(backButton); var touchDelay:Number = setTimeout(touchDelayHandler, 250); function touchDelayHandler() { stage.addEventListener(TouchEvent.TOUCH, stageIntroSelectTouchHandler); } } static function stageIntroSelectTouchHandler(evt:TouchEvent):void { introSelectTouchList = evt.getTouches(Environment.stageRef); if (introSelectTouchList.length > 0) { point = introSelectTouchList[0].getLocation(Environment.stageRef); if (perpetuaButton.bounds.containsPoint(point)) { if (introSelectTouchList[0].phase == TouchPhase.BEGAN || introSelectTouchList[0].phase == TouchPhase.MOVED) { if (!perpetuaButtonOn) { perpetuaButtonFiller.color = buttonColorOn; timedButtonFiller.color = buttonColorOff; movesButtonFiller.color = buttonColorOff; perpetuaButtonText.color = textColorOn; timedButtonText.color = textColorOff; movesButtonText.color = textColorOff; perpetuaButtonOn = true; timedButtonOn = false; movesButtonOn = false; Audio.playButton(); } } if (introSelectTouchList[0].phase == TouchPhase.ENDED) { perpetuaButtonOn = false; if (Screens.gameMode == "timed") { Screens.clearIntroSelectListeners(); var introSelectTimerTimed0:Timer; introSelectTimerTimed0 = new Timer(Screens.transVal); introSelectTimerTimed0.start(); introSelectTimerTimed0.addEventListener(TimerEvent.TIMER, introSelectTimerTimed0Handler); function introSelectTimerTimed0Handler(evt:TimerEvent):void { introSelectTimerTimed0.stop(); introSelectTimerTimed0.removeEventListener(TimerEvent.TIMER, introSelectTimerTimed0Handler); introSelectTimerTimed0 = null; Screens.clearIntroSelectScreen(); Screens.setGame(Score.timedOptions[0]); } } if (Screens.gameMode == "moves") { Screens.clearIntroSelectListeners(); var introSelectTimerMoves0:Timer; introSelectTimerMoves0 = new Timer(Screens.transVal); introSelectTimerMoves0.start(); introSelectTimerMoves0.addEventListener(TimerEvent.TIMER, introSelectTimerMoves0Handler); function introSelectTimerMoves0Handler(evt:TimerEvent):void { introSelectTimerMoves0.stop(); introSelectTimerMoves0.removeEventListener(TimerEvent.TIMER, introSelectTimerMoves0Handler); introSelectTimerMoves0 = null; Screens.clearIntroSelectScreen(); Screens.setGame(Score.movesOptions[0]); } } } } else if (timedButton.bounds.containsPoint(point)) { if (introSelectTouchList[0].phase == TouchPhase.BEGAN || introSelectTouchList[0].phase == TouchPhase.MOVED) { if (!timedButtonOn) { perpetuaButtonFiller.color = buttonColorOff; timedButtonFiller.color = buttonColorOn; movesButtonFiller.color = buttonColorOff; perpetuaButtonText.color = textColorOff; timedButtonText.color = textColorOn; movesButtonText.color = textColorOff; perpetuaButtonOn = false; timedButtonOn = true; movesButtonOn = false; Audio.playButton(); } } if (introSelectTouchList[0].phase == TouchPhase.ENDED) { timedButtonOn = false; if (Screens.gameMode == "timed") { Screens.clearIntroSelectListeners(); var introSelectTimerTimed1:Timer; introSelectTimerTimed1 = new Timer(Screens.transVal); introSelectTimerTimed1.start(); introSelectTimerTimed1.addEventListener(TimerEvent.TIMER, introSelectTimerTimed1Handler); function introSelectTimerTimed1Handler(evt:TimerEvent):void { introSelectTimerTimed1.stop(); introSelectTimerTimed1.removeEventListener(TimerEvent.TIMER, introSelectTimerTimed1Handler); introSelectTimerTimed1 = null; Screens.clearIntroSelectScreen(); Screens.setGame(Score.timedOptions[1]); } } if (Screens.gameMode == "moves") { Screens.clearIntroSelectListeners(); var introSelectTimerMoves1:Timer; introSelectTimerMoves1 = new Timer(Screens.transVal); introSelectTimerMoves1.start(); introSelectTimerMoves1.addEventListener(TimerEvent.TIMER, introSelectTimerMoves1Handler); function introSelectTimerMoves1Handler(evt:TimerEvent):void { introSelectTimerMoves1.stop(); introSelectTimerMoves1.removeEventListener(TimerEvent.TIMER, introSelectTimerMoves1Handler); introSelectTimerMoves1 = null; Screens.clearIntroSelectScreen(); Screens.setGame(Score.movesOptions[1]); } } } } else if (movesButton.bounds.containsPoint(point)) { if (introSelectTouchList[0].phase == TouchPhase.BEGAN || introSelectTouchList[0].phase == TouchPhase.MOVED) { if (!movesButtonOn) { perpetuaButtonFiller.color = buttonColorOff; timedButtonFiller.color = buttonColorOff; movesButtonFiller.color = buttonColorOn; perpetuaButtonText.color = textColorOff; timedButtonText.color = textColorOff; movesButtonText.color = textColorOn; perpetuaButtonOn = false; timedButtonOn = false; movesButtonOn = true; Audio.playButton(); } } if (introSelectTouchList[0].phase == TouchPhase.ENDED) { movesButtonOn = false; if (Screens.gameMode == "timed") { Screens.clearIntroSelectListeners(); var introSelectTimerTimed2:Timer; introSelectTimerTimed2 = new Timer(Screens.transVal); introSelectTimerTimed2.start(); introSelectTimerTimed2.addEventListener(TimerEvent.TIMER, introSelectTimerTimed2Handler); function introSelectTimerTimed2Handler(evt:TimerEvent):void { introSelectTimerTimed2.stop(); introSelectTimerTimed2.removeEventListener(TimerEvent.TIMER, introSelectTimerTimed2Handler); introSelectTimerTimed2 = null; Screens.clearIntroSelectScreen(); Screens.setGame(Score.timedOptions[2]); } } if (Screens.gameMode == "moves") { Screens.clearIntroSelectListeners(); var introSelectTimerMoves2:Timer; introSelectTimerMoves2 = new Timer(Screens.transVal); introSelectTimerMoves2.start(); introSelectTimerMoves2.addEventListener(TimerEvent.TIMER, introSelectTimerMoves2Handler); function introSelectTimerMoves2Handler(evt:TimerEvent):void { introSelectTimerMoves2.stop(); introSelectTimerMoves2.removeEventListener(TimerEvent.TIMER, introSelectTimerMoves2Handler); introSelectTimerMoves2 = null; Screens.clearIntroSelectScreen(); Screens.setGame(Score.movesOptions[2]); } } } } else if (backButton.visible && backButton.bounds.containsPoint(point)) { if (introSelectTouchList[0].phase == TouchPhase.BEGAN || introSelectTouchList[0].phase == TouchPhase.MOVED) { if (!backButtonOn) { backButtonFiller.color = Intro.buttonColorOn; backButtonText.color = Intro.textColorOn; backButtonOn = true; Audio.playButton(); } } if (introSelectTouchList[0].phase == TouchPhase.ENDED) { backButtonOn = false; Screens.clearIntroSelectListeners(); var introSelectTimerIntro:Timer; introSelectTimerIntro = new Timer(Screens.transVal); introSelectTimerIntro.start(); introSelectTimerIntro.addEventListener(TimerEvent.TIMER, introSelectTimerIntroHandler); function introSelectTimerIntroHandler(evt:TimerEvent):void { introSelectTimerIntro.stop(); introSelectTimerIntro.removeEventListener(TimerEvent.TIMER, introSelectTimerIntroHandler); introSelectTimerIntro = null; Screens.clearIntroSelectScreen(); Screens.setIntro(); } } } else { if (perpetuaButtonOn || timedButtonOn || movesButtonOn || backButtonOn) { perpetuaButtonFiller.color = buttonColorOff; timedButtonFiller.color = buttonColorOff; movesButtonFiller.color = buttonColorOff; perpetuaButtonText.color = textColorOff; timedButtonText.color = textColorOff; movesButtonText.color = textColorOff; backButtonFiller.color = Intro.buttonColorOff; backButtonText.color = Intro.textColorOff; perpetuaButtonOn = false; timedButtonOn = false; movesButtonOn = false; backButtonOn = false; } } } } } }
package com.sndbar.events { import flash.events.Event; /** * The TimerTickEvent will be thrown by the AudioPlayer * when the timer in AudioPlayer has completed a cycle. */ public class TimerTickEvent extends Event { //------------------------------------------------------------------------------------- // // Constants // //------------------------------------------------------------------------------------- public static const TIMER_TICK:String = "timerTick" //------------------------------------------------------------------------------------- // // Constructor // //------------------------------------------------------------------------------------- public function TimerTickEvent() { super(TIMER_TICK); } } }
package idubee.events { import com.adobe.cairngorm.control.CairngormEvent; public class AddressBarEvent extends CairngormEvent { public static const SHOW_HIDE_BAR:String = "showHideBar"; public function AddressBarEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) { super(type, bubbles, cancelable); } } }
/************************************************************************ * Copyright 2012 Worlize Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ***********************************************************************/ package com.worlize.gif.constants { public final class DisposalType { public static const NO_DISPOSAL:uint = 0; public static const DO_NOT_DISPOSE:uint = 1; public static const RESTORE_BACKGROUND_COLOR:uint = 2; public static const RESTORE_TO_PREVIOUS:uint = 3; } }
package AI { import flash.geom.Vector3D; import object.RGameEnt; public class RAI { public static const AI_UNKNOWN:int = 0; public static const AI_IDLE:int = 1; public static const AI_FOLLOWPATH:int = 2; public static const AI_FOLLOWOBJECT:int = 3; public static const AI_AUTOPILOT:int = 4; public static const AI_ROAM:int = 5; public static const AI_FLUSTRATE:int = 6; public static const UNKNOWN:int = 0; public static const CHANGERANK:int = 1; public static const COLLISION:int = 2; public static const CHANGEAISTATE:int = 3; public static const GETBONUS:int = 4; public static const LIMITDIST:Number = 300; public static const ZEROANGLE:Number = 0.5; public var m_GameObject:RGameEnt; public var m_DestObject:RGameEnt; public var m_CurState:int; public var m_FlastrateVal:Number = 0; public var m_Hit:Boolean = false; public function RAI(param1:RGameEnt, param2:int = 1) { super(); this.m_GameObject = param1; this.m_CurState = param2; this.m_Hit = false; } public static function DistanceXZ(param1:Vector3D, param2:Vector3D) : Number { return Math.sqrt((param1.x - param2.x) * (param1.x - param2.x) + (param1.z - param2.z) * (param1.z - param2.z)); } public function OnMessage(param1:int, param2:Number, param3:Object) : Boolean { switch(param1) { case CHANGEAISTATE: this.m_CurState = param2; if(this.m_CurState == AI_FOLLOWOBJECT) { this.m_DestObject = RGameEnt(param3); } this.m_FlastrateVal = 0; return true; case COLLISION: return true; default: return false; } } public function SetAIState(param1:int) : void { this.m_CurState = param1; if(this.m_CurState == AI_FLUSTRATE) { this.m_FlastrateVal = Math.random() * Math.PI; } else { this.m_FlastrateVal = 0; } } public function OnRefresh() : void { switch(this.m_CurState) { case AI_AUTOPILOT: case AI_FOLLOWPATH: this.FollowPath(); break; case AI_FOLLOWOBJECT: this.FollowObject(); break; case AI_ROAM: break; case AI_IDLE: this.UpdatePath(); break; case AI_FLUSTRATE: this.FollowPath(); this.m_FlastrateVal += Math.PI / 12; break; case AI_UNKNOWN: } } public function UpdatePath() : Boolean { var _loc1_:Number = NaN; var _loc2_:Array = RockRacer.GameCommon.GameClient.m_Terrain.m_path.m_lPath; _loc1_ = DistanceXZ(this.m_GameObject.currState.loc,_loc2_[this.m_GameObject.m_DestPath]); if(_loc1_ < LIMITDIST * 2) { ++this.m_GameObject.m_DestPath; if(this.m_GameObject.m_DestPath >= _loc2_.length) { this.m_GameObject.m_DestPath = 1; } return true; } return false; } public function FollowPath() : void { var _loc1_:Array = RockRacer.GameCommon.GameClient.m_Terrain.m_path.m_lPath; this.UpdatePath(); this.FollowPoint(_loc1_[this.m_GameObject.m_DestPath]); } public function FollowObject() : void { var _loc1_:Number = NaN; if(this.m_DestObject) { _loc1_ = DistanceXZ(this.m_GameObject.currState.loc,this.m_DestObject.currState.loc); } else { _loc1_ = LIMITDIST * 4; } if(this.m_DestObject.hit && (_loc1_ < LIMITDIST * 3 || this.m_GameObject.m_DestPath >= this.m_DestObject.m_DestPath)) { this.FollowPoint(this.m_DestObject.currState.loc); } else { this.FollowPath(); } } public function FollowPoint(param1:Vector3D) : void { var _loc2_:Vector3D = null; var _loc3_:Number = NaN; var _loc5_:Number = NaN; _loc2_ = param1.subtract(this.m_GameObject.currState.loc); if(this.m_DestObject == null) { return; } _loc3_ = DistanceXZ(this.m_GameObject.currState.loc,this.m_DestObject.currState.loc); if(_loc3_ < Math.sqrt(Math.pow(this.m_DestObject.currState.vel.x,2) + Math.pow(this.m_DestObject.currState.vel.z,2))) { this.m_GameObject.currState.loc.x = param1.x; this.m_GameObject.currState.loc.y = param1.y; this.m_GameObject.currState.loc.z = param1.z; this.m_DestObject.CollisionProc(this.m_GameObject); return; } var _loc4_:Number = this.m_GameObject.currState.vel.length; _loc2_.normalize(); _loc2_.scaleBy(_loc4_); this.m_GameObject.currState.vel = _loc2_; if(_loc2_.z == 0) { _loc5_ = 90; } else { _loc5_ = (_loc5_ = Math.atan(_loc2_.x / _loc2_.z)) * 180 / Math.PI; } if(_loc2_.z < 0) { _loc5_ += 180; } if(_loc5_ < 0) { _loc5_ += 360; } this.m_GameObject.currState.pose.y = _loc5_; } } }
//////////////////////////////////////////////////////////////////////////////// // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License // // No warranty of merchantability or fitness of any kind. // Use this software at your own risk. // //////////////////////////////////////////////////////////////////////////////// package actionScripts.plugin.groovy.grailsproject { import actionScripts.events.NewProjectEvent; import actionScripts.plugin.PluginBase; import actionScripts.plugin.project.ProjectTemplateType; import actionScripts.plugin.project.ProjectType; import actionScripts.valueObjects.ConstantsCoreVO; public class GrailsProjectPlugin extends PluginBase { public var activeType:uint = ProjectType.GROOVY; override public function get name():String { return "Grails Project Plugin"; } override public function get author():String { return ConstantsCoreVO.MOONSHINE_IDE_LABEL + " Project Team"; } override public function get description():String { return "Grails project importing, exporting & scaffolding."; } override public function activate():void { dispatcher.addEventListener(NewProjectEvent.CREATE_NEW_PROJECT, createNewProjectHandler); super.activate(); } override public function deactivate():void { dispatcher.removeEventListener(NewProjectEvent.CREATE_NEW_PROJECT, createNewProjectHandler); super.deactivate(); } private function createNewProjectHandler(event:NewProjectEvent):void { if(!canCreateProject(event)) { return; } model.groovyCore.createProject(event); } private function canCreateProject(event:NewProjectEvent):Boolean { var projectTemplateName:String = event.templateDir.fileBridge.name; return projectTemplateName.indexOf(ProjectTemplateType.GRAILS) != -1; } } }
package ahhenderson.core.collections.interfaces { internal interface IBaseDictionaryList { /** * This function adds an item from a Vector/ArrayList. * * @param item: IDictionaryItem to add * @param args: rest arguments; might needs later. * * @langversion 3.0 * @playerversion Flash 11 * @playerversion AIR 3 * @productversion Starling 1.2, Flex 4.6 */ function addItem(item:IDictionaryItem, ... args):Boolean; /** * This function get's an IDictionaryItem from a Vector/ArrayList. * * @param key: unique id to retrieve the item from the Vector/ArrayList * @param args: rest arguments; might needs later. * * @langversion 3.0 * @playerversion Flash 11 * @playerversion AIR 3 * @productversion Starling 1.2, Flex 4.6 */ function getItem(key:String, ... args):*; /** * This function checks if an item exists in a Vector/ArrayList. * * @param key: unique id to validate if the item exists. * * @langversion 3.0 * @playerversion Flash 11 * @playerversion AIR 3 * @productversion Starling 1.2, Flex 4.6 */ function itemExists(key:String):Boolean; /** * This function removes an item from a Vector/ArrayList. * * @param key: unique used to remove the item. * @param args: rest arguments; might needs later. * * @langversion 3.0 * @playerversion Flash 11 * @playerversion AIR 3 * @productversion Starling 1.2, Flex 4.6 */ function removeItem(key:String, ... args):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.collections { import flash.events.UncaughtErrorEvent; import flash.utils.describeType; import mx.core.FlexGlobals; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertNotNull; import spark.components.Application; public class HierarchicalCollectionViewCursor_Basics_Tests { private static var _utils:HierarchicalCollectionViewTestUtils = new HierarchicalCollectionViewTestUtils(); private static var _currentHierarchy:HierarchicalCollectionView; private static var _noErrorsThrown:Boolean = true; private var _level0:ArrayCollection; private var _sut:HierarchicalCollectionViewCursor; [BeforeClass] public static function setUpBeforeClass():void { if(FlexGlobals.topLevelApplication is Application) (FlexGlobals.topLevelApplication as Application).loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleUncaughtClientError); } [AfterClass] public static function tearDownAfterClass():void { if(FlexGlobals.topLevelApplication is Application) (FlexGlobals.topLevelApplication as Application).loaderInfo.uncaughtErrorEvents.removeEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleUncaughtClientError); } [Before] public function setUp():void { _currentHierarchy = generateHierarchyViewWithOpenNodes(); _level0 = _utils.getRoot(_currentHierarchy) as ArrayCollection; _sut = _currentHierarchy.createCursor() as HierarchicalCollectionViewCursor; _noErrorsThrown = true; } [After] public function tearDown():void { _sut = null; _currentHierarchy = null; _level0 = null; } [Test] public function testMovingAround():void { //given var lastCompany:DataNode = _level0.getItemAt(_level0.length - 1) as DataNode; var firstCompany:DataNode = _level0.getItemAt(0) as DataNode; var firstLocation:DataNode = firstCompany.children.getItemAt(0) as DataNode; var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode; var firstDepartment:DataNode = firstLocation.children.getItemAt(0) as DataNode; var secondDepartment:DataNode = firstLocation.children.getItemAt(1) as DataNode; //when _sut.moveNext(); //then assertEquals(firstLocation, _sut.current); //when _sut.moveNext(); //then assertEquals(firstDepartment, _sut.current); //when _sut.moveNext(); //then assertEquals(secondDepartment, _sut.current); //when _sut.movePrevious(); //then assertEquals(firstDepartment, _sut.current); //when _sut.moveToLast(); //then assertEquals(lastCompany, _sut.current); //when _sut.seek(new CursorBookmark(4)); //then assertEquals(secondLocation, _sut.current); } [Test] public function testCollectionChangeInRootDoesNotChangeCurrent():void { //given var lastCompany:DataNode = _level0.getItemAt(_level0.length - 1) as DataNode; //when _sut.moveToLast(); var newFirstCompany:DataNode = _utils.createSimpleNode("[INS] Company"); _level0.addItemAt(newFirstCompany, 0); var newLastCompany:DataNode = _utils.createSimpleNode("[INS] Company"); _level0.addItemAt(newLastCompany, _level0.length); //then assertEquals(lastCompany, _sut.current); //when _sut.moveToLast(); //then assertEquals(newLastCompany, _sut.current); } [Test] public function testRemovingCurrentMiddleItemChangesCurrentToNextItem():void { //given var firstCompany:DataNode = _level0.getItemAt(0) as DataNode; var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode; var thirdDepartmentOfSecondLocation:DataNode = secondLocation.children.getItemAt(2) as DataNode; _sut.seek(new CursorBookmark(6)); //Company(1)->Location(2)->Department(2) //when secondLocation.children.removeItemAt(1); //then assertEquals(thirdDepartmentOfSecondLocation, _sut.current); } [Test] public function testRemovingPreviousSiblingOfCurrentMiddleItemDoesNotChangeCurrent():void { //given var firstCompany:DataNode = _level0.getItemAt(0) as DataNode; var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode; var secondDepartmentOfSecondLocation:DataNode = secondLocation.children.getItemAt(1) as DataNode; //when _sut.seek(new CursorBookmark(6)); //Company(1)->Location(2)->Department(2) //then assertEquals(secondDepartmentOfSecondLocation, _sut.current); //when secondLocation.children.removeItemAt(0); //then assertEquals(secondDepartmentOfSecondLocation, _sut.current); } [Test] public function testRemovingCurrentFirstItemChangesCurrentToNextItem():void { //given var firstCompany:DataNode = _level0.getItemAt(0) as DataNode; var secondCompany:DataNode = _level0.getItemAt(1) as DataNode; //initial assumption assertEquals(firstCompany, _sut.current); //when _level0.removeItemAt(0); //then assertEquals(secondCompany, _sut.current); } [Test] public function testRemovingSiblingOfCurrentFirstItemDoesNotChangeCurrent():void { //given var firstCompany:DataNode = _level0.getItemAt(0) as DataNode; var firstLocation:DataNode = firstCompany.children.getItemAt(0) as DataNode; //when _sut.seek(new CursorBookmark(1)); //Company(1)->Location(1) //then assertEquals(firstLocation, _sut.current); //when firstCompany.children.removeItemAt(1); //then assertEquals(firstLocation, _sut.current); } private static function handleUncaughtClientError(event:UncaughtErrorEvent):void { event.preventDefault(); event.stopImmediatePropagation(); _noErrorsThrown = false; trace("\n" + event.error); _utils.printHCollectionView(_currentHierarchy); } private static function generateHierarchyViewWithOpenNodes():HierarchicalCollectionView { return _utils.generateOpenHierarchyFromRootList(_utils.generateHierarchySourceFromString(HIERARCHY_STRING)); } private static const HIERARCHY_STRING:String = (<![CDATA[ Company(1) Company(1)->Location(1) Company(1)->Location(1)->Department(1) Company(1)->Location(1)->Department(2) Company(1)->Location(2) Company(1)->Location(2)->Department(1) Company(1)->Location(2)->Department(2) Company(1)->Location(2)->Department(3) Company(1)->Location(3) Company(2) Company(2)->Location(1) Company(2)->Location(2) Company(2)->Location(2)->Department(1) Company(2)->Location(3) Company(3) ]]>).toString(); } }
package SJ.Common.Constants { /** * 酒馆常量 * * @author longtao * 创建时间:2013/4/24 18:45 */ public final class ConstWinebar { public function ConstWinebar() { } /** * 酒馆武将卡最大数量 */ public static const ConstWinebarMaxHeroCards:uint = 5; /** * 酒馆名牌状态 */ public static const ConstWinebarStateFront:String = "1"; /** * 酒馆暗牌状态(暗牌状态下当抽取武将次数为0时,翻开所有武将牌,此时酒馆状态仍为暗牌阶段) */ public static const ConstWinebarStateBack:String = "2"; /** * 武将卡状态 未选择 */ public static const ConstWinebarHeroStateNoSelected:String = "1"; /** * 武将卡状态 已选择 */ public static const ConstWinebarHeroStateSelected:String = "2"; /** * 武将卡状态 已雇佣 */ public static const ConstWinebarHeroStateEmployed:String = "3"; /** * 酒馆VIP等级不同翻牌次数变化 */ public static const WINEBAR_PICK_COUNT_LIMIT:Array = new Array(1,1,1,2,2,2,2,2,2,3,3,3,3); /** * 酒馆最大翻牌次数 */ public static const WINEBAR_MAX_PICK_COUNT:uint = 3; } }
package org.swiftsuspenders.injectionpoints { import flash.utils.Dictionary; import flash.utils.getQualifiedClassName; import org.flexunit.Assert; import org.swiftsuspenders.InjectionConfig; import org.swiftsuspenders.InjectionType; import org.swiftsuspenders.Injector; import org.swiftsuspenders.support.injectees.ClassInjectee; import org.swiftsuspenders.support.nodes.InjectionNodes; import org.swiftsuspenders.support.types.Clazz; public class PostConstructInjectionPointTests { [Test] public function invokeXMLConfiguredPostConstructMethod():void { var injectee:ClassInjectee = applyPostConstructToClassInjectee(); Assert.assertTrue(injectee.someProperty); } private function applyPostConstructToClassInjectee():ClassInjectee { var injectee:ClassInjectee = new ClassInjectee(); var injector:Injector = new Injector( <types> <type name='org.swiftsuspenders.support.injectees::ClassInjectee'> <postconstruct name='doSomeStuff' order='1'/> </type> </types>); injector.injectInto(injectee); return injectee; } } }
package org.papervision3d.core.geom.renderables { import flash.display.Sprite; import org.papervision3d.core.math.Number3D; import org.papervision3d.objects.DisplayObject3D; public class Triangle3DInstance { public var instance:DisplayObject3D; /** * container is initialized via DisplayObject3D's render method IF DisplayObject3D.faceLevelMode is set to true */ public var container:Sprite; public var visible:Boolean = false; public var screenZ:Number; public var faceNormal:Number3D; public function Triangle3DInstance(face:Triangle3D, instance:DisplayObject3D) { this.instance = instance; faceNormal = new Number3D(); } } }
package org.shypl.common.logging { public class PrefixedLoggerProxy extends LoggerProxy { private var _prefix:String; public function PrefixedLoggerProxy(logger:Logger, prefix:String) { super(logger); _prefix = prefix; } override public function log(level:Level, message:String, args:Array):void { if (isEnabled(level)) { super.log(level, _prefix + message, args); } } } }
package widgets.ControlPanel.ListControlPanel { import flash.events.EventDispatcher; [Bindable] public class MenuItem extends EventDispatcher { public var id:Number; // id of the associated widget public var isGroup:Boolean; public var label:String; public var open:Boolean; // indicates whether the associated widget is open or closed public var groupMenuItems:Array; //点击以后执行的操作 public var functionArray:Array; } }
/** * VERSION: 1.87 * DATE: 2011-07-30 * AS3 * UPDATES AND DOCS AT: http://www.greensock.com/loadermax/ **/ package com.greensock.loading.core { import com.greensock.events.LoaderEvent; import com.greensock.loading.LoaderMax; import com.greensock.loading.LoaderStatus; import com.greensock.loading.display.ContentDisplay; import flash.display.DisplayObject; import flash.display.Loader; import flash.display.Sprite; import flash.events.ErrorEvent; import flash.events.Event; import flash.events.ProgressEvent; import flash.net.LocalConnection; import flash.system.ApplicationDomain; import flash.system.Capabilities; import flash.system.LoaderContext; import flash.system.Security; import flash.system.SecurityDomain; /** * Serves as the base class for SWFLoader and ImageLoader. There is no reason to use this class on its own. * Please refer to the documentation for the other classes. * <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 DisplayObjectLoader extends LoaderItem { /** @private the Sprite to which the EVENT_LISTENER was attached for forcing garbage collection after 1 frame (improves performance especially when multiple loaders are disposed at one time). **/ protected static var _gcDispatcher:Sprite; /** @private **/ protected static var _gcCycles:uint = 0; /** @private **/ protected var _loader:Loader; /** @private **/ protected var _sprite:Sprite; /** @private **/ protected var _context:LoaderContext; /** @private **/ protected var _initted:Boolean; /** @private used by SWFLoader when the loader is canceled before the SWF ever had a chance to init which causes garbage collection issues. We slip into stealthMode at that point, wait for it to init, and then cancel the _loader's loading.**/ protected var _stealthMode:Boolean; /** * Constructor * * @param urlOrRequest The url (<code>String</code>) or <code>URLRequest</code> from which the loader should get its content * @param vars An object containing optional parameters like <code>estimatedBytes, name, autoDispose, onComplete, onProgress, onError</code>, etc. For example, <code>{estimatedBytes:2400, name:"myImage1", onComplete:completeHandler}</code>. */ public function DisplayObjectLoader(urlOrRequest:*, vars:Object=null) { super(urlOrRequest, vars); _refreshLoader(false); if (LoaderMax.contentDisplayClass is Class) { _sprite = new LoaderMax.contentDisplayClass(this); if (!_sprite.hasOwnProperty("rawContent")) { throw new Error("LoaderMax.contentDisplayClass must be set to a class with a 'rawContent' property, like com.greensock.loading.display.ContentDisplay"); } } else { _sprite = new ContentDisplay(this); } } /** @private Set inside ContentDisplay's or FlexContentDisplay's "loader" setter. **/ public function setContentDisplay(contentDisplay:Sprite):void { _sprite = contentDisplay; } /** @private **/ override protected function _load():void { _prepRequest(); if (this.vars.context is LoaderContext) { _context = this.vars.context; } else if (_context == null) { if (LoaderMax.defaultContext != null) { _context = LoaderMax.defaultContext; if (_isLocal) { _context.securityDomain = null; } } else if (!_isLocal) { _context = new LoaderContext(true, new ApplicationDomain(ApplicationDomain.currentDomain), SecurityDomain.currentDomain); //avoids some security sandbox headaches that plague many users. } } if (Capabilities.playerType != "Desktop") { //AIR apps will choke on Security.allowDomain() Security.allowDomain(_url); } _loader.load(_request, _context); } /** @private **/ protected function _refreshLoader(unloadContent:Boolean=true):void { if (_loader != null) { //to avoid gc issues and get around a bug in Flash that incorrectly reports progress values on Loaders that were closed before completing, we must force gc and recreate the Loader altogether... if (_status == LoaderStatus.LOADING) { try { _loader.close(); } catch (error:Error) { } } _loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, _progressHandler); _loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, _completeHandler); _loader.contentLoaderInfo.removeEventListener("ioError", _failHandler); _loader.contentLoaderInfo.removeEventListener("securityError", _securityErrorHandler); _loader.contentLoaderInfo.removeEventListener("httpStatus", _httpStatusHandler); _loader.contentLoaderInfo.removeEventListener(Event.INIT, _initHandler); if (_loader.hasOwnProperty("uncaughtErrorEvents")) { //not available when published to FP9, so we reference things this way to avoid compiler errors Object(_loader).uncaughtErrorEvents.removeEventListener("uncaughtError", _errorHandler); } if (unloadContent) { try { if (_loader.parent == null && _sprite != null) { _sprite.addChild(_loader); //adding the _loader to the display list BEFORE calling unloadAndStop() and then removing it will greatly improve its ability to gc correctly if event listeners were added to the stage from within a subloaded swf without specifying "true" for the weak parameter of addEventListener(). The order here is critical. } if (_loader.hasOwnProperty("unloadAndStop")) { //Flash Player 10 and later only (_loader as Object).unloadAndStop(); } else { _loader.unload(); } } catch (error:Error) { } if (_loader.parent) { _loader.parent.removeChild(_loader); } } forceGC((this.hasOwnProperty("getClass")) ? 3 : 1); } _initted = false; _loader = new Loader(); _loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, _progressHandler, false, 0, true); _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, _completeHandler, false, 0, true); _loader.contentLoaderInfo.addEventListener("ioError", _failHandler, false, 0, true); _loader.contentLoaderInfo.addEventListener("securityError", _securityErrorHandler, false, 0, true); _loader.contentLoaderInfo.addEventListener("httpStatus", _httpStatusHandler, false, 0, true); _loader.contentLoaderInfo.addEventListener(Event.INIT, _initHandler, false, 0, true); if (_loader.hasOwnProperty("uncaughtErrorEvents")) { //not available when published to FP9, so we reference things this way to avoid compiler errors Object(_loader).uncaughtErrorEvents.addEventListener("uncaughtError", _errorHandler, false, 0, true); } } /** @private works around bug in Flash Player that prevents SWFs from properly being garbage collected after being unloaded - for certain types of objects like swfs, this needs to be run more than once (spread out over several frames) to force Flash to properly garbage collect everything. **/ public static function forceGC(cycles:uint=1):void { if (_gcCycles < cycles) { _gcCycles = cycles; if (_gcDispatcher == null) { _gcDispatcher = new Sprite(); _gcDispatcher.addEventListener(Event.ENTER_FRAME, _forceGCHandler, false, 0, true); } } } /** @private **/ protected static function _forceGCHandler(event:Event):void { if (_gcCycles == 0) { _gcDispatcher.removeEventListener(Event.ENTER_FRAME, _forceGCHandler); _gcDispatcher = null; } else { _gcCycles--; } try { new LocalConnection().connect("FORCE_GC"); new LocalConnection().connect("FORCE_GC"); } catch (error:Error) { } } /** @private scrubLevel: 0 = cancel, 1 = unload, 2 = dispose, 3 = flush **/ override protected function _dump(scrubLevel:int=0, newStatus:int=LoaderStatus.READY, suppressEvents:Boolean=false):void { if (!_stealthMode) { _refreshLoader(Boolean(scrubLevel != 2)); } if (scrubLevel == 1) { //unload (_sprite as Object).rawContent = null; } else if (scrubLevel == 2) { //dispose (_sprite as Object).loader = null; } else if (scrubLevel == 3) { //unload and dispose (_sprite as Object).dispose(false, false); //makes sure the ContentDisplay is removed from its parent as well. } super._dump(scrubLevel, newStatus, suppressEvents); } /** @private **/ protected function _determineScriptAccess():void { if (!_scriptAccessDenied) { if (!_loader.contentLoaderInfo.childAllowsParent) { _scriptAccessDenied = true; dispatchEvent(new LoaderEvent(LoaderEvent.SCRIPT_ACCESS_DENIED, this, "Error #2123: Security sandbox violation: " + this + ". No policy files granted access.")); } } } //---- EVENT HANDLERS ------------------------------------------------------------------------------------ /** @private **/ protected function _securityErrorHandler(event:ErrorEvent):void { //If a security error is thrown because of a missing crossdomain.xml file for example and the user didn't define a specific LoaderContext, we'll try again without checking the policy file, accepting the restrictions that come along with it because typically people would rather have the content show up on the screen rather than just error out (and they can always check the scriptAccessDenied property if they need to figure out whether it's safe to do BitmapData stuff on it, etc.) if (_context != null && _context.checkPolicyFile && !(this.vars.context is LoaderContext)) { _context = new LoaderContext(false); _scriptAccessDenied = true; dispatchEvent(new LoaderEvent(LoaderEvent.SCRIPT_ACCESS_DENIED, this, event.text)); _errorHandler(event); _load(); } else { _failHandler(event); } } /** @private **/ protected function _initHandler(event:Event):void { if (!_initted) { _initted = true; if (_content == null) { //_content is set in ImageLoader or SWFLoader (subclasses), but we put this here just in case someone wants to use DisplayObjectLoader on its own as a lighter weight alternative without the bells & whistles of SWFLoader/ImageLoader. _content = (_scriptAccessDenied) ? _loader : _loader.content; } (_sprite as Object).rawContent = (_content as DisplayObject); dispatchEvent(new LoaderEvent(LoaderEvent.INIT, this)); } } //---- GETTERS / SETTERS ------------------------------------------------------------------------- /** A ContentDisplay object (a Sprite) that will contain the remote content as soon as the <code>INIT</code> event has been dispatched. This ContentDisplay can be accessed immediately; you do not need to wait for the content to load. **/ override public function get content():* { return _sprite; } /** * The raw content that was successfully loaded <strong>into</strong> the <code>content</code> ContentDisplay * Sprite which varies depending on the type of loader and whether or not script access was denied while * attempting to load the file: * * <ul> * <li>ImageLoader with script access granted: <code>flash.display.Bitmap</code></li> * <li>ImageLoader with script access denied: <code>flash.display.Loader</code></li> * <li>SWFLoader with script access granted: <code>flash.display.DisplayObject</code> (the swf's <code>root</code>)</li> * <li>SWFLoader with script access denied: <code>flash.display.Loader</code> (the swf's <code>root</code> cannot be accessed because it would generate a security error)</li> * </ul> **/ public function get rawContent():* { return _content; } } }
// // $Id$ package com.threerings.msoy.avrg.data { import com.threerings.util.Integer; import com.threerings.presents.data.InvocationMarshaller; import com.threerings.msoy.avrg.client.AVRGameAgentService; /** * Provides the implementation of the <code>AVRGameAgentService</code> interface * that marshalls the arguments and delivers the request to the provider * on the server. Also provides an implementation of the response listener * interfaces that marshall the response arguments and deliver them back * to the requesting client. */ public class AVRGameAgentMarshaller extends InvocationMarshaller implements AVRGameAgentService { /** The method id used to dispatch <code>leaveGame</code> requests. */ public static const LEAVE_GAME :int = 1; // from interface AVRGameAgentService public function leaveGame (arg1 :int) :void { sendRequest(LEAVE_GAME, [ Integer.valueOf(arg1) ]); } /** The method id used to dispatch <code>roomSubscriptionComplete</code> requests. */ public static const ROOM_SUBSCRIPTION_COMPLETE :int = 2; // from interface AVRGameAgentService public function roomSubscriptionComplete (arg1 :int) :void { sendRequest(ROOM_SUBSCRIPTION_COMPLETE, [ Integer.valueOf(arg1) ]); } } }
/** * VERSION: 1.22 * DATE: 2011-04-20 * AS3 * UPDATES AND DOCS AT: http://www.greensock.com/loadermax/ **/ package com.greensock.loading.data { import flash.display.DisplayObject; /** * Can be used instead of a generic Object to define the <code>vars</code> parameter of a XMLLoader's constructor. <br /><br /> * * There are 2 primary benefits of using a XMLLoaderVars instance to define your XMLLoader variables: * <ol> * <li> In most code editors, code hinting will be activated which helps remind you which special properties are available in XMLLoader</li> * <li> It enables strict data typing for improved debugging (ensuring, for example, that you don't define a Boolean value for <code>onComplete</code> where a Function is expected).</li> * </ol><br /> * * The down side, of course, is that the code is more verbose and the XMLLoaderVars class adds slightly more kb to your swf. * * <b>USAGE:</b><br /><br /> * Note that each method returns the XMLLoaderVars instance, so you can reduce the lines of code by method chaining (see example below).<br /><br /> * * <b>Without XMLLoaderVars:</b><br /><code> * new XMLLoader("data.xml", {name:"css", estimatedBytes:1500, onComplete:completeHandler, onProgress:progressHandler})</code><br /><br /> * * <b>With XMLLoaderVars</b><br /><code> * new XMLLoader("data.xml", new XMLLoaderVars().name("data").estimatedBytes(1500).onComplete(completeHandler).onProgress(progressHandler))</code><br /><br /> * * <b>NOTES:</b><br /> * <ul> * <li> To get the generic vars object that XMLLoaderVars builds internally, simply access its "vars" property. * In fact, if you want maximum backwards compatibility, you can tack ".vars" onto the end of your chain like this:<br /><code> * new XMLLoader("data.xml", new XMLLoaderVars().name("data").estimatedBytes(1500).onComplete(completeHandler).vars)</code></li> * <li> Using XMLLoaderVars is completely optional. If you prefer the shorter synatax with the generic Object, feel * free to use it. The purpose of this class is simply to enable code hinting and to allow for strict data typing.</li> * </ul> * * <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 XMLLoaderVars { /** @private **/ public static const version:Number = 1.22; /** @private **/ protected var _vars:Object; /** * Constructor * @param vars A generic Object containing properties that you'd like to add to this XMLLoaderVars instance. */ public function XMLLoaderVars(vars:Object=null) { _vars = {}; if (vars != null) { for (var p:String in vars) { _vars[p] = vars[p]; } } } /** @private **/ protected function _set(property:String, value:*):XMLLoaderVars { if (value == null) { delete _vars[property]; //in case it was previously set } else { _vars[property] = value; } return this; } /** * Adds a dynamic property to the vars object containing any value you want. This can be useful * in situations where you need to associate certain data with a particular loader. Just make sure * that the property name is a valid variable name (starts with a letter or underscore, no special characters, etc.) * and that it doesn't use a reserved property name like "name" or "onComplete", etc. * * For example, to set an "index" property to 5, do: * * <code>prop("index", 5);</code> * * @param property Property name * @param value Value */ public function prop(property:String, value:*):XMLLoaderVars { return _set(property, value); } //---- LOADERCORE PROPERTIES ----------------------------------------------------------------- /** When <code>autoDispose</code> is <code>true</code>, the loader will be disposed immediately after it completes (it calls the <code>dispose()</code> method internally after dispatching its <code>COMPLETE</code> event). This will remove any listeners that were defined in the vars object (like onComplete, onProgress, onError, onInit). Once a loader is disposed, it can no longer be found with <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> - it is essentially destroyed but its content is not unloaded (you must call <code>unload()</code> or <code>dispose(true)</code> to unload its content). The default <code>autoDispose</code> value is <code>false</code>.**/ public function autoDispose(value:Boolean):XMLLoaderVars { return _set("autoDispose", value); } /** A name that is used to identify the loader instance. This name can be fed to the <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> methods or traced at any time. Each loader's name should be unique. If you don't define one, a unique name will be created automatically, like "loader21". **/ public function name(value:String):XMLLoaderVars { return _set("name", value); } /** A handler function for <code>LoaderEvent.CANCEL</code> events which are dispatched when loading is aborted due to either a failure or because another loader was prioritized or <code>cancel()</code> was manually called. Make sure your onCancel function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onCancel(value:Function):XMLLoaderVars { return _set("onCancel", value); } /** A handler function for <code>LoaderEvent.COMPLETE</code> events which are dispatched when the loader has finished loading successfully. Make sure your onComplete function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onComplete(value:Function):XMLLoaderVars { return _set("onComplete", value); } /** A handler function for <code>LoaderEvent.ERROR</code> events which are dispatched whenever the loader experiences an error (typically an IO_ERROR or SECURITY_ERROR). An error doesn't necessarily mean the loader failed, however - to listen for when a loader fails, use the <code>onFail</code> special property. Make sure your onError function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onError(value:Function):XMLLoaderVars { return _set("onError", value); } /** A handler function for <code>LoaderEvent.FAIL</code> events which are dispatched whenever the loader fails and its <code>status</code> changes to <code>LoaderStatus.FAILED</code>. Make sure your onFail function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onFail(value:Function):XMLLoaderVars { return _set("onFail", value); } /** A handler function for <code>LoaderEvent.HTTP_STATUS</code> events. Make sure your onHTTPStatus function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). You can determine the httpStatus code using the LoaderEvent's <code>target.httpStatus</code> (LoaderItems keep track of their <code>httpStatus</code> when possible, although certain environments prevent Flash from getting httpStatus information).**/ public function onHTTPStatus(value:Function):XMLLoaderVars { return _set("onHTTPStatus", value); } /** A handler function for <code>LoaderEvent.IO_ERROR</code> events which will also call the onError handler, so you can use that as more of a catch-all whereas <code>onIOError</code> is specifically for LoaderEvent.IO_ERROR events. Make sure your onIOError function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onIOError(value:Function):XMLLoaderVars { return _set("onIOError", value); } /** A handler function for <code>LoaderEvent.OPEN</code> events which are dispatched when the loader begins loading. Make sure your onOpen function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>).**/ public function onOpen(value:Function):XMLLoaderVars { return _set("onOpen", value); } /** A handler function for <code>LoaderEvent.PROGRESS</code> events which are dispatched whenever the <code>bytesLoaded</code> changes. Make sure your onProgress function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). You can use the LoaderEvent's <code>target.progress</code> to get the loader's progress value or use its <code>target.bytesLoaded</code> and <code>target.bytesTotal</code>.**/ public function onProgress(value:Function):XMLLoaderVars { return _set("onProgress", value); } /** LoaderMax supports <i>subloading</i>, where an object can be factored into a parent's loading progress. If you want LoaderMax to require this loader as part of its parent SWFLoader's progress, you must set the <code>requireWithRoot</code> property to your swf's <code>root</code>. For example, <code>vars.requireWithRoot = this.root;</code>. **/ public function requireWithRoot(value:DisplayObject):XMLLoaderVars { return _set("requireWithRoot", value); } //---- LOADERITEM PROPERTIES ------------------------------------------------------------- /** If you define an <code>alternateURL</code>, the loader will initially try to load from its original <code>url</code> and if it fails, it will automatically (and permanently) change the loader's <code>url</code> to the <code>alternateURL</code> and try again. Think of it as a fallback or backup <code>url</code>. It is perfectly acceptable to use the same <code>alternateURL</code> for multiple loaders (maybe a default image for various ImageLoaders for example). **/ public function alternateURL(value:String):XMLLoaderVars { return _set("alternateURL", value); } /** Initially, the loader's <code>bytesTotal</code> is set to the <code>estimatedBytes</code> value (or <code>LoaderMax.defaultEstimatedBytes</code> if one isn't defined). Then, when the loader begins loading and it can accurately determine the bytesTotal, it will do so. Setting <code>estimatedBytes</code> is optional, but the more accurate the value, the more accurate your loaders' overall progress will be initially. If the loader is inserted into a LoaderMax instance (for queue management), its <code>auditSize</code> feature can attempt to automatically determine the <code>bytesTotal</code> at runtime (there is a slight performance penalty for this, however - see LoaderMax's documentation for details). **/ public function estimatedBytes(value:uint):XMLLoaderVars { return _set("estimatedBytes", value); } /** If <code>true</code>, a "gsCacheBusterID" parameter will be appended to the url with a random set of numbers to prevent caching (don't worry, this info is ignored when you <code>LoaderMax.getLoader()</code> or <code>LoaderMax.getContent()</code> by <code>url</code> or when you're running locally). **/ public function noCache(value:Boolean):XMLLoaderVars { return _set("noCache", value); } /** Normally, the URL will be parsed and any variables in the query string (like "?name=test&state=il&gender=m") will be placed into a URLVariables object which is added to the URLRequest. This avoids a few bugs in Flash, but if you need to keep the entire URL intact (no parsing into URLVariables), set <code>allowMalformedURL:true</code>. For example, if your URL has duplicate variables in the query string like <code>http://www.greensock.com/?c=S&c=SE&c=SW</code>, it is technically considered a malformed URL and a URLVariables object can't properly contain all the duplicates, so in this case you'd want to set <code>allowMalformedURL</code> to <code>true</code>. **/ public function allowMalformedURL(value:Boolean):XMLLoaderVars { return _set("allowMalformedURL", value); } //---- XMLLOADER PROPERTIES -------------------------------------------------------------- /** By default, the XMLLoader will automatically look for LoaderMax-related nodes like <code>&lt;LoaderMax&gt;, &lt;ImageLoader&gt;, &lt;SWFLoader&gt;, &lt;XMLLoader&gt;, &lt;MP3Loader&gt;, &lt;DataLoader&gt;</code>, and <code>&lt;XMLLoader&gt;</code> inside the XML when it inits. If it finds any that have a <code>load="true"</code> attribute, it will begin loading them and integrate their progress into the XMLLoader's overall progress. Its <code>COMPLETE</code> event won't fire until all of these loaders have completed as well. If you prefer NOT to integrate the dynamically-created loader instances into the XMLLoader's overall <code>progress</code>, set <code>integrateProgress</code> to <code>false</code>. **/ public function integrateProgress(value:Boolean):XMLLoaderVars { return _set("integrateProgress", value); } /** Maximum number of simultaneous connections that should be used while loading child loaders that were parsed from the XML and had their "load" attribute set to "true" (like &lt;ImageLoader url="1.jpg" load="true" /&gt;). A higher number will generally result in faster overall load times for the group. The default is 2. Sometimes there are limits imposed by the Flash Player itself or the browser or the user's system, but LoaderMax will do its best to honor the <code>maxConnections</code> you define. **/ public function maxConnections(value:uint):XMLLoaderVars { return _set("maxConnections", value); } /** A handler function for <code>LoaderEvent.CHILD_OPEN</code> events which are dispatched each time any nested LoaderMax-related loaders that were defined in the XML begins loading. Make sure your onChildOpen function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onChildOpen(value:Function):XMLLoaderVars { return _set("onChildOpen", value); } /** A handler function for <code>LoaderEvent.CHILD_PROGRESS</code> events which are dispatched each time any nested LoaderMax-related loaders that were defined in the XML dispatches a <code>PROGRESS</code> event. To listen for changes in the XMLLoader's overall progress, use the <code>onProgress</code> special property instead. You can use the LoaderEvent's <code>target.progress</code> to get the child loader's progress value or use its <code>target.bytesLoaded</code> and <code>target.bytesTotal</code>. The LoaderEvent's <code>currentTarget</code> refers to the XMLLoader, so you can check its overall progress with the LoaderEvent's <code>currentTarget.progress</code>. Make sure your onChildProgress function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onChildProgress(value:Function):XMLLoaderVars { return _set("onChildProgress", value); } /** A handler function for <code>LoaderEvent.CHILD_COMPLETE</code> events which are dispatched each time any nested LoaderMax-related loaders that were defined in the XML finishes loading successfully. Make sure your onChildComplete function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onChildComplete(value:Function):XMLLoaderVars { return _set("onChildComplete", value); } /** A handler function for <code>LoaderEvent.CHILD_CANCEL</code> events which are dispatched each time loading is aborted on any nested LoaderMax-related loaders that were defined in the XML due to either an error or because another loader was prioritized in the queue or because <code>cancel()</code> was manually called on the child loader. Make sure your onChildCancel function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onChildCancel(value:Function):XMLLoaderVars { return _set("onChildCancel", value); } /** A handler function for <code>LoaderEvent.CHILD_FAIL</code> events which are dispatched each time any nested LoaderMax-related loaders that were defined in the XML fails (and its <code>status</code> chances to <code>LoaderStatus.FAILED</code>). Make sure your onChildFail function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>). **/ public function onChildFail(value:Function):XMLLoaderVars { return _set("onChildFail", value); } /** A handler function for <code>LoaderEvent.INIT</code> events which are dispatched when the XML finishes loading and its contents are parsed (creating any dynamic XML-driven loader instances necessary). If any dynamic loaders are created and have a <code>load="true"</code> attribute, they will begin loading at this point and the XMLLoader's <code>COMPLETE</code> will not be dispatched until the loaders have completed as well. **/ public function onInit(value:Function):XMLLoaderVars { return _set("onInit", value); } /** A handler function for <code>XMLLoader.RAW_LOAD</code> events which are dispatched when the loader finishes loading the XML but has <b>NOT</b> parsed the XML yet. This can be useful in rare situations when you want to alter the XML before it is parsed by XMLLoader (for identifying LoaderMax-related nodes like <code>&lt;ImageLoader&gt;</code>, etc.). Make sure your onRawLoad function accepts a single parameter of type <code>LoaderEvent</code> (<code>com.greensock.events.LoaderEvent</code>) **/ public function onRawLoad(value:Function):XMLLoaderVars { return _set("onRawLoad", value); } /** A String that should be prepended to all parsed LoaderMax-related loader URLs (from nodes like &lt;ImageLoader&gt;, &lt;XMLLoader&gt;, etc.) as soon as the XML has been parsed. For example, if your XML has the following node: <code>&lt;ImageLoader url="1.jpg" /&gt;</code> and <code>prependURLs</code> is set to "../images/", then the ImageLoader's url will end up being "../images/1.jpg". <code>prependURLs</code> affects ALL parsed loaders in the XML. However, if you have an <code>&lt;XMLLoader&gt;</code> node inside your XML that also loads another XML doc and you'd like to recursively prepend all of the URLs in this loader's XML as well as the subloading one and all of its children, use <code>recursivePrependURLs</code> instead of <code>prependURLs</code>. **/ public function prependURLs(value:String):XMLLoaderVars { return _set("prependURLs", value); } /** A String that should be recursively prepended to all parsed LoaderMax-related loader URLs (from nodes like &lt;ImageLoader&gt;, &lt;XMLLoader&gt;, etc.). The functionality is identical to <code>prependURLs</code> except that it is recursive, affecting all parsed loaders in subloaded XMLLoaders (other XML files that this one loads too). For example, if your XML has the following node: <code>&lt;XMLLoader url="doc2.xml" /&gt;</code> and <code>recursivePrependURLs</code> is set to "../xml/", then the nested XMLLoader's URL will end up being "../xml/doc2.xml". Since it is recursive, parsed loaders inside doc2.xml <i>and</i> any other XML files that it loads will <i>all</i> have their URLs prepended. So if you load doc1.xml which loads doc2.xml which loads doc3.xml (due to <code>&lt;XMLLoader&gt;</code> nodes discovered in each XML file), <code>recursivePrependURLs</code> will affect all of the parsed LoaderMax-related URLs in all 3 documents. If you'd prefer to <i>only</i> have the URLs affected that are in the XML file that this XMLLoader is loading, use <code>prependURLs</code> instead of <code>recursivePrependURLs</code>. **/ public function recursivePrependURLs(value:String):XMLLoaderVars { return _set("recursivePrependURLs", value); } /** By default, XMLLoader will parse any LoaderMax-related loaders in the XML and load any that have their "load" attribute set to "true" and then if any fail to load, they will simply be skipped. But if you prefer to have the XMLLoader fail immediately if one of the parsed loaders fails to load, set <code>skipFailed</code> to <code>false</code> (it is <code>true</code> by default). **/ public function skipFailed(value:Boolean):XMLLoaderVars { return _set("skipFailed", value); } //---- GETTERS / SETTERS ----------------------------------------------------------------- /** The generic Object populated by all of the method calls in the XMLLoaderVars instance. This is the raw data that gets passed to the loader. **/ public function get vars():Object { return _vars; } /** @private **/ public function get isGSVars():Boolean { return true; } } }
package com.unhurdle { public class OMVType { public function OMVType() { } static public function getType(type:String):String{ if(type.indexOf("=any") >=0){ return "*"; } switch(type){ case "string": return "String"; case "bool": return "Boolean"; case "varies=any": case "Any": case "any": return "*"; case "number": return "Number"; case "object": return "Object"; default: return type; } } } }
package connection.req_member { import connection.APIConnectionBase; import flash.events.Event; public class GetIncentiveAPI extends APIConnectionBase { public function GetIncentiveAPI() { super(); _API_NAME = "インセンティブチェック"; _url = "api_req_member/get_incentive"; } override protected function _handleLoadComplete(param1:Event, param2:Object) : void { DataFacade.getIncentiveData().setData(param2); } } }
// 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 m = 1, c = 0; while (m < 5) { if(m > 2) { c++; } m++; } print(c);
//////////////////////////////////////////////////////////////////////////////// // // 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.mobile { import org.apache.royale.core.IBead; import org.apache.royale.core.IBeadController; import org.apache.royale.core.IToggleButtonModel; import org.apache.royale.core.UIBase; import org.apache.royale.core.ValuesManager; /** * The ToggleSwitch is a UI control that displays on/off or yes/no states. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 */ public class ToggleSwitch extends UIBase { /** * Constructor * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 */ public function ToggleSwitch() { super(); COMPILE::JS { setWidthAndHeight(40.0, 25.0, false); } } [Bindable("change")] /** * <code>true</code> if the switch is selected. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 */ public function get selected():Boolean { return IToggleButtonModel(model).selected; } /** * @private */ public function set selected(value:Boolean):void { IToggleButtonModel(model).selected = value; } private var _controller:IBeadController; /** * Get the controller for the view. * * @royaleignorecoercion Class * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.0 */ public function get controller():IBeadController { if (_controller == null) { _controller = getBeadByType(IBeadController) as IBeadController; if (_controller == null) { var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class; _controller = new c() as IBeadController; addBead(_controller); } } return _controller; } public function set controller(value:IBeadController):void { _controller = value; } } }
package br.com.caelum.stella.validation.ie { import br.com.caelum.stella.MessageProducer; import br.com.caelum.stella.validation.DigitoVerificadorInfo; import br.com.caelum.stella.validation.ValidadorDeDV; public class IERondoniaCasoUmValidator extends AbstractIEValidator { private static const MOD:int = 11; // TAMANHO = 9; private static const MISSING_LEFT_SIDE_ZEROS:String = '00000'; private static const DVX_POSITION:int = MISSING_LEFT_SIDE_ZEROS.length + 9; private static const DVX_MULTIPLIERS:Array = IEConstraints.P4; private static const rotinas:Array = [IERotinas.E, IERotinas.POS_IE]; private static const DVX_INFO:DigitoVerificadorInfo = new DigitoVerificadorInfo(1, rotinas, MOD, DVX_MULTIPLIERS, DVX_POSITION); private static const DVX_CHECKER:ValidadorDeDV = new ValidadorDeDV(DVX_INFO); public static const FORMATTED:RegExp = /^([1-9]\d{2})[.](\d{5})[-](\d{1})$/; public static const UNFORMATTED:RegExp = /^([1-9]\d{2})(\d{5})(\d{1})$/; public function IERondoniaCasoUmValidator(isFormatted:Boolean = true, messageProducer:MessageProducer = null) { super(isFormatted, messageProducer); } override protected function getUnformattedPattern():RegExp { return UNFORMATTED; } override protected function getFormattedPattern():RegExp { return FORMATTED; } override protected function hasValidCheckDigits(value:String):Boolean { var testedValue:String = MISSING_LEFT_SIDE_ZEROS + value; return DVX_CHECKER.isDVValid(testedValue); } } }
/* 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.controls.text { import feathers.controls.Scroller; import feathers.skins.IStyleProvider; import feathers.utils.geom.matrixToRotation; import feathers.utils.geom.matrixToScaleX; import feathers.utils.geom.matrixToScaleY; import feathers.utils.math.roundToNearest; import flash.events.Event; import flash.events.FocusEvent; import flash.geom.Matrix; import flash.geom.Point; import flash.geom.Rectangle; import flash.text.TextField; import starling.core.Starling; import starling.utils.MatrixUtil; import starling.utils.Pool; /** * A text editor view port for the <code>TextArea</code> component that uses * <code>flash.text.TextField</code>. * * @see feathers.controls.TextArea */ public class TextFieldTextEditorViewPort extends TextFieldTextEditor implements ITextEditorViewPort { /** * The default <code>IStyleProvider</code> for all <code>TextFieldTextEditorViewPort</code> * components. * * @default null * @see feathers.core.FeathersControl#styleProvider */ public static var globalStyleProvider:IStyleProvider; /** * Constructor. */ public function TextFieldTextEditorViewPort() { super(); this.multiline = true; this.wordWrap = true; this.resetScrollOnFocusOut = false; } /** * @private */ override protected function get defaultStyleProvider():IStyleProvider { return globalStyleProvider; } /** * @private */ private var _ignoreScrolling:Boolean = false; /** * @private */ private var _minVisibleWidth:Number = 0; /** * @private */ public function get minVisibleWidth():Number { return this._minVisibleWidth; } /** * @private */ public function set minVisibleWidth(value:Number):void { if(this._minVisibleWidth == value) { return; } if(value !== value) //isNaN { throw new ArgumentError("minVisibleWidth cannot be NaN"); } this._minVisibleWidth = value; this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ private var _maxVisibleWidth:Number = Number.POSITIVE_INFINITY; /** * @private */ public function get maxVisibleWidth():Number { return this._maxVisibleWidth; } /** * @private */ public function set maxVisibleWidth(value:Number):void { if(this._maxVisibleWidth == value) { return; } if(value !== value) //isNaN { throw new ArgumentError("maxVisibleWidth cannot be NaN"); } this._maxVisibleWidth = value; this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ private var _visibleWidth:Number = NaN; /** * @private */ public function get visibleWidth():Number { return this._visibleWidth; } /** * @private */ public function set visibleWidth(value:Number):void { if(this._visibleWidth == value || (value !== value && this._visibleWidth !== this._visibleWidth)) //isNaN { return; } this._visibleWidth = value; this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ private var _minVisibleHeight:Number = 0; /** * @private */ public function get minVisibleHeight():Number { return this._minVisibleHeight; } /** * @private */ public function set minVisibleHeight(value:Number):void { if(this._minVisibleHeight == value) { return; } if(value !== value) //isNaN { throw new ArgumentError("minVisibleHeight cannot be NaN"); } this._minVisibleHeight = value; this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ private var _maxVisibleHeight:Number = Number.POSITIVE_INFINITY; /** * @private */ public function get maxVisibleHeight():Number { return this._maxVisibleHeight; } /** * @private */ public function set maxVisibleHeight(value:Number):void { if(this._maxVisibleHeight == value) { return; } if(value !== value) //isNaN { throw new ArgumentError("maxVisibleHeight cannot be NaN"); } this._maxVisibleHeight = value; this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ private var _visibleHeight:Number = NaN; /** * @private */ public function get visibleHeight():Number { return this._visibleHeight; } /** * @private */ public function set visibleHeight(value:Number):void { if(this._visibleHeight == value || (value !== value && this._visibleHeight !== this._visibleHeight)) //isNaN { return; } this._visibleHeight = value; this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ public function get contentX():Number { return 0; } /** * @private */ public function get contentY():Number { return 0; } /** * @private */ protected var _scrollStep:int = 0; /** * @private */ public function get horizontalScrollStep():Number { return this._scrollStep; } /** * @private */ public function get verticalScrollStep():Number { return this._scrollStep; } /** * @private */ private var _horizontalScrollPosition:Number = 0; /** * @private */ public function get horizontalScrollPosition():Number { return this._horizontalScrollPosition; } /** * @private */ public function set horizontalScrollPosition(value:Number):void { //this value is basically ignored because the text does not scroll //horizontally. instead, it wraps. this._horizontalScrollPosition = value; } /** * @private */ private var _verticalScrollPosition:Number = 0; /** * @private */ public function get verticalScrollPosition():Number { return this._verticalScrollPosition; } /** * @private */ public function set verticalScrollPosition(value:Number):void { if(this._verticalScrollPosition == value) { return; } this._verticalScrollPosition = value; this.invalidate(INVALIDATION_FLAG_SCROLL); //hack because the superclass doesn't know about the scroll flag this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ public function get requiresMeasurementOnScroll():Boolean { return false; } /** * @private */ override public function get baseline():Number { return super.baseline + this._paddingTop + this._verticalScrollPosition; } /** * Quickly sets all padding properties to the same value. The * <code>padding</code> getter always returns the value of * <code>paddingTop</code>, but the other padding values may be * different. * * @default 0 * * @see #paddingTop * @see #paddingRight * @see #paddingBottom * @see #paddingLeft */ public function get padding():Number { return this._paddingTop; } /** * @private */ public function set padding(value:Number):void { this.paddingTop = value; this.paddingRight = value; this.paddingBottom = value; this.paddingLeft = value; } /** * @private */ protected var _paddingTop:Number = 0; /** * The minimum space, in pixels, between the view port's top edge and * the view port's content. * * @default 0 */ public function get paddingTop():Number { return this._paddingTop; } /** * @private */ public function set paddingTop(value:Number):void { if(this._paddingTop == value) { return; } this._paddingTop = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _paddingRight:Number = 0; /** * The minimum space, in pixels, between the view port's right edge and * the view port's content. * * @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.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _paddingBottom:Number = 0; /** * The minimum space, in pixels, between the view port's bottom edge and * the view port's content. * * @default 0 */ public function get paddingBottom():Number { return this._paddingBottom; } /** * @private */ public function set paddingBottom(value:Number):void { if(this._paddingBottom == value) { return; } this._paddingBottom = value; this.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ protected var _paddingLeft:Number = 0; /** * The minimum space, in pixels, between the view port's left edge and * the view port's content. * * @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.invalidate(INVALIDATION_FLAG_STYLES); } /** * @private */ override public function setFocus(position:Point = null):void { if(position !== null) { position.x -= this._paddingLeft; position.y -= this._paddingTop; } super.setFocus(position); } /** * @private */ override protected function measure(result:Point = null):Point { if(!result) { result = new Point(); } var needsWidth:Boolean = this._visibleWidth !== this._visibleWidth; //isNaN this.commitStylesAndData(this.measureTextField); var gutterDimensionsOffset:Number = 4; if(this._useGutter) { gutterDimensionsOffset = 0; } var newWidth:Number = this._visibleWidth; this.measureTextField.width = newWidth - this._paddingLeft - this._paddingRight + gutterDimensionsOffset; if(needsWidth) { newWidth = this.measureTextField.width + this._paddingLeft + this._paddingRight - gutterDimensionsOffset; if(newWidth < this._minVisibleWidth) { newWidth = this._minVisibleWidth; } else if(newWidth > this._maxVisibleWidth) { newWidth = this._maxVisibleWidth; } } var newHeight:Number = this.measureTextField.height + this._paddingTop + this._paddingBottom - gutterDimensionsOffset; if(this._useGutter) { newHeight += 4; } if(this._visibleHeight === this._visibleHeight) //!isNaN { if(newHeight < this._visibleHeight) { newHeight = this._visibleHeight; } } else if(newHeight < this._minVisibleHeight) { newHeight = this._minVisibleHeight; } result.x = newWidth; result.y = newHeight; return result; } /** * @private */ override protected function refreshSnapshotParameters():void { var textFieldWidth:Number = this._visibleWidth - this._paddingLeft - this._paddingRight; if(textFieldWidth !== textFieldWidth) //isNaN { if(this._maxVisibleWidth < Number.POSITIVE_INFINITY) { textFieldWidth = this._maxVisibleWidth - this._paddingLeft - this._paddingRight; } else { textFieldWidth = this._minVisibleWidth - this._paddingLeft - this._paddingRight; } } var textFieldHeight:Number = this._visibleHeight - this._paddingTop - this._paddingBottom; if(textFieldHeight !== textFieldHeight) //isNaN { if(this._maxVisibleHeight < Number.POSITIVE_INFINITY) { textFieldHeight = this._maxVisibleHeight - this._paddingTop - this._paddingBottom; } else { textFieldHeight = this._minVisibleHeight - this._paddingTop - this._paddingBottom; } } this._textFieldOffsetX = 0; this._textFieldOffsetY = 0; this._textFieldSnapshotClipRect.x = 0; this._textFieldSnapshotClipRect.y = 0; var starling:Starling = this.stage !== null ? this.stage.starling : Starling.current; var scaleFactor:Number = starling.contentScaleFactor; var clipWidth:Number = textFieldWidth * scaleFactor; if(this._updateSnapshotOnScaleChange) { var matrix:Matrix = Pool.getMatrix(); this.getTransformationMatrix(this.stage, matrix); clipWidth *= matrixToScaleX(matrix); } if(clipWidth < 0) { clipWidth = 0; } var clipHeight:Number = textFieldHeight * scaleFactor; if(this._updateSnapshotOnScaleChange) { clipHeight *= matrixToScaleY(matrix); Pool.putMatrix(matrix); } if(clipHeight < 0) { clipHeight = 0; } this._textFieldSnapshotClipRect.width = clipWidth; this._textFieldSnapshotClipRect.height = clipHeight; } /** * @private */ override protected function refreshTextFieldSize():void { var oldIgnoreScrolling:Boolean = this._ignoreScrolling; var gutterDimensionsOffset:Number = 4; if(this._useGutter) { gutterDimensionsOffset = 0; } this._ignoreScrolling = true; this.textField.width = this._visibleWidth - this._paddingLeft - this._paddingRight + gutterDimensionsOffset; var textFieldHeight:Number = this._visibleHeight - this._paddingTop - this._paddingBottom + gutterDimensionsOffset; if(this.textField.height != textFieldHeight) { this.textField.height = textFieldHeight; } var scroller:Scroller = Scroller(this.parent); this.textField.scrollV = Math.round(1 + ((this.textField.maxScrollV - 1) * (this._verticalScrollPosition / scroller.maxVerticalScrollPosition))); this._ignoreScrolling = oldIgnoreScrolling; } /** * @private */ override protected function commitStylesAndData(textField:TextField):void { super.commitStylesAndData(textField); if(textField == this.textField) { this._scrollStep = textField.getLineMetrics(0).height; } } /** * @private */ override protected function transformTextField():void { var starling:Starling = this.stage !== null ? this.stage.starling : Starling.current; var nativeScaleFactor:Number = 1; if(starling.supportHighResolutions) { nativeScaleFactor = starling.nativeStage.contentsScaleFactor; } var scaleFactor:Number = starling.contentScaleFactor / nativeScaleFactor; var matrix:Matrix = Pool.getMatrix(); var point:Point = Pool.getPoint(); this.getTransformationMatrix(this.stage, matrix); MatrixUtil.transformCoords(matrix, 0, 0, point); var scaleX:Number = matrixToScaleX(matrix) * scaleFactor; var scaleY:Number = matrixToScaleY(matrix) * scaleFactor; var offsetX:Number = Math.round(this._paddingLeft * scaleX); var offsetY:Number = Math.round((this._paddingTop + this._verticalScrollPosition) * scaleY); var starlingViewPort:Rectangle = starling.viewPort; var gutterPositionOffset:Number = 2; if(this._useGutter) { gutterPositionOffset = 0; } this.textField.x = offsetX + Math.round(starlingViewPort.x + (point.x * scaleFactor) - gutterPositionOffset * scaleX); this.textField.y = offsetY + Math.round(starlingViewPort.y + (point.y * scaleFactor) - gutterPositionOffset * scaleY); this.textField.rotation = matrixToRotation(matrix) * 180 / Math.PI; this.textField.scaleX = scaleX; this.textField.scaleY = scaleY; Pool.putPoint(point); Pool.putMatrix(matrix); } /** * @private */ override protected function positionSnapshot():void { if(!this.textSnapshot) { return; } var matrix:Matrix = Pool.getMatrix(); this.getTransformationMatrix(this.stage, matrix); this.textSnapshot.x = this._paddingLeft + Math.round(matrix.tx) - matrix.tx; this.textSnapshot.y = this._paddingTop + this._verticalScrollPosition + Math.round(matrix.ty) - matrix.ty; Pool.putMatrix(matrix); } /** * @private */ override protected function checkIfNewSnapshotIsNeeded():void { super.checkIfNewSnapshotIsNeeded(); this._needsNewTexture ||= this.isInvalid(INVALIDATION_FLAG_SCROLL); } /** * @private */ override protected function textField_focusInHandler(event:FocusEvent):void { this.textField.addEventListener(Event.SCROLL, textField_scrollHandler); super.textField_focusInHandler(event); this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ override protected function textField_focusOutHandler(event:FocusEvent):void { this.textField.removeEventListener(Event.SCROLL, textField_scrollHandler); super.textField_focusOutHandler(event); this.invalidate(INVALIDATION_FLAG_SIZE); } /** * @private */ protected function textField_scrollHandler(event:Event):void { //for some reason, the text field's scroll positions don't work //properly unless we access the values here. weird. var scrollH:Number = this.textField.scrollH; var scrollV:Number = this.textField.scrollV; if(this._ignoreScrolling) { return; } var scroller:Scroller = Scroller(this.parent); if(scroller.maxVerticalScrollPosition > 0 && this.textField.maxScrollV > 1) { var calculatedVerticalScrollPosition:Number = scroller.maxVerticalScrollPosition * (scrollV - 1) / (this.textField.maxScrollV - 1); scroller.verticalScrollPosition = roundToNearest(calculatedVerticalScrollPosition, this._scrollStep); } } } }
package laya.ui { import laya.display.css.Font; import laya.display.Text; import laya.events.Event; import laya.ui.Component; import laya.ui.UIUtils; /** * 文本内容发生改变后调度。 * @eventType laya.events.Event */ [Event(name = "change", type = "laya.events.Event")] /** * <p> <code>Label</code> 类用于创建显示对象以显示文本。</p> * * @example 以下示例代码,创建了一个 <code>Label</code> 实例。 * <listing version="3.0"> * package * { * import laya.ui.Label; * public class Label_Example * { * public function Label_Example() * { * Laya.init(640, 800);//设置游戏画布宽高、渲染模式。 * Laya.stage.bgColor = "#efefef";//设置画布的背景颜色。 * onInit(); * } * private function onInit():void * { * var label:Label = new Label();//创建一个 Label 类的实例对象 label 。 * label.font = "Arial";//设置 label 的字体。 * label.bold = true;//设置 label 显示为粗体。 * label.leading = 4;//设置 label 的行间距。 * label.wordWrap = true;//设置 label 自动换行。 * label.padding = "10,10,10,10";//设置 label 的边距。 * label.color = "#ff00ff";//设置 label 的颜色。 * label.text = "Hello everyone,我是一个可爱的文本!";//设置 label 的文本内容。 * label.x = 100;//设置 label 对象的属性 x 的值,用于控制 label 对象的显示位置。 * label.y = 100;//设置 label 对象的属性 y 的值,用于控制 label 对象的显示位置。 * label.width = 300;//设置 label 的宽度。 * label.height = 200;//设置 label 的高度。 * Laya.stage.addChild(label);//将 label 添加到显示列表。 * var passwordLabel:Label = new Label("请原谅我,我不想被人看到我心里话。");//创建一个 Label 类的实例对象 passwordLabel 。 * passwordLabel.asPassword = true;//设置 passwordLabel 的显示反式为密码显示。 * passwordLabel.x = 100;//设置 passwordLabel 对象的属性 x 的值,用于控制 passwordLabel 对象的显示位置。 * passwordLabel.y = 350;//设置 passwordLabel 对象的属性 y 的值,用于控制 passwordLabel 对象的显示位置。 * passwordLabel.width = 300;//设置 passwordLabel 的宽度。 * passwordLabel.color = "#000000";//设置 passwordLabel 的文本颜色。 * passwordLabel.bgColor = "#ccffff";//设置 passwordLabel 的背景颜色。 * passwordLabel.fontSize = 20;//设置 passwordLabel 的文本字体大小。 * Laya.stage.addChild(passwordLabel);//将 passwordLabel 添加到显示列表。 * } * } * } * </listing> * <listing version="3.0"> * Laya.init(640, 800);//设置游戏画布宽高 * Laya.stage.bgColor = "#efefef";//设置画布的背景颜色 * onInit(); * function onInit(){ * var label = new laya.ui.Label();//创建一个 Label 类的实例对象 label 。 * label.font = "Arial";//设置 label 的字体。 * label.bold = true;//设置 label 显示为粗体。 * label.leading = 4;//设置 label 的行间距。 * label.wordWrap = true;//设置 label 自动换行。 * label.padding = "10,10,10,10";//设置 label 的边距。 * label.color = "#ff00ff";//设置 label 的颜色。 * label.text = "Hello everyone,我是一个可爱的文本!";//设置 label 的文本内容。 * label.x = 100;//设置 label 对象的属性 x 的值,用于控制 label 对象的显示位置。 * label.y = 100;//设置 label 对象的属性 y 的值,用于控制 label 对象的显示位置。 * label.width = 300;//设置 label 的宽度。 * label.height = 200;//设置 label 的高度。 * Laya.stage.addChild(label);//将 label 添加到显示列表。 * var passwordLabel = new laya.ui.Label("请原谅我,我不想被人看到我心里话。");//创建一个 Label 类的实例对象 passwordLabel 。 * passwordLabel.asPassword = true;//设置 passwordLabel 的显示反式为密码显示。 * passwordLabel.x = 100;//设置 passwordLabel 对象的属性 x 的值,用于控制 passwordLabel 对象的显示位置。 * passwordLabel.y = 350;//设置 passwordLabel 对象的属性 y 的值,用于控制 passwordLabel 对象的显示位置。 * passwordLabel.width = 300;//设置 passwordLabel 的宽度。 * passwordLabel.color = "#000000";//设置 passwordLabel 的文本颜色。 * passwordLabel.bgColor = "#ccffff";//设置 passwordLabel 的背景颜色。 * passwordLabel.fontSize = 20;//设置 passwordLabel 的文本字体大小。 * Laya.stage.addChild(passwordLabel);//将 passwordLabel 添加到显示列表。 * } * </listing> * <listing version="3.0"> * import Label = laya.ui.Label; * class Label_Example { * constructor() { * Laya.init(640, 800);//设置游戏画布宽高。 * Laya.stage.bgColor = "#efefef";//设置画布的背景颜色。 * this.onInit(); * } * private onInit(): void { * var label: Label = new Label();//创建一个 Label 类的实例对象 label 。 * label.font = "Arial";//设置 label 的字体。 * label.bold = true;//设置 label 显示为粗体。 * label.leading = 4;//设置 label 的行间距。 * label.wordWrap = true;//设置 label 自动换行。 * label.padding = "10,10,10,10";//设置 label 的边距。 * label.color = "#ff00ff";//设置 label 的颜色。 * label.text = "Hello everyone,我是一个可爱的文本!";//设置 label 的文本内容。 * label.x = 100;//设置 label 对象的属性 x 的值,用于控制 label 对象的显示位置。 * label.y = 100;//设置 label 对象的属性 y 的值,用于控制 label 对象的显示位置。 * label.width = 300;//设置 label 的宽度。 * label.height = 200;//设置 label 的高度。 * Laya.stage.addChild(label);//将 label 添加到显示列表。 * var passwordLabel: Label = new Label("请原谅我,我不想被人看到我心里话。");//创建一个 Label 类的实例对象 passwordLabel 。 * passwordLabel.asPassword = true;//设置 passwordLabel 的显示反式为密码显示。 * passwordLabel.x = 100;//设置 passwordLabel 对象的属性 x 的值,用于控制 passwordLabel 对象的显示位置。 * passwordLabel.y = 350;//设置 passwordLabel 对象的属性 y 的值,用于控制 passwordLabel 对象的显示位置。 * passwordLabel.width = 300;//设置 passwordLabel 的宽度。 * passwordLabel.color = "#000000";//设置 passwordLabel 的文本颜色。 * passwordLabel.bgColor = "#ccffff";//设置 passwordLabel 的背景颜色。 * passwordLabel.fontSize = 20;//设置 passwordLabel 的文本字体大小。 * Laya.stage.addChild(passwordLabel);//将 passwordLabel 添加到显示列表。 * } * } * </listing> * @see laya.display.Text */ public class Label extends Component { /** * @private */ private static var _textReg:RegExp = new RegExp("\\\\n", "g"); /** * @private * 文本 <code>Text</code> 实例。 */ protected var _tf:Text; /** * 创建一个新的 <code>Label</code> 实例。 * @param text 文本内容字符串。 */ public function Label(text:String = "") { Font.defaultColor = Styles.labelColor; this.text = text; } /**@inheritDoc */ override public function destroy(destroyChild:Boolean = true):void { super.destroy(destroyChild); _tf = null; } /**@inheritDoc */ override protected function createChildren():void { addChild(_tf = new Text()); } /** * 当前文本内容字符串。 * @see laya.display.Text.text */ public function get text():String { return _tf.text; } public function set text(value:String):void { if (_tf.text != value) { if(value) value=(value+"").replace(_textReg,"\n"); _tf.text = value; event(Event.CHANGE); } } /**@copy laya.display.Text#changeText() **/ public function changeText(text:String):void { _tf.changeText(text); } /** * @copy laya.display.Text#wordWrap */ public function get wordWrap():Boolean { return _tf.wordWrap; } /** * @copy laya.display.Text#wordWrap */ public function set wordWrap(value:Boolean):void { _tf.wordWrap = value; } /** * @copy laya.display.Text#color */ public function get color():String { return _tf.color; } public function set color(value:String):void { _tf.color = value; } /** * @copy laya.display.Text#font */ public function get font():String { return _tf.font; } public function set font(value:String):void { _tf.font = value; } /** * @copy laya.display.Text#align */ public function get align():String { return _tf.align; } public function set align(value:String):void { _tf.align = value; } /** * @copy laya.display.Text#valign */ public function get valign():String { return _tf.valign; } public function set valign(value:String):void { _tf.valign = value; } /** * @copy laya.display.Text#bold */ public function get bold():Boolean { return _tf.bold; } public function set bold(value:Boolean):void { _tf.bold = value; } /** * @copy laya.display.Text#italic */ public function get italic():Boolean { return _tf.italic; } public function set italic(value:Boolean):void { _tf.italic = value; } /** * @copy laya.display.Text#leading */ public function get leading():Number { return _tf.leading; } public function set leading(value:Number):void { _tf.leading = value; } /** * @copy laya.display.Text#fontSize */ public function get fontSize():int { return _tf.fontSize; } public function set fontSize(value:int):void { _tf.fontSize = value; } /** * <p>边距信息</p> * <p>"上边距,右边距,下边距 , 左边距(边距以像素为单位)"</p> * @see laya.display.Text.padding */ public function get padding():String { return _tf.padding.join(","); } public function set padding(value:String):void { _tf.padding = UIUtils.fillArray(Styles.labelPadding, value, Number); } /** * @copy laya.display.Text#bgColor */ public function get bgColor():String { return _tf.bgColor } public function set bgColor(value:String):void { _tf.bgColor = value; } /** * @copy laya.display.Text#borderColor */ public function get borderColor():String { return _tf.borderColor } public function set borderColor(value:String):void { _tf.borderColor = value; } /** * @copy laya.display.Text#stroke */ public function get stroke():Number { return this._tf.stroke; } public function set stroke(value:Number):void { _tf.stroke = value; } /** * @copy laya.display.Text#strokeColor */ public function get strokeColor():String { return _tf.strokeColor; } public function set strokeColor(value:String):void { _tf.strokeColor = value; } /** * 文本控件实体 <code>Text</code> 实例。 */ public function get textField():Text { return _tf; } /** * @inheritDoc */ override protected function get measureWidth():Number { return _tf.width; } /** * @inheritDoc */ override protected function get measureHeight():Number { return _tf.height; } /** * @inheritDoc */ override public function get width():Number { if (_width || _tf.text) return super.width; return 0; } /** * @inheritDoc */ override public function set width(value:Number):void { super.width = value; _tf.width = value; } /** * @inheritDoc */ override public function get height():Number { if (_height || _tf.text) return super.height; return 0; } /** * @inheritDoc */ override public function set height(value:Number):void { super.height = value; _tf.height = value; } /**@inheritDoc */ override public function set dataSource(value:*):void { _dataSource = value; if (value is Number || value is String) text = value + ""; else super.dataSource = value; } /** * @copy laya.display.Text#overflow */ public function get overflow():String { return _tf.overflow; } /** * @copy laya.display.Text#overflow */ public function set overflow(value:String):void { _tf.overflow = value; } /** * @copy laya.display.Text#underline */ public function get underline():Boolean { return _tf.underline; } /** * @copy laya.display.Text#underline */ public function set underline(value:Boolean):void { _tf.underline = value; } /** * @copy laya.display.Text#underlineColor */ public function get underlineColor():String { return _tf.underlineColor; } /** * @copy laya.display.Text#underlineColor */ public function set underlineColor(value:String):void { _tf.underlineColor = value; } } }
package kabam.rotmg.ui.view { import com.company.assembleegameclient.objects.ImageFactory; import com.company.assembleegameclient.objects.Player; import com.company.assembleegameclient.parameters.Parameters; import com.company.assembleegameclient.ui.BoostPanelButton; import com.company.assembleegameclient.ui.ExperienceBoostTimerPopup; import com.company.assembleegameclient.ui.icons.IconButton; import com.company.assembleegameclient.ui.icons.IconButtonFactory; import flash.display.Bitmap; import flash.display.Sprite; import flash.events.MouseEvent; import io.decagames.rotmg.ui.defaults.DefaultLabelFormat; import io.decagames.rotmg.ui.labels.UILabel; import org.osflash.signals.Signal; import org.osflash.signals.natives.NativeSignal; public class CharacterDetailsView extends Sprite { public static const IMAGE_SET_NAME:String = "lofiInterfaceBig"; public var openExaltation:Signal; public var iconButtonFactory:IconButtonFactory; public var imageFactory:ImageFactory; public var friendsBtn:IconButton; private var portrait_:Bitmap; private var button:IconButton; private var nameText_:UILabel; private var exaltationClicked:NativeSignal; private var boostPanelButton:BoostPanelButton; private var expTimer:ExperienceBoostTimerPopup; private var indicator:Sprite; public function CharacterDetailsView() { openExaltation = new Signal(); portrait_ = new Bitmap(null); exaltationClicked = new NativeSignal(button,"click"); super(); } public function init(param1:String) : void { this.indicator = new Sprite(); this.indicator.graphics.beginFill(823807); this.indicator.graphics.drawCircle(0,0,4); this.indicator.graphics.endFill(); this.indicator.x = 13; this.indicator.y = -5; this.createPortrait(); this.createButton(); this.createNameText(param1); } public function addInvitationIndicator() : void { if(this.friendsBtn) { this.friendsBtn.addChild(this.indicator); } } public function clearInvitationIndicator() : void { if(this.indicator && this.indicator.parent) { this.indicator.parent.removeChild(this.indicator); } } public function initFriendList(param1:ImageFactory, param2:IconButtonFactory, param3:Function, param4:Boolean) : void { this.friendsBtn = param2.create(param1.getImageFromSet("lofiInterfaceBig",13),"","Social","",6); this.friendsBtn.x = 146; this.friendsBtn.y = 12; this.friendsBtn.addEventListener("click",param3); addChild(this.friendsBtn); if(param4) { this.addInvitationIndicator(); } } public function createNameText(param1:String) : void { this.nameText_ = new UILabel(); this.nameText_.x = 35; this.nameText_.y = 6; this.setName(param1); addChild(this.nameText_); } public function update(param1:Player) : void { this.portrait_.bitmapData = param1.getPortrait(); } public function draw(param1:Player) : void { if(this.expTimer) { this.expTimer.update(param1.xpTimer); } if(param1.tierBoost || int(param1.dropBoost)) { this.boostPanelButton = this.boostPanelButton || new BoostPanelButton(param1); if(this.portrait_) { this.portrait_.x = 13; } if(this.nameText_) { this.nameText_.x = 47; } this.boostPanelButton.x = 6; this.boostPanelButton.y = 5; addChild(this.boostPanelButton); } else if(this.boostPanelButton) { removeChild(this.boostPanelButton); this.boostPanelButton = null; this.portrait_.x = -2; this.nameText_.x = 36; } } public function setName(param1:String) : void { this.nameText_.text = Parameters.data.customName != ""?Parameters.data.customName:param1; DefaultLabelFormat.characterViewNameLabel(this.nameText_); } private function createButton() : void { this.button = this.iconButtonFactory.create(this.imageFactory.getImageFromSet("lofiInterfaceBig",5),"","Exaltation","",6); this.exaltationClicked = new NativeSignal(this.button,"click",MouseEvent); this.exaltationClicked.add(this.onExaltationClick); this.button.x = 172; this.button.y = 12; addChild(this.button); } private function createPortrait() : void { this.portrait_.x = -2; this.portrait_.y = -8; addChild(this.portrait_); } private function onExaltationClick(param1:MouseEvent) : void { this.openExaltation.dispatch(); } } }
package view.image { import flash.display.*; import flash.events.Event; import flash.events.MouseEvent; import mx.core.UIComponent; import org.papervision3d.events.FileLoadEvent; import org.papervision3d.objects.parsers.DAE; import org.libspark.thread.*; import view.IViewThread; /** * DAEファイルを使用したオブジェクトの基底クラス * */ public class BaseObject extends Sprite implements IMonitor, IViewThread { private var _monitor:Monitor; protected var _loaded:Boolean = false; protected var _object:DAE; protected var _container:UIComponent; protected var _depthAt:int; /** * コンストラクタ * */ public function BaseObject() { _monitor = new Monitor(); _object = new DAE(); //FileLoadEventでColladaの読み込みを監視 _object.addEventListener(FileLoadEvent.LOAD_COMPLETE, initObject); } // オブジェクトの初期化をする仮想関数 protected function initObject(event:FileLoadEvent):void { _loaded = true; } /** * オブジェクト本体 * */ public function get getObject():DAE { return _object; } // 特定フレームで停止させるイベントハンドラを返す関数 private function stopFunc(num:int):Function { var func:Function; func = function(e:Event):void { if (e.target.currentFrame == num) { e.target.stop(); e.target.removeEventListener(Event.ENTER_FRAME,func); } } return func; } // オブジェクトを特定のフレームで止める関数 protected function frameStop(object:DAE, num:int):void { object.addEventListener(Event.ENTER_FRAME,stopFunc(num)); } // ローディング状態を返す public function get loaded():Boolean { return _loaded; } // Monitorクラスの委譲用関数 public function wait(timeout:uint = 0):void { _monitor.wait(timeout); } public function notify():void { _monitor.notify(); } public function notifyAll():void { _monitor.notifyAll(); } public function leave(thread:Thread):void { _monitor.leave(thread); } // 表示用のスレッドを返す public function getShowThread(stage:DisplayObjectContainer, at:int = -1, type:String=""):Thread { _depthAt = at; return new ShowThread(this, stage); } // 非表示用のスレッドを返す public function getHideThread(type:String=""):Thread { return new HideThread(this); } public function get depthAt():int { return _depthAt; } public function init():void { } public function final():void { _object.removeEventListener(FileLoadEvent.LOAD_COMPLETE, initObject); } } } import flash.display.DisplayObjectContainer; import org.libspark.thread.Thread; import org.libspark.thread.utils.ParallelExecutor; import view.image.BaseObject; import view.BaseShowThread; import view.BaseHideThread; // 基本的なShowスレッド class ShowThread extends BaseShowThread { private var _bo:BaseObject; public function ShowThread(bo:BaseObject, stage:DisplayObjectContainer) { _bo = bo; super(bo, stage) } protected override function run():void { // ロードを待つ if (_bo.loaded == false) { _bo.wait(); } next(close); } } // 基本的なHideスレッド class HideThread extends BaseHideThread { public function HideThread(bo:BaseObject) { super(bo); } }
//////////////////////////////////////////////////////////////////////////////// // // 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.collections { import org.flexunit.asserts.*; public class ArrayCollection_AddRemoveNumbers_Tests { protected var _sut:ArrayCollection; [Before] public function setUp():void { _sut = new ArrayCollection(); } [After] public function tearDown():void { _sut = null; } [Test] public function empty():void { //then assertEquals(_sut.length, 0); } [Test] public function addNumbers():void { _sut.addItem(1); assertEquals("Length is not one", 1, _sut.length); assertEquals("First element not correct", 1, _sut[0]); _sut.addItem(2); assertEquals("Length is not two", 2, _sut.length); assertEquals("Second element not correct", 2, _sut[1]); } [Test] public function addDuplicate():void { addNumbers(); _sut.addItem(1); assertEquals("Length is not three", 3, _sut.length); assertEquals("First element not correct", 1, _sut[0]); assertEquals("Second element not correct", 2, _sut[1]); assertEquals("Second element not correct", 1, _sut[2]); } [Test] public function removeDuplicate():void { addNumbers(); _sut.addItem(1); _sut.removeItemAt(0); assertEquals("Length is not two", 2, _sut.length); assertEquals("First element not correct", 2, _sut[0]); assertEquals("Second element not correct", 1, _sut[1]); } [Test] public function removeAllNumbers():void { addNumbers(); _sut.removeAll(); assertEquals("Length is not zero", 0, _sut.length); } [Test] public function removeFirstNumbers():void { addNumbers(); _sut.removeItemAt(0); assertEquals("First element not correct", 2, _sut[0]); assertEquals("Length is not one", 1, _sut.length); _sut.removeItemAt(0); assertEquals("Length is not zero", 0, _sut.length); } [Test] public function removeLastNumbers():void { addNumbers(); _sut.removeItemAt(1); assertEquals("First element not correct", 1, _sut[0]); assertEquals("Length is not one", 1, _sut.length); _sut.removeItemAt(0); assertEquals("Length is not zero", 0, _sut.length); } [Test] public function removeItemByIndex():void { addNumbers(); _sut.removeItemAt(_sut.getItemIndex(1)); assertEquals("First element not correct", 2, _sut[0]); assertEquals("Length is not one", 1, _sut.length); _sut.removeItemAt(_sut.getItemIndex(2)); assertEquals("Length is not zero", 0, _sut.length); } [Test] public function outOfRange():void { addNumbers(); try { _sut.removeItemAt(-1); } catch (error:Error) { assertTrue("Error not range error", error is RangeError); } assertEquals("Length is not two", 2, _sut.length); try { _sut.removeItemAt(10); } catch (error:Error) { assertTrue("Error not range error", error is RangeError); } assertEquals("Length is not two", 2, _sut.length); } [Test] public function swapItemsTwoThenOne():void { addNumbers(); var item1:Number = _sut.getItemAt(0) as Number; var item2:Number = _sut.getItemAt(1) as Number; _sut.setItemAt(item2,0); _sut.setItemAt(item1,1); assertEquals("Length is not two", 2, _sut.length); assertEquals("First element not correct", 2, _sut[0]); assertEquals("Second element not correct", 1, _sut[1]); } [Test] public function swapItemsOneThenTwo():void { addNumbers(); var item1:Number = _sut.getItemAt(0) as Number; var item2:Number = _sut.getItemAt(1) as Number; _sut.setItemAt(item1,1); _sut.setItemAt(item2,0); assertEquals("Length is not two", 2, _sut.length); assertEquals("First element not correct", 2, _sut[0]); assertEquals("Second element not correct", 1, _sut[1]); } } }
/* Copyright (c) 2007 Danny Chapman http://www.rowlhouse.co.uk 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. */ /** * @author Muzer(muzerly@gmail.com) * @link http://code.google.com/p/jiglibflash */ package jiglib.physics { import jiglib.math.JNumber3D; public class BodyPair { public var body0:RigidBody; public var body1:RigidBody; public var r:JNumber3D; public function BodyPair(_body0:RigidBody, _body1:RigidBody, r0:JNumber3D, r1:JNumber3D) { if (_body0.id > _body1.id) { this.body0 = _body0; this.body1 = _body1; this.r = r0; } else { this.body0 = _body1; this.body1 = _body0; this.r = r1; } } } }
package aerys.minko.render.shader.compiler.graph.visitors { import aerys.minko.render.shader.compiler.graph.nodes.AbstractNode; import aerys.minko.render.shader.compiler.graph.nodes.leaf.Attribute; import aerys.minko.render.shader.compiler.graph.nodes.leaf.BindableConstant; import aerys.minko.render.shader.compiler.graph.nodes.leaf.BindableSampler; import aerys.minko.render.shader.compiler.graph.nodes.leaf.Constant; import aerys.minko.render.shader.compiler.graph.nodes.leaf.Sampler; import aerys.minko.render.shader.compiler.graph.nodes.vertex.Extract; import aerys.minko.render.shader.compiler.graph.nodes.vertex.Instruction; import aerys.minko.render.shader.compiler.graph.nodes.vertex.Interpolate; import aerys.minko.render.shader.compiler.graph.nodes.vertex.Overwriter; import aerys.minko.render.shader.compiler.graph.nodes.vertex.VariadicExtract; /** * @private * @author Romain Gilliotte * */ public class CopyInserterVisitor extends AbstractVisitor { public function CopyInserterVisitor() { } override protected function visitTraversable(node:AbstractNode, isVertexShader:Boolean):void { visitArguments(node, true); if (node is Instruction) { var instruction : Instruction = Instruction(node); if (isConstant(instruction.argument1) && (instruction.isSingle || isConstant(instruction.argument2))) instruction.argument1 = new Instruction(Instruction.MOV, instruction.argument1); } } override protected function visitNonTraversable(node:AbstractNode, isVertexShader:Boolean):void { } private function isConstant(node : AbstractNode) : Boolean { return node is Constant || node is BindableConstant || node is VariadicExtract; } } }
package com.ankamagames.dofus.network.messages.game.context.fight.arena { import com.ankamagames.dofus.network.types.game.character.CharacterBasicMinimalInformations; import com.ankamagames.jerakine.network.CustomDataWrapper; import com.ankamagames.jerakine.network.ICustomDataInput; import com.ankamagames.jerakine.network.ICustomDataOutput; import com.ankamagames.jerakine.network.INetworkMessage; import com.ankamagames.jerakine.network.NetworkMessage; import com.ankamagames.jerakine.network.utils.FuncTree; import flash.utils.ByteArray; public class ArenaFighterLeaveMessage extends NetworkMessage implements INetworkMessage { public static const protocolId:uint = 1880; private var _isInitialized:Boolean = false; public var leaver:CharacterBasicMinimalInformations; private var _leavertree:FuncTree; public function ArenaFighterLeaveMessage() { this.leaver = new CharacterBasicMinimalInformations(); super(); } override public function get isInitialized() : Boolean { return this._isInitialized; } override public function getMessageId() : uint { return 1880; } public function initArenaFighterLeaveMessage(leaver:CharacterBasicMinimalInformations = null) : ArenaFighterLeaveMessage { this.leaver = leaver; this._isInitialized = true; return this; } override public function reset() : void { this.leaver = new CharacterBasicMinimalInformations(); this._isInitialized = false; } override public function pack(output:ICustomDataOutput) : void { var data:ByteArray = new ByteArray(); this.serialize(new CustomDataWrapper(data)); writePacket(output,this.getMessageId(),data); } override public function unpack(input:ICustomDataInput, length:uint) : void { this.deserialize(input); } override public function unpackAsync(input:ICustomDataInput, length:uint) : FuncTree { var tree:FuncTree = new FuncTree(); tree.setRoot(input); this.deserializeAsync(tree); return tree; } public function serialize(output:ICustomDataOutput) : void { this.serializeAs_ArenaFighterLeaveMessage(output); } public function serializeAs_ArenaFighterLeaveMessage(output:ICustomDataOutput) : void { this.leaver.serializeAs_CharacterBasicMinimalInformations(output); } public function deserialize(input:ICustomDataInput) : void { this.deserializeAs_ArenaFighterLeaveMessage(input); } public function deserializeAs_ArenaFighterLeaveMessage(input:ICustomDataInput) : void { this.leaver = new CharacterBasicMinimalInformations(); this.leaver.deserialize(input); } public function deserializeAsync(tree:FuncTree) : void { this.deserializeAsyncAs_ArenaFighterLeaveMessage(tree); } public function deserializeAsyncAs_ArenaFighterLeaveMessage(tree:FuncTree) : void { this._leavertree = tree.addChild(this._leavertreeFunc); } private function _leavertreeFunc(input:ICustomDataInput) : void { this.leaver = new CharacterBasicMinimalInformations(); this.leaver.deserializeAsync(this._leavertree); } } }
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is [Open Source Virtual Machine.]. * * The Initial Developer of the Original Code is * Adobe System Incorporated. * Portions created by the Initial Developer are Copyright (C) 2005-2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adobe AS3 Team * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var CODE = 1088; // The markup in the document following the root element must be well-formed. //----------------------------------------------------------- startTest(); //----------------------------------------------------------- try { var result = "no error"; var x = <a b="b" c="c"/>; var y = x.attributes(); var z = new XML(y); } catch (err) { result = err.toString(); } finally { AddTestCase("Runtime Error", TYPEERROR + CODE, typeError(result)); } //----------------------------------------------------------- test(); //-----------------------------------------------------------
/** * MyClient2地图编辑器 - Copyright (c) 2010 王明凡 */ package com.vo.common { import flash.net.FileFilter; /** * 浏览目录 * @author 王明凡 */ public class BrowseVO { //原始路径 public var path:String; //浏览类型(1.文件,2.目录) public var browseType:String; //浏览文件类型 new FileFilter(".swf", "*.swf"); public var fFilter:FileFilter; } }
/* 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.controls.supportClasses { import feathers.core.IFeathersControl; [ExcludeClass] public interface IViewPort extends IFeathersControl { function get visibleWidth():Number; function set visibleWidth(value:Number):void; function get minVisibleWidth():Number; function set minVisibleWidth(value:Number):void; function get maxVisibleWidth():Number; function set maxVisibleWidth(value:Number):void; function get visibleHeight():Number; function set visibleHeight(value:Number):void; function get minVisibleHeight():Number; function set minVisibleHeight(value:Number):void; function get maxVisibleHeight():Number; function set maxVisibleHeight(value:Number):void; function get contentX():Number; function get contentY():Number; function get horizontalScrollPosition():Number; function set horizontalScrollPosition(value:Number):void; function get verticalScrollPosition():Number; function set verticalScrollPosition(value:Number):void; function get horizontalScrollStep():Number; function get verticalScrollStep():Number; function get requiresMeasurementOnScroll():Boolean; /** * 目前使用mask之后一些在不可见位置的元素依然在绘制,添加一个方法用来避免绘制不可见元素 */ function refreshMask():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 spark.utils { import mx.core.DPIClassification; /** * This class provides a list of bitmaps for various runtime densities. It is supplied * as the source to BitmapImage or Image and as the icon of a Button. The components * will use the Application.runtimeDPI to choose which image to display. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Flex 4.5 */ public class MultiDPIBitmapSource { include "../core/Version.as"; /** * The source to use if the <code>Application.runtimeDPI</code> * is <code>DPIClassification.DPI_160</code>. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Flex 4.5 */ public var source160dpi:Object; /** * The source to use if the <code>Application.runtimeDPI</code> * is <code>DPIClassification.DPI_240</code>. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Flex 4.5 */ public var source240dpi:Object; /** * The source to use if the <code>Application.runtimeDPI</code> * is <code>DPIClassification.DPI_320</code>. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Flex 4.5 */ public var source320dpi:Object; /** * Select one of the sourceXXXdpi properties based on the given DPI. This * function handles the fallback to different sourceXXXdpi properties * if the given one is null. * The strategy is to try to choose the next highest * property if it is not null, then return a lower property if not null, then * just return null. * * @param The desired DPI. * * @return One of the sourceXXXdpi properties based on the desired DPI. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Flex 4.5 */ public function getSource(desiredDPI:Number):Object { var source:Object = source160dpi; switch (desiredDPI) { case DPIClassification.DPI_160: source = source160dpi; if (!source || source == "") source = source240dpi; if (!source || source == "") source = source320dpi; break; case DPIClassification.DPI_240: source = source240dpi; if (!source || source == "") source = source320dpi; if (!source || source == "") source = source160dpi; break; case DPIClassification.DPI_320: source = source320dpi; if (!source || source == "") source = source240dpi; if (!source || source == "") source = source160dpi; break; } return source; } } }
/* * ______ _____ _______ * .-----..--.--..----..-----.| __ \ \| ___| * | _ || | || _|| -__|| __/ -- | ___| * | __||_____||__| |_____||___| |_____/|___| * |__| * $Id: PdfStream.as 242 2010-02-01 14:30:41Z alessandro.crugnola $ * $Author Alessandro Crugnola $ * $Rev: 242 $ $LastChangedDate: 2010-02-01 15:30:41 +0100 (Mon, 01 Feb 2010) $ * $URL: https://purepdf.googlecode.com/svn/trunk/src/org/purepdf/pdf/PdfStream.as $ * * The contents of this file are subject to LGPL license * (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the * provisions of LGPL are applicable instead of those above. If you wish to * allow use of your version of this file only under the terms of the LGPL * License and not to allow others to use your version of this file under * the MPL, indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the LGPL. * If you do not delete the provisions above, a recipient may use your version * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. * * The Original Code is 'iText, a free JAVA-PDF library' ( version 4.2 ) by Bruno Lowagie. * All the Actionscript ported code and all the modifications to the * original java library are written by Alessandro Crugnola (alessandro@sephiroth.it) * * This library is free software; you can redistribute it and/or modify it * under the terms of the MPL as stated above or under the terms of the GNU * Library General Public License as published by the Free Software Foundation; * either version 2 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU LIBRARY GENERAL PUBLIC LICENSE for more * details * * If you didn't download this code from the following link, you should check if * you aren't using an obsolete version: * http://code.google.com/p/purepdf * */ package org.purepdf.pdf.codec { import org.purepdf.utils.Bytes; public class TIFFLZWDecoder { public function TIFFLZWDecoder( w: int, predictor: int, samplesPerPixel: int) { } public function decode( data: Bytes, uncompData: Bytes, h: int ): Bytes { return null; } } }
package flash.net { /** * @externs */ public function navigateToURL (request:URLRequest, window:String = null):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 spark.components { import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.events.Event; import flash.events.EventDispatcher; import mx.core.FlexGlobals; import mx.core.IFlexDisplayObject; import mx.core.IMXMLObject; import mx.core.IVisualElement; import mx.core.IVisualElementContainer; import mx.core.UIComponent; import mx.core.mx_internal; import mx.events.FlexEvent; import mx.events.ItemClickEvent; import mx.utils.NameUtil; use namespace mx_internal; //-------------------------------------- // Events //-------------------------------------- /** * Dispatched when the value of the selected RadioButton component in * this group changes. * * @eventType flash.events.Event.CHANGE * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ [Event(name="change", type="flash.events.Event")] /** * Dispatched when a user selects a RadioButton component in the group. * You can also set a handler for individual RadioButton components. * * This event is dispatched only when the * user interacts with the radio buttons by using the mouse. * * @eventType mx.events.ItemClickEvent.ITEM_CLICK * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ [Event(name="itemClick", type="mx.events.ItemClickEvent")] //-------------------------------------- // Validation events //-------------------------------------- /** * Dispatched when values are changed programmatically * or by user interaction. * * <p>Because a programmatic change triggers this event, make sure * that any <code>valueCommit</code> event handler does not change * a value that causes another <code>valueCommit</code> event. * For example, do not change the<code>selectedValue</code> * property or <code>selection</code> property in a <code>valueCommit</code> * event handler. </p> * * @eventType mx.events.FlexEvent.VALUE_COMMIT * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ [Event(name="valueCommit", type="mx.events.FlexEvent")] //-------------------------------------- // Other metadata //-------------------------------------- [IconFile("RadioButtonGroup.png")] [DefaultTriggerEvent("change")] /** * The RadioButtonGroup component defines a group of RadioButton components * that act as a single mutually exclusive component; therefore, * a user can select only one RadioButton component at a time. * The <code>id</code> property is required when you use the * <code>&lt;s:RadioButtonGroup&gt;</code> tag to define the group name. Any * <code>&lt;s:RadioButton&gt;</code> component added to this group will * have this group name. * * <p>Notice that the RadioButtonGroup component is a subclass of EventDispatcher, * not UIComponent, and implements the IMXMLObject interface. * All other Flex visual components implement the IVisualElement interface. * The RadioButtonGroup component declaration must * be contained within the <code>&lt;Declarations&gt;</code> tag since it is * not assignable to IVisualElement.</p> * * <p>To use this component in a list-based component, such as a List or DataGrid, * create an item renderer. * For information about creating an item renderer, see * <a href="http://help.adobe.com/en_US/flex/using/WS4bebcd66a74275c3-fc6548e124e49b51c4-8000.html"> * Custom Spark item renderers</a>. </p> * * @mxml * * <p>The <code>&lt;s:RadioButtonGroup&gt;</code> tag inherits all of the * tag attributes of its superclass, and adds the following tag attributes:</p> * * <pre> * &lt;s:RadioButtonGroup * <strong>Properties</strong> * enabled="true" * selectedValue="null" * selection="null" * * <strong>Events</strong> * change="<i>No default</i>" * itemClick="<i>No default</i>" * valueCommit="<i>No default</i>" * /&gt; * </pre> * * @see spark.components.RadioButton * @includeExample examples/RadioButtonGroupExample.mxml * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public class RadioButtonGroup extends EventDispatcher implements IMXMLObject { include "../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @param document In simple cases where a class extends EventDispatcher, * the <code>document</code> parameter should not be used. * * @see flash.events.EventDispatcher * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function RadioButtonGroup(document:IFlexDisplayObject = null) { super(); } //-------------------------------------------------------------------------- // // Variables // //-------------------------------------------------------------------------- /** * @private * Since there is no id, generate one, if needed. */ private var _name:String; /** * @private * The document containing a reference to this RadioButtonGroup. */ private var document:IFlexDisplayObject; /** * @private * An Array of the RadioButtons that belong to this group. */ private var radioButtons:Array /* of RadioButton */ = []; /** * @private * Whether the group is enabled. This can be different than the individual * radio buttons in the group. */ private var _enabled:Boolean = true; //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // enabled //---------------------------------- [Inspectable(category="General", defaultValue="true")] /** * Determines whether selection is allowed. Note that the value returned * only reflects the value that was explicitly set on the * <code>RadioButtonGroup</code> and does not reflect any values explicitly * set on the individual RadioButtons. * * @default true * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function get enabled():Boolean { return _enabled; } /** * @private */ public function set enabled(value:Boolean):void { if (_enabled == value) return; _enabled = value; // The group state changed. Invalidate all the radio buttons. The // radio button skin most likely will change. for (var i:int = 0; i < numRadioButtons; i++) getRadioButtonAt(i).invalidateSkinState(); } //---------------------------------- // numRadioButtons //---------------------------------- [Bindable("numRadioButtonsChanged")] /** * The number of RadioButtons that belong to this RadioButtonGroup. * * @default "0" * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function get numRadioButtons():int { return radioButtons.length; } //---------------------------------- // selectedValue //---------------------------------- /** * @private * Storage for the selectedValue property. */ private var _selectedValue:Object; [Bindable("change")] [Bindable("valueCommit")] [Inspectable(category="General")] /** * The <code>value</code> property of the selected * RadioButton component in the group, if it has been set, * otherwise, the <code>label</code> property of the selected RadioButton. * If no RadioButton is selected, this property is <code>null</code>. * * <p>If you set <code>selectedValue</code>, Flex selects the * first RadioButton component whose <code>value</code> or * <code>label</code> property matches this value.</p> * * @default null * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function get selectedValue():Object { if (selection) { return selection.value != null ? selection.value : selection.label; } return null; } /** * @private. */ public function set selectedValue(value:Object):void { // The rbg might set the selectedValue before the radio buttons are // initialized and inserted in the group. This will hold the selected // value until it can be put in the group. _selectedValue = value; // Clear the exisiting selecton if there is one. if (value == null) { setSelection(null, false); return; } // Find the radio button value specified. var n:int = numRadioButtons; for (var i:int = 0; i < n; i++) { var radioButton:RadioButton = getRadioButtonAt(i); if (radioButton.value == value || radioButton.label == value) { changeSelection(i, false); _selectedValue = null; dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); break; } } } //---------------------------------- // selection //---------------------------------- /** * @private * Reference to the selected radio button. */ private var _selection:RadioButton; [Bindable("change")] [Bindable("valueCommit")] [Inspectable(category="General")] /** * Contains a reference to the currently selected * RadioButton component in the group. * You can access this property in ActionScript only; * it is not settable in MXML. * Setting this property to <code>null</code> deselects the currently * selected RadioButton component. A change event is not dispatched. * * @default null * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function get selection():RadioButton { return _selection; } /** * @private */ public function set selection(value:RadioButton):void { if ( _selection == value) return; // Going through the selection setter should never fire a change event. setSelection(value, false); } //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * Implementation of the <code>IMXMLObject.initialized()</code> method * to support deferred instantiation. * * @param document The MXML document that created this object. * * @param id The identifier used by document to refer to this object. * If the object is a deep property on document, <code>id</code> is null. * * @see mx.core.IMXMLObject * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function initialized(document:Object, id:String):void { _name = id; this.document = document ? IFlexDisplayObject(document) : IFlexDisplayObject(FlexGlobals.topLevelApplication); } /** * Returns the RadioButton component at the specified index. * * @param index The 0-based index of the RadioButton in the * RadioButtonGroup. * * @return The specified RadioButton component if index is between * 0 and <code>numRadioButtons</code> - 1. Returns * <code>null</code> if the index is invalid. * * @see numRadioButtons * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function getRadioButtonAt(index:int):RadioButton { if (index >= 0 && index < numRadioButtons) return radioButtons[index]; return null; } /** * @private * String to uniquely identify this radio button group. */ mx_internal function get name():String { if (_name == null) _name = NameUtil.createUniqueName(this); return _name; } /** * @private * Add a radio button to the group. This can be called by * RadioButton or via the addedHandler when applying a state. */ mx_internal function addInstance(instance:RadioButton):void { // During a state transition, called when rb is removed from // display list. instance.addEventListener(Event.REMOVED, radioButton_removedHandler); radioButtons.push(instance); // Apply group indices in "breadth-first" order. radioButtons.sort(breadthOrderCompare); for (var i:int = 0; i < radioButtons.length; i++) radioButtons[i].indexNumber = i; // There is a pending selectedValue. See if we can set it now. if (_selectedValue != null) selectedValue = _selectedValue; // If this radio button is selected, then it becomes the selection // for the group. if (instance.selected == true) selection = instance; instance.radioButtonGroup = this; instance.invalidateSkinState(); dispatchEvent(new Event("numRadioButtonsChanged")); } /** * @private * Remove a radio button from the group. This can be called by * RadioButton or via the removedHandler when removing a state. */ private function removeInstance(instance:RadioButton):void { if (instance) { var foundInstance:Boolean = false; for (var i:int = 0; i < numRadioButtons; i++) { var rb:RadioButton = getRadioButtonAt(i); if (foundInstance) { // Decrement the indexNumber for each button after the removed button. rb.indexNumber = rb.indexNumber - 1; } else if (rb == instance) { // During a state transition, called when rb is added back // to display list. instance.addEventListener(Event.ADDED, radioButton_addedHandler); // Don't set the group to null. If this is being removed // because the state changed, the group will be needed // if the radio button is readded later because of another // state transition. //rb.group = null; // If the rb is selected, leave the button itself selected // but clear the selection for the group. if (instance == _selection) _selection = null; instance.radioButtonGroup = null; instance.invalidateSkinState(); // Remove the radio button from the internal array. radioButtons.splice(i,1); foundInstance = true; // redo the same index because we removed the previous item at this index i--; } } if (foundInstance) dispatchEvent(new Event("numRadioButtonsChanged")); } } /** * @private */ mx_internal function setSelection(value:RadioButton, fireChange:Boolean = true):void { if (_selection == value) return; if (value == null) { if (selection != null) { _selection.selected = false; _selection = null; if (fireChange) dispatchEvent(new Event(Event.CHANGE)); } } else { var n:int = numRadioButtons; for (var i:int = 0; i < n; i++) { if (value == getRadioButtonAt(i)) { changeSelection(i, fireChange); break; } } } dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); } /** * @private */ private function changeSelection(index:int, fireChange:Boolean = true):void { var rb:RadioButton = getRadioButtonAt(index); if (rb && rb != _selection) { // Unselect the currently selected radio if (_selection) _selection.selected = false; // Change the focus to the new radio. // Set the state of the new radio to true. // Fire a click event for the new radio. // Fire a click event for the radio group. _selection = rb; _selection.selected = true; if (fireChange) dispatchEvent(new Event(Event.CHANGE)); } } /** * @private * Sandbox root of RadioButton "a" in breadthOrderCompare(). */ private var aSbRoot:DisplayObject; /** * @private * Sandbox root of RadioButton "b" in breadthOrderCompare(). */ private var bSbRoot:DisplayObject; /** * @private * Returns -1 if a is before b in sort order, 0 if a and b have same * sort order and 1 if a after b in sort order. */ private function breadthOrderCompare(a:DisplayObject, b:DisplayObject):Number { var aParent:DisplayObjectContainer = a.parent; var bParent:DisplayObjectContainer = b.parent; if (!aParent || !bParent) return 0; // Only set when a is the radio button. The sandbox root should be the // same for the parents. if (a is RadioButton) aSbRoot = RadioButton(a).systemManager.getSandboxRoot(); // Only set when b is the radio button. The sandbox root should be the // same for the parents. if (b is RadioButton) bSbRoot = RadioButton(b).systemManager.getSandboxRoot(); // If reached the sandbox root of either then done. if (aParent == aSbRoot || bParent == bSbRoot) return 0; var aNestLevel:int = (a is UIComponent) ? UIComponent(a).nestLevel : -1; var bNestLevel:int = (b is UIComponent) ? UIComponent(b).nestLevel : -1; var aIndex:int = 0; var bIndex:int = 0; if (aParent == bParent) { if (aParent is IVisualElementContainer && a is IVisualElement) aIndex = IVisualElementContainer(aParent).getElementIndex(IVisualElement(a)); else aIndex = DisplayObjectContainer(aParent).getChildIndex(a); if (bParent is IVisualElementContainer && b is IVisualElement) bIndex = IVisualElementContainer(bParent).getElementIndex(IVisualElement(b)); else bIndex = DisplayObjectContainer(bParent).getChildIndex(b); } if (aNestLevel > bNestLevel || aIndex > bIndex) return 1; else if (aNestLevel < bNestLevel || bIndex > aIndex) return -1; else if (a == b) return 0; else // Nest levels are identical, compare ancestors. return breadthOrderCompare(aParent, bParent); } //-------------------------------------------------------------------------- // // Event Handlers // //-------------------------------------------------------------------------- /** * @private * Called during a state transition when rb is added back to display list. */ private function radioButton_addedHandler(event:Event):void { var rb:RadioButton = event.target as RadioButton; if (rb) { //trace("radioButton_addedHandler", rb.id); rb.removeEventListener(Event.ADDED, radioButton_addedHandler); addInstance(rb); } } /** * @private */ private function radioButton_removedHandler(event:Event):void { var rb:RadioButton = event.target as RadioButton; if (rb) { //trace("radioButton_removedHandler", rb.id); rb.removeEventListener(Event.REMOVED, radioButton_removedHandler); removeInstance(rb); } } } }
package org.mock4as { public class Mock { public function Mock(){ } // hash table of methodName -> MethodInvocation obj private var actualMethodInvocations:Object = new Object(); private var methodInvoked:Array = new Array(); private var methodExpected:Array = new Array(); // hash table of methodName -> MethodInvocation obj private var expectedMethodInvocations:Object = new Object(); private var _ignoreMissingExpectations:Boolean = false; private var methodInProgress:String; private var testFailed:Boolean = false; private var reason:String; public function expects(methodName:String):Mock { this.methodInProgress = methodName; this.methodExpected.push(methodName); this.expectedMethodInvocations[methodName] = new MethodInvocation(methodName); return this; } public function clear():void { this.actualMethodInvocations = new Object(); this.methodInvoked = new Array(); this.methodExpected = new Array(); this.expectedMethodInvocations = new Object(); } public function times(timesInvoked:int):Mock { expectedMethodInvocationFor(methodInProgress).timesInvoked = timesInvoked; return this; } private function expectedMethodInvocationFor(methodName:String):MethodInvocation { return this.expectedMethodInvocations[methodName]; } private function actualMethodInvocationFor(methodName:String):MethodInvocation { return this.actualMethodInvocations[methodName]; } public function noArgs():Mock { return this; } public function withArgs(...args):Mock { expectedMethodInvocationFor(methodInProgress).args = args; return this; } public function withArg(arg:Object):Mock { expectedMethodInvocationFor(methodInProgress).args[0] = arg; return this; } public function willReturn(returnValue:Object):void { expectedMethodInvocationFor(methodInProgress).returnValue = returnValue; } public function noReturn():void { } private function returnValueFor(methodName:String):Object { if(expectedMethodInvocationFor(methodName)!=null){ return expectedMethodInvocationFor(methodName).returnValue; } return "No Return Defined for " + methodName; } private function verifyMethodIsExpected(methodName:String):void { if (!this.methodIsExpected(methodName)){ reason = "Unexpected method call - " + methodName + "(...)"; testFailed = true; } } private function verifyMethodHasBeenInvoked(methodName:String):void { if (!this.methodHasBeenInvoked(methodName) && this.expectedMethodInvocations[methodName].timesInvoked != 0){ reason = "Expected method - " + methodName + "(...) not called"; testFailed = true; } } private function methodIsExpected(methodName:String):Boolean{ return (this.expectedMethodInvocationFor(methodName)!=null); } private function verifyTimesInvoked(methodName:String):void { if (!this.testFailed){ var expectedTimeInvoked:int = this.expectedMethodInvocationFor(methodName).timesInvoked; var actualTimeInvoked:int = this.actualMethodInvocationFor(methodName).timesInvoked; if (actualTimeInvoked != expectedTimeInvoked){ reason = "Unexpected method call. Expected " + methodName + "(...) to be invoked " + expectedTimeInvoked + " time(s), but it was invoked " + actualTimeInvoked + " time(s)." ; testFailed = true; } } } public function expectedReturnFor(methodName:String):Object{ return this.returnValueFor(methodName); } private function methodHasBeenInvoked(methodName:String):Boolean{ return (this.actualMethodInvocationFor(methodName) != null); } public function record(methodName:String, ...args):void{ this.methodInvoked.push(methodName); if (this.methodHasBeenInvoked(methodName)){ this.actualMethodInvocationFor(methodName).timesInvoked++; }else{ var methodInvoked:MethodInvocation = new MethodInvocation(methodName) methodInvoked.args = args; this.actualMethodInvocations[methodName] = methodInvoked; } } private function verifyArgList(methodName:String, args:Array):void{ if (!this.testFailed){ var argsReceived:String = args.toString(); var methInv:MethodInvocation; methInv = this.expectedMethodInvocationFor(methodName); var argsExpected:String = methInv.args.toString(); if (argsReceived != argsExpected){ reason = "Unexpected argument value. Expected " + methodName + "("+argsExpected+"), but " + methodName + "("+argsReceived+") was invoked instead."; testFailed = true; } } } // verify all method expectations for this mock public function verify():void{ trace("invoked methods:"+this.methodInvoked.join(",")); var methodInvokation:MethodInvocation; for (var i:int=0; i<this.methodInvoked.length; i++){ methodInvokation = this.actualMethodInvocationFor(this.methodInvoked.valueOf(i)); trace("checking expectations for invoked method"); trace(this.methodInvoked[i]); if(!this._ignoreMissingExpectations) { this.verifyMethodIsExpected(this.methodInvoked[i]); } if (methodInvokation!= null){ this.verifyTimesInvoked(methodInvokation.name); this.verifyArgList(methodInvokation.name, methodInvokation.args); } /* remove call from expected if all is fine */ this.methodExpected.splice(this.methodExpected.indexOf(this.methodInvoked[i]),1); } for (i=0; i<this.methodExpected.length; i++){ this.verifyMethodHasBeenInvoked(this.methodExpected[i]); trace("checking invokations for expected method"); trace(this.methodExpected[i]); } } public function success():Boolean{ this.verify(); return !this.testFailed; } public function hasError():Boolean{ return !this.testFailed; } public function errorMessage():String{ return this.reason; } public function ignoreMissingExpectations():void{ this._ignoreMissingExpectations = true; } } } class MethodInvocation { function MethodInvocation(methodName : String){ this.name = methodName; } public var name:String; public var timesInvoked:int=1; public var args:Array = new Array(); public var returnValue:Object; }
/* Copyright (C) 2007 Apple Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. */ function arrayExists(array, x) { for (var i = 0; i < array.length; i++) { if (array[i] == x) return true; } return false; } Date.prototype.formatDate = function (input,time) { // formatDate : // a PHP date like function, for formatting date strings // See: http://www.php.net/date // // input : format string // time : epoch time (seconds, and optional) // // if time is not passed, formatting is based on // the current "this" date object's set time. // // supported: // a, A, B, d, D, F, g, G, h, H, i, j, l (lowercase L), L, // m, M, n, O, r, s, S, t, U, w, W, y, Y, z // // unsupported: // I (capital i), T, Z var switches = ["a", "A", "B", "d", "D", "F", "g", "G", "h", "H", "i", "j", "l", "L", "m", "M", "n", "O", "r", "s", "S", "t", "U", "w", "W", "y", "Y", "z"]; var daysLong = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var daysShort = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var daysSuffix = ["st", "nd", "rd", "th", "th", "th", "th", // 1st - 7th "th", "th", "th", "th", "th", "th", "th", // 8th - 14th "th", "th", "th", "th", "th", "th", "st", // 15th - 21st "nd", "rd", "th", "th", "th", "th", "th", // 22nd - 28th "th", "th", "st"]; // 29th - 31st function a() { // Lowercase Ante meridiem and Post meridiem return self.getHours() > 11? "pm" : "am"; } function A() { // Uppercase Ante meridiem and Post meridiem return self.getHours() > 11? "PM" : "AM"; } function B(){ // Swatch internet time. code simply grabbed from ppk, // since I was feeling lazy: // http://www.xs4all.nl/~ppk/js/beat.html var off = (self.getTimezoneOffset() + 60)*60; var theSeconds = (self.getHours() * 3600) + (self.getMinutes() * 60) + self.getSeconds() + off; var beat = Math.floor(theSeconds/86.4); if (beat > 1000) beat -= 1000; if (beat < 0) beat += 1000; if ((""+beat).length == 1) beat = "00"+beat; if ((""+beat).length == 2) beat = "0"+beat; return beat; } function d() { // Day of the month, 2 digits with leading zeros return new String(self.getDate()).length == 1? "0"+self.getDate() : self.getDate(); } function D() { // A textual representation of a day, three letters return daysShort[self.getDay()]; } function F() { // A full textual representation of a month return monthsLong[self.getMonth()]; } function g() { // 12-hour format of an hour without leading zeros return self.getHours() > 12? self.getHours()-12 : self.getHours(); } function G() { // 24-hour format of an hour without leading zeros return self.getHours(); } function h() { // 12-hour format of an hour with leading zeros if (self.getHours() > 12) { var s = new String(self.getHours()-12); return s.length == 1? "0"+ (self.getHours()-12) : self.getHours()-12; } else { var s = new String(self.getHours()); return s.length == 1? "0"+self.getHours() : self.getHours(); } } function H() { // 24-hour format of an hour with leading zeros return new String(self.getHours()).length == 1? "0"+self.getHours() : self.getHours(); } function i() { // Minutes with leading zeros return new String(self.getMinutes()).length == 1? "0"+self.getMinutes() : self.getMinutes(); } function j() { // Day of the month without leading zeros return self.getDate(); } function l() { // A full textual representation of the day of the week return daysLong[self.getDay()]; } function L() { // leap year or not. 1 if leap year, 0 if not. // the logic should match iso's 8601 standard. var y_ = Y(); if ( (y_ % 4 == 0 && y_ % 100 != 0) || (y_ % 4 == 0 && y_ % 100 == 0 && y_ % 400 == 0) ) { return 1; } else { return 0; } } function m() { // Numeric representation of a month, with leading zeros return self.getMonth() < 9? "0"+(self.getMonth()+1) : self.getMonth()+1; } function M() { // A short textual representation of a month, three letters return monthsShort[self.getMonth()]; } function n() { // Numeric representation of a month, without leading zeros return self.getMonth()+1; } function O() { // Difference to Greenwich time (GMT) in hours var os = Math.abs(self.getTimezoneOffset()); var h = ""+Math.floor(os/60); var m = ""+(os%60); h.length == 1? h = "0"+h:1; m.length == 1? m = "0"+m:1; return self.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m; } function r() { // RFC 822 formatted date var r; // result // Thu , 21 Dec 2000 r = D() + ", " + j() + " " + M() + " " + Y() + // 16 : 01 : 07 +0200 " " + H() + ":" + i() + ":" + s() + " " + O(); return r; } function S() { // English ordinal suffix for the day of the month, 2 characters return daysSuffix[self.getDate()-1]; } function s() { // Seconds, with leading zeros return new String(self.getSeconds()).length == 1? "0"+self.getSeconds() : self.getSeconds(); } function t() { // thanks to Matt Bannon for some much needed code-fixes here! var daysinmonths = [null,31,28,31,30,31,30,31,31,30,31,30,31]; if (L()==1 && n()==2) return 29; // leap day return daysinmonths[n()]; } function U() { // Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) return Math.round(self.getTime()/1000); } function W() { // Weeknumber, as per ISO specification: // http://www.cl.cam.ac.uk/~mgk25/iso-time.html // if the day is three days before newyears eve, // there's a chance it's "week 1" of next year. // here we check for that. var beforeNY = 364+L() - z(); var afterNY = z(); var weekday = w()!=0?w()-1:6; // makes sunday (0), into 6. if (beforeNY <= 2 && weekday <= 2-beforeNY) { return 1; } // similarly, if the day is within threedays of newyears // there's a chance it belongs in the old year. var ny = new Date("January 1 " + Y() + " 00:00:00"); var nyDay = ny.getDay()!=0?ny.getDay()-1:6; if ( (afterNY <= 2) && (nyDay >=4) && (afterNY >= (6-nyDay)) ) { // Since I'm not sure we can just always return 53, // i call the function here again, using the last day // of the previous year, as the date, and then just // return that week. var prevNY = new Date("December 31 " + (Y()-1) + " 00:00:00"); return prevNY.formatDate("W"); } // week 1, is the week that has the first thursday in it. // note that this value is not zero index. if (nyDay <= 3) { // first day of the year fell on a thursday, or earlier. return 1 + Math.floor( ( z() + nyDay ) / 7 ); } else { // first day of the year fell on a friday, or later. return 1 + Math.floor( ( z() - ( 7 - nyDay ) ) / 7 ); } } function w() { // Numeric representation of the day of the week return self.getDay(); } function Y() { // A full numeric representation of a year, 4 digits // we first check, if getFullYear is supported. if it // is, we just use that. ppks code is nice, but wont // work with dates outside 1900-2038, or something like that if (self.getFullYear) { var newDate = new Date("January 1 2001 00:00:00 +0000"); var x = newDate .getFullYear(); if (x == 2001) { // i trust the method now return self.getFullYear(); } } // else, do this: // codes thanks to ppk: // http://www.xs4all.nl/~ppk/js/introdate.html var x = self.getFullYear(); var y = x % 100; y += (y < 38) ? 2000 : 1900; return y; } function y() { // A two-digit representation of a year var y = Y()+""; return y.substring(y.length-2,y.length); } function z() { // The day of the year, zero indexed! 0 through 366 var t = new Date("January 1 " + Y() + " 00:00:00"); var diff = self.getTime() - t.getTime(); return Math.floor(diff/1000/60/60/24); } var self = this; if (time) { // save time var prevTime = self.getTime(); self.setTime(time); } var ia = input.split(""); var ij = 0; while (ia[ij]) { if (ia[ij] == "\\") { // this is our way of allowing users to escape stuff ia.splice(ij,1); } else { if (arrayExists(switches,ia[ij])) { switch (ia[ij]) { case "A": ia[ij]=A(); break; case "d": ia[ij]=d(); break; case "F": ia[ij]=F(); break; case "g": ia[ij]=g(); break; case "i": ia[ij]=i(); break; case "l": ia[ij]=l(); break; case "m": ia[ij]=m(); break; case "s": ia[ij]=s(); break; case "Y": ia[ij]=Y(); break; default: print("unknown function: "+ ia[ij]); } } } ij++; } // reset time, back to what it was if (prevTime) { self.setTime(prevTime); } return ia.join(""); } var start=new Date(); var date = new Date("1/1/2007 1:11:11"); var shortFormat; var longFormat; for (i = 0; i < 500; ++i) { shortFormat = date.formatDate("Y-m-d"); longFormat = date.formatDate("l, F d, Y g:i:s A"); date.setTime(date.getTime() + 84266956); } var totaltime=new Date()-start; if (shortFormat!="2008-05-01") { print("error shortFormat expecting 2008-05-01 got "+shortFormat); } else { if (longFormat!="Thursday, May 01, 2008 6:31:22 PM") { print("error longFormat expecting Thursday, May 01, 2008 6:31:22 PM got "+longFormat); } else { print("Pass"); } }
// // test // // Created by Andrew Fitzgerald on 2007-07-09. // Copyright (c) 2007 __MyCompanyName__. All rights reserved. // // A *really* crude sample to test the "Build in MTASC" command // Run the "Install MTASC Support Files" in your project before running "Build in MTASC", and be sure to edit the data to suit your class' name // import com.visualcondition.twease.*; class test { function test() { // Empty constructor } // Hook for MTASC. This method will be called to start the application static function main() { Stage.scaleMode = 'noscale'; var t:MovieClip = _root.createEmptyMovieClip('5', 3); t.beginFill(0,100); t.lineTo(50,0); t.lineTo(50,50); t.lineTo(0,50); t.endFill(); var f1:Function = function(target){trace("hey anthony")}; var f2:Function = function(target){trace("hey bob is cool")}; var k:MovieClip = _root.createEmptyMovieClip('mc3', 4); k.beginFill(0x555050,100); k.lineTo(50,0); k.lineTo(50,50); k.lineTo(0,50); k.endFill(); k._y = k._x = 100; //k._y = 0; Twease.register(Easing, Colors, Extras, Filters, Texts); //Twease.collectionrate = 5000; //Twease.tween({target:t, _xscale:500, _yscale:500, time:3, ease:'easeOutSine', cycles:-1, delay:0}); Twease.tween([{target:k, _x:'50', time:1}, {target:t, _xscale:500, _yscale:500, time:3, ease:Twease.easeOut, delay:.5}]); // Twease.tween({delay:2, func:f1}); var s = Twease.tween([{delay: 1, time:2, _rotation:'365'}, {delay:2, func:f1}, {target:t, _x:100, _y:100, _alpha:50, delay:0, ease:Twease.easeOut, time:2, cycles:3, func:function(to,po,q){if(Twease.tweens[to][po][0].cycles == 1){Twease.advance(q)}}}, {time:2, _rotation:'25'}, {time:2, _rotation:'-55'}, {time:2, _rotation:0}], k); // Twease.tween({delay:3, func:function(){Twease.advance(s)}}); // Twease.tween([{target:t, _rotation:50, time:2}, {target:k, _xscale:50, time:2}]); // Twease.stacking = false; // /PennerEasing.init(); // Twease.tween({target:k, _width:150, time:9, ease:'linear', delay:1}); // Twease.tween({target:k, _rotation:-250, time:2}); // Twease.tween({target:k, _rotation:50, time:2}); // Twease.queue[s].splice(2,1); // trace(Twease.queue[s]); // Extend.init(); var co:Object = {color:0x0e350f}; //Twease.tween({target:co, color:0xffffff, time:4}); var oldc = (new Color(k)).getTransform(); var newc = Twease.getColorObject('tint', 100, 0xDf5AF1); newc.target = oldc; newc.time = 2; //newc.round = true; // newc.upfunc = function(to, po){ // trace(to[po]); // (new Color(k)).setTransform(oldc); // }; // Twease.tween(newc); Twease.combinecolors = true; //Twease.setColor(k, 'tint', 100, 0x4f5801); //Twease.tween({target:k, tint:0xff0000, tintPercent:80, time:2, delay:0}); //Twease.tween({target:k, tint:0xfaf100, tintPercent:80, time:2, delay:0}); //Twease.tween({target:k, brightOffset:80, time:2, delay:0, ease:'easeOutBounce', cycles:2}); var tttp = "BlurFilter"; var newf = new flash.filters.BlurFilter(8, 8, 3); //k.filters = [newf]; //Twease.tween([{_x: 350, _y:380, bezier:[{_x:'-200', _y:'250'}, {_x:'200', _y:'100'}, {_x:0, _y:100}], tint:0xff4d8a, time:5, ease:'easeOutBounce', cycles:-1}], k); var tok:Object = {text:"A"}; Twease.tween({target:tok, time:2, character:"Z"}); var toyk:Object = {text:"BOOBOOB"}; //Twease.tween({target:toyk, time:4, words:"Frank Carloton"}); //Twease.tween({target:k, _x:'200' , rate:2, delay:0, cycles:-1, progress: 0}); /* var pool = Twease.tween({target:k, _x:'100', _y:'150', time:1, delay:.2, cycles:1}, true); k.onEnterFrame = function ():Void{ var gtt:Number = getTimer(); for ( var i in pool ){ trace(Twease.render(pool[i], gtt)); }; }; */ /* //make color object var masc:Object = {}; masc.colorobj = new Color(targetmc); masc.currentcolor = masc.colorobj.getTransform(); masc.newcolortween = Twease.getColorTransObj(prop, amount, value); */ var os = false; _root.onMouseDown = function() { if(os != true){ os = true; Twease.setActive(false, k); }else { os = false; Twease.setActive(true, k); } } } };
package kabam.rotmg.util.graphics { public class BevelRect { public var topLeftBevel:Boolean = true; public var topRightBevel:Boolean = true; public var bottomLeftBevel:Boolean = true; public var bottomRightBevel:Boolean = true; public var width:int; public var height:int; public var bevel:int; public function BevelRect(_arg1:int, _arg2:int, _arg3:int) { this.width = _arg1; this.height = _arg2; this.bevel = _arg3; } } }
// // $Id$ package com.threerings.msoy.room.client { import flash.display.DisplayObject; import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.geom.Point; import flash.ui.Keyboard; import flash.utils.ByteArray; import flash.utils.Dictionary; import flash.utils.Timer; import flash.utils.getTimer; import mx.core.Application; import mx.core.IToolTip; import mx.core.UIComponent; import mx.events.MenuEvent; import mx.managers.ISystemManager; import mx.managers.ToolTipManager; import com.threerings.util.Log; import com.threerings.util.Map; import com.threerings.util.Maps; import com.threerings.util.ObjectMarshaller; import com.threerings.crowd.client.PlaceView; import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.util.CrowdContext; import com.threerings.whirled.client.SceneController; import com.threerings.flex.CommandMenu; import com.threerings.flex.PopUpUtil; import com.threerings.msoy.chat.client.ChatOverlay; import com.threerings.msoy.client.Msgs; import com.threerings.msoy.client.PlaceBox; import com.threerings.msoy.client.UberClient; import com.threerings.msoy.data.all.MemberName; import com.threerings.msoy.item.data.all.ItemIdent; import com.threerings.msoy.item.data.all.ItemTypes; import com.threerings.msoy.room.data.ActorInfo; import com.threerings.msoy.room.data.EntityMemories; import com.threerings.msoy.room.data.FurniData; import com.threerings.msoy.room.data.MsoyLocation; import com.threerings.msoy.world.client.WorldContext; import com.threerings.msoy.world.client.WorldControlBar; /** * Manages the various interactions that take place in a room scene. */ public class RoomController extends SceneController { /** Logging facilities. */ protected static const log :Log = Log.getLog(RoomController); /** Some commands. */ public static const FURNI_CLICKED :String = "FurniClicked"; public static const AVATAR_CLICKED :String = "AvatarClicked"; public static const PET_CLICKED :String = "PetClicked"; public static const ORDER_PET :String = "OrderPet"; public static const MAX_ENCODED_MESSAGE_LENGTH :int = 1024; /** The entity type groupings for querying for property owners. */ public static const ENTITY_TYPES :Dictionary = new Dictionary(); // static initialization... ENTITY_TYPES[ItemTypes.FURNITURE] = "furni"; ENTITY_TYPES[ItemTypes.TOY] = "furni"; ENTITY_TYPES[ItemTypes.DECOR] = "furni"; ENTITY_TYPES[ItemTypes.AVATAR] = "avatar"; ENTITY_TYPES[ItemTypes.OCCUPANT] = "avatar"; ENTITY_TYPES[ItemTypes.PET] = "pet"; // end: static initialization // documentation inherited override public function init (ctx :CrowdContext, config :PlaceConfig) :void { _wdctx = (ctx as WorldContext); _throttleChecker.addEventListener(TimerEvent.TIMER, handleCheckThrottles); super.init(ctx, config); } // documentation inherited override public function willEnterPlace (plobj :PlaceObject) :void { super.willEnterPlace(plobj); _throttleChecker.start(); } // documentation inherited override public function didLeavePlace (plobj :PlaceObject) :void { super.didLeavePlace(plobj); _throttleChecker.stop(); // see if this is causing the drop of any messages for each (var throttler :Throttler in _throttlers.values()) { throttler.noteDrop(); } _throttlers.clear(); } // documentation inherited override protected function createPlaceView (ctx :CrowdContext) :PlaceView { _roomView = new RoomView(_wdctx, this); return _roomView; } /** * Get the instanceId of all the entity instances in the room. This is used so that two * instances of a pet can negotiate which client will control it, for example. */ public function getEntityInstanceId () :int { // we use the memberId, which is valid (but negative) even if you're a guest return _wdctx.getMyId(); } /** * Get the display name of the user viewing a particular instance. */ public function getViewerName (instanceId :int = 0) :String { var name :MemberName = _wdctx.getMyName(); if (instanceId == 0 || instanceId == name.getId()) { return name.toString(); } return null; // see subclasses for more... } /** * Return the environment in which the entities are running. * See EntityControl's ENV_VIEWER, ENV_SHOP, and ENV_ROOM. */ public function getEnvironment () :String { return "viewer"; // ENV_VIEWER. See subclasses. } /** * Return true if we're in a place in which memories will save. */ public function memoriesWillSave () :Boolean { return true; } /** * Get the specified item's room memories in a map. */ public function getMemories (ident :ItemIdent) :Object { return {}; // see subclasses } /** * Look up a particular memory key for the specified item. */ public function lookupMemory (ident :ItemIdent, key :String) :Object { return null; // see subclasses } /** * Does this user have management permission in this room? */ public function canManageRoom (memberId :int = 0, allowSupport :Boolean = true) :Boolean { return false; } /** * Requests that this client be given control of the specified item. */ public function requestControl (ident :ItemIdent) :void { // see subclasses } /** * Requests that an item be removed from the owner's inventory. */ public function deleteItem (ident :ItemIdent) :void { // see subclasses } /** * Requests to rate this room. */ public function rateRoom (rating :Number, onSuccess :Function) :void { // see subclasses } /** * Called when control of an entity is assigned to us. */ public function dispatchEntityGotControl (ident :ItemIdent) :void { var sprite :EntitySprite = _roomView.getEntity(ident); if (sprite != null) { sprite.gotControl(); } else { log.info("Received got control for unknown sprite", "item", ident); } } /** * Handles a request by an item in our room to send an "action" (requires control) or a * "message" (doesn't require control). */ public function sendSpriteMessage ( ident :ItemIdent, name :String, arg :Object, isAction :Boolean) :void { if (isAction && !checkCanRequest(ident, "triggerAction")) { log.info("Dropping message for lack of control", "ident", ident, "name", name); return; } // send the request off to the server var data :ByteArray = ObjectMarshaller.validateAndEncode(arg, MAX_ENCODED_MESSAGE_LENGTH); sendSpriteMessage2(ident, name, data, isAction); } /** * Handles a request by an item in our room to send a "signal" to all the instances of * all the entities in the room. This does not require control. */ public function sendSpriteSignal (ident :ItemIdent, name :String, arg :Object) :void { var data :ByteArray = ObjectMarshaller.validateAndEncode(arg, MAX_ENCODED_MESSAGE_LENGTH); sendSpriteSignal2(ident, name, data); } /** * Handles a request by an actor item to change its persistent state. Requires control. */ public function setActorState (ident :ItemIdent, actorOid :int, state :String) :void { if (!checkCanRequest(ident, "setState")) { log.info("Dropping state change for lack of control", "ident", ident, "state", state); return; } setActorState2(ident, actorOid, state); } /** * Handles a request by an entity item to send a chat message. */ public function sendPetChatMessage (msg :String, info :ActorInfo) :void { if (checkCanRequest(info.getItemIdent(), "PetService")) { sendPetChatMessage2(msg, info); } } /** * Handles a request by an item in our room to update its memory. */ public function updateMemory ( ident :ItemIdent, key :String, value: Object, callback :Function) :void { // NOTE: there is no need to be "in control" to update memory. // validateKey(key); // This will validate that the memory being set isn't greater than the maximum // alloted space for all memories, becauses that will surely fail on the server, // but the server will do further checks to ensure that this entry can be // safely added to the memory set such that combined they're all under the maximum. var data :ByteArray = ObjectMarshaller.validateAndEncode(value, EntityMemories.MAX_ENCODED_MEMORY_LENGTH); updateMemory2(ident, key, data, callback); } /** * Retrieves a published property of a given entity. */ public function getEntityProperty (ident :ItemIdent, key :String) :Object { var sprite :EntitySprite = _roomView.getEntity(ident); return (sprite == null) ? null : sprite.lookupEntityProperty(key); } /** * Get the ID strings of all entities of the specified type, or all if type is null. * @see ENTITY_TYPES */ public function getEntityIds (type :String = null) :Array { var idents :Array = _roomView.getItemIdents(); // Filter for items of the correct type, if necessary if (type != null) { idents = idents.filter( function (id :ItemIdent, ... etc) :Boolean { // Is the entity a valid item of this type? return (ENTITY_TYPES[id.type] == type); }); } // Convert from ItemIdents to entityId Strings return idents.map( function (id :ItemIdent, ... etc) :String { return id.toString(); }); } /** * Handles a request by an actor to change its location. Returns true if the request was * dispatched, false if funny business prevented it. */ public function requestMove (ident :ItemIdent, newloc :MsoyLocation) :Boolean { // handled in subclasses return false; } /** * Called to enact the avatar action globally: all users will see it. */ public function doAvatarAction (action :String) :void { sendSpriteMessage(_roomView.getMyAvatar().getItemIdent(), action, null, true); } /** * Called to enact an avatar state change. */ public function doAvatarState (state :String) :void { var avatar :MemberSprite = _roomView.getMyAvatar(); setActorState(avatar.getItemIdent(), avatar.getOid(), state); } /** * Handles FURNI_CLICKED. */ public function handleFurniClicked (furni :FurniData) :void { // see subclasses } /** * Either mutes or unmutes the sounds belonging to a memberId's avatars and pets. */ public function squelchPlayer (player :MemberName, squelch :Boolean) :void { // see subclasses } /** * Add menu items for triggering actions and changing state on our avatar. */ protected function addSelfMenuItems ( avatar :MemberSprite, menuItems :Array, canControl :Boolean) :void { CommandMenu.addSeparator(menuItems); // create a sub-menu for playing avatar actions var actions :Array = avatar.getAvatarActions(); if (actions.length > 0) { var worldActions :Array = []; for each (var act :String in actions) { worldActions.push({ label: act, callback: doAvatarAction, arg: act }); } menuItems.push({ label: Msgs.GENERAL.get("l.avAction"), children: worldActions, enabled: canControl }); } // create a sub-menu for changing avatar states var states :Array = avatar.getAvatarStates(); if (states.length > 0) { var worldStates :Array = []; var curState :String = avatar.getState(); // NOTE: we usually want to translate null into the first state, however, if there's // only one state registered, let them select it anyway by not translating. if (states.length > 1 && curState == null) { curState = states[0]; } for each (var state :String in states) { worldStates.push({ label: state, callback: doAvatarState, arg :state, enabled: (curState != state) }); } menuItems.push({ label: Msgs.GENERAL.get("l.avStates"), children: worldStates, enabled: canControl }); } // custom config if (avatar.hasCustomConfigPanel()) { menuItems.push({ label: Msgs.GENERAL.get("b.config_item", "avatar"), callback: showConfigPopup, arg: avatar, enabled: memoriesWillSave() }); } } /** * Pop up an actor menu. */ protected function popActorMenu (sprite :ActorSprite, menuItems :Array) :void { // pop up the menu where the mouse is if (menuItems.length > 0) { var menu :CommandMenu = CommandMenu.createMenu(menuItems, _roomView); menu.setBounds(_wdctx.getTopPanel().getPlaceViewBounds()); menu.popUpAtMouse(); menu.addEventListener(MenuEvent.MENU_HIDE, function (event :MenuEvent) :void { if (event.menu == menu) { _clickSuppress = sprite; _wdctx.getTopPanel().systemManager.topLevelSystemManager.getSandboxRoot(). addEventListener(MouseEvent.MOUSE_DOWN, clearClickSuppress, false, 0, true); } }); // var menu :RadialMenu = new RadialMenu(); // menu.dataProvider = menuItems; // menu.popUp(UberClient.getApplication()); } } /** * Handles AVATAR_CLICKED. */ public function handleAvatarClicked (avatar :MemberSprite) :void { // nada here, see subclasses } /** * Handles PET_CLICKED. */ public function handlePetClicked (pet :ActorSprite) :void { // see subclasses } /** * Handles ORDER_PET. */ public function handleOrderPet (petId :int, command :int) :void { // see subclasses / TODO } /** * Get the top-most sprite mouse-capturing sprite with a non-transparent pixel at the specified * location. * * @return undefined if the mouse isn't in our bounds, or null, or an EntitySprite. */ public function getHitSprite (stageX :Number, stageY :Number, all :Boolean = false) :EntitySprite { // check to make sure we're within the bounds of the place container var container :PlaceBox = _wdctx.getTopPanel().getPlaceContainer(); var containerP :Point = container.localToGlobal(new Point()); if (stageX < containerP.x || stageX > containerP.x + container.width || stageY < containerP.y || stageY > containerP.y + container.height) { return undefined; } // first, avoid any popups var smgr :ISystemManager = UberClient.getApplication().systemManager; var ii :int; var disp :DisplayObject; for (ii = smgr.numChildren - 1; ii >= 0; ii--) { disp = smgr.getChildAt(ii) if ((disp is Application) || (disp is UIComponent && !UIComponent(disp).visible)) { continue; } if (disp.hitTestPoint(stageX, stageY)) { return undefined; } } // then check with the PlaceBox if (container.overlaysMousePoint(stageX, stageY)) { return undefined; } // then avoid any chat glyphs that are clickable var overlay :ChatOverlay = _wdctx.getTopPanel().getChatOverlay(); if (overlay != null && overlay.hasClickableGlyphsAtPoint(stageX, stageY)) { return undefined; } // we search from last-drawn to first drawn to get the topmost... for (var dex :int = _roomView.numChildren - 1; dex >= 0; dex--) { var viz :DisplayObject = _roomView.getChildAt(dex); var el :RoomElement = _roomView.vizToEntity(viz); if (el == null || !(el is EntitySprite)) { continue; } var spr :EntitySprite = (el as EntitySprite); if ((all || (spr.isActive() && spr.capturesMouse())) && viz.hitTestPoint(stageX, stageY, true)) { return spr; } } return null; } /** * Handles ENTER_FRAME and see if the mouse is now over anything. Normally the flash player * will dispatch mouseOver/mouseLeft for an object even if the mouse isn't moving: the sprite * could move. Since we're hacking in our own mouseOver handling, we emulate that. Gah. */ protected function checkMouse (event :Event) :void { // skip if supressed, and freak not out if we're temporarily removed from the stage if (_suppressNormalHovering || _roomView.stage == null || !_roomView.isShowing()) { return; } // // in case a mouse event was captured by an entity, prevent it from adding a popup later // _entityAllowedToPop = null; checkMouse2(false, false, null); } /** * Helper for checkMouse. Broken out for subclasses to override. * * @param grabAll if true, grab all sprites * @param allowMovement only consulted when grabAll is true. * @param setHitter only used when grabAll is true. */ protected function checkMouse2 ( grabAll :Boolean, allowMovement :Boolean, setHitter :Function) :void { var sx :Number = _roomView.stage.mouseX; var sy :Number = _roomView.stage.mouseY; var showWalkTarget :Boolean = false; var showFlyTarget :Boolean = false; var hoverTarget :EntitySprite = null; // if shift is being held down, we're looking for locations only, so // skip looking for hitSprites. var hit :* = (_shiftDownSpot == null) ? getHitSprite(sx, sy, grabAll) : null; var hitter :EntitySprite = (hit as EntitySprite); // ensure we hit no pop-ups if (hit !== undefined) { hoverTarget = hitter; if (hitter == null) { var cloc :ClickLocation = _roomView.layout.pointToAvatarLocation( sx, sy, _shiftDownSpot, RoomMetrics.N_UP); if (cloc != null && _wdctx.worldProps.userControlsAvatar) { addAvatarYOffset(cloc); if (cloc.loc.y != 0) { _flyTarget.setLocation(cloc.loc); _roomView.layout.updateScreenLocation(_flyTarget); showFlyTarget = true; // Set the Y to 0 and use it for the walkTarget cloc.loc.y = 0; _walkTarget.alpha = .5; } else { _walkTarget.alpha = 1; } // don't show the walk target if we're "in front" of the room view showWalkTarget = (cloc.loc.z >= 0); _walkTarget.setLocation(cloc.loc); _roomView.layout.updateScreenLocation(_walkTarget); } } else if (!hoverTarget.hasAction()) { // it may have captured the mouse, but it doesn't actually // have any action, so we don't hover it. hoverTarget = null; } // if we're in grab-all mode, we operate slightly differently: don't actually highlight if (grabAll) { hoverTarget = null; // possibly hide walk targets too showWalkTarget = (showWalkTarget && allowMovement); showFlyTarget = (showFlyTarget && allowMovement); // indicate which sprite is being hovered setHitter(hitter); } } _walkTarget.visible = showWalkTarget; _flyTarget.visible = showFlyTarget; setHoverSprite(hoverTarget, sx, sy); } /** * Set the special singleton sprite that the mouse is hovering over. */ protected function setHoverSprite ( sprite :EntitySprite, stageX :Number = NaN, stageY :Number = NaN) :void { if (sprite is FurniSprite && WorldControlBar(_wdctx.getControlBar()).hotZoneBtn.selected) { return; // not right now, they're all hovered } // iff the sprite has changed.. if (_hoverSprite != sprite) { // unglow the old sprite (and remove any tooltip) if (_hoverSprite != null) { setSpriteHovered(_hoverSprite, false, stageX, stageY); } // assign the new hoversprite, maybe assigning to null _hoverSprite = sprite; } // glow the sprite (and give it a chance update the tip) if (_hoverSprite != null) { setSpriteHovered(_hoverSprite, true, stageX, stageY); } } /** * This sets the particular sprite to be hovered or no. This can be called even for * sprites other than the _hoverSprite. */ public function setSpriteHovered ( sprite :EntitySprite, hovered: Boolean, stageX :Number = NaN, stageY :Number = NaN) :void { // update the glow on the sprite var text :Object = sprite.setHovered(hovered, stageX, stageY); if (hovered && text === true) { return; // this is a special-case shortcut we use to save time. } var tip :IToolTip = IToolTip(_hoverTips[sprite]); // maybe remove the tip if ((tip != null) && (!hovered || text == null || tip.text != text)) { delete _hoverTips[sprite]; ToolTipManager.destroyToolTip(tip); tip = null; } // maybe add a new tip if (hovered && (text != null)) { if (isNaN(stageX) || isNaN(stageY)) { var p :Point = sprite.viz.localToGlobal(sprite.getLayoutHotSpot()); stageX = p.x; stageY = p.y; } _hoverTips[sprite] = addHoverTip( sprite, String(text), stageX, stageY + MOUSE_TOOLTIP_Y_OFFSET); } } /** * Utility method to create and style the hover tip for a sprite. */ protected function addHoverTip ( sprite :EntitySprite, tipText :String, stageX :Number, stageY :Number) :IToolTip { var tip :IToolTip = ToolTipManager.createToolTip(tipText, stageX, stageY); var tipComp :UIComponent = UIComponent(tip); tipComp.styleName = "roomToolTip"; tipComp.x -= tipComp.width/2; tipComp.y -= tipComp.height/2; PopUpUtil.fitInRect(tipComp, _wdctx.getTopPanel().getPlaceViewBounds()); var hoverColor :uint = sprite.getHoverColor(); tipComp.setStyle("color", hoverColor); if (hoverColor == 0) { tipComp.setStyle("backgroundColor", 0xFFFFFF); } return tip; } protected function mouseClicked (event :MouseEvent) :void { if (_suppressNormalHovering) { return; } // // at this point, the mouse click is bubbling back out, and the entity is no // // longer allowed to pop up a popup. // _entityAllowedToPop = null; // if shift is being held down, we're looking for locations only, so skip looking for // hitSprites. var hit :* = (_shiftDownSpot == null) ? getHitSprite(event.stageX, event.stageY) : null; if (hit === undefined) { return; } // deal with the target var hitter :EntitySprite = (hit as EntitySprite); if (hitter != null) { // let the sprite decide what to do with it if (hitter != _clickSuppress) { hitter.mouseClick(event); } } else if (_wdctx.worldProps.userControlsAvatar) { var curLoc :MsoyLocation = _roomView.getMyCurrentLocation(); if (curLoc == null) { return; // we've already left, ignore the click } // calculate where the location is var cloc :ClickLocation = _roomView.layout.pointToAvatarLocation( event.stageX, event.stageY, _shiftDownSpot, RoomMetrics.N_UP); // disallow clicking in "front" of the scene when minimized if (cloc != null && cloc.loc.z >= 0) { // orient the location as appropriate addAvatarYOffset(cloc); var newLoc :MsoyLocation = cloc.loc; var degrees :Number = 180 / Math.PI * Math.atan2(newLoc.z - curLoc.z, newLoc.x - curLoc.x); // we rotate so that 0 faces forward newLoc.orient = (degrees + 90 + 360) % 360; // effect the move requestAvatarMove(newLoc); } } } /** * Clear out the click suppress sprite. */ protected function clearClickSuppress (event :MouseEvent) :void { _clickSuppress = null; _wdctx.getTopPanel().systemManager.topLevelSystemManager.getSandboxRoot(). removeEventListener(MouseEvent.MOUSE_DOWN, clearClickSuppress); } /** * Effect a move for our avatar. */ protected function requestAvatarMove (newLoc :MsoyLocation) :void { // nada here, see subclasses } /** * Once the state change has been validated, effect it. */ protected function setActorState2 (ident :ItemIdent, actorOid :int, state :String) :void { // see subclasses } /** * Once a sprite message is validated and ready to go, it is sent here. */ protected function sendSpriteMessage2 ( ident :ItemIdent, name :String, data :ByteArray, isAction :Boolean) :void { // see subclasses } /** * Once a sprite signal is validated and ready to go, it is sent here. */ protected function sendSpriteSignal2 (ident :ItemIdent, name :String, data :ByteArray) :void { // see subclasses } /** * Once a pet chat is validated and ready to go, it is sent here. */ protected function sendPetChatMessage2 (msg :String, info :ActorInfo) :void { // see subclasses } /** * Once a memory update is validated and ready to go, it is sent here. */ protected function updateMemory2 ( ident :ItemIdent, key :String, data :ByteArray, callback :Function) :void { // see subclasses } protected function keyEvent (event :KeyboardEvent) :void { try { var keyDown :Boolean = event.type == KeyboardEvent.KEY_DOWN; switch (event.keyCode) { case Keyboard.F4: _roomView.dimAvatars(keyDown); return; case Keyboard.F5: _roomView.dimFurni(keyDown); return; case Keyboard.SHIFT: _shiftDown = keyDown; if (keyDown) { if (_walkTarget.visible && (_shiftDownSpot == null)) { // record the y position at this _shiftDownSpot = new Point(_roomView.stage.mouseX, _roomView.stage.mouseY); } } else { _shiftDownSpot = null; } return; } if (keyDown) { switch (event.charCode) { case 91: // '[' _roomView.scrollViewBy(-ROOM_SCROLL_INCREMENT); break; case 93: // ']' _roomView.scrollViewBy(ROOM_SCROLL_INCREMENT); break; } } } finally { event.updateAfterEvent(); } } /** * Return the avatar's preferred y offset for normal mouse positioning, * unless shift is being held down, in which case use 0 so that the user * can select their height precisely. */ protected function addAvatarYOffset (cloc :ClickLocation) :void { if (_shiftDownSpot != null) { return; } var av :MemberSprite = _roomView.getMyAvatar(); if (av != null) { var prefY :Number = av.getPreferredY() / _roomView.layout.metrics.sceneHeight; // but clamp their preferred Y into the normal range cloc.loc.y = Math.min(1, Math.max(0, prefY)); } } /** * Ensures that we can issue a request to update the distributed state of the specified item, * returning true if so, false if we don't yet have a room object or are not in control of that * item. */ protected function checkCanRequest (ident :ItemIdent, from :String) :Boolean { // make sure we are in control of this entity (or that no one has control) var result :Object = hasEntityControl(ident); if (result == null || result == true) { // it's ok if nobody has control return true; } log.info("Dropping request as we are not controller", "from", from, "item", ident); return false; } // protected function validateKey (key :String) :void // { // if (key == null) { // throw new Error("Null is an invalid key!"); // } // for (var ii :int = 0; ii < key.length; ii++) { // if (key.charAt(ii) > "\u007F") { // throw new Error("Unicode characters not supported in keys."); // } // } // } /** * Does this client have control over the specified entity? * * Side-effect: The gotControl() will always be re-dispatched to the entity if it does. * The newest EntityControl will suppress repeats. * * @returns true, false, or null if nobody currently has control. */ protected function hasEntityControl (ident :ItemIdent) :Object { return true; } protected function throttle (ident :ItemIdent, fn :Function, ... args) :void { var av :EntitySprite = _roomView.getMyAvatar(); if (av != null && av.getItemIdent().equals(ident)) { // our own avatar is never throttled fn.apply(null, args); } else { // else, subject to throttling var throttler :Throttler = _throttlers.get(ident) as Throttler; if (throttler == null) { throttler = new Throttler(ident); _throttlers.put(ident, throttler); } throttler.processOp(fn, args); } } /** * Check queued messages to see if there are any we should send now. */ protected function handleCheckThrottles (... ignored) :void { var now :int = getTimer(); for each (var throttler :Throttler in _throttlers.values()) { // make sure it's a valid entity still // (We do this here instead of at the time the sprite is removed because sometimes // things are removed and re-added when simply repositioned. This lets that settle..). if (null == _roomView.getEntity(throttler.ident)) { throttler.noteDrop(); _throttlers.remove(throttler.ident); } else { // it's in the room, it's cool throttler.checkOps(now); } } } /** * Called to show the custom config panel for the specified FurniSprite in * a pop-up. */ public function showConfigPopup (sprite :EntitySprite) :Boolean { if (_entityPopup != null && _entityPopup.getOwningEntity() == sprite) { return true; } var configger :DisplayObject = sprite.getCustomConfigPanel(); if (configger == null) { return false; } return showEntityPopup(sprite, Msgs.GENERAL.get("t.config_item"), configger, configger.width, configger.height, 0xFFFFFF, 1.0, false); } /** * Called from user code to show a custom popup. */ internal function showEntityPopup ( sprite :EntitySprite, title :String, panel :DisplayObject, w :Number, h :Number, color :uint = 0xFFFFFF, alpha :Number = 1.0, mask :Boolean = true) :Boolean { // if (_entityAllowedToPop != sprite) { // return false; // } // other people's avatars cannot put a popup on our screen... if ((sprite is MemberSprite) && (sprite != _roomView.getMyAvatar())) { return false; } if (isNaN(w) || isNaN(h) || w <= 0 || h <= 0 || title == null || panel == null) { return false; } // close any existing popup if (_entityPopup != null) { _entityPopup.close(); } _entityPopup = new EntityPopup(_wdctx, sprite, title, panel, w, h, color, alpha, mask); _entityPopup.addCloseCallback(entityPopupClosed); _entityPopup.open(); return true; } /** * Clear any popup belonging to the specified sprite. */ public function clearEntityPopup (sprite :EntitySprite) :void { if (_entityPopup != null && _entityPopup.getOwningEntity() == sprite) { _entityPopup.close(); // will trigger callback that clears _entityPopup } } /** * A callback from the EntityPopup to let us know that it's been closed. */ protected function entityPopupClosed () :void { _entityPopup = null; } /** The number of pixels we scroll the room on a keypress. */ protected static const ROOM_SCROLL_INCREMENT :int = 20; /** The event to send to GWT when a background property has changed. */ protected static const BACKGROUND_CHANGED_EVENT :String = "backgroundChanged"; /** The event to send to GWT when furni has been added or removed. */ protected static const FURNI_CHANGED_EVENT :String = "furniChanged"; /** The amount we alter the y coordinate of tooltips generated under the mouse. */ protected static const MOUSE_TOOLTIP_Y_OFFSET :int = 50; /** The life-force of the client. */ protected var _wdctx :WorldContext; /** The room view that we're controlling. */ protected var _roomView :RoomView; /** Contains active throttlers. ItemIdent -> Throttler. */ protected var _throttlers :Map = Maps.newMapOf(ItemIdent); protected var _throttleChecker :Timer = new Timer(500); /** If true, normal sprite hovering is disabled. */ protected var _suppressNormalHovering :Boolean; /** The currently hovered sprite, or null. */ protected var _hoverSprite :EntitySprite; /** All currently displayed sprite tips, indexed by EntitySprite. */ protected var _hoverTips :Dictionary = new Dictionary(true); /** True if the shift key is currently being held down, false if not. */ protected var _shiftDown :Boolean; /** If shift is being held down, the coordinates at which it was pressed. */ protected var _shiftDownSpot :Point; /** Assigned to a sprite that we should not process clicks upon. */ protected var _clickSuppress :Object; /** The "cursor" used to display that a location is walkable. */ protected var _walkTarget :WalkTarget = new WalkTarget(); protected var _flyTarget :WalkTarget = new WalkTarget(true); protected var _entityPopup :EntityPopup; // protected var _entityAllowedToPop :EntitySprite; } } import flash.display.DisplayObject; import com.threerings.util.Log; import com.threerings.util.Throttle; import com.threerings.msoy.item.data.all.ItemIdent; import com.threerings.msoy.room.client.RoomElementSprite; import com.threerings.msoy.room.data.RoomCodes; class WalkTarget extends RoomElementSprite { public function WalkTarget (fly :Boolean = false) { var targ :DisplayObject = (fly ? new FLYTARGET() : new WALKTARGET()) as DisplayObject; targ.x = -targ.width/2; targ.y = -targ.height/2; addChild(targ); } override public function getRoomLayer () :int { return RoomCodes.FURNITURE_LAYER; } // from RoomElement override public function setScreenLocation (x :Number, y :Number, scale :Number) :void { // don't let the target shrink too much - 0.25 of original size at most super.setScreenLocation(x, y, Math.max(0.25, scale)); } [Embed(source="../../../../../../../rsrc/media/walkable.swf")] protected static const WALKTARGET :Class; [Embed(source="../../../../../../../rsrc/media/flyable.swf")] protected static const FLYTARGET :Class; } /** * Throttles entity communications. */ class Throttler { public static const OPERATIONS :int = 5; public static const PERIOD :int = 1000; public static const MAX_QUEUE :int = 20; public static const log :Log = Log.getLog(Throttler); /** The ident associated with this Throttler. */ public var ident :ItemIdent; public function Throttler (ident :ItemIdent) { this.ident = ident; } public function processOp (fn :Function, args :Array) :void { if (_throttle.throttleOp()) { if (_queue.length < MAX_QUEUE) { _queue.push([ fn, args ]); log.info("Queued entity message", "ident", ident, "queueSize", _queue.length); } else { log.warning("Dropping entity message", "ident", ident); } } else { fn.apply(null, args); //log.debug("Message not throttled", "ident", ident); } } public function checkOps (now :int) :void { while (_queue.length > 0) { if (_throttle.throttleOpAt(now)) { break; } var item :Array = _queue.shift() as Array; (item[0] as Function).apply(null, item[1] as Array); //log.debug("Sent queued message", "ident", ident); } } public function noteDrop () :void { if (_queue.length > 0) { log.warning("Queued messages dropped", "ident", ident, "queueSize", _queue.length); } } protected var _throttle :Throttle = new Throttle(OPERATIONS, PERIOD); protected var _queue :Array = []; }
/* VERSION: 1.01 DATE: 1/29/2009 ACTIONSCRIPT VERSION: 3.0 DESCRIPTION: This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in the TweenLiteVars or TweenMaxVars for more information. USAGE: Instead of TweenMax.to(my_mc, 1, {dropShadowFilter:{distance:5, blurX:10, blurY:10, color:0xFF0000}, onComplete:myFunction}), you could use this utility like: var myVars:TweenMaxVars = new TweenMaxVars(); myVars.dropShadowFilter = new DropShadowFilterVars(5, 10, 10, 1, 45, 0xFF0000); myVars.onComplete = myFunction; TweenMax.to(my_mc, 1, myVars); NOTES: - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite/TweenMax class, feel free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing. - You cannot define relative tween values with this utility. If you need relative values, just use the shorter (non strictly data typed) syntax, like TweenMax.to(my_mc, 1, {dropShadowFilter:{blurX:"-5", blurY:"3"}}); AUTHOR: Jack Doyle, jack@greensock.com Copyright 2010, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. */ package com.greensock.data { public class DropShadowFilterVars extends BlurFilterVars { public var distance:Number; public var alpha:Number; public var angle:Number; public var strength:Number; public function DropShadowFilterVars(distance:Number=4, blurX:Number=4, blurY:Number=4, alpha:Number=1, angle:Number=45, color:uint=0x000000, strength:Number=2, inner:Boolean=false, knockout:Boolean=false, hideObject:Boolean=false, quality:uint=2, remove:Boolean=false, index:int=-1, addFilter:Boolean=false) { super(blurX, blurY, quality, remove, index, addFilter); this.distance = distance; this.alpha = alpha; this.angle = angle; this.color = color; this.strength = strength; this.inner = inner; this.knockout = knockout; this.hideObject = hideObject; } override protected function initEnumerables(nulls:Array, numbers:Array):void { super.initEnumerables(nulls, numbers.concat(["distance","alpha","angle","strength"])); } public static function create(vars:Object):DropShadowFilterVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor) if (vars is DropShadowFilterVars) { return vars as DropShadowFilterVars; } return new DropShadowFilterVars(vars.distance || 0, vars.blurX || 0, vars.blurY || 0, vars.alpha || 0, (vars.angle == null) ? 45 : vars.angle, (vars.color == null) ? 0x000000 : vars.color, (vars.strength == null) ? 2 : vars.strength, Boolean(vars.inner), Boolean(vars.knockout), Boolean(vars.hideObject), vars.quality || 2, vars.remove || false, (vars.index == null) ? -1 : vars.index, vars.addFilter); } //---- GETTERS / SETTERS -------------------------------------------------------------------------------------------- /** Color. **/ public function get color():uint { return uint(_values.color); } public function set color(value:uint):void { setProp("color", value); } /** **/ public function get inner():Boolean { return Boolean(_values.inner); } public function set inner(value:Boolean):void { setProp("inner", value); } /** **/ public function get knockout():Boolean { return Boolean(_values.knockout); } public function set knockout(value:Boolean):void { setProp("knockout", value); } /** **/ public function get hideObject():Boolean { return Boolean(_values.hideObject); } public function set hideObject(value:Boolean):void { setProp("hideObject", value); } } }
import gfx.io.GameDelegate; import skyui.components.list.BasicList; import skyui.components.list.IListProcessor; import skyui.props.PropertyLookup; import skyui.props.CompoundProperty; class skyui.props.PropertyDataExtender implements IListProcessor { /* PRIVATE VARIABLES */ private var _propertyList; private var _iconList; private var _compoundPropertyList; private var _noIconColors: Boolean; /* PROPERTIES */ public var propertiesVar: String; public var iconsVar: String; public var compoundPropVar: String; /* CONSTRUCTORS */ public function PropertyDataExtender(a_configAppearance: Object, a_dataSource: Object, a_propertiesVar: String, a_iconsVar: String, a_compoundPropVar: String) { propertiesVar = a_propertiesVar; iconsVar = a_iconsVar; compoundPropVar = a_compoundPropVar; _propertyList = new Array(); _iconList = new Array(); _compoundPropertyList = new Array(); _noIconColors = a_configAppearance.icons.item.noColor; var propertyLevel = "props"; var compoundLevel = "compoundProps"; // Set up our arrays with information from the config for use in ProcessConfigVars() if (propertiesVar) { var configProperties = a_dataSource[propertiesVar]; if (configProperties instanceof Array) { for (var i=0; i<configProperties.length; i++) { var propName = configProperties[i]; var propertyData = a_dataSource[propertyLevel][propName]; var propLookup = new PropertyLookup(propertyData); _propertyList.push(propLookup); } } } if (iconsVar) { var configIcons = a_dataSource[iconsVar]; if (configIcons instanceof Array) { for (var i=0; i<configIcons.length; i++) { var propName = configIcons[i]; var propertyData = a_dataSource[propertyLevel][propName]; var propLookup = new PropertyLookup(propertyData); _iconList.push(propLookup); } } } if (compoundPropVar) { var configCompoundList = a_dataSource[compoundPropVar]; if (configCompoundList instanceof Array) { for (var i=0; i<configCompoundList.length; i++) { var propName = configCompoundList[i]; var propertyData = a_dataSource[compoundLevel][propName]; var compoundProperty = new CompoundProperty(propertyData); _compoundPropertyList.push(compoundProperty); } } } } /* PUBLIC FUNCTIONS */ // @override IListProcessor public function processList(a_list: BasicList): Void { var entryList = a_list.entryList; for (var i=0; i<entryList.length; i++) processEntry(entryList[i]); } /* PRIVATE FUNCTIONS */ private function processEntry(a_entryObject: Object): Void { // Use the information from the arrays from the config to fill in additional info // Set properties based on other dataMembers and keywords // as defined in the config for (var i=0; i<_propertyList.length; i++) _propertyList[i].processProperty(a_entryObject); // Set iconLabel, iconColor etc (run this even if skse not used) for (var i=0; i<_iconList.length; i++) _iconList[i].processProperty(a_entryObject); // Process compound properties // (concatenate several properties together, used for sorting) for (var i=0; i<_compoundPropertyList.length; i++) _compoundPropertyList[i].processCompoundProperty(a_entryObject); if (_noIconColors && a_entryObject.iconColor != undefined) delete(a_entryObject.iconColor) } }
package org.poly2tri.utils { import flash.utils.Dictionary; import org.poly2tri.Point; import org.poly2tri.Triangle; public class SpatialMesh { protected var mapTriangleToSpatialNode:Dictionary; public var nodes:Vector.<SpatialNode>; public function SpatialMesh() { nodes = new Vector.<SpatialNode>(); mapTriangleToSpatialNode = new Dictionary(); } public function spatialNodeFromPoint(point:Point):SpatialNode { for each (var node:SpatialNode in nodes) { if (node.triangle.pointInsideTriangle(point)) return node; } throw('Point not inside triangles'); } public function getNodeFromTriangle(triangle:Triangle):SpatialNode { if (triangle === null) return null; if (mapTriangleToSpatialNode[triangle] === undefined) { var spatialNode:SpatialNode = mapTriangleToSpatialNode[triangle] = new SpatialNode(); var tp:Vector.<Point> = triangle.points; spatialNode.x = int((tp[0].x + tp[1].x + tp[2].x) / 3); spatialNode.y = int((tp[0].y + tp[1].y + tp[2].y) / 3); spatialNode.z = 0.0; spatialNode.triangle = triangle; spatialNode.G = 0; spatialNode.H = 0; spatialNode.neighbors[0] = triangle.constrained_edge[0] ? null : getNodeFromTriangle(triangle.neighbors[0]); spatialNode.neighbors[1] = triangle.constrained_edge[1] ? null : getNodeFromTriangle(triangle.neighbors[1]); spatialNode.neighbors[2] = triangle.constrained_edge[2] ? null : getNodeFromTriangle(triangle.neighbors[2]); } return mapTriangleToSpatialNode[triangle]; } static public function fromTriangles(triangles:Vector.<Triangle>):SpatialMesh { var sm:SpatialMesh = new SpatialMesh(); for each (var triangle:Triangle in triangles) { sm.nodes.push(sm.getNodeFromTriangle(triangle)); } return sm; } public function toString():String { return 'SpatialMesh(' + nodes.toString() + ')'; } } }
/* Copyright 2008-2011 by the authors of asaplibrary, http://asaplibrary.org Copyright 2005-2007 by the authors of asapframework, http://asapframework.org Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.asaplibrary.ui.form.components { import org.asaplibrary.ui.form.focus.IFocusable; import org.asaplibrary.util.validation.IHasError; import org.asaplibrary.util.validation.IValidatable; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.FocusEvent; import flash.text.TextField; import flash.utils.getQualifiedClassName; /** * UI Component class for text input. * This class provides text input with validation through Validator, focus through FocusManager, and has an error state. * The following requirements must be met to use this class: * <ul> * <li>This class must be linked to a library item of type MovieClip</li> * <li>The library item has a TextField child set to input, with the instance name "tInput"</li> * <li>Optionally, the library item has a MovieClip child with instance name "tError", to be used for displaying an error state</li> * </ul> */ public class InputField extends MovieClip implements IFocusable, IValidatable, IHasError, IResettable { public var tInput : TextField; public var tError : Sprite; protected var mHasFocus : Boolean; protected var mText : String; protected var mHintText : String; protected var mShowsHint : Boolean; protected var mTextColor : uint; protected var mHintTextColor : uint; /** * Constructor */ public function InputField() { // catch events for focus management tInput.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, handleMouseFocusChange, false, 0, true); tInput.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, handleKeyFocusChange, false, 0, true); tInput.addEventListener(FocusEvent.FOCUS_IN, handleFocusIn, false, 0, true); tInput.addEventListener(FocusEvent.FOCUS_OUT, handleFocusOut, false, 0, true); mTextColor = mHintTextColor = tInput.textColor; if (tError) tError.visible = false; } /** * The text in the contained input field */ public function get text() : String { return mShowsHint ? "" : tInput.text; } /** * The text in the contained input field */ public function set text(inText : String) : void { mText = inText; tInput.text = inText; mShowsHint = false; updateHint(); } /** * Set the hint text to be displayed when nothing has been input in the field yet */ public function set hintText(inText : String) : void { mHintText = inText; updateHint(); } /** * Set the colour of the hint text */ public function set hintTextColor(inColor : uint) : void { mHintTextColor = inColor; if (mShowsHint) tInput.textColor = mHintTextColor; } /** * Enable or disable input */ public function setEnabled(inEnable : Boolean) : void { tInput.mouseEnabled = inEnable; } /** * Give focus to this component */ public function setFocus() : void { mHasFocus = true; tInput.setSelection(0, tInput.text.length); stage.focus = tInput; } /** * Clear focus flag */ public function clearFocus() : void { mHasFocus = false; } /** * Return true if this element has focus */ public function hasFocus() : Boolean { return mHasFocus; } /** * Return the value to be validated */ public function getValue() : * { return text; } public function showError() : void { if (tError) tError.visible = true; } public function hideError() : void { if (tError) tError.visible = false; } /** * Reset the input field */ public function reset() : void { text = ""; } /** * Handle FOCUS_IN event from input field */ protected function handleFocusIn(event : FocusEvent) : void { mHasFocus = true; updateHint(); } /** * Handle FOCUS_OUT event from input field */ protected function handleFocusOut(event : FocusEvent) : void { clearFocus(); updateHint(); } /** * Handle KEY_FOCUS_CHANGE event from input field */ protected function handleKeyFocusChange(event : FocusEvent) : void { // prevent default selecting behaviour event.preventDefault(); } /** * Handle MOUSE_FOCUS_CHANGE event from input field */ protected function handleMouseFocusChange(event : FocusEvent) : void { setFocus(); } protected function updateHint() : void { if (!mHintText) return; if (mHasFocus && mShowsHint) { mShowsHint = false; tInput.text = ""; tInput.textColor = mTextColor; } else if (!mHasFocus && !mShowsHint && (tInput.text == "")) { mShowsHint = true; tInput.text = mHintText; tInput.textColor = mHintTextColor; } } override public function toString() : String { return getQualifiedClassName(this) + ":" + name; } } }
package io.decagames.rotmg.pets.windows.yard.list { import flash.display.Sprite; import io.decagames.rotmg.pets.components.petItem.PetItem; import io.decagames.rotmg.ui.buttons.BaseButton; import io.decagames.rotmg.ui.buttons.SliceScalingButton; import io.decagames.rotmg.ui.defaults.DefaultLabelFormat; import io.decagames.rotmg.ui.gird.UIGrid; import io.decagames.rotmg.ui.gird.UIGridElement; import io.decagames.rotmg.ui.labels.UILabel; import io.decagames.rotmg.ui.scroll.UIScrollbar; import io.decagames.rotmg.ui.sliceScaling.SliceScalingBitmap; import io.decagames.rotmg.ui.texture.TextureParser; import io.decagames.rotmg.utils.colors.Tint; public class PetYardList extends Sprite { public static const YARD_HEIGHT:int = 425; public static var YARD_WIDTH:int = 275; public function PetYardList() { super(); this.contentGrid = new UIGrid(YARD_WIDTH - 55, 1, 15); this.contentInset = TextureParser.instance.getSliceScalingBitmap("UI", "popup_content_inset", YARD_WIDTH); addChild(this.contentInset); this.contentInset.height = 425; this.contentInset.x = 0; this.contentInset.y = 0; this.contentTitle = TextureParser.instance.getSliceScalingBitmap("UI", "content_title_decoration", YARD_WIDTH); addChild(this.contentTitle); this.contentTitle.x = 0; this.contentTitle.y = 0; this.title = new UILabel(); this.title.text = "Pet Yard"; DefaultLabelFormat.petNameLabel(this.title, 16777215); this.title.width = YARD_WIDTH; this.title.wordWrap = true; this.title.y = 3; this.title.x = 0; addChild(this.title); this.createScrollview(); this.createPetsGrid(); } private var yardContainer:Sprite; private var contentInset:SliceScalingBitmap; private var contentTitle:SliceScalingBitmap; private var title:UILabel; private var contentGrid:UIGrid; private var contentElement:UIGridElement; private var petGrid:UIGrid; private var _upgradeButton:SliceScalingButton; public function get upgradeButton():BaseButton { return this._upgradeButton; } public function showPetYardRarity(param1:String, param2:Boolean):void { var _loc4_:* = null; var _loc3_:* = null; _loc4_ = TextureParser.instance.getSliceScalingBitmap("UI", "content_divider_smalltitle_white", 180); Tint.add(_loc4_, 3355443, 1); addChild(_loc4_); _loc4_.x = Math.round((YARD_WIDTH - _loc4_.width) / 2); _loc4_.y = 23; _loc3_ = new UILabel(); DefaultLabelFormat.petYardRarity(_loc3_); _loc3_.text = param1; _loc3_.width = _loc4_.width; _loc3_.wordWrap = true; _loc3_.y = _loc4_.y + 2; _loc3_.x = _loc4_.x; addChild(_loc3_); if (param2) { this._upgradeButton = new SliceScalingButton(TextureParser.instance.getSliceScalingBitmap("UI", "upgrade_button")); this._upgradeButton.x = _loc4_.x + _loc4_.width - this._upgradeButton.width + 8; this._upgradeButton.y = _loc4_.y - this._upgradeButton.height / 2 + 8; addChild(this._upgradeButton); } } public function addPet(param1:PetItem):void { var _loc2_:UIGridElement = new UIGridElement(); _loc2_.addChild(param1); this.petGrid.addGridElement(_loc2_); } public function clearPetsList():void { this.petGrid.clearGrid(); } private function createScrollview():void { var _loc2_:Sprite = new Sprite(); this.yardContainer = new Sprite(); this.yardContainer.x = this.contentInset.x; this.yardContainer.y = 2; this.yardContainer.addChild(this.contentGrid); _loc2_.addChild(this.yardContainer); var _loc1_:UIScrollbar = new UIScrollbar(365); _loc1_.mouseRollSpeedFactor = 1; _loc1_.scrollObject = this; _loc1_.content = this.yardContainer; _loc2_.addChild(_loc1_); _loc1_.x = this.contentInset.x + this.contentInset.width - 25; _loc1_.y = 7; var _loc3_:Sprite = new Sprite(); _loc3_.graphics.beginFill(0); _loc3_.graphics.drawRect(0, 0, YARD_WIDTH, 380); _loc3_.x = this.yardContainer.x; _loc3_.y = this.yardContainer.y; this.yardContainer.mask = _loc3_; _loc2_.addChild(_loc3_); addChild(_loc2_); _loc2_.y = 45; } private function createPetsGrid():void { this.contentElement = new UIGridElement(); this.petGrid = new UIGrid(YARD_WIDTH - 55, 5, 5); this.petGrid.x = 18; this.petGrid.y = 8; this.contentElement.addChild(this.petGrid); this.contentGrid.addGridElement(this.contentElement); } } }
package flexUnitTests.as3.mongo.wire.messages { import as3.mongo.db.document.Document; import as3.mongo.wire.messages.MessageFactory; import as3.mongo.wire.messages.client.OpUpdate; import as3.mongo.wire.messages.client.OpUpdateFlags; import org.flexunit.asserts.assertEquals; import org.flexunit.asserts.assertTrue; public class MessageFactory_makeUpsertOpUpdateMessageTests { private var _messageFactory:MessageFactory; private var _testDocument:Document = new Document("document:newValue"); private var _testSelector:Document = new Document("selector:value"); private var _testCollectionName:String = "aCollectionName"; private var _testDBName:String = "aDBName"; private var _testFullCollectionName:String = "aDBName.aCollectionName"; private var _opUpdate:OpUpdate; [Before] public function setUp():void { _messageFactory = new MessageFactory(); _opUpdate = _messageFactory.makeUpsertOpUpdateMessage(_testDBName, _testCollectionName, _testSelector, _testDocument); } [After] public function tearDown():void { _messageFactory = null; _opUpdate = null; } [Test] public function makeUpsertOpUpdateMessage_validInputs_returnsOpUpdateInstance():void { assertTrue(_opUpdate is OpUpdate); } [Test] public function makeUpsertOpUpdateMessage_validInputs_fullCollectionNameIsCorrect():void { assertEquals(_testFullCollectionName, _opUpdate.fullCollectionName); } [Test] public function makeUpsertOpUpdateMessage_validInputs_flagsIsSetToUpsert():void { assertEquals(OpUpdateFlags.UPSERT, _opUpdate.flags); } [Test] public function makeUpserOpUpdateMessage_validInputs_selectorIsSet():void { assertEquals(_testSelector, _opUpdate.selector); } [Test] public function makeUpserOpUpdateMessage_validInputs_documentIsSet():void { assertEquals(_testDocument, _opUpdate.update); } } }
package com.tinyspeck.engine.net { public class NetOutgoingContactListOpenedVO extends NetOutgoingMessageVO { public function NetOutgoingContactListOpenedVO() { super(MessageTypes.CONTACT_LIST_OPENED); } } }
package quickb2.math.geo { import quickb2.lang.foundation.qb2Enum; /** * ... * @author Doug Koellmer */ public class qb2E_GeoIntersectionFlags extends qb2Enum { include "../../../lang/macros/QB2_ENUM"; public static const CURVE_TO_POINT:uint = 0x00000001; public static const CURVE_TO_CURVE:uint = 0x00000002; public static const CURVE_TO_SURFACE:uint = 0x00000004; public static const SURFACE_TO_SURFACE:uint = 0x00000008; } }
package kabam.rotmg.account.securityQuestions.data { public class SecurityQuestionsData { public var answers:Array; public function SecurityQuestionsData() { answers = []; super(); } } }
package APIPlox { public class PLOX_LogoPane extends BaseObject implements PLOX_Pane { private var logo : Logo_Small; private var w : int; private var h : int; public function PLOX_LogoPane(width : int, height : int) { super(); w = width; h = height; init(); } public function Selected():void { //Nothing } private function init() : void { logo = new Logo_Small(); logo.gotoAndStop(Internationalisation.GetLogoFrame()); addChild(logo); Refresh(); } public function Resize(newW:int, newH:int):void { w=newW; h=newH; Refresh(); } public function Refresh():void { graphics.clear(); graphics.beginFill(0x121245, 1); graphics.drawRoundRect(0,0,w,h,16,16); graphics.endFill(); logo.x = w/2; logo.y = h/2; } } }
package awaybuilder.model { import away3d.animators.AnimationSetBase; import away3d.animators.AnimatorBase; import away3d.animators.SkeletonAnimationSet; import away3d.animators.SkeletonAnimator; import away3d.animators.VertexAnimationSet; import away3d.animators.VertexAnimator; import away3d.animators.data.Skeleton; import away3d.cameras.Camera3D; import away3d.cameras.lenses.LensBase; import away3d.cameras.lenses.OrthographicLens; import away3d.cameras.lenses.OrthographicOffCenterLens; import away3d.cameras.lenses.PerspectiveLens; import away3d.containers.ObjectContainer3D; import away3d.core.base.Geometry; import away3d.entities.Mesh; import away3d.entities.TextureProjector; import away3d.library.assets.IAsset; import away3d.lights.DirectionalLight; import away3d.lights.LightBase; import away3d.lights.PointLight; import away3d.lights.shadowmaps.CascadeShadowMapper; import away3d.lights.shadowmaps.CubeMapShadowMapper; import away3d.lights.shadowmaps.DirectionalShadowMapper; import away3d.lights.shadowmaps.NearDirectionalShadowMapper; import away3d.lights.shadowmaps.ShadowMapperBase; import away3d.materials.SinglePassMaterialBase; import away3d.materials.TextureMaterial; import away3d.materials.lightpickers.StaticLightPicker; import away3d.materials.methods.AlphaMaskMethod; import away3d.materials.methods.AnisotropicSpecularMethod; import away3d.materials.methods.BasicAmbientMethod; import away3d.materials.methods.BasicDiffuseMethod; import away3d.materials.methods.BasicNormalMethod; import away3d.materials.methods.BasicSpecularMethod; import away3d.materials.methods.CascadeShadowMapMethod; import away3d.materials.methods.CelDiffuseMethod; import away3d.materials.methods.CelSpecularMethod; import away3d.materials.methods.ColorMatrixMethod; import away3d.materials.methods.ColorTransformMethod; import away3d.materials.methods.DitheredShadowMapMethod; import away3d.materials.methods.EffectMethodBase; import away3d.materials.methods.EnvMapAmbientMethod; import away3d.materials.methods.EnvMapMethod; import away3d.materials.methods.FilteredShadowMapMethod; import away3d.materials.methods.FogMethod; import away3d.materials.methods.FresnelEnvMapMethod; import away3d.materials.methods.FresnelSpecularMethod; import away3d.materials.methods.GradientDiffuseMethod; import away3d.materials.methods.HardShadowMapMethod; import away3d.materials.methods.HeightMapNormalMethod; import away3d.materials.methods.LightMapDiffuseMethod; import away3d.materials.methods.LightMapMethod; import away3d.materials.methods.NearShadowMapMethod; import away3d.materials.methods.OutlineMethod; import away3d.materials.methods.PhongSpecularMethod; import away3d.materials.methods.ProjectiveTextureMethod; import away3d.materials.methods.RefractionEnvMapMethod; import away3d.materials.methods.RimLightMethod; import away3d.materials.methods.ShadingMethodBase; import away3d.materials.methods.SimpleWaterNormalMethod; import away3d.materials.methods.SoftShadowMapMethod; import away3d.materials.methods.SubsurfaceScatteringDiffuseMethod; import away3d.materials.methods.WrapDiffuseMethod; import away3d.primitives.CapsuleGeometry; import away3d.primitives.ConeGeometry; import away3d.primitives.CubeGeometry; import away3d.primitives.CylinderGeometry; import away3d.primitives.PlaneGeometry; import away3d.primitives.PrimitiveBase; import away3d.primitives.SkyBox; import away3d.primitives.SphereGeometry; import away3d.primitives.TorusGeometry; import away3d.textures.BitmapCubeTexture; import away3d.textures.CubeTextureBase; import away3d.textures.Texture2DBase; import awaybuilder.model.vo.scene.AnimationSetVO; import awaybuilder.model.vo.scene.AnimatorVO; import awaybuilder.model.vo.scene.AssetVO; import awaybuilder.model.vo.scene.CameraVO; import awaybuilder.model.vo.scene.ContainerVO; import awaybuilder.model.vo.scene.CubeTextureVO; import awaybuilder.model.vo.scene.EffectVO; import awaybuilder.model.vo.scene.GeometryVO; import awaybuilder.model.vo.scene.LensVO; import awaybuilder.model.vo.scene.LightPickerVO; import awaybuilder.model.vo.scene.LightVO; import awaybuilder.model.vo.scene.MaterialVO; import awaybuilder.model.vo.scene.MeshVO; import awaybuilder.model.vo.scene.ShadingMethodVO; import awaybuilder.model.vo.scene.ShadowMapperVO; import awaybuilder.model.vo.scene.ShadowMethodVO; import awaybuilder.model.vo.scene.SkeletonVO; import awaybuilder.model.vo.scene.SkyBoxVO; import awaybuilder.model.vo.scene.TextureProjectorVO; import awaybuilder.utils.AssetUtil; import flash.geom.ColorTransform; import flash.utils.getQualifiedClassName; import mx.utils.UIDUtil; public class AssetsModel extends SmartFactoryModelBase { public function GetObjectsByType( type:Class, property:String=null, value:Object=null ):Vector.<Object> { var objects:Vector.<Object> = new Vector.<Object>(); for (var object:Object in _assets) { if( object is type ) { if( property ) { if( (object[property] == value) ) { objects.push( object ); } } else { objects.push( object ); } } } return objects; } public function RemoveObject( obj:Object ):void { var asset:AssetVO = _assets[obj] as AssetVO; delete _objectsByAsset[asset]; delete _assets[obj]; } public function ReplaceObject( oldObject:Object, newObject:Object ):void { var asset:AssetVO = _assets[oldObject]; _objectsByAsset[asset] = newObject; _assets[newObject] = asset; delete _assets[oldObject]; } public function GetObject( asset:AssetVO ):Object { if( !asset ) return null; return _objectsByAsset[asset]; } override public function GetAsset( obj:Object ):AssetVO { if( !obj ) return null; if( _assets[obj] ) return _assets[obj]; var asset:AssetVO = createAsset( obj ); if ((obj is IAsset) && (obj.id)) { asset.id = obj.id; } else { asset.id = UIDUtil.createUID(); if (obj is IAsset) { obj.id = asset.id; } } _assets[obj] = asset; _objectsByAsset[asset] = obj; return asset; } public function CreateAnimationSet( type:String ):AnimationSetVO { var animation:AnimationSetBase; switch( type ) { case "VertexAnimationSet": animation = new VertexAnimationSet(); animation.name = "VertexAnimationSet" + AssetUtil.GetNextId("VertexAnimationSet"); break; case "SkeletonAnimationSet": animation = new SkeletonAnimationSet(); animation.name = "SkeletonAnimationSet" + AssetUtil.GetNextId("SkeletonAnimationSet"); break; } return GetAsset( animation ) as AnimationSetVO; } public function CreateAnimator( type:String, animationSet:AnimationSetVO, skeleton:SkeletonVO=null ):AnimatorVO { var animator:AnimatorBase; switch( type ) { case "UVAnimator": break; case "ParticleAnimator": break; case "SkeletonAnimator": animator = new SkeletonAnimator(GetObject(animationSet) as SkeletonAnimationSet,GetObject(skeleton) as Skeleton ); animator.name = "SkeletonAnimator" + AssetUtil.GetNextId("SkeletonAnimator"); break; case "VertexAnimator": animator = new VertexAnimator(GetObject(animationSet) as VertexAnimationSet); animator.name = "VertexAnimator" + AssetUtil.GetNextId("VertexAnimator"); break; } animator.updatePosition = false; return GetAsset( animator ) as AnimatorVO; } public function CreateMaterial( clone:MaterialVO = null ):MaterialVO { if( !clone ) { clone = defaultMaterial; } var newMaterial:SinglePassMaterialBase; var textureMaterial:TextureMaterial = GetObject(clone) as TextureMaterial; newMaterial = new TextureMaterial( textureMaterial.texture, textureMaterial.smooth, textureMaterial.repeat, textureMaterial.mipmap ); newMaterial.name = "Material" + AssetUtil.GetNextId("Material"); newMaterial.gloss = 50; return GetAsset(newMaterial) as MaterialVO; } public function CreateLens( type:String ):LensVO { var lens:LensBase = new LensBase(); switch( type ) { case "PerspectiveLens": lens = new PerspectiveLens(); break; case "OrthographicLens": lens = new OrthographicLens( 600 ); break; case "OrthographicOffCenterLens": lens = new OrthographicOffCenterLens( -400, 400, -300, 300 ); break; } return GetAsset(lens) as LensVO; } public function CreateCamera():CameraVO { var camera:Camera3D = new Camera3D(); camera.name = "Camera" + AssetUtil.GetNextId("Camera"); camera.x = camera.y = camera.z = 0; return GetAsset(camera) as CameraVO; } public function CreateProjectiveTextureMethod( textureProjector:TextureProjectorVO ):EffectVO { var method:EffectMethodBase = new ProjectiveTextureMethod( GetObject(textureProjector) as TextureProjector ); method.name = "ProjectiveTexture " + AssetUtil.GetNextId("ProjectiveTexture"); return GetAsset( method ) as EffectVO; } public function CreateEffectMethod( type:String ):EffectVO { var method:EffectMethodBase; switch( type ) { case "LightMapMethod": method = new LightMapMethod(GetObject(defaultTexture) as Texture2DBase); method.name = "LightMap" + AssetUtil.GetNextId("LightMapMethod"); break; case "RimLightMethod": method = new RimLightMethod(); method.name = "RimLight" + AssetUtil.GetNextId("RimLightMethod"); break; case "ColorTransformMethod": method = new ColorTransformMethod(); ColorTransformMethod(method).colorTransform = new ColorTransform(); method.name = "ColorTransform" + AssetUtil.GetNextId("ColorTransformMethod"); break; case "AlphaMaskMethod": method = new AlphaMaskMethod(GetObject(defaultTexture) as Texture2DBase, false); method.name = "AlphaMask" + AssetUtil.GetNextId("AlphaMaskMethod"); break; case "ColorMatrixMethod": method = new ColorMatrixMethod([ 0.2225, 0.7169, 0.0606, 0, 0, 0.2225, 0.7169, 0.0606, 0, 0, 0.2225, 0.7169, 0.0606, 0, 0, 0, 0, 0, 1, 1]); method.name = "ColorMatrix" + AssetUtil.GetNextId("ColorMatrixMethod"); break; case "RefractionEnvMapMethod": method = new RefractionEnvMapMethod( GetObject(defaultCubeTexture) as CubeTextureBase ); method.name = "RefractionEnvMap" + AssetUtil.GetNextId("RefractionEnvMapMethod"); break; case "OutlineMethod": method = new OutlineMethod(); method.name = "Outline" + AssetUtil.GetNextId("OutlineMethod"); break; case "FresnelEnvMapMethod": method = new FresnelEnvMapMethod( GetObject(defaultCubeTexture) as CubeTextureBase ); method.name = "FresnelEnvMap" + AssetUtil.GetNextId("FresnelEnvMapMethod"); break; case "FogMethod": method = new FogMethod(0,1000); method.name = "Fog" + AssetUtil.GetNextId("FogMethod"); break; case "EnvMapMethod": method = new EnvMapMethod( GetObject(defaultCubeTexture) as CubeTextureBase ); method.name = "EnvMap" + AssetUtil.GetNextId("EnvMapMethod"); EnvMapMethod(method).mask = GetObject(defaultTexture) as Texture2DBase; break; } return GetAsset( method ) as EffectVO; } public function CreateSkyBox():SkyBoxVO { var mesh:SkyBox = new SkyBox( GetObject(defaultCubeTexture) as CubeTextureBase ); mesh.name = "SkyBox" + AssetUtil.GetNextId("SkyBox"); return GetAsset( mesh ) as SkyBoxVO; } public function CreateTextureProjector():TextureProjectorVO { var projector:TextureProjector = new TextureProjector( GetObject(defaultTexture) as Texture2DBase ); projector.name = "TextureProjector" + AssetUtil.GetNextId("TextureProjector"); return GetAsset( projector ) as TextureProjectorVO; } public function CreateContainer():ContainerVO { var obj:ObjectContainer3D = new ObjectContainer3D(); obj.name = "Container" + AssetUtil.GetNextId("ObjectContainer3D"); return GetAsset( obj ) as ContainerVO; } public function CreateMesh( geometry:GeometryVO ):MeshVO { var mesh:Mesh = new Mesh( GetObject(geometry) as Geometry ); mesh.name = "Mesh" + AssetUtil.GetNextId("Mesh"); return GetAsset( mesh ) as MeshVO; } public function CreateGeometry( type:String ):GeometryVO { var georM:TorusGeometry var geometry:PrimitiveBase; switch( type ) { case "PlaneGeometry": geometry = new PlaneGeometry(); geometry.name = "PlaneGeometry" + AssetUtil.GetNextId("PlaneGeometry"); break; case "CubeGeometry": geometry = new CubeGeometry(); geometry.name = "CubeGeometry" + AssetUtil.GetNextId("CubeGeometry"); break; case "SphereGeometry": geometry = new SphereGeometry(); geometry.name = "SphereGeometry" + AssetUtil.GetNextId("SphereGeometry"); break; case "CylinderGeometry": geometry = new CylinderGeometry(); geometry.name = "CylinderGeometry" + AssetUtil.GetNextId("CylinderGeometry"); break; case "ConeGeometry": geometry = new ConeGeometry(); geometry.name = "ConeGeometry" + AssetUtil.GetNextId("ConeGeometry"); break; case "CapsuleGeometry": geometry = new CapsuleGeometry(); geometry.name = "CapsuleGeometry" + AssetUtil.GetNextId("CapsuleGeometry"); break; case "TorusGeometry": geometry = new TorusGeometry(); geometry.name = "TorusGeometry" + AssetUtil.GetNextId("TorusGeometry"); break; } return GetAsset( geometry ) as GeometryVO; } public function CreateCubeTexture():CubeTextureVO { var light:BitmapCubeTexture = new BitmapCubeTexture( getChekerboard(0xFFFFFF), getChekerboard(0xAAAAAA), getChekerboard(0xEEEEEE), getChekerboard(0xDDDDDD), getChekerboard(0xCCCCCC), getChekerboard(0xBBBBBB) ); light.name = "Cube " + AssetUtil.GetNextId("Cube"); return GetAsset( light ) as CubeTextureVO; } public function CreateDirectionalLight():LightVO { var light:DirectionalLight = new DirectionalLight(); light.name = "DirectionalLight " + AssetUtil.GetNextId("directionalLight"); light.castsShadows = false; return GetAsset( light ) as LightVO; } public function CreatePointLight():LightVO { var light:PointLight = new PointLight(); light.name = "PointLight " + AssetUtil.GetNextId("pointLight"); light.radius = 1000; light.fallOff = 3000; light.castsShadows = false; return GetAsset( light ) as LightVO; } public function CreateLightPicker():LightPickerVO { var lightPicker:StaticLightPicker = new StaticLightPicker([]); lightPicker.name = "Light Picker " + AssetUtil.GetNextId("lightPicker"); return GetAsset( lightPicker ) as LightPickerVO; } public function CreateFilteredShadowMapMethod( light:LightVO ):ShadowMethodVO { var method:FilteredShadowMapMethod = new FilteredShadowMapMethod( GetObject(light) as DirectionalLight ); method.name = "FilteredShadow" + AssetUtil.GetNextId("FilteredShadowMapMethod"); return GetAsset( method ) as ShadowMethodVO; } public function CreateDitheredShadowMapMethod( light:LightVO ):ShadowMethodVO { var method:DitheredShadowMapMethod = new DitheredShadowMapMethod( GetObject(light) as DirectionalLight ); method.name = "DitheredShadow" + AssetUtil.GetNextId("DitheredShadowMapMethod"); return GetAsset( method ) as ShadowMethodVO; } public function CreateSoftShadowMapMethod( light:LightVO ):ShadowMethodVO { var method:SoftShadowMapMethod = new SoftShadowMapMethod( GetObject(light) as DirectionalLight ); method.name = "SoftShadow" + AssetUtil.GetNextId("SoftShadowMapMethod"); return GetAsset( method ) as ShadowMethodVO; } public function CreateHardShadowMapMethod( light:LightVO ):ShadowMethodVO { var method:HardShadowMapMethod = new HardShadowMapMethod( GetObject(light) as LightBase ); method.name = "HardShadow" + AssetUtil.GetNextId("HardShadowMapMethod"); return GetAsset( method ) as ShadowMethodVO; } public function CreateNearShadowMapMethod( light:LightVO ):ShadowMethodVO { var simple:SoftShadowMapMethod = new SoftShadowMapMethod( GetObject(light) as DirectionalLight ); var method:NearShadowMapMethod = new NearShadowMapMethod( simple ); method.name = "NearShadow" + AssetUtil.GetNextId("NearShadowMapMethod"); var asset:ShadowMethodVO = GetAsset( method ) as ShadowMethodVO;; asset.baseMethod = GetAsset( simple ) as ShadowMethodVO; return asset; } public function CreateCascadeShadowMapMethod( light:LightVO ):ShadowMethodVO { var simple:SoftShadowMapMethod = new SoftShadowMapMethod( GetObject(light) as DirectionalLight ); var method:CascadeShadowMapMethod = new CascadeShadowMapMethod( simple ); method.name = "CascadeShadow" + AssetUtil.GetNextId("CascadeShadowMapMethod"); return GetAsset( method ) as ShadowMethodVO; } public function CreateShadingMethod( type:String ):ShadingMethodVO { var baseMethod:ShadingMethodBase; var method:ShadingMethodBase; switch( type ) { case "BasicAmbientMethod": method = new BasicAmbientMethod(); break; case "EnvMapAmbientMethod": method = new EnvMapAmbientMethod(GetObject(defaultCubeTexture) as CubeTextureBase); break; case "BasicDiffuseMethod": method = new BasicDiffuseMethod(); break; case "GradientDiffuseMethod": method = new GradientDiffuseMethod(GetObject(defaultTexture) as Texture2DBase); break; case "WrapDiffuseMethod": method = new WrapDiffuseMethod(); break; case "LightMapDiffuseMethod": baseMethod = new BasicDiffuseMethod(); method = new LightMapDiffuseMethod(GetObject(defaultTexture) as Texture2DBase,"multiply",false, baseMethod as BasicDiffuseMethod); break; case "CelDiffuseMethod": baseMethod = new BasicDiffuseMethod(); method = new CelDiffuseMethod(3,baseMethod as BasicDiffuseMethod); break; case "SubsurfaceScatteringDiffuseMethod": baseMethod = new BasicDiffuseMethod(); method = new SubsurfaceScatteringDiffuseMethod(); // SubsurfaceScatteringDiffuseMethod(method).baseMethod = baseMethod as BasicDiffuseMethod; break; case "BasicSpecularMethod": method = new BasicSpecularMethod(); break; case "AnisotropicSpecularMethod": method = new AnisotropicSpecularMethod(); break; case "PhongSpecularMethod": method = new PhongSpecularMethod(); break; case "CelSpecularMethod": method = new CelSpecularMethod(); break; case "FresnelSpecularMethod": baseMethod = new BasicSpecularMethod(); method = new FresnelSpecularMethod( true, baseMethod as BasicSpecularMethod ); break; case "BasicNormalMethod": method = new BasicNormalMethod(); break; case "HeightMapNormalMethod": method = new HeightMapNormalMethod(GetObject(defaultTexture) as Texture2DBase,5,5,5); break; case "SimpleWaterNormalMethod": method = new SimpleWaterNormalMethod(GetObject(defaultTexture) as Texture2DBase,GetObject(defaultTexture) as Texture2DBase); break; } return GetAsset( method ) as ShadingMethodVO; } public function CreateShadowMapper( type:String ):ShadowMapperVO { var mapper:ShadowMapperBase; switch( type ) { case "DirectionalShadowMapper": mapper = new DirectionalShadowMapper(); break; case "CascadeShadowMapper": mapper = new CascadeShadowMapper(); break; case "NearDirectionalShadowMapper": mapper = new NearDirectionalShadowMapper(); break; case "CubeMapShadowMapper": mapper = new CubeMapShadowMapper(); break; } return GetAsset( mapper ) as ShadowMapperVO; } public function checkEffectMethodForDefaulttexture( method:EffectMethodBase ):void { if (method is EnvMapMethod ){ if(EnvMapMethod (method).envMap.name=="defaultTexture"){ EnvMapMethod (method).envMap=GetObject(defaultCubeTexture) as BitmapCubeTexture; } if(EnvMapMethod (method).mask){ if(EnvMapMethod (method).mask.name=="defaultTexture"){ EnvMapMethod (method).mask=GetObject(defaultTexture) as Texture2DBase; } } } if (method is LightMapMethod){ if(LightMapMethod (method).texture.name=="defaultTexture"){ LightMapMethod (method).texture=GetObject(defaultTexture) as Texture2DBase; } } if (method is AlphaMaskMethod){ if(AlphaMaskMethod (method).texture.name=="defaultTexture"){ AlphaMaskMethod (method).texture=GetObject(defaultTexture) as Texture2DBase; } } if (method is RefractionEnvMapMethod){ if(RefractionEnvMapMethod (method).envMap.name=="defaultTexture"){ RefractionEnvMapMethod (method).envMap=GetObject(defaultCubeTexture) as BitmapCubeTexture; } } if (method is FresnelEnvMapMethod){ if(FresnelEnvMapMethod(method).envMap.name=="defaultTexture"){ FresnelEnvMapMethod (method).envMap=GetObject(defaultCubeTexture) as BitmapCubeTexture; } } } public function checkIfMaterialIsDefault( mat:TextureMaterial ):Boolean { var defaultMat:TextureMaterial=GetObject(defaultMaterial) as TextureMaterial; //first check the textures (before returning false); if (mat.normalMap) if (mat.normalMap.name=="defaultTexture") mat.normalMap=GetObject(defaultTexture) as Texture2DBase; if (mat.specularMap) if (mat.specularMap.name=="defaultTexture") mat.texture=GetObject(defaultTexture) as Texture2DBase; if (mat.ambientTexture) if (mat.ambientTexture.name=="defaultTexture") mat.texture=GetObject(defaultTexture) as Texture2DBase; if (mat.texture) if (mat.texture.name=="defaultTexture") mat.texture=GetObject(defaultTexture) as Texture2DBase; var i:int; for (i=0;i<mat.numMethods;i++){ checkEffectMethodForDefaulttexture(mat.getMethodAt(i)); } // now all texutures are checked and replaced with defaults // check each material-property, and return false, if it is not default if ((mat.name!="Default")&& (mat.name!="defaultMaterial"))return false; if (getQualifiedClassName( mat.ambientMethod ).split("::")[1]!="BasicAmbientMethod")return false; if (getQualifiedClassName( mat.diffuseMethod ).split("::")[1]!="BasicDiffuseMethod")return false; if (getQualifiedClassName( mat.specularMethod ).split("::")[1]!="BasicSpecularMethod")return false; if (getQualifiedClassName( mat.normalMethod ).split("::")[1]!="BasicNormalMethod")return false; if (mat.numMethods!=defaultMat.numMethods)return false; if (mat.alpha!=defaultMat.alpha)return false; if (mat.alphaBlending!=defaultMat.alphaBlending)return false; if (mat.alphaPremultiplied!=defaultMat.alphaPremultiplied)return false; if (mat.alphaThreshold!=defaultMat.alphaThreshold)return false; if (mat.ambient!=defaultMat.ambient)return false; if (mat.ambientColor!=defaultMat.ambientColor)return false; if (mat.blendMode!=defaultMat.blendMode)return false; if (mat.bothSides!=defaultMat.bothSides)return false; if (mat.gloss!=defaultMat.gloss)return false; //if (mat.mipmap!=defaultMat.mipmap)return false; //if (mat.smooth!=defaultMat.smooth)return false; if (mat.specular!=defaultMat.specular)return false; if (mat.specularColor!=defaultMat.specularColor)return false; if (mat.normalMap!=defaultMat.normalMap)return false; if (mat.texture!=defaultMat.texture)return false; if (mat.specularMap!=defaultMat.specularMap)return false; if (mat.specularMap!=defaultMat.specularMap)return false; return true; } } }
package com.kyo.media.simpleVideo.utils { import flash.events.EventDispatcher; import flash.events.IEventDispatcher; import flash.events.TimerEvent; import flash.utils.Timer; public class MissionTimer extends EventDispatcher { /** * 函数延时调用 * @param whatFunctionToDelay 希望延时的函数 * @param delayInMilliseconds 延长时间,以微秒为单位 * @param params 函数被调用时要传入的参数 * */ public function MissionTimer(whatFunctionToDelay:Function, delayInMilliseconds:Number, params:Array=null) { super(); delayedFunction = whatFunctionToDelay; funcParams = params; if(delayInMilliseconds == 0){ doMission(); return; } myTimer = new Timer(delayInMilliseconds, 1); myTimer.addEventListener(TimerEvent.TIMER, doMission); myTimer.start(); } private var myTimer:Timer; private var delayedFunction:Function; public var funcParams:Array; public function pause():void{ } public function resume():void{ } private function doMission(...args):void { if(myTimer){ myTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, doMission); myTimer.stop(); } //trace("delayyedFunction: " + this.delayedFunction); delayedFunction.apply(null, funcParams); } /** * 取消延时调用 * */ public function stop():void { if(myTimer){ myTimer.stop(); myTimer.reset(); myTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, doMission); myTimer = null; } delayedFunction = null; funcParams = null; } } }
//---------------------------------------------------------------------------------------------------- // MIDI sound module operator // Copyright (c) 2011 keim All rights reserved. // Distributed under BSD-style license (see org.si.license.txt). //---------------------------------------------------------------------------------------------------- package org.si.sion.midi { /** MIDI sound module channel */ public class MIDIModuleChannel { // variables //-------------------------------------------------------------------------------- /** active operator count of this channel */ public var activeOperatorCount:int; /** maximum operator limit of this channel */ public var maxOperatorCount:int; public var drumMode:int; public var mute:Boolean; public var programNumber:int; public var pan:int; public var modulation:int; public var pitchBend:int; public var channelAfterTouch:int; public var sustainPedal:Boolean; public var portamento:Boolean; public var portamentoTime:int; public var masterFineTune:int; public var masterCoarseTune:int; public var pitchBendSensitivity:int; public var modulationCycleTime:int; public var eventTriggerID:int; public var eventTriggerTypeOn:int; public var eventTriggerTypeOff:int; public var bankNumber:int; /** @private */ internal var _sionVolumes:Vector.<int> = new Vector.<int>(8); /** @private */ internal var _effectSendLevels:Vector.<int> = new Vector.<int>(8); private var _expression:int; private var _masterVolume:int; // properties //-------------------------------------------------------------------------------- /** master volume (0-127) */ public function get masterVolume() : int { return _masterVolume; } public function set masterVolume(v:int) : void { _masterVolume = v; _updateVolumes(); } /** expression (0-127) */ public function get expression() : int { return _expression; } public function set expression(e:int) : void { _expression = e; _updateVolumes(); } // update all volumes of SiON tracks private function _updateVolumes() : void { var v:int = (_masterVolume * _expression + 64) >> 7; _sionVolumes[0] = _effectSendLevels[0] = v; for (var i:int =1; i<8; i++) { _sionVolumes[i] = (v * _effectSendLevels[i] + 64) >> 7; } } // constructor //-------------------------------------------------------------------------------- /** @private */ function MIDIModuleChannel() { mute = false; eventTriggerID = 0; eventTriggerTypeOn = 0; eventTriggerTypeOff = 0; reset(); } // operations //-------------------------------------------------------------------------------- /** reset this channel */ public function reset() : void { activeOperatorCount = 0; maxOperatorCount = 1024; //mute = false; drumMode = 0; programNumber = 0; _expression = 127; _masterVolume = 64; pan = 0; modulation = 0; pitchBend = 0; channelAfterTouch = 0; sustainPedal = false; portamento = false; portamentoTime = 0; masterFineTune = 0; masterCoarseTune = 0; pitchBendSensitivity = 2; modulationCycleTime = 180; bankNumber = 0; _sionVolumes[0] = _masterVolume; _effectSendLevels[0] = _masterVolume; for (var i:int = 1; i<8; i++) { _sionVolumes[i] = 0; _effectSendLevels[i] = 0; } } /** get effect send level * @param slotNumber effect slot number (1-8) * @return effect send level */ public function getEffectSendLevel(slotNumber:int) : int { return _effectSendLevels[slotNumber]; } /** set effect send level * @param slotNumber effect slot number (1-8) * @param level effect send level (0-127) */ public function setEffectSendLevel(slotNumber:int, level:int) : void { _effectSendLevels[slotNumber] = level; _sionVolumes[slotNumber] = (_effectSendLevels[0] * _effectSendLevels[slotNumber] + 64) >> 7; } /** set event trigger of this channel * @param id Event trigger ID of this track. This value can be refered from SiONTrackEvent.eventTriggerID. * @param noteOnType Dispatching event type at note on. 0=no events, 1=NOTE_ON_FRAME, 2=NOTE_ON_STREAM, 3=both. * @param noteOffType Dispatching event type at note off. 0=no events, 1=NOTE_OFF_FRAME, 2=NOTE_OFF_STREAM, 3=both. * @see org.si.sion.events.SiONTrackEvent */ public function setEventTrigger(id:int, noteOnType:int=1, noteOffType:int=0) : void { eventTriggerID = id; eventTriggerTypeOn = noteOnType; eventTriggerTypeOff = noteOffType; } } }
package org.menacheri.jetclient.communication { import flash.utils.ByteArray; /** * Not completed yet! A thin wrapper over ByteArray which will provide utility methods for writing and reading multiple Strings. * @author Abraham Menacherry */ public class MessageBuffer { private var buffer:ByteArray; public function MessageBuffer(byteArray:ByteArray) { if (null == byteArray) { buffer = new ByteArray(); } else{ buffer = byteArray; } } /** * Writes multiple Strings to the underlying ByteArray. Each string is written as <length><bytes of string> * to the array since JetServer protocol expects it in this way. * @param ... args */ public function writeMultiStrings(... args):void { for (var i:int = 0; i < args.length; i++) { writeString(args[i]) } } /** * Each string is written as <length><bytes of string> to the array since JetServer protocol expects it in this way * @param theString */ public function writeString(theString:String):void { var bytes:ByteArray = new ByteArray(); bytes.writeUTFBytes(theString); return writeBytes(bytes); } /** * Reads the length and then the actual string of that length from the underlying buffer. * @return */ public function readString():String { var utfBytes:ByteArray = readBytes(); var str:String = null; if (utfBytes != null) { str = utfBytes.readUTF(); } return str; } /** * Writes bytes to the underlying buffer, with the length of the bytes prepended. * @param bytes */ public function writeBytes(bytes:ByteArray):void { buffer.writeShort(bytes.length); buffer.writeBytes(bytes); } public function readBytes():ByteArray { var length:int = buffer.readShort(); var bytes:ByteArray = null; if ((length > 0) && buffer.bytesAvailable >= length) { bytes = new ByteArray(); buffer.readBytes(bytes); } return bytes; } public function getBuffer():ByteArray { return buffer; } } }
/* * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ package Box2D.Dynamics{ import Box2D.Common.Math.*; import Box2D.Common.b2internal; use namespace b2internal; /** * This holds contact filtering data. */ public class b2FilterData { public function Copy() : b2FilterData { var copy: b2FilterData = new b2FilterData(); copy.categoryBits = categoryBits; copy.maskBits = maskBits; copy.groupIndex = groupIndex; return copy; } /** * The collision category bits. Normally you would just set one bit. */ public var categoryBits: uint = 0x0001; /** * The collision mask bits. This states the categories that this * shape would accept for collision. */ public var maskBits: uint = 0xFFFF; /** * Collision groups allow a certain group of objects to never collide (negative) * or always collide (positive). Zero means no collision group. Non-zero group * filtering always wins against the mask bits. */ public var groupIndex: int = 0; } }
/* Feathers Copyright 2012-2013 Joshua Tynjala. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.dragDrop { /** * Stores data associated with a drag and drop operation. * * @see DragDropManager */ public class DragData { /** * Constructor. */ public function DragData() { } /** * @private */ protected var _data:Object = {}; /** * Determines if the specified data format is available. */ public function hasDataForFormat(format:String):Boolean { return this._data.hasOwnProperty(format); } /** * Returns data for the specified format. */ public function getDataForFormat(format:String):* { if(this._data.hasOwnProperty(format)) { return this._data[format]; } return undefined; } /** * Saves data for the specified format. */ public function setDataForFormat(format:String, data:*):void { this._data[format] = data; } /** * Removes all data for the specified format. */ public function clearDataForFormat(format:String):* { var data:* = undefined; if(this._data.hasOwnProperty(format)) { data = this._data[format]; } delete this._data[format]; return data; } } }
/* Feathers Copyright 2012-2013 Joshua Tynjala. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ package feathers.layout { import feathers.core.IFeathersControl; import flash.geom.Point; import starling.display.DisplayObject; import starling.events.Event; import starling.events.EventDispatcher; /** * @inheritDoc */ [Event(name="change",type="starling.events.Event")] /** * Positions items from top to bottom in a single column. * * @see http://wiki.starling-framework.org/feathers/vertical-layout */ public class VerticalLayout extends EventDispatcher implements IVariableVirtualLayout, ITrimmedVirtualLayout { /** * If the total item height is smaller than the height of the bounds, * the items will be aligned to the top. */ public static const VERTICAL_ALIGN_TOP:String = "top"; /** * If the total item height is smaller than the height of the bounds, * the items will be aligned to the middle. */ public static const VERTICAL_ALIGN_MIDDLE:String = "middle"; /** * If the total item height is smaller than the height of the bounds, * the items will be aligned to the bottom. */ public static const VERTICAL_ALIGN_BOTTOM:String = "bottom"; /** * The items will be aligned to the left of the bounds. */ public static const HORIZONTAL_ALIGN_LEFT:String = "left"; /** * The items will be aligned to the center of the bounds. */ public static const HORIZONTAL_ALIGN_CENTER:String = "center"; /** * The items will be aligned to the right of the bounds. */ public static const HORIZONTAL_ALIGN_RIGHT:String = "right"; /** * The items will fill the width of the bounds. */ public static const HORIZONTAL_ALIGN_JUSTIFY:String = "justify"; /** * Constructor. */ public function VerticalLayout() { } /** * @private */ protected var _heightCache:Array = []; /** * @private */ protected var _discoveredItemsCache:Vector.<DisplayObject> = new <DisplayObject>[]; /** * @private */ protected var _gap:Number = 0; /** * THe space, in pixels, between items. */ 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>paddingTop</code>, but the other padding values may be * different. */ public function get padding():Number { return this._paddingTop; } /** * @private */ public function set padding(value:Number):void { this.paddingTop = value; this.paddingRight = value; this.paddingBottom = value; this.paddingLeft = value; } /** * @private */ protected var _paddingTop:Number = 0; /** * The space, in pixels, that appears on top, before the first item. */ public function get paddingTop():Number { return this._paddingTop; } /** * @private */ public function set paddingTop(value:Number):void { if(this._paddingTop == value) { return; } this._paddingTop = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _paddingRight:Number = 0; /** * The minimum space, in pixels, to the right of the items. */ 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 _paddingBottom:Number = 0; /** * The space, in pixels, that appears on the bottom, after the last * item. */ public function get paddingBottom():Number { return this._paddingBottom; } /** * @private */ public function set paddingBottom(value:Number):void { if(this._paddingBottom == value) { return; } this._paddingBottom = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _paddingLeft:Number = 0; /** * The minimum space, in pixels, to the left of the items. */ 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 _verticalAlign:String = VERTICAL_ALIGN_TOP; [Inspectable(type="String",enumeration="top,middle,bottom")] /** * If the total item height is less than the bounds, the positions of * the items can be aligned vertically. */ public function get verticalAlign():String { return this._verticalAlign; } /** * @private */ public function set verticalAlign(value:String):void { if(this._verticalAlign == value) { return; } this._verticalAlign = value; this.dispatchEventWith(Event.CHANGE); } /** * @private */ protected var _horizontalAlign:String = HORIZONTAL_ALIGN_LEFT; [Inspectable(type="String",enumeration="left,center,right,justify")] /** * The alignment of the items horizontally, on the x-axis. */ 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 */ 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 _hasVariableItemDimensions:Boolean = false; /** * When the layout is virtualized, and this value is true, the items may * have variable width values. If false, the items will all share the * same width value with the typical item. */ public function get hasVariableItemDimensions():Boolean { return this._hasVariableItemDimensions; } /** * @private */ public function set hasVariableItemDimensions(value:Boolean):void { if(this._hasVariableItemDimensions == value) { return; } this._hasVariableItemDimensions = 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 _typicalItemWidth:Number = -1; /** * @inheritDoc */ public function get typicalItemWidth():Number { return this._typicalItemWidth; } /** * @private */ public function set typicalItemWidth(value:Number):void { if(this._typicalItemWidth == value) { return; } this._typicalItemWidth = value; } /** * @private */ protected var _typicalItemHeight:Number = -1; /** * @inheritDoc */ public function get typicalItemHeight():Number { return this._typicalItemHeight; } /** * @private */ public function set typicalItemHeight(value:Number):void { if(this._typicalItemHeight == value) { return; } this._typicalItemHeight = value; } /** * @private */ protected var _scrollPositionVerticalAlign:String = VERTICAL_ALIGN_MIDDLE; [Inspectable(type="String",enumeration="top,middle,bottom")] /** * When the scroll position is calculated for an item, an attempt will * be made to align the item to this position. */ public function get scrollPositionVerticalAlign():String { return this._scrollPositionVerticalAlign; } /** * @private */ public function set scrollPositionVerticalAlign(value:String):void { this._scrollPositionVerticalAlign = value; } /** * @inheritDoc */ public function layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult { const boundsX:Number = viewPortBounds ? viewPortBounds.x : 0; const boundsY:Number = viewPortBounds ? viewPortBounds.y : 0; const minWidth:Number = viewPortBounds ? viewPortBounds.minWidth : 0; const minHeight:Number = viewPortBounds ? viewPortBounds.minHeight : 0; const maxWidth:Number = viewPortBounds ? viewPortBounds.maxWidth : Number.POSITIVE_INFINITY; const maxHeight:Number = viewPortBounds ? viewPortBounds.maxHeight : Number.POSITIVE_INFINITY; const explicitWidth:Number = viewPortBounds ? viewPortBounds.explicitWidth : NaN; const explicitHeight:Number = viewPortBounds ? viewPortBounds.explicitHeight : NaN; if(!this._useVirtualLayout || this._hasVariableItemDimensions || this._horizontalAlign != HORIZONTAL_ALIGN_JUSTIFY || isNaN(explicitWidth)) { this.validateItems(items); } this._discoveredItemsCache.length = 0; var maxItemWidth:Number = this._useVirtualLayout ? this._typicalItemWidth : 0; var positionY:Number = boundsY + this._paddingTop; var indexOffset:int = 0; if(this._useVirtualLayout && !this._hasVariableItemDimensions) { indexOffset = this._beforeVirtualizedItemCount; positionY += (this._beforeVirtualizedItemCount * (this._typicalItemHeight + this._gap)); } const itemCount:int = items.length; for(var i:int = 0; i < itemCount; i++) { var item:DisplayObject = items[i]; var iNormalized:int = i + indexOffset; if(this._useVirtualLayout && !item) { if(!this._hasVariableItemDimensions || isNaN(this._heightCache[iNormalized])) { positionY += this._typicalItemHeight + this._gap; } else { positionY += this._heightCache[iNormalized] + this._gap; } } else { if(item is ILayoutDisplayObject) { var layoutItem:ILayoutDisplayObject = ILayoutDisplayObject(item); if(!layoutItem.includeInLayout) { continue; } } item.y = positionY; if(this._useVirtualLayout) { if(this._hasVariableItemDimensions) { if(isNaN(this._heightCache[iNormalized])) { this._heightCache[iNormalized] = item.height; this.dispatchEventWith(Event.CHANGE); } } else if(this._typicalItemHeight >= 0) { item.height = this._typicalItemHeight; } } positionY += item.height + this._gap; maxItemWidth = Math.max(maxItemWidth, item.width); if(this._useVirtualLayout) { this._discoveredItemsCache.push(item); } } } if(this._useVirtualLayout && !this._hasVariableItemDimensions) { positionY += (this._afterVirtualizedItemCount * (this._typicalItemHeight + this._gap)); } const discoveredItems:Vector.<DisplayObject> = this._useVirtualLayout ? this._discoveredItemsCache : items; const totalWidth:Number = maxItemWidth + this._paddingLeft + this._paddingRight; const availableWidth:Number = isNaN(explicitWidth) ? Math.min(maxWidth, Math.max(minWidth, totalWidth)) : explicitWidth; const discoveredItemCount:int = discoveredItems.length; for(i = 0; i < discoveredItemCount; i++) { item = discoveredItems[i]; switch(this._horizontalAlign) { case HORIZONTAL_ALIGN_RIGHT: { item.x = boundsX + availableWidth - this._paddingRight - item.width; break; } case HORIZONTAL_ALIGN_CENTER: { item.x = boundsX + this._paddingLeft + (availableWidth - this._paddingLeft - this._paddingRight - item.width) / 2; break; } case HORIZONTAL_ALIGN_JUSTIFY: { item.x = boundsX + this._paddingLeft; item.width = availableWidth - this._paddingLeft - this._paddingRight; break; } default: //left { item.x = boundsX + this._paddingLeft; } } } const totalHeight:Number = positionY - this._gap + this._paddingBottom - boundsY; const availableHeight:Number = isNaN(explicitHeight) ? Math.min(maxHeight, Math.max(minHeight, totalHeight)) : explicitHeight; if(totalHeight < availableHeight) { var verticalAlignOffsetY:Number = 0; if(this._verticalAlign == VERTICAL_ALIGN_BOTTOM) { verticalAlignOffsetY = availableHeight - totalHeight; } else if(this._verticalAlign == VERTICAL_ALIGN_MIDDLE) { verticalAlignOffsetY = (availableHeight - totalHeight) / 2; } if(verticalAlignOffsetY != 0) { for(i = 0; i < discoveredItemCount; i++) { item = discoveredItems[i]; item.y += verticalAlignOffsetY; } } } this._discoveredItemsCache.length = 0; if(!result) { result = new LayoutBoundsResult(); } result.contentWidth = this._horizontalAlign == HORIZONTAL_ALIGN_JUSTIFY ? availableWidth : totalWidth; 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(); } const explicitWidth:Number = viewPortBounds ? viewPortBounds.explicitWidth : NaN; const explicitHeight:Number = viewPortBounds ? viewPortBounds.explicitHeight : NaN; const needsWidth:Boolean = isNaN(explicitWidth); const needsHeight:Boolean = isNaN(explicitHeight); if(!needsWidth && !needsHeight) { result.x = explicitWidth; result.y = explicitHeight; return result; } const minWidth:Number = viewPortBounds ? viewPortBounds.minWidth : 0; const minHeight:Number = viewPortBounds ? viewPortBounds.minHeight : 0; const maxWidth:Number = viewPortBounds ? viewPortBounds.maxWidth : Number.POSITIVE_INFINITY; const maxHeight:Number = viewPortBounds ? viewPortBounds.maxHeight : Number.POSITIVE_INFINITY; var positionY:Number = 0; var maxItemWidth:Number = this._typicalItemWidth; if(!this._hasVariableItemDimensions) { positionY += ((this._typicalItemHeight + this._gap) * itemCount); } else { for(var i:int = 0; i < itemCount; i++) { if(isNaN(this._heightCache[i])) { positionY += this._typicalItemHeight + this._gap; } else { positionY += this._heightCache[i] + this._gap; } } } if(needsWidth) { result.x = Math.min(maxWidth, Math.max(minWidth, maxItemWidth + this._paddingLeft + this._paddingRight)); } else { result.x = explicitWidth; } if(needsHeight) { result.y = Math.min(maxHeight, Math.max(minHeight, positionY - this._gap + this._paddingTop + this._paddingBottom)); } else { result.y = explicitHeight; } return result; } /** * @inheritDoc */ public function resetVariableVirtualCache():void { this._heightCache.length = 0; } /** * @inheritDoc */ public function resetVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void { delete this._heightCache[index]; if(item) { this._heightCache[index] = item.height; this.dispatchEventWith(Event.CHANGE); } } /** * @inheritDoc */ public function addToVariableVirtualCacheAtIndex(index:int, item:DisplayObject = null):void { const heightValue:* = item ? item.height : undefined; this._heightCache.splice(index, 0, heightValue); } /** * @inheritDoc */ public function removeFromVariableVirtualCacheAtIndex(index:int):void { this._heightCache.splice(index, 1); } /** * @inheritDoc */ public function getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int> { if(!result) { result = new <int>[]; } result.length = 0; const visibleTypicalItemCount:int = Math.ceil(height / (this._typicalItemHeight + this._gap)); if(!this._hasVariableItemDimensions) { //this case can be optimized because we know that every item has //the same height var indexOffset:int = 0; var totalItemHeight:Number = itemCount * (this._typicalItemHeight + this._gap) - this._gap; if(totalItemHeight < height) { if(this._verticalAlign == VERTICAL_ALIGN_BOTTOM) { indexOffset = Math.ceil((height - totalItemHeight) / (this._typicalItemHeight + this._gap)); } else if(this._verticalAlign == VERTICAL_ALIGN_MIDDLE) { indexOffset = Math.ceil(((height - totalItemHeight) / (this._typicalItemHeight + this._gap)) / 2); } } var minimum:int = -indexOffset + Math.max(0, (scrollY - this._paddingTop) / (this._typicalItemHeight + this._gap)); //if we're scrolling beyond the final item, we should keep the //indices consistent so that items aren't destroyed and //recreated unnecessarily var maximum:int = Math.min(itemCount - 1, minimum + visibleTypicalItemCount); minimum = Math.max(0, maximum - visibleTypicalItemCount); for(var i:int = minimum; i <= maximum; i++) { result.push(i); } return result; } const maxPositionY:Number = scrollY + height; var positionY:Number = this._paddingTop; for(i = 0; i < itemCount; i++) { if(isNaN(this._heightCache[i])) { var itemHeight:Number = this._typicalItemHeight; } else { itemHeight = this._heightCache[i]; } var oldPositionY:Number = positionY; positionY += itemHeight + this._gap; if(positionY > scrollY && oldPositionY < maxPositionY) { result.push(i); } if(positionY >= maxPositionY) { break; } } //similar to above, in order to avoid costly destruction and //creation of item renderers, we're going to fill in some extra //indices var resultLength:int = result.length; var visibleItemCountDifference:int = visibleTypicalItemCount - resultLength; if(visibleItemCountDifference > 0 && resultLength > 0) { //add extra items before the first index const firstExistingIndex:int = result[0]; const lastIndexToAdd:int = Math.max(0, firstExistingIndex - visibleItemCountDifference); for(i = firstExistingIndex - 1; i >= lastIndexToAdd; i--) { result.unshift(i); } } resultLength = result.length; visibleItemCountDifference = visibleTypicalItemCount - resultLength; if(visibleItemCountDifference > 0) { //add extra items after the last index const startIndex:int = resultLength > 0 ? (result[resultLength - 1] + 1) : 0; const endIndex:int = Math.min(itemCount, startIndex + visibleItemCountDifference); for(i = startIndex; i < endIndex; i++) { result.push(i); } } return result; } /** * @inheritDoc */ public function getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point { if(!result) { result = new Point(); } var positionY:Number = y + this._paddingTop; var startIndexOffset:int = 0; var endIndexOffset:Number = 0; if(this._useVirtualLayout && !this._hasVariableItemDimensions) { startIndexOffset = this._beforeVirtualizedItemCount; positionY += (this._beforeVirtualizedItemCount * (this._typicalItemHeight + this._gap)); endIndexOffset = Math.max(0, index - items.length - this._beforeVirtualizedItemCount + 1); positionY += (endIndexOffset * (this._typicalItemHeight + this._gap)); } index -= (startIndexOffset + endIndexOffset); var lastHeight:Number = 0; for(var i:int = 0; i <= index; i++) { var item:DisplayObject = items[i]; var iNormalized:int = i + startIndexOffset; if(this._useVirtualLayout && !item) { if(!this._hasVariableItemDimensions || isNaN(this._heightCache[iNormalized])) { lastHeight = this._typicalItemHeight; } else { lastHeight = this._heightCache[iNormalized]; } } else { if(this._hasVariableItemDimensions) { if(isNaN(this._heightCache[iNormalized])) { this._heightCache[iNormalized] = item.height; this.dispatchEventWith(Event.CHANGE); } } else if(this._typicalItemHeight >= 0) { item.height = this._typicalItemHeight; } lastHeight = item.height; } positionY += lastHeight + this._gap; } positionY -= (lastHeight + this._gap); if(this._scrollPositionVerticalAlign == VERTICAL_ALIGN_MIDDLE) { positionY -= (height - lastHeight) / 2; } else if(this._scrollPositionVerticalAlign == VERTICAL_ALIGN_BOTTOM) { positionY -= (height - lastHeight); } result.x = 0; result.y = positionY; return result; } /** * @private */ protected function validateItems(items:Vector.<DisplayObject>):void { const itemCount:int = items.length; for(var i:int = 0; i < itemCount; i++) { var control:IFeathersControl = items[i] as IFeathersControl; if(control) { control.validate(); } } } } }
package flare.scale { import flare.util.Maths; import flare.util.Strings; /** * Scale that organizes data into discrete bins by quantiles. * For example, the quantile scale can be used to create a discrete size * encoding by statistically dividing the data into bins. Quantiles are * computed using the <code>flare.util.Maths.quantile</code> method. * * @see flare.util.Maths#quantile */ public class QuantileScale extends Scale { private var _quantiles:Array; /** @inheritDoc */ public override function get flush():Boolean { return true; } public override function set flush(val:Boolean):void { /* nothing */ } /** @inheritDoc */ public override function get min():Object { return _quantiles[0]; } /** @inheritDoc */ public override function get max():Object { return _quantiles[_quantiles.length-1]; } // -------------------------------------------------------------------- /** * Creates a new QuantileScale. * @param n the number of quantiles desired * @param values the data values to organized into quantiles * @param sorted flag indicating if the input values array is * already pre-sorted * @param labelFormat the formatting pattern for value labels */ public function QuantileScale(n:int, values:Array, sorted:Boolean=false, labelFormat:String=Strings.DEFAULT_NUMBER) { _quantiles = (n<0 ? values : Maths.quantile(n, values, !sorted)); this.labelFormat = labelFormat; } /** @inheritDoc */ public override function get scaleType():String { return ScaleType.QUANTILE; } /** @inheritDoc */ public override function clone():Scale { return new QuantileScale(-1, _quantiles, false, _format); } /** @inheritDoc */ public override function interpolate(value:Object):Number { return Maths.invQuantileInterp(Number(value), _quantiles); } /** @inheritDoc */ public override function lookup(f:Number):Object { return Maths.quantileInterp(f, _quantiles); } /** @inheritDoc */ public override function values(num:int=-1):/*Number*/Array { var a:Array = new Array(); var stride:int = num<0 ? 1 : int(Math.max(1, Math.floor(_quantiles.length/num))); for (var i:uint=0; i<_quantiles.length; i += stride) { a.push(_quantiles[i]); } return a; } } // end of class QuantileScale }
package visuals.ui.elements.guild { import com.playata.framework.display.Sprite; import com.playata.framework.display.lib.flash.FlashDisplayObjectContainer; import com.playata.framework.display.lib.flash.FlashLabel; import com.playata.framework.display.lib.flash.FlashSprite; import com.playata.framework.display.ui.controls.ILabel; import flash.display.MovieClip; import visuals.ui.elements.backgrounds.SymbolSlice9BackgroundButtonGeneric; import visuals.ui.elements.icons.SymbolIconGuildBattleDefenseGeneric; public class SymbolButtonGuildBattleDefendGeneric extends Sprite { private var _nativeObject:SymbolButtonGuildBattleDefend = null; public var bg:SymbolSlice9BackgroundButtonGeneric = null; public var caption:ILabel = null; public var symbolIconGuildBattleDefense:SymbolIconGuildBattleDefenseGeneric = null; public function SymbolButtonGuildBattleDefendGeneric(param1:MovieClip = null) { if(param1) { _nativeObject = param1 as SymbolButtonGuildBattleDefend; } else { _nativeObject = new SymbolButtonGuildBattleDefend(); } super(null,FlashSprite.fromNative(_nativeObject)); var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer; bg = new SymbolSlice9BackgroundButtonGeneric(_nativeObject.bg); caption = FlashLabel.fromNative(_nativeObject.caption); symbolIconGuildBattleDefense = new SymbolIconGuildBattleDefenseGeneric(_nativeObject.symbolIconGuildBattleDefense); } public function setNativeInstance(param1:SymbolButtonGuildBattleDefend) : void { FlashSprite.setNativeInstance(_sprite,param1); _nativeObject = param1; syncInstances(); } public function syncInstances() : void { if(_nativeObject.bg) { bg.setNativeInstance(_nativeObject.bg); } FlashLabel.setNativeInstance(caption,_nativeObject.caption); if(_nativeObject.symbolIconGuildBattleDefense) { symbolIconGuildBattleDefense.setNativeInstance(_nativeObject.symbolIconGuildBattleDefense); } } } }
package mx.messaging { import flash.utils.Dictionary; import mx.core.mx_internal; import mx.logging.Log; import mx.messaging.events.MessageEvent; use namespace mx_internal; public class ConsumerMessageDispatcher { private static var _instance:ConsumerMessageDispatcher; private const _consumers:Object = {}; private const _channelSetRefCounts:Dictionary = new Dictionary(); private const _consumerDuplicateMessageBarrier:Object = {}; public function ConsumerMessageDispatcher() { super(); } public static function getInstance() : ConsumerMessageDispatcher { if(!_instance) { _instance = new ConsumerMessageDispatcher(); } return _instance; } public function isChannelUsedForSubscriptions(channel:Channel) : Boolean { var memberOfChannelSets:Array = channel.channelSets; var cs:ChannelSet = null; var n:int = memberOfChannelSets.length; for(var i:int = 0; i < n; i++) { cs = memberOfChannelSets[i]; if(this._channelSetRefCounts[cs] != null && cs.currentChannel == channel) { return true; } } return false; } public function registerSubscription(consumer:AbstractConsumer) : void { this._consumers[consumer.clientId] = consumer; if(this._channelSetRefCounts[consumer.channelSet] == null) { consumer.channelSet.addEventListener(MessageEvent.MESSAGE,this.messageHandler); this._channelSetRefCounts[consumer.channelSet] = 1; } else { ++this._channelSetRefCounts[consumer.channelSet]; } } public function unregisterSubscription(consumer:AbstractConsumer) : void { delete this._consumers[consumer.clientId]; var refCount:int = this._channelSetRefCounts[consumer.channelSet]; if(--refCount == 0) { consumer.channelSet.removeEventListener(MessageEvent.MESSAGE,this.messageHandler); delete this._channelSetRefCounts[consumer.channelSet]; if(this._consumerDuplicateMessageBarrier[consumer.id] != null) { delete this._consumerDuplicateMessageBarrier[consumer.id]; } } else { this._channelSetRefCounts[consumer.channelSet] = refCount; } } private function messageHandler(event:MessageEvent) : void { var count:int = 0; var cs:ChannelSet = null; var duplicateDispatchGuard:Array = null; var consumer:AbstractConsumer = this._consumers[event.message.clientId]; if(consumer == null) { if(Log.isDebug()) { Log.getLogger("mx.messaging.Consumer").debug("\'{0}\' received pushed message for consumer but no longer subscribed: {1}",event.message.clientId,event.message); } return; } if(event.target.currentChannel.channelSets.length > 1) { count = 0; for each(cs in event.target.currentChannel.channelSets) { if(this._channelSetRefCounts[cs] != null) { count++; } } if(count > 1) { if(this._consumerDuplicateMessageBarrier[consumer.id] == null) { this._consumerDuplicateMessageBarrier[consumer.id] = [event.messageId,count]; consumer.messageHandler(event); } duplicateDispatchGuard = this._consumerDuplicateMessageBarrier[consumer.id]; if(duplicateDispatchGuard[0] == event.messageId) { if(--duplicateDispatchGuard[1] == 0) { delete this._consumerDuplicateMessageBarrier[consumer.id]; } } return; } } consumer.messageHandler(event); } } }
package { //Imports import com.adobe.images.PNGEncoder; import flash.desktop.NativeApplication; import flash.display.BitmapData; import flash.display.NativeWindow; import flash.display.NativeWindowDisplayState; import flash.display.NativeMenu; import flash.display.NativeMenuItem; import flash.display.Sprite; import flash.display.StageDisplayState; import flash.events.Event; import flash.events.EventDispatcher; import flash.net.FileReference; import flash.ui.ContextMenu; import flash.ui.Keyboard; import flash.utils.ByteArray; //Class public class DesktopMenu extends EventDispatcher { //Variables private var applicationMenu:NativeMenu; private var windowMenu:NativeMenu; private var dropSwatchMenu:NativeMenu; private var aboutMenuItem:NativeMenuItem; private var preferencesMenuItem:NativeMenuItem; private var quitMenuItem:NativeMenuItem; private var canvasMenu:NativeMenu; private var saveCanvasSnapshotItem:NativeMenuItem; private var minimizeMenuItem:NativeMenuItem; private var maximizeMenuItem:NativeMenuItem; private var fullScreenMenuItem:NativeMenuItem; private var restoreMenuItem:NativeMenuItem; private var swatchesMenu:NativeMenu; private var toggleSwatchValuesMenuItem:NativeMenuItem; private var removeAllSwatchesMenuItem:NativeMenuItem; private var appearancePanelMenu:NativeMenu; private var colorWheelMenuItem:NativeMenuItem; private var slidersButtonsMenuItem:NativeMenuItem; private var lightColorWheelMenuItem:NativeMenuItem; private var darkColorWheelMenuItem:NativeMenuItem; private var toggleTexturePanelMenuItem:NativeMenuItem; private var helpMenu:NativeMenu; private var dropSwatchHelpMenuItem:NativeMenuItem; //Constructor public function DesktopMenu() { init(); } //Initialize private function init():void { var canvasMenu:NativeMenu = new NativeMenu(); addItemsToSubmenu ( canvasMenu, canvasMenuDisplayingEventHandler, saveCanvasSnapshotItem = createMenuItem(createMenuItemData(saveCanvasSnapshot), "Save Canvas Snapshot", "s"), menuItemSeperator(), minimizeMenuItem = createMenuItem(createMenuItemData(DropSwatch.controller.stage.nativeWindow.minimize), "Minimize", "m"), maximizeMenuItem = createMenuItem(createMenuItemData(DropSwatch.controller.stage.nativeWindow.maximize), "Maximize", "k"), fullScreenMenuItem = createMenuItem(createMenuItemData(DropSwatch.controller.toggleDisplayState), "Full Screen", "f"), menuItemSeperator(), restoreMenuItem = createMenuItem(createMenuItemData(DropSwatch.controller.stage.nativeWindow.restore), "Restore", "r") ); var swatchesMenu:NativeMenu = new NativeMenu(); addItemsToSubmenu ( swatchesMenu, swatchesMenuDisplayingEventHandler, toggleSwatchValuesMenuItem = createMenuItem(createMenuItemData(toggleSwatchValues), null, "v"), menuItemSeperator(), removeAllSwatchesMenuItem = createMenuItem(createMenuItemData(DropSwatch.controller.stage.dispatchEvent, new DropSwatchEvent(DropSwatchEvent.REMOVE_ALL)), "Remove All Swatches") ); var appearancePanelMenu:NativeMenu = new NativeMenu(); addItemsToSubmenu ( appearancePanelMenu, appearancePanelMenuDisplayingEventHandler, colorWheelMenuItem = createMenuItem(createMenuItemData(activateColorWheelMode), "Color Wheel", "w"), slidersButtonsMenuItem = createMenuItem(createMenuItemData(activateColorSlidersMode), "Color Sliders & Buttons", "s"), menuItemSeperator(), lightColorWheelMenuItem = createMenuItem(createMenuItemData(activateLightColorWheelSubmode), "Light Color Wheel", "l"), darkColorWheelMenuItem = createMenuItem(createMenuItemData(activateDarkColorWheelSubmode), "Dark Color Wheel", "d"), menuItemSeperator(), toggleTexturePanelMenuItem = createMenuItem(createMenuItemData(toggleTexturePanel), null, "t") ); var helpMenu:NativeMenu = new NativeMenu(); addItemsToSubmenu ( helpMenu, helpMenuDisplayingEventHandler, dropSwatchHelpMenuItem = createMenuItem(createMenuItemData(showHelpDialog), "Drop Swatch Help") ); if (NativeApplication.supportsMenu) { applicationMenu = NativeApplication.nativeApplication.menu; while (applicationMenu.items.length > 1) applicationMenu.removeItemAt(applicationMenu.items.length - 1); var applicationNameMenu:NativeMenuItem = applicationMenu.getItemAt(0); applicationNameMenu.submenu.removeItemAt(0); applicationNameMenu.submenu.removeItemAt(applicationNameMenu.submenu.numItems - 1); addItemsToSubmenu ( applicationNameMenu.submenu, dropSwatchMenuDisplayingEventHandler, aboutMenuItem = createMenuItem(createMenuItemData(showAboutDialog, null, 0), "About Drop Swatch"), menuItemSeperator(1), preferencesMenuItem = createMenuItem(createMenuItemData(showPreferencesDialog, null, 2), "Preferences...") ); addItemsToSubmenu ( applicationNameMenu.submenu, null, quitMenuItem = createMenuItem(createMenuItemData(DropSwatch.controller.stage.nativeWindow.dispatchEvent, new Event(Event.CLOSING), applicationNameMenu.submenu.numItems), "Quit Drop Swatch", "q") ); } if (NativeWindow.supportsMenu) { applicationMenu = new NativeMenu(); DropSwatch.controller.stage.nativeWindow.menu = applicationMenu; var dropSwatchMenu:NativeMenu = new NativeMenu(); addItemsToSubmenu ( dropSwatchMenu, dropSwatchMenuDisplayingEventHandler, aboutMenuItem = createMenuItem(createMenuItemData(showAboutDialog), "About Drop Swatch"), menuItemSeperator(), preferencesMenuItem = createMenuItem(createMenuItemData(showPreferencesDialog), "Preferences..."), menuItemSeperator(), quitMenuItem = createMenuItem(createMenuItemData(DropSwatch.controller.stage.nativeWindow.dispatchEvent, new Event(Event.CLOSING)), "Quit Drop Swatch", "q") ); applicationMenu.addSubmenuAt(dropSwatchMenu, 0, "Drop Swatch"); } applicationMenu.addSubmenuAt(canvasMenu, 1, "Canvas"); applicationMenu.addSubmenuAt(swatchesMenu, 2, "Swatches"); applicationMenu.addSubmenuAt(appearancePanelMenu, 3, "Appearance Panel"); applicationMenu.addSubmenuAt(helpMenu, 4, "Help"); } //Add Items To Submenus private function addItemsToSubmenu(menu:NativeMenu, menuDisplayingEventHandler:Function = null, ...menuItems):void { for each (var element:NativeMenuItem in menuItems) if (element.data.index == -1) menu.addItem(element); else menu.addItemAt(element, element.data.index); if (menuDisplayingEventHandler != null) menu.addEventListener(Event.DISPLAYING, menuDisplayingEventHandler); } //Create Menu Items private function createMenuItem(itemData:Object, itemLabel:String = null, itemKeyEquivalent:String = null, itemKeyEquivalentModifiers:Array = null):NativeMenuItem { var resultMenuItem:NativeMenuItem = new NativeMenuItem(); resultMenuItem.data = itemData; if (itemLabel != null) resultMenuItem.label = itemLabel; if (itemKeyEquivalent != null) resultMenuItem.keyEquivalent = itemKeyEquivalent; if (itemKeyEquivalentModifiers != null) resultMenuItem.keyEquivalentModifiers = itemKeyEquivalentModifiers; resultMenuItem.addEventListener(Event.SELECT, menuItemSelectEventHandler); return resultMenuItem; } //Create Menu Item Data private function createMenuItemData(callBackFunction:Function, callBackArgument:* = null, index:int = -1):Object { return {callBackFunction:callBackFunction, callBackArgument:callBackArgument, index:index}; } //Menu Item Seperator private function menuItemSeperator(index:int = -1):NativeMenuItem { var resultMenuItem:NativeMenuItem = new NativeMenuItem("", true); resultMenuItem.data = createMenuItemData(null, null, index); return resultMenuItem; } //Menu Item Select Event Handler private function menuItemSelectEventHandler(evt:Event):void { var targetData:Object = evt.currentTarget.data; if (targetData.callBackArgument == null) targetData.callBackFunction(); else targetData.callBackFunction(targetData.callBackArgument); } //Drop Swatch Menu Displaying Event Handler private function dropSwatchMenuDisplayingEventHandler(evt:Event):void { (NativeApplication.nativeApplication.activeWindow == AboutWindow.aboutWindow) ? aboutMenuItem.enabled = false : aboutMenuItem.enabled = true; (NativeApplication.nativeApplication.activeWindow == PreferencesWindow.preferencesWindow) ? preferencesMenuItem.enabled = false : preferencesMenuItem.enabled = true; } //Show About Dialog private function showAboutDialog():void { AboutWindow.aboutWindow.activate(); } //Show Preferences Dialog private function showPreferencesDialog():void { PreferencesWindow.preferencesWindow.activate(); } //Canvas Menu Displaying Event Handler private function canvasMenuDisplayingEventHandler(evt:Event):void { if (DropSwatch.controller.stage.nativeWindow.displayState == NativeWindowDisplayState.MINIMIZED || DropSwatch.controller.stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE) { minimizeMenuItem.enabled = false; maximizeMenuItem.enabled = false; fullScreenMenuItem.enabled = false; restoreMenuItem.enabled = true; } else if (DropSwatch.controller.stage.nativeWindow.displayState == NativeWindowDisplayState.MAXIMIZED) { minimizeMenuItem.enabled = true; maximizeMenuItem.enabled = false; fullScreenMenuItem.enabled = false; restoreMenuItem.enabled = true; } else { minimizeMenuItem.enabled = true; maximizeMenuItem.enabled = true; fullScreenMenuItem.enabled = true; restoreMenuItem.enabled = false; } } //Save Canvas Snapshot private function saveCanvasSnapshot():void { var bitmapData:BitmapData = new BitmapData(DropSwatch.controller.stage.stageWidth, DropSwatch.controller.stage.stageHeight); bitmapData.draw(DropSwatch.controller); var file:ByteArray = PNGEncoder.encode(bitmapData); var fileReference:FileReference = new FileReference(); fileReference.save(file, "DropSwatchCanvas.png"); } //Swatches Menu Displaying Event Handler private function swatchesMenuDisplayingEventHandler(evt:Event):void { for (var i:uint = 0; i < DropSwatch.controller.numChildren; i++) if (Object(DropSwatch.controller.getChildAt(i)).constructor == Swatch) { removeAllSwatchesMenuItem.enabled = true; toggleSwatchValuesMenuItem.enabled = true; break; } else { removeAllSwatchesMenuItem.enabled = false; toggleSwatchValuesMenuItem.enabled = false; } (Swatch.showValues) ? toggleSwatchValuesMenuItem.label = "Hide Color Values" : toggleSwatchValuesMenuItem.label = "Show Color Values"; } //Toggle Swatch Values private function toggleSwatchValues():void { DropSwatch.controller.stage.dispatchEvent(new DropSwatchEvent(DropSwatchEvent.VALUES, null, NaN, null, (Swatch.showValues) ? false : true)); } //Appearance Panel Menu Displaying Event Handler private function appearancePanelMenuDisplayingEventHandler(evt:Event):void { if (DropSwatch.controller.appearancePanel.visible) { if (DropSwatch.controller.appearancePanel.panelMode == AppearancePanel.COLOR_WHEEL_MODE) { colorWheelMenuItem.enabled = false; slidersButtonsMenuItem.enabled = true; if (DropSwatch.controller.appearancePanel.colorWheelSubmode == AppearancePanel.COLOR_WHEEL_SUBMODE_LIGHT) { lightColorWheelMenuItem.enabled = false; darkColorWheelMenuItem.enabled = true; } else { lightColorWheelMenuItem.enabled = true; darkColorWheelMenuItem.enabled = false; } } else { colorWheelMenuItem.enabled = true; slidersButtonsMenuItem.enabled = false; lightColorWheelMenuItem.enabled = false; darkColorWheelMenuItem.enabled = false; } toggleTexturePanelMenuItem.enabled = true; } else { colorWheelMenuItem.enabled = false; slidersButtonsMenuItem.enabled = false; lightColorWheelMenuItem.enabled = false; darkColorWheelMenuItem.enabled = false; toggleTexturePanelMenuItem.enabled = false; } (DropSwatch.controller.appearancePanel.texturePanelIsCollapsed) ? toggleTexturePanelMenuItem.label = "Show Texture Panel" : toggleTexturePanelMenuItem.label = "Hide Texture Panel"; } //Activate Color Wheel Mode private function activateColorWheelMode():void { DropSwatch.controller.appearancePanel.panelMode = AppearancePanel.COLOR_WHEEL_MODE; } //Activate Color Wheel Mode private function activateColorSlidersMode():void { DropSwatch.controller.appearancePanel.panelMode = AppearancePanel.COLOR_SLIDERS_MODE; } //Activate Color Wheel Light Submode private function activateLightColorWheelSubmode():void { DropSwatch.controller.appearancePanel.colorWheelSubmode = AppearancePanel.COLOR_WHEEL_SUBMODE_LIGHT; } //Activate Color Wheel Light Submode private function activateDarkColorWheelSubmode():void { DropSwatch.controller.appearancePanel.colorWheelSubmode = AppearancePanel.COLOR_WHEEL_SUBMODE_DARK; } //Toggle Texture Panel private function toggleTexturePanel():void { DropSwatch.controller.appearancePanel.texturePanelIsCollapsed = !DropSwatch.controller.appearancePanel.texturePanelIsCollapsed; } //Help Menu Displaying Event Handler private function helpMenuDisplayingEventHandler(evt:Event):void { (NativeApplication.nativeApplication.activeWindow == HelpWindow.helpWindow) ? dropSwatchHelpMenuItem.enabled = false : dropSwatchHelpMenuItem.enabled = true; } //Activate Help Window private function showHelpDialog():void { HelpWindow.helpWindow.activate(); } } }
package zenith.context.game.views { import starling.display.DisplayObject; import starling.display.Image; import starling.display.Quad; import starling.display.Sprite; import starling.textures.Texture; public class ObstacleView extends Sprite { [Embed(source="assets/wall.png")] private static const ObstacleImage:Class; private var upperImage:Image; private var lowerImage:Image; private var _checkpoint:DisplayObject; public function ObstacleView(height:Number) { var texture:Texture = Texture.fromEmbeddedAsset(ObstacleImage); upperImage = new Image(texture); lowerImage = new Image(texture); upperImage.height = 16 * 32; upperImage.width = 4 * 32; upperImage.y = - upperImage.height + height * 32; lowerImage.height = 16 * 32; lowerImage.width = 4 * 32; lowerImage.y = upperImage.bounds.bottom + 8 * 32; addChild(upperImage); addChild(lowerImage); _checkpoint = new Quad(1, 1000, 0, false); _checkpoint.x = upperImage.width; _checkpoint.y = 0; _checkpoint.alpha = 0; addChild(_checkpoint); } public function get realObstacles():Vector.<DisplayObject> { return Vector.<DisplayObject>([upperImage, lowerImage]); } public function get checkpoint():DisplayObject { return _checkpoint; } } }
package sh.saqoo.motion { public function customTransition (t:Number,b:Number,c:Number,d:Number,pl:Array):Number { var r:Number = 200 * t/d; var i:Number = -1; var e:Object; while (pl[++i].Mx<=r) e = pl[i]; var Px:Number = e.Px; var Nx:Number = e.Nx; var s:Number = (Px==0) ? -(e.Mx-r)/Nx : (-Nx+Math.sqrt(Nx*Nx-4*Px*(e.Mx-r)))/(2*Px); return (b-c*((e.My+e.Ny*s+e.Py*s*s)/200)); } }
// // 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.file.beads { /** * The FileModelWithParamsAndFileContent behaves like FileModelWithParams but retains the file content. * This can be useful e.g. for displaying a thumbnail of a file you are about to upload in FormData format. * * * @toplevel * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9.7 */ import org.apache.royale.utils.BinaryData; public class FileModelWithParamsAndFileContent extends FileModelWithParams { public function FileModelWithParamsAndFileContent() { super(); } /** * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9.7 */ private var _fileContent:BinaryData; override public function set fileContent(value:BinaryData):void { _fileContent = value; super.fileContent = value; } public function get fileContent():BinaryData { return _fileContent; } } }
/* Copyright (c) 2012 Raohmaru 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 jp.raohmaru.toolkit.motion { /** * Esta clase representa el bote donde almacenar las instancias de la especia PaprikaSpice, reservándolas en memoria, reutilizándolas y creando nuevas * instancias sólo cuando es necesario. * @author raohmaru * @source Basado en la clase com.flashdynamix.utils.ObjectPool de Shane McCartney [http://www.lostinactionscript.com/blog/index.php] */ public class PaprikaPot { internal var size :int, length :int; private var _list :Array = []; /** * Crea un nuevo objeto PaprikaPot. La primera vez que se llama al método <code>Paprika.add()</code> se crea una instancia de PaprikaPot * para almacenar la especia. */ public function PaprikaPot() { } /** * Obtiene una nueva instancia de la clase PaprikaSpice. Si no ha objetos disponibles se crea uno nuevo y se aumenta el tamaño de la rerserva. * @return Una instancia de PaprikaSpice. */ public function retrieve() :PaprikaSpice { if(length == 0) { size++; return new PaprikaSpice(); } return _list[--length]; } /** * Deposita un objeto, guardándolo en memoria para que vuelva a ser utilizado. * @param item Una instancia de PaprikaSpice limpia de referencias. */ public function drop(item :PaprikaSpice) :void { _list[length++] = item; } /** * Vacía la lista interna de objetos, liberando memoria. */ public function empty() :void { size = length = _list.length = 0; } } }
//////////////////////////////////////////////////////////////////////////////// // // 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.events { import flash.events.Event; import mx.core.mx_internal; use namespace mx_internal; /** * The VideoEvent class represents the event object passed to the event listener for * events dispatched by the VideoDisplay control, and defines the values of * the <code>VideoDisplay.state</code> property. * * @see mx.controls.VideoDisplay * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class VideoEvent extends Event { include "../core/Version.as"; //-------------------------------------------------------------------------- // // Class constants // //-------------------------------------------------------------------------- /** * The value of the <code>VideoDisplay.state</code> property * immediately after a call to the * <code>play()</code> or <code>load()</code> method. * * <p>This is a responsive state. In the responsive state, calls to * the <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are executed immediately.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const BUFFERING:String = "buffering"; /** * The <code>VideoEvent.CLOSE</code> constant defines the value of the * <code>type</code> property of the event object for a <code>close</code> event. * * <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>cancelable</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>playheadTime</code></td><td>The location of the playhead * when the event occurs.</td></tr> * <tr><td><code>state</code></td><td>The value of the * <code>VideoDisplay.state</code> property when the event occurs.</td></tr> * <tr><td><code>stateResponsive</code></td><td>The value of the * <code>VideoDisplay.stateResponsive</code> property * when the event occurs.</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 close * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const CLOSE:String = "close"; /** * The <code>VideoEvent.COMPLETE</code> constant defines the value of the * <code>type</code> property of the event object for a <code>complete</code> event. * * <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>cancelable</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>playheadTime</code></td><td>The location of the playhead * when the event occurs.</td></tr> * <tr><td><code>state</code></td><td>The value of the * <code>VideoDisplay.state</code> property when the event occurs.</td></tr> * <tr><td><code>stateResponsive</code></td><td>The value of the * <code>VideoDisplay.stateResponsive</code> property * when the event occurs.</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 complete * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const COMPLETE:String = "complete"; /** * The value of the <code>VideoDisplay.state</code> property * when the VideoDisplay control was unable to load the video stream. * This state can occur when there is no connection to a server, * the video stream is not found, or for other reasons. * * <p>This is a unresponsive state. If the control is unresponsive, calls to the * <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are queued, * and then executed when the control changes to the responsive state.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const CONNECTION_ERROR:String = "connectionError"; /** * The value of the <code>VideoDisplay.state</code> property * when the video stream has timed out or is idle. * * <p>This is a responsive state. In the responsive state, calls to * the <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are executed immediately.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const DISCONNECTED:String = "disconnected"; /** * The value of the <code>VideoDisplay.state</code> property * during execution of queued command. * There will never be a <code>stateChange</code> event dispatched for * this state; it is for internal use only. * * <p>This is a unresponsive state. If the control is unresponsive, calls to the * <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are queued, * and then executed when the control changes to the responsive state.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const EXEC_QUEUED_CMD:String = "execQueuedCmd"; /** * The value of the <code>VideoDisplay.state</code> property * immediately after a call to the * <code>play()</code> or <code>load()</code> method. * * <p>This is a unresponsive state. If the control is unresponsive, calls to the * <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are queued, * and then executed when the control changes to the responsive state.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const LOADING:String = "loading"; /** * The value of the <code>VideoDisplay.state</code> property * when an FLV file is loaded, but play is paused. * This state is entered when you call the <code>pause()</code> * or <code>load()</code> method. * * <p>This is a responsive state. In the responsive state, calls to * the <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are executed immediately.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const PAUSED:String = "paused"; /** * The <code>VideoEvent.PLAYHEAD_UPDATE</code> constant defines the value of the * <code>type</code> property of the event object for a <code>playheadUpdate</code> event. * * <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>cancelable</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>playheadTime</code></td><td>The location of the playhead * when the event occurs.</td></tr> * <tr><td><code>state</code></td><td>The value of the * <code>VideoDisplay.state</code> property when the event occurs.</td></tr> * <tr><td><code>stateResponsive</code></td><td>The value of the * <code>VideoDisplay.stateResponsive</code> property * when the event occurs.</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 playheadUpdate * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const PLAYHEAD_UPDATE:String = "playheadUpdate"; /** * The value of the <code>VideoDisplay.state</code> property * when an FLV file is loaded and is playing. * This state is entered when you call the <code>play()</code> * method. * * <p>This is a responsive state. In the responsive state, calls to * the <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are executed immediately.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const PLAYING:String = "playing"; /** * The <code>VideoEvent.READY</code> constant defines the value of the * <code>type</code> property of the event object for a <code>ready</code> event. * * <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>cancelable</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>playheadTime</code></td><td>The location of the playhead * when the event occurs.</td></tr> * <tr><td><code>state</code></td><td>The value of the * <code>VideoDisplay.state</code> property when the event occurs.</td></tr> * <tr><td><code>stateResponsive</code></td><td>The value of the * <code>VideoDisplay.stateResponsive</code> property * when the event occurs.</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 ready * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const READY:String = "ready"; /** * The value of the <code>VideoDisplay.state</code> property * when the VideoDisplay control is resizing. * * <p>This is a unresponsive state. If the control is unresponsive, calls to the * <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are queued, * and then executed when the control changes to the responsive state.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const RESIZING:String = "resizing"; /** * The <code>VideoEvent.REWIND</code> constant defines the value of the * <code>type</code> property of the event object for a <code>rewind</code> event. * * <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>cancelable</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>playheadTime</code></td><td>The location of the playhead * when the event occurs.</td></tr> * <tr><td><code>state</code></td><td>The value of the * <code>VideoDisplay.state</code> property when the event occurs.</td></tr> * <tr><td><code>stateResponsive</code></td><td>The value of the * <code>VideoDisplay.stateResponsive</code> property * when the event occurs.</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 rewind * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const REWIND:String = "rewind"; /** * The value of the <code>VideoDisplay.state</code> property * during an autorewind triggered * when play stops. After the rewind completes, the state changes to * <code>STOPPED</code>. * * <p>This is a unresponsive state. If the control is unresponsive, calls to the * <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are queued, * and then executed when the control changes to the responsive state.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const REWINDING:String = "rewinding"; /** * The value of the <code>VideoDisplay.state</code> property * for a seek occurring * due to the <code>VideoDisplay.playHeadTime</code> property being set. * * <p>This is a unresponsive state. If the control is unresponsive, calls to the * <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are queued, * and then executed when the control changes to the responsive state.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const SEEKING:String = "seeking"; /** * The <code>VideoEvent.STATE_CHANGE</code> constant defines the value of the * <code>type</code> property of the event object for a <code>stateChange</code> event. * * <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>cancelable</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>playheadTime</code></td><td>The location of the playhead * when the event occurs.</td></tr> * <tr><td><code>state</code></td><td>The value of the * <code>VideoDisplay.state</code> property when the event occurs.</td></tr> * <tr><td><code>stateResponsive</code></td><td>The value of the * <code>VideoDisplay.stateResponsive</code> property * when the event occurs.</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 stateChange * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const STATE_CHANGE:String = "stateChange"; /** * The value of the <code>VideoDisplay.state</code> property * when an FLV file is loaded but play has stopped. * This state is entered when you call the <code>stop()</code> method * or when the playhead reaches the end of the video stream. * * <p>This is a responsive state. In the responsive state, calls to * the <code>play()</code>, <code>load()</code>, <code>stop()</code>, * and <code>pause()</code> methods are executed immediately.</p> * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public static const STOPPED:String = "stopped"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @param type The event type; indicates the action that caused the event. * * @param bubbles Specifies whether the event can bubble up the display list hierarchy. * * @param cancelable Specifies whether the behavior associated with * the event can be prevented. * * @param state The value of the <code>VideoDisplay.state</code> property * when the event occurs. * * @param playeheadTime The location of the playhead when the event occurs. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function VideoEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, state:String = null, playheadTime:Number = NaN) { super(type, bubbles, cancelable); this.state = state; this.playheadTime = playheadTime; } //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //---------------------------------- // playheadTime //---------------------------------- /** * The location of the playhead of the VideoDisplay control * when the event occurs. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public var playheadTime:Number; //---------------------------------- // state //---------------------------------- /** * The value of the <code>VideoDisplay.state</code> property * when the event occurs. * * @see mx.controls.VideoDisplay#state * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public var state:String; //---------------------------------- // stateResponsive //---------------------------------- /** * The value of the <code>VideoDisplay.stateResponsive</code> property * when the event occurs. * * @see mx.controls.VideoDisplay#stateResponsive * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get stateResponsive():Boolean { switch (state) { case DISCONNECTED: case STOPPED: case PLAYING: case PAUSED: case BUFFERING: { return true; } default: { return false; } } } //-------------------------------------------------------------------------- // // Overridden methods: Event // //-------------------------------------------------------------------------- /** * @private */ override public function clone():Event { return new VideoEvent(type, bubbles, cancelable, state, playheadTime); } } }
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import com.adobe.test.Assert; gTestfile = 'definition-1.js'; /** File Name: definition-1.js Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=111284 Description: Regression test for declaring functions. Author: christine@netscape.com Date: 15 June 1998 */ // var SECTION = "function/definition-1.js"; // var VERSION = "JS_12"; // var TITLE = "Regression test for 111284"; f1 = function() { return "passed!" } function f2() { f3 = function() { return "passed!" }; return f3(); } Assert.expectEq( 'f1 = function() { return "passed!" }; f1()', "passed!", f1() ); Assert.expectEq( 'function f2() { f3 = function { return "passed!" }; return f3() }; f2()', "passed!", f2() ); Assert.expectEq( 'f3()', "passed!", f3() );
package com.tudou.player.skin.widgets { import com.tudou.layout.LayoutSprite; import flash.display.DisplayObject; import flash.events.Event; import flash.events.MouseEvent; /** * 开关按钮 * * @author 8088 */ public class SwitchButton extends LayoutSprite { public function SwitchButton( on_normal:DisplayObject, off_normal:DisplayObject, on_focused:DisplayObject = null, off_focused:DisplayObject = null, on_disabled:DisplayObject = null, off_disabled:DisplayObject = null) { super(); this.on_normal = on_normal; this.on_focused = on_focused; this.on_disabled = on_disabled; this.off_normal = off_normal; this.off_focused = off_focused; this.off_disabled = off_disabled; btn_w = on_normal.width; btn_h = on_normal.height; this.mouseChildren = false; updateFace(this.off_normal); } override protected function onStage(evt:Event=null):void { super.onStage(evt); style = "height:"+btn_h+"; width:" + btn_w + ";"; } protected function onMouseDown(evt:MouseEvent):void { _mouse_on = true; _on = !_on; if (_on) { updateFace(on_focused); } else { updateFace(off_focused); } } protected function onRollOver(evt:MouseEvent):void { _mouse_on = true; var btn_face:DisplayObject; if (on) btn_face = on_focused; else btn_face = off_focused; updateFace(btn_face); } protected function onRollOut(evt:MouseEvent):void { _mouse_on = false; var btn_face:DisplayObject; if (on) btn_face = on_normal; else btn_face = off_normal; updateFace(btn_face); } protected function updateFace(face:DisplayObject):void { if (face == null) return; if (currentFace != face) { if (currentFace) { removeChild(currentFace); } currentFace = face; if (currentFace) { addChildAt(currentFace, 0); } } } public function get on():Boolean { return this._on; } public function set on(b:Boolean):void { this._on = b; if (_on) { if (enabled) { if(_mouse_on) updateFace(on_focused); else updateFace(on_normal); } else updateFace(on_disabled); } else { if(enabled) updateFace(off_normal); else updateFace(off_disabled); } } public function set enabled(value:Boolean):void { _enabled = value; processEnabledChange(); } public function get enabled():Boolean { return _enabled; } protected function processEnabledChange():void { mouseEnabled = enabled; buttonMode = enabled; updateFace( enabled ? on ? on_normal : off_normal : on ? on_disabled : off_disabled ); if (enabled) { addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); addEventListener(MouseEvent.ROLL_OVER, onRollOver); addEventListener(MouseEvent.ROLL_OUT, onRollOut); } else { removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); removeEventListener(MouseEvent.ROLL_OVER, onRollOver); removeEventListener(MouseEvent.ROLL_OUT, onRollOut); } } private var currentFace:DisplayObject; protected var on_normal:DisplayObject; protected var on_focused:DisplayObject; protected var on_disabled:DisplayObject; protected var off_normal:DisplayObject; protected var off_focused:DisplayObject; protected var off_disabled:DisplayObject; private var btn_w:Number; private var btn_h:Number; private var _on:Boolean; private var _mouse_on:Boolean; private var _enabled:Boolean; } }
/** * Label.as * Keith Peters * version 0.9.9 * * A Label component for displaying a single line of text. * * Copyright (c) 2011 Keith Peters * * 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.bit101.components { import flash.display.DisplayObjectContainer; import flash.events.Event; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; [Event(name="resize", type="flash.events.Event")] public class Label extends Component { protected var _autoSize:Boolean = true; protected var _text:String = ""; protected var _tf:TextField; /** * Constructor * @param parent The parent DisplayObjectContainer on which to add this Label. * @param xpos The x position to place this component. * @param ypos The y position to place this component. * @param text The string to use as the initial text in this component. */ public function Label(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0, text:String = "") { this.text = text; super(parent, xpos, ypos); } /** * Initializes the component. */ override protected function init():void { super.init(); mouseEnabled = false; mouseChildren = false; } /** * Creates and adds the child display objects of this component. */ override protected function addChildren():void { _height = 18; _tf = new TextField(); _tf.height = _height; _tf.embedFonts = Style.embedFonts; _tf.selectable = false; _tf.mouseEnabled = false; _tf.defaultTextFormat = new TextFormat(Style.fontName, Style.fontSize, Style.LABEL_TEXT); _tf.text = _text; addChild(_tf); draw(); } /////////////////////////////////// // public methods /////////////////////////////////// /** * Draws the visual ui of the component. */ override public function draw():void { super.draw(); _tf.text = _text; if(_autoSize) { _tf.autoSize = TextFieldAutoSize.LEFT; _width = _tf.width; dispatchEvent(new Event(Event.RESIZE)); } else { _tf.autoSize = TextFieldAutoSize.NONE; _tf.width = _width; } _height = _tf.height = 18; } /////////////////////////////////// // event handlers /////////////////////////////////// /////////////////////////////////// // getter/setters /////////////////////////////////// /** * Gets / sets the text of this Label. */ public function set text(t:String):void { _text = t; if(_text == null) _text = ""; invalidate(); } public function get text():String { return _text; } /** * Gets / sets whether or not this Label will autosize. */ public function set autoSize(b:Boolean):void { _autoSize = b; } public function get autoSize():Boolean { return _autoSize; } /** * Gets the internal TextField of the label if you need to do further customization of it. */ public function get textField():TextField { return _tf; } } }
package cmodule.lua_wrapper { const __2E_str11186329:int = gstaticInitter.alloc(15,1); }
package { import com.leapmotion.leap.*; import com.leapmotion.leap.events.*; import com.leapmotion.leap.util.*; import flash.display.Sprite; [SWF(frameRate=60)] public class Sample extends Sprite { private var controller:Controller; public function Sample() { controller = new Controller(); controller.addEventListener( LeapEvent.LEAPMOTION_INIT, onInit ); controller.addEventListener( LeapEvent.LEAPMOTION_CONNECTED, onConnect ); controller.addEventListener( LeapEvent.LEAPMOTION_DISCONNECTED, onDisconnect ); controller.addEventListener( LeapEvent.LEAPMOTION_EXIT, onExit ); controller.addEventListener( LeapEvent.LEAPMOTION_FRAME, onFrame ); } private function onInit( event:LeapEvent ):void { trace( "Initialized" ); } private function onConnect( event:LeapEvent ):void { trace( "Connected" ); controller.enableGesture( Gesture.TYPE_SWIPE ); controller.enableGesture( Gesture.TYPE_CIRCLE ); controller.enableGesture( Gesture.TYPE_SCREEN_TAP ); controller.enableGesture( Gesture.TYPE_KEY_TAP ); controller.setPolicyFlags( Controller.POLICY_BACKGROUND_FRAMES ); } private function onDisconnect( event:LeapEvent ):void { trace( "Disconnected" ); } private function onExit( event:LeapEvent ):void { trace( "Exited" ); } private function onFrame( event:LeapEvent ):void { // Get the most recent frame and report some basic information var frame:Frame = event.frame; trace( "Frame id: " + frame.id + ", timestamp: " + frame.timestamp + ", hands: " + frame.hands.length + ", fingers: " + frame.fingers.length + ", tools: " + frame.tools.length + ", gestures: " + frame.gestures().length ); if ( frame.hands.length > 0 ) { // Get the first hand var hand:Hand = frame.hands[ 0 ]; // Check if the hand has any fingers var fingers:Vector.<Finger> = hand.fingers; if ( !fingers.length == 0 ) { // Calculate the hand's average finger tip position var avgPos:Vector3 = Vector3.zero(); for each ( var finger:Finger in fingers ) avgPos = avgPos.plus( finger.tipPosition ); avgPos = avgPos.divide( fingers.length ); trace( "Hand has " + fingers.length + " fingers, average finger tip position: " + avgPos ); } // Get the hand's sphere radius and palm position trace( "Hand sphere radius: " + hand.sphereRadius + " mm, palm position: " + hand.palmPosition ); // Get the hand's normal vector and direction var normal:Vector3 = hand.palmNormal; var direction:Vector3 = hand.direction; // Calculate the hand's pitch, roll, and yaw angles trace( "Hand pitch: " + LeapUtil.toDegrees( direction.pitch ) + " degrees, " + "roll: " + LeapUtil.toDegrees( normal.roll ) + " degrees, " + "yaw: " + LeapUtil.toDegrees( direction.yaw ) + " degrees\n" ); } var gestures:Vector.<Gesture> = frame.gestures(); for ( var i:int = 0; i < gestures.length; i++ ) { var gesture:Gesture = gestures[ i ]; switch ( gesture.type ) { case Gesture.TYPE_CIRCLE: var circle:CircleGesture = CircleGesture( gesture ); // Calculate clock direction using the angle between circle normal and pointable var clockwiseness:String; if ( circle.pointable.direction.angleTo( circle.normal ) <= Math.PI / 4 ) { // Clockwise if angle is less than 90 degrees clockwiseness = "clockwise"; } else { clockwiseness = "counterclockwise"; } // Calculate angle swept since last frame var sweptAngle:Number = 0; if ( circle.state != Gesture.STATE_START ) { var previousGesture:Gesture = controller.frame( 1 ).gesture( circle.id ); if( previousGesture.isValid() ) { var previousUpdate:CircleGesture = CircleGesture( controller.frame( 1 ).gesture( circle.id ) ); sweptAngle = ( circle.progress - previousUpdate.progress ) * 2 * Math.PI; } } trace( "Circle id: " + circle.id + ", " + circle.state + ", progress: " + circle.progress + ", radius: " + circle.radius + ", angle: " + LeapUtil.toDegrees( sweptAngle ) + ", " + clockwiseness ); break; case Gesture.TYPE_SWIPE: var swipe:SwipeGesture = SwipeGesture( gesture ); trace( "Swipe id: " + swipe.id + ", " + swipe.state + ", position: " + swipe.position + ", direction: " + swipe.direction + ", speed: " + swipe.speed ); break; case Gesture.TYPE_SCREEN_TAP: var screenTap:ScreenTapGesture = ScreenTapGesture( gesture ); trace( "Screen Tap id: " + screenTap.id + ", " + screenTap.state + ", position: " + screenTap.position + ", direction: " + screenTap.direction ); break; case Gesture.TYPE_KEY_TAP: var keyTap:KeyTapGesture = KeyTapGesture( gesture ); trace( "Key Tap id: " + keyTap.id + ", " + keyTap.state + ", position: " + keyTap.position + ", direction: " + keyTap.direction ); break; default: trace( "Unknown gesture type." ); break; } } } } }
package com.playfab.AdminModels { public class PlayerStatisticDefinition { public var AggregationMethod:String; public var CurrentVersion:uint; public var StatisticName:String; public var VersionChangeInterval:String; public function PlayerStatisticDefinition(data:Object=null) { if(data == null) return; AggregationMethod = data.AggregationMethod; CurrentVersion = data.CurrentVersion; StatisticName = data.StatisticName; VersionChangeInterval = data.VersionChangeInterval; } } }
//////////////////////////////////////////////////////////////////////////////// // // ADOBE SYSTEMS INCORPORATED // Copyright 2007-2010 Adobe Systems Incorporated // All Rights Reserved. // // NOTICE: Adobe permits you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// package flashx.textLayout.container { import flashx.textLayout.property.Property; import flashx.textLayout.tlf_internal; use namespace tlf_internal; /** * The ScrollPolicy class is an enumeration class that defines values for setting the <code>horizontalScrollPolicy</code> and * <code>verticalScrollPolicy</code> properties of the ContainerController class, which defines a text flow * container. * * @see ContainerController#horizontalScrollPolicy * @see ContainerController#verticalScrollPolicy * @playerversion Flash 10 * @playerversion AIR 1.5 * @langversion 3.0 */ public final class ScrollPolicy { /** * Specifies that scrolling is to occur if the content exceeds the container's dimension. The runtime calculates * the number of lines that overflow the container and the user can navigate to them with cursor keys, by drag selecting, * or by rotating the mouse wheel. You can also cause scrolling to occur by setting the corresponding position value, * either <code>ContainerController.horizontalScrollPosition</code> or <code>ContainerController.verticalScrollPosition</code>. Also, the runtime can automatically * scroll the contents of the container during editing. * * @playerversion Flash 10 * @playerversion AIR 1.5 * @langversion 3.0 */ public static const AUTO:String = "auto"; /** * Causes the runtime to not display overflow lines, which means that the user cannot navigate to them. * In this case, setting the corresponding <code>ContainerController.horizontalScrollPosition</code> and * <code>ContainerController.verticalScrollPosition</code> properties have no effect. * * @playerversion Flash 10 * @playerversion AIR 1.5 * @langversion 3.0 */ public static const OFF:String = "off"; /** * Specifies that scrolling is available to access content that exceeds the container's dimension. The runtime calculates the * number of lines that overflow the container and allows the user to scroll them into view with the cursor keys, by drag selecting, * or by rotating the mouse wheel. You can also scroll by setting the corresponding position value, either * <code>ContainerController.horizontalScrollPosition</code> or <code>ContainerController.verticalScrollPosition</code>. Also, the runtime can automatically scroll the contents * of the container during editing. * * @playerversion Flash 10 * @playerversion AIR 1.5 * @langversion 3.0 */ public static const ON:String = "on"; /** Shared definition of the scrollPolicy property. @private */ static tlf_internal const scrollPolicyPropertyDefinition:Property = Property.NewEnumStringProperty("scrollPolicy", ScrollPolicy.AUTO, false, null, ScrollPolicy.AUTO, ScrollPolicy.OFF, ScrollPolicy.ON); } }
package qihoo.triplecleangame.protos { import com.netease.protobuf.*; import com.netease.protobuf.fieldDescriptors.*; import flash.utils.Endian; import flash.utils.IDataInput; import flash.utils.IDataOutput; import flash.utils.IExternalizable; import flash.errors.IOError; // @@protoc_insertion_point(imports) // @@protoc_insertion_point(class_metadata) public dynamic final class CMsgGetActivityDayEnergyRequest extends com.netease.protobuf.Message { /** * @private */ override public final function writeToBuffer(output:com.netease.protobuf.WritingBuffer):void { for (var fieldKey:* in this) { super.writeUnknown(output, fieldKey); } } /** * @private */ override public final function readFromSlice(input:flash.utils.IDataInput, bytesAfterSlice:uint):void { while (input.bytesAvailable > bytesAfterSlice) { var tag:uint = com.netease.protobuf.ReadUtils.read$TYPE_UINT32(input); switch (tag >> 3) { default: super.readUnknown(input, tag); break; } } } } }
package com.swfwire.decompiler.abc.instructions { import com.swfwire.decompiler.abc.*; public class Instruction_pushbyte implements IInstruction { public var byteValue:int; public function Instruction_pushbyte(byteValue:int = 0) { this.byteValue = byteValue; } } }
package visuals.ui.base { import com.playata.framework.display.Sprite; import com.playata.framework.display.lib.flash.FlashDisplayObjectContainer; import com.playata.framework.display.lib.flash.FlashLabel; import com.playata.framework.display.lib.flash.FlashLabelArea; import com.playata.framework.display.lib.flash.FlashSprite; import com.playata.framework.display.ui.controls.ILabel; import com.playata.framework.display.ui.controls.ILabelArea; import flash.display.MovieClip; import visuals.ui.elements.backgrounds.SymbolSlice9BackgroundTooltipGeneric; import visuals.ui.elements.generic.SymbolProgressBarBigGeneric; import visuals.ui.elements.goal.SymbolGoalInfoTtileRewardGeneric; import visuals.ui.elements.icons.SymbolIconBoosterGeneric; import visuals.ui.elements.icons.SymbolIconEnergyGeneric; import visuals.ui.elements.icons.SymbolIconGameCurrencyGeneric; import visuals.ui.elements.icons.SymbolIconGiftGeneric; import visuals.ui.elements.icons.SymbolIconPlusGeneric; import visuals.ui.elements.icons.SymbolIconPremiumCurrencyGeneric; import visuals.ui.elements.icons.SymbolIconXpGeneric; public class SymbolUiGoalItemButtonTooltipGeneric extends Sprite { private var _nativeObject:SymbolUiGoalItemButtonTooltip = null; public var background:SymbolSlice9BackgroundTooltipGeneric = null; public var progressBar:SymbolProgressBarBigGeneric = null; public var txtName:ILabelArea = null; public var captionProgress:ILabelArea = null; public var txtProgress:ILabelArea = null; public var captionReward:ILabelArea = null; public var iconXp:SymbolIconXpGeneric = null; public var iconBooster:SymbolIconBoosterGeneric = null; public var iconQuestEnergy:SymbolIconEnergyGeneric = null; public var iconStatPoints:SymbolIconPlusGeneric = null; public var iconItem:SymbolIconGiftGeneric = null; public var iconPremiumCurrency:SymbolIconPremiumCurrencyGeneric = null; public var iconCoins:SymbolIconGameCurrencyGeneric = null; public var txtReward:ILabel = null; public var title:SymbolGoalInfoTtileRewardGeneric = null; public function SymbolUiGoalItemButtonTooltipGeneric(param1:MovieClip = null) { if(param1) { _nativeObject = param1 as SymbolUiGoalItemButtonTooltip; } else { _nativeObject = new SymbolUiGoalItemButtonTooltip(); } super(null,FlashSprite.fromNative(_nativeObject)); var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer; background = new SymbolSlice9BackgroundTooltipGeneric(_nativeObject.background); progressBar = new SymbolProgressBarBigGeneric(_nativeObject.progressBar); txtName = FlashLabelArea.fromNative(_nativeObject.txtName); captionProgress = FlashLabelArea.fromNative(_nativeObject.captionProgress); txtProgress = FlashLabelArea.fromNative(_nativeObject.txtProgress); captionReward = FlashLabelArea.fromNative(_nativeObject.captionReward); iconXp = new SymbolIconXpGeneric(_nativeObject.iconXp); iconBooster = new SymbolIconBoosterGeneric(_nativeObject.iconBooster); iconQuestEnergy = new SymbolIconEnergyGeneric(_nativeObject.iconQuestEnergy); iconStatPoints = new SymbolIconPlusGeneric(_nativeObject.iconStatPoints); iconItem = new SymbolIconGiftGeneric(_nativeObject.iconItem); iconPremiumCurrency = new SymbolIconPremiumCurrencyGeneric(_nativeObject.iconPremiumCurrency); iconCoins = new SymbolIconGameCurrencyGeneric(_nativeObject.iconCoins); txtReward = FlashLabel.fromNative(_nativeObject.txtReward); title = new SymbolGoalInfoTtileRewardGeneric(_nativeObject.title); } public function setNativeInstance(param1:SymbolUiGoalItemButtonTooltip) : void { FlashSprite.setNativeInstance(_sprite,param1); _nativeObject = param1; syncInstances(); } public function syncInstances() : void { if(_nativeObject.background) { background.setNativeInstance(_nativeObject.background); } if(_nativeObject.progressBar) { progressBar.setNativeInstance(_nativeObject.progressBar); } FlashLabelArea.setNativeInstance(txtName,_nativeObject.txtName); FlashLabelArea.setNativeInstance(captionProgress,_nativeObject.captionProgress); FlashLabelArea.setNativeInstance(txtProgress,_nativeObject.txtProgress); FlashLabelArea.setNativeInstance(captionReward,_nativeObject.captionReward); if(_nativeObject.iconXp) { iconXp.setNativeInstance(_nativeObject.iconXp); } if(_nativeObject.iconBooster) { iconBooster.setNativeInstance(_nativeObject.iconBooster); } if(_nativeObject.iconQuestEnergy) { iconQuestEnergy.setNativeInstance(_nativeObject.iconQuestEnergy); } if(_nativeObject.iconStatPoints) { iconStatPoints.setNativeInstance(_nativeObject.iconStatPoints); } if(_nativeObject.iconItem) { iconItem.setNativeInstance(_nativeObject.iconItem); } if(_nativeObject.iconPremiumCurrency) { iconPremiumCurrency.setNativeInstance(_nativeObject.iconPremiumCurrency); } if(_nativeObject.iconCoins) { iconCoins.setNativeInstance(_nativeObject.iconCoins); } FlashLabel.setNativeInstance(txtReward,_nativeObject.txtReward); if(_nativeObject.title) { title.setNativeInstance(_nativeObject.title); } } } }
package { import flash.display.Sprite; /** * Bytecode size test * @author Philippe / http://philippe.elsass.me */ public class WeightCheck extends Sprite { public function WeightCheck() { //import aze.motion.EazeTween; EazeTween; // raw engine import aze.motion.eaze; eaze(this); // with all plugins } } }
package by.blooddy.crypto { import by.blooddy.crypto.events.ProcessEvent; import flexunit.framework.Assert; import org.flexunit.async.Async; import org.flexunit.runners.Parameterized; [RunWith( "org.flexunit.runners.Parameterized" )] /** * @author BlooDHounD * @version 1.0 * @playerversion Flash 11.4 * @langversion 3.0 * @created 21.03.2016 15:54:46 */ public class SHA1Test { //-------------------------------------------------------------------------- // // Class initialization // //-------------------------------------------------------------------------- Parameterized; //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- public static var $hash:Array = [ [ 'da39a3ee5e6b4b0d3255bfef95601890afd80709', '' ], [ '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', 'a' ], [ 'a9993e364706816aba3e25717850c26c9cd0d89d', 'abc' ], [ 'c12252ceda8be8994d5fa0290a47231c1d16aae3', 'message digest' ], [ '32d10c7b8cf96570ca04ce37f2a19d84240d3a89', 'abcdefghijklmnopqrstuvwxyz' ], [ '761c457bf73b14d27e9e9265c46f4b4dda11f940', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ], [ '50abf5706a150990a08b2c5ea40fa0e585554732', '12345678901234567890123456789012345678901234567890123456789012345678901234567890' ] ]; [Test( dataProvider="$hash" )] public function hash(result:String, str:String):void { Assert.assertEquals( SHA1.hash( str ), result ); } [Test( async, dataProvider="$hash" )] public function asyncHash(result:String, str:String):void { var hash:SHA1 = new SHA1(); hash.hash( str ); hash.addEventListener( ProcessEvent.COMPLETE, Async.asyncHandler( this, function(event:ProcessEvent, data:*):void { Assert.assertEquals( event.data, result ); }, 1e3 ) ); Async.registerFailureEvent( this, hash, ProcessEvent.ERROR ); } } }
// // DST Movie Viewer Document class // // Copyright (c) 2012 Kyoto University and DoGA // package { import fl.containers.ScrollPane; import fl.controls.List; import flash.display.*; import flash.events.*; import flash.net.drm.VoucherAccessInfo; import flash.text.TextField; import flash.ui.Mouse; import flash.net.*; import flash.external.ExternalInterface; import fl.video.*; import ToggleButtonBase; import RadioButtonBase; import CueItem; import EffectItem; import CaptionItem; import TransparentButton; import VolumeControl; import DualCaption; import Player3Videos; import PlayerControl; import PopupPlayerControl; import CustomSeekBarBase; import UtilFuncs; import BookmarkPane; import EffectControl; import EffectOnOff; /** * ムービービューア ドキュメントクラス(メインとなるクラス). * * <p>XMLファイルはFlashコンテンツを埋め込むHTMLファイルのobject要素内のparam要素で、 * 以下の要領で、「test.xml」の部分を読み込みたいファイル名に書き換えて指定する。</p> * <listing version="3.0">&lt;param name="FlashVars" value="xmlfname=test.xml" /&gt;</listing> * * <p>object要素は、IE用とその他のブラウザ用の2重になっているので注意。</p> */ public class MovieViewer extends MovieClip { /** Javascriptとの連携をするか */ const USE_JAVASCRIPT: Boolean = true; /** 映像の数 */ const MOVIE_NUM:uint = 3; /** 映像あたりのエフェクトの数 */ const EFFECT_NUM:uint = 4; /** 字幕の数 */ const CAPTION_NUM:uint = 2; /** XMLファイル名を受け取るパラメーター名 */ const XML_FILE_VARNAME:String = "xmlfname"; /** パラメータでファイル名が与えられなかった場合のデフォルトの映像記述XMLファイル名 */ const DEFAULT_XML_FILENAME:String = "test.xml"; /** 起動時の頭出し開始時刻を受け取るパラメータ名 */ const START_TIME_VARNAME:String = "sttime"; /** 起動時の頭出し終了時刻を受け取るパラメータ名 */ const END_TIME_VARNAME:String = "edtime"; /** 矢印のエフェクトの識別名 */ const EFFECT_TYPE_ARROW:String = "Arrow"; /** 円のエフェクトの識別名 */ const EFFECT_TYPE_CIRCLE:String = "Circle"; /** 画像のエフェクトの識別名 */ const EFFECT_TYPE_IMG:String = "Picture"; /** オーバーラップするポップアップ操作パネルのアルファ値 */ const POPUP_OVER_ALPHA:Number = 0.5; /** Matrixしおりのファイル名 */ const MATRIX_HTML_FILE_NAME:String = "LMMatrix.html"; /** マトリックスしおりを開くターゲット */ const MATRIX_HTML_TARGET:String = "lmmatrix"; /** 映像記述XMLファイル名 */ var xmlName:String; /** 映像記述XMLの存在するパス */ var xmlPathName:String; /** 映像ファイル名 */ var movieFileName:Array; /** 映像のReady状態チェック */ var movieReadyChk:Array; /** 映像の番号 */ var movieIdx:int; /** エフェクトの番号 */ var effectIdx:int; /** 字幕のインデックス */ var captionIdx:int; /** しおりリスト・しおりクリッカブルマップ統一インデックス */ var bookmarkIdx:int; /** しおりリストインデックス */ var bookmarkListIdx:int; /** しおりクリッカブルマップ統一インデックス */ var bookmarkMapIdx:int; /** エフェクトXMLファイル名 */ var effectFileName:Vector.<Vector.<String>>; /** XMLファイル別のエフェクトデータの配列 */ var effectArray:Vector.<Vector.<Vector.<EffectItem>>>; /** エフェクト制御オブジェクト */ var effectControler:EffectControl = new EffectControl(); /** エフェクトOn/Offボタン格納用配列 */ var effectButtonArray:Vector.<LabeledToggleButton>; /** エフェクト表示初期状態 */ var effSwInitialState:Vector.<Vector.<Boolean>>; /** エフェクトラベル */ var effLabel:Vector.<Vector.<String>>; /** 字幕XMLファイル名 */ var captionFileName:Vector.<String>; /** 読み込んだ字幕データ */ var captionArray:Vector.<Vector.<CaptionItem>>; /** 字幕On/Offボタン格納用配列 */ var capButtonArray:Vector.<ToggleButtonBase>; /** しおりリストXMLファイル名 */ var bookmarkListFileName:Vector.<String>; /** しおりクリッカブルマップXMLファイル名 */ var bookmarkMapFileName:Vector.<String>; /** 映像の長さ(秒) */ var movieLength:Number = 0; /** 選択中の映像の番号 */ var selectedVideo:int = -1; /** 起動時の頭出し開始時間 */ var startTimeOnLoaded:Number = -1; /** 起動時の頭出し終了時間 */ var endTimeOnLoaded:Number = -1; /** ファイルの読み込みに使用する URLLoader オブジェクト */ var loader:URLLoader; /** ファイルへのアクセスに使用する URLRequest オブジェクト */ var request:URLRequest; /** 戻るボタンの戻り先URL */ var returnUrl:String = "index.html"; var player_orig_x:Number; var player_orig_y:Number; var player_full_x:Number; var player_full_y:Number; var player_full_scale:Number = 1; /** 音量バーの1目盛りの半分の幅 */ var half_volume_step:Number; /** 準備完了までの目隠し */ public var mcShutter:MovieClip; /** 映像選択ボタン管理用配列 */ public var selVideoBtnArr:Array = new Array(); /** プレイヤー操作部(通常表示時) */ public var mcPlayerControl:PlayerControl; /** プレイヤー操作部(フルスクリーン表示時) */ public var mcPopupPlayerControl:PopupPlayerControl; /** フルスクリーン表示時のプレイヤー操作部以外のクリック検知用 */ public var mcUnderPopup:MovieClip; /** プレイヤー部 */ public var mc_player:Player3Videos; /** 字幕表示部(通常表示時) */ public var mc_Caption:DualCaption; /** 字幕表示部(フルスクリーン表示時) */ public var mc_CaptionFull:MovieClip; /** ファイル名表示部 */ public var dispFilename:TextField; /** 「戻る」ボタン */ public var bReturn:SimpleButton; /** 「表の表示」ボタン */ public var bMatrix:SimpleButton; /** シーン情報表示部 */ public var mcBookmarkPane:BookmarkPane; /** エフェクト表示切り替えボタンを保持するオブジェクト */ public var mcEffectButtons:EffectOnOff; /** フルスクリーン表示時背景 */ public var FullBG:MovieClip; /** 初期設定に戻るボタン */ public var bReset:SimpleButtonBase; /** * ファイル読み込みエラー時処理. * * @param event イベントオブジェクト */ public function loaderErrorHandler(event:ErrorEvent):void { mcShutter.tSetupReport.appendText("\n" + event.toString()); } /** * 相対パスを映像記述XMLファイルの位置基準のパスにする * 絶対パスはそのまま返す * @param path 元のパス * @return 調整後のパス */ public function relativePathFromXML(path:String):String { var pattern:RegExp =/^(\w+:|\\|\/)/; if (path.length == 0 || pattern.test(path)) { return path; } else { return xmlPathName + path; } } /** * 映像定義ファイル読み込み完了時処理. * * @param event イベントオブジェクト */ public function processMovieDesc(event:Event):void { var i:int; var j:int; var index:int; var index2:int; loader.removeEventListener(Event.COMPLETE, processMovieDesc); loader.removeEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); //読み込んだ内容を元に,XMLデータを作成 var xmlobj:XML = new XML(event.target.data); mcShutter.tSetupReport.text = "初期化中です"; //戻り先URL取得 if (xmlobj.hasOwnProperty("returnUrl")) { var urlStr:String = relativePathFromXML(xmlobj.returnUrl.toString()); if (UtilFuncs.checkProtocol(urlStr)) { returnUrl = urlStr; } } //映像ファイル情報取得 if (xmlobj.hasOwnProperty("movieFiles")) { for (i = 0; i < xmlobj.movieFiles.item.length(); ++i) { if (xmlobj.movieFiles.item[i].hasOwnProperty("@id")) { index = xmlobj.movieFiles.item[i].@id; } else { index = i; } if (xmlobj.movieFiles.item[i].hasOwnProperty("path")) { movieFileName[index] = relativePathFromXML(xmlobj.movieFiles.item[i].path.toString()); } if (xmlobj.movieFiles.item[i].hasOwnProperty("effectFiles")) { //エフェクトファイル情報取得 for (j=0; j < xmlobj.movieFiles.item[i].effectFiles.item.length(); ++j) { if (xmlobj.movieFiles.item[i].effectFiles.item[j].hasOwnProperty("@id")) { index2 = xmlobj.movieFiles.item[i].effectFiles.item[j].@id; } else { index2 = j; } if (xmlobj.movieFiles.item[i].effectFiles.item[j].hasOwnProperty("path")) { effectFileName[index][index2] = relativePathFromXML(xmlobj.movieFiles.item[i].effectFiles.item[j].path.toString()); } } } } } //字幕ファイル情報取得 if (xmlobj.hasOwnProperty("captionFiles")) { for (i=0; i < xmlobj.captionFiles.item.length(); ++i) { if (xmlobj.captionFiles.item[i].hasOwnProperty("@id")) { index = xmlobj.captionFiles.item[i].@id; } else { index = i; } if (xmlobj.captionFiles.item[i].hasOwnProperty("path")) { captionFileName[index] = relativePathFromXML(xmlobj.captionFiles.item[i].path.toString()); } } } //しおりファイル情報取得 if (xmlobj.hasOwnProperty("bookmarkListFiles")) { for (i=0; i < xmlobj.bookmarkListFiles.item.length(); ++i) { if (xmlobj.bookmarkListFiles.item[i].hasOwnProperty("path")) { bookmarkListFileName.push(relativePathFromXML(xmlobj.bookmarkListFiles.item[i].path.toString())); } } } //しおりクリッカブルマップファイル情報取得 if (xmlobj.hasOwnProperty("bookmarkMapFiles")) { for (i=0; i < xmlobj.bookmarkMapFiles.item.length(); ++i) { if (xmlobj.bookmarkMapFiles.item[i].hasOwnProperty("path")) { bookmarkMapFileName.push(relativePathFromXML(xmlobj.bookmarkMapFiles.item[i].path.toString())); } } } //再生時間取得 if (xmlobj.hasOwnProperty("movieLength")) { if (xmlobj.movieLength.hasOwnProperty("seconds")) { movieLength = UtilFuncs.StringToNumber(xmlobj.movieLength.seconds.toString()); } else if (xmlobj.movieLength.hasOwnProperty("hmsValue")) { movieLength = UtilFuncs.HMSToSecond(xmlobj.movieLength.hmsValue.toString()); } } //タイトル取得 if (xmlobj.hasOwnProperty("title")) { dispFilename.appendText(" : " + xmlobj.title.toString()); } startReadEffect(); } /** * エフェクトファイル読み込み開始. */ private function startReadEffect():void { mcShutter.tSetupReport.appendText("\nエフェクトの読み込み開始"); movieIdx = 0; effectIdx = 0; for (movieIdx = 0; movieIdx < MOVIE_NUM; ++movieIdx) { for (effectIdx = 0; effectIdx < EFFECT_NUM; ++effectIdx) { if (effectFileName[movieIdx][effectIdx] != "") { loader = new URLLoader(); request = new URLRequest(effectFileName[movieIdx][effectIdx]); loader.addEventListener(Event.COMPLETE, processEffectDesc); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); return; } } } //ファイルが全く無い場合のみここに来る effectControler.setup(effectArray, effSwInitialState, mc_player.mcEffectScreen, mc_player.player); startReadCaption(); } /** * エフェクト画像読み込み完了時処理. * * <p>読み込んだ画像の中央を原点に設定する。</p> * * @param event イベントオブジェクト */ public function imgLoadCompleteHandler(event:Event):void { var ldr:Loader = event.currentTarget.loader as Loader; ldr.removeEventListener(Event.COMPLETE, imgLoadCompleteHandler); ldr.removeEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); ldr.x = -ldr.content.width / 2; ldr.y = -ldr.content.height / 2; } /** * エフェクトファイル読み込み処理. * * @param event イベントオブジェクト */ public function processEffectDesc(event:Event):void { var i:int; var j:int; var index:int; var index2:int; var strEffType:String; var imgloader:Loader; loader.removeEventListener(Event.COMPLETE, processEffectDesc); loader.removeEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); //読み込んだ内容を元に,XMLデータを作成 var xmlobj:XML = new XML(event.target.data); if (xmlobj.hasOwnProperty("label")) { effLabel[movieIdx][effectIdx] = xmlobj.label.toString(); } if (xmlobj.hasOwnProperty("initialVisible")) { effSwInitialState[movieIdx][effectIdx] = UtilFuncs.strToBoolean(xmlobj.initialVisible.toString()); } for (i = 0; i < xmlobj.item.length(); ++i) { effectArray[movieIdx][effectIdx].push(new EffectItem()); with (effectArray[movieIdx][effectIdx][i]) { if (xmlobj.item[i].hasOwnProperty("id")) { id = xmlobj.item[i].id.toString(); } if (xmlobj.item[i].hasOwnProperty("type")) { strEffType = xmlobj.item[i].type.toString(); } if (xmlobj.item[i].(hasOwnProperty("image") && image.hasOwnProperty("path"))) { imagepath = relativePathFromXML(xmlobj.item[i].image.path.toString()); } //エフェクトのインスタンス生成 if (strEffType == EFFECT_TYPE_ARROW) { efftype = EffectControl.EFFECT_TYPE_ARROW; effectSymbol = new eff_arrow(); } else if (strEffType == EFFECT_TYPE_CIRCLE) { efftype = EffectControl.EFFECT_TYPE_CIRCLE; effectSymbol = new eff_circle(); } else if (strEffType == EFFECT_TYPE_IMG) { efftype = EffectControl.EFFECT_TYPE_IMG; imgloader = new Loader(); effectSymbol = new MovieClip(); effectSymbol.addChild(imgloader); imgloader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoadCompleteHandler); imgloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); imgloader.load(new URLRequest(imagepath)); } effectSymbol.originalHeight = effectSymbol.height; if (xmlobj.item[i].hasOwnProperty("cues")) { for (j = 0; j < xmlobj.item[i].cues.item.length(); ++j) { cueArr.push(new CueItem()); if (xmlobj.item[i].cues.item[j].hasOwnProperty("time")) { if (xmlobj.item[i].cues.item[j].time.hasOwnProperty("seconds")) { cueArr[j].time = UtilFuncs.StringToNumber(xmlobj.item[i].cues.item[j].time.seconds.toString()); } else if (xmlobj.item[i].cues.item[j].time.hasOwnProperty("hmsValue")) { cueArr[j].time = UtilFuncs.HMSToSecond(xmlobj.item[i].cues.item[j].time.hmsValue.toString()); } } if (xmlobj.item[i].cues.item[j].hasOwnProperty("pos")) { if (xmlobj.item[i].cues.item[j].pos.hasOwnProperty("x")) { cueArr[j].x = UtilFuncs.StringToNumber(xmlobj.item[i].cues.item[j].pos.x.toString()); } if (xmlobj.item[i].cues.item[j].pos.hasOwnProperty("y")) { cueArr[j].y = UtilFuncs.StringToNumber(xmlobj.item[i].cues.item[j].pos.y.toString()); } } if (xmlobj.item[i].cues.item[j].(hasOwnProperty("angle") && angle.hasOwnProperty("degree"))) { cueArr[j].angle = UtilFuncs.StringToNumber(xmlobj.item[i].cues.item[j].angle.degree.toString()); } if (xmlobj.item[i].cues.item[j].hasOwnProperty("scale")) { if (xmlobj.item[i].cues.item[j].scale.hasOwnProperty("x")) { cueArr[j].scaleX = UtilFuncs.StringToNumber(xmlobj.item[i].cues.item[j].scale.x.toString()); } if (xmlobj.item[i].cues.item[j].scale.hasOwnProperty("y")) { cueArr[j].scaleY = UtilFuncs.StringToNumber(xmlobj.item[i].cues.item[j].scale.y.toString()); } } if (sttime == 0) { sttime = cueArr[j].time; } if (edtime < cueArr[j].time) { edtime = cueArr[j].time; } } } } } //次のファイルの読み出し開始 ++effectIdx; while (movieIdx < MOVIE_NUM) { while (effectIdx < EFFECT_NUM) { if (effectFileName[movieIdx][effectIdx] != "") { loader = new URLLoader(); request = new URLRequest(effectFileName[movieIdx][effectIdx]); loader.addEventListener(Event.COMPLETE, processEffectDesc); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); return; } else { ++effectIdx; } } effectIdx = 0; ++movieIdx; } //最後のファイルの場合だけここに来る effectControler.setup(effectArray, effSwInitialState, mc_player.mcEffectScreen, mc_player.player); startReadCaption(); } /** * 字幕ファイル読み込み開始. */ private function startReadCaption():void { mcShutter.tSetupReport.appendText("\n字幕の読み込み開始"); for (captionIdx = 0; captionIdx < CAPTION_NUM; ++captionIdx) { if (captionFileName[captionIdx] != "") { loader = new URLLoader(); request = new URLRequest(captionFileName[captionIdx]); loader.addEventListener(Event.COMPLETE, processCaptionDesc); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); return; } } //ファイルが全く無い場合のみここに来る startReadBookmarkList(); } /** * 字幕ファイル読み込み処理. * * @param event イベントオブジェクト */ public function processCaptionDesc(event:Event):void { var i:int; var wknum:Number; loader.removeEventListener(Event.COMPLETE, processCaptionDesc); loader.removeEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); //読み込んだ内容を元に,XMLデータを作成 var xmlobj:XML = new XML(event.target.data); for (i = 0; i < xmlobj.item.length(); ++i) { captionArray[captionIdx].push(new CaptionItem()); with (captionArray[captionIdx][i]) { if (xmlobj.item[i].hasOwnProperty("id")) { id = xmlobj.item[i].id.toString(); } if (xmlobj.item[i].hasOwnProperty("text")) { captionText = xmlobj.item[i].text.toString(); } if (xmlobj.item[i].hasOwnProperty("startTime")) { if (xmlobj.item[i].startTime.hasOwnProperty("seconds")) { sttime = UtilFuncs.StringToNumber(xmlobj.item[i].startTime.seconds.toString()); } else if (xmlobj.item[i].startTime.hasOwnProperty("hmsValue")) { sttime = UtilFuncs.HMSToSecond(xmlobj.item[i].startTime.hmsValue.toString()); } } if (xmlobj.item[i].hasOwnProperty("endTime")) { if (xmlobj.item[i].endTime.hasOwnProperty("seconds")) { edtime = UtilFuncs.StringToNumber(xmlobj.item[i].endTime.seconds.toString()); } else if (xmlobj.item[i].endTime.hasOwnProperty("hmsValue")) { edtime = UtilFuncs.HMSToSecond(xmlobj.item[i].endTime.hmsValue.toString()); } } if (edtime < sttime) { wknum = edtime; edtime = sttime; sttime = wknum; } if (xmlobj.item[i].hasOwnProperty("font")) { if (xmlobj.item[i].font.hasOwnProperty("size")) { fontSize = UtilFuncs.StringToNumber(xmlobj.item[i].font.size.toString()); } } } } mc_Caption.setCaptionData(captionIdx, captionArray[captionIdx]); //次のファイルの読み出し開始 ++captionIdx; while (captionIdx < CAPTION_NUM) { if (captionFileName[captionIdx] != "") { loader = new URLLoader(); request = new URLRequest(captionFileName[captionIdx]); loader.addEventListener(Event.COMPLETE, processCaptionDesc); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); return; } ++captionIdx; } //最後のファイルの場合だけここに来る startReadBookmarkList(); } /** * しおりリスト読み込み開始. */ private function startReadBookmarkList():void { mcShutter.tSetupReport.appendText("\nしおりリストの読み込み開始"); bookmarkIdx = 0; for (bookmarkListIdx = 0; bookmarkListIdx < bookmarkListFileName.length; ++bookmarkListIdx) { if (bookmarkListFileName[bookmarkListIdx] != "") { loader = new URLLoader(); request = new URLRequest(bookmarkListFileName[bookmarkListIdx]); loader.addEventListener(Event.COMPLETE, processBookmarkList); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); return; } } //ファイルが全く無い場合のみここに来る startReadBookmarkMap(); } /** * 再生範囲を設定する * @param sttime 開始時刻 * @param edtime 終了時刻 */ public function setPlayRange(sttime:Number, edtime:Number):void { if (sttime < mc_player.playRangeEnd) { mc_player.playRangeStart = sttime; mc_player.playRangeEnd = edtime; } else { mc_player.playRangeEnd = edtime; mc_player.playRangeStart = sttime; } } /** * しおり選択処理. * * @param event イベントオブジェクト */ public function bookmarkSelectHandler(event:Event):void { var list:List = event.target as List; var btn:TransparentButton = event.target as TransparentButton; var bkmkdata:BookmarkItem; if (list != null) { // しおりリストがクリックされた場合 if (list.selectedItem != null) { bkmkdata = list.selectedItem.data; } } else if (btn != null) { // しおりクリッカブルマップがクリックされた場合 bkmkdata = btn.bkmk; } if (bkmkdata != null) { setPlayRange(bkmkdata.sttime, bkmkdata.edtime); if (bkmkdata == mcBookmarkPane.selectedBookmark) { //選択中のしおりが再度クリックされたら頭出し headHandler(null); } else if (mc_player.playheadTime < bkmkdata.sttime || mc_player.playheadTime > bkmkdata.edtime) { if (mcPlayerControl.bPause.visible) { pauseHandler(null); } //mc_player.pauseVideo(); mc_player.seekVideo(bkmkdata.sttime); } } mcBookmarkPane.selectionUpdated(true); mcBookmarkPane.selectedBookmark = bkmkdata; } /** * 範囲選択スライダドラッグ時にしおりを無効化する */ public function bookmarkInvalidated():void { mcBookmarkPane.selectionUpdated(false); } /** * しおり選択解除ボタン処理 * * @param event イベントオブジェクト */ public function cancelBookmarkHandler(event:MouseEvent):void { mc_player.playRangeStart = 0; mc_player.playRangeEnd = movieLength; mcBookmarkPane.cancelBookmarkSelection(); } /** * しおりリスト読み込み処理. * * @param event イベントオブジェクト */ public function processBookmarkList(event:Event):void { var i:int; var itemlabel:String; var bkmkdata:BookmarkItem; loader.removeEventListener(Event.COMPLETE, processBookmarkList); loader.removeEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); //読み込んだ内容を元に,XMLデータを作成 var xmlobj:XML = new XML(event.target.data); var listno:int = mcBookmarkPane.addList(bookmarkSelectHandler); for (i = 0; i < xmlobj.item.length(); ++i) { bkmkdata = new BookmarkItem(); itemlabel = ""; if (xmlobj.item[i].hasOwnProperty("startTime")) { if (xmlobj.item[i].startTime.hasOwnProperty("seconds")) { bkmkdata.sttime = UtilFuncs.StringToNumber(xmlobj.item[i].startTime.seconds.toString()); } else if (xmlobj.item[i].startTime.hasOwnProperty("hmsValue")) { bkmkdata.sttime = UtilFuncs.HMSToSecond(xmlobj.item[i].startTime.hmsValue.toString()); } } if (xmlobj.item[i].hasOwnProperty("endTime")) { if (xmlobj.item[i].endTime.hasOwnProperty("seconds")) { bkmkdata.edtime = UtilFuncs.StringToNumber(xmlobj.item[i].endTime.seconds.toString()); } else if (xmlobj.item[i].endTime.hasOwnProperty("hmsValue")) { bkmkdata.edtime = UtilFuncs.HMSToSecond(xmlobj.item[i].endTime.hmsValue.toString()); } } if (xmlobj.item[i].hasOwnProperty("text")) { itemlabel = xmlobj.item[i].text.toString(); } if (xmlobj.item[i].hasOwnProperty("favorite")) { bkmkdata.isFav = UtilFuncs.strToBoolean(xmlobj.item[i].favorite.toString()); } bkmkdata.id = ("000" + i.toString()).substr( -3); mcBookmarkPane.addBookmarkToList(listno, itemlabel, bkmkdata); } //次のファイルの読み出し開始 ++bookmarkIdx; ++bookmarkListIdx; while (bookmarkListIdx < bookmarkListFileName.length) { if (bookmarkListFileName[bookmarkListIdx] != "") { loader = new URLLoader(); request = new URLRequest(bookmarkListFileName[bookmarkListIdx]); loader.addEventListener(Event.COMPLETE, processBookmarkList); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); return; } ++bookmarkListIdx; } //最後のファイルの場合だけここに来る startReadBookmarkMap(); } /** * しおりクリッカブルマップ読み込み開始 */ private function startReadBookmarkMap():void { mcShutter.tSetupReport.appendText("\nしおりクリッカブルマップの読み込み開始"); for (bookmarkMapIdx = 0; bookmarkMapIdx < bookmarkMapFileName.length; ++bookmarkMapIdx) { if (bookmarkMapFileName[bookmarkMapIdx] != "") { loader = new URLLoader(); request = new URLRequest(bookmarkMapFileName[bookmarkMapIdx]); loader.addEventListener(Event.COMPLETE, processBookmarkMap); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); return; } } //ファイルが全く無い場合のみここに来る setMovie(); } /** * しおりクリッカブルマップ読み込み処理. * * @param event イベントオブジェクト */ public function processBookmarkMap(event:Event):void { var i:int; var bkmkdata:BookmarkItem; var x1:Number; var x2:Number; var y1:Number; var y2:Number; var maparea: TransparentButton; var imagesource:String = ""; loader.removeEventListener(Event.COMPLETE, processBookmarkMap); loader.removeEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); //読み込んだ内容を元に,XMLデータを作成 var xmlobj:XML = new XML(event.target.data); //pane = new ScrollPane(); if (xmlobj.(hasOwnProperty("image") && image.hasOwnProperty("path"))) { imagesource = relativePathFromXML(xmlobj.image.path.toString()); } var mapno:int = mcBookmarkPane.addClickableMap(imagesource); for (i = 0; i < xmlobj.item.length(); ++i) { bkmkdata = new BookmarkItem(); maparea = new TransparentButton(); x1 = 0; y1 = 0; x2 = 0; y2 = 0; if (xmlobj.item[i].hasOwnProperty("startTime")) { if (xmlobj.item[i].startTime.hasOwnProperty("seconds")) { bkmkdata.sttime = UtilFuncs.StringToNumber(xmlobj.item[i].startTime.seconds.toString()); } else if (xmlobj.item[i].startTime.hasOwnProperty("hmsValue")) { bkmkdata.sttime = UtilFuncs.HMSToSecond(xmlobj.item[i].startTime.hmsValue.toString()); } } if (xmlobj.item[i].hasOwnProperty("endTime")) { if (xmlobj.item[i].endTime.hasOwnProperty("seconds")) { bkmkdata.edtime = UtilFuncs.StringToNumber(xmlobj.item[i].endTime.seconds.toString()); } else if (xmlobj.item[i].endTime.hasOwnProperty("hmsValue")) { bkmkdata.edtime = UtilFuncs.HMSToSecond(xmlobj.item[i].endTime.hmsValue.toString()); } } if (xmlobj.item[i].hasOwnProperty("area")) { if (xmlobj.item[i].area.hasOwnProperty("x1")) { x1 = UtilFuncs.StringToNumber(xmlobj.item[i].area.x1.toString()); } if (xmlobj.item[i].area.hasOwnProperty("y1")) { y1 = UtilFuncs.StringToNumber(xmlobj.item[i].area.y1.toString()); } if (xmlobj.item[i].area.hasOwnProperty("x2")) { x2 = UtilFuncs.StringToNumber(xmlobj.item[i].area.x2.toString()); } if (xmlobj.item[i].area.hasOwnProperty("y2")) { y2 = UtilFuncs.StringToNumber(xmlobj.item[i].area.y2.toString()); } } maparea.setup(x1, y1, x2, y2, bkmkdata); maparea.addEventListener(MouseEvent.CLICK, bookmarkSelectHandler); mcBookmarkPane.addBookmarkToMap(mapno, maparea); } //次のファイルの読み出し開始 ++bookmarkIdx; ++bookmarkMapIdx; while (bookmarkMapIdx < bookmarkMapFileName.length) { if (bookmarkMapFileName[bookmarkMapIdx] != "") { loader = new URLLoader(); request = new URLRequest(bookmarkMapFileName[bookmarkMapIdx]); loader.addEventListener(Event.COMPLETE, processBookmarkMap); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); return; } ++bookmarkMapIdx; } //最後のファイルの場合だけここに来る setMovie(); } /** * 動画へのアクセス開始 */ private function setMovie():void { mcShutter.tSetupReport.appendText("\nムービーの準備中です"); movieIdx = 0; mc_player.player.addEventListener(VideoEvent.READY, setMovie3); mc_player.videoSource = movieFileName[movieIdx]; } /** * READYイベントハンドラ. * * <p>ムービー1つアクセスする毎にREADYを待つ。</p> * * @param eventObject イベントオブジェクト */ public function setMovie2(eventObject:VideoEvent):void { mcPlayerControl.mc_seekBar.totalPlaytime = mc_player.player.totalTime; mcPopupPlayerControl.mc_seekBar.totalPlaytime = mc_player.player.totalTime; movieReadyChk[movieIdx] = 1; ++movieIdx; while ((movieIdx < MOVIE_NUM) && (movieFileName[movieIdx] == "")) { ++movieIdx; } if (movieIdx >= MOVIE_NUM) { mc_player.player.removeEventListener(VideoEvent.READY, setMovie2); endSetup(); return; } mc_player.player.activeVideoPlayerIndex = movieIdx; //trace ("movieFileName[",movieIdx,"] fname:",movieFileName[movieIdx]); mc_player.videoSource = movieFileName[movieIdx]; } /** * READYイベントハンドラ. * * <p>2つめ以降のムービーはREADYを待たずに次の処理へ進む。</p> * * @param eventObject イベントオブジェクト */ public function setMovie3(eventObject:VideoEvent):void { mc_player.player.removeEventListener(VideoEvent.READY, setMovie3); mcPlayerControl.mc_seekBar.totalPlaytime = movieLength; mcPopupPlayerControl.mc_seekBar.totalPlaytime = movieLength; movieReadyChk[movieIdx] = 1; ++movieIdx; while (movieIdx < MOVIE_NUM) { if (movieFileName[movieIdx] != "") { mc_player.player.activeVideoPlayerIndex = movieIdx; //trace ("movieFileName[",movieIdx,"] fname:",movieFileName[movieIdx]); mc_player.videoSource = movieFileName[movieIdx]; } ++movieIdx; } endSetup(); } /** * 文字列を秒数に変換する * @param str * @return */ public function getsec(str:String): Number { var num: Number; num = UtilFuncs.HMSToSecond(str, NaN); if (isNaN(num)) { num = Number(str); } if (isNaN(num)) { return -1; } else { return num; } } /** * javascriptから呼び出してしおりをセット * @param sttime_str 再生開始時刻 * @param edtime_str 再生終了時刻 */ private function setRangeCallback(sttime_str:String, edtime_str:String) { var sttime:Number = getsec(sttime_str); var edtime:Number = getsec(edtime_str); if (sttime >= 0 && edtime >= 0) { if (sttime > edtime) { (function() { var tmp:Number = sttime; sttime = edtime; edtime = tmp; })(); } setPlayRange(sttime, edtime); if (mc_player.playheadTime < sttime || mc_player.playheadTime > edtime) { if (mcPlayerControl.bPause.visible) { pauseHandler(null); } mc_player.seekVideo(sttime); } } } /** * 初期設定の最終処理. */ public function endSetup():void { mc_player.player.activeVideoPlayerIndex = 0; chngVideo(0); mc_Caption.updateCaption(0, true); this.addEventListener(Event.ENTER_FRAME, enterframeHandler); mcShutter.visible = false; //リクエストパラメータで範囲指定されていた場合 if (startTimeOnLoaded >= 0 && endTimeOnLoaded >= 0) { setPlayRange(startTimeOnLoaded, endTimeOnLoaded); mc_player.seekVideo(startTimeOnLoaded); } if (ExternalInterface.available && USE_JAVASCRIPT) { ExternalInterface.addCallback("setPlayRange", setRangeCallback); } } /** * エフェクトの表示切り替えボタンの ON/OFF 状態変更時の処理. * * @param obj プロパティ effno で対象エフェクトの番号を、プロパティ onoff で表示・非表示を指定。 */ public function effectSW(obj:Object):void { var effno:int = obj.effno; var effsw:Boolean = obj.onoff; effectControler.setDispMode(selectedVideo, effno, effsw); } /** * 映像切替完了後に実行する処理として <code>Player3Videos.setOnChangeVideoFunc()</code>に登録し、エフェクトと切替ボタンの表示状態を更新する. * * @param obj 切替先の映像番号 */ public function chngVideoEffect(obj:Object):void { var no:int = int(obj); effectControler.swDisp(no,true); selectedVideo = no; for (var i:int = 0; i < effectButtonArray.length; ++i) { if (effectControler.getDispMode(no, i)) { effectButtonArray[i].setOn(true); } else { effectButtonArray[i].setOff(true); } effectButtonArray[i].label.text = effLabel[no][i]; } } /** * 映像切替ボタンの処理. * * @param obj 切替先の映像番号 */ public function chngVideo(obj:Object):void { var no:int = int(obj); if (selectedVideo == no) return; mc_player.setOnChangeVideoFunc(chngVideoEffect, obj); mc_player.chngVideo(no); } /** * 戻るボタン処理. * * @param event イベントオブジェクト */ public function bReturnHandler(event:MouseEvent):void { var request:URLRequest = new URLRequest(returnUrl); navigateToURL(request, "_self"); } /** * 表の表示処理. * * @param event イベントオブジェクト */ public function bMatrixHandler(event:MouseEvent):void { var request:URLRequest = new URLRequest(xmlPathName + "../" + MATRIX_HTML_FILE_NAME); navigateToURL(request, MATRIX_HTML_TARGET); } /** * 頭出しボタン処理. * * @param obj 未使用 */ public function headHandler(obj:Object):void { mc_player.seekVideo(mc_player.playRangeStart); mcPlayerControl.bHead.buttonEnabled = false; } /** * フレーム戻しボタン処理. * * @param event イベントオブジェクト */ public function prevFrameHandler(event:MouseEvent):void { mc_player.stepFrame( -1); } /** * 1秒戻しボタン処理. * * @param event イベントオブジェクト */ public function prevSecondHandler(event:MouseEvent):void { mc_player.stepSecond( -1); } /** * 全区間選択時処理. * * @param event イベントオブジェクト */ public function allRangePlayHandler(event:MouseEvent):void { cancelBookmarkHandler(null); } /** * Playボタン処理. * * @param event イベントオブジェクト */ public function playHandler(event:MouseEvent):void { if (mcPlayerControl.bSlow.isOn()) { mc_player.speedRangePlayVideo(0.5); } else { mc_player.speedRangePlayVideo(); } mcPlayerControl.bPause.visible = true; mcPlayerControl.bPlay.visible = false; mcPopupPlayerControl.bPause.visible = true; mcPopupPlayerControl.bPlay.visible = false; } /** * Pauseボタン処理. * * @param event イベントオブジェクト */ public function pauseHandler(event:MouseEvent):void { mc_player.pauseVideo(); mcPlayerControl.bPause.visible = false; mcPlayerControl.bPlay.visible = true; mcPopupPlayerControl.bPause.visible = false; mcPopupPlayerControl.bPlay.visible = true; } /** * スローモード切替処理. * * @param obj プロパティ onoff でON/OFFを指定。 */ public function slowSW(obj:Object):void { var sw:Boolean = obj.onoff; switch (mc_player.status) { case Player3Videos.MODE_FAST: case Player3Videos.MODE_SLOW: case Player3Videos.MODE_PLAY: case Player3Videos.MODE_RANGE: case Player3Videos.MODE_RANGE_FAST: case Player3Videos.MODE_RANGE_SLOW: if (sw) { mc_player.speedRangePlayVideo(0.5, -1, -1, false); } else { mc_player.speedRangePlayVideo(1, -1, -1, false); } break; case Player3Videos.MODE_RANGE_END: case Player3Videos.MODE_PAUSE: break; } } /** * 1秒送りボタン処理. * * @param event イベントオブジェクト */ public function nextSecondHandler(event:MouseEvent):void { mc_player.stepSecond(1); } /** * フレーム送りボタン処理. * * @param event イベントオブジェクト */ public function nextFrameHandler(event:MouseEvent):void { mc_player.stepFrame(1); } /** * 繰り返し再生ON. * * @param obj 未使用 */ public function repeatOnHandler(obj:Object):void { mc_player.rangeRepeat = true; } /** * 繰り返し再生OFF. * * @param obj 未使用 */ public function repeatOffHandler(obj:Object):void { mc_player.rangeRepeat = false; } /** * 字幕の表示切り替えボタンの ON/OFF 状態変更時の処理. * * @param obj プロパティ btnno で対象ボタンの番号を、プロパティ onoff で表示・非表示を指定。 */ public function captionSW(obj:Object):void { var btnno:uint = obj.btnno; var sw:Boolean = obj.onoff; mc_Caption.captionDispSwSingle(btnno, sw); var now:Number = mc_player.player.playheadTime; mc_Caption.updateCaption(now, true); } /** * フルスクリーン表示切り替えボタン処理 * * @param event イベントオブジェクト */ public function fullScreenBtnHandler(event:MouseEvent):void { setFullScreen(); } /** * 通常表示切り替えボタン処理 * * @param event イベントオブジェクト */ public function normalScreenBtnHandler(event:MouseEvent):void { endFullScreen(); } /** * フルスクリーンクリック処理. * * @param event イベントオブジェクト */ public function clickFullScreenHandler(event:MouseEvent):void { if (!mcPopupPlayerControl.visible) { mcPopupPlayerControl.alpha = POPUP_OVER_ALPHA; mcPopupPlayerControl.visible = true; } else { //フルスクリーン解除 endFullScreen(); } } /** * ポップアップ操作パネルを綴じる * * @param event イベントオブジェクト */ public function closePopupPlayerControl(event:MouseEvent):void { mcPopupPlayerControl.visible = false; } /** * ポップアップ操作パネルマウスオーバー処理 * * @param event イベントオブジェクト */ public function popupOverHandler(event:MouseEvent):void { mcPopupPlayerControl.alpha = 1.0; } /** * ポップアップ操作パネルマウスアウト処理 * * @param event イベントオブジェクト */ public function popupOutHandler(event:MouseEvent):void { mcPopupPlayerControl.alpha = POPUP_OVER_ALPHA; } /** * 初期設定に戻るボタン処理 * * @param event */ public function bResetHandler(event:MouseEvent):void { if (mcPlayerControl.bPause.visible) { mcPlayerControl.bPause.dispatchEvent(new MouseEvent(MouseEvent.CLICK)); } if (mcPlayerControl.bSlow.isOn()) { mcPlayerControl.bSlow.dispatchEvent(new MouseEvent(MouseEvent.CLICK)); } mcPlayerControl.bAllRange.dispatchEvent(new MouseEvent(MouseEvent.CLICK)); mc_player.seekVideo(0); for (var mvidx:int = 0; mvidx < MOVIE_NUM; ++mvidx) { for (var effidx:int = 0; effidx < EFFECT_NUM; ++effidx) { effectControler.setDispMode(mvidx, effidx, effSwInitialState[mvidx][effidx]); } } chngVideoEffect(int(selectedVideo)); } /** * フレーム毎の処理. * * @param event イベントオブジェクト */ public function enterframeHandler(event:Event):void { var now:Number = mc_player.player.playheadTime; mc_Caption.updateCaption(now); mcPlayerControl.mc_seekBar.updateView(); mcPopupPlayerControl.mc_seekBar.updateView(); effectControler.updateView(now); if (mc_player.status == Player3Videos.MODE_RANGE_END && mcPlayerControl.bPause.visible) { mcPlayerControl.bPause.visible = false; mcPlayerControl.bPlay.visible = true; mcPopupPlayerControl.bPause.visible = false; mcPopupPlayerControl.bPlay.visible = true; } if (!mcPlayerControl.mcVolumeControl.isDragging() && Math.abs(mc_player.player.volume - mcPlayerControl.mcVolumeControl.volume) > half_volume_step) { mcPlayerControl.mcVolumeControl.volume = mc_player.player.volume; } if (! mcPopupPlayerControl.mcVolumeControl.isDragging() && Math.abs(mc_player.player.volume - mcPopupPlayerControl.mcVolumeControl.volume) > half_volume_step) { mcPopupPlayerControl.mcVolumeControl.volume = mc_player.player.volume; } //if (mc_player.status != Player3Videos.MODE_PAUSE) { if (!mc_player.isSeeking) { if (Math.abs(mc_player.playheadTime-mcPlayerControl.mc_seekBar.playRangeStart) > mc_player.deemedKeyFramePitch) { mcPlayerControl.bHead.buttonEnabled = true; } else { mcPlayerControl.bHead.buttonEnabled = false; } } } /** * フルスクリーン表示切り替え処理 */ public function setFullScreen():void { mcPlayerControl.visible = false; mcUnderPopup.visible = true; mc_CaptionFull.visible = true; mc_Caption.dispTo = mc_CaptionFull; mc_Caption.updateCaption(mc_player.player.playheadTime, true); mc_player.x = player_full_x; mc_player.y = player_full_y; mc_player.scaleX = player_full_scale; mc_player.scaleY = player_full_scale; FullBG.visible = true; stage.displayState = "fullScreen"; } /** * 通常表示切替処理 */ public function endFullScreen():void { stage.displayState = "normal"; mcPlayerControl.visible = true; mcPopupPlayerControl.visible = false; mcUnderPopup.visible = false; mc_CaptionFull.visible = false; mc_Caption.dispTo = mc_Caption; mc_Caption.updateCaption(mc_player.player.playheadTime, true); mc_player.x = player_orig_x; mc_player.y = player_orig_y; mc_player.scaleX = 1; mc_player.scaleY = 1; FullBG.visible = false; } /** * コンストラクタ. * * <p>メンバの初期化を行い、映像記述XMLファイルの読み込みを開始する。</p> */ public function MovieViewer() { var flashVars:Object = loaderInfo.parameters; var i:int; var j:int; var btnparam:Object; var player_orig_width:Number; var player_orig_height:Number; var player_full_width:Number; var player_full_height:Number; var scale1:Number; var scale2:Number; stage.scaleMode = StageScaleMode.SHOW_ALL; FullBG.visible = false; player_orig_x = mc_player.x; player_orig_y = mc_player.y; player_orig_width = mc_player.width; player_orig_height = mc_player.height; player_full_x = 0; player_full_y = 0; player_full_width = stage.width; player_full_height = mc_CaptionFull.y; scale1 = player_full_width / player_orig_width; scale2 = player_full_height / player_orig_height; if (scale1 <= scale2) { player_full_scale = scale1; player_full_y = (mc_CaptionFull.y - player_orig_height * player_full_scale) / 2; } else { player_full_scale = scale2; player_full_x = (stage.width - player_orig_width * player_full_scale) / 2; } half_volume_step = 1.0 / mcPlayerControl.mcVolumeControl.volumeStepNumber / 2; //戻るボタンの設定 bReturn.addEventListener(MouseEvent.CLICK, bReturnHandler); //表の表示ボタンの設定 bMatrix.addEventListener(MouseEvent.CLICK, bMatrixHandler); //映像切替ボタンの設定 selVideoBtnArr.push(0); btnVideo1.attachTo(selVideoBtnArr); btnVideo1.setOnFunc(chngVideo, int(0)); btnVideo2.attachTo(selVideoBtnArr); btnVideo2.setOnFunc(chngVideo, int(1)); btnVideo3.attachTo(selVideoBtnArr); btnVideo3.setOnFunc(chngVideo, int(2)); //字幕ON/OFFボタンの設定 capButtonArray = new Vector.<ToggleButtonBase>(); capButtonArray.push(mc_Caption.bCap1); capButtonArray.push(mc_Caption.bCap2); for (i = 0; i < capButtonArray.length; ++i) { capButtonArray[i].setOff(); btnparam = new Object(); btnparam.btnno = i; btnparam.onoff = false; capButtonArray[i].setOffFunc(captionSW, btnparam); captionSW(btnparam); btnparam = new Object(); btnparam.btnno = i; btnparam.onoff = true; capButtonArray[i].setOnFunc(captionSW, btnparam); capButtonArray[i].setOn(); } //エフェクトON/OFFボタンの設定 var effbtnparam:Object; effectButtonArray = new Vector.<LabeledToggleButton>(); effectButtonArray.push(mcEffectButtons.btnA); effectButtonArray.push(mcEffectButtons.btnB); effectButtonArray.push(mcEffectButtons.btnC); effectButtonArray.push(mcEffectButtons.btnD); for (i = 0; i < effectButtonArray.length; ++i) { effectButtonArray[i].setOff(); effbtnparam = new Object(); effbtnparam.effno = i; effbtnparam.onoff = false; effectButtonArray[i].setOffFunc(effectSW, effbtnparam); effbtnparam = new Object(); effbtnparam.effno = i; effbtnparam.onoff = true; effectButtonArray[i].setOnFunc(effectSW, effbtnparam); } //プレイヤー操作部の設定 //SimpleButtonBaseから派生するボタンで、有効・無効を切り替えるものは、イベントリスナーでなくset~Funcで処理を設定すること mcPlayerControl.bHead.setClickFunc(headHandler, null); mcPlayerControl.bPrevF.addEventListener(MouseEvent.CLICK, prevFrameHandler); mcPlayerControl.bPrevS.addEventListener(MouseEvent.CLICK, prevSecondHandler); mcPlayerControl.bAllRange.addEventListener(MouseEvent.CLICK, allRangePlayHandler); mcPlayerControl.bPlay.addEventListener(MouseEvent.CLICK, playHandler); mcPlayerControl.bPause.addEventListener(MouseEvent.CLICK, pauseHandler); mcPlayerControl.bSlow.setOff(); btnparam = new Object(); btnparam.onoff = false; mcPlayerControl.bSlow.setOffFunc(slowSW, btnparam); btnparam = new Object(); btnparam.onoff = true; mcPlayerControl.bSlow.setOnFunc(slowSW, btnparam); mcPlayerControl.bNextS.addEventListener(MouseEvent.CLICK, nextSecondHandler); mcPlayerControl.bNextF.addEventListener(MouseEvent.CLICK, nextFrameHandler); mcPlayerControl.bRepeatOnOff.setOnFunc(repeatOnHandler, null); mcPlayerControl.bRepeatOnOff.setOffFunc(repeatOffHandler, null); mcPlayerControl.mcVolumeControl.setTargetPlayer(mc_player.player); mcPlayerControl.mc_seekBar.setTargetPlayer(mc_player); mcPlayerControl.mc_seekBar.onDraggingRange = bookmarkInvalidated; mcPlayerControl.bFullScreen.addEventListener(MouseEvent.CLICK, fullScreenBtnHandler); mcPopupPlayerControl.bPlay.addEventListener(MouseEvent.CLICK, playHandler); mcPopupPlayerControl.bPause.addEventListener(MouseEvent.CLICK, pauseHandler); mcPopupPlayerControl.mcVolumeControl.setTargetPlayer(mc_player.player); mcPopupPlayerControl.mc_seekBar.setTargetPlayer(mc_player); mcPopupPlayerControl.bNormalScreen.addEventListener(MouseEvent.CLICK, normalScreenBtnHandler); mcPopupPlayerControl.bClose.addEventListener(MouseEvent.CLICK, closePopupPlayerControl); mcPopupPlayerControl.addEventListener(MouseEvent.MOUSE_OVER, popupOverHandler); mcPopupPlayerControl.addEventListener(MouseEvent.MOUSE_OUT, popupOutHandler); mcPopupPlayerControl.mc_seekBar.onDraggingRange = bookmarkInvalidated; mcUnderPopup.addEventListener(MouseEvent.CLICK, clickFullScreenHandler); mc_CaptionFull.visible = false; mcPopupPlayerControl.visible = false; mcUnderPopup.visible = false; //シーン情報表示部の処理 mcBookmarkPane.bookmarkListHeader.bCancel.addEventListener(MouseEvent.CLICK, cancelBookmarkHandler); bReset.addEventListener(MouseEvent.CLICK, bResetHandler); //データ構造の初期化 movieFileName = new Array(MOVIE_NUM); movieReadyChk = new Array(MOVIE_NUM); for (i=0; i< MOVIE_NUM; ++i) { movieFileName[i] = ""; movieReadyChk[i] = 0; } effectFileName = new Vector.<Vector.<String>>(MOVIE_NUM); effectArray = new Vector.<Vector.<Vector.<EffectItem>>>(MOVIE_NUM); effSwInitialState = new Vector.<Vector.<Boolean>>(MOVIE_NUM); effLabel = new Vector.<Vector.<String>>(MOVIE_NUM); for (i=0; i< MOVIE_NUM; ++i) { effectFileName[i] = new Vector.<String>(EFFECT_NUM); effectArray[i] = new Vector.<Vector.<EffectItem>>(EFFECT_NUM); effSwInitialState[i] = new Vector.<Boolean>(EFFECT_NUM); effLabel[i] = new Vector.<String>(EFFECT_NUM); for (j = 0; j < EFFECT_NUM; ++j) { effectFileName[i][j] = ""; effectArray[i][j] = new Vector.<EffectItem>(); effSwInitialState[i][j] = false; effLabel[i][j] = "エフェクト " + String("ABCDEFGHIJ").substr(j, 1); } } captionFileName = new Vector.<String>(CAPTION_NUM); captionArray = new Vector.<Vector.<CaptionItem>>(CAPTION_NUM); for (i=0; i< CAPTION_NUM; ++i) { captionFileName[i] = ""; captionArray[i] = new Vector.<CaptionItem>(); } bookmarkListFileName = new Vector.<String>(); bookmarkMapFileName = new Vector.<String>(); // 映像定義XMLファイル名の取得 //var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters[XML_FILE_VARNAME]; //if (paramObj) { // xmlName = paramObj.toString(); //} //if (!xmlName) { // xmlName = DEFAULT_XML_FILENAME; //} var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters; var param_str:String; for (var name_str:String in paramObj) { param_str = String(paramObj[name_str]); switch (name_str) { // 映像定義XMLファイル名 case XML_FILE_VARNAME: xmlName = param_str; break; // 頭出し先頭 case START_TIME_VARNAME: startTimeOnLoaded = getsec(param_str); break; // 頭出し終了 case END_TIME_VARNAME: endTimeOnLoaded = getsec(param_str); break; } } if (!xmlName) { xmlName = DEFAULT_XML_FILENAME; } (function() { var slpos:int = xmlName.lastIndexOf("/"); var bslpos:int = xmlName.lastIndexOf("\\"); if (slpos >= 0 || bslpos >= 0) { //パス情報が付いている xmlPathName = xmlName.substring(0, ((slpos > bslpos) ? slpos : bslpos) + 1); } else { //ファイル名のみ xmlPathName = ""; } })(); if (startTimeOnLoaded >= 0 && endTimeOnLoaded >= 0 && startTimeOnLoaded > endTimeOnLoaded) { (function() { var wk:Number = startTimeOnLoaded; startTimeOnLoaded = endTimeOnLoaded; endTimeOnLoaded = wk; })(); } dispFilename.text = xmlName; //映像定義XMLファイル読み込み開始 loader = new URLLoader(); request = new URLRequest(xmlName); loader.addEventListener(Event.COMPLETE, processMovieDesc); loader.addEventListener(IOErrorEvent.IO_ERROR, loaderErrorHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderErrorHandler); loader.load(request); } } }
package cmodule.decry { const _malloc_hint_2E_b:int = gstaticInitter.alloc(1,1); }
// Decompiled by AS3 Sorcerer 6.08 // www.as3sorcerer.com //io.decagames.rotmg.seasonalEvent.tasks.GetChallengerListTask package io.decagames.rotmg.seasonalEvent.tasks { import kabam.lib.tasks.BaseTask; import kabam.rotmg.account.core.Account; import kabam.rotmg.appengine.api.AppEngineClient; import kabam.rotmg.core.model.PlayerModel; import kabam.rotmg.legends.model.LegendsModel; import io.decagames.rotmg.seasonalEvent.data.SeasonalEventModel; import kabam.rotmg.legends.model.LegendFactory; import io.decagames.rotmg.seasonalEvent.SeasonalLeaderBoard.SeasonalItemDataFactory; import kabam.rotmg.legends.model.Timespan; import io.decagames.rotmg.seasonalEvent.signals.SeasonalLeaderBoardErrorSignal; import io.decagames.rotmg.seasonalEvent.SeasonalLeaderBoard.SeasonalLeaderBoard; import io.decagames.rotmg.seasonalEvent.SeasonalLeaderBoard.SeasonalLeaderBoardItemData; public class GetChallengerListTask extends BaseTask { public static const REFRESH_INTERVAL_IN_MILLISECONDS:Number = ((5 * 60) * 1000);//300000 [Inject] public var account:Account; [Inject] public var client:AppEngineClient; [Inject] public var player:PlayerModel; [Inject] public var model:LegendsModel; [Inject] public var seasonalEventModel:SeasonalEventModel; [Inject] public var factory:LegendFactory; [Inject] public var seasonalItemDataFactory:SeasonalItemDataFactory; [Inject] public var timespan:Timespan; [Inject] public var listType:String; [Inject] public var seasonalLeaderBoardErrorSignal:SeasonalLeaderBoardErrorSignal; public var charId:int; override protected function startTask():void { this.client.complete.addOnce(this.onComplete); if (this.listType == SeasonalLeaderBoard.TOP_20_TAB_LABEL) { this.client.sendRequest("/fame/challengerLeaderboard", this.makeRequestObject()); } else { if (this.listType == SeasonalLeaderBoard.PLAYER_TAB_LABEL) { this.client.sendRequest(("/fame/challengerAccountLeaderboard?account=" + this.account.getUserName()), this.makeRequestObject()); } } } private function onComplete(_arg_1:Boolean, _arg_2:*):void { if (_arg_1) { this.updateFameListData(_arg_2); } else { this.onFameListError(_arg_2); } } private function onFameListError(_arg_1:String):void { this.seasonalLeaderBoardErrorSignal.dispatch(_arg_1); completeTask(true); } private function updateFameListData(_arg_1:String):void { var _local_2:XML = XML(_arg_1); var _local_3:Date = new Date((_local_2.GeneratedOn * 1000)); var _local_4:Number = ((_local_3.getTimezoneOffset() * 60) * 1000); _local_3.setTime((_local_3.getTime() - _local_4)); var _local_5:Date = new Date(); _local_5.setTime((_local_5.getTime() + REFRESH_INTERVAL_IN_MILLISECONDS)); var _local_6:Vector.<SeasonalLeaderBoardItemData> = this.seasonalItemDataFactory.createSeasonalLeaderBoardItemDatas(XML(_arg_1)); if (this.listType == SeasonalLeaderBoard.TOP_20_TAB_LABEL) { this.seasonalEventModel.leaderboardTop20ItemDatas = _local_6; this.seasonalEventModel.leaderboardTop20RefreshTime = _local_5; this.seasonalEventModel.leaderboardTop20CreateTime = _local_3; } else { if (this.listType == SeasonalLeaderBoard.PLAYER_TAB_LABEL) { _local_6.sort(this.fameSort); this.seasonalEventModel.leaderboardPlayerItemDatas = _local_6; this.seasonalEventModel.leaderboardPlayerRefreshTime = _local_5; this.seasonalEventModel.leaderboardPlayerCreateTime = _local_3; } } completeTask(true); } private function fameSort(_arg_1:SeasonalLeaderBoardItemData, _arg_2:SeasonalLeaderBoardItemData):int { if (_arg_1.totalFame > _arg_2.totalFame) { return (-1); } if (_arg_1.totalFame < _arg_2.totalFame) { return (1); } return (0); } private function makeRequestObject():Object { var _local_1:Object = {} _local_1.timespan = this.timespan.getId(); _local_1.accountId = this.player.getAccountId(); _local_1.charId = this.charId; return (_local_1); } } }//package io.decagames.rotmg.seasonalEvent.tasks
package mx.logging.errors { import mx.core.mx_internal; use namespace mx_internal; public class InvalidCategoryError extends Error { mx_internal static const VERSION:String = "4.16.1.0"; public function InvalidCategoryError(message:String) { super(message); } public function toString() : String { return String(message); } } }
package PathFinding.libs { /** * ... * @author dongketao */ public class HeapFunction { public function HeapFunction() { } /* Default comparison function to be used */ //defaultCmp = function(x, y) { //if (x < y) { //return -1; //} //if (x > y) { //return 1; //} //return 0; //}; public var defaultCmp:Function = function(x:Number, y:Number):int { if (x < y) { return -1; } if (x > y) { return 1; } return 0; } /* Insert item x in list a, and keep it sorted assuming a is sorted. If x is already in a, insert it to the right of the rightmost x. Optional args lo (default 0) and hi (default a.length) bound the slice of a to be searched. */ //insort = function(a, x, lo, hi, cmp) { //var mid; //if (lo == null) { //lo = 0; //} //if (cmp == null) { //cmp = defaultCmp; //} //if (lo < 0) { //throw new Error('lo must be non-negative'); //} //if (hi == null) { //hi = a.length; //} //while (lo < hi) { //mid = floor((lo + hi) / 2); //if (cmp(x, a[mid]) < 0) { //hi = mid; //} else { //lo = mid + 1; //} //} //return ([].splice.apply(a, [lo, lo - lo].concat(x)), x); //}; public function insort(a:Object, x:Object, lo:* = null, hi:* = null, cmp:* = null):* { var mid:Number; if (lo == null) { lo = 0; } if (cmp == null) { cmp = defaultCmp; } if (lo < 0) { throw new Error('lo must be non-negative'); } if (hi == null) { hi = a.length; } while (lo < hi) { mid = Math.floor((lo + hi) / 2); if (cmp(x, a[mid]) < 0) { hi = mid; } else { lo = mid + 1; } } return ([].splice.apply(a, [lo, lo - lo].concat(x)), x); } /* Push item onto heap, maintaining the heap invariant. */ //heappush = function(array, item, cmp) { //if (cmp == null) { //cmp = defaultCmp; //} //array.push(item); //return _siftdown(array, 0, array.length - 1, cmp); //}; public function heappush(array:Object, item:Object, cmp:Object):Object { if (cmp == null) { cmp = defaultCmp; } array.push(item); return _siftdown(array, 0, array.length - 1, cmp); } /* Pop the smallest item off the heap, maintaining the heap invariant. */ //heappop = function(array, cmp) { //var lastelt, returnitem; //if (cmp == null) { //cmp = defaultCmp; //} //lastelt = array.pop(); //if (array.length) { //returnitem = array[0]; //array[0] = lastelt; //_siftup(array, 0, cmp); //} else { //returnitem = lastelt; //} //return returnitem; //}; public function heappop(array:Object, cmp:Object):Object { var lastelt:Object, returnitem:Object; if (cmp == null) { cmp = defaultCmp; } lastelt = array.pop(); if (array.length) { returnitem = array[0]; array[0] = lastelt; _siftup(array, 0, cmp); } else { returnitem = lastelt; } return returnitem; } /* Pop and return the current smallest value, and add the new item. This is more efficient than heappop() followed by heappush(), and can be more appropriate when using a fixed size heap. Note that the value returned may be larger than item! That constrains reasonable use of this routine unless written as part of a conditional replacement: if item > array[0] item = heapreplace(array, item) */ //heapreplace = function(array, item, cmp) { //var returnitem; //if (cmp == null) { //cmp = defaultCmp; //} //returnitem = array[0]; //array[0] = item; //_siftup(array, 0, cmp); //return returnitem; //}; public function heapreplace(array:Object, item:Object, cmp:Object):Object { var returnitem:Object; if (cmp == null) { cmp = defaultCmp; } returnitem = array[0]; array[0] = item; _siftup(array, 0, cmp); return returnitem; } /* Fast version of a heappush followed by a heappop. */ //heappushpop = function(array, item, cmp) { //var _ref; //if (cmp == null) { //cmp = defaultCmp; //} //if (array.length && cmp(array[0], item) < 0) { //_ref = [array[0], item], item = _ref[0], array[0] = _ref[1]; //_siftup(array, 0, cmp); //} //return item; //}; public function heappushpop(array:Object, item:Object, cmp:Object):Object { var _ref:Object; if (cmp == null) { cmp = defaultCmp; } if (array.length && cmp(array[0], item) < 0) { _ref = [array[0], item], item = _ref[0], array[0] = _ref[1]; _siftup(array, 0, cmp); } return item; } /* Transform list into a heap, in-place, in O(array.length) time. */ //heapify = function(array, cmp) { //var i, _i, _j, _len, _ref, _ref1, _results, _results1; //if (cmp == null) { //cmp = defaultCmp; //} //_ref1 = (function() { //_results1 = []; //for (var _j = 0, _ref = floor(array.length / 2); 0 <= _ref ? _j < _ref : _j > _ref; 0 <= _ref ? _j++ : _j--){ _results1.push(_j); } //return _results1; //}).apply(this).reverse(); //_results = []; //for (_i = 0, _len = _ref1.length; _i < _len; _i++) { //i = _ref1[_i]; //_results.push(_siftup(array, i, cmp)); //} //return _results; //}; public function heapify(array:Object, cmp:Object):Object { var i:int, _i:int, _j:int, _len:int, _ref:Object, _ref1:Object, _results:Object, _results1:Object; if (cmp == null) { cmp = defaultCmp; } _ref1 = (function():Object { _results1 = []; for (_j = 0, _ref = Math.floor(array.length / 2); 0 <= _ref ? _j < _ref : _j > _ref; 0 <= _ref ? _j++ : _j--) { _results1.push(_j); } return _results1; }).apply(this).reverse(); _results = []; for (_i = 0, _len = _ref1.length; _i < _len; _i++) { i = _ref1[_i]; _results.push(_siftup(array, i, cmp)); } return _results; } /* Update the position of the given item in the heap. This function should be called every time the item is being modified. */ //updateItem = function(array, item, cmp) { //var pos; //if (cmp == null) { //cmp = defaultCmp; //} //pos = array.indexOf(item); //if (pos === -1) { //return; //} //_siftdown(array, 0, pos, cmp); //return _siftup(array, pos, cmp); //}; public function updateItem(array:Object, item:Object, cmp:Object):Object { var pos:int; if (cmp == null) { cmp = defaultCmp; } pos = array.indexOf(item); if (pos === -1) { return null; } _siftdown(array, 0, pos, cmp); return _siftup(array, pos, cmp); } /* Find the n largest elements in a dataset. */ //nlargest = function(array, n, cmp) { //var elem, result, _i, _len, _ref; //if (cmp == null) { //cmp = defaultCmp; //} //result = array.slice(0, n); //if (!result.length) { //return result; //} //heapify(result, cmp); //_ref = array.slice(n); //for (_i = 0, _len = _ref.length; _i < _len; _i++) { //elem = _ref[_i]; //heappushpop(result, elem, cmp); //} //return result.sort(cmp).reverse(); //}; public function nlargest(array:Object, n:int, cmp:Object):Object { var elem:Object, result:Object, _i:int, _len:int, _ref:Object; if (cmp == null) { cmp = defaultCmp; } result = array.slice(0, n); if (!result.length) { return result; } heapify(result, cmp); _ref = array.slice(n); for (_i = 0, _len = _ref.length; _i < _len; _i++) { elem = _ref[_i]; heappushpop(result, elem, cmp); } return result.sort(cmp).reverse(); } /* Find the n smallest elements in a dataset. */ //nsmallest = function(array, n, cmp) { //var elem, i, los, result, _i, _j, _len, _ref, _ref1, _results; //if (cmp == null) { //cmp = defaultCmp; //} //if (n * 10 <= array.length) { //result = array.slice(0, n).sort(cmp); //if (!result.length) { //return result; //} //los = result[result.length - 1]; //_ref = array.slice(n); //for (_i = 0, _len = _ref.length; _i < _len; _i++) { //elem = _ref[_i]; //if (cmp(elem, los) < 0) { //insort(result, elem, 0, null, cmp); //result.pop(); //los = result[result.length - 1]; //} //} //return result; //} //heapify(array, cmp); //_results = []; //for (i = _j = 0, _ref1 = min(n, array.length); 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) { //_results.push(heappop(array, cmp)); //} //return _results; //}; public function nsmallest(array:Object, n:int, cmp:Object):Object { var elem:Object, i:Object, los:Object, result:Object, _i:int, _j:int, _len:Object, _ref:Object, _ref1:Object, _results:Object; if (cmp == null) { cmp = defaultCmp; } if (n * 10 <= array.length) { result = array.slice(0, n).sort(cmp); if (!result.length) { return result; } los = result[result.length - 1]; _ref = array.slice(n); for (_i = 0, _len = _ref.length; _i < _len; _i++) { elem = _ref[_i]; if (cmp(elem, los) < 0) { insort(result, elem, 0, null, cmp); result.pop(); los = result[result.length - 1]; } } return result; } heapify(array, cmp); _results = []; for (i = _j = 0, _ref1 = Math.min(n, array.length); 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) { _results.push(heappop(array, cmp)); } return _results; } //_siftdown = function(array, startpos, pos, cmp) { //var newitem, parent, parentpos; //if (cmp == null) { //cmp = defaultCmp; //} //newitem = array[pos]; //while (pos > startpos) { //parentpos = (pos - 1) >> 1; //parent = array[parentpos]; //if (cmp(newitem, parent) < 0) { //array[pos] = parent; //pos = parentpos; //continue; //} //break; //} //return array[pos] = newitem; //}; public function _siftdown(array:Object, startpos:int, pos:int, cmp:Object):Object { var newitem:Object, parent:Object, parentpos:int; if (cmp == null) { cmp = defaultCmp; } newitem = array[pos]; while (pos > startpos) { parentpos = (pos - 1) >> 1; parent = array[parentpos]; if (cmp(newitem, parent) < 0) { array[pos] = parent; pos = parentpos; continue; } break; } return array[pos] = newitem; } //_siftup = function(array, pos, cmp) { //var childpos, endpos, newitem, rightpos, startpos; //if (cmp == null) { //cmp = defaultCmp; //} //endpos = array.length; //startpos = pos; //newitem = array[pos]; //childpos = 2 * pos + 1; //while (childpos < endpos) { //rightpos = childpos + 1; //if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) { //childpos = rightpos; //} //array[pos] = array[childpos]; //pos = childpos; //childpos = 2 * pos + 1; //} //array[pos] = newitem; //return _siftdown(array, startpos, pos, cmp); //}; public function _siftup(array:Object, pos:int, cmp:Object):Object { var childpos:int, endpos:int, newitem:Object, rightpos:int, startpos:int; if (cmp == null) { cmp = defaultCmp; } endpos = array.length; startpos = pos; newitem = array[pos]; childpos = 2 * pos + 1; while (childpos < endpos) { rightpos = childpos + 1; if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) { childpos = rightpos; } array[pos] = array[childpos]; pos = childpos; childpos = 2 * pos + 1; } array[pos] = newitem; return _siftdown(array, startpos, pos, cmp); } } }