msg-chumby-display 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. data/VERSION +1 -1
  2. data/bin/msg-chumby-daemon +6 -1
  3. data/etc/msgchumbydaemonrc +7 -4
  4. data/lib/msg-chumby-daemon/http-xml-server.rb +20 -1
  5. data/widget/currentpower/currentpower Report.txt +1 -1
  6. data/widget/currentpower/currentpower.swd +0 -0
  7. data/widget/currentpower/currentpower.swf +0 -0
  8. data/widget/last_reading/DataArray.as +116 -0
  9. data/widget/last_reading/Gluehlampe.fla +0 -0
  10. data/widget/last_reading/Gluehlampe.swf +0 -0
  11. data/widget/last_reading/Gluehlampe_frames.fla +0 -0
  12. data/widget/last_reading/Gluehlampe_frames.swf +0 -0
  13. data/widget/last_reading/Makefile +30 -0
  14. data/widget/last_reading/Makefile.orig +60 -0
  15. data/widget/last_reading/README.rdoc +50 -0
  16. data/widget/last_reading/README.rtf +57 -0
  17. data/widget/last_reading/XmlParse.as +1 -0
  18. data/widget/last_reading/caurina/transitions/AuxFunctions.as +88 -0
  19. data/widget/last_reading/caurina/transitions/Equations.as +713 -0
  20. data/widget/last_reading/caurina/transitions/PropertyInfoObj.as +86 -0
  21. data/widget/last_reading/caurina/transitions/SpecialProperty.as +48 -0
  22. data/widget/last_reading/caurina/transitions/SpecialPropertyModifier.as +39 -0
  23. data/widget/last_reading/caurina/transitions/SpecialPropertySplitter.as +46 -0
  24. data/widget/last_reading/caurina/transitions/TweenListObj.as +227 -0
  25. data/widget/last_reading/caurina/transitions/Tweener.as +1121 -0
  26. data/widget/last_reading/caurina/transitions/properties/ColorShortcuts.as +471 -0
  27. data/widget/last_reading/caurina/transitions/properties/CurveModifiers.as +104 -0
  28. data/widget/last_reading/caurina/transitions/properties/DisplayShortcuts.as +158 -0
  29. data/widget/last_reading/caurina/transitions/properties/FilterShortcuts.as +516 -0
  30. data/widget/last_reading/caurina/transitions/properties/SoundShortcuts.as +83 -0
  31. data/widget/last_reading/caurina/transitions/properties/TextShortcuts.as +151 -0
  32. data/widget/last_reading/energietacho.fla +0 -0
  33. data/widget/last_reading/energietacho.swf +0 -0
  34. metadata +30 -4
