[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Section 1 (11.55 KiB) ● ●
//ColorShortcuts (caurina.transitions.properties.ColorShortcuts)
package caurina.transitions.properties {
import flash.geom.*;
import flash.filters.*;
import caurina.transitions.*;
public class ColorShortcuts {
private static var LUMINANCE_B:Number = 0.072169;
private static var LUMINANCE_G:Number = 0.71516;
private static var LUMINANCE_R:Number = 0.212671;
public function ColorShortcuts(){
super();
trace("This is an static class and should not be instantiated.");
}
public static function _color_splitter(p_value, p_parameters:Array):Array{
var nArray:Array = new Array();
if (p_value == null){
nArray.push({name:"_color_redMultiplier", value:1});
nArray.push({name:"_color_redOffset", value:0});
nArray.push({name:"_color_greenMultiplier", value:1});
nArray.push({name:"_color_greenOffset", value:0});
nArray.push({name:"_color_blueMultiplier", value:1});
nArray.push({name:"_color_blueOffset", value:0});
} else {
nArray.push({name:"_color_redMultiplier", value:0});
nArray.push({name:"_color_redOffset", value:AuxFunctions.numberToR(p_value)});
nArray.push({name:"_color_greenMultiplier", value:0});
nArray.push({name:"_color_greenOffset", value:AuxFunctions.numberToG(p_value)});
nArray.push({name:"_color_blueMultiplier", value:0});
nArray.push({name:"_color_blueOffset", value:AuxFunctions.numberToB(p_value)});
};
return (nArray);
}
public static function _contrast_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var mc:Number;
var co:Number;
mc = (p_value + 1);
co = Math.round((p_value * -128));
var cfm:ColorTransform = new ColorTransform(mc, mc, mc, 1, co, co, co, 0);
p_obj.transform.colorTransform = cfm;
}
public static function _brightness_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var isTint:Boolean = p_parameters[0];
var cfm:ColorTransform = p_obj.transform.colorTransform;
var mc:Number = (1 - (((cfm.redMultiplier + cfm.greenMultiplier) + cfm.blueMultiplier) / 3));
var co:Number = (((cfm.redOffset + cfm.greenOffset) + cfm.blueOffset) / 3);
if (isTint){
return (((co > 0)) ? (co / 0xFF) : -(mc));
//unresolved jump
};
return ((co / 100));
}
public static function _saturation_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var mtx:Array = getObjectMatrix(p_obj);
var isDumb:Boolean = p_parameters[0];
var rl:Number = (isDumb) ? (1 / 3) : LUMINANCE_R;
var gl:Number = (isDumb) ? (1 / 3) : LUMINANCE_G;
var bl:Number = (isDumb) ? (1 / 3) : LUMINANCE_B;
var mc:Number = (((((mtx[0] - rl) / (1 - rl)) + ((mtx[6] - gl) / (1 - gl))) + ((mtx[12] - bl) / (1 - bl))) / 3);
var cc:Number = (1 - (((((((mtx[1] / gl) + (mtx[2] / bl)) + (mtx[5] / rl)) + (mtx[7] / bl)) + (mtx[10] / rl)) + (mtx[11] / gl)) / 6));
return (((mc + cc) / 2));
}
public static function _oldColor_property_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
return ((p_obj.transform.colorTransform[p_parameters[0]] * 100));
}
public static function _brightness_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var mc:Number;
var co:Number;
var isTint:Boolean = p_parameters[0];
if (isTint){
mc = (1 - Math.abs(p_value));
co = ((p_value > 0)) ? Math.round((p_value * 0xFF)) : 0;
} else {
mc = 1;
co = Math.round((p_value * 100));
};
var cfm:ColorTransform = new ColorTransform(mc, mc, mc, 1, co, co, co, 0);
p_obj.transform.colorTransform = cfm;
}
public static function _saturation_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var isDumb:Boolean = p_parameters[0];
var rl:Number = (isDumb) ? (1 / 3) : LUMINANCE_R;
var gl:Number = (isDumb) ? (1 / 3) : LUMINANCE_G;
var bl:Number = (isDumb) ? (1 / 3) : LUMINANCE_B;
var sf:Number = p_value;
var nf:Number = (1 - sf);
var nr:Number = (rl * nf);
var ng:Number = (gl * nf);
var nb:Number = (bl * nf);
var mtx:Array = [(nr + sf), ng, nb, 0, 0, nr, (ng + sf), nb, 0, 0, nr, ng, (nb + sf), 0, 0, 0, 0, 0, 1, 0];
setObjectMatrix(p_obj, mtx);
}
private static function getObjectMatrix(p_obj:Object):Array{
var i:Number = 0;
while (i < p_obj.filters.length) {
if ((p_obj.filters[i] is ColorMatrixFilter)){
return (p_obj.filters[i].matrix.concat());
};
i++;
};
return ([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]);
}
public static function getHueDistance(mtx1:Array, mtx2:Array):Number{
return (((Math.abs((mtx1[0] - mtx2[0])) + Math.abs((mtx1[1] - mtx2[1]))) + Math.abs((mtx1[2] - mtx2[2]))));
}
public static function _hue_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
setObjectMatrix(p_obj, getHueMatrix(p_value));
}
public static function _hue_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var i:Number;
var angleToSplit:Number;
var mtx:Array = getObjectMatrix(p_obj);
var hues:Array = [];
hues[0] = {angle:-179.9, matrix:getHueMatrix(-179.9)};
hues[1] = {angle:180, matrix:getHueMatrix(180)};
i = 0;
while (i < hues.length) {
hues[i].distance = getHueDistance(mtx, hues[i].matrix);
i++;
};
var maxTries:Number = 15;
i = 0;
while (i < maxTries) {
if (hues[0].distance < hues[1].distance){
angleToSplit = 1;
} else {
angleToSplit = 0;
};
hues[angleToSplit].angle = ((hues[0].angle + hues[1].angle) / 2);
hues[angleToSplit].matrix = getHueMatrix(hues[angleToSplit].angle);
hues[angleToSplit].distance = getHueDistance(mtx, hues[angleToSplit].matrix);
i++;
};
return (hues[angleToSplit].angle);
}
public static function getHueMatrix(hue:Number):Array{
var ha:Number = ((hue * Math.PI) / 180);
var rl:Number = LUMINANCE_R;
var gl:Number = LUMINANCE_G;
var bl:Number = LUMINANCE_B;
var c:Number = Math.cos(ha);
var s:Number = Math.sin(ha);
var mtx:Array = [((rl + (c * (1 - rl))) + (s * -(rl))), ((gl + (c * -(gl))) + (s * -(gl))), ((bl + (c * -(bl))) + (s * (1 - bl))), 0, 0, ((rl + (c * -(rl))) + (s * 0.143)), ((gl + (c * (1 - gl))) + (s * 0.14)), ((bl + (c * -(bl))) + (s * -0.283)), 0, 0, ((rl + (c * -(rl))) + (s * -((1 - rl)))), ((gl + (c * -(gl))) + (s * gl)), ((bl + (c * (1 - bl))) + (s * bl)), 0, 0, 0, 0, 0, 1, 0];
return (mtx);
}
public static function _color_property_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
return (p_obj.transform.colorTransform[p_parameters[0]]);
}
public static function init():void{
Tweener.registerSpecialProperty("_color_ra", _oldColor_property_get, _oldColor_property_set, ["redMultiplier"]);
Tweener.registerSpecialProperty("_color_rb", _color_property_get, _color_property_set, ["redOffset"]);
Tweener.registerSpecialProperty("_color_ga", _oldColor_property_get, _oldColor_property_set, ["greenMultiplier"]);
Tweener.registerSpecialProperty("_color_gb", _color_property_get, _color_property_set, ["greenOffset"]);
Tweener.registerSpecialProperty("_color_ba", _oldColor_property_get, _oldColor_property_set, ["blueMultiplier"]);
Tweener.registerSpecialProperty("_color_bb", _color_property_get, _color_property_set, ["blueOffset"]);
Tweener.registerSpecialProperty("_color_aa", _oldColor_property_get, _oldColor_property_set, ["alphaMultiplier"]);
Tweener.registerSpecialProperty("_color_ab", _color_property_get, _color_property_set, ["alphaOffset"]);
Tweener.registerSpecialProperty("_color_redMultiplier", _color_property_get, _color_property_set, ["redMultiplier"]);
Tweener.registerSpecialProperty("_color_redOffset", _color_property_get, _color_property_set, ["redOffset"]);
Tweener.registerSpecialProperty("_color_greenMultiplier", _color_property_get, _color_property_set, ["greenMultiplier"]);
Tweener.registerSpecialProperty("_color_greenOffset", _color_property_get, _color_property_set, ["greenOffset"]);
Tweener.registerSpecialProperty("_color_blueMultiplier", _color_property_get, _color_property_set, ["blueMultiplier"]);
Tweener.registerSpecialProperty("_color_blueOffset", _color_property_get, _color_property_set, ["blueOffset"]);
Tweener.registerSpecialProperty("_color_alphaMultiplier", _color_property_get, _color_property_set, ["alphaMultiplier"]);
Tweener.registerSpecialProperty("_color_alphaOffset", _color_property_get, _color_property_set, ["alphaOffset"]);
Tweener.registerSpecialPropertySplitter("_color", _color_splitter);
Tweener.registerSpecialPropertySplitter("_colorTransform", _colorTransform_splitter);
Tweener.registerSpecialProperty("_brightness", _brightness_get, _brightness_set, [false]);
Tweener.registerSpecialProperty("_tintBrightness", _brightness_get, _brightness_set, [true]);
Tweener.registerSpecialProperty("_contrast", _contrast_get, _contrast_set);
Tweener.registerSpecialProperty("_hue", _hue_get, _hue_set);
Tweener.registerSpecialProperty("_saturation", _saturation_get, _saturation_set, [false]);
Tweener.registerSpecialProperty("_dumbSaturation", _saturation_get, _saturation_set, [true]);
}
private static function setObjectMatrix(p_obj:Object, p_matrix:Array):void{
var cmtx:ColorMatrixFilter;
var objFilters:Array = p_obj.filters.concat();
var found:Boolean;
var i:Number = 0;
while (i < objFilters.length) {
if ((objFilters[i] is ColorMatrixFilter)){
objFilters[i].matrix = p_matrix.concat();
found = true;
};
i++;
};
if (!found){
cmtx = new ColorMatrixFilter(p_matrix);
objFilters[objFilters.length] = cmtx;
};
p_obj.filters = objFilters;
}
public static function _color_property_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var cfm:ColorTransform = p_obj.transform.colorTransform;
cfm[p_parameters[0]] = p_value;
p_obj.transform.colorTransform = cfm;
}
public static function _oldColor_property_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var tf:ColorTransform = p_obj.transform.colorTransform;
tf[p_parameters[0]] = (p_value / 100);
p_obj.transform.colorTransform = tf;
}
public static function _contrast_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var mc:Number;
var co:Number;
var cfm:ColorTransform = p_obj.transform.colorTransform;
mc = ((((cfm.redMultiplier + cfm.greenMultiplier) + cfm.blueMultiplier) / 3) - 1);
co = ((((cfm.redOffset + cfm.greenOffset) + cfm.blueOffset) / 3) / -128);
return (((mc + co) / 2));
}
public static function _colorTransform_splitter(p_value:Object, p_parameters:Array):Array{
var nArray:Array = new Array();
if (p_value == null){
nArray.push({name:"_color_redMultiplier", value:1});
nArray.push({name:"_color_redOffset", value:0});
nArray.push({name:"_color_greenMultiplier", value:1});
nArray.push({name:"_color_greenOffset", value:0});
nArray.push({name:"_color_blueMultiplier", value:1});
nArray.push({name:"_color_blueOffset", value:0});
} else {
nArray.push({name:"_color_redMultiplier", value:p_value.redMultiplier});
nArray.push({name:"_color_redOffset", value:p_value.redOffset});
nArray.push({name:"_color_blueMultiplier", value:p_value.blueMultiplier});
nArray.push({name:"_color_blueOffset", value:p_value.blueOffset});
nArray.push({name:"_color_greenMultiplier", value:p_value.greenMultiplier});
nArray.push({name:"_color_greenOffset", value:p_value.greenOffset});
nArray.push({name:"_color_alphaMultiplier", value:p_value.alphaMultiplier});
nArray.push({name:"_color_alphaOffset", value:p_value.alphaOffset});
};
return (nArray);
}
}
}//package caurina.transitions.properties
Section 2 (28.83 KiB) ● ● ●
//FilterShortcuts (caurina.transitions.properties.FilterShortcuts)
package caurina.transitions.properties {
import flash.geom.*;
import flash.filters.*;
import caurina.transitions.*;
import flash.display.*;
public class FilterShortcuts {
public function FilterShortcuts(){
super();
trace("This is an static class and should not be instantiated.");
}
public static function init():void{
Tweener.registerSpecialPropertySplitter("_filter", _filter_splitter);
Tweener.registerSpecialProperty("_Bevel_angle", _filter_property_get, _filter_property_set, [BevelFilter, "angle"]);
Tweener.registerSpecialProperty("_Bevel_blurX", _filter_property_get, _filter_property_set, [BevelFilter, "blurX"]);
Tweener.registerSpecialProperty("_Bevel_blurY", _filter_property_get, _filter_property_set, [BevelFilter, "blurY"]);
Tweener.registerSpecialProperty("_Bevel_distance", _filter_property_get, _filter_property_set, [BevelFilter, "distance"]);
Tweener.registerSpecialProperty("_Bevel_highlightAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "highlightAlpha"]);
Tweener.registerSpecialPropertySplitter("_Bevel_highlightColor", _generic_color_splitter, ["_Bevel_highlightColor_r", "_Bevel_highlightColor_g", "_Bevel_highlightColor_b"]);
Tweener.registerSpecialProperty("_Bevel_highlightColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "r"]);
Tweener.registerSpecialProperty("_Bevel_highlightColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "g"]);
Tweener.registerSpecialProperty("_Bevel_highlightColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "b"]);
Tweener.registerSpecialProperty("_Bevel_knockout", _filter_property_get, _filter_property_set, [BevelFilter, "knockout"]);
Tweener.registerSpecialProperty("_Bevel_quality", _filter_property_get, _filter_property_set, [BevelFilter, "quality"]);
Tweener.registerSpecialProperty("_Bevel_shadowAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "shadowAlpha"]);
Tweener.registerSpecialPropertySplitter("_Bevel_shadowColor", _generic_color_splitter, ["_Bevel_shadowColor_r", "_Bevel_shadowColor_g", "_Bevel_shadowColor_b"]);
Tweener.registerSpecialProperty("_Bevel_shadowColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "r"]);
Tweener.registerSpecialProperty("_Bevel_shadowColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "g"]);
Tweener.registerSpecialProperty("_Bevel_shadowColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "b"]);
Tweener.registerSpecialProperty("_Bevel_strength", _filter_property_get, _filter_property_set, [BevelFilter, "strength"]);
Tweener.registerSpecialProperty("_Bevel_type", _filter_property_get, _filter_property_set, [BevelFilter, "type"]);
Tweener.registerSpecialProperty("_Blur_blurX", _filter_property_get, _filter_property_set, [BlurFilter, "blurX"]);
Tweener.registerSpecialProperty("_Blur_blurY", _filter_property_get, _filter_property_set, [BlurFilter, "blurY"]);
Tweener.registerSpecialProperty("_Blur_quality", _filter_property_get, _filter_property_set, [BlurFilter, "quality"]);
Tweener.registerSpecialPropertySplitter("_ColorMatrix_matrix", _generic_matrix_splitter, [[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], ["_ColorMatrix_matrix_rr", "_ColorMatrix_matrix_rg", "_ColorMatrix_matrix_rb", "_ColorMatrix_matrix_ra", "_ColorMatrix_matrix_ro", "_ColorMatrix_matrix_gr", "_ColorMatrix_matrix_gg", "_ColorMatrix_matrix_gb", "_ColorMatrix_matrix_ga", "_ColorMatrix_matrix_go", "_ColorMatrix_matrix_br", "_ColorMatrix_matrix_bg", "_ColorMatrix_matrix_bb", "_ColorMatrix_matrix_ba", "_ColorMatrix_matrix_bo", "_ColorMatrix_matrix_ar", "_ColorMatrix_matrix_ag", "_ColorMatrix_matrix_ab", "_ColorMatrix_matrix_aa", "_ColorMatrix_matrix_ao"]]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_rr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 0]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_rg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 1]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_rb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 2]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ra", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 3]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ro", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 4]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_gr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 5]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_gg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 6]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_gb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 7]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ga", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 8]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_go", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 9]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_br", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 10]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_bg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 11]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_bb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 12]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ba", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 13]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_bo", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 14]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ar", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 15]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ag", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 16]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ab", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 17]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_aa", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 18]);
Tweener.registerSpecialProperty("_ColorMatrix_matrix_ao", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 19]);
Tweener.registerSpecialProperty("_Convolution_alpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "alpha"]);
Tweener.registerSpecialProperty("_Convolution_bias", _filter_property_get, _filter_property_set, [ConvolutionFilter, "bias"]);
Tweener.registerSpecialProperty("_Convolution_clamp", _filter_property_get, _filter_property_set, [ConvolutionFilter, "clamp"]);
Tweener.registerSpecialPropertySplitter("_Convolution_color", _generic_color_splitter, ["_Convolution_color_r", "_Convolution_color_g", "_Convolution_color_b"]);
Tweener.registerSpecialProperty("_Convolution_color_r", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "r"]);
Tweener.registerSpecialProperty("_Convolution_color_g", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "g"]);
Tweener.registerSpecialProperty("_Convolution_color_b", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "b"]);
Tweener.registerSpecialProperty("_Convolution_divisor", _filter_property_get, _filter_property_set, [ConvolutionFilter, "divisor"]);
Tweener.registerSpecialProperty("_Convolution_matrixX", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixX"]);
Tweener.registerSpecialProperty("_Convolution_matrixY", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixY"]);
Tweener.registerSpecialProperty("_Convolution_preserveAlpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "preserveAlpha"]);
Tweener.registerSpecialProperty("_DisplacementMap_alpha", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "alpha"]);
Tweener.registerSpecialPropertySplitter("_DisplacementMap_color", _generic_color_splitter, ["_DisplacementMap_color_r", "_DisplacementMap_color_r", "_DisplacementMap_color_r"]);
Tweener.registerSpecialProperty("_DisplacementMap_color_r", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "r"]);
Tweener.registerSpecialProperty("_DisplacementMap_color_g", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "g"]);
Tweener.registerSpecialProperty("_DisplacementMap_color_b", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "b"]);
Tweener.registerSpecialProperty("_DisplacementMap_componentX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentX"]);
Tweener.registerSpecialProperty("_DisplacementMap_componentY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentY"]);
Tweener.registerSpecialProperty("_DisplacementMap_mapBitmap", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapBitmap"]);
Tweener.registerSpecialPropertySplitter("_DisplacementMap_mapPoint", _generic_point_splitter, ["_DisplacementMap_mapPoint_x", "_DisplacementMap_mapPoint_y"]);
Tweener.registerSpecialProperty("_DisplacementMap_mapPoint_x", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint", "point", "x"]);
Tweener.registerSpecialProperty("_DisplacementMap_mapPoint_y", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint", "point", "y"]);
Tweener.registerSpecialProperty("_DisplacementMap_mode", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mode"]);
Tweener.registerSpecialProperty("_DisplacementMap_scaleX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleX"]);
Tweener.registerSpecialProperty("_DisplacementMap_scaleY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleY"]);
Tweener.registerSpecialProperty("_DropShadow_alpha", _filter_property_get, _filter_property_set, [DropShadowFilter, "alpha"]);
Tweener.registerSpecialProperty("_DropShadow_angle", _filter_property_get, _filter_property_set, [DropShadowFilter, "angle"]);
Tweener.registerSpecialProperty("_DropShadow_blurX", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurX"]);
Tweener.registerSpecialProperty("_DropShadow_blurY", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurY"]);
Tweener.registerSpecialPropertySplitter("_DropShadow_color", _generic_color_splitter, ["_DropShadow_color_r", "_DropShadow_color_g", "_DropShadow_color_b"]);
Tweener.registerSpecialProperty("_DropShadow_color_r", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "r"]);
Tweener.registerSpecialProperty("_DropShadow_color_g", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "g"]);
Tweener.registerSpecialProperty("_DropShadow_color_b", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "b"]);
Tweener.registerSpecialProperty("_DropShadow_distance", _filter_property_get, _filter_property_set, [DropShadowFilter, "distance"]);
Tweener.registerSpecialProperty("_DropShadow_hideObject", _filter_property_get, _filter_property_set, [DropShadowFilter, "hideObject"]);
Tweener.registerSpecialProperty("_DropShadow_inner", _filter_property_get, _filter_property_set, [DropShadowFilter, "inner"]);
Tweener.registerSpecialProperty("_DropShadow_knockout", _filter_property_get, _filter_property_set, [DropShadowFilter, "knockout"]);
Tweener.registerSpecialProperty("_DropShadow_quality", _filter_property_get, _filter_property_set, [DropShadowFilter, "quality"]);
Tweener.registerSpecialProperty("_DropShadow_strength", _filter_property_get, _filter_property_set, [DropShadowFilter, "strength"]);
Tweener.registerSpecialProperty("_Glow_alpha", _filter_property_get, _filter_property_set, [GlowFilter, "alpha"]);
Tweener.registerSpecialProperty("_Glow_blurX", _filter_property_get, _filter_property_set, [GlowFilter, "blurX"]);
Tweener.registerSpecialProperty("_Glow_blurY", _filter_property_get, _filter_property_set, [GlowFilter, "blurY"]);
Tweener.registerSpecialPropertySplitter("_Glow_color", _generic_color_splitter, ["_Glow_color_r", "_Glow_color_g", "_Glow_color_b"]);
Tweener.registerSpecialProperty("_Glow_color_r", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "r"]);
Tweener.registerSpecialProperty("_Glow_color_g", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "g"]);
Tweener.registerSpecialProperty("_Glow_color_b", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "b"]);
Tweener.registerSpecialProperty("_Glow_inner", _filter_property_get, _filter_property_set, [GlowFilter, "inner"]);
Tweener.registerSpecialProperty("_Glow_knockout", _filter_property_get, _filter_property_set, [GlowFilter, "knockout"]);
Tweener.registerSpecialProperty("_Glow_quality", _filter_property_get, _filter_property_set, [GlowFilter, "quality"]);
Tweener.registerSpecialProperty("_Glow_strength", _filter_property_get, _filter_property_set, [GlowFilter, "strength"]);
Tweener.registerSpecialProperty("_GradientBevel_angle", _filter_property_get, _filter_property_set, [GradientBevelFilter, "angle"]);
Tweener.registerSpecialProperty("_GradientBevel_blurX", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurX"]);
Tweener.registerSpecialProperty("_GradientBevel_blurY", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurY"]);
Tweener.registerSpecialProperty("_GradientBevel_distance", _filter_property_get, _filter_property_set, [GradientBevelFilter, "distance"]);
Tweener.registerSpecialProperty("_GradientBevel_quality", _filter_property_get, _filter_property_set, [GradientBevelFilter, "quality"]);
Tweener.registerSpecialProperty("_GradientBevel_strength", _filter_property_get, _filter_property_set, [GradientBevelFilter, "strength"]);
Tweener.registerSpecialProperty("_GradientBevel_type", _filter_property_get, _filter_property_set, [GradientBevelFilter, "type"]);
Tweener.registerSpecialProperty("_GradientGlow_angle", _filter_property_get, _filter_property_set, [GradientGlowFilter, "angle"]);
Tweener.registerSpecialProperty("_GradientGlow_blurX", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurX"]);
Tweener.registerSpecialProperty("_GradientGlow_blurY", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurY"]);
Tweener.registerSpecialProperty("_GradientGlow_distance", _filter_property_get, _filter_property_set, [GradientGlowFilter, "distance"]);
Tweener.registerSpecialProperty("_GradientGlow_knockout", _filter_property_get, _filter_property_set, [GradientGlowFilter, "knockout"]);
Tweener.registerSpecialProperty("_GradientGlow_quality", _filter_property_get, _filter_property_set, [GradientGlowFilter, "quality"]);
Tweener.registerSpecialProperty("_GradientGlow_strength", _filter_property_get, _filter_property_set, [GradientGlowFilter, "strength"]);
Tweener.registerSpecialProperty("_GradientGlow_type", _filter_property_get, _filter_property_set, [GradientGlowFilter, "type"]);
}
public static function _filter_property_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var i:Number;
var defaultValues:Object;
var colorComponent:String;
var f:Array = p_obj.filters;
var filterClass:Object = p_parameters[0];
var propertyName:String = p_parameters[1];
var splitType:String = p_parameters[2];
i = 0;
while (i < f.length) {
if ((f[i] is Class(filterClass))){
if (splitType == "color"){
colorComponent = p_parameters[3];
if (colorComponent == "r"){
return (AuxFunctions.numberToR(f[i][propertyName]));
};
if (colorComponent == "g"){
return (AuxFunctions.numberToG(f[i][propertyName]));
};
if (colorComponent == "b"){
return (AuxFunctions.numberToB(f[i][propertyName]));
};
} else {
if (splitType == "matrix"){
return (f[i][propertyName][p_parameters[3]]);
};
if (splitType == "point"){
return (f[i][propertyName][p_parameters[3]]);
};
return (f[i][propertyName]);
};
};
i++;
};
switch (filterClass){
case BevelFilter:
defaultValues = {angle:NaN, blurX:0, blurY:0, distance:0, highlightAlpha:1, highlightColor:NaN, knockout:null, quality:NaN, shadowAlpha:1, shadowColor:NaN, strength:2, type:null};
break;
case BlurFilter:
defaultValues = {blurX:0, blurY:0, quality:NaN};
break;
case ColorMatrixFilter:
defaultValues = {matrix:[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]};
break;
case ConvolutionFilter:
defaultValues = {alpha:0, bias:0, clamp:null, color:NaN, divisor:1, matrix:[1], matrixX:1, matrixY:1, preserveAlpha:null};
break;
case DisplacementMapFilter:
defaultValues = {alpha:0, color:NaN, componentX:null, componentY:null, mapBitmap:null, mapPoint:null, mode:null, scaleX:0, scaleY:0};
break;
case DropShadowFilter:
defaultValues = {distance:0, angle:NaN, color:NaN, alpha:1, blurX:0, blurY:0, strength:1, quality:NaN, inner:null, knockout:null, hideObject:null};
break;
case GlowFilter:
defaultValues = {alpha:1, blurX:0, blurY:0, color:NaN, inner:null, knockout:null, quality:NaN, strength:2};
break;
case GradientBevelFilter:
defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null};
break;
case GradientGlowFilter:
defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null};
break;
};
if (splitType == "color"){
return (NaN);
};
if (splitType == "matrix"){
return (defaultValues[propertyName][p_parameters[3]]);
};
if (splitType == "point"){
return (defaultValues[propertyName][p_parameters[3]]);
};
return (defaultValues[propertyName]);
}
public static function _filter_property_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var i:Number;
var fi:BitmapFilter;
var colorComponent:String;
var mtx:Array;
var pt:Point;
var f:Array = p_obj.filters;
var filterClass:Object = p_parameters[0];
var propertyName:String = p_parameters[1];
var splitType:String = p_parameters[2];
i = 0;
while (i < f.length) {
if ((f[i] is Class(filterClass))){
if (splitType == "color"){
colorComponent = p_parameters[3];
if (colorComponent == "r"){
f[i][propertyName] = ((f[i][propertyName] & 0xFFFF) | (p_value << 16));
};
if (colorComponent == "g"){
f[i][propertyName] = ((f[i][propertyName] & 0xFF00FF) | (p_value << 8));
};
if (colorComponent == "b"){
f[i][propertyName] = ((f[i][propertyName] & 0xFFFF00) | p_value);
};
} else {
if (splitType == "matrix"){
mtx = f[i][propertyName];
mtx[p_parameters[3]] = p_value;
f[i][propertyName] = mtx;
} else {
if (splitType == "point"){
pt = Point(f[i][propertyName]);
pt[p_parameters[3]] = p_value;
f[i][propertyName] = pt;
} else {
f[i][propertyName] = p_value;
};
};
};
p_obj.filters = f;
return;
};
i++;
};
if (f == null){
f = new Array();
};
switch (filterClass){
case BevelFilter:
fi = new BevelFilter(0, 45, 0xFFFFFF, 1, 0, 1, 0, 0);
break;
case BlurFilter:
fi = new BlurFilter(0, 0);
break;
case ColorMatrixFilter:
fi = new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]);
break;
case ConvolutionFilter:
fi = new ConvolutionFilter(1, 1, [1], 1, 0, true, true, 0, 0);
break;
case DisplacementMapFilter:
fi = new DisplacementMapFilter(new BitmapData(10, 10), new Point(0, 0), 0, 1, 0, 0);
break;
case DropShadowFilter:
fi = new DropShadowFilter(0, 45, 0, 1, 0, 0);
break;
case GlowFilter:
fi = new GlowFilter(0xFF0000, 1, 0, 0);
break;
case GradientBevelFilter:
fi = new GradientBevelFilter(0, 45, [0xFFFFFF, 0], [1, 1], [32, 223], 0, 0);
break;
case GradientGlowFilter:
fi = new GradientGlowFilter(0, 45, [0xFFFFFF, 0], [1, 1], [32, 223], 0, 0);
break;
};
f.push(fi);
p_obj.filters = f;
_filter_property_set(p_obj, p_value, p_parameters);
}
public static function _generic_color_splitter(p_value:Number, p_parameters:Array):Array{
var nArray:Array = new Array();
nArray.push({name:p_parameters[0], value:AuxFunctions.numberToR(p_value)});
nArray.push({name:p_parameters[1], value:AuxFunctions.numberToG(p_value)});
nArray.push({name:p_parameters[2], value:AuxFunctions.numberToB(p_value)});
return (nArray);
}
public static function _generic_point_splitter(p_value:Point, p_parameters:Array):Array{
var nArray:Array = new Array();
nArray.push({name:p_parameters[0], value:p_value.x});
nArray.push({name:p_parameters[1], value:p_value.y});
return (nArray);
}
public static function _generic_matrix_splitter(p_value:Array, p_parameters:Array):Array{
if (p_value == null){
p_value = p_parameters[0].concat();
};
var nArray:Array = new Array();
var i:Number = 0;
while (i < p_value.length) {
nArray.push({name:p_parameters[1][i], value:p_value[i]});
i++;
};
return (nArray);
}
public static function _filter_splitter(p_value:BitmapFilter, p_parameters:Array, p_extra:Object=null):Array{
var nArray:Array = new Array();
if ((p_value is BevelFilter)){
nArray.push({name:"_Bevel_angle", value:BevelFilter(p_value).angle});
nArray.push({name:"_Bevel_blurX", value:BevelFilter(p_value).blurX});
nArray.push({name:"_Bevel_blurY", value:BevelFilter(p_value).blurY});
nArray.push({name:"_Bevel_distance", value:BevelFilter(p_value).distance});
nArray.push({name:"_Bevel_highlightAlpha", value:BevelFilter(p_value).highlightAlpha});
nArray.push({name:"_Bevel_highlightColor", value:BevelFilter(p_value).highlightColor});
nArray.push({name:"_Bevel_knockout", value:BevelFilter(p_value).knockout});
nArray.push({name:"_Bevel_quality", value:BevelFilter(p_value).quality});
nArray.push({name:"_Bevel_shadowAlpha", value:BevelFilter(p_value).shadowAlpha});
nArray.push({name:"_Bevel_shadowColor", value:BevelFilter(p_value).shadowColor});
nArray.push({name:"_Bevel_strength", value:BevelFilter(p_value).strength});
nArray.push({name:"_Bevel_type", value:BevelFilter(p_value).type});
} else {
if ((p_value is BlurFilter)){
nArray.push({name:"_Blur_blurX", value:BlurFilter(p_value).blurX});
nArray.push({name:"_Blur_blurY", value:BlurFilter(p_value).blurY});
nArray.push({name:"_Blur_quality", value:BlurFilter(p_value).quality});
} else {
if ((p_value is ColorMatrixFilter)){
nArray.push({name:"_ColorMatrix_matrix", value:ColorMatrixFilter(p_value).matrix});
} else {
if ((p_value is ConvolutionFilter)){
nArray.push({name:"_Convolution_alpha", value:ConvolutionFilter(p_value).alpha});
nArray.push({name:"_Convolution_bias", value:ConvolutionFilter(p_value).bias});
nArray.push({name:"_Convolution_clamp", value:ConvolutionFilter(p_value).clamp});
nArray.push({name:"_Convolution_color", value:ConvolutionFilter(p_value).color});
nArray.push({name:"_Convolution_divisor", value:ConvolutionFilter(p_value).divisor});
nArray.push({name:"_Convolution_matrixX", value:ConvolutionFilter(p_value).matrixX});
nArray.push({name:"_Convolution_matrixY", value:ConvolutionFilter(p_value).matrixY});
nArray.push({name:"_Convolution_preserveAlpha", value:ConvolutionFilter(p_value).preserveAlpha});
} else {
if ((p_value is DisplacementMapFilter)){
nArray.push({name:"_DisplacementMap_alpha", value:DisplacementMapFilter(p_value).alpha});
nArray.push({name:"_DisplacementMap_color", value:DisplacementMapFilter(p_value).color});
nArray.push({name:"_DisplacementMap_componentX", value:DisplacementMapFilter(p_value).componentX});
nArray.push({name:"_DisplacementMap_componentY", value:DisplacementMapFilter(p_value).componentY});
nArray.push({name:"_DisplacementMap_mapBitmap", value:DisplacementMapFilter(p_value).mapBitmap});
nArray.push({name:"_DisplacementMap_mapPoint", value:DisplacementMapFilter(p_value).mapPoint});
nArray.push({name:"_DisplacementMap_mode", value:DisplacementMapFilter(p_value).mode});
nArray.push({name:"_DisplacementMap_scaleX", value:DisplacementMapFilter(p_value).scaleX});
nArray.push({name:"_DisplacementMap_scaleY", value:DisplacementMapFilter(p_value).scaleY});
} else {
if ((p_value is DropShadowFilter)){
nArray.push({name:"_DropShadow_alpha", value:DropShadowFilter(p_value).alpha});
nArray.push({name:"_DropShadow_angle", value:DropShadowFilter(p_value).angle});
nArray.push({name:"_DropShadow_blurX", value:DropShadowFilter(p_value).blurX});
nArray.push({name:"_DropShadow_blurY", value:DropShadowFilter(p_value).blurY});
nArray.push({name:"_DropShadow_color", value:DropShadowFilter(p_value).color});
nArray.push({name:"_DropShadow_distance", value:DropShadowFilter(p_value).distance});
nArray.push({name:"_DropShadow_hideObject", value:DropShadowFilter(p_value).hideObject});
nArray.push({name:"_DropShadow_inner", value:DropShadowFilter(p_value).inner});
nArray.push({name:"_DropShadow_knockout", value:DropShadowFilter(p_value).knockout});
nArray.push({name:"_DropShadow_quality", value:DropShadowFilter(p_value).quality});
nArray.push({name:"_DropShadow_strength", value:DropShadowFilter(p_value).strength});
} else {
if ((p_value is GlowFilter)){
nArray.push({name:"_Glow_alpha", value:GlowFilter(p_value).alpha});
nArray.push({name:"_Glow_blurX", value:GlowFilter(p_value).blurX});
nArray.push({name:"_Glow_blurY", value:GlowFilter(p_value).blurY});
nArray.push({name:"_Glow_color", value:GlowFilter(p_value).color});
nArray.push({name:"_Glow_inner", value:GlowFilter(p_value).inner});
nArray.push({name:"_Glow_knockout", value:GlowFilter(p_value).knockout});
nArray.push({name:"_Glow_quality", value:GlowFilter(p_value).quality});
nArray.push({name:"_Glow_strength", value:GlowFilter(p_value).strength});
} else {
if ((p_value is GradientBevelFilter)){
nArray.push({name:"_GradientBevel_angle", value:GradientBevelFilter(p_value).strength});
nArray.push({name:"_GradientBevel_blurX", value:GradientBevelFilter(p_value).blurX});
nArray.push({name:"_GradientBevel_blurY", value:GradientBevelFilter(p_value).blurY});
nArray.push({name:"_GradientBevel_distance", value:GradientBevelFilter(p_value).distance});
nArray.push({name:"_GradientBevel_quality", value:GradientBevelFilter(p_value).quality});
nArray.push({name:"_GradientBevel_strength", value:GradientBevelFilter(p_value).strength});
nArray.push({name:"_GradientBevel_type", value:GradientBevelFilter(p_value).type});
} else {
if ((p_value is GradientGlowFilter)){
nArray.push({name:"_GradientGlow_angle", value:GradientGlowFilter(p_value).strength});
nArray.push({name:"_GradientGlow_blurX", value:GradientGlowFilter(p_value).blurX});
nArray.push({name:"_GradientGlow_blurY", value:GradientGlowFilter(p_value).blurY});
nArray.push({name:"_GradientGlow_distance", value:GradientGlowFilter(p_value).distance});
nArray.push({name:"_GradientGlow_knockout", value:GradientGlowFilter(p_value).knockout});
nArray.push({name:"_GradientGlow_quality", value:GradientGlowFilter(p_value).quality});
nArray.push({name:"_GradientGlow_strength", value:GradientGlowFilter(p_value).strength});
nArray.push({name:"_GradientGlow_type", value:GradientGlowFilter(p_value).type});
} else {
trace("Tweener FilterShortcuts Error :: Unknown filter class used");
};
};
};
};
};
};
};
};
};
return (nArray);
}
}
}//package caurina.transitions.properties
Section 3 (1.13 KiB) ●
//AuxFunctions (caurina.transitions.AuxFunctions)
package caurina.transitions {
public class AuxFunctions {
public function AuxFunctions(){
super();
}
public static function getObjectLength(p_object:Object):uint{
var pName:String;
var totalProperties:uint;
for (pName in p_object) {
totalProperties++;
};
return (totalProperties);
}
public static function numberToG(p_num:Number):Number{
return (((p_num & 0xFF00) >> 8));
}
public static function numberToB(p_num:Number):Number{
return ((p_num & 0xFF));
}
public static function numberToR(p_num:Number):Number{
return (((p_num & 0xFF0000) >> 16));
}
public static function concatObjects(... _args):Object{
var currentObject:Object;
var prop:String;
var finalObject:Object = {};
var i:int;
while (i < _args.length) {
currentObject = _args[i];
for (prop in currentObject) {
if (currentObject[prop] == null){
delete finalObject[prop];
} else {
finalObject[prop] = currentObject[prop];
};
};
i++;
};
return (finalObject);
}
}
}//package caurina.transitions
Section 4 (14.32 KiB) ● ●
//Equations (caurina.transitions.Equations)
package caurina.transitions {
public class Equations {
public function Equations(){
super();
trace("Equations is a static class and should not be instantiated.");
}
public static function easeOutBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
if (t < (1 / 2.75)){
return (((c * ((7.5625 * t) * t)) + b));
};
if (t < (2 / 2.75)){
t = (t - (1.5 / 2.75));
return (((c * (((7.5625 * t) * t) + 0.75)) + b));
};
if (t < (2.5 / 2.75)){
t = (t - (2.25 / 2.75));
return (((c * (((7.5625 * t) * t) + 0.9375)) + b));
};
t = (t - (2.625 / 2.75));
return (((c * (((7.5625 * t) * t) + 0.984375)) + b));
}
public static function easeInOutElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number;
if (t == 0){
return (b);
};
t = (t / (d / 2));
if (t == 2){
return ((b + c));
};
var p:Number = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * (0.3 * 1.5)) : p_params.period;
var a:Number = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude;
if (((!(Boolean(a))) || ((a < Math.abs(c))))){
a = c;
s = (p / 4);
} else {
s = ((p / (2 * Math.PI)) * Math.asin((c / a)));
};
if (t < 1){
--t;
return (((-0.5 * ((a * Math.pow(2, (10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p)))) + b));
};
--t;
return ((((((a * Math.pow(2, (-10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p))) * 0.5) + c) + b));
}
public static function easeInOutQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return (((((c / 2) * t) * t) + b));
};
--t;
return ((((-(c) / 2) * ((t * (t - 2)) - 1)) + b));
}
public static function easeInOutBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (((easeInBounce((t * 2), 0, c, d) * 0.5) + b));
};
return ((((easeOutBounce(((t * 2) - d), 0, c, d) * 0.5) + (c * 0.5)) + b));
}
public static function easeInOutBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot;
t = (t / (d / 2));
if (t < 1){
s = (s * 1.525);
return ((((c / 2) * ((t * t) * (((s + 1) * t) - s))) + b));
};
t = (t - 2);
s = (s * 1.525);
return ((((c / 2) * (((t * t) * (((s + 1) * t) + s)) + 2)) + b));
}
public static function easeOutInCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutCubic((t * 2), b, (c / 2), d, p_params));
};
return (easeInCubic(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeNone(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return ((((c * t) / d) + b));
}
public static function easeOutBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot;
t = ((t / d) - 1);
return (((c * (((t * t) * (((s + 1) * t) + s)) + 1)) + b));
}
public static function easeInOutSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return ((((-(c) / 2) * (Math.cos(((Math.PI * t) / d)) - 1)) + b));
}
public static function easeInBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot;
t = (t / d);
return (((((c * t) * t) * (((s + 1) * t) - s)) + b));
}
public static function easeInQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return ((((((c * t) * t) * t) * t) + b));
}
public static function easeOutInQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutQuint((t * 2), b, (c / 2), d, p_params));
};
return (easeInQuint(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeOutInBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutBounce((t * 2), b, (c / 2), d, p_params));
};
return (easeInBounce(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function init():void{
Tweener.registerTransition("easenone", easeNone);
Tweener.registerTransition("linear", easeNone);
Tweener.registerTransition("easeinquad", easeInQuad);
Tweener.registerTransition("easeoutquad", easeOutQuad);
Tweener.registerTransition("easeinoutquad", easeInOutQuad);
Tweener.registerTransition("easeoutinquad", easeOutInQuad);
Tweener.registerTransition("easeincubic", easeInCubic);
Tweener.registerTransition("easeoutcubic", easeOutCubic);
Tweener.registerTransition("easeinoutcubic", easeInOutCubic);
Tweener.registerTransition("easeoutincubic", easeOutInCubic);
Tweener.registerTransition("easeinquart", easeInQuart);
Tweener.registerTransition("easeoutquart", easeOutQuart);
Tweener.registerTransition("easeinoutquart", easeInOutQuart);
Tweener.registerTransition("easeoutinquart", easeOutInQuart);
Tweener.registerTransition("easeinquint", easeInQuint);
Tweener.registerTransition("easeoutquint", easeOutQuint);
Tweener.registerTransition("easeinoutquint", easeInOutQuint);
Tweener.registerTransition("easeoutinquint", easeOutInQuint);
Tweener.registerTransition("easeinsine", easeInSine);
Tweener.registerTransition("easeoutsine", easeOutSine);
Tweener.registerTransition("easeinoutsine", easeInOutSine);
Tweener.registerTransition("easeoutinsine", easeOutInSine);
Tweener.registerTransition("easeincirc", easeInCirc);
Tweener.registerTransition("easeoutcirc", easeOutCirc);
Tweener.registerTransition("easeinoutcirc", easeInOutCirc);
Tweener.registerTransition("easeoutincirc", easeOutInCirc);
Tweener.registerTransition("easeinexpo", easeInExpo);
Tweener.registerTransition("easeoutexpo", easeOutExpo);
Tweener.registerTransition("easeinoutexpo", easeInOutExpo);
Tweener.registerTransition("easeoutinexpo", easeOutInExpo);
Tweener.registerTransition("easeinelastic", easeInElastic);
Tweener.registerTransition("easeoutelastic", easeOutElastic);
Tweener.registerTransition("easeinoutelastic", easeInOutElastic);
Tweener.registerTransition("easeoutinelastic", easeOutInElastic);
Tweener.registerTransition("easeinback", easeInBack);
Tweener.registerTransition("easeoutback", easeOutBack);
Tweener.registerTransition("easeinoutback", easeInOutBack);
Tweener.registerTransition("easeoutinback", easeOutInBack);
Tweener.registerTransition("easeinbounce", easeInBounce);
Tweener.registerTransition("easeoutbounce", easeOutBounce);
Tweener.registerTransition("easeinoutbounce", easeInOutBounce);
Tweener.registerTransition("easeoutinbounce", easeOutInBounce);
}
public static function easeOutExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return (((t)==d) ? (b + c) : (((c * 1.001) * (-(Math.pow(2, ((-10 * t) / d))) + 1)) + b));
}
public static function easeOutInBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutBack((t * 2), b, (c / 2), d, p_params));
};
return (easeInBack(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeInExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return (((t)==0) ? b : (((c * Math.pow(2, (10 * ((t / d) - 1)))) + b) - (c * 0.001)));
}
public static function easeInCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return (((((c * t) * t) * t) + b));
}
public static function easeInQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return (((((((c * t) * t) * t) * t) * t) + b));
}
public static function easeInOutCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return ((((-(c) / 2) * (Math.sqrt((1 - (t * t))) - 1)) + b));
};
t = (t - 2);
return ((((c / 2) * (Math.sqrt((1 - (t * t))) + 1)) + b));
}
public static function easeInQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return ((((c * t) * t) + b));
}
public static function easeInBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return (((c - easeOutBounce((d - t), 0, c, d)) + b));
}
public static function easeOutInExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutExpo((t * 2), b, (c / 2), d, p_params));
};
return (easeInExpo(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeOutQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = ((t / d) - 1);
return (((-(c) * ((((t * t) * t) * t) - 1)) + b));
}
public static function easeInSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return ((((-(c) * Math.cos(((t / d) * (Math.PI / 2)))) + c) + b));
}
public static function easeInOutQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return (((((((c / 2) * t) * t) * t) * t) + b));
};
t = (t - 2);
return ((((-(c) / 2) * ((((t * t) * t) * t) - 2)) + b));
}
public static function easeOutQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return ((((-(c) * t) * (t - 2)) + b));
}
public static function easeOutInElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutElastic((t * 2), b, (c / 2), d, p_params));
};
return (easeInElastic(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeInElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number;
if (t == 0){
return (b);
};
t = (t / d);
if (t == 1){
return ((b + c));
};
var p:Number = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * 0.3) : p_params.period;
var a:Number = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude;
if (((!(Boolean(a))) || ((a < Math.abs(c))))){
a = c;
s = (p / 4);
} else {
s = ((p / (2 * Math.PI)) * Math.asin((c / a)));
};
--t;
return ((-(((a * Math.pow(2, (10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p)))) + b));
}
public static function easeOutCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = ((t / d) - 1);
return (((c * (((t * t) * t) + 1)) + b));
}
public static function easeOutQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = ((t / d) - 1);
return (((c * (((((t * t) * t) * t) * t) + 1)) + b));
}
public static function easeOutInQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutQuad((t * 2), b, (c / 2), d, p_params));
};
return (easeInQuad(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeOutSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return (((c * Math.sin(((t / d) * (Math.PI / 2)))) + b));
}
public static function easeInOutCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return ((((((c / 2) * t) * t) * t) + b));
};
t = (t - 2);
return ((((c / 2) * (((t * t) * t) + 2)) + b));
}
public static function easeInOutQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return ((((((((c / 2) * t) * t) * t) * t) * t) + b));
};
t = (t - 2);
return ((((c / 2) * (((((t * t) * t) * t) * t) + 2)) + b));
}
public static function easeInCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return (((-(c) * (Math.sqrt((1 - (t * t))) - 1)) + b));
}
public static function easeOutInSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutSine((t * 2), b, (c / 2), d, p_params));
};
return (easeInSine(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeInOutExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t == 0){
return (b);
};
if (t == d){
return ((b + c));
};
t = (t / (d / 2));
if (t < 1){
return (((((c / 2) * Math.pow(2, (10 * (t - 1)))) + b) - (c * 0.0005)));
};
--t;
return (((((c / 2) * 1.0005) * (-(Math.pow(2, (-10 * t))) + 2)) + b));
}
public static function easeOutElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number;
if (t == 0){
return (b);
};
t = (t / d);
if (t == 1){
return ((b + c));
};
var p:Number = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * 0.3) : p_params.period;
var a:Number = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude;
if (((!(Boolean(a))) || ((a < Math.abs(c))))){
a = c;
s = (p / 4);
} else {
s = ((p / (2 * Math.PI)) * Math.asin((c / a)));
};
return (((((a * Math.pow(2, (-10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p))) + c) + b));
}
public static function easeOutCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = ((t / d) - 1);
return (((c * Math.sqrt((1 - (t * t)))) + b));
}
public static function easeOutInQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutQuart((t * 2), b, (c / 2), d, p_params));
};
return (easeInQuart(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeOutInCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutCirc((t * 2), b, (c / 2), d, p_params));
};
return (easeInCirc(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
}
}//package caurina.transitions
Section 5 (2.36 KiB) ●
//PropertyInfoObj (caurina.transitions.PropertyInfoObj)
package caurina.transitions {
public class PropertyInfoObj {
public var modifierParameters:Array;
public var isSpecialProperty:Boolean;
public var valueComplete:Number;
public var modifierFunction:Function;
public var extra:Object;
public var valueStart:Number;
public var hasModifier:Boolean;
public var arrayIndex:Number;
public var originalValueComplete:Object;
public function PropertyInfoObj(p_valueStart:Number, p_valueComplete:Number, p_originalValueComplete:Object, p_arrayIndex:Number, p_extra:Object, p_isSpecialProperty:Boolean, p_modifierFunction:Function, p_modifierParameters:Array){
super();
valueStart = p_valueStart;
valueComplete = p_valueComplete;
originalValueComplete = p_originalValueComplete;
arrayIndex = p_arrayIndex;
extra = p_extra;
isSpecialProperty = p_isSpecialProperty;
hasModifier = Boolean(p_modifierFunction);
modifierFunction = p_modifierFunction;
modifierParameters = p_modifierParameters;
}
public function toString():String{
var returnStr:String = "\n[PropertyInfoObj ";
returnStr = (returnStr + ("valueStart:" + String(valueStart)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("valueComplete:" + String(valueComplete)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("originalValueComplete:" + String(originalValueComplete)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("arrayIndex:" + String(arrayIndex)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("extra:" + String(extra)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("isSpecialProperty:" + String(isSpecialProperty)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("hasModifier:" + String(hasModifier)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("modifierFunction:" + String(modifierFunction)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("modifierParameters:" + String(modifierParameters)));
returnStr = (returnStr + "]\n");
return (returnStr);
}
public function clone():PropertyInfoObj{
var nProperty:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (nProperty);
}
}
}//package caurina.transitions
Section 6 (1.01 KiB) ●
//SpecialProperty (caurina.transitions.SpecialProperty)
package caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var getValue:Function;
public var preProcess:Function;
public var setValue:Function;
public function SpecialProperty(p_getFunction:Function, p_setFunction:Function, p_parameters:Array=null, p_preProcessFunction:Function=null){
super();
getValue = p_getFunction;
setValue = p_setFunction;
parameters = p_parameters;
preProcess = p_preProcessFunction;
}
public function toString():String{
var value:String = "";
value = (value + "[SpecialProperty ");
value = (value + ("getValue:" + String(getValue)));
value = (value + ", ");
value = (value + ("setValue:" + String(setValue)));
value = (value + ", ");
value = (value + ("parameters:" + String(parameters)));
value = (value + ", ");
value = (value + ("preProcess:" + String(preProcess)));
value = (value + "]");
return (value);
}
}
}//package caurina.transitions
Section 7 (730 B)
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier)
package caurina.transitions {
public class SpecialPropertyModifier {
public var getValue:Function;
public var modifyValues:Function;
public function SpecialPropertyModifier(p_modifyFunction:Function, p_getFunction:Function){
super();
modifyValues = p_modifyFunction;
getValue = p_getFunction;
}
public function toString():String{
var value:String = "";
value = (value + "[SpecialPropertyModifier ");
value = (value + ("modifyValues:" + String(modifyValues)));
value = (value + ", ");
value = (value + ("getValue:" + String(getValue)));
value = (value + "]");
return (value);
}
}
}//package caurina.transitions
Section 8 (724 B)
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter)
package caurina.transitions {
public class SpecialPropertySplitter {
public var parameters:Array;
public var splitValues:Function;
public function SpecialPropertySplitter(p_splitFunction:Function, p_parameters:Array){
super();
splitValues = p_splitFunction;
parameters = p_parameters;
}
public function toString():String{
var value:String = "";
value = (value + "[SpecialPropertySplitter ");
value = (value + ("splitValues:" + String(splitValues)));
value = (value + ", ");
value = (value + ("parameters:" + String(parameters)));
value = (value + "]");
return (value);
}
}
}//package caurina.transitions
Section 9 (26.25 KiB) ● ● ●
//Tweener (caurina.transitions.Tweener)
package caurina.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tweener {
private static var _timeScale:Number = 1;
private static var _currentTimeFrame:Number;
private static var _specialPropertySplitterList:Object;
private static var _engineExists:Boolean = false;
private static var _specialPropertyModifierList:Object;
private static var _currentTime:Number;
private static var _tweenList:Array;
private static var _specialPropertyList:Object;
private static var _transitionList:Object;
private static var _inited:Boolean = false;
private static var __tweener_controller__:MovieClip;
public function Tweener(){
super();
trace("Tweener is a static class and should not be instantiated.");
}
public static function registerSpecialPropertyModifier(p_name:String, p_modifyFunction:Function, p_getFunction:Function):void{
if (!_inited){
init();
};
var spm:SpecialPropertyModifier = new SpecialPropertyModifier(p_modifyFunction, p_getFunction);
_specialPropertyModifierList[p_name] = spm;
}
public static function registerSpecialProperty(p_name:String, p_getFunction:Function, p_setFunction:Function, p_parameters:Array=null, p_preProcessFunction:Function=null):void{
if (!_inited){
init();
};
var sp:SpecialProperty = new SpecialProperty(p_getFunction, p_setFunction, p_parameters, p_preProcessFunction);
_specialPropertyList[p_name] = sp;
}
public static function init(... _args):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
private static function updateTweens():Boolean{
var i:int;
if (_tweenList.length == 0){
return (false);
};
i = 0;
while (i < _tweenList.length) {
if ((((_tweenList[i] == undefined)) || (!(_tweenList[i].isPaused)))){
if (!updateTweenByIndex(i)){
removeTweenByIndex(i);
};
if (_tweenList[i] == null){
removeTweenByIndex(i, true);
i--;
};
};
i++;
};
return (true);
}
public static function addCaller(p_scopes:Object=null, p_parameters:Object=null):Boolean{
var i:Number;
var rScopes:Array;
var rTransition:Function;
var nTween:TweenListObj;
var myT:Number;
var trans:String;
if (!Boolean(p_scopes)){
return (false);
};
if ((p_scopes is Array)){
rScopes = p_scopes.concat();
} else {
rScopes = [p_scopes];
};
var p_obj:Object = p_parameters;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var rTime:Number = (isNaN(p_obj.time)) ? 0 : p_obj.time;
var rDelay:Number = (isNaN(p_obj.delay)) ? 0 : p_obj.delay;
if (typeof(p_obj.transition) == "string"){
trans = p_obj.transition.toLowerCase();
rTransition = _transitionList[trans];
} else {
rTransition = p_obj.transition;
};
if (!Boolean(rTransition)){
rTransition = _transitionList["easeoutexpo"];
};
i = 0;
while (i < rScopes.length) {
if (p_obj.useFrames == true){
nTween = new TweenListObj(rScopes[i], (_currentTimeFrame + (rDelay / _timeScale)), (_currentTimeFrame + ((rDelay + rTime) / _timeScale)), true, rTransition, p_obj.transitionParams);
} else {
nTween = new TweenListObj(rScopes[i], (_currentTime + ((rDelay * 1000) / _timeScale)), (_currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale)), false, rTransition, p_obj.transitionParams);
};
nTween.properties = null;
nTween.onStart = p_obj.onStart;
nTween.onUpdate = p_obj.onUpdate;
nTween.onComplete = p_obj.onComplete;
nTween.onOverwrite = p_obj.onOverwrite;
nTween.onStartParams = p_obj.onStartParams;
nTween.onUpdateParams = p_obj.onUpdateParams;
nTween.onCompleteParams = p_obj.onCompleteParams;
nTween.onOverwriteParams = p_obj.onOverwriteParams;
nTween.onStartScope = p_obj.onStartScope;
nTween.onUpdateScope = p_obj.onUpdateScope;
nTween.onCompleteScope = p_obj.onCompleteScope;
nTween.onOverwriteScope = p_obj.onOverwriteScope;
nTween.onErrorScope = p_obj.onErrorScope;
nTween.isCaller = true;
nTween.count = p_obj.count;
nTween.waitFrames = p_obj.waitFrames;
_tweenList.push(nTween);
if ((((rTime == 0)) && ((rDelay == 0)))){
myT = (_tweenList.length - 1);
updateTweenByIndex(myT);
removeTweenByIndex(myT);
};
i++;
};
return (true);
}
public static function pauseAllTweens():Boolean{
var i:uint;
if (!Boolean(_tweenList)){
return (false);
};
var paused:Boolean;
i = 0;
while (i < _tweenList.length) {
pauseTweenByIndex(i);
paused = true;
i++;
};
return (paused);
}
public static function removeTweens(p_scope:Object, ... _args):Boolean{
var i:uint;
var sps:SpecialPropertySplitter;
var specialProps:Array;
var j:uint;
var properties:Array = new Array();
i = 0;
while (i < _args.length) {
if ((((typeof(_args[i]) == "string")) && ((properties.indexOf(_args[i]) == -1)))){
if (_specialPropertySplitterList[_args[i]]){
sps = _specialPropertySplitterList[_args[i]];
specialProps = sps.splitValues(p_scope, null);
j = 0;
while (j < specialProps.length) {
properties.push(specialProps[j].name);
j++;
};
} else {
properties.push(_args[i]);
};
};
i++;
};
return (affectTweens(removeTweenByIndex, p_scope, properties));
}
public static function splitTweens(p_tween:Number, p_properties:Array):uint{
var i:uint;
var pName:String;
var found:Boolean;
var originalTween:TweenListObj = _tweenList[p_tween];
var newTween:TweenListObj = originalTween.clone(false);
i = 0;
while (i < p_properties.length) {
pName = p_properties[i];
if (Boolean(originalTween.properties[pName])){
originalTween.properties[pName] = undefined;
delete originalTween.properties[pName];
};
i++;
};
for (pName in newTween.properties) {
found = false;
i = 0;
while (i < p_properties.length) {
if (p_properties[i] == pName){
found = true;
break;
};
i++;
};
if (!found){
newTween.properties[pName] = undefined;
delete newTween.properties[pName];
};
};
_tweenList.push(newTween);
return ((_tweenList.length - 1));
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function resumeTweenByIndex(p_tween:Number):Boolean{
var tTweening:TweenListObj = _tweenList[p_tween];
if ((((tTweening == null)) || (!(tTweening.isPaused)))){
return (false);
};
var cTime:Number = getCurrentTweeningTime(tTweening);
tTweening.timeStart = (tTweening.timeStart + (cTime - tTweening.timePaused));
tTweening.timeComplete = (tTweening.timeComplete + (cTime - tTweening.timePaused));
tTweening.timePaused = undefined;
tTweening.isPaused = false;
return (true);
}
public static function getVersion():String{
return ("AS3 1.31.74");
}
public static function onEnterFrame(e:Event):void{
updateTime();
updateFrame();
var hasUpdated:Boolean;
hasUpdated = updateTweens();
if (!hasUpdated){
stopEngine();
};
}
public static function updateTime():void{
_currentTime = getTimer();
}
private static function updateTweenByIndex(i:Number):Boolean{
var tTweening:TweenListObj;
var mustUpdate:Boolean;
var nv:Number;
var t:Number;
var b:Number;
var c:Number;
var d:Number;
var pName:String;
var eventScope:Object;
var tScope:Object;
var tProperty:Object;
var pv:Number;
var i = i;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
var isOver:Boolean;
var cTime:Number = getCurrentTweeningTime(tTweening);
if (cTime >= tTweening.timeStart){
tScope = tTweening.scope;
if (tTweening.isCaller){
do {
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1));
b = tTweening.timeStart;
c = (tTweening.timeComplete - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
//unresolved if
if (Boolean(tTweening.onUpdate)){
eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope;
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
continue;
var _slot1 = e1;
handleError(tTweening, _slot1, "onUpdate");
};
} while (tTweening.timesCalled++, !(tTweening.timesCalled >= tTweening.count));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (cTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope;
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
//unresolved jump
var _slot1 = e2;
handleError(tTweening, _slot1, "onStart");
};
for (pName in tTweening.properties) {
if (tTweening.properties[pName].isSpecialProperty){
if (Boolean(_specialPropertyList[pName].preProcess)){
tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra);
};
pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
pv = tScope[pName];
};
tTweening.properties[pName].valueStart = (isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv;
};
mustUpdate = true;
tTweening.hasStarted = true;
};
if (mustUpdate){
for (pName in tTweening.properties) {
tProperty = tTweening.properties[pName];
if (isOver){
nv = tProperty.valueComplete;
} else {
if (tProperty.hasModifier){
t = (cTime - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams);
nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters);
} else {
t = (cTime - tTweening.timeStart);
b = tProperty.valueStart;
c = (tProperty.valueComplete - tProperty.valueStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d, tTweening.transitionParams);
};
};
if (tTweening.rounded){
nv = Math.round(nv);
};
if (tProperty.isSpecialProperty){
_specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
tScope[pName] = nv;
};
};
tTweening.updatesSkipped = 0;
if (Boolean(tTweening.onUpdate)){
eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope;
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
//unresolved jump
var _slot1 = e3;
handleError(tTweening, _slot1, "onUpdate");
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope;
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
//unresolved jump
var _slot1 = e4;
handleError(tTweening, _slot1, "onComplete");
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(p_time:Number):void{
var i:Number;
var cTime:Number;
if (isNaN(p_time)){
p_time = 1;
};
if (p_time < 1E-5){
p_time = 1E-5;
};
if (p_time != _timeScale){
if (_tweenList != null){
i = 0;
while (i < _tweenList.length) {
cTime = getCurrentTweeningTime(_tweenList[i]);
_tweenList[i].timeStart = (cTime - (((cTime - _tweenList[i].timeStart) * _timeScale) / p_time));
_tweenList[i].timeComplete = (cTime - (((cTime - _tweenList[i].timeComplete) * _timeScale) / p_time));
if (_tweenList[i].timePaused != undefined){
_tweenList[i].timePaused = (cTime - (((cTime - _tweenList[i].timePaused) * _timeScale) / p_time));
};
i++;
};
};
_timeScale = p_time;
};
}
public static function resumeAllTweens():Boolean{
var i:uint;
if (!Boolean(_tweenList)){
return (false);
};
var resumed:Boolean;
i = 0;
while (i < _tweenList.length) {
resumeTweenByIndex(i);
resumed = true;
i++;
};
return (resumed);
}
private static function handleError(pTweening:TweenListObj, pError:Error, pCallBackName:String):void{
var eventScope:Object;
var pTweening = pTweening;
var pError = pError;
var pCallBackName = pCallBackName;
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){
eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope;
pTweening.onError.apply(eventScope, [pTweening.scope, pError]);
//unresolved jump
var _slot1 = metaError;
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + _slot1.getStackTrace()));
} else {
if (!Boolean(pTweening.onError)){
printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace()));
};
};
}
private static function startEngine():void{
_engineExists = true;
_tweenList = new Array();
__tweener_controller__ = new MovieClip();
__tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
_currentTimeFrame = 0;
updateTime();
}
public static function removeAllTweens():Boolean{
var i:uint;
if (!Boolean(_tweenList)){
return (false);
};
var removed:Boolean;
i = 0;
while (i < _tweenList.length) {
removeTweenByIndex(i);
removed = true;
i++;
};
return (removed);
}
public static function addTween(p_scopes:Object=null, p_parameters:Object=null):Boolean{
var i:Number;
var j:Number;
var istr:String;
var rScopes:Array;
var rTransition:Function;
var nProperties:Object;
var nTween:TweenListObj;
var myT:Number;
var splitProperties:Array;
var splitProperties2:Array;
var tempModifiedProperties:Array;
var trans:String;
if (!Boolean(p_scopes)){
return (false);
};
if ((p_scopes is Array)){
rScopes = p_scopes.concat();
} else {
rScopes = [p_scopes];
};
var p_obj:Object = TweenListObj.makePropertiesChain(p_parameters);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var rTime:Number = (isNaN(p_obj.time)) ? 0 : p_obj.time;
var rDelay:Number = (isNaN(p_obj.delay)) ? 0 : p_obj.delay;
var rProperties:Array = new Array();
var restrictedWords:Object = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true};
var modifiedProperties:Object = new Object();
for (istr in p_obj) {
if (!restrictedWords[istr]){
if (_specialPropertySplitterList[istr]){
splitProperties = _specialPropertySplitterList[istr].splitValues(p_obj[istr], _specialPropertySplitterList[istr].parameters);
i = 0;
while (i < splitProperties.length) {
if (_specialPropertySplitterList[splitProperties[i].name]){
splitProperties2 = _specialPropertySplitterList[splitProperties[i].name].splitValues(splitProperties[i].value, _specialPropertySplitterList[splitProperties[i].name].parameters);
j = 0;
while (j < splitProperties2.length) {
rProperties[splitProperties2[j].name] = {valueStart:undefined, valueComplete:splitProperties2[j].value, arrayIndex:splitProperties2[j].arrayIndex, isSpecialProperty:false};
j++;
};
} else {
rProperties[splitProperties[i].name] = {valueStart:undefined, valueComplete:splitProperties[i].value, arrayIndex:splitProperties[i].arrayIndex, isSpecialProperty:false};
};
i++;
};
} else {
if (_specialPropertyModifierList[istr] != undefined){
tempModifiedProperties = _specialPropertyModifierList[istr].modifyValues(p_obj[istr]);
i = 0;
while (i < tempModifiedProperties.length) {
modifiedProperties[tempModifiedProperties[i].name] = {modifierParameters:tempModifiedProperties[i].parameters, modifierFunction:_specialPropertyModifierList[istr].getValue};
i++;
};
} else {
rProperties[istr] = {valueStart:undefined, valueComplete:p_obj[istr]};
};
};
};
};
for (istr in rProperties) {
if (_specialPropertyList[istr] != undefined){
rProperties[istr].isSpecialProperty = true;
} else {
if (rScopes[0][istr] == undefined){
printError((((("The property '" + istr) + "' doesn't seem to be a normal object property of ") + String(rScopes[0])) + " or a registered special property."));
};
};
};
for (istr in modifiedProperties) {
if (rProperties[istr] != undefined){
rProperties[istr].modifierParameters = modifiedProperties[istr].modifierParameters;
rProperties[istr].modifierFunction = modifiedProperties[istr].modifierFunction;
};
};
if (typeof(p_obj.transition) == "string"){
trans = p_obj.transition.toLowerCase();
rTransition = _transitionList[trans];
} else {
rTransition = p_obj.transition;
};
if (!Boolean(rTransition)){
rTransition = _transitionList["easeoutexpo"];
};
i = 0;
while (i < rScopes.length) {
nProperties = new Object();
for (istr in rProperties) {
nProperties[istr] = new PropertyInfoObj(rProperties[istr].valueStart, rProperties[istr].valueComplete, rProperties[istr].valueComplete, rProperties[istr].arrayIndex, {}, rProperties[istr].isSpecialProperty, rProperties[istr].modifierFunction, rProperties[istr].modifierParameters);
};
if (p_obj.useFrames == true){
nTween = new TweenListObj(rScopes[i], (_currentTimeFrame + (rDelay / _timeScale)), (_currentTimeFrame + ((rDelay + rTime) / _timeScale)), true, rTransition, p_obj.transitionParams);
} else {
nTween = new TweenListObj(rScopes[i], (_currentTime + ((rDelay * 1000) / _timeScale)), (_currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale)), false, rTransition, p_obj.transitionParams);
};
nTween.properties = nProperties;
nTween.onStart = p_obj.onStart;
nTween.onUpdate = p_obj.onUpdate;
nTween.onComplete = p_obj.onComplete;
nTween.onOverwrite = p_obj.onOverwrite;
nTween.onError = p_obj.onError;
nTween.onStartParams = p_obj.onStartParams;
nTween.onUpdateParams = p_obj.onUpdateParams;
nTween.onCompleteParams = p_obj.onCompleteParams;
nTween.onOverwriteParams = p_obj.onOverwriteParams;
nTween.onStartScope = p_obj.onStartScope;
nTween.onUpdateScope = p_obj.onUpdateScope;
nTween.onCompleteScope = p_obj.onCompleteScope;
nTween.onOverwriteScope = p_obj.onOverwriteScope;
nTween.onErrorScope = p_obj.onErrorScope;
nTween.rounded = p_obj.rounded;
nTween.skipUpdates = p_obj.skipUpdates;
removeTweensByTime(nTween.scope, nTween.properties, nTween.timeStart, nTween.timeComplete);
_tweenList.push(nTween);
if ((((rTime == 0)) && ((rDelay == 0)))){
myT = (_tweenList.length - 1);
updateTweenByIndex(myT);
removeTweenByIndex(myT);
};
i++;
};
return (true);
}
public static function registerTransition(p_name:String, p_function:Function):void{
if (!_inited){
init();
};
_transitionList[p_name] = p_function;
}
public static function printError(p_message:String):void{
trace(("## [Tweener] Error: " + p_message));
}
private static function affectTweens(p_affectFunction:Function, p_scope:Object, p_properties:Array):Boolean{
var i:uint;
var affectedProperties:Array;
var j:uint;
var objectProperties:uint;
var slicedTweenIndex:uint;
var affected:Boolean;
if (!Boolean(_tweenList)){
return (false);
};
i = 0;
while (i < _tweenList.length) {
if (((_tweenList[i]) && ((_tweenList[i].scope == p_scope)))){
if (p_properties.length == 0){
p_affectFunction(i);
affected = true;
} else {
affectedProperties = new Array();
j = 0;
while (j < p_properties.length) {
if (Boolean(_tweenList[i].properties[p_properties[j]])){
affectedProperties.push(p_properties[j]);
};
j++;
};
if (affectedProperties.length > 0){
objectProperties = AuxFunctions.getObjectLength(_tweenList[i].properties);
if (objectProperties == affectedProperties.length){
p_affectFunction(i);
affected = true;
} else {
slicedTweenIndex = splitTweens(i, affectedProperties);
p_affectFunction(slicedTweenIndex);
affected = true;
};
};
};
};
i++;
};
return (affected);
}
public static function getTweens(p_scope:Object):Array{
var i:uint;
var pName:String;
if (!Boolean(_tweenList)){
return ([]);
};
var tList:Array = new Array();
i = 0;
while (i < _tweenList.length) {
if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){
for (pName in _tweenList[i].properties) {
tList.push(pName);
};
};
i++;
};
return (tList);
}
public static function isTweening(p_scope:Object):Boolean{
var i:uint;
if (!Boolean(_tweenList)){
return (false);
};
i = 0;
while (i < _tweenList.length) {
if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){
return (true);
};
i++;
};
return (false);
}
public static function pauseTweenByIndex(p_tween:Number):Boolean{
var tTweening:TweenListObj = _tweenList[p_tween];
if ((((tTweening == null)) || (tTweening.isPaused))){
return (false);
};
tTweening.timePaused = getCurrentTweeningTime(tTweening);
tTweening.isPaused = true;
return (true);
}
public static function getCurrentTweeningTime(p_tweening:Object):Number{
return ((p_tweening.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getTweenCount(p_scope:Object):Number{
var i:uint;
if (!Boolean(_tweenList)){
return (0);
};
var c:Number = 0;
i = 0;
while (i < _tweenList.length) {
if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){
c = (c + AuxFunctions.getObjectLength(_tweenList[i].properties));
};
i++;
};
return (c);
}
private static function stopEngine():void{
_engineExists = false;
_tweenList = null;
_currentTime = 0;
_currentTimeFrame = 0;
__tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
__tweener_controller__ = null;
}
public static function removeTweensByTime(p_scope:Object, p_properties:Object, p_timeStart:Number, p_timeComplete:Number):Boolean{
var removedLocally:Boolean;
var i:uint;
var pName:String;
var eventScope:Object;
var p_scope = p_scope;
var p_properties = p_properties;
var p_timeStart = p_timeStart;
var p_timeComplete = p_timeComplete;
var removed:Boolean;
var tl:uint = _tweenList.length;
i = 0;
while (i < tl) {
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){
removedLocally = false;
for (pName in _tweenList[i].properties) {
if (Boolean(p_properties[pName])){
if (Boolean(_tweenList[i].onOverwrite)){
eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
//unresolved jump
var _slot1 = e;
handleError(_tweenList[i], _slot1, "onOverwrite");
};
_tweenList[i].properties[pName] = undefined;
delete _tweenList[i].properties[pName];
removedLocally = true;
removed = true;
};
};
if (removedLocally){
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){
removeTweenByIndex(i);
};
};
};
};
i = (i + 1);
};
return (removed);
}
public static function registerSpecialPropertySplitter(p_name:String, p_splitFunction:Function, p_parameters:Array=null):void{
if (!_inited){
init();
};
var sps:SpecialPropertySplitter = new SpecialPropertySplitter(p_splitFunction, p_parameters);
_specialPropertySplitterList[p_name] = sps;
}
public static function removeTweenByIndex(i:Number, p_finalRemoval:Boolean=false):Boolean{
_tweenList[i] = null;
if (p_finalRemoval){
_tweenList.splice(i, 1);
};
return (true);
}
public static function resumeTweens(p_scope:Object, ... _args):Boolean{
var i:uint;
var properties:Array = new Array();
i = 0;
while (i < _args.length) {
if ((((typeof(_args[i]) == "string")) && ((properties.indexOf(_args[i]) == -1)))){
properties.push(_args[i]);
};
i++;
};
return (affectTweens(resumeTweenByIndex, p_scope, properties));
}
public static function pauseTweens(p_scope:Object, ... _args):Boolean{
var i:uint;
var properties:Array = new Array();
i = 0;
while (i < _args.length) {
if ((((typeof(_args[i]) == "string")) && ((properties.indexOf(_args[i]) == -1)))){
properties.push(_args[i]);
};
i++;
};
return (affectTweens(pauseTweenByIndex, p_scope, properties));
}
}
}//package caurina.transitions
Section 10 (7.27 KiB) ● ●
//TweenListObj (caurina.transitions.TweenListObj)
package caurina.transitions {
public class TweenListObj {
public var hasStarted:Boolean;
public var onUpdate:Function;
public var useFrames:Boolean;
public var count:Number;
public var onOverwriteParams:Array;
public var timeStart:Number;
public var timeComplete:Number;
public var onStartParams:Array;
public var onUpdateScope:Object;
public var rounded:Boolean;
public var onUpdateParams:Array;
public var properties:Object;
public var onComplete:Function;
public var transitionParams:Object;
public var updatesSkipped:Number;
public var onStart:Function;
public var onOverwriteScope:Object;
public var skipUpdates:Number;
public var onStartScope:Object;
public var scope:Object;
public var isCaller:Boolean;
public var timePaused:Number;
public var transition:Function;
public var onCompleteParams:Array;
public var onError:Function;
public var timesCalled:Number;
public var onErrorScope:Object;
public var onOverwrite:Function;
public var isPaused:Boolean;
public var waitFrames:Boolean;
public var onCompleteScope:Object;
public function TweenListObj(p_scope:Object, p_timeStart:Number, p_timeComplete:Number, p_useFrames:Boolean, p_transition:Function, p_transitionParams:Object){
super();
scope = p_scope;
timeStart = p_timeStart;
timeComplete = p_timeComplete;
useFrames = p_useFrames;
transition = p_transition;
transitionParams = p_transitionParams;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(omitEvents:Boolean):TweenListObj{
var pName:String;
var nTween:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
nTween.properties = new Array();
for (pName in properties) {
nTween.properties[pName] = properties[pName].clone();
};
nTween.skipUpdates = skipUpdates;
nTween.updatesSkipped = updatesSkipped;
if (!omitEvents){
nTween.onStart = onStart;
nTween.onUpdate = onUpdate;
nTween.onComplete = onComplete;
nTween.onOverwrite = onOverwrite;
nTween.onError = onError;
nTween.onStartParams = onStartParams;
nTween.onUpdateParams = onUpdateParams;
nTween.onCompleteParams = onCompleteParams;
nTween.onOverwriteParams = onOverwriteParams;
nTween.onStartScope = onStartScope;
nTween.onUpdateScope = onUpdateScope;
nTween.onCompleteScope = onCompleteScope;
nTween.onOverwriteScope = onOverwriteScope;
nTween.onErrorScope = onErrorScope;
};
nTween.rounded = rounded;
nTween.isPaused = isPaused;
nTween.timePaused = timePaused;
nTween.isCaller = isCaller;
nTween.count = count;
nTween.timesCalled = timesCalled;
nTween.waitFrames = waitFrames;
nTween.hasStarted = hasStarted;
return (nTween);
}
public function toString():String{
var i:String;
var returnStr:String = "\n[TweenListObj ";
returnStr = (returnStr + ("scope:" + String(scope)));
returnStr = (returnStr + ", properties:");
var isFirst:Boolean;
for (i in properties) {
if (!isFirst){
returnStr = (returnStr + ",");
};
returnStr = (returnStr + ("[name:" + properties[i].name));
returnStr = (returnStr + (",valueStart:" + properties[i].valueStart));
returnStr = (returnStr + (",valueComplete:" + properties[i].valueComplete));
returnStr = (returnStr + "]");
isFirst = false;
};
returnStr = (returnStr + (", timeStart:" + String(timeStart)));
returnStr = (returnStr + (", timeComplete:" + String(timeComplete)));
returnStr = (returnStr + (", useFrames:" + String(useFrames)));
returnStr = (returnStr + (", transition:" + String(transition)));
returnStr = (returnStr + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
returnStr = (returnStr + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
returnStr = (returnStr + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
returnStr = (returnStr + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
returnStr = (returnStr + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
returnStr = (returnStr + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
returnStr = (returnStr + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
returnStr = (returnStr + (", onError:" + String(onError)));
};
if (onStartParams){
returnStr = (returnStr + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
returnStr = (returnStr + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
returnStr = (returnStr + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
returnStr = (returnStr + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
returnStr = (returnStr + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
returnStr = (returnStr + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
returnStr = (returnStr + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
returnStr = (returnStr + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
returnStr = (returnStr + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
returnStr = (returnStr + (", rounded:" + String(rounded)));
};
if (isPaused){
returnStr = (returnStr + (", isPaused:" + String(isPaused)));
};
if (timePaused){
returnStr = (returnStr + (", timePaused:" + String(timePaused)));
};
if (isCaller){
returnStr = (returnStr + (", isCaller:" + String(isCaller)));
};
if (count){
returnStr = (returnStr + (", count:" + String(count)));
};
if (timesCalled){
returnStr = (returnStr + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
returnStr = (returnStr + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
returnStr = (returnStr + (", hasStarted:" + String(hasStarted)));
};
returnStr = (returnStr + "]\n");
return (returnStr);
}
public static function makePropertiesChain(p_obj:Object):Object{
var chainedObject:Object;
var chain:Object;
var currChainObj:Object;
var len:Number;
var i:Number;
var k:Number;
var baseObject:Object = p_obj.base;
if (baseObject){
chainedObject = {};
if ((baseObject is Array)){
chain = [];
k = 0;
while (k < baseObject.length) {
chain.push(baseObject[k]);
k++;
};
} else {
chain = [baseObject];
};
chain.push(p_obj);
len = chain.length;
i = 0;
while (i < len) {
if (chain[i]["base"]){
currChainObj = AuxFunctions.concatObjects(makePropertiesChain(chain[i]["base"]), chain[i]);
} else {
currChainObj = chain[i];
};
chainedObject = AuxFunctions.concatObjects(chainedObject, currChainObj);
i++;
};
if (chainedObject["base"]){
delete chainedObject["base"];
};
return (chainedObject);
//unresolved jump
};
return (p_obj);
}
}
}//package caurina.transitions
Section 11 (404 B)
//DSMath (com.dontsave.math.DSMath)
package com.dontsave.math {
public class DSMath {
public function DSMath(){
super();
}
public static function randRange(min:Number, max:Number):Number{
return (((Math.random() * (max - min)) + min));
}
public static function randInt(min:int, max:int):int{
return (int(Math.floor(randRange(min, (max + 1)))));
}
}
}//package com.dontsave.math
Section 12 (1.36 KiB) ●
//Counter (com.firstpersontetris.Counter)
package com.firstpersontetris {
import flash.events.*;
import flash.display.*;
public class Counter extends EventDispatcher {
private var _value:uint;
private var _digits:Array;
public function Counter(mc:MovieClip, initNumber:uint=0){
_digits = new Array();
super();
var i:uint;
while (i < mc.numChildren) {
if ((mc.getChildAt(i) is MovieClip)){
_digits.push(mc.getChildAt(i));
};
i++;
};
setNum(initNumber);
}
public function get value():uint{
return (_value);
}
public function getString():String{
var d:MovieClip;
var s:String = "";
var i:uint;
while (i < _digits.length) {
d = (_digits[i] as MovieClip);
s = (s + String((d.currentFrame - 1)));
i++;
};
return (s);
}
public function setNum(num:uint):void{
var d:MovieClip;
var s:String = String(num);
_value = num;
var i:uint;
while (i < _digits.length) {
d = (_digits[i] as MovieClip);
if (s.length <= _digits.length){
d.gotoAndStop(1);
} else {
d.gotoAndStop(d.totalFrames);
};
i++;
};
if (s.length <= _digits.length){
i = 0;
while (i < s.length) {
d = (_digits[((_digits.length - s.length) + i)] as MovieClip);
d.gotoAndStop((uint(s.charAt(i)) + 1));
i++;
};
};
}
}
}//package com.firstpersontetris
Section 13 (28.84 KiB) ● ● ●
//FirstPersonTetris (com.firstpersontetris.FirstPersonTetris)
package com.firstpersontetris {
import flash.events.*;
import flash.geom.*;
import caurina.transitions.*;
import flash.display.*;
import flash.utils.*;
import caurina.transitions.properties.*;
import flash.net.*;
import flash.ui.*;
public class FirstPersonTetris extends Sprite {
private var _lines:uint;// = 0
private var _fxY:Number;
private var _nesBoard:NESBoard;
private var _fxX:Number;
protected var _dropTimer:Timer;
private var _mouseHideTimer:Timer;
protected var _pieceIndex:int;// = -1
private var _leftKeyTimer:Timer;
protected var _currentRow:int;
private var _dead:Boolean;
protected var _dropDelay:Number;// = 400
protected var _isPaused:Boolean;
protected var _pieceSprites:Array;
private var _rightKeyTimer:Timer;
private var _fx:Sprite;
protected var _showPiece:Sprite;
protected var _boardHolder:Sprite;
private var _boardChild:Sprite;
private var _settings:MovieClip;
private var _level:uint;// = 0
private var _score:uint;// = 0
protected var _boardArray:Array;
private var _sceneScale:Number;
private var _settingsController:Settings;
private var _downKeyTimer:Timer;
protected var _currentPiece:Array;
protected var _currentRotation:int;// = 0
protected var _board:Sprite;
protected var _currentCol:int;
protected static const DOWN_DELAY:Number = 30;
protected static const KEY_ACCEL:Number = 2;
protected static const CELL_WIDTH:Number = 8;
protected static const BOARD_COLOR:Number = 0x444444;
private static const FPTSettings:Class = FirstPersonTetris_FPTSettings;
protected static const KEY_MIN_DELAY:Number = 10;
protected static const KEY_INIT_ACCEL:Number = 70;
protected static const NEW_LEVEL_DELAY_DECREASE:Number = 35;
protected static const FAST_MUSIC_ROW_THRESH:Number = 6;
private static const QUALITY:String = "medium";
protected static const ROWS:uint = 20;
protected static const PIECE_COLOR:Number = 0xFFFFFF;
protected static const INIT_DROP_DELAY:Number = 400;
protected static const KEY_MAX_DELAY:Number = 100;
protected static const COLS:uint = 10;
public static var nightMode:Boolean = false;
public function FirstPersonTetris(){
_boardArray = new Array();
_pieceSprites = new Array();
_board = new Sprite();
_boardHolder = new Sprite();
_leftKeyTimer = new Timer(0);
_rightKeyTimer = new Timer(0);
_mouseHideTimer = new Timer(8000);
super();
FilterShortcuts.init();
ColorShortcuts.init();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = 40;
stage.quality = QUALITY;
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
_settings = new FPTSettings();
addChild(_settings);
_settingsController = new Settings(_settings);
stage.addEventListener(Event.RESIZE, centerSettings);
centerSettings();
_settingsController.addEventListener(Event.CLOSE, init);
_mouseHideTimer.addEventListener(TimerEvent.TIMER, onMouseHideTimer);
_mouseHideTimer.start();
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
var dsMenu:ContextMenu = new ContextMenu();
dsMenu.hideBuiltInItems();
var dsItem0:ContextMenuItem = new ContextMenuItem("by david kraftsow");
dsItem0.enabled = false;
var dsItem1:ContextMenuItem = new ContextMenuItem("dontsave.com");
dsItem1.enabled = true;
dsItem1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, function ():void{
navigateToURL(new URLRequest("http://dontsave.com"), "_top");
});
dsMenu.customItems.push(dsItem0, dsItem1);
this.contextMenu = dsMenu;
}
private function drawBoard(hideShowPiece:Boolean=true):void{
var row:Array;
var j:uint;
var block:MovieClip;
var s:Sprite;
if (_isPaused){
return;
};
if (hideShowPiece){
eraseCurrentPiece();
};
clearBoardSprites();
var i:uint;
while (i < _boardArray.length) {
row = _boardArray[i];
j = 0;
while (j < row.length) {
if (row[j] > 0){
block = Pieces.getBlockForPiece(row[j]);
block.gotoAndStop((_level + 1));
s = new Sprite();
block.x = (block.y = (-(CELL_WIDTH) / 2));
s.addChild(block);
s.width = CELL_WIDTH;
s.height = CELL_WIDTH;
s.x = ((j * CELL_WIDTH) + (CELL_WIDTH / 2));
s.y = ((i * CELL_WIDTH) + (CELL_WIDTH / 2));
_board.addChild(s);
_pieceSprites[i][j] = s;
};
j++;
};
i++;
};
if (hideShowPiece){
drawPieceAt(_currentRow, _currentCol, _currentPiece);
};
moveBoardInRelationToPiece();
}
private function drawShowPiece():void{
drawPieceAt(_currentRow, _currentCol, _currentPiece);
drawBoard(false);
_showPiece.rotation = _currentRotation;
var cellSprites:Array = getSpritesForCurrentPiece();
while (_showPiece.numChildren > 0) {
_showPiece.removeChildAt(0);
};
var i:uint;
while (i < cellSprites.length) {
cellSprites[i].x = (cellSprites[i].x - ((_currentCol * CELL_WIDTH) + getCurrentPieceOffset().x));
cellSprites[i].y = (cellSprites[i].y - ((_currentRow * CELL_WIDTH) + getCurrentPieceOffset().y));
_showPiece.addChild(cellSprites[i]);
i++;
};
}
private function pauseGame():void{
disableKeyBoard();
_dropTimer.stop();
_isPaused = true;
}
private function doMovePieceDown(e=null):void{
if (_isPaused){
return;
};
if (detectCurrentCollision((_currentRow + 1), _currentCol)){
onHitFloor();
if (_downKeyTimer){
_downKeyTimer.stop();
_downKeyTimer.delay = KEY_MAX_DELAY;
_downKeyTimer = null;
};
} else {
eraseCurrentPiece();
drawPieceAt(++_currentRow, _currentCol, _currentPiece);
_dropTimer.reset();
_dropTimer.start();
};
drawBoard();
}
private function init(e=null):void{
removeChild(_settings);
stage.removeEventListener(MouseEvent.CLICK, init);
stage.addEventListener(Event.RESIZE, onStageResize);
_nesBoard = new NESBoard();
_nesBoard.x = -(_nesBoard.getBoardOffset().x);
_nesBoard.y = -(_nesBoard.getBoardOffset().y);
_board.addChild(_nesBoard);
_boardHolder.addChild(_board);
addChild(_boardHolder);
_nesBoard.fx.x = (_nesBoard.fx.x + _nesBoard.x);
_nesBoard.fx.y = (_nesBoard.fx.y + _nesBoard.y);
initBoard();
nextPiece();
enableKeyBoard();
_dropTimer = new Timer(_dropDelay, 0);
_dropTimer.start();
_dropTimer.addEventListener(TimerEvent.TIMER, onDropTimer);
_fx = _nesBoard.fx;
_fxX = _fx.x;
_fxY = _fx.y;
addChild(_fx);
_fx["gate"].gotoAndStop(1);
if (_showPiece){
_showPiece.mask = _fx["showPieceMask"];
};
centerHolder();
_boardChild = (_board.getChildAt(0) as Sprite);
onStageResize(null);
_settingsController.removeEventListener(Event.CLOSE, init);
_settingsController.addEventListener(Event.CLOSE, resumeFromSettings);
toggleNightMode();
}
private function onDropPiece():void{
resumeGame();
drawBoard();
onHitFloor();
}
private function onResetBoard():void{
resumeGame();
_showPiece.visible = true;
_showPiece.alpha = 0;
Tweener.addTween(_showPiece, {alpha:1, time:0.5});
if (_leftKeyTimer){
_leftKeyTimer.stop();
_leftKeyTimer = null;
};
if (_rightKeyTimer){
_rightKeyTimer.stop();
_rightKeyTimer = null;
};
if (_downKeyTimer){
_downKeyTimer.delay = KEY_MAX_DELAY;
_downKeyTimer.stop();
_downKeyTimer.reset();
_downKeyTimer = null;
};
}
private function doMoveLeft(e:Event=null):void{
var accel:Number;
var min:Number;
if (_isPaused){
return;
};
if (detectCurrentCollision(_currentRow, (_currentCol - 1))){
return;
};
eraseCurrentPiece();
drawPieceAt(_currentRow, --_currentCol, _currentPiece);
drawBoard();
if (_leftKeyTimer){
accel = ((_leftKeyTimer.delay)==KEY_MAX_DELAY) ? KEY_INIT_ACCEL : KEY_ACCEL;
min = KEY_MIN_DELAY;
if ((_leftKeyTimer.delay - accel) >= min){
_leftKeyTimer.delay = (_leftKeyTimer.delay - accel);
} else {
_leftKeyTimer.delay = min;
};
};
}
private function getSpritesForCurrentPiece():Array{
var r:Array;
var j:uint;
var sprites:Array = new Array();
var i:uint;
while (i < _currentPiece.length) {
r = _currentPiece[i];
j = 0;
while (j < r.length) {
if (r[j] > 0){
sprites.push(_pieceSprites[(_currentRow + i)][(_currentCol + j)]);
};
j++;
};
i++;
};
return (sprites);
}
private function onHitFloor():void{
var hRow:uint = getHighestRowNum();
if (hRow <= FAST_MUSIC_ROW_THRESH){
GameSounds.playFast();
} else {
GameSounds.playSlow();
};
if (((_showPiece) && (contains(_showPiece)))){
removeChild(_showPiece);
};
drawPieceAt(_currentRow, _currentCol, _currentPiece);
drawBoard(false);
pauseGame();
removeFullRows();
GameSounds.playSound(GameSounds.Floor);
}
private function erasePieceAt(row:int, col:int, piece:Array):void{
var pRow:Array;
var j:uint;
var i:uint;
while (i < piece.length) {
pRow = piece[i];
j = 0;
while (j < pRow.length) {
if (pRow[j] > 0){
_boardArray[(row + i)][(col + j)] = 0;
};
j++;
};
i++;
};
}
private function getMaxRowForPieceAtCol(piece:Array, col:int):int{
var i:uint;
while (i <= ROWS) {
if (detectCollision(piece, i, col)){
return ((i - 1));
};
i++;
};
return (-1);
}
private function dropPiece():void{
var max:int = getMaxRowForCurrentPieceAtCol(_currentCol);
if ((max - _currentRow) < 2){
return;
};
pauseGame();
var time:Number = ((max - _currentRow) * 0.007);
_score = (_score + (max - _currentRow));
_nesBoard.score = _score;
alignFX();
Tweener.addTween(_board, {time:time, y:(_board.y - ((max - _currentRow) * CELL_WIDTH)), onUpdate:alignFX, onComplete:onDropPiece, transition:"easeInSine"});
eraseCurrentPiece();
_currentRow = max;
drawPieceAt(_currentRow, _currentCol, _currentPiece);
}
private function movePieceLeft():void{
if (_leftKeyTimer){
_leftKeyTimer.stop();
_leftKeyTimer = null;
};
doMoveLeft();
_leftKeyTimer = new Timer(KEY_MAX_DELAY);
_leftKeyTimer.start();
_leftKeyTimer.addEventListener(TimerEvent.TIMER, doMoveLeft);
}
private function onGateMoving(event:Event):void{
if ((_fx["gate"].totalFrames - 1) == _fx["gate"].currentFrame){
_fx["gate"].stop();
_fx["gate"].removeEventListener(Event.ENTER_FRAME, onGateMoving);
pauseGame();
pauseAndShowSettings();
resetGame();
_settings.gotoAndStop(3);
pauseGame();
};
}
private function dropRemainingRows(... _args):void{
var isCompleteSet:Boolean;
var numEmpty:uint;
var i:int;
var isEmpty:Boolean;
var j:uint;
var s:Sprite;
var tParams:Object;
if (_args.length > 0){
numEmpty = 0;
i = _args[(_args.length - 1)];
while (i >= 0) {
isEmpty = false;
j = 0;
while (j < _args.length) {
if (_args[j] == i){
isEmpty = true;
break;
};
j++;
};
if (isEmpty){
numEmpty++;
} else {
j = 0;
while (j < COLS) {
if (_pieceSprites[i][j]){
s = _pieceSprites[i][j];
tParams = {y:((numEmpty * CELL_WIDTH) + s.y), time:(0.1 * numEmpty), transition:"easeInQuad"};
if ((((numEmpty == _args.length)) && (!(isCompleteSet)))){
tParams.onComplete = onRemoveFullRows;
isCompleteSet = true;
};
Tweener.addTween(s, tParams);
};
j++;
};
};
i--;
};
if (!isCompleteSet){
onRemoveFullRows();
};
};
}
private function getHighestRowNum():uint{
var pieceFound:Boolean;
var row:Array;
var j:uint;
var i:uint;
while (i < _boardArray.length) {
row = _boardArray[i];
j = 0;
while (j < row.length) {
if (row[j] != 0){
pieceFound = true;
break;
};
j++;
};
if (pieceFound){
break;
};
i++;
};
return (i);
}
private function centerHolder():void{
_boardHolder.x = (stage.stageWidth / 2);
_boardHolder.y = (stage.stageHeight / 2);
if (((_showPiece) && (contains(_showPiece)))){
_showPiece.x = (stage.stageWidth / 2);
_showPiece.y = (stage.stageHeight / 2);
};
alignFX();
}
private function scaleScene():void{
var w:Number = Math.max(stage.stageWidth, stage.stageHeight);
w = Math.sqrt((2 * (w * w)));
w = (w + ((CELL_WIDTH * ROWS) / 2));
_sceneScale = ((w / _nesBoard.getBgWidth()) * 1);
_boardHolder.scaleX = (_boardHolder.scaleY = _sceneScale);
_boardHolder.width = Math.round(_boardHolder.width);
_boardHolder.height = Math.round(_boardHolder.height);
if (_showPiece){
_showPiece.scaleX = (_showPiece.scaleY = _sceneScale);
};
if (_fx){
_fx.scaleX = (_fx.scaleY = _boardHolder.scaleX);
};
alignFX();
}
private function enableKeyBoard():void{
stage.focus = stage;
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
}
private function onRemoveFullRows():void{
var y0:Number = _board.y;
var x0:Number = _board.x;
resumeGame();
nextPiece();
if (_dead){
return;
};
var y1:Number = _board.y;
var x1:Number = _board.x;
pauseGame();
_board.x = x0;
_board.y = y0;
_showPiece.visible = false;
alignFX();
Tweener.addTween(_board, {x:x1, y:y1, time:0.25, transition:"easeInQuad", onComplete:onResetBoard, onUpdate:alignFX});
}
private function endGame():void{
pauseGame();
if (nightMode){
nightMode = false;
toggleNightMode();
nightMode = true;
};
_nesBoard.storeTopScore();
GameSounds.playSound(GameSounds.Die);
GameSounds.selectMusic(0);
_fx["gate"].play();
_fx["gate"].addEventListener(Event.ENTER_FRAME, onGateMoving);
_fx["gate"]["colors"].gotoAndStop((_level + 1));
Tweener.addTween(_boardHolder, {time:1.5, rotation:0, onUpdate:alignFX});
}
private function onDropTimer(event:TimerEvent):void{
doMovePieceDown();
drawBoard();
}
private function getMaxRowForCurrentPieceAtCol(col:int):int{
eraseCurrentPiece();
var i:int = getMaxRowForPieceAtCol(_currentPiece, col);
drawPieceAt(_currentRow, _currentCol, _currentPiece);
return (i);
}
private function detectCurrentCollision(row:Number, col:Number):Boolean{
eraseCurrentPiece();
var b:Boolean = detectCollision(_currentPiece, row, col);
drawPieceAt(_currentRow, _currentCol, _currentPiece);
return (b);
}
private function movePieceRight():void{
if (_rightKeyTimer){
_rightKeyTimer.stop();
_rightKeyTimer = null;
};
doMoveRight();
_rightKeyTimer = new Timer(KEY_MAX_DELAY);
_rightKeyTimer.start();
_rightKeyTimer.addEventListener(TimerEvent.TIMER, doMoveRight);
}
private function flipPiece():void{
var t:Number;
var nextPiece:Array = Pieces.flipPiece(_currentPiece);
eraseCurrentPiece();
if (detectCollision(nextPiece, _currentRow, _currentCol)){
drawPieceAt(_currentRow, _currentCol, _currentPiece);
return;
};
_currentPiece = nextPiece;
drawPieceAt(_currentRow, _currentCol, _currentPiece);
if (_currentRotation == 90){
_currentRotation = 0;
} else {
_currentRotation = (_currentRotation - 90);
};
if (_currentRotation < -180){
_currentRotation = 90;
};
if (_currentRotation == 90){
_boardHolder.rotation = -180.5;
};
t = ((_level)>=8) ? 0.1 : 0.2;
Tweener.addTween(_boardHolder, {time:t, rotation:_currentRotation, onUpdate:alignFX, onComplete:onFlipRotateComplete, transition:"Linear"});
moveBoardInRelationToPiece();
drawShowPiece();
GameSounds.playSound(GameSounds.FlipSound);
if (_leftKeyTimer){
_leftKeyTimer.stop();
_leftKeyTimer = null;
};
if (_rightKeyTimer){
_rightKeyTimer.stop();
_rightKeyTimer = null;
};
if (_downKeyTimer){
_downKeyTimer.stop();
_downKeyTimer = null;
};
}
private function clearBoardSprites():void{
while (_board.numChildren > 1) {
_board.removeChildAt((_board.numChildren - 1));
};
var i:uint;
while (i < ROWS) {
_pieceSprites[i] = new Array();
i++;
};
}
private function doMoveRight(e:Event=null):void{
var accel:Number;
var min:Number;
if (_isPaused){
return;
};
if (detectCurrentCollision(_currentRow, (_currentCol + 1))){
return;
};
eraseCurrentPiece();
drawPieceAt(_currentRow, ++_currentCol, _currentPiece);
drawBoard();
if (_rightKeyTimer){
accel = ((_rightKeyTimer.delay)==KEY_MAX_DELAY) ? KEY_INIT_ACCEL : KEY_ACCEL;
min = KEY_MIN_DELAY;
if ((_rightKeyTimer.delay - accel) >= min){
_rightKeyTimer.delay = (_rightKeyTimer.delay - accel);
} else {
_rightKeyTimer.delay = min;
};
};
}
private function alignFX():void{
if (_fx){
_fx.x = _board.localToGlobal(new Point(_fxX, _fxY)).x;
_fx.y = _board.localToGlobal(new Point(_fxX, _fxY)).y;
_fx.rotation = _boardHolder.rotation;
};
}
private function centerSettings(e:Event=null):void{
_settings.x = Math.round(((stage.stageWidth / 2) - (_settings["bg"].width / 2)));
_settings.y = Math.round(((stage.stageHeight / 2) - (_settings["bg"].height / 2)));
}
private function moveBoardInRelationToPiece():void{
var pieceX:Number = (_currentCol * CELL_WIDTH);
var pieceY:Number = (_currentRow * CELL_WIDTH);
_board.x = (-(pieceX) - getCurrentPieceOffset().x);
_board.y = (-(pieceY) - getCurrentPieceOffset().y);
alignFX();
}
private function traceBoard():void{
var row:Array;
var s:String;
var j:uint;
var i:uint;
while (i < _boardArray.length) {
row = _boardArray[i];
s = "";
j = 0;
while (j < row.length) {
if (row[j] > 0){
s = (s + "1,");
} else {
s = (s + "0,");
};
j++;
};
trace(s);
i++;
};
}
private function onAddedToStage(event:Event):void{
}
private function removeFullRows():void{
var row:Array;
var isFull:Boolean;
var j:uint;
var s:Sprite;
var delay:Number;
var tProps:Object;
var fullRows:Array = new Array();
var i:uint;
while (i < _boardArray.length) {
row = _boardArray[i];
isFull = true;
j = 0;
while (j < row.length) {
if (row[j] == 0){
isFull = false;
break;
};
j++;
};
if (isFull){
fullRows.push(i);
};
i++;
};
if (fullRows.length > 0){
updateLineCount(fullRows.length);
if (fullRows.length == 4){
GameSounds.playSound(GameSounds.Tetris);
_nesBoard.playTetrisFlash();
} else {
GameSounds.playSound(GameSounds.Row);
};
i = 0;
while (i < fullRows.length) {
j = fullRows[i];
while (j > 0) {
_boardArray[j] = _boardArray[(j - 1)];
j--;
};
_boardArray[0] = new Array();
j = 0;
while (j < COLS) {
_boardArray[0][j] = 0;
j++;
};
row = _boardArray[fullRows[i]];
j = 0;
while (j < row.length) {
s = _pieceSprites[fullRows[i]][j];
delay = 0;
if (j < 5){
delay = (((9 - j) - 5) * 0.04);
} else {
delay = ((j - 5) * 0.04);
};
tProps = {time:0.1, delay:delay, scaleX:0, scaleY:0, transition:"Linear"};
if ((((i == (fullRows.length - 1))) && ((j == (row.length - 1))))){
tProps.onComplete = dropRemainingRows;
tProps.onCompleteParams = fullRows;
};
Tweener.addTween(s, tProps);
j++;
};
i++;
};
} else {
onRemoveFullRows();
};
}
private function initBoard():void{
var row:Array;
var j:uint;
var i:uint;
while (i < ROWS) {
row = new Array();
_boardArray.push(row);
j = 0;
while (j < COLS) {
row.push(0);
j++;
};
i++;
};
}
private function updateLineCount(count:uint):void{
switch (count){
case 1:
_score = (_score + ((_level * 40) + 40));
break;
case 2:
_score = (_score + ((_level * 100) + 100));
break;
case 3:
_score = (_score + ((_level * 300) + 300));
break;
case 4:
_score = (_score + ((_level * 1200) + 1200));
break;
};
if (Math.floor(((_lines + count) / 10)) > _level){
_level++;
GameSounds.playSoundAfterDelay(GameSounds.NextLevel, 0.4);
_dropTimer.delay = (_dropTimer.delay - NEW_LEVEL_DELAY_DECREASE);
};
_lines = (_lines + count);
_nesBoard.lines = _lines;
var storeTopScore = (_nesBoard.topScore < _score);
_nesBoard.score = _score;
_nesBoard.level = _level;
if (storeTopScore){
_nesBoard.storeTopScore();
};
}
private function resumeFromSettings(event:Event):void{
removeChild(_settings);
addChildAt(_boardHolder, 0);
if (!FirstPersonTetris.nightMode){
_fx.visible = true;
};
resumeGame();
GameSounds.playSound(GameSounds.Pause);
toggleNightMode();
_settings.gotoAndStop(3);
}
private function onKeyUp(event:KeyboardEvent):void{
switch (event.keyCode){
case Keyboard.LEFT:
switch (_boardHolder.rotation){
case 0:
if (_leftKeyTimer){
_leftKeyTimer.stop();
};
_leftKeyTimer = null;
break;
case -90:
break;
case -180:
if (_rightKeyTimer){
_rightKeyTimer.stop();
};
_rightKeyTimer = null;
break;
case 90:
if (_downKeyTimer){
_downKeyTimer.stop();
};
_downKeyTimer = null;
break;
};
break;
case Keyboard.RIGHT:
switch (_boardHolder.rotation){
case 0:
if (_rightKeyTimer){
_rightKeyTimer.stop();
};
_rightKeyTimer = null;
break;
case -90:
if (_downKeyTimer){
_downKeyTimer.stop();
};
_downKeyTimer = null;
break;
case -180:
if (_leftKeyTimer){
_leftKeyTimer.stop();
};
_leftKeyTimer = null;
break;
case 90:
break;
};
break;
case Keyboard.DOWN:
switch (_boardHolder.rotation){
case 0:
if (_downKeyTimer){
_downKeyTimer.stop();
};
_downKeyTimer = null;
break;
case -90:
if (_leftKeyTimer){
_leftKeyTimer.stop();
};
_leftKeyTimer = null;
break;
case -180:
break;
case 90:
if (_rightKeyTimer){
_rightKeyTimer.stop();
};
_rightKeyTimer = null;
break;
};
break;
case Keyboard.UP:
switch (_boardHolder.rotation){
case 0:
break;
case -90:
if (_rightKeyTimer){
_rightKeyTimer.stop();
};
_rightKeyTimer = null;
break;
case -180:
if (_downKeyTimer){
_downKeyTimer.stop();
};
_downKeyTimer = null;
break;
case 90:
if (_leftKeyTimer){
_leftKeyTimer.stop();
};
_leftKeyTimer = null;
break;
};
break;
default:
return;
};
}
private function resumeGame():void{
enableKeyBoard();
_dropTimer.start();
_isPaused = false;
}
private function onFlipRotateComplete():void{
}
private function onKeyDown(event:KeyboardEvent):void{
switch (event.keyCode){
case Keyboard.LEFT:
switch (_boardHolder.rotation){
case 0:
movePieceLeft();
break;
case -90:
break;
case -180:
movePieceRight();
break;
case 90:
movePieceDown();
break;
};
break;
case Keyboard.RIGHT:
switch (_boardHolder.rotation){
case 0:
movePieceRight();
break;
case -90:
movePieceDown();
break;
case -180:
movePieceLeft();
break;
case 90:
break;
};
break;
case Keyboard.DOWN:
switch (_boardHolder.rotation){
case 0:
movePieceDown();
break;
case -90:
movePieceLeft();
break;
case -180:
break;
case 90:
movePieceRight();
break;
};
break;
case Keyboard.UP:
switch (_boardHolder.rotation){
case 0:
break;
case -90:
movePieceRight();
break;
case -180:
movePieceDown();
break;
case 90:
movePieceLeft();
break;
};
break;
case Keyboard.ENTER:
dropPiece();
break;
case Keyboard.SPACE:
flipPiece();
break;
case Keyboard.ESCAPE:
pauseAndShowSettings();
break;
default:
return;
};
drawBoard();
}
private function onMouseHideTimer(event:TimerEvent):void{
Mouse.hide();
}
private function nextPiece():void{
_nesBoard.incrementStatByLetter(Pieces.nextPieceLetter);
_currentPiece = Pieces.getNextPiece();
_currentRow = 0;
_currentCol = (Math.floor((COLS / 2)) - 1);
if (detectCollision(_currentPiece, _currentRow, _currentCol)){
_dead = true;
};
if (((_showPiece) && (contains(_showPiece)))){
removeChild(_showPiece);
};
_showPiece = new Sprite();
drawShowPiece();
if (((_fx) && (!(nightMode)))){
_showPiece.mask = _fx["showPieceMask"];
};
if (_fx){
addChildAt(_showPiece, getChildIndex(_fx));
} else {
addChild(_showPiece);
};
centerHolder();
if (_sceneScale){
_showPiece.scaleX = (_showPiece.scaleY = _sceneScale);
};
_nesBoard.updateNextPiece(_level);
if (_dead){
removeChild(_showPiece);
drawPieceAt(_currentRow, _currentCol, _currentPiece);
drawBoard();
endGame();
};
}
private function disableKeyBoard():void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
}
private function eraseCurrentPiece():void{
erasePieceAt(_currentRow, _currentCol, _currentPiece);
}
private function detectCollision(piece:Array, row:Number, col:Number):Boolean{
var r:Array;
var j:uint;
var i:uint;
while (i < piece.length) {
r = piece[i];
j = 0;
while (j < r.length) {
if ((((r[j] > 0)) && (((((((((((row + i) < 0)) || (((row + i) >= ROWS)))) || (((col + j) < 0)))) || (((col + j) >= COLS)))) || ((_boardArray[(row + i)][(col + j)] > 0)))))){
return (true);
};
j++;
};
i++;
};
return (false);
}
private function drawPieceAt(row:int, col:int, piece:Array):void{
var pRow:Array;
var id:uint;
var j:uint;
var i:uint;
while (i < piece.length) {
pRow = piece[i];
id = Pieces.getBlockIdForPiece(piece);
j = 0;
while (j < pRow.length) {
if (pRow[j] > 0){
if (pRow[j] == 1){
_boardArray[(row + i)][(col + j)] = id;
} else {
_boardArray[(row + i)][(col + j)] = pRow[j];
};
};
j++;
};
i++;
};
}
private function getCurrentPieceOffset():Object{
var maxRow:Number;
var maxCol:Number;
var pRow:Array;
var j:uint;
var offsetX:Number = 0;
var offsetY:Number = 0;
var minRow:Number = 9999;
var minCol:Number = 9999;
var i:uint;
while (i < _currentPiece.length) {
pRow = _currentPiece[i];
j = 0;
while (j < pRow.length) {
if (pRow[j] > 0){
if (i < minRow){
minRow = i;
};
if (((!(maxRow)) || ((maxRow < (i + 1))))){
maxRow = (i + 1);
};
if (j < minCol){
minCol = j;
};
if (((!(maxCol)) || ((maxCol < (j + 1))))){
maxCol = (j + 1);
};
};
j++;
};
i++;
};
offsetX = ((minCol * CELL_WIDTH) + (((maxCol - minCol) * CELL_WIDTH) / 2));
offsetY = ((minRow * CELL_WIDTH) + (((maxRow - minRow) * CELL_WIDTH) / 2));
return ({x:offsetX, y:offsetY});
}
private function movePieceDown():void{
if (!_downKeyTimer){
doMovePieceDown();
_downKeyTimer = new Timer(DOWN_DELAY);
_downKeyTimer.start();
_downKeyTimer.addEventListener(TimerEvent.TIMER, doMovePieceDown);
};
}
private function pauseAndShowSettings():void{
pauseGame();
removeChild(_boardHolder);
_fx.visible = false;
addChild(_settings);
GameSounds.playSound(GameSounds.Pause);
_settings.gotoAndStop(2);
_settingsController.showScore(_nesBoard.levelStr, _nesBoard.linesStr, _nesBoard.scoreStr, _nesBoard.topScoreStr);
}
private function onLeaveFS(event:FullScreenEvent):void{
pauseAndShowSettings();
stage.removeEventListener(FullScreenEvent.FULL_SCREEN, onLeaveFS);
}
private function resetGame():void{
_fx["gate"].gotoAndStop(1);
_boardArray = new Array();
initBoard();
_dead = false;
_dropTimer.delay = INIT_DROP_DELAY;
_score = (_lines = (_level = 0));
_nesBoard.reset();
clearBoardSprites();
resumeGame();
nextPiece();
_currentRotation = 0;
_showPiece.rotation = 0;
_boardHolder.rotation = 0;
}
private function toggleNightMode():void{
if (nightMode){
_fx.visible = false;
_boardChild.visible = false;
} else {
_boardChild.visible = true;
_fx.visible = true;
};
}
private function onStageResize(event:Event):void{
scaleScene();
centerHolder();
}
private function onMouseMove(event:MouseEvent):void{
Mouse.show();
_mouseHideTimer.reset();
_mouseHideTimer.start();
}
}
}//package com.firstpersontetris
Section 14 (771 B)
//FirstPersonTetris_FPTSettings (com.firstpersontetris.FirstPersonTetris_FPTSettings)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class FirstPersonTetris_FPTSettings extends MovieClipAsset {
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var fx:DisplayObject;
public var nightToggle:DisplayObject;
public var musicToggle:DisplayObject;
public var nightMode:DisplayObject;
public var contact:DisplayObject;
public var start:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var music3:DisplayObject;
public var info:DisplayObject;
}
}//package com.firstpersontetris
Section 15 (2.48 KiB) ●
//GameSounds (com.firstpersontetris.GameSounds)
package com.firstpersontetris {
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.net.*;
public class GameSounds {
public static var FlipSound:Class = GameSounds_FlipSound;
private static var _musicSlow:Sound;
public static var Tetris:Class = GameSounds_Tetris;
public static var NextLevel:Class = GameSounds_NextLevel;
private static var _playingSlow:Boolean;
private static var _slowChan:SoundChannel;
public static var Pause:Class = GameSounds_Pause;
public static var useFX:Boolean = true;
public static var Die:Class = GameSounds_Die;
private static var _type:uint = 0;
private static var _musicFast:Sound;
private static var _playingFast:Boolean;
public static var Floor:Class = GameSounds_Floor;
private static var _fastChan:SoundChannel;
public static var Move:Class = GameSounds_Move;
public static var Row:Class = GameSounds_Row;
public function GameSounds(){
super();
}
public static function playSlow():void{
if ((((_type == 0)) || (_playingSlow))){
return;
};
if (_fastChan){
_fastChan.stop();
};
_slowChan = _musicSlow.play(0, int.MAX_VALUE);
_playingSlow = true;
_playingFast = false;
}
public static function playSoundAfterDelay(SoundClass:Class, delay:Number):void{
var SoundClass = SoundClass;
var delay = delay;
var t:Timer = new Timer((delay * 1000), 1);
t.addEventListener(TimerEvent.TIMER, function ():void{
playSound(SoundClass);
});
t.start();
}
public static function get type():uint{
return (_type);
}
public static function selectMusic(type:uint):void{
_type = type;
if (_slowChan){
_slowChan.stop();
};
if (_fastChan){
_fastChan.stop();
};
if (type != 0){
_musicSlow = new Sound();
_musicFast = new Sound();
_musicSlow.load(new URLRequest((("/audio/track_" + type) + "_slow.mp3")));
_musicFast.load(new URLRequest((("/audio/track_" + type) + "_fast.mp3")));
_playingSlow = false;
_playingFast = false;
playSlow();
};
}
public static function playFast():void{
if ((((_type == 0)) || (_playingFast))){
return;
};
if (_slowChan){
_slowChan.stop();
};
_fastChan = _musicFast.play(0, int.MAX_VALUE);
_playingSlow = false;
_playingFast = true;
}
public static function playSound(SoundClass:Class):void{
if (!useFX){
return;
};
var s:Sound = new (SoundClass);
s.play();
}
}
}//package com.firstpersontetris
Section 16 (1.41 KiB) ●
//GameSounds_Die (com.firstpersontetris.GameSounds_Die)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class GameSounds_Die extends SoundAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 17 (1.42 KiB) ●
//GameSounds_FlipSound (com.firstpersontetris.GameSounds_FlipSound)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class GameSounds_FlipSound extends SoundAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 18 (1.41 KiB) ●
//GameSounds_Floor (com.firstpersontetris.GameSounds_Floor)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class GameSounds_Floor extends SoundAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 19 (1.41 KiB) ●
//GameSounds_Move (com.firstpersontetris.GameSounds_Move)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class GameSounds_Move extends SoundAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 20 (1.42 KiB) ●
//GameSounds_NextLevel (com.firstpersontetris.GameSounds_NextLevel)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class GameSounds_NextLevel extends SoundAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 21 (1.41 KiB) ●
//GameSounds_Pause (com.firstpersontetris.GameSounds_Pause)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class GameSounds_Pause extends SoundAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 22 (1.41 KiB) ●
//GameSounds_Row (com.firstpersontetris.GameSounds_Row)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class GameSounds_Row extends SoundAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 23 (1.42 KiB) ●
//GameSounds_Tetris (com.firstpersontetris.GameSounds_Tetris)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class GameSounds_Tetris extends SoundAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 24 (4.65 KiB) ●
//NESBoard (com.firstpersontetris.NESBoard)
package com.firstpersontetris {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
public class NESBoard extends Sprite {
private var _boardMarker:Sprite;
private var _level:Counter;
private var _lines:Counter;
private var _levelNum:uint;
private var _boardSprite:Sprite;
private var _score:Counter;
private var _tetrisFlash:MovieClip;
private var _next:MovieClip;
private var _topScore:Counter;
private var _stats:Array;
private var _statBlocks:Sprite;
private var _topScoreSOTimer:Timer;
private static var BoardSprite:Class = NESBoard_BoardSprite;
public function NESBoard(){
super();
_boardSprite = new BoardSprite();
addChild(_boardSprite);
_boardMarker = _boardSprite["clip"]["board_marker"];
_boardMarker.visible = false;
_tetrisFlash = _boardSprite["clip"]["tetrisFlash"];
_tetrisFlash.gotoAndStop(1);
_level = new Counter(_boardSprite["clip"]["level"], 0);
_lines = new Counter(_boardSprite["clip"]["lines"], 0);
_score = new Counter(_boardSprite["clip"]["score"], 0);
_statBlocks = _boardSprite["clip"]["stats"];
var i:uint;
while (i < _statBlocks.numChildren) {
MovieClip(_statBlocks.getChildAt(i)).gotoAndStop(1);
i++;
};
_next = _boardSprite["clip"]["next"];
_next.stop();
var top:uint;
var so:SharedObject = SharedObject.getLocal("firstpersontetris_full");
if (so.data.top > 0){
top = so.data.top;
};
_topScore = new Counter(_boardSprite["clip"]["top_score"], top);
initStats();
}
public function playTetrisFlash():void{
_tetrisFlash.gotoAndPlay(1);
_tetrisFlash.addEventListener(Event.ENTER_FRAME, onTetrisFlashEnterFrame);
}
public function get linesStr():String{
return (_lines.getString());
}
public function getBgWidth():Number{
return (_boardSprite["bg"].width);
}
public function set lines(lines:uint):void{
_lines.setNum(lines);
}
public function get fx():Sprite{
return (_boardSprite["fx"]);
}
private function onTetrisFlashEnterFrame(event:Event):void{
if (_tetrisFlash.currentFrame == _tetrisFlash.totalFrames){
_tetrisFlash.gotoAndStop(1);
_tetrisFlash.removeEventListener(Event.ENTER_FRAME, onTetrisFlashEnterFrame);
};
}
public function reset():void{
level = 0;
score = 0;
lines = 0;
_stats["T"].setNum(0);
_stats["O"].setNum(0);
_stats["S"].setNum(0);
_stats["Z"].setNum(0);
_stats["I"].setNum(0);
_stats["L"].setNum(0);
_stats["J"].setNum(0);
}
public function set level(level:uint):void{
_level.setNum(level);
}
private function onUpdateNextPiece(event:Event):void{
var i:uint;
while (i < _next.numChildren) {
if ((_next.getChildAt(i) is MovieClip)){
MovieClip(_next.getChildAt(i)).gotoAndStop((_levelNum + 1));
};
i++;
};
if (_next.getChildAt(1) != null){
removeEventListener(Event.ENTER_FRAME, onUpdateNextPiece);
};
}
public function getBoardOffset():Point{
return (new Point(_boardMarker.x, _boardMarker.y));
}
public function get levelStr():String{
return (_level.getString());
}
public function incrementStatByLetter(letter:String):void{
Counter(_stats[letter]).setNum((Counter(_stats[letter]).value + 1));
}
public function set score(score:uint):void{
if (score > _topScore.value){
_topScore.setNum(score);
};
_score.setNum(score);
}
private function initStats():void{
_stats = new Array();
_stats["T"] = new Counter(_boardSprite["clip"]["stats_T"], 0);
_stats["O"] = new Counter(_boardSprite["clip"]["stats_O"], 0);
_stats["S"] = new Counter(_boardSprite["clip"]["stats_S"], 0);
_stats["Z"] = new Counter(_boardSprite["clip"]["stats_Z"], 0);
_stats["I"] = new Counter(_boardSprite["clip"]["stats_I"], 0);
_stats["L"] = new Counter(_boardSprite["clip"]["stats_L"], 0);
_stats["J"] = new Counter(_boardSprite["clip"]["stats_J"], 0);
}
public function get topScoreStr():String{
return (_topScore.getString());
}
public function updateNextPiece(level:uint):void{
_levelNum = level;
addEventListener(Event.ENTER_FRAME, onUpdateNextPiece);
_next.gotoAndStop(Pieces.nextPieceLetter);
var i:uint;
while (i < _statBlocks.numChildren) {
MovieClip(_statBlocks.getChildAt(i)).gotoAndStop((_levelNum + 1));
i++;
};
}
public function get topScore():uint{
return (_topScore.value);
}
public function storeTopScore():void{
var so:SharedObject = SharedObject.getLocal("firstpersontetris_full");
so.data.top = _topScore.value;
}
public function get scoreStr():String{
return (_score.getString());
}
}
}//package com.firstpersontetris
Section 25 (1.42 KiB) ●
//NESBoard_BoardSprite (com.firstpersontetris.NESBoard_BoardSprite)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class NESBoard_BoardSprite extends SpriteAsset {
public var level:DisplayObject;
public var nightToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var score:DisplayObject;
public var stats:DisplayObject;
public var contact:DisplayObject;
public var top_score:DisplayObject;
public var stats_I:DisplayObject;
public var stats_J:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var stats_O:DisplayObject;
public var board_marker:DisplayObject;
public var stats_T:DisplayObject;
public var info:DisplayObject;
public var stats_L:DisplayObject;
public var music3:DisplayObject;
public var stats_Z:DisplayObject;
public var stats_S:DisplayObject;
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var gate:DisplayObject;
public var fx:DisplayObject;
public var clip:DisplayObject;
public var nightMode:DisplayObject;
public var fxMask:DisplayObject;
public var musicToggle:DisplayObject;
public var start:DisplayObject;
public var tetrisFlash:DisplayObject;
public var colors:DisplayObject;
public var next:DisplayObject;
public var showPieceMask:DisplayObject;
public var lines:DisplayObject;
}
}//package com.firstpersontetris
Section 26 (4.7 KiB) ●
//Pieces (com.firstpersontetris.Pieces)
package com.firstpersontetris {
import flash.display.*;
import com.dontsave.math.*;
public class Pieces {
public static const I0:Array = [[1, 1, 1, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
public static const I1:Array = [[0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0]];
public static const Z0:Array = [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
public static const Z1:Array = [[0, 1, 0, 0], [1, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0]];
public static const J1:Array = [[1, 0, 0, 0], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
public static const J2:Array = [[1, 1, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0]];
public static const J3:Array = [[1, 1, 1, 0], [0, 0, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
public static const J0:Array = [[0, 1, 0, 0], [0, 1, 0, 0], [1, 1, 0, 0], [0, 0, 0, 0]];
public static const S0:Array = [[0, 1, 1, 0], [1, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
public static const S1:Array = [[1, 0, 0, 0], [1, 1, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0]];
public static const O:Array = [[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
public static const T0:Array = [[1, 1, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
public static const T1:Array = [[0, 0, 1, 0], [0, 1, 1, 0], [0, 0, 1, 0], [0, 0, 0, 0]];
public static const T2:Array = [[0, 0, 0, 0], [0, 1, 0, 0], [1, 1, 1, 0], [0, 0, 0, 0]];
public static const T3:Array = [[1, 0, 0, 0], [1, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0]];
public static const PIECE_SCRIPT:Array = [T1, I1, O, O, L2, S1, I0, J0, L0, T0, Z0, Z0, J0, S0, T0, L0, I0, S0, Z0, L0, T0, Z0, S0, I0, I0, O, T0, Z0, T0, O];
public static const L0:Array = [[1, 0, 0, 0], [1, 0, 0, 0], [1, 1, 0, 0], [0, 0, 0, 0]];
public static const L1:Array = [[1, 1, 1, 0], [1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
public static const L2:Array = [[1, 1, 0, 0], [0, 1, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0]];
public static const L3:Array = [[0, 0, 1, 0], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
private static const Block0:Class = Pieces_Block0;
private static const Block1:Class = Pieces_Block1;
private static const Block2:Class = Pieces_Block2;
private static var _nextPiece:Array = getRandomPiece();
public function Pieces(){
super();
}
public static function flipPiece(currentPiece:Array):Array{
var nextPiece:Array = currentPiece;
switch (currentPiece){
case L0:
nextPiece = L1;
break;
case L1:
nextPiece = L2;
break;
case L2:
nextPiece = L3;
break;
case L3:
nextPiece = L0;
break;
case J0:
nextPiece = J1;
break;
case J1:
nextPiece = J2;
break;
case J2:
nextPiece = J3;
break;
case J3:
nextPiece = J0;
break;
case T0:
nextPiece = T1;
break;
case T1:
nextPiece = T2;
break;
case T2:
nextPiece = T3;
break;
case T3:
nextPiece = T0;
break;
case S0:
nextPiece = S1;
break;
case S1:
nextPiece = S0;
break;
case Z0:
nextPiece = Z1;
break;
case Z1:
nextPiece = Z0;
break;
case I0:
nextPiece = I1;
break;
case I1:
nextPiece = I0;
break;
default:
break;
};
return (nextPiece);
}
public static function getNextPiece():Array{
var thisPiece:Array = _nextPiece;
_nextPiece = getRandomPiece();
return (thisPiece);
}
public static function getBlockForPiece(blockId:uint):MovieClip{
switch (blockId){
case 3:
return (new Block2());
case 2:
return (new Block1());
case 1:
return (new Block0());
};
return (new Block0());
}
public static function getBlockIdForPiece(piece:Array):uint{
switch (piece){
case L0:
case L1:
case L2:
case L3:
case Z0:
case Z1:
return (3);
case J0:
case J1:
case J2:
case J3:
case S0:
case S1:
return (2);
case T0:
case T1:
case T2:
case T3:
case O:
case I0:
case I1:
return (1);
};
return (1);
}
public static function getRandomPiece():Array{
var a:Array = new Array(L3, J3, O, T0, I0, S0, Z0);
var rand:int = DSMath.randInt(0, (a.length - 1));
return (a[rand]);
}
public static function get nextPieceLetter():String{
switch (_nextPiece){
case L0:
case L1:
case L2:
case L3:
return ("L");
case Z0:
case Z1:
return ("Z");
case J0:
case J1:
case J2:
case J3:
return ("J");
case S0:
case S1:
return ("S");
case T0:
case T1:
case T2:
case T3:
return ("T");
case O:
return ("O");
case I0:
case I1:
return ("I");
};
return ("O");
}
}
}//package com.firstpersontetris
Section 27 (723 B)
//Pieces_Block0 (com.firstpersontetris.Pieces_Block0)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class Pieces_Block0 extends MovieClipAsset {
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var fx:DisplayObject;
public var nightToggle:DisplayObject;
public var musicToggle:DisplayObject;
public var nightMode:DisplayObject;
public var contact:DisplayObject;
public var start:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var music3:DisplayObject;
public var info:DisplayObject;
}
}//package com.firstpersontetris
Section 28 (723 B)
//Pieces_Block1 (com.firstpersontetris.Pieces_Block1)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class Pieces_Block1 extends MovieClipAsset {
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var fx:DisplayObject;
public var nightToggle:DisplayObject;
public var musicToggle:DisplayObject;
public var nightMode:DisplayObject;
public var contact:DisplayObject;
public var start:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var music3:DisplayObject;
public var info:DisplayObject;
}
}//package com.firstpersontetris
Section 29 (723 B)
//Pieces_Block2 (com.firstpersontetris.Pieces_Block2)
package com.firstpersontetris {
import flash.display.*;
import mx.core.*;
public class Pieces_Block2 extends MovieClipAsset {
public var bg:DisplayObject;
public var fxToggle:DisplayObject;
public var scoreField:DisplayObject;
public var musicOff:DisplayObject;
public var fx:DisplayObject;
public var nightToggle:DisplayObject;
public var musicToggle:DisplayObject;
public var nightMode:DisplayObject;
public var contact:DisplayObject;
public var start:DisplayObject;
public var music1:DisplayObject;
public var music2:DisplayObject;
public var music3:DisplayObject;
public var info:DisplayObject;
}
}//package com.firstpersontetris
Section 30 (2.84 KiB) ●
//Settings (com.firstpersontetris.Settings)
package com.firstpersontetris {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class Settings extends EventDispatcher {
private var _clip:MovieClip;
public function Settings(clip:MovieClip){
super();
_clip = clip;
_clip["music1"].addEventListener(MouseEvent.CLICK, onSelectMusic);
_clip["music2"].addEventListener(MouseEvent.CLICK, onSelectMusic);
_clip["music3"].addEventListener(MouseEvent.CLICK, onSelectMusic);
_clip["musicOff"].addEventListener(MouseEvent.CLICK, onSelectMusic);
_clip["fx"].addEventListener(MouseEvent.CLICK, toggleFX);
_clip["nightMode"].addEventListener(MouseEvent.CLICK, toggleNight);
_clip["start"].addEventListener(MouseEvent.CLICK, onStart);
_clip["info"].addEventListener(MouseEvent.CLICK, onInfo);
_clip["musicToggle"].gotoAndStop(1);
_clip["fxToggle"].gotoAndStop(1);
_clip["nightToggle"].gotoAndStop(2);
_clip.gotoAndStop(1);
GameSounds.selectMusic(1);
hideScore();
}
public function hideScore():void{
_clip["scoreField"].visible = false;
}
private function onSelectMusic(event:MouseEvent):void{
switch (event.target.name){
case "music1":
_clip["musicToggle"].gotoAndStop(1);
GameSounds.selectMusic(1);
break;
case "music2":
_clip["musicToggle"].gotoAndStop(2);
GameSounds.selectMusic(2);
break;
case "music3":
_clip["musicToggle"].gotoAndStop(3);
GameSounds.selectMusic(3);
break;
case "musicOff":
GameSounds.selectMusic(0);
_clip["musicToggle"].gotoAndStop(4);
break;
};
}
private function toggleNight(event:MouseEvent):void{
if (_clip["nightToggle"].currentFrame == 1){
_clip["nightToggle"].gotoAndStop(2);
FirstPersonTetris.nightMode = false;
} else {
_clip["nightToggle"].gotoAndStop(1);
FirstPersonTetris.nightMode = true;
};
}
public function showScore(level:String, rows:String, score:String, top:String):void{
_clip["scoreField"].visible = true;
_clip["scoreField"].text = ((((((("LEVEL: " + level) + "\nLINES: ") + rows) + "\nSCORE: ") + score) + "\nTOP SCORE: ") + top);
}
private function toggleFX(event:MouseEvent):void{
if (_clip["fxToggle"].currentFrame == 1){
_clip["fxToggle"].gotoAndStop(2);
GameSounds.useFX = false;
} else {
_clip["fxToggle"].gotoAndStop(1);
GameSounds.useFX = true;
};
}
private function onStart(event:MouseEvent):void{
_clip["info"].addEventListener(MouseEvent.CLICK, onInfo);
dispatchEvent(new Event(Event.CLOSE));
if ((((GameSounds.type == 0)) && (!((_clip["musicToggle"].currentFrame == 4))))){
GameSounds.selectMusic(_clip["musicToggle"].currentFrame);
};
}
private function onInfo(event:MouseEvent):void{
navigateToURL(new URLRequest("http://dontsave.com/"), "_top");
}
}
}//package com.firstpersontetris
Section 31 (641 B)
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.3.0.4852";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(left:Number=0, top:Number=0, right:Number=0, bottom:Number=0){
super();
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 32 (469 B)
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "3.3.0.4852";
public function FlexMovieClip(){
super();
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 33 (454 B)
//FlexSprite (mx.core.FlexSprite)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexSprite extends Sprite {
mx_internal static const VERSION:String = "3.3.0.4852";
public function FlexSprite(){
super();
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 34 (143 B)
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 35 (107 B)
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 36 (2.71 KiB) ●
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(void:Point):Point;
function get name():String;
function set width(flash.display:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(flash.display:String):void;
function set scaleX(flash.display:Number):void;
function set scaleY(flash.display:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(flash.display:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(void:Point):Point;
function get height():Number;
function set blendMode(flash.display:String):void;
function get parent():DisplayObjectContainer;
function getBounds(String:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(flash.display:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(flash.display:Number):void;
function set accessibilityProperties(flash.display:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(flash.display:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(flash.display:Number):void;
function set mask(flash.display:DisplayObject):void;
function getRect(String:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(flash.display:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean;
function set opaqueBackground(flash.display:Object):void;
function set visible(flash.display:Boolean):void;
function get mask():DisplayObject;
function set x(flash.display:Number):void;
function set y(flash.display:Number):void;
function get transform():Transform;
function set filters(flash.display:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(flash.display:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 37 (779 B)
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(C:\autobuild\3.3.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(C:\autobuild\3.3.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(C:\autobuild\3.3.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(C:\autobuild\3.3.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 38 (1.05 KiB) ●
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.3.0.4852";
public function MovieClipAsset(){
super();
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 39 (152 B)
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 40 (269 B)
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.3.0.4852";
public function SoundAsset(){
super();
}
}
}//package mx.core
Section 41 (1.03 KiB) ●
//SpriteAsset (mx.core.SpriteAsset)
package mx.core {
public class SpriteAsset extends FlexSprite implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.3.0.4852";
public function SpriteAsset(){
super();
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 42 (1.42 KiB) ●
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.3.0.4852";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = displayObject;
o = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
//unresolved jump
var _slot1 = e;
return (result);
}
public static function createUniqueName(object:Object):String{
if (!object){
return (null);
};
var name:String = getQualifiedClassName(object);
var index:int = name.indexOf("::");
if (index != -1){
name = name.substr((index + 2));
};
var charCode:int = name.charCodeAt((name.length - 1));
if ((((charCode >= 48)) && ((charCode <= 57)))){
name = (name + "_");
};
return ((name + counter++));
}
}
}//package mx.utils