msg-chumby-display 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/msg-chumby-daemon +6 -1
- data/etc/msgchumbydaemonrc +7 -4
- data/lib/msg-chumby-daemon/http-xml-server.rb +20 -1
- data/widget/currentpower/currentpower Report.txt +1 -1
- data/widget/currentpower/currentpower.swd +0 -0
- data/widget/currentpower/currentpower.swf +0 -0
- data/widget/last_reading/DataArray.as +116 -0
- data/widget/last_reading/Gluehlampe.fla +0 -0
- data/widget/last_reading/Gluehlampe.swf +0 -0
- data/widget/last_reading/Gluehlampe_frames.fla +0 -0
- data/widget/last_reading/Gluehlampe_frames.swf +0 -0
- data/widget/last_reading/Makefile +30 -0
- data/widget/last_reading/Makefile.orig +60 -0
- data/widget/last_reading/README.rdoc +50 -0
- data/widget/last_reading/README.rtf +57 -0
- data/widget/last_reading/XmlParse.as +1 -0
- data/widget/last_reading/caurina/transitions/AuxFunctions.as +88 -0
- data/widget/last_reading/caurina/transitions/Equations.as +713 -0
- data/widget/last_reading/caurina/transitions/PropertyInfoObj.as +86 -0
- data/widget/last_reading/caurina/transitions/SpecialProperty.as +48 -0
- data/widget/last_reading/caurina/transitions/SpecialPropertyModifier.as +39 -0
- data/widget/last_reading/caurina/transitions/SpecialPropertySplitter.as +46 -0
- data/widget/last_reading/caurina/transitions/TweenListObj.as +227 -0
- data/widget/last_reading/caurina/transitions/Tweener.as +1121 -0
- data/widget/last_reading/caurina/transitions/properties/ColorShortcuts.as +471 -0
- data/widget/last_reading/caurina/transitions/properties/CurveModifiers.as +104 -0
- data/widget/last_reading/caurina/transitions/properties/DisplayShortcuts.as +158 -0
- data/widget/last_reading/caurina/transitions/properties/FilterShortcuts.as +516 -0
- data/widget/last_reading/caurina/transitions/properties/SoundShortcuts.as +83 -0
- data/widget/last_reading/caurina/transitions/properties/TextShortcuts.as +151 -0
- data/widget/last_reading/energietacho.fla +0 -0
- data/widget/last_reading/energietacho.swf +0 -0
- metadata +30 -4
@@ -0,0 +1,86 @@
|
|
1
|
+
/**
|
2
|
+
* PropertyInfoObj
|
3
|
+
* An object containing the updating info for a given property (its starting value, its final value, and a few other things)
|
4
|
+
*
|
5
|
+
* @author Zeh Fernando
|
6
|
+
* @version 1.0.0
|
7
|
+
* @private
|
8
|
+
*/
|
9
|
+
|
10
|
+
class caurina.transitions.PropertyInfoObj {
|
11
|
+
|
12
|
+
public var valueStart :Number; // Starting value of the tweening (null if not started yet)
|
13
|
+
public var valueComplete :Number; // Final desired value (numerically)
|
14
|
+
public var originalValueComplete :Object; // Final desired value as declared initially
|
15
|
+
public var arrayIndex :Number; // Index (if this is an array item)
|
16
|
+
public var extra :Object; // Additional parameters, used by some special properties
|
17
|
+
public var isSpecialProperty :Boolean; // Whether or not this is a special property instead of a direct one
|
18
|
+
public var hasModifier :Boolean; // Whether or not it has a modifier function
|
19
|
+
public var modifierFunction :Function; // Modifier function, if any
|
20
|
+
public var modifierParameters :Array; // Additional array of modifier parameters
|
21
|
+
|
22
|
+
// ==================================================================================================================================
|
23
|
+
// CONSTRUCTOR function -------------------------------------------------------------------------------------------------------------
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Initializes the basic PropertyInfoObj.
|
27
|
+
*
|
28
|
+
* @param p_valueStart Number Starting value of the tweening (null if not started yet)
|
29
|
+
* @param p_valueComplete Number Final (desired) property value
|
30
|
+
*/
|
31
|
+
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) {
|
32
|
+
valueStart = p_valueStart;
|
33
|
+
valueComplete = p_valueComplete;
|
34
|
+
originalValueComplete = p_originalValueComplete;
|
35
|
+
arrayIndex = p_arrayIndex;
|
36
|
+
extra = p_extra;
|
37
|
+
isSpecialProperty = p_isSpecialProperty;
|
38
|
+
hasModifier = p_modifierFunction != undefined;
|
39
|
+
modifierFunction = p_modifierFunction;
|
40
|
+
modifierParameters = p_modifierParameters;
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
// ==================================================================================================================================
|
45
|
+
// OTHER functions ------------------------------------------------------------------------------------------------------------------
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Clones this property info and returns the new PropertyInfoObj
|
49
|
+
*
|
50
|
+
* @param omitEvents Boolean Whether or not events such as onStart (and its parameters) should be omitted
|
51
|
+
* @return TweenListObj A copy of this object
|
52
|
+
*/
|
53
|
+
public function clone():PropertyInfoObj {
|
54
|
+
var nProperty:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
|
55
|
+
return nProperty;
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Returns this object described as a String.
|
60
|
+
*
|
61
|
+
* @return String The description of this object.
|
62
|
+
*/
|
63
|
+
public function toString():String {
|
64
|
+
var returnStr:String = "\n[PropertyInfoObj ";
|
65
|
+
returnStr += "valueStart:" + String(valueStart);
|
66
|
+
returnStr += ", ";
|
67
|
+
returnStr += "valueComplete:" + String(valueComplete);
|
68
|
+
returnStr += ", ";
|
69
|
+
returnStr += "originalValueComplete:" + String(originalValueComplete);
|
70
|
+
returnStr += ", ";
|
71
|
+
returnStr += "arrayIndex:" + String(arrayIndex);
|
72
|
+
returnStr += ", ";
|
73
|
+
returnStr += "extra:" + String(extra);
|
74
|
+
returnStr += ", ";
|
75
|
+
returnStr += "isSpecialProperty:" + String(isSpecialProperty);
|
76
|
+
returnStr += ", ";
|
77
|
+
returnStr += "hasModifier:" + String(hasModifier);
|
78
|
+
returnStr += ", ";
|
79
|
+
returnStr += "modifierFunction:" + String(modifierFunction);
|
80
|
+
returnStr += ", ";
|
81
|
+
returnStr += "modifierParameters:" + String(modifierParameters);
|
82
|
+
returnStr += "]\n";
|
83
|
+
return returnStr;
|
84
|
+
}
|
85
|
+
|
86
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/**
|
2
|
+
* SpecialProperty
|
3
|
+
* A kind of a getter/setter for special properties
|
4
|
+
*
|
5
|
+
* @author Zeh Fernando
|
6
|
+
* @version 1.0.0
|
7
|
+
*/
|
8
|
+
|
9
|
+
class caurina.transitions.SpecialProperty {
|
10
|
+
|
11
|
+
public var getValue:Function; // (p_obj:Object, p_parameters:Array): Number
|
12
|
+
public var setValue:Function; // (p_obj:Object, p_value:Number, p_parameters:Array): Void
|
13
|
+
public var parameters:Array;
|
14
|
+
public var preProcess:Function; // (p_obj:Object, p_parameters:Array, p_originalValueComplete:Object, p_extra:Object): Number
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Builds a new special property object.
|
18
|
+
*
|
19
|
+
* @param p_getFunction Function Reference to the function used to get the special property value
|
20
|
+
* @param p_setFunction Function Reference to the function used to set the special property value
|
21
|
+
* @param p_parameters Array Additional parameters that should be passed to the function when executing (so the same function can apply to different special properties)
|
22
|
+
*/
|
23
|
+
public function SpecialProperty (p_getFunction:Function, p_setFunction:Function, p_parameters:Array, p_preProcessFunction:Function) {
|
24
|
+
getValue = p_getFunction;
|
25
|
+
setValue = p_setFunction;
|
26
|
+
parameters = p_parameters;
|
27
|
+
preProcess = p_preProcessFunction;
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Converts the instance to a string that can be used when trace()ing the object
|
32
|
+
*/
|
33
|
+
public function toString():String {
|
34
|
+
var value:String = "";
|
35
|
+
value += "[SpecialProperty ";
|
36
|
+
value += "getValue:"+getValue.toString();
|
37
|
+
value += ", ";
|
38
|
+
value += "setValue:"+setValue.toString();
|
39
|
+
value += ", ";
|
40
|
+
value += "parameters:"+parameters.toString();
|
41
|
+
value += ", ";
|
42
|
+
value += "preProcess:"+preProcess.toString();
|
43
|
+
value += "]";
|
44
|
+
return value;
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* SpecialPropertyModifier
|
3
|
+
* A special property which actually acts on other properties
|
4
|
+
*
|
5
|
+
* @author Zeh Fernando
|
6
|
+
* @version 1.0.0
|
7
|
+
* @private
|
8
|
+
*/
|
9
|
+
|
10
|
+
class caurina.transitions.SpecialPropertyModifier {
|
11
|
+
|
12
|
+
public var modifyValues:Function;
|
13
|
+
public var getValue:Function;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Builds a new special property modifier object.
|
17
|
+
*
|
18
|
+
* @param p_modifyFunction Function Function that returns the modifider parameters.
|
19
|
+
*/
|
20
|
+
public function SpecialPropertyModifier (p_modifyFunction:Function, p_getFunction:Function) {
|
21
|
+
modifyValues = p_modifyFunction;
|
22
|
+
getValue = p_getFunction;
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Converts the instance to a string that can be used when trace()ing the object
|
27
|
+
*/
|
28
|
+
public function toString():String {
|
29
|
+
var value:String = "";
|
30
|
+
value += "[SpecialPropertyModifier ";
|
31
|
+
value += "modifyValues:"+modifyValues.toString();
|
32
|
+
value += ", ";
|
33
|
+
value += "getValue:"+getValue.toString();
|
34
|
+
value += "]";
|
35
|
+
return value;
|
36
|
+
}
|
37
|
+
|
38
|
+
|
39
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* SpecialPropertySplitter
|
3
|
+
* A proxy setter for special properties
|
4
|
+
*
|
5
|
+
* @author Zeh Fernando
|
6
|
+
* @version 1.0.0
|
7
|
+
*/
|
8
|
+
|
9
|
+
class caurina.transitions.SpecialPropertySplitter {
|
10
|
+
|
11
|
+
public var parameters:Array;
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Builds a new splitter special propery object.
|
15
|
+
*
|
16
|
+
* @param p_splitFunction Function Reference to the function used to split a value
|
17
|
+
*/
|
18
|
+
public function SpecialPropertySplitter (p_splitFunction:Function, p_parameters:Array) {
|
19
|
+
splitValues = p_splitFunction;
|
20
|
+
parameters = p_parameters;
|
21
|
+
}
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Empty shell for the function that receives the value (usually just a Number), and splits it in new property names and values
|
25
|
+
* Must return an array containing .name and .value
|
26
|
+
*/
|
27
|
+
public function splitValues(p_value:Object, p_parameters:Array):Array {
|
28
|
+
// This is rewritten
|
29
|
+
return [];
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Converts the instance to a string that can be used when trace()ing the object
|
34
|
+
*/
|
35
|
+
public function toString():String {
|
36
|
+
var value:String = "";
|
37
|
+
value += "[SpecialPropertySplitter ";
|
38
|
+
value += "splitValues:"+splitValues.toString();
|
39
|
+
value += ", ";
|
40
|
+
value += "parameters:"+parameters.toString();
|
41
|
+
value += "]";
|
42
|
+
return value;
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
}
|
@@ -0,0 +1,227 @@
|
|
1
|
+
/**
|
2
|
+
* The tween list object. Stores all of the properties and information that pertain to individual tweens.
|
3
|
+
*
|
4
|
+
* @author Nate Chatellier, Zeh Fernando
|
5
|
+
* @version 1.0.4
|
6
|
+
*/
|
7
|
+
import caurina.transitions.AuxFunctions;
|
8
|
+
|
9
|
+
class caurina.transitions.TweenListObj {
|
10
|
+
|
11
|
+
public var scope :Object; // Object affected by this tweening
|
12
|
+
public var properties :Object; // List of properties that are tweened (PropertyInfoObj instances)
|
13
|
+
// .valueStart :Number // Initial value of the property
|
14
|
+
// .valueComplete :Number // The value the property should have when completed
|
15
|
+
public var timeStart :Number; // Time when this tweening should start
|
16
|
+
public var timeComplete :Number; // Time when this tweening should end
|
17
|
+
public var useFrames :Boolean; // Whether or not to use frames instead of time
|
18
|
+
public var transition :Function; // Equation to control the transition animation
|
19
|
+
public var transitionParams :Object; // Additional parameters for the transition
|
20
|
+
public var onStart :Function; // Function to be executed on the object when the tween starts (once)
|
21
|
+
public var onUpdate :Function; // Function to be executed on the object when the tween updates (several times)
|
22
|
+
public var onComplete :Function; // Function to be executed on the object when the tween completes (once)
|
23
|
+
public var onOverwrite :Function; // Function to be executed on the object when the tween is overwritten
|
24
|
+
public var onError :Function; // Function to be executed if an error is thrown when tweener exectues a callback (onComplete, onUpdate etc)
|
25
|
+
public var onStartParams :Array; // Array of parameters to be passed for the event
|
26
|
+
public var onUpdateParams :Array; // Array of parameters to be passed for the event
|
27
|
+
public var onCompleteParams :Array; // Array of parameters to be passed for the event
|
28
|
+
public var onOverwriteParams :Array; // Array of parameters to be passed for the event
|
29
|
+
public var onStartScope :Object; // Scope in which the event function is ran
|
30
|
+
public var onUpdateScope :Object; // Scope in which the event function is ran
|
31
|
+
public var onCompleteScope :Object; // Scope in which the event function is ran
|
32
|
+
public var onOverwriteScope :Object; // Scope in which the event function is ran
|
33
|
+
public var onErrorScope :Object; // Scope in which the event function is ran
|
34
|
+
public var rounded :Boolean; // Use rounded values when updating
|
35
|
+
public var isPaused :Boolean; // Whether or not this tween is paused
|
36
|
+
public var timePaused :Number; // Time when this tween was paused
|
37
|
+
public var isCaller :Boolean; // Whether or not this tween is a "caller" tween
|
38
|
+
public var count :Number; // Number of times this caller should be called
|
39
|
+
public var timesCalled :Number; // How many times the caller has already been called ("caller" tweens only)
|
40
|
+
public var waitFrames :Boolean; // Whether or not this caller should wait at least one frame for each call execution ("caller" tweens only)
|
41
|
+
public var skipUpdates :Number; // How many updates should be skipped (default = 0; 1 = update-skip-update-skip...)
|
42
|
+
public var updatesSkipped :Number; // How many updates have already been skipped
|
43
|
+
public var hasStarted :Boolean; // Whether or not this tween has already started
|
44
|
+
|
45
|
+
// ==================================================================================================================================
|
46
|
+
// CONSTRUCTOR function -------------------------------------------------------------------------------------------------------------
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Initializes the basic TweenListObj
|
50
|
+
*
|
51
|
+
* @param p_scope Object Object affected by this tweening
|
52
|
+
* @param p_timeStart Number Time when this tweening should start
|
53
|
+
* @param p_timeComplete Number Time when this tweening should end
|
54
|
+
* @param p_useFrames Boolean Whether or not to use frames instead of time
|
55
|
+
* @param p_transition Function Equation to control the transition animation
|
56
|
+
*/
|
57
|
+
function TweenListObj(p_scope:Object, p_timeStart:Number, p_timeComplete:Number, p_useFrames:Boolean, p_transition:Function, p_transitionParams:Object) {
|
58
|
+
scope = p_scope;
|
59
|
+
timeStart = p_timeStart;
|
60
|
+
timeComplete = p_timeComplete;
|
61
|
+
useFrames = p_useFrames;
|
62
|
+
transition = p_transition;
|
63
|
+
transitionParams = p_transitionParams;
|
64
|
+
|
65
|
+
// Other default information
|
66
|
+
properties = new Object();
|
67
|
+
isPaused = false;
|
68
|
+
timePaused = undefined;
|
69
|
+
isCaller = false;
|
70
|
+
updatesSkipped = 0;
|
71
|
+
timesCalled = 0;
|
72
|
+
skipUpdates = 0;
|
73
|
+
hasStarted = false;
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
// ==================================================================================================================================
|
78
|
+
// OTHER functions ------------------------------------------------------------------------------------------------------------------
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Clones this tweening and returns the new TweenListObj
|
82
|
+
*
|
83
|
+
* @param omitEvents Boolean Whether or not events such as onStart (and its parameters) should be omitted
|
84
|
+
* @return TweenListObj A copy of this object
|
85
|
+
*/
|
86
|
+
public function clone(omitEvents:Boolean):TweenListObj {
|
87
|
+
var nTween:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
|
88
|
+
nTween.properties = new Object();
|
89
|
+
for (var pName:String in properties) {
|
90
|
+
nTween.properties[pName] = properties[pName].clone();
|
91
|
+
}
|
92
|
+
nTween.skipUpdates = skipUpdates;
|
93
|
+
nTween.updatesSkipped = updatesSkipped;
|
94
|
+
if (!omitEvents) {
|
95
|
+
nTween.onStart = onStart;
|
96
|
+
nTween.onUpdate = onUpdate;
|
97
|
+
nTween.onComplete = onComplete;
|
98
|
+
nTween.onOverwrite = onOverwrite;
|
99
|
+
nTween.onError = onError;
|
100
|
+
nTween.onStartParams = onStartParams;
|
101
|
+
nTween.onUpdateParams = onUpdateParams;
|
102
|
+
nTween.onCompleteParams = onCompleteParams;
|
103
|
+
nTween.onOverwriteParams = onOverwriteParams;
|
104
|
+
nTween.onStartScope = onStartScope;
|
105
|
+
nTween.onUpdateScope = onUpdateScope;
|
106
|
+
nTween.onCompleteScope = onCompleteScope;
|
107
|
+
nTween.onOverwriteScope = onOverwriteScope;
|
108
|
+
nTween.onErrorScope = onErrorScope;
|
109
|
+
}
|
110
|
+
nTween.rounded = rounded;
|
111
|
+
nTween.isPaused = isPaused;
|
112
|
+
nTween.timePaused = timePaused;
|
113
|
+
nTween.isCaller = isCaller;
|
114
|
+
nTween.count = count;
|
115
|
+
nTween.timesCalled = timesCalled;
|
116
|
+
nTween.waitFrames = waitFrames;
|
117
|
+
nTween.hasStarted = hasStarted;
|
118
|
+
|
119
|
+
return nTween;
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Returns this object described as a String.
|
124
|
+
*
|
125
|
+
* @return String The description of this object.
|
126
|
+
*/
|
127
|
+
public function toString():String {
|
128
|
+
var returnStr:String = "\n[TweenListObj ";
|
129
|
+
returnStr += "scope:" + String(scope);
|
130
|
+
returnStr += ", properties:";
|
131
|
+
var isFirst:Boolean = true;
|
132
|
+
for (var i:String in properties) {
|
133
|
+
if (!isFirst) returnStr += ",";
|
134
|
+
returnStr += "[name:"+properties[i].name;
|
135
|
+
returnStr += ",valueStart:"+properties[i].valueStart;
|
136
|
+
returnStr += ",valueComplete:"+properties[i].valueComplete;
|
137
|
+
returnStr += "]";
|
138
|
+
isFirst = false;
|
139
|
+
}
|
140
|
+
returnStr += ", timeStart:" + String(timeStart);
|
141
|
+
returnStr += ", timeComplete:" + String(timeComplete);
|
142
|
+
returnStr += ", useFrames:" + String(useFrames);
|
143
|
+
returnStr += ", transition:" + String(transition);
|
144
|
+
returnStr += ", transitionParams:" + String(transitionParams);
|
145
|
+
|
146
|
+
if (skipUpdates) returnStr += ", skipUpdates:" + String(skipUpdates);
|
147
|
+
if (updatesSkipped) returnStr += ", updatesSkipped:" + String(updatesSkipped);
|
148
|
+
|
149
|
+
if (onStart) returnStr += ", onStart:" + String(onStart);
|
150
|
+
if (onUpdate) returnStr += ", onUpdate:" + String(onUpdate);
|
151
|
+
if (onComplete) returnStr += ", onComplete:" + String(onComplete);
|
152
|
+
if (onOverwrite) returnStr += ", onOverwrite:" + String(onOverwrite);
|
153
|
+
if (onError) returnStr += ", onError:" + String(onError);
|
154
|
+
|
155
|
+
if (onStartParams) returnStr += ", onStartParams:" + String(onStartParams);
|
156
|
+
if (onUpdateParams) returnStr += ", onUpdateParams:" + String(onUpdateParams);
|
157
|
+
if (onCompleteParams) returnStr += ", onCompleteParams:" + String(onCompleteParams);
|
158
|
+
if (onOverwriteParams) returnStr += ", onOverwriteParams:" + String(onOverwriteParams);
|
159
|
+
|
160
|
+
if (onStartScope) returnStr += ", onStartScope:" + String(onStartScope);
|
161
|
+
if (onUpdateScope) returnStr += ", onUpdateScope:" + String(onUpdateScope);
|
162
|
+
if (onCompleteScope) returnStr += ", onCompleteScope:" + String(onCompleteScope);
|
163
|
+
if (onOverwriteScope) returnStr += ", onOverwriteScope:" + String(onOverwriteScope);
|
164
|
+
if (onErrorScope) returnStr += ", onErrorScope:" + String(onErrorScope);
|
165
|
+
|
166
|
+
if (rounded) returnStr += ", rounded:" + String(rounded);
|
167
|
+
if (isPaused) returnStr += ", isPaused:" + String(isPaused);
|
168
|
+
if (timePaused) returnStr += ", timePaused:" + String(timePaused);
|
169
|
+
if (isCaller) returnStr += ", isCaller:" + String(isCaller);
|
170
|
+
if (count) returnStr += ", count:" + String(count);
|
171
|
+
if (timesCalled) returnStr += ", timesCalled:" + String(timesCalled);
|
172
|
+
if (waitFrames) returnStr += ", waitFrames:" + String(waitFrames);
|
173
|
+
if (hasStarted) returnStr += ", hasStarted:" + String(hasStarted);
|
174
|
+
|
175
|
+
returnStr += "]\n";
|
176
|
+
return returnStr;
|
177
|
+
}
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Checks if p_obj "inherits" properties from other objects, as set by the "base" property. Will create a new object, leaving others intact.
|
181
|
+
* o_bj.base can be an object or an array of objects. Properties are collected from the first to the last element of the "base" filed, with higher
|
182
|
+
* indexes overwritting smaller ones. Does not modify any of the passed objects, but makes a shallow copy of all properties.
|
183
|
+
*
|
184
|
+
* @param p_obj Object Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects
|
185
|
+
* @return Object A new object with all properties from the p_obj and p_obj.base.
|
186
|
+
*/
|
187
|
+
|
188
|
+
public static function makePropertiesChain(p_obj : Object) : Object{
|
189
|
+
// Is this object inheriting properties from another object?
|
190
|
+
var baseObject : Object = p_obj.base;
|
191
|
+
if(baseObject){
|
192
|
+
// object inherits. Are we inheriting from an object or an array
|
193
|
+
var chainedObject : Object = {};
|
194
|
+
var chain : Object;
|
195
|
+
if (baseObject instanceof Array){
|
196
|
+
// Inheritance chain is the base array
|
197
|
+
chain = [];
|
198
|
+
// make a shallow copy
|
199
|
+
for (var k : Number = 0 ; k< baseObject.length; k++) chain.push(baseObject[k]);
|
200
|
+
}else{
|
201
|
+
// Only one object to be added to the array
|
202
|
+
chain = [baseObject];
|
203
|
+
}
|
204
|
+
// add the final object to the array, so it's properties are added last
|
205
|
+
chain.push(p_obj);
|
206
|
+
var currChainObj : Object;
|
207
|
+
// Loops through each object adding it's property to the final object
|
208
|
+
var len : Number = chain.length;
|
209
|
+
for(var i : Number = 0; i < len ; i ++){
|
210
|
+
if(chain[i]["base"]){
|
211
|
+
// deal with recursion: watch the order! "parent" base must be concatenated first!
|
212
|
+
currChainObj = AuxFunctions.concatObjects( makePropertiesChain(chain[i]["base"] ), chain[i]);
|
213
|
+
}else{
|
214
|
+
currChainObj = chain[i] ;
|
215
|
+
}
|
216
|
+
chainedObject = AuxFunctions.concatObjects(chainedObject, currChainObj );
|
217
|
+
}
|
218
|
+
if( chainedObject["base"]){
|
219
|
+
delete chainedObject["base"];
|
220
|
+
}
|
221
|
+
return chainedObject;
|
222
|
+
}else{
|
223
|
+
// No inheritance, just return the object it self
|
224
|
+
return p_obj;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|