@@ -0,0 +1,104 @@
1
+ /**
2
+ * properties.CurveModifiers
3
+ * List of default special properties modifiers for the Tweener class
4
+ * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways.
5
+ *
6
+ * @author Zeh Fernando, Nate Chatellier, Arthur Debert
7
+ * @version 1.0.0
8
+ */
9
+
10
+ import caurina.transitions.Tweener;
11
+
12
+ class caurina.transitions.properties.CurveModifiers {
13
+
14
+ /**
15
+ * There's no constructor.
16
+ */
17
+ public function CurveModifiers () {
18
+ trace ("This is an static class and should not be instantiated.")
19
+ }
20
+
21
+ /**
22
+ * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them.
23
+ */
24
+ public static function init():Void {
25
+
26
+ // Bezier modifiers
27
+ Tweener.registerSpecialPropertyModifier("_bezier", _bezier_modifier, _bezier_get);
28
+ }
29
+
30
+
31
+ // ==================================================================================================================================
32
+ // SPECIAL PROPERTY MODIFIER functions ----------------------------------------------------------------------------------------------
33
+
34
+ // ----------------------------------------------------------------------------------------------------------------------------------
35
+ // _bezier
36
+
37
+ /**
38
+ * Given the parameter object passed to this special property, return an array listing the properties that should be modified, and their parameters
39
+ *
40
+ * @param p_obj Object Parameter passed to this property
41
+ * @return Array Array listing name and parameter of each property
42
+ */
43
+ public static function _bezier_modifier (p_obj:Object):Array {
44
+ var mList:Array = []; // List of properties to be modified
45
+ var pList:Array; // List of parameters passed, normalized as an array
46
+ if (p_obj instanceof Array) {
47
+ // Complex
48
+ pList = p_obj.concat();
49
+ } else {
50
+ pList = [p_obj];
51
+ }
52
+
53
+ var i:Number;
54
+ var istr:String;
55
+ var mListObj:Object = {}; // Object describing each property name and parameter
56
+
57
+ for (i = 0; i < pList.length; i++) {
58
+ for (istr in pList[i]) {
59
+ if (mListObj[istr] == undefined) mListObj[istr] = [];
60
+ mListObj[istr].push(pList[i][istr]);
61
+ }
62
+ }
63
+ for (istr in mListObj) {
64
+ mList.push({name:istr, parameters:mListObj[istr]});
65
+ }
66
+ return mList;
67
+ }
68
+
69
+ /**
70
+ * Given tweening specifications (beging, end, t), applies the property parameter to it, returning new t
71
+ *
72
+ * @param b Number Beginning value of the property
73
+ * @param e Number Ending (desired) value of the property
74
+ * @param t Number Current t of this tweening (0-1), after applying the easing equation
75
+ * @param p Array Array of parameters passed to this specific property
76
+ * @return Number New t, with the p parameters applied to it
77
+ */
78
+ public static function _bezier_get (b:Number, e:Number, t:Number, p:Array):Number {
79
+ // This is based on Robert Penner's code
80
+ if (p.length == 1) {
81
+ // Simple curve with just one bezier control point
82
+ return b + t*(2*(1-t)*(p[0]-b) + t*(e - b));
83
+ } else {
84
+ // Array of bezier control points, must find the point between each pair of bezier points
85
+ var ip:Number = Math.floor(t * p.length); // Position on the bezier list
86
+ var it:Number = (t - (ip * (1 / p.length))) * p.length; // t inside this ip
87
+ var p1:Number, p2:Number;
88
+ if (ip == 0) {
89
+ // First part: belongs to the first control point, find second midpoint
90
+ p1 = b;
91
+ p2 = (p[0]+p[1])/2;
92
+ } else if (ip == p.length - 1) {
93
+ // Last part: belongs to the last control point, find first midpoint
94
+ p1 = (p[ip-1]+p[ip])/2;
95
+ p2 = e;
96
+ } else {
97
+ // Any middle part: find both midpoints
98
+ p1 = (p[ip-1]+p[ip])/2;
99
+ p2 = (p[ip]+p[ip+1])/2;
100
+ }
101
+ return p1+it*(2*(1-it)*(p[ip]-p1) + it*(p2 - p1));
102
+ }
103
+ }
104
+ }
@@ -0,0 +1,158 @@
1
+ /**
2
+ * properties.DisplayShortcuts.as
3
+ * List of default special MovieClip properties (normal and splitter properties) for the Tweener class
4
+ * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways.
5
+ *
6
+ * @author Zeh Fernando, Nate Chatellier, Arthur Debert
7
+ * @version 1.0.0
8
+ */
9
+
10
+ import flash.geom.Point;
11
+ import flash.geom.Rectangle;
12
+
13
+ import caurina.transitions.Tweener;
14
+
15
+ class caurina.transitions.properties.DisplayShortcuts {
16
+
17
+ /**
18
+ * There's no constructor.
19
+ */
20
+ public function DisplayShortcuts () {
21
+ trace ("This is an static class and should not be instantiated.")
22
+ }
23
+
24
+ /**
25
+ * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them.
26
+ */
27
+ public static function init():Void {
28
+
29
+ // Normal properties
30
+ Tweener.registerSpecialProperty("_frame", _frame_get, _frame_set);
31
+ Tweener.registerSpecialProperty("_autoAlpha", _autoAlpha_get, _autoAlpha_set);
32
+
33
+ // Scale splitter properties
34
+ Tweener.registerSpecialPropertySplitter("_scale", _scale_splitter);
35
+
36
+ // scrollRect splitter properties
37
+ Tweener.registerSpecialPropertySplitter("_scrollRect", _scrollRect_splitter);
38
+
39
+ // scrollrect normal properties
40
+ Tweener.registerSpecialProperty("_scrollRect_x", _scrollRect_property_get, _scrollRect_property_set, ["x"]);
41
+ Tweener.registerSpecialProperty("_scrollRect_y", _scrollRect_property_get, _scrollRect_property_set, ["y"]);
42
+ Tweener.registerSpecialProperty("_scrollRect_left", _scrollRect_property_get, _scrollRect_property_set, ["left"]);
43
+ Tweener.registerSpecialProperty("_scrollRect_right", _scrollRect_property_get, _scrollRect_property_set, ["right"]);
44
+ Tweener.registerSpecialProperty("_scrollRect_top", _scrollRect_property_get, _scrollRect_property_set, ["top"]);
45
+ Tweener.registerSpecialProperty("_scrollRect_bottom", _scrollRect_property_get, _scrollRect_property_set, ["bottom"]);
46
+ Tweener.registerSpecialProperty("_scrollRect_width", _scrollRect_property_get, _scrollRect_property_set, ["width"]);
47
+ Tweener.registerSpecialProperty("_scrollRect_height", _scrollRect_property_get, _scrollRect_property_set, ["height"]);
48
+
49
+ }
50
+
51
+
52
+ // ==================================================================================================================================
53
+ // PROPERTY GROUPING/SPLITTING functions --------------------------------------------------------------------------------------------
54
+
55
+ // ----------------------------------------------------------------------------------------------------------------------------------
56
+ // scale
57
+ public static function _scale_splitter(p_value:Number, p_parameters:Array) : Array{
58
+ var nArray:Array = new Array();
59
+ nArray.push({name:"_xscale", value: p_value});
60
+ nArray.push({name:"_yscale", value: p_value});
61
+ return nArray;
62
+ }
63
+
64
+ // ----------------------------------------------------------------------------------------------------------------------------------
65
+ // _scrollRect
66
+
67
+ /**
68
+ * Splits the _scrollRect parameter into specific scrollRect variables
69
+ *
70
+ * @param p_value Rectangle The original _scrollRect rectangle
71
+ * @return Array An array containing the .name and .value of all new properties
72
+ */
73
+ public static function _scrollRect_splitter (p_value:Rectangle, p_parameters:Array):Array {
74
+ var nArray:Array = new Array();
75
+ if (p_value == null) {
76
+ // No parameter passed, so try any rectangle :/
77
+ nArray.push({name:"_scrollRect_x", value:0});
78
+ nArray.push({name:"_scrollRect_y", value:0});
79
+ nArray.push({name:"_scrollRect_width", value:100});
80
+ nArray.push({name:"_scrollRect_height", value:100});
81
+ } else {
82
+ // A rectangle is passed, so just return the properties
83
+ nArray.push({name:"_scrollRect_x", value:p_value.x});
84
+ nArray.push({name:"_scrollRect_y", value:p_value.y});
85
+ nArray.push({name:"_scrollRect_width", value:p_value.width});
86
+ nArray.push({name:"_scrollRect_height", value:p_value.height});
87
+ }
88
+ return nArray;
89
+ }
90
+
91
+
92
+ // ==================================================================================================================================
93
+ // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------
94
+
95
+ // ----------------------------------------------------------------------------------------------------------------------------------
96
+ // _frame
97
+
98
+ /**
99
+ * Returns the current frame number from the movieclip timeline
100
+ *
101
+ * @param p_obj Object MovieClip object
102
+ * @return Number The current frame
103
+ */
104
+ public static function _frame_get (p_obj:Object):Number {
105
+ return p_obj._currentframe;
106
+ }
107
+
108
+ /**
109
+ * Sets the timeline frame
110
+ *
111
+ * @param p_obj Object MovieClip object
112
+ * @param p_value Number New frame number
113
+ */
114
+ public static function _frame_set (p_obj:Object, p_value:Number):Void {
115
+ p_obj.gotoAndStop(Math.round(p_value));
116
+ }
117
+
118
+
119
+ // ----------------------------------------------------------------------------------------------------------------------------------
120
+ // _autoAlpha
121
+
122
+ /**
123
+ * Returns the current alpha
124
+ *
125
+ * @param p_obj Object MovieClip or Textfield object
126
+ * @return Number The current alpha
127
+ */
128
+ public static function _autoAlpha_get (p_obj:Object):Number {
129
+ return p_obj._alpha;
130
+ }
131
+
132
+ /**
133
+ * Sets the current autoAlpha
134
+ *
135
+ * @param p_obj Object MovieClip or Textfield object
136
+ * @param p_value Number New alpha
137
+ */
138
+ public static function _autoAlpha_set (p_obj:Object, p_value:Number):Void {
139
+ p_obj._alpha = p_value;
140
+ p_obj._visible = p_value > 0;
141
+ }
142
+
143
+ // ----------------------------------------------------------------------------------------------------------------------------------
144
+ // _scrollRect_*
145
+
146
+ /**
147
+ * _scrollRect_*
148
+ * Generic function for the properties of the scrollRect object
149
+ */
150
+ public static function _scrollRect_property_get (p_obj:Object, p_parameters:Array):Number {
151
+ return p_obj.scrollRect[p_parameters[0]];
152
+ }
153
+ public static function _scrollRect_property_set (p_obj:Object, p_value:Number, p_parameters:Array):Void {
154
+ var rect:Rectangle = p_obj.scrollRect;
155
+ rect[p_parameters[0]] = Math.round(p_value);
156
+ p_obj.scrollRect = rect;
157
+ }
158
+ }
@@ -0,0 +1,516 @@
1
+ /**
2
+ * properties.FilterShortcuts
3
+ * Special properties for the Tweener class to handle MovieClip filters
4
+ * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways.
5
+ *
6
+ * @author Zeh Fernando, Nate Chatellier, Arthur Debert
7
+ * @version 1.0.0
8
+ */
9
+
10
+ import flash.display.BitmapData;
11
+ import flash.filters.BevelFilter;
12
+ import flash.filters.BitmapFilter;
13
+ import flash.filters.BlurFilter;
14
+ import flash.filters.ColorMatrixFilter;
15
+ import flash.filters.ConvolutionFilter;
16
+ import flash.filters.DisplacementMapFilter;
17
+ import flash.filters.DropShadowFilter;
18
+ import flash.filters.GlowFilter;
19
+ import flash.filters.GradientBevelFilter;
20
+ import flash.filters.GradientGlowFilter;
21
+ import flash.geom.Point;
22
+
23
+ import caurina.transitions.Tweener;
24
+ import caurina.transitions.AuxFunctions;
25
+
26
+ class caurina.transitions.properties.FilterShortcuts {
27
+
28
+ /**
29
+ * There's no constructor.
30
+ */
31
+ public function FilterShortcuts () {
32
+ trace ("This is an static class and should not be instantiated.")
33
+ }
34
+
35
+ /**
36
+ * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them.
37
+ */
38
+ public static function init():Void {
39
+
40
+ // Filter tweening splitter properties
41
+ Tweener.registerSpecialPropertySplitter("_filter", _filter_splitter);
42
+
43
+ // Shortcuts - BevelFilter
44
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/BevelFilter.html
45
+ Tweener.registerSpecialProperty("_Bevel_angle", _filter_property_get, _filter_property_set, [BevelFilter, "angle"]);
46
+ Tweener.registerSpecialProperty("_Bevel_blurX", _filter_property_get, _filter_property_set, [BevelFilter, "blurX"]);
47
+ Tweener.registerSpecialProperty("_Bevel_blurY", _filter_property_get, _filter_property_set, [BevelFilter, "blurY"]);
48
+ Tweener.registerSpecialProperty("_Bevel_distance", _filter_property_get, _filter_property_set, [BevelFilter, "distance"]);
49
+ Tweener.registerSpecialProperty("_Bevel_highlightAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "highlightAlpha"]);
50
+ Tweener.registerSpecialPropertySplitter("_Bevel_highlightColor", _generic_color_splitter, ["_Bevel_highlightColor_r", "_Bevel_highlightColor_g", "_Bevel_highlightColor_b"]);
51
+ Tweener.registerSpecialProperty("_Bevel_highlightColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "r"]);
52
+ Tweener.registerSpecialProperty("_Bevel_highlightColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "g"]);
53
+ Tweener.registerSpecialProperty("_Bevel_highlightColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "b"]);
54
+ Tweener.registerSpecialProperty("_Bevel_knockout", _filter_property_get, _filter_property_set, [BevelFilter, "knockout"]);
55
+ Tweener.registerSpecialProperty("_Bevel_quality", _filter_property_get, _filter_property_set, [BevelFilter, "quality"]);
56
+ Tweener.registerSpecialProperty("_Bevel_shadowAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "shadowAlpha"]);
57
+ Tweener.registerSpecialPropertySplitter("_Bevel_shadowColor", _generic_color_splitter, ["_Bevel_shadowColor_r", "_Bevel_shadowColor_g", "_Bevel_shadowColor_b"]);
58
+ Tweener.registerSpecialProperty("_Bevel_shadowColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "r"]);
59
+ Tweener.registerSpecialProperty("_Bevel_shadowColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "g"]);
60
+ Tweener.registerSpecialProperty("_Bevel_shadowColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "b"]);
61
+ Tweener.registerSpecialProperty("_Bevel_strength", _filter_property_get, _filter_property_set, [BevelFilter, "strength"]);
62
+ Tweener.registerSpecialProperty("_Bevel_type", _filter_property_get, _filter_property_set, [BevelFilter, "type"]);
63
+
64
+ // Shortcuts - BlurFilter
65
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/BlurFilter.html
66
+ Tweener.registerSpecialProperty("_Blur_blurX", _filter_property_get, _filter_property_set, [BlurFilter, "blurX"]);
67
+ Tweener.registerSpecialProperty("_Blur_blurY", _filter_property_get, _filter_property_set, [BlurFilter, "blurY"]);
68
+ Tweener.registerSpecialProperty("_Blur_quality", _filter_property_get, _filter_property_set, [BlurFilter, "quality"]);
69
+
70
+ // Shortcuts - ColorMatrixFilter
71
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/ColorMatrixFilter.html
72
+ 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],
73
+ ["_ColorMatrix_matrix_rr", "_ColorMatrix_matrix_rg", "_ColorMatrix_matrix_rb", "_ColorMatrix_matrix_ra", "_ColorMatrix_matrix_ro",
74
+ "_ColorMatrix_matrix_gr", "_ColorMatrix_matrix_gg", "_ColorMatrix_matrix_gb", "_ColorMatrix_matrix_ga", "_ColorMatrix_matrix_go",
75
+ "_ColorMatrix_matrix_br", "_ColorMatrix_matrix_bg", "_ColorMatrix_matrix_bb", "_ColorMatrix_matrix_ba", "_ColorMatrix_matrix_bo",
76
+ "_ColorMatrix_matrix_ar", "_ColorMatrix_matrix_ag", "_ColorMatrix_matrix_ab", "_ColorMatrix_matrix_aa", "_ColorMatrix_matrix_ao"]]);
77
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_rr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 0]);
78
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_rg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 1]);
79
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_rb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 2]);
80
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_ra", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 3]);
81
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_ro", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 4]);
82
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_gr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 5]);
83
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_gg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 6]);
84
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_gb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 7]);
85
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_ga", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 8]);
86
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_go", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 9]);
87
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_br", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 10]);
88
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_bg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 11]);
89
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_bb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 12]);
90
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_ba", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 13]);
91
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_bo", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 14]);
92
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_ar", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 15]);
93
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_ag", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 16]);
94
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_ab", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 17]);
95
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_aa", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 18]);
96
+ Tweener.registerSpecialProperty("_ColorMatrix_matrix_ao", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 19]);
97
+
98
+ // Shortcuts - ConvolutionFilter
99
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/ConvolutionFilter.html
100
+ Tweener.registerSpecialProperty("_Convolution_alpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "alpha"]);
101
+ Tweener.registerSpecialProperty("_Convolution_bias", _filter_property_get, _filter_property_set, [ConvolutionFilter, "bias"]);
102
+ Tweener.registerSpecialProperty("_Convolution_clamp", _filter_property_get, _filter_property_set, [ConvolutionFilter, "clamp"]);
103
+ Tweener.registerSpecialPropertySplitter("_Convolution_color", _generic_color_splitter, ["_Convolution_color_r", "_Convolution_color_g", "_Convolution_color_b"]);
104
+ Tweener.registerSpecialProperty("_Convolution_color_r", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "r"]);
105
+ Tweener.registerSpecialProperty("_Convolution_color_g", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "g"]);
106
+ Tweener.registerSpecialProperty("_Convolution_color_b", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "b"]);
107
+ Tweener.registerSpecialProperty("_Convolution_divisor", _filter_property_get, _filter_property_set, [ConvolutionFilter, "divisor"]);
108
+ //Tweener.registerSpecialPropertySplitter("_Convolution_matrix", _generic_array_splitter, ["_Convolution_matrix_array"]);
109
+ //Tweener.registerSpecialProperty("_Convolution_matrix_array", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrix", "array"]);
110
+ Tweener.registerSpecialProperty("_Convolution_matrixX", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixX"]);
111
+ Tweener.registerSpecialProperty("_Convolution_matrixY", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixY"]);
112
+ Tweener.registerSpecialProperty("_Convolution_preserveAlpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "preserveAlpha"]);
113
+
114
+ // Shortcuts - DisplacementMapFilter
115
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/DisplacementMapFilter.html
116
+ Tweener.registerSpecialProperty("_DisplacementMap_alpha", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "alpha"]);
117
+ Tweener.registerSpecialPropertySplitter("_DisplacementMap_color", _generic_color_splitter, ["_DisplacementMap_color_r", "_DisplacementMap_color_r", "_DisplacementMap_color_r"]);
118
+ Tweener.registerSpecialProperty("_DisplacementMap_color_r", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "r"]);
119
+ Tweener.registerSpecialProperty("_DisplacementMap_color_g", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "g"]);
120
+ Tweener.registerSpecialProperty("_DisplacementMap_color_b", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "b"]);
121
+ Tweener.registerSpecialProperty("_DisplacementMap_componentX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentX"]);
122
+ Tweener.registerSpecialProperty("_DisplacementMap_componentY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentY"]);
123
+ Tweener.registerSpecialProperty("_DisplacementMap_mapBitmap", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapBitmap"]);
124
+ Tweener.registerSpecialPropertySplitter("_DisplacementMap_mapPoint",_generic_point_splitter, ["_DisplacementMap_mapPoint_x", "_DisplacementMap_mapPoint_y"]);
125
+ Tweener.registerSpecialProperty("_DisplacementMap_mapPoint_x", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint", "point", "x"]);
126
+ Tweener.registerSpecialProperty("_DisplacementMap_mapPoint_y", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint", "point", "y"]);
127
+ Tweener.registerSpecialProperty("_DisplacementMap_mode", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mode"]);
128
+ Tweener.registerSpecialProperty("_DisplacementMap_scaleX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleX"]);
129
+ Tweener.registerSpecialProperty("_DisplacementMap_scaleY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleY"]);
130
+
131
+ // Shortcuts - DropShadowFilter
132
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/DropShadowFilter.html
133
+ Tweener.registerSpecialProperty("_DropShadow_alpha", _filter_property_get, _filter_property_set, [DropShadowFilter, "alpha"]);
134
+ Tweener.registerSpecialProperty("_DropShadow_angle", _filter_property_get, _filter_property_set, [DropShadowFilter, "angle"]);
135
+ Tweener.registerSpecialProperty("_DropShadow_blurX", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurX"]);
136
+ Tweener.registerSpecialProperty("_DropShadow_blurY", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurY"]);
137
+ Tweener.registerSpecialPropertySplitter("_DropShadow_color", _generic_color_splitter, ["_DropShadow_color_r", "_DropShadow_color_g", "_DropShadow_color_b"]);
138
+ Tweener.registerSpecialProperty("_DropShadow_color_r", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "r"]);
139
+ Tweener.registerSpecialProperty("_DropShadow_color_g", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "g"]);
140
+ Tweener.registerSpecialProperty("_DropShadow_color_b", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "b"]);
141
+ Tweener.registerSpecialProperty("_DropShadow_distance", _filter_property_get, _filter_property_set, [DropShadowFilter, "distance"]);
142
+ Tweener.registerSpecialProperty("_DropShadow_hideObject", _filter_property_get, _filter_property_set, [DropShadowFilter, "hideObject"]);
143
+ Tweener.registerSpecialProperty("_DropShadow_inner", _filter_property_get, _filter_property_set, [DropShadowFilter, "inner"]);
144
+ Tweener.registerSpecialProperty("_DropShadow_knockout", _filter_property_get, _filter_property_set, [DropShadowFilter, "knockout"]);
145
+ Tweener.registerSpecialProperty("_DropShadow_quality", _filter_property_get, _filter_property_set, [DropShadowFilter, "quality"]);
146
+ Tweener.registerSpecialProperty("_DropShadow_strength", _filter_property_get, _filter_property_set, [DropShadowFilter, "strength"]);
147
+
148
+ // Shortcuts - GlowFilter
149
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/GlowFilter.html
150
+ Tweener.registerSpecialProperty("_Glow_alpha", _filter_property_get, _filter_property_set, [GlowFilter, "alpha"]);
151
+ Tweener.registerSpecialProperty("_Glow_blurX", _filter_property_get, _filter_property_set, [GlowFilter, "blurX"]);
152
+ Tweener.registerSpecialProperty("_Glow_blurY", _filter_property_get, _filter_property_set, [GlowFilter, "blurY"]);
153
+ Tweener.registerSpecialPropertySplitter("_Glow_color", _generic_color_splitter, ["_Glow_color_r", "_Glow_color_g", "_Glow_color_b"]);
154
+ Tweener.registerSpecialProperty("_Glow_color_r", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "r"]);
155
+ Tweener.registerSpecialProperty("_Glow_color_g", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "g"]);
156
+ Tweener.registerSpecialProperty("_Glow_color_b", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "b"]);
157
+ Tweener.registerSpecialProperty("_Glow_inner", _filter_property_get, _filter_property_set, [GlowFilter, "inner"]);
158
+ Tweener.registerSpecialProperty("_Glow_knockout", _filter_property_get, _filter_property_set, [GlowFilter, "knockout"]);
159
+ Tweener.registerSpecialProperty("_Glow_quality", _filter_property_get, _filter_property_set, [GlowFilter, "quality"]);
160
+ Tweener.registerSpecialProperty("_Glow_strength", _filter_property_get, _filter_property_set, [GlowFilter, "strength"]);
161
+
162
+ // Shortcuts - GradientBevelFilter
163
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/GradientBevelFilter.html
164
+ // .alphas (array)
165
+ Tweener.registerSpecialProperty("_GradientBevel_angle", _filter_property_get, _filter_property_set, [GradientBevelFilter, "angle"]);
166
+ Tweener.registerSpecialProperty("_GradientBevel_blurX", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurX"]);
167
+ Tweener.registerSpecialProperty("_GradientBevel_blurY", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurY"]);
168
+ // .colors (array)
169
+ Tweener.registerSpecialProperty("_GradientBevel_distance", _filter_property_get, _filter_property_set, [GradientBevelFilter, "distance"]);
170
+ Tweener.registerSpecialProperty("_GradientBevel_quality", _filter_property_get, _filter_property_set, [GradientBevelFilter, "quality"]);
171
+ // .ratios(array)
172
+ Tweener.registerSpecialProperty("_GradientBevel_strength", _filter_property_get, _filter_property_set, [GradientBevelFilter, "strength"]);
173
+ Tweener.registerSpecialProperty("_GradientBevel_type", _filter_property_get, _filter_property_set, [GradientBevelFilter, "type"]);
174
+
175
+ // Shortcuts - GradientGlowFilter
176
+ // http://livedocs.adobe.com/flex/2/langref/flash/filters/GradientGlowFilter.html
177
+ // .alphas (array)
178
+ Tweener.registerSpecialProperty("_GradientGlow_angle", _filter_property_get, _filter_property_set, [GradientGlowFilter, "angle"]);
179
+ Tweener.registerSpecialProperty("_GradientGlow_blurX", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurX"]);
180
+ Tweener.registerSpecialProperty("_GradientGlow_blurY", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurY"]);
181
+ // .colors (array)
182
+ Tweener.registerSpecialProperty("_GradientGlow_distance", _filter_property_get, _filter_property_set, [GradientGlowFilter, "distance"]);
183
+ Tweener.registerSpecialProperty("_GradientGlow_knockout", _filter_property_get, _filter_property_set, [GradientGlowFilter, "knockout"]);
184
+ Tweener.registerSpecialProperty("_GradientGlow_quality", _filter_property_get, _filter_property_set, [GradientGlowFilter, "quality"]);
185
+ // .ratios (array)
186
+ Tweener.registerSpecialProperty("_GradientGlow_strength", _filter_property_get, _filter_property_set, [GradientGlowFilter, "strength"]);
187
+ Tweener.registerSpecialProperty("_GradientGlow_type", _filter_property_get, _filter_property_set, [GradientGlowFilter, "type"]);
188
+
189
+ }
190
+
191
+
192
+ // ==================================================================================================================================
193
+ // PROPERTY GROUPING/SPLITTING functions --------------------------------------------------------------------------------------------
194
+
195
+ // ----------------------------------------------------------------------------------------------------------------------------------
196
+ // generic splitters
197
+
198
+ /**
199
+ * A generic color splitter - from 0xrrggbb to r, g, b with the name of the parameters passed
200
+ *
201
+ * @param p_value Number The original _color value
202
+ * @return Array An array containing the .name and .value of all new properties
203
+ */
204
+ public static function _generic_color_splitter (p_value:Number, p_parameters:Array):Array {
205
+ var nArray:Array = new Array();
206
+ nArray.push({name:p_parameters[0], value:AuxFunctions.numberToR(p_value)});
207
+ nArray.push({name:p_parameters[1], value:AuxFunctions.numberToG(p_value)});
208
+ nArray.push({name:p_parameters[2], value:AuxFunctions.numberToB(p_value)});
209
+ return nArray;
210
+ }
211
+
212
+ /**
213
+ * A generic mapPoint splitter - from Point to x, y with the name of the parameters passed
214
+ *
215
+ * @param p_value Point The original point
216
+ * @return Array An array containing the .name and .value of all new properties
217
+ */
218
+ public static function _generic_point_splitter (p_value:Point, p_parameters:Array):Array {
219
+ var nArray:Array = new Array();
220
+ nArray.push({name:p_parameters[0], value:p_value.x});
221
+ nArray.push({name:p_parameters[1], value:p_value.y});
222
+ return nArray;
223
+ }
224
+
225
+ /**
226
+ * A generic matrix splitter - from [] to items with the name of the parameters passed
227
+ *
228
+ * @param p_value Array The original matrix
229
+ * @return Array An array containing the .name and .value of all new properties
230
+ */
231
+ public static function _generic_matrix_splitter (p_value:Array, p_parameters:Array):Array {
232
+ if (p_value == null) p_value = p_parameters[0].concat();
233
+ var nArray:Array = new Array();
234
+ for (var i:Number = 0; i < p_value.length; i++) {
235
+ nArray.push({name:p_parameters[1][i], value:p_value[i]});
236
+ }
237
+ return nArray;
238
+ }
239
+
240
+ /**
241
+ * A generic array splitter - from [] to items with the index passed back
242
+ *
243
+ * @param p_value Array The original array value
244
+ * @return Array An array containing the .name and .value of all new properties
245
+ */
246
+ /*
247
+ public static function _generic_array_splitter (p_value:Array, p_parameters:Array):Array {
248
+ if (p_value == null) p_value = p_parameters[0].concat();
249
+ var nArray:Array = new Array();
250
+ for (var i:Number = 0; i < p_value.length; i++) {
251
+ nArray.push({name:p_parameters[1][i], value:p_value[i], arrayIndex:i});
252
+ }
253
+ return nArray;
254
+ }
255
+ */
256
+
257
+ // ----------------------------------------------------------------------------------------------------------------------------------
258
+ // filters
259
+
260
+ /**
261
+ * Splits the _filter, _blur, etc parameter into specific filter variables
262
+ *
263
+ * @param p_value BitmapFilter A BitmapFilter instance
264
+ * @return Array An array containing the .name and .value of all new properties
265
+ */
266
+ public static function _filter_splitter (p_value:BitmapFilter):Array {
267
+ var nArray:Array = new Array();
268
+ if (p_value instanceof BevelFilter) {
269
+ nArray.push({name:"_Bevel_angle", value:BevelFilter(p_value).angle});
270
+ nArray.push({name:"_Bevel_blurX", value:BevelFilter(p_value).blurX});
271
+ nArray.push({name:"_Bevel_blurY", value:BevelFilter(p_value).blurY});
272
+ nArray.push({name:"_Bevel_distance", value:BevelFilter(p_value).distance});
273
+ nArray.push({name:"_Bevel_highlightAlpha", value:BevelFilter(p_value).highlightAlpha});
274
+ nArray.push({name:"_Bevel_highlightColor", value:BevelFilter(p_value).highlightColor});
275
+ nArray.push({name:"_Bevel_knockout", value:BevelFilter(p_value).knockout});
276
+ nArray.push({name:"_Bevel_quality", value:BevelFilter(p_value).quality});
277
+ nArray.push({name:"_Bevel_shadowAlpha", value:BevelFilter(p_value).shadowAlpha});
278
+ nArray.push({name:"_Bevel_shadowColor", value:BevelFilter(p_value).shadowColor});
279
+ nArray.push({name:"_Bevel_strength", value:BevelFilter(p_value).strength});
280
+ nArray.push({name:"_Bevel_type", value:BevelFilter(p_value).type});
281
+ } else if (p_value instanceof BlurFilter) {
282
+ nArray.push({name:"_Blur_blurX", value:BlurFilter(p_value).blurX});
283
+ nArray.push({name:"_Blur_blurY", value:BlurFilter(p_value).blurY});
284
+ nArray.push({name:"_Blur_quality", value:BlurFilter(p_value).quality});
285
+ } else if (p_value instanceof ColorMatrixFilter) {
286
+ nArray.push({name:"_ColorMatrix_matrix", value:ColorMatrixFilter(p_value).matrix});
287
+ } else if (p_value instanceof ConvolutionFilter) {
288
+ nArray.push({name:"_Convolution_alpha", value:ConvolutionFilter(p_value).alpha});
289
+ nArray.push({name:"_Convolution_bias", value:ConvolutionFilter(p_value).bias});
290
+ nArray.push({name:"_Convolution_clamp", value:ConvolutionFilter(p_value).clamp});
291
+ nArray.push({name:"_Convolution_color", value:ConvolutionFilter(p_value).color});
292
+ // .matrix
293
+ nArray.push({name:"_Convolution_divisor", value:ConvolutionFilter(p_value).divisor});
294
+ nArray.push({name:"_Convolution_matrixX", value:ConvolutionFilter(p_value).matrixX});
295
+ nArray.push({name:"_Convolution_matrixY", value:ConvolutionFilter(p_value).matrixY});
296
+ nArray.push({name:"_Convolution_preserveAlpha", value:ConvolutionFilter(p_value).preserveAlpha});
297
+ } else if (p_value instanceof DisplacementMapFilter) {
298
+ nArray.push({name:"_DisplacementMap_alpha", value:DisplacementMapFilter(p_value).alpha});
299
+ nArray.push({name:"_DisplacementMap_color", value:DisplacementMapFilter(p_value).color});
300
+ nArray.push({name:"_DisplacementMap_componentX", value:DisplacementMapFilter(p_value).componentX});
301
+ nArray.push({name:"_DisplacementMap_componentY", value:DisplacementMapFilter(p_value).componentY});
302
+ nArray.push({name:"_DisplacementMap_mapBitmap", value:DisplacementMapFilter(p_value).mapBitmap});
303
+ nArray.push({name:"_DisplacementMap_mapPoint", value:DisplacementMapFilter(p_value).mapPoint});
304
+ nArray.push({name:"_DisplacementMap_mode", value:DisplacementMapFilter(p_value).mode});
305
+ nArray.push({name:"_DisplacementMap_scaleX", value:DisplacementMapFilter(p_value).scaleX});
306
+ nArray.push({name:"_DisplacementMap_scaleY", value:DisplacementMapFilter(p_value).scaleY});
307
+ } else if (p_value instanceof DropShadowFilter) {
308
+ nArray.push({name:"_DropShadow_alpha", value:DropShadowFilter(p_value).alpha});
309
+ nArray.push({name:"_DropShadow_angle", value:DropShadowFilter(p_value).angle});
310
+ nArray.push({name:"_DropShadow_blurX", value:DropShadowFilter(p_value).blurX});
311
+ nArray.push({name:"_DropShadow_blurY", value:DropShadowFilter(p_value).blurY});
312
+ nArray.push({name:"_DropShadow_color", value:DropShadowFilter(p_value).color});
313
+ nArray.push({name:"_DropShadow_distance", value:DropShadowFilter(p_value).distance});
314
+ nArray.push({name:"_DropShadow_hideObject", value:DropShadowFilter(p_value).hideObject});
315
+ nArray.push({name:"_DropShadow_inner", value:DropShadowFilter(p_value).inner});
316
+ nArray.push({name:"_DropShadow_knockout", value:DropShadowFilter(p_value).knockout});
317
+ nArray.push({name:"_DropShadow_quality", value:DropShadowFilter(p_value).quality});
318
+ nArray.push({name:"_DropShadow_strength", value:DropShadowFilter(p_value).strength});
319
+ } else if (p_value instanceof GlowFilter) {
320
+ nArray.push({name:"_Glow_alpha", value:GlowFilter(p_value).alpha});
321
+ nArray.push({name:"_Glow_blurX", value:GlowFilter(p_value).blurX});
322
+ nArray.push({name:"_Glow_blurY", value:GlowFilter(p_value).blurY});
323
+ nArray.push({name:"_Glow_color", value:GlowFilter(p_value).color});
324
+ nArray.push({name:"_Glow_inner", value:GlowFilter(p_value).inner});
325
+ nArray.push({name:"_Glow_knockout", value:GlowFilter(p_value).knockout});
326
+ nArray.push({name:"_Glow_quality", value:GlowFilter(p_value).quality});
327
+ nArray.push({name:"_Glow_strength", value:GlowFilter(p_value).strength});
328
+ } else if (p_value instanceof GradientBevelFilter) {
329
+ // .alphas (array)
330
+ nArray.push({name:"_GradientBevel_angle", value:GradientBevelFilter(p_value).strength});
331
+ nArray.push({name:"_GradientBevel_blurX", value:GradientBevelFilter(p_value).blurX});
332
+ nArray.push({name:"_GradientBevel_blurY", value:GradientBevelFilter(p_value).blurY});
333
+ // .colors (array)
334
+ nArray.push({name:"_GradientBevel_distance", value:GradientBevelFilter(p_value).distance});
335
+ nArray.push({name:"_GradientBevel_quality", value:GradientBevelFilter(p_value).quality});
336
+ // .ratios(array)
337
+ nArray.push({name:"_GradientBevel_strength", value:GradientBevelFilter(p_value).strength});
338
+ nArray.push({name:"_GradientBevel_type", value:GradientBevelFilter(p_value).type});
339
+ } else if (p_value instanceof GradientGlowFilter) {
340
+ // .alphas (array)
341
+ nArray.push({name:"_GradientGlow_angle", value:GradientGlowFilter(p_value).strength});
342
+ nArray.push({name:"_GradientGlow_blurX", value:GradientGlowFilter(p_value).blurX});
343
+ nArray.push({name:"_GradientGlow_blurY", value:GradientGlowFilter(p_value).blurY});
344
+ // .colors (array)
345
+ nArray.push({name:"_GradientGlow_distance", value:GradientGlowFilter(p_value).distance});
346
+ nArray.push({name:"_GradientGlow_knockout", value:GradientGlowFilter(p_value).knockout});
347
+ nArray.push({name:"_GradientGlow_quality", value:GradientGlowFilter(p_value).quality});
348
+ // .ratios(array)
349
+ nArray.push({name:"_GradientGlow_strength", value:GradientGlowFilter(p_value).strength});
350
+ nArray.push({name:"_GradientGlow_type", value:GradientGlowFilter(p_value).type});
351
+ } else {
352
+ // ?
353
+ trace ("Tweener FilterShortcuts Error :: Unknown filter class used");
354
+ }
355
+ return nArray;
356
+ }
357
+
358
+
359
+ // ==================================================================================================================================
360
+ // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------
361
+
362
+ // ----------------------------------------------------------------------------------------------------------------------------------
363
+ // filters
364
+
365
+ /**
366
+ * (filters)
367
+ * Generic function for the properties of filter objects
368
+ */
369
+ public static function _filter_property_get (p_obj:Object, p_parameters:Array):Number {
370
+ var f:Array = p_obj.filters;
371
+ var i:Number;
372
+ var filterClass:Object = p_parameters[0];
373
+ var propertyName:String = p_parameters[1];
374
+ var splitType:String = p_parameters[2];
375
+ for (i = 0; i < f.length; i++) {
376
+ if (f[i] instanceof filterClass) {
377
+ if (splitType == "color") {
378
+ // Composite, color channel
379
+ var colorComponent:String = p_parameters[3];
380
+ if (colorComponent == "r") return AuxFunctions.numberToR(f[i][propertyName]);
381
+ if (colorComponent == "g") return AuxFunctions.numberToG(f[i][propertyName]);
382
+ if (colorComponent == "b") return AuxFunctions.numberToB(f[i][propertyName]);
383
+ } else if (splitType == "matrix") {
384
+ // Composite, some kind of matrix
385
+ return f[i][propertyName][p_parameters[3]];
386
+ } else if (splitType == "point") {
387
+ // Composite, a point
388
+ return f[i][propertyName][p_parameters[3]];
389
+ } else {
390
+ // Standard property
391
+ return (f[i][propertyName]);
392
+ }
393
+ }
394
+ }
395
+
396
+ // No value found for this property - no filter instance found using this class!
397
+ // Must return default desired values
398
+ var defaultValues:Object;
399
+ switch (filterClass) {
400
+ case BevelFilter:
401
+ 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};
402
+ break;
403
+ case BlurFilter:
404
+ defaultValues = {blurX:0, blurY:0, quality:NaN};
405
+ break;
406
+ case ColorMatrixFilter:
407
+ defaultValues = {matrix:[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]};
408
+ break;
409
+ case ConvolutionFilter:
410
+ defaultValues = {alpha:0, bias:0, clamp:null, color:NaN, divisor:1, matrix:[1], matrixX:1, matrixY:1, preserveAlpha:null};
411
+ break;
412
+ case DisplacementMapFilter:
413
+ defaultValues = {alpha:0, color:NaN, componentX:null, componentY:null, mapBitmap:null, mapPoint:null, mode:null, scaleX:0, scaleY:0};
414
+ break;
415
+ case DropShadowFilter:
416
+ defaultValues = {distance:0, angle:NaN, color:NaN, alpha:1, blurX:0, blurY:0, strength:1, quality:NaN, inner:null, knockout:null, hideObject:null};
417
+ break;
418
+ case GlowFilter:
419
+ defaultValues = {alpha:1, blurX:0, blurY:0, color:NaN, inner:null, knockout:null, quality:NaN, strength:2};
420
+ break;
421
+ case GradientBevelFilter:
422
+ defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null};
423
+ break;
424
+ case GradientGlowFilter:
425
+ defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null};
426
+ break;
427
+ }
428
+ // When returning NaN, the Tweener engine sets the starting value as being the same as the final value (if not found)
429
+ // When returning null, the Tweener engine doesn't tween it at all, just setting it to the final value
430
+ // This is DIFFERENT from the default filter applied as default on _filter_property_set because some values shouldn't be tweened
431
+ if (splitType == "color") {
432
+ // Composite, color channel; always defaults to target value
433
+ return NaN;
434
+ } else if (splitType == "matrix") {
435
+ // Composite, matrix; always defaults to target value
436
+ return defaultValues[propertyName][p_parameters[3]];
437
+ } else if (splitType == "point") {
438
+ // Composite, point; always defaults to target value
439
+ return defaultValues[propertyName][p_parameters[3]];
440
+ } else {
441
+ // Standard property
442
+ return defaultValues[propertyName];
443
+ }
444
+ }
445
+
446
+ public static function _filter_property_set (p_obj:Object, p_value:Number, p_parameters:Array):Void {
447
+ var f:Array = p_obj.filters;
448
+ var i:Number;
449
+ var filterClass:Object = p_parameters[0];
450
+ var propertyName:String = p_parameters[1];
451
+ var splitType:String = p_parameters[2];
452
+ for (i = 0; i < f.length; i++) {
453
+ if (f[i] instanceof filterClass) {
454
+ if (splitType == "color") {
455
+ // Composite, color channel
456
+ var colorComponent:String = p_parameters[3];
457
+ if (colorComponent == "r") f[i][propertyName] = (f[i][propertyName] & 0xffff) | (p_value << 16);
458
+ if (colorComponent == "g") f[i][propertyName] = (f[i][propertyName] & 0xff00ff) | (p_value << 8);
459
+ if (colorComponent == "b") f[i][propertyName] = (f[i][propertyName] & 0xffff00) | p_value;
460
+ } else if (splitType == "matrix") {
461
+ var mtx:Array = f[i][propertyName];
462
+ mtx[p_parameters[3]] = p_value;
463
+ f[i][propertyName] = mtx;
464
+ } else if (splitType == "point") {
465
+ var pt:Point = Point(f[i][propertyName]);
466
+ pt[p_parameters[3]] = p_value;
467
+ f[i][propertyName] = pt;
468
+ } else {
469
+ // Standard property
470
+ f[i][propertyName] = p_value;
471
+ }
472
+ p_obj.filters = f;
473
+ return;
474
+ }
475
+ }
476
+
477
+ // The correct filter class wasn't found, so create a new one that is the equivalent of the object without the filter
478
+ if (f == undefined) f = new Array();
479
+ var fi:BitmapFilter;
480
+ switch (filterClass) {
481
+ case BevelFilter:
482
+ fi = new BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, 0, 0);
483
+ break;
484
+ case BlurFilter:
485
+ fi = new BlurFilter(0, 0);
486
+ break;
487
+ case ColorMatrixFilter:
488
+ fi = new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]);
489
+ break;
490
+ case ConvolutionFilter:
491
+ fi = new ConvolutionFilter(1, 1, [1], 1, 0, true, true, 0x000000, 0);
492
+ break;
493
+ case DisplacementMapFilter:
494
+ // Doesn't make much sense to create a new empty DisplacementMapFilter if there's nothing to tween
495
+ fi = new DisplacementMapFilter(new BitmapData(10, 10), new Point(0, 0), 0, 1, 0, 0);
496
+ break;
497
+ case DropShadowFilter:
498
+ fi = new DropShadowFilter(0, 45, 0x000000, 1, 0, 0);
499
+ break;
500
+ case GlowFilter:
501
+ fi = new GlowFilter(0xff0000, 1, 0, 0);
502
+ break;
503
+ case GradientBevelFilter:
504
+ fi = new GradientBevelFilter(0, 45, [0xffffff, 0x000000], [1, 1], [32, 223], 0, 0);
505
+ break;
506
+ case GradientGlowFilter:
507
+ fi = new GradientGlowFilter(0, 45, [0xffffff, 0x000000], [1, 1], [32, 223], 0, 0);
508
+ break;
509
+ }
510
+ //fi[propertyName] = p_value;
511
+ f.push(fi);
512
+ p_obj.filters = f;
513
+ _filter_property_set(p_obj, p_value, p_parameters);
514
+ }
515
+
516
+ }