You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(109) |
Oct
(25) |
Nov
(6) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(263) |
Feb
(107) |
Mar
(62) |
Apr
(25) |
May
(39) |
Jun
(15) |
Jul
(19) |
Aug
(1) |
Sep
(54) |
Oct
(80) |
Nov
(61) |
Dec
|
| 2007 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
(22) |
Jun
(36) |
Jul
|
Aug
(3) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
(5) |
3
(5) |
4
(8) |
5
(3) |
6
(5) |
7
(17) |
|
8
(5) |
9
(8) |
10
(3) |
11
|
12
(10) |
13
(1) |
14
(8) |
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
|
29
|
30
(2) |
31
|
|
|
|
|
|
From: <aci...@us...> - 2006-10-30 21:55:35
|
Revision: 606
http://svn.sourceforge.net/asapframework/?rev=606&view=rev
Author: acidcats
Date: 2006-10-30 13:55:24 -0800 (Mon, 30 Oct 2006)
Log Message:
-----------
Added documentation to management.lang package
Modified Paths:
--------------
trunk/asapframework/org/asapframework/management/lang/IMultiLanguageTextContainer.as
trunk/asapframework/org/asapframework/management/lang/ItemData.as
trunk/asapframework/org/asapframework/management/lang/LanguageManager.as
trunk/asapframework/org/asapframework/management/lang/MultiLanguageClipData.as
trunk/asapframework/org/asapframework/management/lang/MultiLanguageTextContainer.as
Modified: trunk/asapframework/org/asapframework/management/lang/IMultiLanguageTextContainer.as
===================================================================
--- trunk/asapframework/org/asapframework/management/lang/IMultiLanguageTextContainer.as 2006-10-30 16:00:14 UTC (rev 605)
+++ trunk/asapframework/org/asapframework/management/lang/IMultiLanguageTextContainer.as 2006-10-30 21:55:24 UTC (rev 606)
@@ -18,7 +18,8 @@
import org.asapframework.management.lang.ItemData;
/**
-@author stephan.bezoen
+Interface to be implemented by any class that wishes to add itself to the LanguageManager.
+This interface provides two functions that the LanguageManager expects.
*/
interface org.asapframework.management.lang.IMultiLanguageTextContainer {
Modified: trunk/asapframework/org/asapframework/management/lang/ItemData.as
===================================================================
--- trunk/asapframework/org/asapframework/management/lang/ItemData.as 2006-10-30 16:00:14 UTC (rev 605)
+++ trunk/asapframework/org/asapframework/management/lang/ItemData.as 2006-10-30 21:55:24 UTC (rev 606)
@@ -14,10 +14,11 @@
limitations under the License.
*/
-// ASAP classes
-
/**
-@author stephan.bezoen
+ValueObject class that holds data for a text item.
+Classes that implement {@link IMultiLanguageTextContainer} get this type of data from the LanguageManager.
+Basic info contained in this class is the text and the id by which it is referenced.
+Optional info are offset values for changing textfields.
*/
class org.asapframework.management.lang.ItemData {
Modified: trunk/asapframework/org/asapframework/management/lang/LanguageManager.as
===================================================================
--- trunk/asapframework/org/asapframework/management/lang/LanguageManager.as 2006-10-30 16:00:14 UTC (rev 605)
+++ trunk/asapframework/org/asapframework/management/lang/LanguageManager.as 2006-10-30 21:55:24 UTC (rev 606)
@@ -18,19 +18,100 @@
import org.asapframework.events.Dispatcher;
import org.asapframework.events.Event;
import org.asapframework.events.EventDelegate;
+import org.asapframework.management.lang.IMultiLanguageTextContainer;
+import org.asapframework.management.lang.ItemData;
+import org.asapframework.management.lang.MultiLanguageClipData;
+import org.asapframework.util.debug.Log;
import org.asapframework.util.xml.XML2Object;
import org.asapframework.util.xml.XMLEvent;
import org.asapframework.util.xml.XMLLoader;
-import org.asapframework.management.lang.IMultiLanguageTextContainer;
-import org.asapframework.management.lang.ItemData;
-import org.asapframework.management.lang.MultiLanguageClipData;
+/**
+Class for managing language dependencies in an application.
+For text, the language dependent texts are expected to be in an xml per language, with the following structure:
+<texts>
+ <text id="1">Hello World</text>
+ <text id="2" w="10">Hello World wider</text>
+ <text id="3" x="50">Hello World shifted to the right</text>
+ <text id="4"><[!CDATA[>>>Hello World<<<]]></text>
+</texts>
+The 'id' attribute is mandatory, and has to be a number. Attributes 'x', 'y' and 'w' are offsets to be applied to textfields, for the x-position, y-position and width respectively. These are optional.
+In case the text contains xml characters, the text has to be wrapped in a <!CDATA[[]]> tag.
+The id is expected to be unique. When it isn't, the last item is taken.
-/**
-@author stephan.bezoen
+The xml file containing the language dependent texts has to be loaded with the method {@link #loadXML}.
+When loaded and parsed, the LanguageManager sends an event of type LanguageManager.EVENT_LOADED. Subscribe to this event if you wish to be notified.
+No event is sent when the loading fails, only a Log message of level ERROR is output.
+
+Once an xml file has been loaded, data is available by id through {@link #getTextByID} and {@link #getDataByID}. Since the LanguageManager is a Singleton, the language dependent data is available throughout your application.
+
+However, the LanguageManager also contains a mechanism for automatic assignment of data. To use this functionality, use the provided class {@link MultiLanguageTextContainer}, or write your own implementation of {@link IMultiLanguageTextContainer}.
+When writing your own class, allow for a way to determine the id of the text that is to be used by a specific instance for your class. In case of the MultiLanguageTextContainer class, this id is retrieved from the name of the movieclip instance to which the class is linked, by taking everything after the last underscore and converting to a number. So "myText_1" gets the text with id=1.
+Once the id is known inside your class, add the instance to the LanguageManager with {@link #addContainer}, providing the id and the instance itself as parameters. If data has been loaded, it is provided to the instance immediately. Whenever new data is loaded, the LanguageManager calls "setData" on each instance that was added, thereby updating language dependent text instantaneously.
+A good spot to add an instance to the LanguageManager is in its onLoad() function. Make sure to remove it again in its onUnload() function, to allow for proper memory management. This also makes sure that the instance keeps its text when subject to animation key frames.
+Instances can share the same id, and thereby have the same text.
+
+By default, the LanguageManager returns an empty string (or provides an empty string in the data) when a requested id is not found.
+This has two drawbacks:
+<ul><li>The textfield becomes effectively invisible since there is no text in it</li>
+<li>Formatting of the textfield (such as weight or alignment) may be lost when the textfield is cleared</li></ul>
+To allow for easier debugging, the flag {@link generateDebugText} can be set. If an unknown id is requested, the returned text will be ">> id = #id", where #id is replaced with the actually requested id. This makes it easier to find missing texts from the xml files.
+
+<b>Performance note</b>: The LanguageManager stores texts and containers in Arrays, without any sorting. It may be necessary to find more intricate lookup algorithms when dealing with large numbers of texts and/or containers.
+
+@Examples
+<ul>
+<li>Loading an xml file into the LanguageManager, specifying a language code to be used in determining the name of the xml file to be loaded.
+<code>
+// @param inCode: 2-letter ISO language code; will be added to filename. Example: with parameter "en" the file "texts_en.xml" will be loaded.
+private function loadLanguage (inCode:String) : Void {
+ var lm:LanguageManager = LanguageManager.getInstance();
+ lm.addEventListener(LanguageManager.EVENT_LOADED, EventDelegate.create(this, handleLanguageLoaded);
+ lm.loadXML("../xml/texts_" + inCode + ".xml");
+}
+
+private function handleLanguageLoaded () : Void {
+ Log.debug("handleLanguageLoaded: Language file loaded.", toString());
+}
+</code>
+</li>
+
+<li>Assigning a text to a textfield manually from anywhere in your code:
+<code>myTextfield.text = LanguageManager.getInstance().getTextByID(23);</code>
+</li>
+
+<li>A class that gets a random text from the first 10 texts of the LanguageManager each time it is loaded:
+<code>
+class MyText extends MovieClip implements IMultiLanguageTextContainer {
+ private var mID:Number;
+ private var myTextField:TextField;
+
+ public function setData (inData : ItemData) : Void {
+ setText(inData.text);
+ }
+
+ public function setText (inText:String) : Void {
+ myTextField.text = inText;
+ }
+
+ private function onLoad () : Void {
+ mID = Math.floor(10 * Math.random());
+
+ LanguageManager.getInstance().addContainer(mID, this);
+ }
+
+ private function onUnload () : Void {
+ LanguageManager.getInstance().removeContainer(this);
+ }
+}
+</code>
+</li>
+</ul>
*/
class org.asapframework.management.lang.LanguageManager extends Dispatcher {
+ /** The event sent when the language xml has been loaded and parsed */
+ public static var EVENT_LOADED:String = "onLanguageLoaded";
private var textDataItems:Array; // of ItemData objects
private var textClips:Array; // of MultiLanguageClipData objects
@@ -41,27 +122,12 @@
// singleton instance
private static var instance:LanguageManager = null;
private static var XML_NAME:String = "languagexml";
+
+ private var mURL : String;
- // The event sent when the language xml has been loaded and parsed
- public static var EVENT_LOADED:String = "onLanguageLoaded";
/**
- Private singleton constructor.
- */
- private function LanguageManager() {
-
- super();
-
- // XML loader
- mXMLLoader = XMLLoader.getInstance();
- mXMLLoader.addEventListener(XMLEvent.ON_LOADED, EventDelegate.create(this,onLanguageLoaded));
-
- textDataItems = new Array();
- textClips = new Array();
- }
-
- /**
@return The singleton instance of the LanguageManager
*/
public static function getInstance () : LanguageManager {
@@ -72,23 +138,29 @@
}
/**
- Loads language XML
+ Load language XML
+ @param inURL: full path of the xml file to be loaded
*/
public function loadXML ( inURL:String ) : Void {
+ mURL = inURL;
// start loading
mXMLLoader.load(inURL,LanguageManager.XML_NAME, true);
}
/**
- Flag indicates whether items show their id as text when no text is found in the xml
+ Flag indicates whether items show their id as text when no text is found in the xml. When false, an empty string is returned when no text is found.
*/
public function set generateDebugText (inGenerate:Boolean) : Void {
mGenerateDebugText = inGenerate;
}
/**
- Adds a multi-laguage container to the LanguageManager
+ Add a multi-laguage container to the LanguageManager.
+ If data has been loaded, the container will receive its data immediately.
+ If the container had been added already, it will not be added again.
+ @param inID: the id to be associated with the container
+ @param inContainer: instance of a class implementing {@link IMultiLanguageTextContainer}
*/
public function addContainer (inID:Number, inContainer:IMultiLanguageTextContainer) : Void {
@@ -100,7 +172,8 @@
}
/**
- Removes a multi-laguage container from the LanguageManager
+ Remove a multi-laguage container from the LanguageManager
+ @param inContainer: previously added instance of a class implementing {@link IMultiLanguageTextContainer}
*/
public function removeContainer (inContainer:IMultiLanguageTextContainer) : Void {
var index:Number = getClipDataIndexByContainer(inContainer);
@@ -111,7 +184,8 @@
/**
Add text for a specific ID to the language manager.
- Set the text in any textfield with that id
+ Set the text in any IMultiLanguageTextContainer instance associated with that id.
+ @param inData: {@link ItemData} instance containing necessary data.
*/
public function addText (inData:ItemData) : Void {
@@ -127,14 +201,18 @@
}
/**
-
+ Retrieve a text
+ @param inID: the id for the text to be found
+ @return the text if found, an empty string if generateDebugText is set to false, or '>> id = ' + id if generateDebugText is set to true
*/
public function getTextByID (inID:Number) : String {
return getDataByID(inID).text;
}
/**
-
+ Retrieve text data
+ @param inID: the id for the text to be found
+ @return the text data with the right text if found, with an empty string if generateDebugText is set to false, or with '>> id = ' + id if generateDebugText is set to true
*/
public function getDataByID (inID:Number) : ItemData {
if (textDataItems[inID] == undefined) {
@@ -149,7 +227,7 @@
}
/**
- Find the data block for the specified movieclip
+ Find the data block for the specified {@link IMultiLanguageTextContainer} instance
@return the data block for the clip, or null if none was found
*/
private function getClipDataByContainer (inContainer:IMultiLanguageTextContainer) : MultiLanguageClipData {
@@ -162,7 +240,7 @@
}
/**
- Find the index of the data block for the specified movieclip
+ Find the index of the data block for the specified {@link IMultiLanguageTextContainer} instance
@return the index of the data block, or -1 if none was found
*/
private function getClipDataIndexByContainer (inContainer:IMultiLanguageTextContainer) : Number {
@@ -209,9 +287,10 @@
}
/**
- Triggered by XMLLoader.
+ Handle event from the XMLLoader that the XML file has been loaded.
+ @param e: data for the event
*/
- private function onLanguageLoaded ( e:XMLEvent ) : Void {
+ private function handleLanguageLoaded ( e:XMLEvent ) : Void {
// was language file loaded?
if (e.name == LanguageManager.XML_NAME) {
@@ -224,6 +303,32 @@
}
/**
+ Handle error event from the XMLLoader
+ */
+ private function handleLanguageLoadError (e:XMLEvent) : Void {
+ if (e.name == LanguageManager.XML_NAME) {
+ Log.error("Error loading xml at url: " + mURL, toString());
+ }
+ }
+
+ /**
+ Private singleton constructor.
+ */
+ private function LanguageManager() {
+
+ super();
+
+ // XML loader
+ mXMLLoader = XMLLoader.getInstance();
+ mXMLLoader.addEventListener(XMLEvent.ON_LOADED, EventDelegate.create(this,handleLanguageLoaded));
+ mXMLLoader.addEventListener(XMLEvent.ON_ERROR, EventDelegate.create(this,handleLanguageLoadError));
+ mXMLLoader.addEventListener(XMLEvent.ON_TIMEOUT, EventDelegate.create(this,handleLanguageLoadError));
+
+ textDataItems = new Array();
+ textClips = new Array();
+ }
+
+ /**
@return Package and class name.
*/
public function toString () : String {
Modified: trunk/asapframework/org/asapframework/management/lang/MultiLanguageClipData.as
===================================================================
--- trunk/asapframework/org/asapframework/management/lang/MultiLanguageClipData.as 2006-10-30 16:00:14 UTC (rev 605)
+++ trunk/asapframework/org/asapframework/management/lang/MultiLanguageClipData.as 2006-10-30 21:55:24 UTC (rev 606)
@@ -19,7 +19,7 @@
/**
-@author stephan.bezoen
+Internal ValueObject class used by the LanguageManager to store information on text containers.
*/
class org.asapframework.management.lang.MultiLanguageClipData {
@@ -28,7 +28,9 @@
public var cnt:IMultiLanguageTextContainer;
/**
-
+ Constructor
+ @param inID: the id of the text assigned to the container
+ @param inContainer: instance of a class implementing {@link IMultiLanguageTextContainer}
*/
public function MultiLanguageClipData (inID:Number, inContainer:IMultiLanguageTextContainer) {
id = inID;
Modified: trunk/asapframework/org/asapframework/management/lang/MultiLanguageTextContainer.as
===================================================================
--- trunk/asapframework/org/asapframework/management/lang/MultiLanguageTextContainer.as 2006-10-30 16:00:14 UTC (rev 605)
+++ trunk/asapframework/org/asapframework/management/lang/MultiLanguageTextContainer.as 2006-10-30 21:55:24 UTC (rev 606)
@@ -20,7 +20,24 @@
import org.asapframework.management.lang.LanguageManager;
/**
-@author stephan.bezoen
+Basic implementation of {@link IMultiLanguageTextContainer} to be used with the {@link LanguageManager} to provide language dependent texts in an application.
+
+To use this class, perform the following steps:
+<ol>
+<li>Create a new movieclip in the library</li>
+<li>Give it a significant name containing font information, p.e. "arial 11px center"; this allows for easy reuse of containers</li>
+<li>Link it to the class org.asapframework.management.lang.MultiLanguageTextContainer</li>
+<li>Inside the movieclip, create a dynamic textfield. Name it "tf_txt"</li>
+<li>Set font embedding as necessary</li>
+<li>Place instances of the library item on the stage where necessary.</li>
+<li>Name the instances whatever you like, as long as the name ends with underscore, followed by the integer id of the text to be associated with the instance. P.e.: "helloWorld_1"</li>
+<li>In your application, load an xml file containing texts into the LanguageManager: <code>LanguageManager.getInstance().loadXML("texts_en.xml");</code></li>
+</ol>
+
+This class can be used either
+<ul><li>directly,</li>
+<li>as base class for further extension or </li>
+<li>as example of how to implement the {@link IMultiLanguageTextContainer} interface.</li></ul>
*/
class org.asapframework.management.lang.MultiLanguageTextContainer extends MovieClip implements IMultiLanguageTextContainer {
@@ -32,9 +49,9 @@
private var base_w:Number;
/**
- *
+ Handle MovieClip onLoad event
*/
- public function onLoad () : Void {
+ private function onLoad () : Void {
base_x = tf_txt._x;
base_y = tf_txt._y;
base_w = tf_txt._width;
@@ -45,14 +62,16 @@
}
/**
- *
+ Handle MovieClip onUnload event
*/
- public function onUnload () : Void {
+ private function onUnload () : Void {
LanguageManager.getInstance().removeContainer(this);
}
/**
- *
+ IMultiLanguageTextContainer implementation
+ Set the data for the container
+ @param inData: the object containing the data
*/
public function setData (inData : ItemData) : Void {
setText(inData.text);
@@ -63,7 +82,9 @@
}
/**
- *
+ IMultiLanguageTextContainer implementation
+ Set the text for the container
+ @param inText: the string containing the text
*/
public function setText (inText:String) : Void {
var tf:TextFormat = tf_txt.getTextFormat();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aci...@us...> - 2006-10-30 16:00:35
|
Revision: 605
http://svn.sourceforge.net/asapframework/?rev=605&view=rev
Author: acidcats
Date: 2006-10-30 08:00:14 -0800 (Mon, 30 Oct 2006)
Log Message:
-----------
Removed 'break' in addText to allow for several containers to receive same text. Some optimization/rework might be necessary for large projects.
Modified Paths:
--------------
trunk/asapframework/org/asapframework/management/lang/LanguageManager.as
Modified: trunk/asapframework/org/asapframework/management/lang/LanguageManager.as
===================================================================
--- trunk/asapframework/org/asapframework/management/lang/LanguageManager.as 2006-10-14 23:05:53 UTC (rev 604)
+++ trunk/asapframework/org/asapframework/management/lang/LanguageManager.as 2006-10-30 16:00:14 UTC (rev 605)
@@ -122,7 +122,6 @@
var md:MultiLanguageClipData = MultiLanguageClipData(textClips[i]);
if (md.id == inData.id) {
md.cnt.setData(inData);
- break;
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-14 23:06:14
|
Revision: 604
http://svn.sourceforge.net/asapframework/?rev=604&view=rev
Author: aclemens
Date: 2006-10-14 16:05:53 -0700 (Sat, 14 Oct 2006)
Log Message:
-----------
new unit tests
Modified Paths:
--------------
trunk/asapframework/tests/unit/UnitTester.fla
trunk/asapframework/tests/unit/includes/testlist.as
Added Paths:
-----------
trunk/asapframework/tests/unit/assets/
trunk/asapframework/tests/unit/assets/util/
trunk/asapframework/tests/unit/assets/util/loader/
trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/
trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/blue-flowerThumb.jpg
trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/orange-petals-3Thumb.jpg
trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/pinky-flowersThumb.jpg
trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/red-flower-burstThumb.jpg
trunk/asapframework/tests/unit/tests/org/asapframework/util/actionqueue/
trunk/asapframework/tests/unit/tests/org/asapframework/util/actionqueue/ActionQueueTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/loader/
trunk/asapframework/tests/unit/tests/org/asapframework/util/loader/LoaderTest.as
Modified: trunk/asapframework/tests/unit/UnitTester.fla
===================================================================
(Binary files differ)
Added: trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/blue-flowerThumb.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/blue-flowerThumb.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/orange-petals-3Thumb.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/orange-petals-3Thumb.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/pinky-flowersThumb.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/pinky-flowersThumb.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/red-flower-burstThumb.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/asapframework/tests/unit/assets/util/loader/LoaderTest/red-flower-burstThumb.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/asapframework/tests/unit/includes/testlist.as
===================================================================
--- trunk/asapframework/tests/unit/includes/testlist.as 2006-10-14 21:06:03 UTC (rev 603)
+++ trunk/asapframework/tests/unit/includes/testlist.as 2006-10-14 23:05:53 UTC (rev 604)
@@ -1,21 +1,27 @@
-
+/*
// data
org.asapframework.data.array.ArrayEnumeratorTest; // complete
org.asapframework.data.array.TraverseArrayEnumeratorTest; // complete
// util
org.asapframework.util.BooleanUtilsTest; // complete
+org.asapframework.util.FrameDelayTest; // complete
+org.asapframework.util.MovieClipUtilsTest; // complete
org.asapframework.util.NumberUtilsTest; // complete
-org.asapframework.util.StringUtilsTest; // TODO: format, capitalizeChar, capitalizeString, capitalizeWords, validateEmail
-org.asapframework.util.MovieClipUtilsTest; // complete
org.asapframework.util.PointUtilsTest; // complete
org.asapframework.util.RectangleUtilsTest; // complete
-org.asapframework.util.FrameDelayTest; // complete
+org.asapframework.util.StringUtilsTest; // TODO: format, capitalizeChar, capitalizeString, capitalizeWords, validateEmail
+// util.loader
+//org.asapframework.util.loader.LoaderTest;
+
// util.types
org.asapframework.util.types.PointTest; // complete
org.asapframework.util.types.RectangleTest; // complete
// util.watch
-org.asapframework.util.watcher.WatcherTest; // in progress
+org.asapframework.util.watcher.WatcherTest; // complete
+*/
+// util.actionqueue
+org.asapframework.util.actionqueue.ActionQueueTest; // TODO: relativeValue
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/actionqueue/ActionQueueTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/actionqueue/ActionQueueTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/actionqueue/ActionQueueTest.as 2006-10-14 23:05:53 UTC (rev 604)
@@ -0,0 +1,354 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.actionqueue.*;
+import org.asapframework.util.FrameDelay;
+import org.asapframework.events.EventDelegate;
+import org.asapframework.ui.buttons.EventButton;
+import org.asapframework.ui.buttons.EventButtonEvent;
+import org.asapframework.util.MovieClipUtils;
+
+
+class org.asapframework.util.actionqueue.ActionQueueTest extends TestCase {
+
+// private static var ALL_METHODS_CALLED_COUNT:Number = 3;
+ private static var sMethodsCalledCount:Number = 0;
+
+ private static var sTestAddAllCount:Number = 0;
+ private static var sTestAddActionAllCount:Number = 0;
+ private static var sTestAddMethodCount:Number = 0;
+ private static var sTestInsertQueueString:String = "";
+ private static var sTestInsertQueueActionsString:String = "";
+
+ private static var sDeprecatedParams:String = "";
+ private static var sAddActionParams:String = "";
+
+ private var mPauseQueue1:ActionQueue;
+ private var mPauseQueue1Button:EventButton;
+ private var mPauseQueue2:ActionQueue;
+ private var mPauseQueue2Button:EventButton;
+
+ private static var sFrameDelay:Number = 10;
+
+ public function testAll () : Void {
+
+ // deprecated methods
+ {
+ pause();
+ new FrameDelay(this, performTestDeprecated, [], sFrameDelay );
+ sFrameDelay += 2;
+ resume();
+ new FrameDelay(this, evaluateTestAddAll, [4, true, "ABCD"], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ // addAction
+ {
+ pause();
+ new FrameDelay(this, performTestAddAction, [], sFrameDelay );
+ sFrameDelay += 2;
+ resume();
+ new FrameDelay(this, evaluateTestAddActionAll, [5, true, "KLMNO"], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ // test addAction before and after run
+ {
+ pause();
+ new FrameDelay(this, performTestAddActionBeforeAndAfter, [], sFrameDelay );
+ sFrameDelay += 2;
+ resume();
+ new FrameDelay(this, evaluateTestAddMethod2, [3, true], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ // insertQueue
+ {
+ pause();
+ new FrameDelay(this, performTestInsertQueue, [], sFrameDelay );
+ sFrameDelay += 10;
+ resume();
+ new FrameDelay(this, evaluateTestInsertQueue, ["ABECD", true], sFrameDelay );
+ sFrameDelay += 10;
+ }
+ // insertQueue actions
+ {
+ pause();
+ new FrameDelay(this, performTestInsertQueueActions, [], sFrameDelay );
+ sFrameDelay += 2;
+ resume();
+ new FrameDelay(this, evaluateTestInsertQueueActions, ["ABCDE", true], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ // name
+ {
+ new FrameDelay(this, performTestName, [], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ // clear
+ {
+ new FrameDelay(this, performTestClear, [], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ // quit
+ {
+ new FrameDelay(this, performTestQuit, [], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ // events on quit
+ {
+ pause();
+ var mc:MovieClip = _level0.createEmptyMovieClip("testquit", _level0.getNextHighestDepth());
+ MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
+ var queue:ActionQueue = new ActionQueue( "test events on quit" );
+ queue.addEventListener(ActionQueueEvent.QUEUE_QUIT, this);
+ queue.addEventListener(ActionQueueEvent.QUEUE_FINISHED, this);
+ queue.addAction(AQFade.fade, mc, 1, 100, 0);
+ queue.run();
+ }
+
+ // pause and continue
+ {
+ pause();
+ new FrameDelay(this, performTestPauseAndContinue, [], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ /*
+ // pause and skip
+ {
+ pause();
+ new FrameDelay(this, performTestPauseAndSkip, [], sFrameDelay );
+ sFrameDelay += 2;
+ }
+ */
+ }
+
+ // PRIVATE METHODS
+
+ private function performTestDeprecated () : Void {
+ var queue:ActionQueue = new ActionQueue("ActionQueueTest all deprecated");
+ queue.addFunction(this.performTestAddFunction, "A");
+ queue.addMethod(this, "performTestAddMethod1", "B");
+ queue.addAQMethod(performTestAddAQMethod, "C");
+ queue.addInAQMethod(performTestAddInAQMethod, "D");
+ queue.run();
+ }
+
+ private function performTestAddAction () : Void {
+ var queue:ActionQueue = new ActionQueue("ActionQueueTest all addAction");
+ queue.addAction( this.performAddAction, true, "K" );
+ var ref = this;
+ queue.addAction( function() {
+ ref.performAddAction(true, "L");
+ } );
+ queue.addAction( this, "performAddAction", true, "M" );
+ queue.addAction( this, performAddAction, true, "N" );
+ queue.addInAction( performAddAction, true, "O" );
+ queue.run();
+ }
+
+ private function performTestAddActionBeforeAndAfter () : Void {
+ var queue:ActionQueue = new ActionQueue("ActionQueueTest");
+ queue.addAction( this, performTestAddMethod2, true, "P" ); // increment by 1
+ queue.addAction( this, "performTestAddMethod2", true, "Q" ); // increment by 1
+ queue.addAction( this, "evaluateTestAddMethod2", 2, true );
+ queue.run(true);
+ queue.addAction( this, "performTestAddMethod2", true, "R" ); // increment by 1
+ queue.addAction( this, "evaluateTestAddMethod2", 3, true );
+ queue.run();
+ queue.addAction( this, "performTestAddMethod2", true, "S" ); // increment by 1, but this should fail, so the total amount is still 3
+ queue.run();
+ }
+
+ private function performTestInsertQueue () : Void {
+ var queue1:ActionQueue = new ActionQueue("ActionQueueTest insertQueue first");
+ queue1.addAction( this, "addToTestInsertQueueString", "A" );
+ queue1.addAction( this, "addToTestInsertQueueString", "B" );
+
+ var queue2:ActionQueue = new ActionQueue("ActionQueueTest insertQueue second").addPause(.01).addMethod( this, "addToTestInsertQueueString", "C" ).addMethod( this, "addToTestInsertQueueString", "D" );
+
+ queue1.insertQueue( queue2 );
+ queue1.addAction( this, "addToTestInsertQueueString", "E" );
+ queue1.run();
+ }
+
+ private function performTestInsertQueueActions () : Void {
+ var queue1:ActionQueue = new ActionQueue("ActionQueueTest insertQueue first");
+ queue1.addAction( this, "addToTestInsertQueueActionsString", "A" );
+ queue1.addAction( this, "addToTestInsertQueueActionsString", "B" );
+
+ var queue2:ActionQueue = new ActionQueue("ActionQueueTest insertQueue second").addPause(.01).addMethod( this, "addToTestInsertQueueActionsString", "C" ).addMethod( this, "addToTestInsertQueueActionsString", "D" );
+
+ queue1.insertQueueActions( queue2 );
+ queue1.addAction( this, "addToTestInsertQueueActionsString", "E" );
+ queue1.run();
+ }
+
+ private function performTestPauseAndContinue () : Void {
+ mPauseQueue1Button = EventButton(_level0.attachMovie("org.asapframework.ui.buttons.EventButton", "ActionQueueTest_EventButton 1", _level0.getNextHighestDepth()));
+ mPauseQueue1Button._x = 300;
+ mPauseQueue1Button._y = 150;
+ mPauseQueue1Button.addEventListener(EventButtonEvent.ON_RELEASE, EventDelegate.create(this, continuePausedQueue1));
+
+ mPauseQueue1 = new ActionQueue("test pause and continue");
+ mPauseQueue1.pause();
+ mPauseQueue1.run();
+ assertTrue("ActionQueueTest test pause and continue is paused", mPauseQueue1.isPaused());
+ }
+
+ private function performTestPauseAndSkip () : Void {
+ pause();
+
+ mPauseQueue2Button = EventButton(_level0.attachMovie("org.asapframework.ui.buttons.EventButton", "ActionQueueTest_EventButton 2", _level0.getNextHighestDepth()));
+ mPauseQueue2Button._x = 300;
+ mPauseQueue2Button._y = 200;
+ mPauseQueue2Button.addEventListener(EventButtonEvent.ON_RELEASE, EventDelegate.create(this, continuePausedQueue2));
+
+ mPauseQueue2 = new ActionQueue("test pause and skip");
+ mPauseQueue2.addPause(0);
+ mPauseQueue2.addAction( this, "dummy" );
+ assertTrue("ActionQueueTest test pause and skip actions length", mPauseQueue2.actions().length == 2);
+ mPauseQueue2.run();
+ assertFalse("ActionQueueTest test pause and skip not pause", mPauseQueue2.isPaused());
+ }
+
+ private function performTestName () : Void {
+ var queue:ActionQueue = new ActionQueue("some name");
+ assertTrue("ActionQueueTest test name", queue.name() == "some name");
+ }
+
+ private function performTestClear () : Void {
+ var queue:ActionQueue = new ActionQueue("clear queue");
+ queue.addAction( this, "dummy" );
+ queue.clear();
+ assertTrue("ActionQueueTest test clear actions length", queue.actions().length == 0);
+ }
+
+ private function performTestQuit () : Void {
+ var queue:ActionQueue = new ActionQueue("quit queue");
+ queue.addAction( this, "dummy" );
+ queue.quit();
+ assertTrue("ActionQueueTest test quit actions length", queue.actions() == undefined);
+ }
+
+ private function onActionQueueQuit (e:ActionQueueEvent) : Void {
+ //trace("onActionQueueQuit");
+ assertTrue("ActionQueueTest onActionQueueQuit", e != undefined);
+ }
+
+ private function onActionQueueFinished (e:ActionQueueEvent) : Void {
+ //trace("onActionQueueFinished");
+ assertTrue("ActionQueueTest onActionQueueFinished", e != undefined);
+ }
+
+ //-------------------------------------------------------------------------
+
+ private function performTestAddFunction (inValue:String) : Void {
+
+
+ sDeprecatedParams += inValue;
+ sTestAddAllCount++;
+ }
+ private function performTestAddMethod1 (inValue:String) : Void {
+
+
+ sDeprecatedParams += inValue;
+ sTestAddAllCount++;
+ }
+ private static function performTestAddAQMethod (inValue:String) : Void {
+
+
+ sDeprecatedParams += inValue;
+ sTestAddAllCount++;
+ }
+ private static function performTestAddInAQMethod (inValue:String) : Void {
+
+
+ sDeprecatedParams += inValue;
+ sTestAddAllCount++;
+ }
+ private function evaluateTestAddAll (inCount:Number, inResult:Boolean, inParams:String) : Void {
+ var result:Boolean = (inCount == sTestAddAllCount);
+ assertTrue("ActionQueueTest evaluateTestAddAll count", result == inResult);
+ assertTrue("ActionQueueTest evaluateTestAddAll params", sDeprecatedParams == inParams);
+ }
+
+ //-------------------------------------------------------------------------
+
+ private function performAddAction (inParamCheck:Boolean, inValue:String) : Void {
+
+ if (inParamCheck == undefined) return;
+ sAddActionParams += inValue;
+ sTestAddActionAllCount++;
+ }
+
+ private function evaluateTestAddActionAll (inCount:Number, inResult:Boolean, inParams:String) : Void {
+ var result:Boolean = (inCount == sTestAddActionAllCount);
+ assertTrue("ActionQueueTest evaluateTestAddActionAll count", result == inResult);
+ assertTrue("ActionQueueTest evaluateTestAddActionAll params", sAddActionParams == inParams);
+ }
+
+ //-------------------------------------------------------------------------
+
+ private function performTestAddMethod2 (inParamCheck:Boolean) : Void {
+
+ if (inParamCheck == undefined) return;
+ sTestAddMethodCount++;
+ }
+ private function evaluateTestAddMethod2 (inCount:Number, inResult:Boolean) : Void {
+ var result:Boolean = (inCount == sTestAddMethodCount);
+ assertTrue("ActionQueueTest evaluateTestAddMethod2", result == inResult);
+ }
+
+ //-------------------------------------------------------------------------
+
+ private function addToTestInsertQueueString (inString:String) : Void {
+
+ sTestInsertQueueString += inString;
+ }
+ private function evaluateTestInsertQueue (inString:String, inResult:Boolean) : Void {
+ var result:Boolean = (inString == sTestInsertQueueString);
+ assertTrue("ActionQueueTest evaluateTestInsertQueue", result == inResult);
+ }
+
+ //-------------------------------------------------------------------------
+
+ private function addToTestInsertQueueActionsString (inString:String) : Void {
+
+ sTestInsertQueueActionsString += inString;
+ }
+ private function evaluateTestInsertQueueActions (inString:String, inResult:Boolean) : Void {
+ var result:Boolean = (inString == sTestInsertQueueActionsString);
+ assertTrue("ActionQueueTest evaluateTestInsertQueueActions", result == inResult);
+ }
+
+ //-------------------------------------------------------------------------
+
+ private function continuePausedQueue1 () : Void {
+ if (mPauseQueue1 == undefined) return;
+ assertTrue("ActionQueueTest test pause and continue is busy", mPauseQueue1.isBusy());
+ mPauseQueue1.play();
+ assertFalse("ActionQueueTest test pause and continue", mPauseQueue1.isPaused());
+ removeMovieClip(mPauseQueue1Button);
+
+ performTestPauseAndSkip();
+ }
+
+ private function continuePausedQueue2 () : Void {
+ if (mPauseQueue2 == undefined) return;
+ assertTrue("ActionQueueTest continuePausedQueue2 is busy", mPauseQueue2.isBusy());
+
+ assertTrue("ActionQueueTest continuePausedQueue2 actions length 1", mPauseQueue2.actions().length == 2);
+ mPauseQueue2.skip();
+ assertFalse("ActionQueueTest continuePausedQueue2 is paused", mPauseQueue2.isPaused());
+ assertTrue("ActionQueueTest continuePausedQueue2 actions length 2", mPauseQueue2.actions().length == 2);
+ removeMovieClip(mPauseQueue2Button);
+
+ resume();
+ }
+
+ private function dummy () : Void {
+ assertTrue("ActionQueueTest continuePausedQueue2 actions length 3", mPauseQueue2.actions().length == 1);
+ }
+
+
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/loader/LoaderTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/loader/LoaderTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/loader/LoaderTest.as 2006-10-14 23:05:53 UTC (rev 604)
@@ -0,0 +1,148 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.loader.*;
+import org.asapframework.events.EventDelegate;
+
+
+class org.asapframework.util.loader.LoaderTest extends TestCase {
+
+ private static var IMAGE_DIR:String = "assets/util/loader/LoaderTest/";
+ private static var IMAGE_NAME_1:String = "blue-flowerThumb.jpg";
+ private static var IMAGE_NAME_2:String = "orange-petals-3Thumb.jpg";
+ private static var IMAGE_NAME_3:String = "pinky-flowersThumb.jpg";
+ private static var IMAGE_NAME_4:String = "red-flower-burstThumb.jpg";
+ private static var TOTAL_IMAGE_COUNT:Number = 4;
+
+ //private static var IMAGE_DIR:String = "http://asapframework.org/tests/testdata/Loader/";
+ private static var sLoadedClipsAddedNamesSimultaneously:Number = 0;
+ private static var sLoadedClipsCountSimultaneously:Number = 0;
+
+ private static var sLoadedClipsAddedNamesOneByOne:Number = 0;
+ private static var sLoadedClipsCountOneByOne:Number = 0;
+
+ private static var ALL_IMAGE_NAMES_ADDED_SIMULTANEOUSLY:Number = 1 + 2 + 3 + 4;
+ private static var ALL_IMAGE_NAMES_ADDED_ONE_BY_ONE:Number = 5 + 6 + 7 + 8;
+
+ private var mLoaderTestClip:MovieClip;
+
+
+ public function LoaderTest () {
+ super();
+ mLoaderTestClip = _level0.createEmptyMovieClip("mLoaderTestClip", _level0.getNextHighestDepth());
+ }
+
+ public function testLoadingSimultaneously () : Void {
+
+ pause();
+
+ var offset:Number = 100;
+ var x:Number = 10;
+ var y:Number = 10;
+
+ var loaderclip:MovieClip;
+
+ var loaderclip1:MovieClip = createLoaderClip("1", x, y);
+ x += offset;
+
+ var loaderclip2:MovieClip = createLoaderClip("2", x, y);
+ x += offset;
+
+ var loaderclip3:MovieClip = createLoaderClip("3", x, y);
+ x += offset;
+
+ var loaderclip4:MovieClip = createLoaderClip("4", x, y);
+ x += offset;
+
+ // load 4 images simultaneously
+ var loader:Loader = new Loader(4);
+
+ loader.addEventListener(LoaderEvent.ON_DONE, EventDelegate.create(this, handleLoadDoneSimultaneously));
+
+ loader.load( loaderclip1.image, IMAGE_DIR + IMAGE_NAME_1, "1" );
+ loader.load( loaderclip2.image, IMAGE_DIR + IMAGE_NAME_2, "2" );
+ loader.load( loaderclip3.image, IMAGE_DIR + IMAGE_NAME_3, "3" );
+ loader.load( loaderclip4.image, IMAGE_DIR + IMAGE_NAME_4, "4" );
+ }
+
+ public function performTestLoadingOneByOne () : Void {
+ pause();
+
+ var offset:Number = 100;
+ var x:Number = 10;
+ var y:Number = 110;
+
+ var loaderclip:MovieClip;
+
+ var loaderclip5:MovieClip = createLoaderClip("5", x, y);
+ x += offset;
+
+ var loaderclip6:MovieClip = createLoaderClip("6", x, y);
+ x += offset;
+
+ var loaderclip7:MovieClip = createLoaderClip("7", x, y);
+ x += offset;
+
+ var loaderclip8:MovieClip = createLoaderClip("8", x, y);
+ x += offset;
+
+ // load 4 images one by yone
+ var loader:Loader = new Loader(1);
+
+ loader.addEventListener(LoaderEvent.ON_DONE, EventDelegate.create(this, handleLoadDoneOneByOne));
+
+ loader.load( loaderclip5.image, IMAGE_DIR + IMAGE_NAME_1, "5" );
+ loader.load( loaderclip6.image, IMAGE_DIR + IMAGE_NAME_2, "6" );
+ loader.load( loaderclip7.image, IMAGE_DIR + IMAGE_NAME_3, "7" );
+ loader.load( loaderclip8.image, IMAGE_DIR + IMAGE_NAME_4, "8" );
+ }
+
+ // PRIVATE METHODS
+
+ private function createLoaderClip (inName:String, inX:Number, inY:Number) : MovieClip {
+ var loaderclip:MovieClip = mLoaderTestClip.createEmptyMovieClip("loaderclip" + inName, mLoaderTestClip.getNextHighestDepth());
+ loaderclip.createEmptyMovieClip("image", loaderclip.getNextHighestDepth());
+ loaderclip._x = inX;
+ loaderclip._y = inY;
+ trace(loaderclip._x + " " + loaderclip._y);
+ return loaderclip;
+ }
+
+ private function handleLoadDoneSimultaneously (e:LoaderEvent) : Void {
+ //trace("handleLoadDoneSimultaneously: " + e.name);
+
+ sLoadedClipsAddedNamesSimultaneously += Number(e.name);
+ sLoadedClipsCountSimultaneously++;
+ if (sLoadedClipsAddedNamesSimultaneously == ALL_IMAGE_NAMES_ADDED_SIMULTANEOUSLY) {
+ evaluateLoadedSimultaneously();
+ performTestLoadingOneByOne();
+ }
+ }
+
+ private function evaluateLoadedSimultaneously () : Void {
+ resume();
+ assertTrue("LoaderTest evaluateLoadedSimultaneously", sLoadedClipsCountSimultaneously == TOTAL_IMAGE_COUNT);
+ }
+
+ private function handleLoadDoneOneByOne (e:LoaderEvent) : Void {
+ //trace("handleLoadDoneOneByOne: " + e.name);
+
+ sLoadedClipsAddedNamesOneByOne += Number(e.name);
+ sLoadedClipsCountOneByOne++;
+ if (sLoadedClipsAddedNamesOneByOne == ALL_IMAGE_NAMES_ADDED_ONE_BY_ONE) {
+ evaluateLoadedOneByOne();
+ cleanup();
+ }
+ }
+
+ private function evaluateLoadedOneByOne () : Void {
+ resume();
+ assertTrue("LoaderTest evaluateLoadedSimultaneously", sLoadedClipsCountOneByOne == TOTAL_IMAGE_COUNT);
+ }
+
+ private function cleanup () : Void {
+ mLoaderTestClip.removeMovieClip();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-14 21:06:17
|
Revision: 603
http://svn.sourceforge.net/asapframework/?rev=603&view=rev
Author: aclemens
Date: 2006-10-14 14:06:03 -0700 (Sat, 14 Oct 2006)
Log Message:
-----------
new unit tests
Modified Paths:
--------------
trunk/asapframework/tests/unit/includes/testlist.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/WatcherTest.as
Added Paths:
-----------
trunk/asapframework/tests/unit/tests/org/asapframework/util/FrameDelayTest.as
Modified: trunk/asapframework/tests/unit/includes/testlist.as
===================================================================
--- trunk/asapframework/tests/unit/includes/testlist.as 2006-10-14 21:02:33 UTC (rev 602)
+++ trunk/asapframework/tests/unit/includes/testlist.as 2006-10-14 21:06:03 UTC (rev 603)
@@ -1,4 +1,4 @@
-/*
+
// data
org.asapframework.data.array.ArrayEnumeratorTest; // complete
org.asapframework.data.array.TraverseArrayEnumeratorTest; // complete
@@ -10,11 +10,12 @@
org.asapframework.util.MovieClipUtilsTest; // complete
org.asapframework.util.PointUtilsTest; // complete
org.asapframework.util.RectangleUtilsTest; // complete
+org.asapframework.util.FrameDelayTest; // complete
// util.types
org.asapframework.util.types.PointTest; // complete
org.asapframework.util.types.RectangleTest; // complete
-*/
// util.watch
-org.asapframework.util.watcher.WatcherTest; // in progress
\ No newline at end of file
+org.asapframework.util.watcher.WatcherTest; // in progress
+
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/FrameDelayTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/FrameDelayTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/FrameDelayTest.as 2006-10-14 21:06:03 UTC (rev 603)
@@ -0,0 +1,39 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.FrameDelayTest extends TestCase {
+
+ private static var ALL_METHODS_CALLED_COUNT:Number = 3;
+ private static var sMethodsCalledCount:Number = 0;
+ private static var sCallTestCalled:Boolean = false;
+
+ public function testNew () : Void {
+ sMethodsCalledCount++;
+ pause();
+ var fd:FrameDelay = new FrameDelay(this, callTest);
+ var fd:FrameDelay = new FrameDelay(this, assertCallTest, [], 2);
+ }
+
+ public function testResult () : Void {
+ assertTrue("FrameDelayTest testResult", sMethodsCalledCount == ALL_METHODS_CALLED_COUNT);
+ }
+
+ // PRIVATE METHODS
+
+ private function callTest () : Void {
+ sMethodsCalledCount++;
+ sCallTestCalled = true;
+ }
+
+ private function assertCallTest () : Void {
+ sMethodsCalledCount++;
+ resume();
+ assertTrue("FrameDelayTest assertCallTest", sCallTestCalled == true);
+ }
+
+}
Modified: trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/WatcherTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/WatcherTest.as 2006-10-14 21:02:33 UTC (rev 602)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/WatcherTest.as 2006-10-14 21:06:03 UTC (rev 603)
@@ -9,86 +9,92 @@
import org.asapframework.util.actionqueue.ActionQueue;
import org.asapframework.util.actionqueue.AQFade;
+/**
+This test is in package 'watcher' instead of 'watch' because as2lib's testing framework somehow parses the package path wrong.
+*/
class org.asapframework.util.watcher.WatcherTest extends TestCase {
- private static var sCounter1:Number = 0;
+ private static var ALL_METHODS_CALLED_COUNT:Number = 7;
+ private static var sMethodsCalledCount:Number = 0;
+ private static var sFrameDelayCount:Number = 1;
+
+ private static var sMethodActCalled:Number = 0;
private static var RESULT_COUNTER_1:Number = 1;
- private static var sCounter2:Number = 0;
+ private static var sGetMemberCountWithFunctionReferenceCalled:Number = 0;
private static var RESULT_COUNTER_2:Number = 1;
- private static var sCounter3:Number = 0; // for test 3
- private static var sValue5:Number = 0; // for test 5
-
+ private static var sAlphaAfterFadeOut:Number = 10;
/**
Test function call.
Test isBusy()
*/
- public function testIsBusy () : Void {
+ public function testAfterMethod () : Void {
+ sMethodsCalledCount++;
+
var family:Object = new Object();
- family.memberCount = 2;
+ family.memberCount = 0;
family.birth = function () {
family.memberCount++;
}
family.getMemberCount = function () {
return family.memberCount;
}
- var birthControl:Object = new Object();
- birthControl.act = function () {
- sCounter1++;
- }
-
- var watcher:Watcher = new Watcher(family, "getMemberCount", 5, 1/31);
- watcher.setAfterMethod(birthControl, "act", true);
+
+ // watch until getMemberCount returns 5, watch each 1/31 second
+ var watcher:Watcher = new Watcher(family, family.getMemberCount, 2, 1/31);
+ // after watching, call method 'act'
+ watcher.setAfterMethod(this, afterMethodHandler);
watcher.start();
+ pause();
+
family.birth();
- assertTrue("WatcherTest doTest1 isBusy 1", watcher.isBusy());
+ assertTrue("WatcherTest testAfterMethod isBusy", watcher.isBusy());
family.birth();
- family.birth();
- new FrameDelay(this, evaluateWatcher1, [true, watcher], 20 );
+
+ new FrameDelay(this, evaluateAfterMethodWatcher, [watcher], sFrameDelayCount++ );
}
/**
As test 1 but now with function reference and parameters
*/
- public function testIsBusyWithFunctionReferences () : Void {
+ public function testAfterMethodWithCallbackParams () : Void {
+ sMethodsCalledCount++;
var family:Object = new Object();
- family.memberCount = 2;
+ family.memberCount = 0;
family.birth = function () {
family.memberCount++;
}
- family.toString = function () { return "family"; }
family.getMemberCount = function (inCheck:String) {
if (inCheck == "thewholelot") {
return this.memberCount;
}
return 0;
}
- var birthControl:Object = new Object();
- birthControl.act = function () {
- sCounter2++;
- }
- var watcher:Watcher = new Watcher(family, family.getMemberCount, 5, 1/31, true, "thewholelot");
- watcher.setAfterMethod(birthControl, birthControl.act, true);
+ var watcher:Watcher = new Watcher(family, family.getMemberCount, 2, 1/31, true, "thewholelot");
+ watcher.setAfterMethod(this, afterMethodHandlerWithCallbackParams);
watcher.start();
+ pause();
+
family.birth();
- assertTrue("WatcherTest doTest2 isBusy 1", watcher.isBusy());
+ assertTrue("WatcherTest testAfterMethodWithCallbackParams isBusy", watcher.isBusy());
family.birth();
- family.birth();
- new FrameDelay(this, evaluateWatcher2, [true, watcher], 20 );
+
+ new FrameDelay(this, evaluateAfterMethodWithCallbackParamsWatcher, [ watcher], sFrameDelayCount++ );
}
/**
Test a variable watch
*/
public function testVariable () : Void {
+ sMethodsCalledCount++;
var mc:MovieClip = _level0.createEmptyMovieClip("WatcherTest_doTest3_box", _level0.getNextHighestDepth());
MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
@@ -96,13 +102,14 @@
mc._y = 100;
var watcher:Watcher = new Watcher(mc, "_alpha", 0, 1/31);
- watcher.setAfterMethod(this, "test2AfterZero", true);
watcher.start();
+ pause();
+
var queue:ActionQueue = new ActionQueue();
queue.addAction( AQFade.fade, mc, 1, null, 0 );
queue.addPause(1);
- queue.addAction( this, "evaluateWatcher3", 1, true );
+ queue.addAction( this, "evaluateTestVariableWatcher", watcher, mc);
queue.run();
}
@@ -110,68 +117,107 @@
Start and stopping
*/
public function testStartStopRestart () : Void {
- var watcher:Watcher = new Watcher(null, null, null, 1/12);
- assertFalse("WatcherTest doTest4 isBusy 1", watcher.isBusy());
+ sMethodsCalledCount++;
+
+ var watcher:Watcher = new Watcher();
+ watcher.setIntervalDuration(1/12);
+ assertFalse("WatcherTest testStartStopRestart isBusy 1", watcher.isBusy());
watcher.start();
- assertTrue("WatcherTest doTest4 isBusy 2", watcher.isBusy());
+ assertTrue("WatcherTest testStartStopRestart isBusy 2", watcher.isBusy());
watcher.stop();
- assertFalse("WatcherTest doTest4 isBusy 3", watcher.isBusy());
+ assertFalse("WatcherTest testStartStopRestart isBusy 3", watcher.isBusy());
watcher.restart();
- assertTrue("WatcherTest doTest4 isBusy 4", watcher.isBusy());
+ assertTrue("WatcherTest testStartStopRestart isBusy 4", watcher.isBusy());
watcher.stop();
- assertFalse("WatcherTest doTest4 isBusy 5", watcher.isBusy());
+ assertFalse("WatcherTest testStartStopRestart isBusy 5", watcher.isBusy());
}
/**
Callback
*/
public function testSetCallback () : Void {
+ sMethodsCalledCount++;
- var mc:MovieClip = _level0.createEmptyMovieClip("WatcherTest_doTest5_box", _level0.getNextHighestDepth());
+ var mc:MovieClip = _level0.createEmptyMovieClip("testSetCallback", _level0.getNextHighestDepth());
MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
mc._x = 300;
mc._y = 100;
- var watcher:Watcher = new Watcher(mc, "_alpha", 0, 1/31);
- watcher.setCallback(this, "doTest5Callback");
+ var watcher:Watcher = new Watcher(mc, "_alpha", sAlphaAfterFadeOut, 1/31);
+ watcher.setCallback(this, callbackHandler);
watcher.start();
+ pause();
+
var queue:ActionQueue = new ActionQueue();
queue.addAction( AQFade.fade, mc, 1, null, 0 );
- queue.addPause(1);
- queue.addAction( this, "evaluateWatcher5", 0, true );
+ queue.addPause(.1);
+ queue.addAction( this, evaluateTestSetCallbackWatcher, 0, true, mc );
queue.run();
}
+ public function testResult () : Void {
+ assertTrue("FrameDelayTest testResult", sMethodsCalledCount == ALL_METHODS_CALLED_COUNT);
+ }
+
+ // PRIVATE METHODS
+
+ private function afterMethodHandler () : Void {
+ sMethodsCalledCount++;
+ sMethodActCalled++;
+ }
+
+ private function afterMethodHandlerWithCallbackParams () : Void {
+ sMethodsCalledCount++;
+ sGetMemberCountWithFunctionReferenceCalled++;
+ }
+
/**
*/
- private function evaluateWatcher1 (inWatcher:Watcher) : Void {
- assertTrue("WatcherTest evaluateWatcher1", sCounter1 == RESULT_COUNTER_1);
- assertFalse("WatcherTest doTest1 isBusy 2", inWatcher.isBusy());
+ private function evaluateAfterMethodWatcher (inWatcher:Watcher) : Void {
+ resume();
+
+ assertTrue("WatcherTest evaluateAfterMethodWatcher", sMethodActCalled == RESULT_COUNTER_1);
+ assertFalse("WatcherTest evaluateAfterMethodWatcher isBusy", inWatcher.isBusy());
+ inWatcher.stop();
}
/**
*/
- private function evaluateWatcher2 (inWatcher:Watcher) : Void {
- assertTrue("WatcherTest evaluateWatcher2", sCounter2 == RESULT_COUNTER_2);
- assertFalse("WatcherTest doTest2 isBusy 2", inWatcher.isBusy());
+ private function evaluateAfterMethodWithCallbackParamsWatcher (inWatcher:Watcher) : Void {
+ resume();
+
+ assertTrue("WatcherTest evaluateAfterMethodWithCallbackParamsWatcher", sGetMemberCountWithFunctionReferenceCalled == RESULT_COUNTER_2);
+ assertFalse("WatcherTest evaluateAfterMethodWithCallbackParamsWatcher isBusy", inWatcher.isBusy());
+ inWatcher.stop();
}
+ /**
+
+ */
+ private function evaluateTestVariableWatcher (inWatcher:Watcher, inClip:MovieClip) : Void {
+ resume();
+ assertFalse("WatcherTest evaluateTestVariableWatcher isBusy", inWatcher.isBusy());
+ inClip.removeMovieClip;
+ }
+
/**
*/
- public function doTest5Callback (inAlpha:Number) : Void {
- sValue5 = inAlpha;
+ public function callbackHandler (inAlpha:Number) : Void {
+ sAlphaAfterFadeOut = inAlpha;
}
/**
*/
- public function evaluateWatcher5 (inValue:Number, inResult:Boolean) : Void {
- var result:Boolean = (inValue == sValue5);
- assertTrue("WatcherTest evaluateWatcher5", result == inResult);
+ public function evaluateTestSetCallbackWatcher (inValue:Number, inResult:Boolean, inClip:MovieClip) : Void {
+ resume();
+ var result:Boolean = (inValue == sAlphaAfterFadeOut);
+ assertTrue("WatcherTest evaluateTestSetCallbackWatcher", result == inResult);
+ inClip.removeMovieClip;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-14 21:02:38
|
Revision: 602
http://svn.sourceforge.net/asapframework/?rev=602&view=rev
Author: aclemens
Date: 2006-10-14 14:02:33 -0700 (Sat, 14 Oct 2006)
Log Message:
-----------
setCallback should accept a function reference as well
Modified Paths:
--------------
trunk/asapframework/org/asapframework/util/watch/Watcher.as
Modified: trunk/asapframework/org/asapframework/util/watch/Watcher.as
===================================================================
--- trunk/asapframework/org/asapframework/util/watch/Watcher.as 2006-10-14 12:28:50 UTC (rev 601)
+++ trunk/asapframework/org/asapframework/util/watch/Watcher.as 2006-10-14 21:02:33 UTC (rev 602)
@@ -140,6 +140,11 @@
/**
Sets the Watcher timer frequency interval.
@param inIntervalDuration : time duration between each check; duration in seconds
+ @example
+ <code>
+ var watcher:Watcher = new Watcher();
+ watcher.setIntervalDuration(1/12);
+ </code>
*/
public function setIntervalDuration (inIntervalDuration:Number) : Void {
mIntervalDuration = inIntervalDuration * 1000; // translate to milliseconds;
@@ -151,7 +156,7 @@
@param inCallbackMethod : Method (name or function reference) to be called during watching. Parameters that should be passed to the callback method can be appended as a comma separated list.
*/
public function setCallback (inCallbackObject:Object,
- inCallbackMethod:String) : Void {
+ inCallbackMethod:Object) : Void {
mCallbackObject = inCallbackObject;
mCallbackMethod = inCallbackMethod;
mCallbackParams = arguments.splice(2, arguments.length - 2);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-14 12:29:03
|
Revision: 601
http://svn.sourceforge.net/asapframework/?rev=601&view=rev
Author: aclemens
Date: 2006-10-14 05:28:50 -0700 (Sat, 14 Oct 2006)
Log Message:
-----------
proper prefix for member variables
Modified Paths:
--------------
trunk/asapframework/org/asapframework/util/FrameDelay.as
Modified: trunk/asapframework/org/asapframework/util/FrameDelay.as
===================================================================
--- trunk/asapframework/org/asapframework/util/FrameDelay.as 2006-10-14 00:07:10 UTC (rev 600)
+++ trunk/asapframework/org/asapframework/util/FrameDelay.as 2006-10-14 12:28:50 UTC (rev 601)
@@ -59,12 +59,12 @@
class org.asapframework.util.FrameDelay {
- private var isDone:Boolean = false;
- private var currentFrame:Number;
+ private var mIsDone:Boolean = false;
+ private var mCurrentFrame:Number;
private var mSender:Object;
private var mCallback:Function;
private var mParams:Array;
- private var mFramePulseListener : Function;
+ private var mFramePulseListener:Function;
/**
Constructor; starts the waiting immediately.
@@ -83,22 +83,23 @@
* Use this to remove a FrameDelay object that is still running when the creating object will be removed
*/
public function die () : Void {
- if (!isDone) {
+ if (!mIsDone) {
FramePulse.removeEnterFrameListener(mFramePulseListener);
}
}
-
+ // PRIVATE METHODS
+
/**
Stores input parameters (see {@link #FrameDelay constructor} parameters), start waiting.
*/
private function wait (inSender:Object, inCallback:Function, inParams:Array, inFrameCount:Number) : Void {
- currentFrame = inFrameCount;
+ mCurrentFrame = inFrameCount;
mSender = inSender;
mCallback = inCallback;
mParams = inParams;
- isDone = ((inFrameCount == undefined) || (inFrameCount <= 1));
+ mIsDone = ((inFrameCount == undefined) || (inFrameCount <= 1));
// listen to framepulse events
mFramePulseListener = EventDelegate.create(this, onEnterFrame);
@@ -111,12 +112,12 @@
*/
private function onEnterFrame () : Void {
- if (isDone) {
+ if (mIsDone) {
FramePulse.removeEnterFrameListener(mFramePulseListener);
mCallback.apply(mSender,mParams);
}
- currentFrame--;
- isDone = (currentFrame <= 1);
+ mCurrentFrame--;
+ mIsDone = (mCurrentFrame <= 1);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-14 00:07:13
|
Revision: 600
http://svn.sourceforge.net/asapframework/?rev=600&view=rev
Author: aclemens
Date: 2006-10-13 17:07:10 -0700 (Fri, 13 Oct 2006)
Log Message:
-----------
test: Watcher in package watcher
Modified Paths:
--------------
trunk/asapframework/tests/unit/includes/testlist.as
Modified: trunk/asapframework/tests/unit/includes/testlist.as
===================================================================
--- trunk/asapframework/tests/unit/includes/testlist.as 2006-10-14 00:06:54 UTC (rev 599)
+++ trunk/asapframework/tests/unit/includes/testlist.as 2006-10-14 00:07:10 UTC (rev 600)
@@ -1,4 +1,4 @@
-
+/*
// data
org.asapframework.data.array.ArrayEnumeratorTest; // complete
org.asapframework.data.array.TraverseArrayEnumeratorTest; // complete
@@ -14,6 +14,7 @@
// util.types
org.asapframework.util.types.PointTest; // complete
org.asapframework.util.types.RectangleTest; // complete
+*/
// util.watch
-//org.asapframework.util.WatcherTest; // in progress
\ No newline at end of file
+org.asapframework.util.watcher.WatcherTest; // in progress
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-14 00:06:58
|
Revision: 599
http://svn.sourceforge.net/asapframework/?rev=599&view=rev
Author: aclemens
Date: 2006-10-13 17:06:54 -0700 (Fri, 13 Oct 2006)
Log Message:
-----------
test: Watcher in package watcher
Added Paths:
-----------
trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/
trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/WatcherTest.as
Removed Paths:
-------------
trunk/asapframework/tests/unit/tests/org/asapframework/util/WatcherTest.as
Deleted: trunk/asapframework/tests/unit/tests/org/asapframework/util/WatcherTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/WatcherTest.as 2006-10-14 00:04:30 UTC (rev 598)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/WatcherTest.as 2006-10-14 00:06:54 UTC (rev 599)
@@ -1,177 +0,0 @@
-// testlib classes
-import org.as2lib.test.unit.TestCase;
-import org.as2lib.test.mock.MockControl;
-
-// ASAP classes
-import org.asapframework.util.watch.Watcher;
-import org.asapframework.util.FrameDelay;
-import org.asapframework.util.MovieClipUtils;
-import org.asapframework.util.actionqueue.ActionQueue;
-import org.asapframework.util.actionqueue.AQFade;
-
-
-class org.asapframework.util.WatcherTest extends TestCase {
-
- private static var sCounter1:Number = 0;
- private static var RESULT_COUNTER_1:Number = 1;
-
- private static var sCounter2:Number = 0;
- private static var RESULT_COUNTER_2:Number = 1;
-
- private static var sCounter3:Number = 0; // for test 3
- private static var sValue5:Number = 0; // for test 5
-
-
-
- /**
- Test function call.
- Test isBusy()
- */
- public function testIsBusy () : Void {
- var family:Object = new Object();
- family.memberCount = 2;
- family.birth = function () {
- family.memberCount++;
- }
- family.getMemberCount = function () {
- return family.memberCount;
- }
- var birthControl:Object = new Object();
- birthControl.act = function () {
- sCounter1++;
- }
-
- var watcher:Watcher = new Watcher(family, "getMemberCount", 5, 1/31);
- watcher.setAfterMethod(birthControl, "act", true);
- watcher.start();
-
- family.birth();
- assertTrue("WatcherTest doTest1 isBusy 1", watcher.isBusy());
- family.birth();
- family.birth();
- new FrameDelay(this, evaluateWatcher1, [true, watcher], 20 );
- }
-
- /**
- As test 1 but now with function reference and parameters
- */
- public function testIsBusyWithFunctionReferences () : Void {
-
- var family:Object = new Object();
- family.memberCount = 2;
- family.birth = function () {
- family.memberCount++;
- }
- family.toString = function () { return "family"; }
- family.getMemberCount = function (inCheck:String) {
- if (inCheck == "thewholelot") {
- return this.memberCount;
- }
- return 0;
- }
- var birthControl:Object = new Object();
- birthControl.act = function () {
- sCounter2++;
- }
-
- var watcher:Watcher = new Watcher(family, family.getMemberCount, 5, 1/31, true, "thewholelot");
- watcher.setAfterMethod(birthControl, birthControl.act, true);
- watcher.start();
-
- family.birth();
- assertTrue("WatcherTest doTest2 isBusy 1", watcher.isBusy());
- family.birth();
- family.birth();
- new FrameDelay(this, evaluateWatcher2, [true, watcher], 20 );
- }
-
- /**
- Test a variable watch
- */
- public function testVariable () : Void {
-
- var mc:MovieClip = _level0.createEmptyMovieClip("WatcherTest_doTest3_box", _level0.getNextHighestDepth());
- MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
- mc._x = 100;
- mc._y = 100;
-
- var watcher:Watcher = new Watcher(mc, "_alpha", 0, 1/31);
- watcher.setAfterMethod(this, "test2AfterZero", true);
- watcher.start();
-
- var queue:ActionQueue = new ActionQueue();
- queue.addAction( AQFade.fade, mc, 1, null, 0 );
- queue.addPause(1);
- queue.addAction( this, "evaluateWatcher3", 1, true );
- queue.run();
- }
-
- /**
- Start and stopping
- */
- public function testStartStopRestart () : Void {
- var watcher:Watcher = new Watcher(null, null, null, 1/12);
- assertFalse("WatcherTest doTest4 isBusy 1", watcher.isBusy());
- watcher.start();
- assertTrue("WatcherTest doTest4 isBusy 2", watcher.isBusy());
- watcher.stop();
- assertFalse("WatcherTest doTest4 isBusy 3", watcher.isBusy());
- watcher.restart();
- assertTrue("WatcherTest doTest4 isBusy 4", watcher.isBusy());
- watcher.stop();
- assertFalse("WatcherTest doTest4 isBusy 5", watcher.isBusy());
- }
-
- /**
- Callback
- */
- public function testSetCallback () : Void {
-
- var mc:MovieClip = _level0.createEmptyMovieClip("WatcherTest_doTest5_box", _level0.getNextHighestDepth());
- MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
- mc._x = 300;
- mc._y = 100;
-
- var watcher:Watcher = new Watcher(mc, "_alpha", 0, 1/31);
- watcher.setCallback(this, "doTest5Callback");
- watcher.start();
-
- var queue:ActionQueue = new ActionQueue();
- queue.addAction( AQFade.fade, mc, 1, null, 0 );
- queue.addPause(1);
- queue.addAction( this, "evaluateWatcher5", 0, true );
- queue.run();
- }
-
- /**
-
- */
- private function evaluateWatcher1 (inWatcher:Watcher) : Void {
- assertTrue("WatcherTest evaluateWatcher1", sCounter1 == RESULT_COUNTER_1);
- assertFalse("WatcherTest doTest1 isBusy 2", inWatcher.isBusy());
- }
-
- /**
-
- */
- private function evaluateWatcher2 (inWatcher:Watcher) : Void {
- assertTrue("WatcherTest evaluateWatcher2", sCounter2 == RESULT_COUNTER_2);
- assertFalse("WatcherTest doTest2 isBusy 2", inWatcher.isBusy());
- }
-
-
- /**
-
- */
- public function doTest5Callback (inAlpha:Number) : Void {
- sValue5 = inAlpha;
- }
-
- /**
-
- */
- public function evaluateWatcher5 (inValue:Number, inResult:Boolean) : Void {
- var result:Boolean = (inValue == sValue5);
- assertTrue("WatcherTest evaluateWatcher5", result == inResult);
- }
-}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/WatcherTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/WatcherTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/watcher/WatcherTest.as 2006-10-14 00:06:54 UTC (rev 599)
@@ -0,0 +1,177 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.watch.Watcher;
+import org.asapframework.util.FrameDelay;
+import org.asapframework.util.MovieClipUtils;
+import org.asapframework.util.actionqueue.ActionQueue;
+import org.asapframework.util.actionqueue.AQFade;
+
+
+class org.asapframework.util.watcher.WatcherTest extends TestCase {
+
+ private static var sCounter1:Number = 0;
+ private static var RESULT_COUNTER_1:Number = 1;
+
+ private static var sCounter2:Number = 0;
+ private static var RESULT_COUNTER_2:Number = 1;
+
+ private static var sCounter3:Number = 0; // for test 3
+ private static var sValue5:Number = 0; // for test 5
+
+
+
+ /**
+ Test function call.
+ Test isBusy()
+ */
+ public function testIsBusy () : Void {
+ var family:Object = new Object();
+ family.memberCount = 2;
+ family.birth = function () {
+ family.memberCount++;
+ }
+ family.getMemberCount = function () {
+ return family.memberCount;
+ }
+ var birthControl:Object = new Object();
+ birthControl.act = function () {
+ sCounter1++;
+ }
+
+ var watcher:Watcher = new Watcher(family, "getMemberCount", 5, 1/31);
+ watcher.setAfterMethod(birthControl, "act", true);
+ watcher.start();
+
+ family.birth();
+ assertTrue("WatcherTest doTest1 isBusy 1", watcher.isBusy());
+ family.birth();
+ family.birth();
+ new FrameDelay(this, evaluateWatcher1, [true, watcher], 20 );
+ }
+
+ /**
+ As test 1 but now with function reference and parameters
+ */
+ public function testIsBusyWithFunctionReferences () : Void {
+
+ var family:Object = new Object();
+ family.memberCount = 2;
+ family.birth = function () {
+ family.memberCount++;
+ }
+ family.toString = function () { return "family"; }
+ family.getMemberCount = function (inCheck:String) {
+ if (inCheck == "thewholelot") {
+ return this.memberCount;
+ }
+ return 0;
+ }
+ var birthControl:Object = new Object();
+ birthControl.act = function () {
+ sCounter2++;
+ }
+
+ var watcher:Watcher = new Watcher(family, family.getMemberCount, 5, 1/31, true, "thewholelot");
+ watcher.setAfterMethod(birthControl, birthControl.act, true);
+ watcher.start();
+
+ family.birth();
+ assertTrue("WatcherTest doTest2 isBusy 1", watcher.isBusy());
+ family.birth();
+ family.birth();
+ new FrameDelay(this, evaluateWatcher2, [true, watcher], 20 );
+ }
+
+ /**
+ Test a variable watch
+ */
+ public function testVariable () : Void {
+
+ var mc:MovieClip = _level0.createEmptyMovieClip("WatcherTest_doTest3_box", _level0.getNextHighestDepth());
+ MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
+ mc._x = 100;
+ mc._y = 100;
+
+ var watcher:Watcher = new Watcher(mc, "_alpha", 0, 1/31);
+ watcher.setAfterMethod(this, "test2AfterZero", true);
+ watcher.start();
+
+ var queue:ActionQueue = new ActionQueue();
+ queue.addAction( AQFade.fade, mc, 1, null, 0 );
+ queue.addPause(1);
+ queue.addAction( this, "evaluateWatcher3", 1, true );
+ queue.run();
+ }
+
+ /**
+ Start and stopping
+ */
+ public function testStartStopRestart () : Void {
+ var watcher:Watcher = new Watcher(null, null, null, 1/12);
+ assertFalse("WatcherTest doTest4 isBusy 1", watcher.isBusy());
+ watcher.start();
+ assertTrue("WatcherTest doTest4 isBusy 2", watcher.isBusy());
+ watcher.stop();
+ assertFalse("WatcherTest doTest4 isBusy 3", watcher.isBusy());
+ watcher.restart();
+ assertTrue("WatcherTest doTest4 isBusy 4", watcher.isBusy());
+ watcher.stop();
+ assertFalse("WatcherTest doTest4 isBusy 5", watcher.isBusy());
+ }
+
+ /**
+ Callback
+ */
+ public function testSetCallback () : Void {
+
+ var mc:MovieClip = _level0.createEmptyMovieClip("WatcherTest_doTest5_box", _level0.getNextHighestDepth());
+ MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
+ mc._x = 300;
+ mc._y = 100;
+
+ var watcher:Watcher = new Watcher(mc, "_alpha", 0, 1/31);
+ watcher.setCallback(this, "doTest5Callback");
+ watcher.start();
+
+ var queue:ActionQueue = new ActionQueue();
+ queue.addAction( AQFade.fade, mc, 1, null, 0 );
+ queue.addPause(1);
+ queue.addAction( this, "evaluateWatcher5", 0, true );
+ queue.run();
+ }
+
+ /**
+
+ */
+ private function evaluateWatcher1 (inWatcher:Watcher) : Void {
+ assertTrue("WatcherTest evaluateWatcher1", sCounter1 == RESULT_COUNTER_1);
+ assertFalse("WatcherTest doTest1 isBusy 2", inWatcher.isBusy());
+ }
+
+ /**
+
+ */
+ private function evaluateWatcher2 (inWatcher:Watcher) : Void {
+ assertTrue("WatcherTest evaluateWatcher2", sCounter2 == RESULT_COUNTER_2);
+ assertFalse("WatcherTest doTest2 isBusy 2", inWatcher.isBusy());
+ }
+
+
+ /**
+
+ */
+ public function doTest5Callback (inAlpha:Number) : Void {
+ sValue5 = inAlpha;
+ }
+
+ /**
+
+ */
+ public function evaluateWatcher5 (inValue:Number, inResult:Boolean) : Void {
+ var result:Boolean = (inValue == sValue5);
+ assertTrue("WatcherTest evaluateWatcher5", result == inResult);
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-14 00:04:43
|
Revision: 598
http://svn.sourceforge.net/asapframework/?rev=598&view=rev
Author: aclemens
Date: 2006-10-13 17:04:30 -0700 (Fri, 13 Oct 2006)
Log Message:
-----------
new tests
Modified Paths:
--------------
trunk/asapframework/tests/unit/includes/testlist.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/PointUtilsTest.as
Added Paths:
-----------
trunk/asapframework/tests/unit/tests/org/asapframework/util/RectangleUtilsTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/WatcherTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/types/
trunk/asapframework/tests/unit/tests/org/asapframework/util/types/PointTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/types/RectangleTest.as
Modified: trunk/asapframework/tests/unit/includes/testlist.as
===================================================================
--- trunk/asapframework/tests/unit/includes/testlist.as 2006-10-14 00:03:14 UTC (rev 597)
+++ trunk/asapframework/tests/unit/includes/testlist.as 2006-10-14 00:04:30 UTC (rev 598)
@@ -8,4 +8,12 @@
org.asapframework.util.NumberUtilsTest; // complete
org.asapframework.util.StringUtilsTest; // TODO: format, capitalizeChar, capitalizeString, capitalizeWords, validateEmail
org.asapframework.util.MovieClipUtilsTest; // complete
-org.asapframework.util.PointUtilsTest; // complete
\ No newline at end of file
+org.asapframework.util.PointUtilsTest; // complete
+org.asapframework.util.RectangleUtilsTest; // complete
+
+// util.types
+org.asapframework.util.types.PointTest; // complete
+org.asapframework.util.types.RectangleTest; // complete
+
+// util.watch
+//org.asapframework.util.WatcherTest; // in progress
\ No newline at end of file
Modified: trunk/asapframework/tests/unit/tests/org/asapframework/util/PointUtilsTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/PointUtilsTest.as 2006-10-14 00:03:14 UTC (rev 597)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/PointUtilsTest.as 2006-10-14 00:04:30 UTC (rev 598)
@@ -45,137 +45,5 @@
assertTrue("PointTest Test average 2 x", averagePoint.x == 50);
assertTrue("PointTest Test average 2 y", averagePoint.y == -50);
}
- /*
- // Point constructor (default values)
- var point:Point = new Point();
- assertTrue("PointTest Test initial default x", point.x == undefined);
- assertTrue("PointTest Test initial default y", point.y == undefined);
- delete point;
-
- // Point constructor (set values)
- var point:Point = new Point(3,4);
- assertTrue("PointTest Test initial set x", point.x == 3);
- assertTrue("PointTest Test initial set y", point.y == 4);
- delete point;
-
- //setting public vars
- var point:Point = new Point(3,4);
- point.x *= 100;
- point.y *= 100;
- assertTrue("PointTest Test set x", point.x == 300);
- assertTrue("PointTest Test set y", point.y == 400);
- delete point;
-
- // distance
- var point1:Point = new Point(0,0);
- var point2:Point = new Point(300,400);
- assertTrue("PointTest Test distance", Point.distance(point1, point2) == 500);
- point2.x = point2.y = 0;
- assertTrue("PointTest Test distance", Point.distance(point1, point2) == 0);
- delete point1;
- delete point2;
-
- // clone
- var point:Point = new Point(-1000,-2000);
- var clone:Point = point.clone();
- assertTrue("PointTest Point clone instantiated", clone instanceof Point);
- assertTrue("PointTest Test clone x", point.x == -1000);
- assertTrue("PointTest Test clone y", point.y == -2000);
- //equals
- assertTrue("PointTest Test point equals clone", point.equals(clone));
- delete point;
- delete clone;
-
- // offset
- var point:Point = new Point(0,0);
- point.offset(-100,-100);
- assertTrue("PointTest Test offset x", point.x == -100);
- assertTrue("PointTest Test offset y", point.y == -100);
- delete point;
-
- // subtract
- var point:Point = new Point(100,100);
- var subtractPoint:Point = new Point(0,10);
- var resultPoint:Point = point.subtract(subtractPoint);
- assertTrue("PointTest Test subtracted x", resultPoint.x == 100);
- assertTrue("PointTest Test subtracted y", resultPoint.y == 90);
- delete point;
- delete subtractPoint;
- delete resultPoint;
-
- // addPoint
- var point:Point = new Point(0,0);
- var addPoint:Point = new Point(1.5, 2.5);
- var resultPoint:Point = point.addPoint(addPoint);
- assertTrue("PointTest Test added x 1", resultPoint.x == 1.5);
- assertTrue("PointTest Test added y 1", resultPoint.y == 2.5);
- delete point;
- delete addPoint;
- delete resultPoint;
- var point:Point = new Point(10, 20);
- var resultPoint:Point = point.addPoint(new Point(20,10));
- assertTrue("PointTest Test added x 2", resultPoint.x == 30);
- assertTrue("PointTest Test added y 2", resultPoint.y == 30);
- delete point;
- delete addPoint;
- delete resultPoint;
-
- // normalize
- var point:Point = new Point(1000,500);
- point.normalize(1.0);
- assertTrue("PointTest Test normalized x", point.x == 1.0);
- assertTrue("PointTest Test normalized y", point.y == .5);
- delete point;
- var point:Point = new Point(0,0);
- point.normalize(0);
- assertTrue("PointTest Test normalized x", point.x == 0);
- assertTrue("PointTest Test normalized y", point.y == 0);
- delete point;
- var point:Point = new Point(-100,-200);
- point.normalize(10);
- assertTrue("PointTest Test normalized x", point.x == -5);
- assertTrue("PointTest Test normalized y", point.y == -10);
- delete point;
-
- // multiply
- var point:Point = new Point(100,200);
- var multiplyPoint:Point = point.multiply(0);
- assertTrue("PointTest Test multiplied 1 x", multiplyPoint.x == 0);
- assertTrue("PointTest Test multiplied 1 y", multiplyPoint.y == 0);
- delete point;
- delete multiplyPoint;
- var point:Point = new Point(100,200);
- var multiplyPoint:Point = point.multiply(0.5);
- assertTrue("PointTest Test multiplied 2 x", multiplyPoint.x == 50);
- assertTrue("Test multiplied 2 y", multiplyPoint.y == 100);
- delete point;
- delete multiplyPoint;
- var point:Point = new Point(100,200);
- var multiplyPoint:Point = point.multiply(-10);
- assertTrue("PointTest Test multiplied 2 x", multiplyPoint.x == -1000);
- assertTrue("PointTest Test multiplied 2 y", multiplyPoint.y == -2000);
- delete point;
- delete multiplyPoint;
-
- // average
- var point1:Point = new Point(0,0);
- var point2:Point = new Point(100,100);
- var averagePoint = PointUtils.average(point1, point2);
- assertTrue("PointTest Test average 1 x", averagePoint.x == 50);
- assertTrue("PointTest Test average 1 y", averagePoint.y == 50);
- delete point1;
- delete point2;
- delete averagePoint;
- //
- var point1:Point = new Point(100,-100);
- var point2:Point = new Point(0,0);
- var averagePoint = PointUtils.average(point1, point2);
- assertTrue("PointTest Test average 2 x", averagePoint.x == 50);
- assertTrue("PointTest Test average 2 y", averagePoint.y == -50);
- delete point1;
- delete point2;
- delete averagePoint;
- }
- */
}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/RectangleUtilsTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/RectangleUtilsTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/RectangleUtilsTest.as 2006-10-14 00:04:30 UTC (rev 598)
@@ -0,0 +1,163 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// Adobe classes
+//import flash.geom.*;
+// Still support Flash 7:
+import org.asapframework.util.types.*;
+
+// ASAP classes
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.RectangleUtilsTest extends TestCase {
+
+ public function testGetCenter () : Void {
+ var rect:Rectangle = new Rectangle(0,0,0,0);
+ var center:Point = RectangleUtils.getCenter(rect);
+ assertTrue("RectangleUtilsTest testGetCenter center.x 1", (center.x == 0));
+ assertTrue("RectangleUtilsTest testGetCenter center.y 1", (center.y == 0));
+
+ var rect:Rectangle = new Rectangle(0,0,1,1);
+ var center:Point = RectangleUtils.getCenter(rect);
+ assertTrue("RectangleUtilsTest testGetCenter center.x 2", (center.x == .5));
+ assertTrue("RectangleUtilsTest testGetCenter center.y 2", (center.y == .5));
+
+ var rect:Rectangle = new Rectangle(1,2,4,8);
+ var center:Point = RectangleUtils.getCenter(rect);
+ assertTrue("RectangleUtilsTest testGetCenter center.x 2", (center.x == 3));
+ assertTrue("RectangleUtilsTest testGetCenter center.y 2", (center.y == 6));
+ }
+
+ public function testSetCenter () : Void {
+ var rect:Rectangle = new Rectangle(0,0,10,10);
+ RectangleUtils.setCenter(rect, new Point(0,0));
+ var center:Point = RectangleUtils.getCenter(rect);
+ assertTrue("RectangleUtilsTest testSetCenter left", (rect.left == -5));
+ assertTrue("RectangleUtilsTest testSetCenter top", (rect.top == -5));
+ assertTrue("RectangleUtilsTest testSetCenter center.x", (center.x == 0));
+ assertTrue("RectangleUtilsTest testSetCenter center.y", (center.y == 0));
+ }
+
+ public function testRectOfMovieClip () : Void {
+ var mc:MovieClip = _level0.createEmptyMovieClip("testRectOfMovieClip", _level0.getNextHighestDepth());
+ mc._x = 20;
+ mc._y = 10;
+ var width:Number = 100;
+ var height:Number = 60;
+ var edgeX:Number = width/2;
+ var edgeY:Number = height/2;
+ var col:Number = 0xff0000;
+ MovieClipUtils.drawBox(mc, -edgeX, -edgeY, edgeX, edgeY, [0, col, 100], []);
+ var rect:Rectangle = RectangleUtils.rectOfMovieClip(mc);
+ assertTrue("RectangleUtilsTest testRectOfMovieClip left", (rect.left == -50));
+ assertTrue("RectangleUtilsTest testRectOfMovieClip top", (rect.top == -30));
+ assertTrue("RectangleUtilsTest testRectOfMovieClip right", (rect.right == 50));
+ assertTrue("RectangleUtilsTest testRectOfMovieClip bottom", (rect.bottom == 30));
+ mc.removeMovieClip();
+ }
+
+ public function testBoundsOfMovieClip () : Void {
+ var mc:MovieClip = _level0.createEmptyMovieClip("testBoundsOfMovieClip", _level0.getNextHighestDepth());
+ mc._x = 20;
+ mc._y = 10;
+ var width:Number = 100;
+ var height:Number = 60;
+ var edgeX:Number = width/2;
+ var edgeY:Number = height/2;
+ var col:Number = 0xff0000;
+ MovieClipUtils.drawBox(mc, -edgeX, -edgeY, edgeX, edgeY, [0, col, 100], []);
+ var rect:Rectangle = RectangleUtils.boundsOfMovieClip(mc);
+ assertTrue("RectangleUtilsTest testBoundsOfMovieClip left", (rect.left == -50 + 20));
+ assertTrue("RectangleUtilsTest testBoundsOfMovieClip top", (rect.top == -30 + 10));
+ assertTrue("RectangleUtilsTest testBoundsOfMovieClip right", (rect.right == 50 + 20));
+ assertTrue("RectangleUtilsTest testBoundsOfMovieClip bottom", (rect.bottom == 30 + 10));
+ mc.removeMovieClip();
+ }
+
+ public function testSetToBounds () : Void {
+ var mc:MovieClip = _level0.createEmptyMovieClip("testSetToBounds", _level0.getNextHighestDepth());
+ var width:Number = 100;
+ var height:Number = 60;
+ var col:Number = 0xff0000;
+ MovieClipUtils.drawBox(mc, 0, 0, width, height, [0, col, 100], []);
+ var bounds:Rectangle = new Rectangle(100,100,30,20);
+ RectangleUtils.setToBounds(mc, bounds);
+ var rect:Rectangle = RectangleUtils.boundsOfMovieClip(mc);
+ assertTrue("RectangleUtilsTest testSetToBounds left", (rect.left == 100));
+ assertTrue("RectangleUtilsTest testSetToBounds top", (rect.top == 100));
+ assertTrue("RectangleUtilsTest testSetToBounds right", (rect.right == 130));
+ assertTrue("RectangleUtilsTest testSetToBounds bottom", (rect.bottom == 120));
+ mc.removeMovieClip();
+ }
+
+ public function testCenterPointOfMovieClip () : Void {
+ var mc:MovieClip = _level0.createEmptyMovieClip("testCenterPointOfMovieClip", _level0.getNextHighestDepth());
+ mc._x = 200;
+ mc._y = 100;
+ var width:Number = 100;
+ var height:Number = 60;
+ var col:Number = 0xff0000;
+ MovieClipUtils.drawBox(mc, 0, 0, width, height, [0, col, 100], []);
+
+ var centerOfBounds:Point = RectangleUtils.centerPointOfMovieClip(mc);
+ assertTrue("RectangleUtilsTest testCenterPointOfMovieClip centerOfBounds.x", (centerOfBounds.x == 250));
+ assertTrue("RectangleUtilsTest testCenterPointOfMovieClip centerOfBounds.y", (centerOfBounds.y == 130));
+
+ var centerOfRect:Point = RectangleUtils.centerPointOfMovieClip(mc, mc);
+ assertTrue("RectangleUtilsTest testCenterPointOfMovieClip centerOfRect.x", (centerOfRect.x == 50));
+ assertTrue("RectangleUtilsTest testCenterPointOfMovieClip centerOfRect.y", (centerOfRect.y == 30));
+
+ mc.removeMovieClip();
+ }
+
+ public function testCenterToRectangle () : Void {
+ var rect1:Rectangle = new Rectangle(0,0,20,20);
+ var rect2:Rectangle = new Rectangle(50,50,40,40);
+
+ var mc1:MovieClip = _level0.createEmptyMovieClip("testCenterToRectangle1", _level0.getNextHighestDepth());
+ MovieClipUtils.drawBox(mc1, rect1.left, rect1.top, rect1.right, rect1.bottom, [0, 0xff0000, 100], []);
+
+ var mc2:MovieClip = _level0.createEmptyMovieClip("testCenterToRectangle2", _level0.getNextHighestDepth());
+ MovieClipUtils.drawBox(mc2, rect2.left, rect2.top, rect2.right, rect2.bottom, [0, 0x000099, 100], []);
+
+ RectangleUtils.centerToRectangle(rect1, rect2);
+
+ var mc3:MovieClip = _level0.createEmptyMovieClip("testCenterToRectangle3", _level0.getNextHighestDepth());
+ MovieClipUtils.drawBox(mc3, rect1.left, rect1.top, rect1.right, rect1.bottom, [0, 0x009900, 100], []);
+
+ assertTrue("RectangleUtilsTest testCenterToRectangle left", (rect1.left == 60));
+ assertTrue("RectangleUtilsTest testCenterToRectangle top", (rect1.top == 60));
+
+ mc1.removeMovieClip();
+ mc2.removeMovieClip();
+ mc3.removeMovieClip();
+ }
+
+ public function testFlattenHeight () : Void {
+ var rect1:Rectangle = new Rectangle(0,0,40,40);
+ RectangleUtils.flattenHeight(rect1, 1);
+
+ assertTrue("RectangleUtilsTest testFlattenHeight 1 top", (rect1.top == 19.5));
+ assertTrue("RectangleUtilsTest testFlattenHeight 1 height", (rect1.height == 1));
+
+ var rect2:Rectangle = new Rectangle(0,0,40,40);
+ RectangleUtils.flattenHeight(rect1, 40);
+ assertTrue("RectangleUtilsTest testFlattenHeight 2 top", (rect1.top == 0));
+ assertTrue("RectangleUtilsTest testFlattenHeight 2 height", (rect1.height == 40));
+ }
+
+ public function testFlattenWidth () : Void {
+ var rect1:Rectangle = new Rectangle(0,0,40,40);
+ RectangleUtils.flattenWidth(rect1, 1);
+ assertTrue("RectangleUtilsTest testFlattenWidth 1 top", (rect1.left == 19.5));
+ assertTrue("RectangleUtilsTest testFlattenWidth 1 height", (rect1.width == 1));
+
+ var rect2:Rectangle = new Rectangle(0,0,40,40);
+ RectangleUtils.flattenWidth(rect1, 40);
+ assertTrue("RectangleUtilsTest testFlattenWidth 2 top", (rect1.left == 0));
+ assertTrue("RectangleUtilsTest testFlattenWidth 2 height", (rect1.width == 40));
+ }
+
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/WatcherTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/WatcherTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/WatcherTest.as 2006-10-14 00:04:30 UTC (rev 598)
@@ -0,0 +1,177 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.watch.Watcher;
+import org.asapframework.util.FrameDelay;
+import org.asapframework.util.MovieClipUtils;
+import org.asapframework.util.actionqueue.ActionQueue;
+import org.asapframework.util.actionqueue.AQFade;
+
+
+class org.asapframework.util.WatcherTest extends TestCase {
+
+ private static var sCounter1:Number = 0;
+ private static var RESULT_COUNTER_1:Number = 1;
+
+ private static var sCounter2:Number = 0;
+ private static var RESULT_COUNTER_2:Number = 1;
+
+ private static var sCounter3:Number = 0; // for test 3
+ private static var sValue5:Number = 0; // for test 5
+
+
+
+ /**
+ Test function call.
+ Test isBusy()
+ */
+ public function testIsBusy () : Void {
+ var family:Object = new Object();
+ family.memberCount = 2;
+ family.birth = function () {
+ family.memberCount++;
+ }
+ family.getMemberCount = function () {
+ return family.memberCount;
+ }
+ var birthControl:Object = new Object();
+ birthControl.act = function () {
+ sCounter1++;
+ }
+
+ var watcher:Watcher = new Watcher(family, "getMemberCount", 5, 1/31);
+ watcher.setAfterMethod(birthControl, "act", true);
+ watcher.start();
+
+ family.birth();
+ assertTrue("WatcherTest doTest1 isBusy 1", watcher.isBusy());
+ family.birth();
+ family.birth();
+ new FrameDelay(this, evaluateWatcher1, [true, watcher], 20 );
+ }
+
+ /**
+ As test 1 but now with function reference and parameters
+ */
+ public function testIsBusyWithFunctionReferences () : Void {
+
+ var family:Object = new Object();
+ family.memberCount = 2;
+ family.birth = function () {
+ family.memberCount++;
+ }
+ family.toString = function () { return "family"; }
+ family.getMemberCount = function (inCheck:String) {
+ if (inCheck == "thewholelot") {
+ return this.memberCount;
+ }
+ return 0;
+ }
+ var birthControl:Object = new Object();
+ birthControl.act = function () {
+ sCounter2++;
+ }
+
+ var watcher:Watcher = new Watcher(family, family.getMemberCount, 5, 1/31, true, "thewholelot");
+ watcher.setAfterMethod(birthControl, birthControl.act, true);
+ watcher.start();
+
+ family.birth();
+ assertTrue("WatcherTest doTest2 isBusy 1", watcher.isBusy());
+ family.birth();
+ family.birth();
+ new FrameDelay(this, evaluateWatcher2, [true, watcher], 20 );
+ }
+
+ /**
+ Test a variable watch
+ */
+ public function testVariable () : Void {
+
+ var mc:MovieClip = _level0.createEmptyMovieClip("WatcherTest_doTest3_box", _level0.getNextHighestDepth());
+ MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
+ mc._x = 100;
+ mc._y = 100;
+
+ var watcher:Watcher = new Watcher(mc, "_alpha", 0, 1/31);
+ watcher.setAfterMethod(this, "test2AfterZero", true);
+ watcher.start();
+
+ var queue:ActionQueue = new ActionQueue();
+ queue.addAction( AQFade.fade, mc, 1, null, 0 );
+ queue.addPause(1);
+ queue.addAction( this, "evaluateWatcher3", 1, true );
+ queue.run();
+ }
+
+ /**
+ Start and stopping
+ */
+ public function testStartStopRestart () : Void {
+ var watcher:Watcher = new Watcher(null, null, null, 1/12);
+ assertFalse("WatcherTest doTest4 isBusy 1", watcher.isBusy());
+ watcher.start();
+ assertTrue("WatcherTest doTest4 isBusy 2", watcher.isBusy());
+ watcher.stop();
+ assertFalse("WatcherTest doTest4 isBusy 3", watcher.isBusy());
+ watcher.restart();
+ assertTrue("WatcherTest doTest4 isBusy 4", watcher.isBusy());
+ watcher.stop();
+ assertFalse("WatcherTest doTest4 isBusy 5", watcher.isBusy());
+ }
+
+ /**
+ Callback
+ */
+ public function testSetCallback () : Void {
+
+ var mc:MovieClip = _level0.createEmptyMovieClip("WatcherTest_doTest5_box", _level0.getNextHighestDepth());
+ MovieClipUtils.drawBox(mc, 0, 0, 100, 50, [0, 0xff0000, 100]);
+ mc._x = 300;
+ mc._y = 100;
+
+ var watcher:Watcher = new Watcher(mc, "_alpha", 0, 1/31);
+ watcher.setCallback(this, "doTest5Callback");
+ watcher.start();
+
+ var queue:ActionQueue = new ActionQueue();
+ queue.addAction( AQFade.fade, mc, 1, null, 0 );
+ queue.addPause(1);
+ queue.addAction( this, "evaluateWatcher5", 0, true );
+ queue.run();
+ }
+
+ /**
+
+ */
+ private function evaluateWatcher1 (inWatcher:Watcher) : Void {
+ assertTrue("WatcherTest evaluateWatcher1", sCounter1 == RESULT_COUNTER_1);
+ assertFalse("WatcherTest doTest1 isBusy 2", inWatcher.isBusy());
+ }
+
+ /**
+
+ */
+ private function evaluateWatcher2 (inWatcher:Watcher) : Void {
+ assertTrue("WatcherTest evaluateWatcher2", sCounter2 == RESULT_COUNTER_2);
+ assertFalse("WatcherTest doTest2 isBusy 2", inWatcher.isBusy());
+ }
+
+
+ /**
+
+ */
+ public function doTest5Callback (inAlpha:Number) : Void {
+ sValue5 = inAlpha;
+ }
+
+ /**
+
+ */
+ public function evaluateWatcher5 (inValue:Number, inResult:Boolean) : Void {
+ var result:Boolean = (inValue == sValue5);
+ assertTrue("WatcherTest evaluateWatcher5", result == inResult);
+ }
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/types/PointTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/types/PointTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/types/PointTest.as 2006-10-14 00:04:30 UTC (rev 598)
@@ -0,0 +1,104 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.types.*;
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.types.PointTest extends TestCase {
+
+ public function testNew () : Void {
+ var point:Point = new Point();
+ assertTrue("PointTest initial default x", point.x == undefined);
+ assertTrue("PointTest initial default y", point.y == undefined);
+ delete point;
+
+ // Point constructor (set values)
+ var point:Point = new Point(3,4);
+ assertTrue("PointTest initial set x", point.x == 3);
+ assertTrue("PointTest initial set y", point.y == 4);
+ }
+
+ public function testVars () : Void {
+ var point:Point = new Point(3,4);
+ point.x *= 100;
+ point.y *= 100;
+ assertTrue("PointTest Test set x", point.x == 300);
+ assertTrue("PointTest Test set y", point.y == 400);
+ }
+
+ public function testDistance () : Void {
+ var point1:Point = new Point(0,0);
+ var point2:Point = new Point(300,400);
+ assertTrue("PointTest Test distance", Point.distance(point1, point2) == 500);
+ point2.x = point2.y = 0;
+ assertTrue("PointTest Test distance", Point.distance(point1, point2) == 0);
+ }
+
+ public function testClone () : Void {
+ // clone
+ var point:Point = new Point(-1000,-2000);
+ var clone:Point = point.clone();
+ assertTrue("PointTest clone x", point.x == -1000);
+ assertTrue("PointTest clone y", point.y == -2000);
+ }
+
+ public function testEquals () : Void {
+ var point1:Point = new Point(-1000,-2000);
+ var point2:Point = new Point(-1000,-2000);
+ assertTrue("PointTest point equals clone", point1.equals(point2));
+ var point3:Point = new Point(0,0);
+ assertFalse("PointTest point equals clone", point1.equals(point3));
+ }
+
+ public function testOffset () : Void {
+ // offset
+ var point:Point = new Point(0,0);
+ point.offset(-100,-100);
+ assertTrue("PointTest offset x", point.x == -100);
+ assertTrue("PointTest offset y", point.y == -100);
+ }
+
+ public function testSubtract () : Void {
+ var point:Point = new Point(100,100);
+ var subtractPoint:Point = new Point(0,10);
+ var resultPoint:Point = point.subtract(subtractPoint);
+ assertTrue("PointTest subtracted x", resultPoint.x == 100);
+ assertTrue("PointTest subtracted y", resultPoint.y == 90);
+ }
+
+ public function testAddPoint () : Void {
+ var point:Point = new Point(0,0);
+ var addPoint:Point = new Point(1.5, 2.5);
+ var resultPoint:Point = point.addPoint(addPoint);
+ assertTrue("PointTest added x 1", resultPoint.x == 1.5);
+ assertTrue("PointTest added y 1", resultPoint.y == 2.5);
+ delete point;
+ delete addPoint;
+ delete resultPoint;
+ var point:Point = new Point(10, 20);
+ var resultPoint:Point = point.addPoint(new Point(20,10));
+ assertTrue("PointTest added x 2", resultPoint.x == 30);
+ assertTrue("PointTest added y 2", resultPoint.y == 30);
+ }
+
+ public function testNormalize () : Void {
+ var point:Point = new Point(1000,500);
+ point.normalize(1.0);
+ assertTrue("PointTest normalized x", point.x == 1.0);
+ assertTrue("PointTest normalized y", point.y == .5);
+ delete point;
+ var point:Point = new Point(0,0);
+ point.normalize(0);
+ assertTrue("PointTest normalized x", point.x == 0);
+ assertTrue("PointTest normalized y", point.y == 0);
+ delete point;
+ var point:Point = new Point(-100,-200);
+ point.normalize(10);
+ assertTrue("PointTest normalized x", point.x == -5);
+ assertTrue("PointTest normalized y", point.y == -10);
+ }
+
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/types/RectangleTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/types/RectangleTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/types/RectangleTest.as 2006-10-14 00:04:30 UTC (rev 598)
@@ -0,0 +1,292 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.types.*;
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.types.RectangleTest extends TestCase {
+
+ public function testNew () : Void {
+ // Rectangle constructor (default values)
+ var rectangle:Rectangle = new Rectangle();
+ assertTrue("Test initial default x", rectangle.x == 0);
+ assertTrue("Test initial default y", rectangle.y == 0);
+ assertTrue("Test initial default width", rectangle.width == 0);
+ assertTrue("Test initial default height", rectangle.height == 0);
+ delete rectangle;
+
+ // Rectangle constructor (set values)
+ var rectangle:Rectangle = new Rectangle(-50,-50,100,100);
+ assertTrue("Test initial set x", rectangle.x == -50);
+ assertTrue("Test initial set y", rectangle.y == -50);
+ assertTrue("Test initial set width", rectangle.width == 100);
+ assertTrue("Test initial set height", rectangle.height == 100);
+ }
+
+ public function testBottom () : Void {
+ var rectangle:Rectangle = new Rectangle(0,0,100,100);
+ assertTrue("Test get bottom", rectangle.bottom == 100);
+ rectangle.bottom = 50;
+ assertTrue("Test set bottom", rectangle.bottom == 50);
+ }
+
+ public function testBottomRight () : Void {
+ var rectangle:Rectangle = new Rectangle(1,2,4,8);
+ assertTrue("Test get bottomRight bottom", rectangle.bottom == 10);
+ assertTrue("Test get bottomRight right", rectangle.right == 5);
+ assertTrue("Test get bottomRight height", rectangle.height == 8);
+ assertTrue("Test get bottomRight width", rectangle.width == 4);
+ var myBottomRight:Point = new Point(16, 32);
+ rectangle.bottomRight = myBottomRight;
+ assertTrue("Test set bottomRight bottom", rectangle.bottom == 32);
+ assertTrue("Test set bottomRight right", rectangle.right == 16);
+ assertTrue("Test set bottomRight height", rectangle.height == 30);
+ assertTrue("Test set bottomRight width", rectangle.width == 15);
+ }
+
+ public function testHeight () : Void {
+ var rectangle:Rectangle = new Rectangle(0,0,10,20);
+ assertTrue("Test get height", rectangle.height == 20);
+ rectangle.height = 40;
+ assertTrue("Test set height", rectangle.height == 40);
+ }
+
+ public function testLeft () : Void {
+ var rectangle:Rectangle = new Rectangle(-10,0,100,100);
+ assertTrue("Test get left", rectangle.left == -10);
+ rectangle.left = 0;
+ assertTrue("Test set left", rectangle.left == 0);
+ }
+
+ public function testRight () : Void {
+ var rectangle:Rectangle = new Rectangle(-10,0,100,100);
+ assertTrue("Test get right", rectangle.right == 90);
+ rectangle.right = 45;
+ assertTrue("Test set right", rectangle.right == 45);
+ delete rectangle;
+ var rectangle:Rectangle = new Rectangle(-10,0,100,100);
+ rectangle.size = new Point(10,10);
+ assertTrue("Test set right (after set size)", rectangle.right == 0);
+ delete rectangle;
+ }
+
+ public function testSize () : Void {
+ var rectangle:Rectangle = new Rectangle(1, 2, 4, 8);
+ var size:Point = rectangle.size;
+ assertTrue("Test get size x", size.x == 4);
+ assertTrue("Test get size y", size.y == 8);
+ size.x = 16;
+ size.y = 32;
+ rectangle.size = size;
+ assertTrue("Test set size x", rectangle.x == 1);
+ assertTrue("Test set size y", rectangle.y == 2);
+ assertTrue("Test set size width", rectangle.width == 16);
+ assertTrue("Test set size height", rectangle.height == 32);
+ }
+
+ public function testTop () : Void {
+ var rectangle:Rectangle = new Rectangle(-1,0,1,1);
+ assertTrue("Test get top", rectangle.top == 0);
+ rectangle.top = -1;
+ assertTrue("Test set top", rectangle.top == -1);
+ rectangle.size = new Point(20,20);
+ assertTrue("Test set top (after set size)", rectangle.top == -1);
+ delete rectangle;
+ }
+
+ public function testTopLeft () : Void {
+ var rectangle:Rectangle = new Rectangle(0,0,100,100);
+ assertTrue("Test get topLeft x", rectangle.topLeft.x == 0);
+ assertTrue("Test get topLeft y", rectangle.topLeft.y == 0);
+ rectangle.topLeft = new Point(25,50);
+ assertTrue("Test set bottomRight x", rectangle.topLeft.x == 25);
+ assertTrue("Test set bottomRight y", rectangle.topLeft.y == 50);
+ }
+
+ public function testWidth () : Void {
+ var rectangle:Rectangle = new Rectangle(0,0,10,20);
+ assertTrue("Test get width", rectangle.width == 10);
+ rectangle.width = 100;
+ assertTrue("Test set width", rectangle.width == 100);
+ rectangle.size = new Point(20,20);
+ assertTrue("Test set width (after set size)", rectangle.width == 20);
+ delete rectangle;
+ }
+
+ public function testX () : Void {
+ var rectangle:Rectangle = new Rectangle(1,2,4,8);
+ assertTrue("Test get x", rectangle.x == 1);
+ assertTrue("Test get x width", rectangle.width == 4);
+ rectangle.x = 0;
+ assertTrue("Test set x", rectangle.x == 0);
+ assertTrue("Test set x width", rectangle.right == 4);
+ rectangle.size = new Point(20,20);
+ assertTrue("Test set x (after set size)", rectangle.x == 0);
+ }
+
+ public function testY () : Void {
+ var rectangle:Rectangle = new Rectangle(1,2,4,8);
+ assertTrue("Test get y", rectangle.y == 2);
+ assertTrue("Test get y height", rectangle.height == 8);
+ rectangle.y = 0;
+ assertTrue("Test set y", rectangle.y == 0);
+ assertTrue("Test set y height", rectangle.height == 8);
+ rectangle.size = new Point(20,20);
+ assertTrue("Test set y (after set size)", rectangle.y == 0);
+ }
+
+ public function testClone () : Void {
+ var rectangle:Rectangle = new Rectangle(10,20,100,200);
+ var clone:Rectangle = rectangle.clone();
+ assertTrue("Rectangle clone instantiated", clone instanceof Rectangle);
+ assertTrue("Test clone x", rectangle.x == 10);
+ assertTrue("Test clone y", rectangle.y == 20);
+ assertTrue("Test clone width", rectangle.width == 100);
+ assertTrue("Test clone height", rectangle.height == 200);
+ //equals
+ assertTrue("Test rectangle equals clone", rectangle.equals(clone));
+ }
+
+ public function testContains () : Void {
+ var rectangle:Rectangle = new Rectangle(10, 10, 50, 50);
+ assertTrue("Test contains 1", rectangle.contains(59,59));
+ assertTrue("Test contains 2", rectangle.contains(10,10));
+ assertFalse("Test contains 3", rectangle.contains(60,60));
+ }
+
+ public function testContainsPoint () : Void {
+ var rectangle:Rectangle = new Rectangle(10, 10, 50, 50);
+ assertTrue("Test containsPoint 1", rectangle.containsPoint(new Point(59,59)));
+ assertTrue("Test containsPoint 2", rectangle.containsPoint(new Point(10,10)));
+ assertFalse("Test containsPoint 3", rectangle.containsPoint(new Point(60,60)));
+ }
+
+ public function testContainsRectangle () : Void {
+ var rectA:Rectangle = new Rectangle(10, 10, 50, 50);
+ var rectB:Rectangle = new Rectangle(10, 10, 50, 50);
+ var rectC:Rectangle = new Rectangle(10, 10, 51, 51);
+ var rectD:Rectangle = new Rectangle(15, 15, 45, 45);
+ assertTrue("Test containsRectangle 1", rectA.containsRectangle(rectB));
+ assertFalse("Test containsRectangle 2", rectA.containsRectangle(rectC));
+ assertTrue("Test containsRectangle 3", rectA.containsRectangle(rectD));
+ }
+
+ public function testInflate () : Void {
+ var rectangle:Rectangle = new Rectangle(1, 2, 4, 8);
+ rectangle.inflate(16, 32);
+ assertTrue("Test inflate x", rectangle.x == -15);
+ assertTrue("Test inflate y", rectangle.y == -30);
+ assertTrue("Test inflate width", rectangle.width == 36);
+ assertTrue("Test inflate height", rectangle.height == 72);
+ }
+
+ public function testInflatePoint () : Void {
+ var rectangle:Rectangle = new Rectangle(0, 0, 2, 5);
+ var myPoint:Point = new Point(2, 2);
+ rectangle.inflatePoint(myPoint);
+ assertTrue("Test inflatePoint x", rectangle.x == -2);
+ assertTrue("Test inflatePoint y", rectangle.y == -2);
+ assertTrue("Test inflatePoint width", rectangle.width == 6);
+ assertTrue("Test inflatePoint height", rectangle.height == 9);
+ }
+
+ public function testIntersection () : Void {
+ var rectangle1:Rectangle = new Rectangle(0, 0, 50, 50);
+ var rectangle2:Rectangle = new Rectangle(25, 25, 100, 100);
+ var intersectingArea:Rectangle = rectangle1.intersection(rectangle2);
+ assertFalse("Test intersection non-empty", intersectingArea.isEmpty());
+ assertTrue("Test intersection x", intersectingArea.x == 25);
+ assertTrue("Test intersection y", intersectingArea.y == 25);
+ assertTrue("Test intersection width", intersectingArea.width == 25);
+ assertTrue("Test intersection height", intersectingArea.height == 25);
+ delete rectangle1;
+ delete rectangle2;
+ delete intersectingArea;
+ // test empty intersection
+ var rectangle1:Rectangle = new Rectangle(0, 0, 25, 25);
+ var rectangle2:Rectangle = new Rectangle(50, 50, 25, 25);
+ var intersectingArea:Rectangle = rectangle1.intersection(rectangle2);
+ assertTrue("Test test empty intersection (intersection empty)", intersectingArea.isEmpty());
+ delete rectangle1;
+ delete rectangle2;
+ delete intersectingArea;
+ // test totally overlap
+ var rectangle1:Rectangle = new Rectangle(0, 0, 25, 25);
+ var rectangle2:Rectangle = new Rectangle(10, 10, 5, 5);
+ var intersectingArea:Rectangle = rectangle1.intersection(rectangle2);
+ assertFalse("Test totally overlap (intersection empty)", intersectingArea.isEmpty());
+ assertTrue("Test intersection x", intersectingArea.x == 10);
+ assertTrue("Test intersection y", intersectingArea.y == 10);
+ assertTrue("Test intersection width", intersectingArea.width == 5);
+ assertTrue("Test intersection height", intersectingArea.height == 5);
+ }
+
+ public function testIntersects () : Void {
+ var rectA:Rectangle = new Rectangle(10, 10, 50, 50);
+ var rectB:Rectangle = new Rectangle(59, 59, 50, 50);
+ var rectC:Rectangle = new Rectangle(60, 60, 50, 50);
+ var rectAIntersectsC:Boolean = rectA.intersects(rectC);
+ assertTrue("Test rectA intersects rectB", rectA.intersects(rectB));
+ assertFalse("Test rectA intersects rectC", rectA.intersects(rectC));
+ delete rectA;
+ delete rectB;
+ delete rectC;
+ var firstPixel:Rectangle = new Rectangle(0, 0, 1, 1);
+ var adjacentPixel:Rectangle = new Rectangle(1, 1, 1, 1);
+ var pixelsIntersect:Boolean = firstPixel.intersects(adjacentPixel);
+ assertFalse("Test intersects pixelsIntersect", pixelsIntersect);
+ }
+
+ public function testOffset () : Void {
+ var rectangle:Rectangle = new Rectangle(1, 2, 4, 8);
+ rectangle.offset(16, 32);
+ assertTrue("Test offset x", rectangle.x == 17);
+ assertTrue("Test offset y", rectangle.y == 34);
+ assertTrue("Test offset width", rectangle.width == 4);
+ assertTrue("Test offset height", rectangle.height == 8);
+ }
+
+ public function testOffsetPoint () : Void {
+ var rectangle:Rectangle = new Rectangle(1, 2, 4, 8);
+ rectangle.offsetPoint(new Point(16, 32));
+ assertTrue("Test offsetPoint x", rectangle.x == 17);
+ assertTrue("Test offsetPoint y", rectangle.y == 34);
+ assertTrue("Test offsetPoint width", rectangle.width == 4);
+ assertTrue("Test offsetPoint height", rectangle.height == 8);
+ }
+
+ public function testUnion () : Void {
+ var rectangle1:Rectangle = new Rectangle(20, 50, 60, 30);
+ var rectangle2:Rectangle = new Rectangle(150, 130, 50, 30);
+ var combined:Rectangle = rectangle1.union(rectangle2);
+ assertFalse("Test union empty", combined.isEmpty());
+ assertTrue("Test union x", combined.x == 20);
+ assertTrue("Test union y", combined.y == 50);
+ assertTrue("Test union width", combined.width == 180);
+ assertTrue("Test union height", combined.height == 110);
+ }
+
+ public function testIsEmpty () : Void {
+ var rectangle:Rectangle = new Rectangle(1, 2, 0, 0);
+ assertTrue("Test isEmpty 1", rectangle.isEmpty());
+ delete rectangle;
+ var rectangle:Rectangle = new Rectangle(1, 2, 4, 8);
+ assertFalse("Test isEmpty 2", rectangle.isEmpty());
+ rectangle.width = 0;
+ assertTrue("Test isEmpty 3", rectangle.isEmpty());
+ rectangle.width = 4;
+ assertFalse("Test isEmpty 4", rectangle.isEmpty());
+ rectangle.height = 0;
+ assertTrue("Test isEmpty 5", rectangle.isEmpty());
+ }
+
+ public function testSetEmpty () : Void {
+ var rectangle:Rectangle = new Rectangle(5, 10, 50, 100);
+ assertFalse("Test setEmpty 1", rectangle.isEmpty());
+ rectangle.setEmpty();
+ assertTrue("Test setEmpty 2", rectangle.isEmpty());
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-14 00:03:23
|
Revision: 597
http://svn.sourceforge.net/asapframework/?rev=597&view=rev
Author: aclemens
Date: 2006-10-13 17:03:14 -0700 (Fri, 13 Oct 2006)
Log Message:
-----------
doc update
Modified Paths:
--------------
trunk/asapframework/org/asapframework/util/RectangleUtils.as
Modified: trunk/asapframework/org/asapframework/util/RectangleUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/RectangleUtils.as 2006-10-13 08:30:13 UTC (rev 596)
+++ trunk/asapframework/org/asapframework/util/RectangleUtils.as 2006-10-14 00:03:14 UTC (rev 597)
@@ -129,14 +129,29 @@
/**
Utility fuction to set the center to another rectangle's center.
- @param inRectangle: the rectangle to set the center to
+ @param r1: the rectangle to set the center to
+ @param r2: the rectangle to get the center of
+ @example
+ <code>
+ var rect1:Rectangle = new Rectangle(0,0,20,20);
+ var rect2:Rectangle = new Rectangle(50,50,40,40);
+
+ trace("rect1 = " + rect1); // (x=0, y=0, w=20, h=20)
+ trace("rect2 = " + rect2); // (x=50, y=50, w=40, h=40)
+
+ RectangleUtils.centerToRectangle(rect1, rect2);
+
+ trace("rect1 = " + rect1); // (x=60, y=60, w=20, h=20)
+ trace("rect2 = " + rect2); // (x=50, y=50, w=40, h=40)
+ </code>
*/
public static function centerToRectangle (r1:Rectangle, r2:Rectangle) : Void {
RectangleUtils.setCenter(r1, RectangleUtils.getCenter(r2));
}
/**
- Utility function to flatten the height of the Rectangle to a new given height.
+ Utility function to flatten the height of the Rectangle to a new given height. In contrast to {@link Rectangle#height} flattenHeight originates from the center.
+ @param inRectangle: the Rectangle to flatten the height of
@param inNewHeight: the new height of the Rectangle
*/
public static function flattenHeight (inRectangle:Rectangle, inNewHeight:Number) : Void {
@@ -146,7 +161,8 @@
}
/**
- Utility function to flatten the width of the Rectangle to a new given width.
+ Utility function to flatten the width of the Rectangle to a new given width. In contrast to {@link Rectangle#width} flattenWidth originates from the center.
+ @param inRectangle: the Rectangle to flatten the width of
@param inNewWidth: the new width of the Rectangle
*/
public static function flattenWidth (inRectangle:Rectangle, inNewWidth:Number) : Void {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-13 08:30:21
|
Revision: 596
http://svn.sourceforge.net/asapframework/?rev=596&view=rev
Author: aclemens
Date: 2006-10-13 01:30:13 -0700 (Fri, 13 Oct 2006)
Log Message:
-----------
new tests
Modified Paths:
--------------
trunk/asapframework/tests/unit/includes/testlist.as
Added Paths:
-----------
trunk/asapframework/tests/unit/tests/org/asapframework/util/MovieClipUtilsTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/PointUtilsTest.as
Modified: trunk/asapframework/tests/unit/includes/testlist.as
===================================================================
--- trunk/asapframework/tests/unit/includes/testlist.as 2006-10-12 23:02:30 UTC (rev 595)
+++ trunk/asapframework/tests/unit/includes/testlist.as 2006-10-13 08:30:13 UTC (rev 596)
@@ -1,3 +1,4 @@
+
// data
org.asapframework.data.array.ArrayEnumeratorTest; // complete
org.asapframework.data.array.TraverseArrayEnumeratorTest; // complete
@@ -5,4 +6,6 @@
// util
org.asapframework.util.BooleanUtilsTest; // complete
org.asapframework.util.NumberUtilsTest; // complete
-org.asapframework.util.StringUtilsTest; // TODO: format, capitalizeChar, capitalizeString, capitalizeWords, validateEmail
\ No newline at end of file
+org.asapframework.util.StringUtilsTest; // TODO: format, capitalizeChar, capitalizeString, capitalizeWords, validateEmail
+org.asapframework.util.MovieClipUtilsTest; // complete
+org.asapframework.util.PointUtilsTest; // complete
\ No newline at end of file
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/MovieClipUtilsTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/MovieClipUtilsTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/MovieClipUtilsTest.as 2006-10-13 08:30:13 UTC (rev 596)
@@ -0,0 +1,85 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// Adobe classes
+//import flash.geom.*;
+// Still support Flash 7:
+import org.asapframework.util.types.*;
+
+// ASAP classes
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.MovieClipUtilsTest extends TestCase {
+
+ public function testCenterOnStage () : Void {
+
+ // centerOnStage
+ var centerStageX:Number = Stage.width / 2;
+ var centerStageY:Number = Stage.height / 2;
+ /*
+ var center_mc:MovieClip = drawSquare("MovieClipUtilsTest_square", clipDepth++, 2, 2, 0x0000ff);
+ center_mc._x = centerStageX;
+ center_mc._y = centerStageY;
+ */
+ var size:Number = 100;
+ var mc:MovieClip = drawSquare("MovieClipUtilsTest_square", size, size, 0xff0000);
+
+ // default center
+ MovieClipUtils.centerOnStage(mc);
+ assertTrue("MovieClipUtilsTestTest centerOnStage default x", mc._x == centerStageX);
+ assertTrue("MovieClipUtilsTestTest centerOnStage default y", mc._y == centerStageY);
+
+ // offset
+ MovieClipUtils.centerOnStage(mc, new Point(10,-10));
+ assertTrue("MovieClipUtilsTestTest centerOnStage offset x", mc._x == centerStageX+10);
+ assertTrue("MovieClipUtilsTestTest centerOnStage offset y", mc._y == centerStageY-10);
+
+ // center clip
+ MovieClipUtils.centerOnStage(mc, null, true);
+ assertTrue("MovieClipUtilsTestTest centerOnStage center clip x", mc._x == centerStageX-size/2);
+ assertTrue("MovieClipUtilsTestTest centerOnStage center clip y", mc._y == centerStageY-size/2);
+ mc.removeMovieClip();
+ }
+
+ public function testGetNormalizedScale () : Void {
+ // normalizeScale
+ var frameSize:Point = new Point(120,100);
+ var frame_mc:MovieClip = drawSquare("MovieClipUtilsTest_normalizeScale_1_frame", frameSize.x, frameSize.y, 0x999999);
+ MovieClipUtils.centerOnStage(frame_mc);
+
+ var width:Number = 100;
+ var height:Number = 50;
+ var mc:MovieClip = drawSquare("MovieClipUtilsTest_normalizeScale_1_square", width, height, 0x0000ff);
+ MovieClipUtils.centerOnStage(mc);
+
+ var f:Number = MovieClipUtils.getNormalizedScale(mc, frameSize);
+ mc._xscale = mc._yscale = f;
+ assertTrue("MovieClipUtilsTestTest normalizeScale scaling factor", f == 120);
+ assertTrue("MovieClipUtilsTestTest normalizeScale width", mc._width == frame_mc._width);
+ assertTrue("MovieClipUtilsTestTest normalizeScale yscale", mc._yscale == 120);
+
+ frame_mc.removeMovieClip();
+ mc.removeMovieClip();
+ }
+
+
+
+ /**
+ Creates a movieclip in _level0 and draws a square in it.
+ @return The created movieclip.
+ */
+ private function drawSquare (inName:String, inWidth:Number, inHeight:Number, inColor:Number) : MovieClip
+ {
+ var mc:MovieClip = _level0.createEmptyMovieClip(inName, _level0.getNextHighestDepth());
+ var edgeX:Number = inWidth/2;
+ var edgeY:Number = inHeight/2;
+ MovieClipUtils.drawBox(mc, -edgeX, -edgeY, edgeX, edgeY, [0, inColor, 100], []);
+
+ assertTrue("MovieClipUtilsTestTest drawBox width", mc._width == inWidth);
+ assertTrue("MovieClipUtilsTestTest drawBox height", mc._height == inHeight);
+ return mc;
+ }
+
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/PointUtilsTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/PointUtilsTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/PointUtilsTest.as 2006-10-13 08:30:13 UTC (rev 596)
@@ -0,0 +1,181 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// Adobe classes
+//import flash.geom.*;
+// Still support Flash 7:
+import org.asapframework.util.types.*;
+
+// ASAP classes
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.PointUtilsTest extends TestCase {
+
+ public function testMultiply () : Void {
+ var point:Point = new Point(100,200);
+ var newPoint:Point
+
+ newPoint = PointUtils.multiply(point, 1);
+ assertTrue("PointUtilsTest testMultiply x", (newPoint.x == 100));
+ assertTrue("PointUtilsTest testMultiply y", (newPoint.y == 200));
+
+ newPoint = PointUtils.multiply(point, 0.5);
+ assertTrue("PointUtilsTest testMultiply x", (newPoint.x == 50));
+ assertTrue("PointUtilsTest testMultiply y", (newPoint.y == 100));
+
+ newPoint = PointUtils.multiply(point, 2);
+ assertTrue("PointUtilsTest testMultiply x", (newPoint.x == 200));
+ assertTrue("PointUtilsTest testMultiply y", (newPoint.y == 400));
+ }
+
+ public function testAverage () : Void {
+ var point1:Point, point2:Point, averagePoint:Point;
+
+ point1 = new Point(0,0);
+ point2 = new Point(100,100);
+ averagePoint = PointUtils.average(point1, point2);
+ assertTrue("PointTest Test average 1 x", averagePoint.x == 50);
+ assertTrue("PointTest Test average 1 y", averagePoint.y == 50);
+
+ point1 = new Point(100,-100);
+ point2 = new Point(0,0);
+ averagePoint = PointUtils.average(point1, point2);
+ assertTrue("PointTest Test average 2 x", averagePoint.x == 50);
+ assertTrue("PointTest Test average 2 y", averagePoint.y == -50);
+ }
+ /*
+
+ // Point constructor (default values)
+ var point:Point = new Point();
+ assertTrue("PointTest Test initial default x", point.x == undefined);
+ assertTrue("PointTest Test initial default y", point.y == undefined);
+ delete point;
+
+ // Point constructor (set values)
+ var point:Point = new Point(3,4);
+ assertTrue("PointTest Test initial set x", point.x == 3);
+ assertTrue("PointTest Test initial set y", point.y == 4);
+ delete point;
+
+ //setting public vars
+ var point:Point = new Point(3,4);
+ point.x *= 100;
+ point.y *= 100;
+ assertTrue("PointTest Test set x", point.x == 300);
+ assertTrue("PointTest Test set y", point.y == 400);
+ delete point;
+
+ // distance
+ var point1:Point = new Point(0,0);
+ var point2:Point = new Point(300,400);
+ assertTrue("PointTest Test distance", Point.distance(point1, point2) == 500);
+ point2.x = point2.y = 0;
+ assertTrue("PointTest Test distance", Point.distance(point1, point2) == 0);
+ delete point1;
+ delete point2;
+
+ // clone
+ var point:Point = new Point(-1000,-2000);
+ var clone:Point = point.clone();
+ assertTrue("PointTest Point clone instantiated", clone instanceof Point);
+ assertTrue("PointTest Test clone x", point.x == -1000);
+ assertTrue("PointTest Test clone y", point.y == -2000);
+ //equals
+ assertTrue("PointTest Test point equals clone", point.equals(clone));
+ delete point;
+ delete clone;
+
+ // offset
+ var point:Point = new Point(0,0);
+ point.offset(-100,-100);
+ assertTrue("PointTest Test offset x", point.x == -100);
+ assertTrue("PointTest Test offset y", point.y == -100);
+ delete point;
+
+ // subtract
+ var point:Point = new Point(100,100);
+ var subtractPoint:Point = new Point(0,10);
+ var resultPoint:Point = point.subtract(subtractPoint);
+ assertTrue("PointTest Test subtracted x", resultPoint.x == 100);
+ assertTrue("PointTest Test subtracted y", resultPoint.y == 90);
+ delete point;
+ delete subtractPoint;
+ delete resultPoint;
+
+ // addPoint
+ var point:Point = new Point(0,0);
+ var addPoint:Point = new Point(1.5, 2.5);
+ var resultPoint:Point = point.addPoint(addPoint);
+ assertTrue("PointTest Test added x 1", resultPoint.x == 1.5);
+ assertTrue("PointTest Test added y 1", resultPoint.y == 2.5);
+ delete point;
+ delete addPoint;
+ delete resultPoint;
+ var point:Point = new Point(10, 20);
+ var resultPoint:Point = point.addPoint(new Point(20,10));
+ assertTrue("PointTest Test added x 2", resultPoint.x == 30);
+ assertTrue("PointTest Test added y 2", resultPoint.y == 30);
+ delete point;
+ delete addPoint;
+ delete resultPoint;
+
+ // normalize
+ var point:Point = new Point(1000,500);
+ point.normalize(1.0);
+ assertTrue("PointTest Test normalized x", point.x == 1.0);
+ assertTrue("PointTest Test normalized y", point.y == .5);
+ delete point;
+ var point:Point = new Point(0,0);
+ point.normalize(0);
+ assertTrue("PointTest Test normalized x", point.x == 0);
+ assertTrue("PointTest Test normalized y", point.y == 0);
+ delete point;
+ var point:Point = new Point(-100,-200);
+ point.normalize(10);
+ assertTrue("PointTest Test normalized x", point.x == -5);
+ assertTrue("PointTest Test normalized y", point.y == -10);
+ delete point;
+
+ // multiply
+ var point:Point = new Point(100,200);
+ var multiplyPoint:Point = point.multiply(0);
+ assertTrue("PointTest Test multiplied 1 x", multiplyPoint.x == 0);
+ assertTrue("PointTest Test multiplied 1 y", multiplyPoint.y == 0);
+ delete point;
+ delete multiplyPoint;
+ var point:Point = new Point(100,200);
+ var multiplyPoint:Point = point.multiply(0.5);
+ assertTrue("PointTest Test multiplied 2 x", multiplyPoint.x == 50);
+ assertTrue("Test multiplied 2 y", multiplyPoint.y == 100);
+ delete point;
+ delete multiplyPoint;
+ var point:Point = new Point(100,200);
+ var multiplyPoint:Point = point.multiply(-10);
+ assertTrue("PointTest Test multiplied 2 x", multiplyPoint.x == -1000);
+ assertTrue("PointTest Test multiplied 2 y", multiplyPoint.y == -2000);
+ delete point;
+ delete multiplyPoint;
+
+ // average
+ var point1:Point = new Point(0,0);
+ var point2:Point = new Point(100,100);
+ var averagePoint = PointUtils.average(point1, point2);
+ assertTrue("PointTest Test average 1 x", averagePoint.x == 50);
+ assertTrue("PointTest Test average 1 y", averagePoint.y == 50);
+ delete point1;
+ delete point2;
+ delete averagePoint;
+ //
+ var point1:Point = new Point(100,-100);
+ var point2:Point = new Point(0,0);
+ var averagePoint = PointUtils.average(point1, point2);
+ assertTrue("PointTest Test average 2 x", averagePoint.x == 50);
+ assertTrue("PointTest Test average 2 y", averagePoint.y == -50);
+ delete point1;
+ delete point2;
+ delete averagePoint;
+ }
+ */
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 23:02:34
|
Revision: 595
http://svn.sourceforge.net/asapframework/?rev=595&view=rev
Author: aclemens
Date: 2006-10-12 16:02:30 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
updating status
Modified Paths:
--------------
trunk/asapframework/tests/unit/includes/testlist.as
Modified: trunk/asapframework/tests/unit/includes/testlist.as
===================================================================
--- trunk/asapframework/tests/unit/includes/testlist.as 2006-10-12 22:59:40 UTC (rev 594)
+++ trunk/asapframework/tests/unit/includes/testlist.as 2006-10-12 23:02:30 UTC (rev 595)
@@ -5,4 +5,4 @@
// util
org.asapframework.util.BooleanUtilsTest; // complete
org.asapframework.util.NumberUtilsTest; // complete
-org.asapframework.util.StringUtilsTest; // TODO: remove, replace, format, capitalizeChar, capitalizeString, capitalizeWords, validateEmail
\ No newline at end of file
+org.asapframework.util.StringUtilsTest; // TODO: format, capitalizeChar, capitalizeString, capitalizeWords, validateEmail
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 22:59:43
|
Revision: 594
http://svn.sourceforge.net/asapframework/?rev=594&view=rev
Author: aclemens
Date: 2006-10-12 15:59:40 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
removing old test files
Removed Paths:
-------------
trunk/asapframework/tests/unit/org/
trunk/asapframework/tests/unit/playground/
trunk/asapframework/tests/unit/testdata/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 22:53:13
|
Revision: 593
http://svn.sourceforge.net/asapframework/?rev=593&view=rev
Author: aclemens
Date: 2006-10-12 15:52:53 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
new unit testing framework files - as2lib needs to be downloaded separately from their website or at https://sourceforge.net/project/showfiles.php?group_id=94206&package_id=100189&release_id=363240
Added Paths:
-----------
trunk/asapframework/tests/unit/UnitTester.fla
trunk/asapframework/tests/unit/controller/
trunk/asapframework/tests/unit/controller/UnitTester.as
trunk/asapframework/tests/unit/includes/
trunk/asapframework/tests/unit/includes/testlist.as
trunk/asapframework/tests/unit/lib/
trunk/asapframework/tests/unit/lib/test_lib_readme.txt
trunk/asapframework/tests/unit/tests/
trunk/asapframework/tests/unit/tests/org/
trunk/asapframework/tests/unit/tests/org/asapframework/
trunk/asapframework/tests/unit/tests/org/asapframework/data/
trunk/asapframework/tests/unit/tests/org/asapframework/data/array/
trunk/asapframework/tests/unit/tests/org/asapframework/data/array/ArrayEnumeratorTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/data/array/TraverseArrayEnumeratorTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/
trunk/asapframework/tests/unit/tests/org/asapframework/util/BooleanUtilsTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/NumberUtilsTest.as
trunk/asapframework/tests/unit/tests/org/asapframework/util/StringUtilsTest.as
Added: trunk/asapframework/tests/unit/UnitTester.fla
===================================================================
(Binary files differ)
Property changes on: trunk/asapframework/tests/unit/UnitTester.fla
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/asapframework/tests/unit/controller/UnitTester.as
===================================================================
--- trunk/asapframework/tests/unit/controller/UnitTester.as (rev 0)
+++ trunk/asapframework/tests/unit/controller/UnitTester.as 2006-10-12 22:52:53 UTC (rev 593)
@@ -0,0 +1,29 @@
+// test lib classes
+import org.as2lib.test.unit.*;
+import org.as2lib.env.log.logger.TraceLogger;
+import org.as2lib.env.log.LogManager;
+
+
+class UnitTester {
+
+ public static function main() : Void {
+ var tester:UnitTester = new UnitTester();
+ }
+
+ private function UnitTester () {
+ start();
+ }
+
+ private function start () {
+
+ var logger:TraceLogger = new TraceLogger();
+ LogManager.setLogger(logger);
+
+ #include "includes/testlist.as"
+
+ var suite:TestSuite = new TestSuiteFactory().collectAllTestCases();
+ var runner:TestRunner = suite.getTestRunner();
+ runner.addListener(LoggerTestListener.getInstance());
+ runner.start();
+ }
+}
\ No newline at end of file
Added: trunk/asapframework/tests/unit/includes/testlist.as
===================================================================
--- trunk/asapframework/tests/unit/includes/testlist.as (rev 0)
+++ trunk/asapframework/tests/unit/includes/testlist.as 2006-10-12 22:52:53 UTC (rev 593)
@@ -0,0 +1,8 @@
+// data
+org.asapframework.data.array.ArrayEnumeratorTest; // complete
+org.asapframework.data.array.TraverseArrayEnumeratorTest; // complete
+
+// util
+org.asapframework.util.BooleanUtilsTest; // complete
+org.asapframework.util.NumberUtilsTest; // complete
+org.asapframework.util.StringUtilsTest; // TODO: remove, replace, format, capitalizeChar, capitalizeString, capitalizeWords, validateEmail
\ No newline at end of file
Added: trunk/asapframework/tests/unit/lib/test_lib_readme.txt
===================================================================
--- trunk/asapframework/tests/unit/lib/test_lib_readme.txt (rev 0)
+++ trunk/asapframework/tests/unit/lib/test_lib_readme.txt 2006-10-12 22:52:53 UTC (rev 593)
@@ -0,0 +1,5 @@
+Testing framework: as2lib version 0.93
+
+Site: http://as2lib.org
+
+Download: https://sourceforge.net/project/showfiles.php?group_id=94206&package_id=100189&release_id=363240
\ No newline at end of file
Added: trunk/asapframework/tests/unit/tests/org/asapframework/data/array/ArrayEnumeratorTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/data/array/ArrayEnumeratorTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/data/array/ArrayEnumeratorTest.as 2006-10-12 22:52:53 UTC (rev 593)
@@ -0,0 +1,53 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.data.array.ArrayEnumerator;
+
+
+class org.asapframework.data.array.ArrayEnumeratorTest extends TestCase {
+
+ public function testNew () : Void {
+
+ var chars:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:ArrayEnumerator = new ArrayEnumerator(chars);
+ assertTrue("ArrayEnumerator getAllObjects", (enumerator.getAllObjects() == chars));
+ }
+
+ public function testSetArray () : Void {
+
+ var chars:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:ArrayEnumerator = new ArrayEnumerator();
+ enumerator.setArray(chars);
+ assertTrue("ArrayEnumerator getAllObjects", (enumerator.getAllObjects() == chars));
+ }
+
+ public function testIteration () : Void {
+
+ var chars:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:ArrayEnumerator = new ArrayEnumerator(chars);
+
+ assertTrue("ArrayEnumerator getCurrentObject", (enumerator.getCurrentObject() == null));
+
+ assertTrue("ArrayEnumerator getNextObject", (enumerator.getNextObject() == "a"));
+ assertTrue("ArrayEnumerator getCurrentObject after getNextObject", (enumerator.getCurrentObject() == "a"));
+
+ enumerator.reset();
+ assertTrue("ArrayEnumerator getCurrentObject after reset", (enumerator.getCurrentObject() == null));
+
+ enumerator.getNextObject(); // a
+ enumerator.getNextObject(); // b
+ enumerator.getNextObject(); // c
+ enumerator.getNextObject(); // d
+ enumerator.getNextObject(); // e
+ assertTrue("ArrayEnumerator getNextObject", (enumerator.getNextObject() == null));
+
+ enumerator.setCurrentLocation(2); // c
+ assertTrue("ArrayEnumerator getCurrentObject after setCurrentLocation", (enumerator.getCurrentObject() == "c"));
+
+ enumerator.setCurrentObject("b");
+ assertTrue("ArrayEnumerator getCurrentObject after setCurrentObject", (enumerator.getCurrentObject() == "b"));
+
+ }
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/data/array/TraverseArrayEnumeratorTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/data/array/TraverseArrayEnumeratorTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/data/array/TraverseArrayEnumeratorTest.as 2006-10-12 22:52:53 UTC (rev 593)
@@ -0,0 +1,175 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.data.array.*;
+
+
+class org.asapframework.data.array.TraverseArrayEnumeratorTest extends TestCase {
+
+ private static var DELEGATE_TEST_VALUE = "e";
+
+ private var mReceivedOnArrayTraverseEvent:Boolean = null;
+ private var mArray:Array;
+
+ public function testNew() : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+
+ // test everything from TraverseArrayEnumerator
+ assertTrue("TraverseArrayEnumerator getAllObjects", (enumerator.getAllObjects() == letters));
+
+ enumerator.setArray(letters);
+ assertTrue("TraverseArrayEnumerator getAllObjects after setArray", (enumerator.getAllObjects() == letters));
+
+ assertTrue("TraverseArrayEnumerator getCurrentObject", (enumerator.getCurrentObject() == null));
+ }
+
+ public function testCurrentObject () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+
+ assertTrue("TraverseArrayEnumerator getCurrentObject", (enumerator.getCurrentObject() == null));
+
+ var letter:String = enumerator.getNextObject();
+ assertTrue("TraverseArrayEnumerator getNextObject", (letter == "a"));
+ assertTrue("TraverseArrayEnumerator getCurrentObject after getNextObject", (enumerator.getCurrentObject() == "a"));
+ }
+
+ public function testReset () : Void {
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+ enumerator.reset();
+ assertTrue("TraverseArrayEnumerator getCurrentObject after reset", (enumerator.getCurrentObject() == null));
+ }
+
+ public function testIteration () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+
+ enumerator.getNextObject(); // a
+ enumerator.getNextObject(); // b
+ enumerator.getNextObject(); // c
+ enumerator.getNextObject(); // d
+ enumerator.getNextObject(); // e
+ assertTrue("TraverseArrayEnumerator getNextObject", (enumerator.getNextObject() == null));
+ }
+
+ public function testIterationForwardWithoutLooping () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+
+ // test without looping
+ enumerator.reset();
+ enumerator.getNextObject(); // a
+ enumerator.getNextObject(); // b
+ enumerator.getNextObject(); // c
+ enumerator.getNextObject(); // d
+ enumerator.getNextObject(); // e
+ assertTrue("TraverseArrayEnumerator hasNextObject without looping 'a'", (enumerator.hasNextObject() == false));
+ assertTrue("TraverseArrayEnumerator getNextObject without looping 'a'", (enumerator.getNextObject() == null));
+ }
+
+ public function testIterationForwardWithLooping () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+
+ // test with looping
+ enumerator.setLoop(true);
+ enumerator.getNextObject(); // a
+ enumerator.getNextObject(); // b
+ enumerator.getNextObject(); // c
+ enumerator.getNextObject(); // d
+ enumerator.getNextObject(); // e
+ assertTrue("TraverseArrayEnumerator hasNextObject with looping 'a'", (enumerator.hasNextObject() == true));
+ assertTrue("TraverseArrayEnumerator getNextObject with looping 'a'", (enumerator.getNextObject() == "a"));
+ }
+
+ public function testIterationBackwardWithLooping () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+
+ // test with looping
+ enumerator.setLoop(true);
+ enumerator.getPreviousObject(); // e
+ enumerator.getPreviousObject(); // d
+ assertTrue("TraverseArrayEnumerator getCurrentObject with looping backwards 'd'", (enumerator.getCurrentObject() == 'd'));
+ }
+
+ public function testPreviousWithoutLooping () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+
+ // test 'previous' without looping
+ enumerator.setLoop(false);
+ enumerator.reset();
+ assertTrue("TraverseArrayEnumerator getPreviousObject no loop 'e'", (enumerator.getPreviousObject() == null));
+ }
+
+ public function testPreviousWithLooping () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+
+ // test 'previous' with looping
+ enumerator.setLoop(true);
+ enumerator.reset();
+ assertTrue("TraverseArrayEnumerator getPreviousObject loop 'e'", (enumerator.getPreviousObject() == "e"));
+ }
+
+ public function testArrayEnumeratorEvent () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(letters);
+ enumerator.addEventListener(TraverseArrayEnumeratorEvent.UPDATE,
+this);
+ enumerator.getNextObject();
+
+ // evaluate received events without delegate
+ assertTrue("TraverseArrayEnumerator event", mReceivedOnArrayTraverseEvent);
+ }
+
+ public function testDelegate () : Void {
+
+ var letters:Array = ["a", "b", "c", "d", "e"];
+ setArray(letters);
+ var enumerator:TraverseArrayEnumerator = new TraverseArrayEnumerator(getArray());
+ enumerator.setLoop(true);
+
+ enumerator.setDelegate(this, checkIsCorrectLetter);
+ // evaluate received events with delegate
+ enumerator.reset();
+ enumerator.getNextObject(); // b?
+ assertNull("TraverseArrayEnumerator event with delegate - should be refused", mReceivedOnArrayTraverseEvent);
+ assertTrue("TraverseArrayEnumerator getCurrentObject after delegate refusion", (enumerator.getCurrentObject() == null));
+
+ enumerator.getPreviousObject(); // e
+ assertTrue("TraverseArrayEnumerator event with delegate - should be accepted: 'e'", (enumerator.getCurrentObject() == 'e'));
+ }
+
+ private function setArray (inArray:Array) : Void {
+ mArray = inArray;
+ }
+
+ private function getArray () : Array {
+ return mArray;
+ }
+
+ private function onTraverseArrayEnumeratorUpdate (e:TraverseArrayEnumeratorEvent) : Void {
+ mReceivedOnArrayTraverseEvent = true;
+ }
+
+
+ private function checkIsCorrectLetter (inLocation:Number) : Boolean {
+ return getArray()[inLocation] == DELEGATE_TEST_VALUE;
+ }
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/BooleanUtilsTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/BooleanUtilsTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/BooleanUtilsTest.as 2006-10-12 22:52:53 UTC (rev 593)
@@ -0,0 +1,27 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.BooleanUtilsTest extends TestCase {
+
+ public function testGetBoolean () : Void {
+ assertFalse("BooleanUtilsTest getBoolean empty", BooleanUtils.getBoolean());
+ assertFalse("BooleanUtilsTest getBoolean 0", BooleanUtils.getBoolean(0));
+ assertFalse("BooleanUtilsTest getBoolean \"0\"", BooleanUtils.getBoolean("0"));
+ assertFalse("BooleanUtilsTest getBoolean false", BooleanUtils.getBoolean(false));
+ assertFalse("BooleanUtilsTest getBoolean \"false\"", BooleanUtils.getBoolean("false"));
+ assertFalse("BooleanUtilsTest getBoolean \"off\"", BooleanUtils.getBoolean("off"));
+ assertFalse("BooleanUtilsTest getBoolean \"no\"", BooleanUtils.getBoolean("no"));
+ assertTrue("BooleanUtilsTest getBoolean 1", BooleanUtils.getBoolean(1));
+ assertTrue("BooleanUtilsTest getBoolean \"1\"", BooleanUtils.getBoolean("1"));
+ assertTrue("BooleanUtilsTest getBoolean true", BooleanUtils.getBoolean(true));
+ assertTrue("BooleanUtilsTest getBoolean \"true\"", BooleanUtils.getBoolean("true"));
+ assertTrue("BooleanUtilsTest getBoolean \"on\"", BooleanUtils.getBoolean("on"));
+ assertTrue("BooleanUtilsTest getBoolean \"yes\"", BooleanUtils.getBoolean("yes"));
+ }
+
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/NumberUtilsTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/NumberUtilsTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/NumberUtilsTest.as 2006-10-12 22:52:53 UTC (rev 593)
@@ -0,0 +1,106 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.NumberUtilsTest extends TestCase {
+
+ public function testRandomInRange () : Void {
+ randomInRangeTest("1", 0, 0);
+ randomInRangeTest("2", 0, 10);
+ randomInRangeTest("3", -10, 10);
+ randomInRangeTest("4", -.5, .5);
+ }
+
+ public function testRandomInRanges () : Void {
+ randomInRangesTest("1", [0, 0], [0, 0]);
+ randomInRangesTest("2", [0, 10], [0, 10]);
+ randomInRangesTest("3", [-10, -5], [5, 10]);
+ randomInRangesTest("4", [-.5, 0], [.5, 1]);
+ }
+
+ public function testTruncate () : Void {
+ assertTrue("NumberUtilsTest truncate 1", NumberUtils.truncate(3.14159265, 2).toString() == "3.14");
+ assertTrue("NumberUtilsTest truncate 2", NumberUtils.truncate(0, 0).toString() == "0");
+ assertTrue("NumberUtilsTest truncate 3", NumberUtils.truncate(3.14, 0).toString() == "3");
+ assertTrue("NumberUtilsTest truncate 4", NumberUtils.truncate(3.14, -1).toString() == "3.14");
+ }
+
+
+ public function testPiOffset () : Void {
+ assertTrue("NumberUtilsTest piOffset 1", NumberUtils.piOffset(0, -1, 1) == 0);
+ assertTrue("NumberUtilsTest piOffset 2", NumberUtils.piOffset(1, -1, 1) == 0.5 * Math.PI);
+ assertTrue("NumberUtilsTest piOffset 3", NumberUtils.piOffset(-1, -1, 1) == -0.5 * Math.PI);
+ }
+
+ public function testNormalizedValue () : Void {
+ assertTrue("NumberUtilsTest normalizedValue 1", NumberUtils.normalizedValue(0, -1, 1) == 0.5);
+ assertTrue("NumberUtilsTest normalizedValue 2", NumberUtils.normalizedValue(25, 0, 100) == .25);
+ assertTrue("NumberUtilsTest normalizedValue 3", NumberUtils.normalizedValue(-1, -1, 1) == 0);
+ assertTrue("NumberUtilsTest normalizedValue 4", NumberUtils.normalizedValue(1, -1, 1) == 1);
+ assertTrue("NumberUtilsTest normalizedValue 5", NumberUtils.normalizedValue(-100, 0, 100) == -1);
+ }
+
+
+ public function testAngle () : Void {
+ assertTrue("NumberUtilsTest angle 1", NumberUtils.angle(0, 0) == 0);
+ assertTrue("NumberUtilsTest angle 2", NumberUtils.angle(.5, .5) == 45);
+ assertTrue("NumberUtilsTest angle 3", NumberUtils.angle(0, -1) == -90);
+ assertTrue("NumberUtilsTest angle 4", NumberUtils.angle(-1, -1) == -135);
+ assertTrue("NumberUtilsTest angle 5", NumberUtils.angle(-1, 0) == 180);
+ assertTrue("NumberUtilsTest angle 6", NumberUtils.angle(-1, 1) == 135);
+ assertTrue("NumberUtilsTest angle 7", NumberUtils.angle(0, 1) == 90);
+ assertTrue("NumberUtilsTest angle 8", NumberUtils.angle(1, 1) == 45);
+ assertTrue("NumberUtilsTest angle 9", NumberUtils.angle(1, 0) == 0);
+ }
+
+
+ /**
+ Generates 100 random numbers and checks if the numbers are within the valid range as defined by inStartRange and inEndRange.
+ */
+ private function randomInRangeTest (inTestName:String, inStartRange:Number, inEndRange:Number) : Void {
+
+ var count:Number = 100;
+ var i:Number = count;
+ var total:Number = 0;
+ var rand:Number
+ while (i > 0) {
+ rand = NumberUtils.randomInRange(inStartRange, inEndRange);
+ if (rand < inStartRange) {
+ assertTrue("NumberUtilsTest randomInRange too small" + inTestName, false);
+ }
+ if (rand > inEndRange) {
+ assertTrue("NumberUtilsTest randomInRange too large" + inTestName, false);
+ }
+ total += rand;
+ i--;
+ }
+ var average:Number = total / count;
+ assertTrue("NumberUtilsTest randomInRange average " + inTestName, average >= inStartRange);
+ assertTrue("NumberUtilsTest randomInRange average " + inTestName, average <= inEndRange);
+ }
+
+ /**
+ Generates 100 random numbers and checks if the numbers are within the valid range as defined by inStartRange and inEndRange.
+ */
+ private function randomInRangesTest (inTestName:String, inRange1:Array, inRange2:Array) : Void {
+
+ var count:Number = 100;
+ var i:Number = count;
+ var total:Number = 0;
+ var rand:Number
+ while (i > 0) {
+ rand = NumberUtils.randomInRanges(inRange1, inRange2);
+ if (rand < inRange1[0] && rand < inRange2[0]) {
+ assertTrue("NumberUtilsTest randomInRanges too small" + inTestName, false);
+ }
+ if (rand > inRange1[1] && rand > inRange2[1]) {
+ assertTrue("NumberUtilsTest randomInRanges too large" + inTestName, false);
+ }
+ i--;
+ }
+ }
+}
Added: trunk/asapframework/tests/unit/tests/org/asapframework/util/StringUtilsTest.as
===================================================================
--- trunk/asapframework/tests/unit/tests/org/asapframework/util/StringUtilsTest.as (rev 0)
+++ trunk/asapframework/tests/unit/tests/org/asapframework/util/StringUtilsTest.as 2006-10-12 22:52:53 UTC (rev 593)
@@ -0,0 +1,64 @@
+// testlib classes
+import org.as2lib.test.unit.TestCase;
+import org.as2lib.test.mock.MockControl;
+
+// ASAP classes
+import org.asapframework.util.*;
+
+
+class org.asapframework.util.StringUtilsTest extends TestCase {
+
+ public function testRemove () : Void {
+ assertTrue("StringUtils remove 1", StringUtils.remove(" ", " ") == "");
+ assertTrue("StringUtils remove 2", StringUtils.remove("abc123abc", "abc") == "123");
+ assertTrue("StringUtils remove 3", StringUtils.remove("This is my String", "my ") == "This is String");
+ }
+
+ public function testReplace () : Void {
+ assertTrue("StringUtils replace 1", StringUtils.replace(" ", " ", "") == "");
+ assertTrue("StringUtils replace 2", StringUtils.replace("abc123abc", "abc", "123") == "123123123");
+ assertTrue("StringUtils replace 3", StringUtils.replace("This is my String", "my", "not a") == "This is not a String");
+ }
+
+ public function testAppendDecimalString () : Void {
+
+ var result:String;
+
+ result = StringUtils.appendDecimalString("0", "", 2);
+ assertTrue("StringUtilsTest appendDecimalString 1", result == "0");
+
+ result = StringUtils.appendDecimalString("0", "0", 2);
+ assertTrue("StringUtilsTest appendDecimalString 2", result == "0.00");
+
+ result = StringUtils.appendDecimalString("3.1", "0", 2);
+ assertTrue("StringUtilsTest appendDecimalString 3", result == "3.10");
+
+ result = StringUtils.appendDecimalString("3.0", "0", 2);
+ assertTrue("StringUtilsTest appendDecimalString 4", result == "3.00");
+
+ result = StringUtils.appendDecimalString("3.00", "0", 1, true);
+ assertTrue("StringUtilsTest appendDecimalString 5", result == "3.0");
+
+ result = StringUtils.appendDecimalString("3.123456789", "12", 2, true);
+ assertTrue("StringUtilsTest appendDecimalString 6", result == "3.12");
+
+ result = StringUtils.appendDecimalString("3.123456789", "12", 2, false);
+ assertTrue("StringUtilsTest appendDecimalString 7", result == "3.123456789");
+
+ result = StringUtils.appendDecimalString("3.00", "", 0);
+ assertTrue("StringUtilsTest appendDecimalString 8", result == "3.00");
+
+ result = StringUtils.appendDecimalString("3.00", "", 0, true);
+ assertTrue("StringUtilsTest appendDecimalString 9", result == "3");
+
+ result = StringUtils.appendDecimalString("3", "0", 2, null, ",");
+ assertTrue("StringUtilsTest appendDecimalString 10", result == "3,00");
+
+ result = StringUtils.appendDecimalString("A", "BCDE", 2, false, "");
+ assertTrue("StringUtilsTest appendDecimalString 11", result == "ABC");
+
+ result = StringUtils.appendDecimalString("ABCD", "E", 1, true, "");
+ assertTrue("StringUtilsTest appendDecimalString 12", result == "ABCDE");
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 22:52:39
|
Revision: 592
http://svn.sourceforge.net/asapframework/?rev=592&view=rev
Author: aclemens
Date: 2006-10-12 15:52:35 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
removing old test files
Removed Paths:
-------------
trunk/asapframework/tests/unit/AllTests.as
trunk/asapframework/tests/unit/AsUnit_Readme.txt
Deleted: trunk/asapframework/tests/unit/AllTests.as
===================================================================
--- trunk/asapframework/tests/unit/AllTests.as 2006-10-12 22:50:39 UTC (rev 591)
+++ trunk/asapframework/tests/unit/AllTests.as 2006-10-12 22:52:35 UTC (rev 592)
@@ -1,11 +0,0 @@
-
-class AllTests extends com.asunit.framework.TestSuite {
- private var className:String = "AllTests";
-
- public function AllTests() {
- super();
- addTest(new org.AllTests());
- addTest(new playground.AllTests());
- addTest(new testdata.AllTests());
- }
-}
Deleted: trunk/asapframework/tests/unit/AsUnit_Readme.txt
===================================================================
--- trunk/asapframework/tests/unit/AsUnit_Readme.txt 2006-10-12 22:50:39 UTC (rev 591)
+++ trunk/asapframework/tests/unit/AsUnit_Readme.txt 2006-10-12 22:52:35 UTC (rev 592)
@@ -1,228 +0,0 @@
-
----------------------------------------
-Flash QUICKSTART INSTRUCTIONS:
----------------------------------------
-
- - Open Flash MX Professional 2004
- - Create a new .fla file, name it "Example.fla" and save it to a NEW and EMPTY directory
- on your computer.
- *NOTE: There is deep recursive search and file creation associated with the
- automated creation of Test Suites. This will cause undesired behavior if executed
- outside of a project-only directory.
- - Open the Native Flash Output Panel if it's not already open (Window >> Development
- Panels >> Output or F2)
- - Click Window >> Other Panels >> AsUnit Ui
- - Dock the AsUnit Ui underneath (or above) the Output Panel
- * I try to save this panel set by choosing Window >> Save Panel Layout because sometimes
- Flash will hide your panels for some crazy reason!
- - Choose Commands >> Create Class
- - In the pop-up window, type "com.asunit.example.ExampleClass" (without the quotes)
- - Select:
- "Automatically Open New Files"
- "Add new Test
- and be sure that "Prefix Class Name with __Packages" and "Add to Library as MovieClip"
-is deselected.
- see: http://www.asunit.com/docs/img/simpleclass.jpg for an example.
-
- - Click OK
- - Select frame 1 of your new movie and open the Actions Panel (Window >> Development
- Panels >> Actions or F9)
- - In the Actions Panel, type:
- var at:AllTests = new AllTests();
- - Test the Movie (Control >> Test Movie or CTRL+ENTER)
- * Make sure that the Output Panel and Unit Test Panel both stay open. You can open the
- Output Panel by pressing F2.
-
-The Unit Test UI Panel should say something like, "1 of 2 Asserts Passed". This is
-desired behavior because the new TestCase Template includes 2 assertions. The first one
-instantiates the newly-created class and asserts it's data type. This should be passing.
-
- * You should be able to click on the underlined portion of the Failing Test in the AsUnit Panel
- To open the .as file directly.
-
-The second assertion is a failing assertion that will provide immediate notification that
-the newly-created TestCase is actually being executed.
-
- - Now go to com/asunit/example and open ExampleClassTest.as (From wherever you saved your
- .FLA file.)
- - Change line 22 from:
- assertTrue("failingtest", false);
- to:
- assertTrue("passingtest", true);
- - Now Compile and you should have 2 of 2 Assertions passing.
-
-
----------------------------------------
-NOTES:
-
- - If you EVER close the AsUnit UI Panel, you will probably have to click it's "RELOAD"
- button.
- - If you EVER wonder if tests are being executed, click the Panel's "RELOAD" button.
- - You should *never* manually modify any file named "AllTests.as" as these are auto-created
- whenever you choose to "Create Class" with "Update Test Suites" selected OR when you choose
- the "Build Test Suites" command.
- - If you want your newly-created class to look differently, you can modify the Class Template
- by opening: Configuration >> External Libraries >> ClassTemplate.as
-
-* It should be fairly straightforward, anything found in [% %] will be replaced by your
-entries in the form, other than that everything will appear as expected.
-* If you change this file, be sure to back it up and re-overwrite it whenever you update
-using the AsUnit.mxp file.
-
----------------------------------------
-Flex QUICKSTART INSTRUCTIONS:
----------------------------------------
-
- - Download the SOURCE package (not just the installer)
- - Unzip the file into some directory and copy the entire contents of the "com" folder
- (including the "com" folder itself) into a folder that has been identified in the
- Flex classpath. Mine is as follows:
-
- File Found at: [Flex Installation Folder]/jrun4/servers/default/flex/WEB-INF/flex/flex-config.xml
-
- Approximately line 105
-
- <actionscript-classpath>
- <!-- the build folder contains the "com" folder being copied -->
- <path-element>C:\Documents and Settings\lukebayes\My Documents\clients\asunit\build</path-element>
- <path-element>/WEB-INF/flex/user_classes</path-element>
- </actionscript-classpath>
-
- - Open the AsUnit Ui.swf file in the Flash Player or open this URL in a browser:
- http://www.asunit.com/AsUnitUi.swf
- - Click the "Show Sys.println" radio button so that it is selected.
- - Create a new line in your MXML file like the following:
- Sys.println(">> Showing values from MXML");
- - Reload the MXML document in a browser window while keeping the AsUnit Ui open.
- - You should see text output in the AsUnit Ui panel.
- * It's important for the panel to be open BEFORE the mxml is refreshed.
- * It's important for the panel to be only one instance on your computer.
-
- - Create a new function in your MXML file that instantiates a new TestCase with the AsUnit Ui open.
- - Refresh the MXML page, you should see the Unit Test results reflected in the UI.
- - Check the Flex Documentation for how to instantiate a custom class
- - Check the AsUnit Article for what a TestCase looks like.
- - If you have trouble figuring out how to create a TestCase, use the Flash MX 2004 Professional
- trial installation and read the other articles. There is more content and more Flex support
- coming SOON!
-
-
----------------------------------------
-TEST A LIBRARY MOVIECLIP INSTRUCTIONS:
----------------------------------------
-
- - Open the .FLA file that you created in the Quickstart or go through the Quickstart
- Instructions
- - Open your Library if it's not already open (Window >> Library)
- * You should see a set of folders nested as com/asunit/example/ with a MovieClip Symbol
- named, ExampleClass.
- * These folders and the Symbol are created automatically by the CreateClass command and
- are based on the fully-qualified class name that you have chosen.
- * The Create Class Command will *NOT* clobber an existing MovieClip OR ActionScript file
- if you execute it more than once.
- - Click "Commands >> Create Class"
- * Note that the last-entered ClassName appears in the Text Field. This is saved into the
- .FLA file, so everyone that opens this file in the future will see the same thing.
- - Enter "com.asunit.example.ExampleMovie" (without the quotes) into the text field.
- - Select ONLY:
- "Automatically Open New Files"
- "Add to Library as MovieClip"
- "Add new Test
- and be sure that "Prefix Class Name with __Packages" is deselected.
- see: http://www.asunit.com/docs/img/extendsmovieclip-lib.jpg for an example
-- Click OK
-- Using your Library, double click the new MovieClip Symbol at: "com/asunit/example/ExampleMovie".
-- Using the Drawing Tools, create a new Rectangle that has NO Stroke and is at:
- x:0
- y:0
- width:50
- height:50
-- Save your .FLA file by pressing CTRL+S
-- Execute Test Movie.
-- You should have 3 of 4 Asserts Passing.
- * You should be able to click on the underlined portion of the Failing Test in the AsUnit Panel
- To open the .as file directly.
-- Open com/asunit/example/ExampleMovieTest.as
-- Notice how the "setUp" method is not creating a MovieClip instance using attachMovie, but
- is instead simply instantiating it as an Object.
- - Update the Test Case so that the setUp and tearDown methods look like the following:
-
- public function setUp():Void {
- var initObj:Object = new Object();
- initObj._width = 200;
- instance = ExampleMovie(attachMovie(ExampleMovie.linkageId, initObj));
- }
-
-
-- Now Comment out the entire "tearDown" method and run Test Movie.
-- You should see a Rectangle on stage that is 200 pixels wide by 50 pixels tall.
-- Now replace the "test" method with the following code:
-
- public function testWidth():Void {
- assertTrue("width should be 200", instance._width == 200);
- }
-
-- Running Test Movie at this time, should throw a compile error because your Class definition
- Does not Extend MovieClip and therefore does not have a "_width" method defined.
-- Open ExampleMovie.as and update the class definition as follows:
-
- class ExampleMovie extends MovieClip {
-
-- Run Test Movie again and you should find 4 of 4 Asserts Passing.
-
-
----------------------------------------
-TEST A NON-LIBRARY MOVIECLIP INSTRUCTIONS:
----------------------------------------
-
- - Open the .FLA file that you created in the Quickstart or go through the Quickstart
- Instructions
- - Open your Library if it's not already open (Window >> Library)
- * You should see a set of folders nested as com/asunit/example/ with a MovieClip Symbol
- named, ExampleClass.
- * These folders and the Symbol are created automatically by the CreateClass command and
- are based on the fully-qualified class name that you have chosen.
- * The Create Class Command will *NOT* clobber an existing MovieClip OR ActionScript file
- if you execute it more than once.
- - Click "Commands >> Create Class"
- - Select ONLY:
- "Automatically Open New Files"
- "Prefix Class Name with Packages"
- "Add new Test
- and be sure that "Add to Library as MovieClip" is deselected.
- see: http://www.asunit.com/docs/img/extendsmovieclip-nonlib.jpg for an example.
- - Click OK
- - Open com/asunit/example/ExampleClipTest.as
-
-
- - Update the Test Case so that the setUp and tearDown methods look like the following:
-
- public function setUp():Void {
- var initObj:Object = new Object();
- initObj._xscale = 200;
- instance = ExampleClip(attachMovie(ExampleClip.linkageId, initObj));
- }
-
- public function tearDown():Void {
- instance.removeMovieClip();
- }
-
- - Open com/asunit/example/ExampleClip.as and note the linkageId has "__Packages" prefix.
- * This will register the Class Definition as a MovieClip without anything in your Library.
- - Run TestMovie
- - You should have 3 of 4 Asserts Passed.
- * You should be able to click on the underlined portion of the Failing Test in the AsUnit Panel
- To open the .as file directly.
- - Update the "test" method of the TestCase (ExampleClipTest.as) to look like:
-
- public function testXscale():Void {
- assertTrue("_xscale should be 200", instance._xscale == 200);
- }
-
- - Run TestMovie
- - You should have 4 of 4 Asserts Passing.
- * NOTE That we couldn't update the _width property because the clip is empty and the _width
- won't be adjusted.
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 22:50:44
|
Revision: 591
http://svn.sourceforge.net/asapframework/?rev=591&view=rev
Author: aclemens
Date: 2006-10-12 15:50:39 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
removing old test files
Removed Paths:
-------------
trunk/asapframework/tests/unit/Tester.fla
trunk/asapframework/tests/unit/tester.as
Deleted: trunk/asapframework/tests/unit/Tester.fla
===================================================================
(Binary files differ)
Deleted: trunk/asapframework/tests/unit/tester.as
===================================================================
--- trunk/asapframework/tests/unit/tester.as 2006-10-12 22:47:06 UTC (rev 590)
+++ trunk/asapframework/tests/unit/tester.as 2006-10-12 22:50:39 UTC (rev 591)
@@ -1,22 +0,0 @@
-// run all tests
-//var at:AllTests = new AllTests();
-
-// ActionQueue tests only:
-//import org.asapframework.util.actionqueue.*;
-//var at:org.asapframework.util.actionqueue.AllTests = new AllTests();
-
-// Watcher test only:
-//import org.asapframework.util.watch.*;
-//var at:org.asapframework.util.watch.AllTests = new AllTests();
-
-// Loader test only:
-//import org.asapframework.util.loader.*;
-//var at:org.asapframework.util.loader.AllTests = new AllTests();
-
-// Playground tests only:
-//import playground.classes.*;
-//var at:playground.classes.AllTests = new AllTests();
-
-// core tests only:
-import org.asapframework.*;
-var at:org.asapframework.AllTests = new AllTests();
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 22:47:14
|
Revision: 590
http://svn.sourceforge.net/asapframework/?rev=590&view=rev
Author: aclemens
Date: 2006-10-12 15:47:06 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
fixes replace to let it replace multiple instances of a string
Modified Paths:
--------------
trunk/asapframework/org/asapframework/util/StringUtils.as
Modified: trunk/asapframework/org/asapframework/util/StringUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/StringUtils.as 2006-10-12 22:45:34 UTC (rev 589)
+++ trunk/asapframework/org/asapframework/util/StringUtils.as 2006-10-12 22:47:06 UTC (rev 590)
@@ -53,7 +53,7 @@
var index:Number = inSource.indexOf(inRemove);
while (index >= 0) {
inSource = inSource.substr(0, index) + inReplace + inSource.substr(index + inRemove.length);
- index = inSource.indexOf(inRemove, index+1);
+ index = inSource.indexOf(inRemove);
}
return inSource;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 22:45:44
|
Revision: 589
http://svn.sourceforge.net/asapframework/?rev=589&view=rev
Author: aclemens
Date: 2006-10-12 15:45:34 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
doc update
Modified Paths:
--------------
trunk/asapframework/org/asapframework/util/NumberUtils.as
Modified: trunk/asapframework/org/asapframework/util/NumberUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/NumberUtils.as 2006-10-12 20:19:14 UTC (rev 588)
+++ trunk/asapframework/org/asapframework/util/NumberUtils.as 2006-10-12 22:45:34 UTC (rev 589)
@@ -98,7 +98,7 @@
/**
Finds the normalized value (between 0 and 1) of the number inValueToNormalize, related to the normalized range, defined by lowest range value inMinValue and highest range value inMaxValue.
Normalizes a value, making it a value between 0 and 1
- @param inValueToNormalize: y value of point to normalize
+ @param inValueToNormalize: value to normalize
@param inMinValue: min value
@param inMaxValue: max value
@return The normalized y value: a value between 0 and 1.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 20:19:55
|
Revision: 588
http://svn.sourceforge.net/asapframework/?rev=588&view=rev
Author: aclemens
Date: 2006-10-12 13:19:14 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
follow mouse demo update: graphic orients to mouse position
Modified Paths:
--------------
trunk/asapframework/demos/ActionQueueDemos/doc/AQBlinkController.html
trunk/asapframework/demos/ActionQueueDemos/doc/AQColorController.html
trunk/asapframework/demos/ActionQueueDemos/doc/AQFadeController.html
trunk/asapframework/demos/ActionQueueDemos/doc/AQFollowMouseController.html
trunk/asapframework/demos/ActionQueueDemos/doc/AQPulseController.html
trunk/asapframework/demos/ActionQueueDemos/doc/AQRotateController.html
trunk/asapframework/demos/ActionQueueDemos/doc/AQRotateDial.html
trunk/asapframework/demos/ActionQueueDemos/doc/AQSpringBackground.html
trunk/asapframework/demos/ActionQueueDemos/doc/AQSpringController.html
trunk/asapframework/demos/ActionQueueDemos/doc/AppController.html
trunk/asapframework/demos/ActionQueueDemos/doc/AppData.html
trunk/asapframework/demos/ActionQueueDemos/doc/ButtonBackground.html
trunk/asapframework/demos/ActionQueueDemos/doc/ClickButton.html
trunk/asapframework/demos/ActionQueueDemos/doc/DataManager.html
trunk/asapframework/demos/ActionQueueDemos/doc/DataMapper.html
trunk/asapframework/demos/ActionQueueDemos/doc/DemoController.html
trunk/asapframework/demos/ActionQueueDemos/doc/DemoControllerEvent.html
trunk/asapframework/demos/ActionQueueDemos/doc/DemoData.html
trunk/asapframework/demos/ActionQueueDemos/doc/IDemoController.html
trunk/asapframework/demos/ActionQueueDemos/doc/IMappable.html
trunk/asapframework/demos/ActionQueueDemos/doc/LeftAlignClickButton.html
trunk/asapframework/demos/ActionQueueDemos/doc/MenuController.html
trunk/asapframework/demos/ActionQueueDemos/doc/MovieButton.html
trunk/asapframework/demos/ActionQueueDemos/doc/MovieEvent.html
trunk/asapframework/demos/ActionQueueDemos/doc/ProjectButtonEvent.html
trunk/asapframework/demos/ActionQueueDemos/src/flash/aqfollowmouse.fla
trunk/asapframework/demos/ActionQueueDemos/src/flash/scripts/controllers/AQFollowMouseController.as
trunk/asapframework/demos/ActionQueueDemos/src/flash/scripts/ui/ButtonBackground.as
trunk/asapframework/demos/ActionQueueDemos/src/flash/scripts/ui/ClickButton.as
trunk/asapframework/demos/ActionQueueDemos/web/static/swf/aqfollowmouse.swf
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQBlinkController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQBlinkController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQBlinkController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -565,7 +565,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:30</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:48</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQColorController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQColorController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQColorController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -682,7 +682,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:31</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:49</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQFadeController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQFadeController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQFadeController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -465,7 +465,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:31</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:49</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQFollowMouseController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQFollowMouseController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQFollowMouseController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -30,7 +30,7 @@
</tr>
<tr>
<th class="classDetails">File last modified:</th>
- <td class="classDetails">Wednesday, 04 October 2006, 22:56:59</td>
+ <td class="classDetails">Thursday, 12 October 2006, 22:15:05</td>
</tr>
</table>
</div>
@@ -42,11 +42,15 @@
<div class="sourceCode" style="display:none;">
<pre id="source">// Adobe classes
import mx.transitions.easing.*;
+//import flash.geom.*;
+// Still support Flash 7:
+import org.asapframework.util.types.*;
// ASAP classes
import org.asapframework.management.movie.LocalController;
import org.asapframework.ui.buttons.EventButtonEvent;
import org.asapframework.util.actionqueue.*;
+import org.asapframework.util.NumberUtils;
// project classes
import DemoController;
@@ -55,14 +59,19 @@
class AQFollowMouseController extends DemoController {
- private var square_follow_mc:MovieClip;
+ private static var MOVE_TIME_DIV:Number = .09;
+ private static var ROTATION_EASE_FACTOR:Number = .15;
+ private static var PAUSE_BUTTON_LABEL:String = "Play / Pause";
+ private static var STOP_BUTTON_LABEL:String = "Stop";
+
+
+ private var graphic_mc:MovieClip;
private var pause_btn:ClickButton;
- private static var PAUSE_BUTTON_LABEL:String = "Play / Pause";
+
private var stop_btn:ClickButton;
- private static var STOP_BUTTON_LABEL:String = "Stop";
-
+
private var mFollowMouseQueue:ActionQueue;
@@ -96,21 +105,63 @@
pause_btn = inTimeline.pause_btn;
pause_btn.setLabel(PAUSE_BUTTON_LABEL);
- square_follow_mc = inTimeline.stage_mc.square_follow_mc;
+ graphic_mc = inTimeline.stage_mc.graphic_mc;
stop_btn = inTimeline.stop_btn;
stop_btn.setLabel(STOP_BUTTON_LABEL);
+
+ var duration:Number = 0; // permanent
+ var locDiv:Number = null;
+ var offset:Number = null;
+ var callbackObject:AQFollowMouseController = this;
+ var callbackMethod:Function = this.followMouseLoc;
mFollowMouseQueue = new ActionQueue();
- mFollowMouseQueue.addAction( AQFollowMouse.followMouse, square_follow_mc, 0, .09 );
- mFollowMouseQueue.addAction( AQFade.fade, square_follow_mc, 1.5, null, 0 );
+ mFollowMouseQueue.addAction( AQFollowMouse.followMouse,
+ graphic_mc,
+ duration,
+ MOVE_TIME_DIV,
+ locDiv,
+ offset,
+ callbackObject,
+ callbackMethod
+ );
+ mFollowMouseQueue.addAction( AQFade.fade, graphic_mc, 1.5, null, 0);
mFollowMouseQueue.run();
- mFollowMouseQueue.pause();
}
/**
*/
+ private function followMouseLoc (inPos:Point) : Void {
+
+ var dx:Number = inPos.x - graphic_mc._x;
+ var dy:Number = inPos.y - graphic_mc._y;
+ var d:Point = new Point(dx, dy);
+
+ var startRotation:Number = graphic_mc._rotation;
+ var endRotation:Number = NumberUtils.angle(d.x, d.y);
+ var changeRotation:Number = endRotation - startRotation;
+
+ if ((360 - changeRotation) < changeRotation) {
+ changeRotation = changeRotation - 360;
+ }
+ if (360 - Math.abs(changeRotation) < Math.abs(changeRotation)) {
+ changeRotation = 360 - Math.abs(changeRotation);
+ }
+ // do not rotate if the rotation will not be visible:
+ if (Math.abs(changeRotation) > .5 ) {
+ graphic_mc._rotation = endRotation - ((1 - ROTATION_EASE_FACTOR) * changeRotation);
+ }
+
+ // position clip
+ graphic_mc._x = inPos.x;
+ graphic_mc._y = inPos.y;
+ }
+
+ /**
+
+ */
private function onEventButtonRelease ( e:EventButtonEvent ) : Void {
switch (e.target) {
case pause_btn: pause(); break;
@@ -156,6 +207,12 @@
</div>
<div class="methodSummaryPart"><span class="title">Class properties</span><ul>
<li class="private" style="display:none;">
+ <a href="#MOVE_TIME_DIV">MOVE_TIME_DIV</a>
+ </li>
+ <li class="private" style="display:none;">
+ <a href="#ROTATION_EASE_FACTOR">ROTATION_EASE_FACTOR</a>
+ </li>
+ <li class="private" style="display:none;">
<a href="#PAUSE_BUTTON_LABEL">PAUSE_BUTTON_LABEL</a>
</li>
<li class="private" style="display:none;">
@@ -174,7 +231,7 @@
</div>
<div class="methodSummaryPart private" style="display:none;"><span class="title">Instance properties</span><ul>
<li class="private" style="display:none;">
- <a href="#square_follow_mc">square_follow_mc</a>
+ <a href="#graphic_mc">graphic_mc</a>
</li>
<li class="private" style="display:none;">
<a href="#pause_btn">pause_btn</a>
@@ -207,6 +264,9 @@
<a href="#kill">kill</a>
</li>
<li class="private" style="display:none;">
+ <a href="#followMouseLoc">followMouseLoc</a>
+ </li>
+ <li class="private" style="display:none;">
<a href="#pause">pause</a>
</li>
<li class="private" style="display:none;">
@@ -248,6 +308,16 @@
<div class="methodSection private" style="display:none;">
<h2 class="hasBottomDivider"><span id="Classproperties">Class properties</span></h2>
<div class="method hasBottomDivider private" style="display:none;">
+ <h3 id="MOVE_TIME_DIV">MOVE_TIME_DIV</h3>
+ <div class="fullMemberString">
+ <div class="clearfix floatholder">
+ <div class="floatbox code">static private <b>MOVE_TIME_DIV</b>:Number = .<span class="codeNumber">09</span>
+</div>
+ <div><span class="access">(read,write)</span></div>
+ </div>
+ </div>
+ </div>
+ <div class="method hasBottomDivider private" style="display:none;">
<h3 id="PAUSE_BUTTON_LABEL">PAUSE_BUTTON_LABEL</h3>
<div class="fullMemberString">
<div class="clearfix floatholder">
@@ -258,6 +328,16 @@
</div>
</div>
<div class="method hasBottomDivider private" style="display:none;">
+ <h3 id="ROTATION_EASE_FACTOR">ROTATION_EASE_FACTOR</h3>
+ <div class="fullMemberString">
+ <div class="clearfix floatholder">
+ <div class="floatbox code">static private <b>ROTATION_EASE_FACTOR</b>:Number = .<span class="codeNumber">15</span>
+</div>
+ <div><span class="access">(read,write)</span></div>
+ </div>
+ </div>
+ </div>
+ <div class="method hasBottomDivider private" style="display:none;">
<h3 id="STOP_BUTTON_LABEL">STOP_BUTTON_LABEL</h3>
<div class="fullMemberString">
<div class="clearfix floatholder">
@@ -271,30 +351,30 @@
<div class="methodSection private" style="display:none;">
<h2 class="hasBottomDivider"><span id="Instanceproperties">Instance properties</span></h2>
<div class="method hasBottomDivider private" style="display:none;">
- <h3 id="mFollowMouseQueue">mFollowMouseQueue</h3>
+ <h3 id="graphic_mc">graphic_mc</h3>
<div class="fullMemberString">
<div class="clearfix floatholder">
- <div class="floatbox code">private <b>mFollowMouseQueue</b>:ActionQueue
+ <div class="floatbox code">private <b>graphic_mc</b>:MovieClip
</div>
<div><span class="access">(read,write)</span></div>
</div>
</div>
</div>
<div class="method hasBottomDivider private" style="display:none;">
- <h3 id="pause_btn">pause_btn</h3>
+ <h3 id="mFollowMouseQueue">mFollowMouseQueue</h3>
<div class="fullMemberString">
<div class="clearfix floatholder">
- <div class="floatbox code">private <b>pause_btn</b>:<a href="ClickButton.html">ClickButton</a>
+ <div class="floatbox code">private <b>mFollowMouseQueue</b>:ActionQueue
</div>
<div><span class="access">(read,write)</span></div>
</div>
</div>
</div>
<div class="method hasBottomDivider private" style="display:none;">
- <h3 id="square_follow_mc">square_follow_mc</h3>
+ <h3 id="pause_btn">pause_btn</h3>
<div class="fullMemberString">
<div class="clearfix floatholder">
- <div class="floatbox code">private <b>square_follow_mc</b>:MovieClip
+ <div class="floatbox code">private <b>pause_btn</b>:<a href="ClickButton.html">ClickButton</a>
</div>
<div><span class="access">(read,write)</span></div>
</div>
@@ -332,6 +412,16 @@
</div>
<div class="methodSection">
<h2 class="hasBottomDivider"><span id="Instancemethods">Instance methods</span></h2>
+ <div class="method hasBottomDivider private" style="display:none;">
+ <h3 id="followMouseLoc">followMouseLoc</h3>
+ <div class="fullMemberString">
+ <div class="clearfix floatholder">
+ <div class="floatbox code">private function <b>followMouseLoc</b> (
+</div>
+ <div><span class="code">inPos:Point) : Void</span></div>
+ </div>
+ </div>
+ </div>
<div class="method hasBottomDivider">
<h3 id="kill">kill</h3>
<div class="fullMemberString">
@@ -382,7 +472,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:32</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:49</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQPulseController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQPulseController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQPulseController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -792,7 +792,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:32</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:50</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQRotateController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQRotateController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQRotateController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -470,7 +470,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:33</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:50</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQRotateDial.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQRotateDial.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQRotateDial.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -111,7 +111,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:36</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:54</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQSpringBackground.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQSpringBackground.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQSpringBackground.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -111,7 +111,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:36</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:54</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AQSpringController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AQSpringController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AQSpringController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -485,7 +485,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:34</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:51</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AppController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AppController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AppController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -550,7 +550,7 @@
<div class="description">Gets called when text file with tree data has been parsed.</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:30</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:48</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/AppData.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/AppData.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/AppData.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -73,7 +73,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:35</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:53</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/ButtonBackground.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/ButtonBackground.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/ButtonBackground.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -22,10 +22,6 @@
<td>MovieClip</td>
</tr>
<tr>
- <th class="classDetails">Version:</th>
- <td class="classDetails">4 Feb 2006</td>
- </tr>
- <tr>
<th class="classDetails">Author:</th>
<td class="classDetails">Arthur Clemens</td>
</tr>
@@ -35,7 +31,7 @@
</tr>
<tr>
<th class="classDetails">File last modified:</th>
- <td class="classDetails">Wednesday, 04 October 2006, 16:36:01</td>
+ <td class="classDetails">Wednesday, 11 October 2006, 22:14:01</td>
</tr>
</table>
</div>
@@ -66,7 +62,6 @@
The 3 ButtonBackground movieclips are: <code>center_mc</code>, <code>left_mc</code> and <code>right_mc</code>.
@author Arthur Clemens
-@version 4 Feb 2006
@use
In a (custom, centered) button class:
<code>
@@ -306,7 +301,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:37</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:54</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/ClickButton.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/ClickButton.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/ClickButton.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -38,7 +38,7 @@
</tr>
<tr>
<th class="classDetails">File last modified:</th>
- <td class="classDetails">Sunday, 08 October 2006, 10:12:14</td>
+ <td class="classDetails">Thursday, 12 October 2006, 21:27:24</td>
</tr>
</table>
</div>
@@ -65,7 +65,7 @@
public function setLabel (inText:String) : Void {
label_tf.text = inText;
- var width:Number = label_tf.textWidth * 1.2;
+ var width:Number = label_tf.textWidth + 10;
label_tf._width = width;
label_tf._x = -width/2;
background_mc.setWidth(width, BUTTON_WIDTH_OFFSET);
@@ -261,7 +261,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:37</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:55</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/DataManager.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/DataManager.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/DataManager.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -172,7 +172,7 @@
<div class="description">Stores objects of type <a href="DemoData.html">DemoData</a> and creates a quick lookup hash.</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:35</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:53</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/DataMapper.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/DataMapper.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/DataMapper.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -195,7 +195,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:35</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:53</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/DemoController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/DemoController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/DemoController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -262,7 +262,7 @@
<div class="description">Overriding LocalController's show to let the movies fade in.</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:34</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:51</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/DemoControllerEvent.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/DemoControllerEvent.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/DemoControllerEvent.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -129,7 +129,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:36</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:53</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/DemoData.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/DemoData.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/DemoData.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -200,7 +200,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:35</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
+ <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Thursday, 12 October 2006, 22:15:53</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span class="separator">|</span><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a></span>
</div>
</div>
</div>
Modified: trunk/asapframework/demos/ActionQueueDemos/doc/IDemoController.html
===================================================================
--- trunk/asapframework/demos/ActionQueueDemos/doc/IDemoController.html 2006-10-12 20:17:25 UTC (rev 587)
+++ trunk/asapframework/demos/ActionQueueDemos/doc/IDemoController.html 2006-10-12 20:19:14 UTC (rev 588)
@@ -87,7 +87,7 @@
</div>
</div>
</div>
- <div class="footer"><span class="docFooter"><span class="copyright">© The authors of ASAP framework</span><span class="separator">|</span><span class="createdWith">Created with <a href="http://visiblearea.com/visdoc/">VisDoc</a></span><span class="separator">|</span><span class="creationDate">Sunday, 08 October 2006, 10:23:34</span><span class="separator">|</span><a href="#" onclick="showTOC(); return false;" class="showToc">show TOC</a><a href="#" onclick="hideTOC(); return false;" class="hideToc">hide TOC</a><span class="viewPrivate"><span class="separator">|</span><a href="#PageTop" onclick="showPrivate(); return true;">show private members</a></span><span class="hidePrivate"><span class="separator">|</span><a href="#PageTop" onclick="hidePrivate(); return true;">hide private members</a></span></span><span class="tocFooter">© The authors of ASAP framework<span ...
[truncated message content] |
|
From: <acl...@us...> - 2006-10-12 20:17:31
|
Revision: 587
http://svn.sourceforge.net/asapframework/?rev=587&view=rev
Author: aclemens
Date: 2006-10-12 13:17:25 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
overload callback function to accept method name and function reference;
doc update
Modified Paths:
--------------
trunk/asapframework/org/asapframework/util/actionqueue/AQFollowMouse.as
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQFollowMouse.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQFollowMouse.as 2006-10-12 09:19:40 UTC (rev 586)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQFollowMouse.as 2006-10-12 20:17:25 UTC (rev 587)
@@ -44,7 +44,7 @@
@param inLocDiv : (optional) the translation factor of the mouse movements, relative to its parent's center point; an inLocDiv of 2 multiplies all x and y (difference) locations by 2. The visual effect works best if the parent has its (0,0) location at its center. The value should not be smaller than inTimeDiv (and is set automatically to the value of inTimeDiv if it is smaller); default (when nothing is set) is 1.0.
@param inOffset : (optional) the number of pixels to offset the clip from the mouse, defined as a Point object
@param inCallbackObject : (optional) object to return the calculated value to; if defined, the drawing is not performed by <code>followMouse</code> and should be done in the object's callback method inCallBackMethod
- @param inCallBackMethod : (optional) the object's method to which the calculated value should be returned; the variable that is passed to this object is a {@link Point}
+ @param inCallBackMethod : (optional) method name or function reference of function to which the calculated value should be returned; the variable that is passed to this object is a {@link Point}
@return A new ActionQueuePerformData object.
@example
The most simple way to let a movieclip move infinitely to the mouse is:
@@ -69,6 +69,35 @@
my_mc._y = (STAGE_CENTER.y - inPos.y) * 0.25;
}
</code>
+ To keep the MovieClip oriented to the mouse position, you can use this function:
+ <code>
+ private function followMouseLoc (inPos:Point) : Void {
+
+ var dx:Number = inPos.x - graphic_mc._x;
+ var dy:Number = inPos.y - graphic_mc._y;
+ var d:Point = new Point(dx, dy);
+
+ var startRotation:Number = graphic_mc._rotation;
+ var endRotation:Number = NumberUtils.angle(d.x, d.y);
+ var changeRotation:Number = endRotation - startRotation;
+
+ if ((360 - changeRotation) < changeRotation) {
+ changeRotation = changeRotation - 360;
+ }
+ if (360 - Math.abs(changeRotation) < Math.abs(changeRotation)) {
+ changeRotation = 360 - Math.abs(changeRotation);
+ }
+ // do not rotate if the rotation will not be visible:
+ if (Math.abs(changeRotation) > .5 ) {
+ graphic_mc._rotation = endRotation - ((1 - ROTATION_EASE_FACTOR) * changeRotation);
+ }
+
+ // position clip
+ graphic_mc._x = inPos.x;
+ graphic_mc._y = inPos.y;
+ }
+ </code>
+ Where <code>ROTATION_EASE_FACTOR</code> is 0 < n <= 1.
*/
public static function followMouse (inMC:MovieClip,
@@ -77,7 +106,7 @@
inLocDiv:Number,
inOffset:Point,
inCallbackObject:Object,
- inCallBackMethod:String) : ActionQueuePerformData {
+ inCallBackMethod:Object) : ActionQueuePerformData {
var duration:Number = (inDuration != undefined) ? inDuration * 1000 : 0;
var endTime:Number = getTimer() + duration;
@@ -90,7 +119,13 @@
var offsetX:Number = (inOffset != undefined) ? inOffset.x : 0;
var offsetY:Number = (inOffset != undefined) ? inOffset.y : 0;
- var callbackMethod:Function = (inCallbackObject != undefined) ? inCallbackObject[inCallBackMethod] : null;
+ var callbackMethod:Function = null;
+ if (typeof inCallBackMethod == "string") {
+ callbackMethod = inCallbackObject[inCallBackMethod];
+ }
+ if (typeof inCallBackMethod == "function") {
+ callbackMethod = Function(inCallBackMethod);
+ }
var draw:Function;
var parent:MovieClip = inMC._parent;
var point:Point = new Point(inMC._x, inMC._y);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-12 09:20:37
|
Revision: 586
http://svn.sourceforge.net/asapframework/?rev=586&view=rev
Author: aclemens
Date: 2006-10-12 02:19:40 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
removing @version tag
Modified Paths:
--------------
trunk/asapframework/org/asapframework/data/Enumerator.as
trunk/asapframework/org/asapframework/data/KeyValue.as
trunk/asapframework/org/asapframework/data/array/ArrayEnumerator.as
trunk/asapframework/org/asapframework/data/array/TraverseArrayEnumerator.as
trunk/asapframework/org/asapframework/data/array/TraverseArrayEnumeratorEvent.as
trunk/asapframework/org/asapframework/data/array/TraverseArrayOptions.as
trunk/asapframework/org/asapframework/data/filedatatransform/TextFile2ArrayEvent.as
trunk/asapframework/org/asapframework/data/filedatatransform/TextFile2Collection.as
trunk/asapframework/org/asapframework/ui/Disabler.as
trunk/asapframework/org/asapframework/ui/Tooltip.as
trunk/asapframework/org/asapframework/ui/buttons/DelayButton.as
trunk/asapframework/org/asapframework/util/ArrayUtils.as
trunk/asapframework/org/asapframework/util/BooleanUtils.as
trunk/asapframework/org/asapframework/util/ColorUtils.as
trunk/asapframework/org/asapframework/util/NumberUtils.as
trunk/asapframework/org/asapframework/util/ObjectUtils.as
trunk/asapframework/org/asapframework/util/StringUtils.as
trunk/asapframework/org/asapframework/util/StringUtilsSplit.as
trunk/asapframework/org/asapframework/util/StringUtilsTrim.as
trunk/asapframework/org/asapframework/util/actionqueue/AQAddMove.as
trunk/asapframework/org/asapframework/util/actionqueue/AQBlink.as
trunk/asapframework/org/asapframework/util/actionqueue/AQColor.as
trunk/asapframework/org/asapframework/util/actionqueue/AQFade.as
trunk/asapframework/org/asapframework/util/actionqueue/AQFollowMouse.as
trunk/asapframework/org/asapframework/util/actionqueue/AQMove.as
trunk/asapframework/org/asapframework/util/actionqueue/AQMoveRel.as
trunk/asapframework/org/asapframework/util/actionqueue/AQProperty.as
trunk/asapframework/org/asapframework/util/actionqueue/AQPulse.as
trunk/asapframework/org/asapframework/util/actionqueue/AQReturnValue.as
trunk/asapframework/org/asapframework/util/actionqueue/AQRotate.as
trunk/asapframework/org/asapframework/util/actionqueue/AQScale.as
trunk/asapframework/org/asapframework/util/actionqueue/AQSet.as
trunk/asapframework/org/asapframework/util/actionqueue/AQTimeline.as
trunk/asapframework/org/asapframework/util/actionqueue/AQWorker.as
trunk/asapframework/org/asapframework/util/actionqueue/AQZoom.as
trunk/asapframework/org/asapframework/util/actionqueue/ActionQueue.as
trunk/asapframework/org/asapframework/util/actionqueue/ActionQueueEvent.as
trunk/asapframework/org/asapframework/util/actionqueue/ActionQueuePerformData.as
trunk/asapframework/org/asapframework/util/actionqueue/ExtendedActionQueue.as
trunk/asapframework/org/asapframework/util/actionqueue/ExtendedActionQueueData.as
trunk/asapframework/org/asapframework/util/debug/Console.as
trunk/asapframework/org/asapframework/util/debug/Log.as
trunk/asapframework/org/asapframework/util/framepulse/FramePulse.as
trunk/asapframework/org/asapframework/util/framepulse/FramePulseEvent.as
trunk/asapframework/org/asapframework/util/loader/LoaderEvent.as
trunk/asapframework/org/asapframework/util/system/LocalData.as
trunk/asapframework/org/asapframework/util/transitions/tween/Bezier.as
trunk/asapframework/org/asapframework/util/transitions/tween/Sine.as
trunk/asapframework/org/asapframework/util/watch/RollOverWatcher.as
trunk/asapframework/org/asapframework/util/watch/Watcher.as
trunk/asapframework/org/asapframework/util/xml/XML2Object.as
Modified: trunk/asapframework/org/asapframework/data/Enumerator.as
===================================================================
--- trunk/asapframework/org/asapframework/data/Enumerator.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/data/Enumerator.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
Virtual base class for enumerator objects.
@author Arthur Clemens
-@version 20 July 2005
*/
class org.asapframework.data.Enumerator extends Dispatcher {
Modified: trunk/asapframework/org/asapframework/data/KeyValue.as
===================================================================
--- trunk/asapframework/org/asapframework/data/KeyValue.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/data/KeyValue.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -17,7 +17,6 @@
/**
Key-value object class.
@author Arthur Clemens
-@version 27 march 2006
*/
class org.asapframework.data.KeyValue {
Modified: trunk/asapframework/org/asapframework/data/array/ArrayEnumerator.as
===================================================================
--- trunk/asapframework/org/asapframework/data/array/ArrayEnumerator.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/data/array/ArrayEnumerator.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
Straightforward enumeration (iterator) class for arrays. ArrayEnumerator has one way of iterating: forward ({@link #getNextObject}). For more options see {@link TraverseArrayEnumerator}.
@author Arthur Clemens
-@version 7 May 2006
*/
class org.asapframework.data.array.ArrayEnumerator extends Enumerator {
Modified: trunk/asapframework/org/asapframework/data/array/TraverseArrayEnumerator.as
===================================================================
--- trunk/asapframework/org/asapframework/data/array/TraverseArrayEnumerator.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/data/array/TraverseArrayEnumerator.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -21,7 +21,6 @@
A TraverseArrayEnumerator can be used with a paging controller to navigate through a list of thumbs or search result pages (see example below).
@author Arthur Clemens
-@version 7 May 2006
@use
Example for a enumerator that handles a row of thumbs.
<code>
Modified: trunk/asapframework/org/asapframework/data/array/TraverseArrayEnumeratorEvent.as
===================================================================
--- trunk/asapframework/org/asapframework/data/array/TraverseArrayEnumeratorEvent.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/data/array/TraverseArrayEnumeratorEvent.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
@author Arthur Clemens
-@version 23 June 2006
*/
class org.asapframework.data.array.TraverseArrayEnumeratorEvent extends Event {
Modified: trunk/asapframework/org/asapframework/data/array/TraverseArrayOptions.as
===================================================================
--- trunk/asapframework/org/asapframework/data/array/TraverseArrayOptions.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/data/array/TraverseArrayOptions.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -17,7 +17,6 @@
/**
Array traverse options used by {@link TraverseArrayEnumerator}.
@author Arthur Clemens
-@version 5 May 2006
*/
class org.asapframework.data.array.TraverseArrayOptions {
Modified: trunk/asapframework/org/asapframework/data/filedatatransform/TextFile2ArrayEvent.as
===================================================================
--- trunk/asapframework/org/asapframework/data/filedatatransform/TextFile2ArrayEvent.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/data/filedatatransform/TextFile2ArrayEvent.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
Event object that is dispatched by {@link TextFile2Array}.
@author Arthur Clemens
-@version 20 July 2005
*/
class org.asapframework.data.filedatatransform.TextFile2ArrayEvent extends Event {
Modified: trunk/asapframework/org/asapframework/data/filedatatransform/TextFile2Collection.as
===================================================================
--- trunk/asapframework/org/asapframework/data/filedatatransform/TextFile2Collection.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/data/filedatatransform/TextFile2Collection.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
Base class that takes a text file url, loads the file data and converts the text contents to a collection structure (Tree or Array). Actual parsing is not provided in this class, see the subclasses for implementations.
-@version 5 Feb 2006
@author Arthur Clemens
*/
Modified: trunk/asapframework/org/asapframework/ui/Disabler.as
===================================================================
--- trunk/asapframework/org/asapframework/ui/Disabler.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/ui/Disabler.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -16,7 +16,6 @@
/**
Disabler makes stage elements unreceptive for mouse and keyboard events by placing a 'event catching' movieclip on the stage.
-@version 15 Jan 2006
@use
<code>
mDisabler = new Disabler(timeline, 0, 0, Stage.width, Stage.height);
Modified: trunk/asapframework/org/asapframework/ui/Tooltip.as
===================================================================
--- trunk/asapframework/org/asapframework/ui/Tooltip.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/ui/Tooltip.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -26,7 +26,6 @@
/**
Tooltip class.
@author Arthur Clemens
-@version 2 Mar 2006
@use
You can customize a Tooltip by either setting properties after creation, or by creating a Tooltip subclass (see further below).
Modified: trunk/asapframework/org/asapframework/ui/buttons/DelayButton.as
===================================================================
--- trunk/asapframework/org/asapframework/ui/buttons/DelayButton.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/ui/buttons/DelayButton.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -55,7 +55,6 @@
}
</code>
@author Arthur Clemens
-@version 21 Jan 2006
*/
class org.asapframework.ui.buttons.DelayButton extends EventButton {
Modified: trunk/asapframework/org/asapframework/util/ArrayUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/ArrayUtils.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/ArrayUtils.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
A collection of Array utility functions.
@author Martijn de Visser
@author Arthur Clemens
-@version 6 Jan 2005
*/
class org.asapframework.util.ArrayUtils {
Modified: trunk/asapframework/org/asapframework/util/BooleanUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/BooleanUtils.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/BooleanUtils.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -18,7 +18,6 @@
/**
A collection of Boolean utility functions.
@author Martijn de Visser
-@version 6 Jan 2006
*/
class org.asapframework.util.BooleanUtils {
Modified: trunk/asapframework/org/asapframework/util/ColorUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/ColorUtils.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/ColorUtils.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -18,7 +18,6 @@
/**
A collection of color utility functions.
@author Arthur Clemens
-@version 2 April 2005
*/
class org.asapframework.util.ColorUtils {
Modified: trunk/asapframework/org/asapframework/util/NumberUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/NumberUtils.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/NumberUtils.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -17,7 +17,6 @@
/**
Number utility functions.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.NumberUtils {
Modified: trunk/asapframework/org/asapframework/util/ObjectUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/ObjectUtils.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/ObjectUtils.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -17,7 +17,6 @@
/**
A collection of Object utility functions.
@author Martijn de Visser
-@version 0.1
*/
class org.asapframework.util.ObjectUtils {
Modified: trunk/asapframework/org/asapframework/util/StringUtils.as
===================================================================
--- trunk/asapframework/org/asapframework/util/StringUtils.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/StringUtils.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -18,7 +18,6 @@
A collection of String manipulation methods.
Specialized String methods can be found in {@link StringUtilsTrim} and {@link StringUtilsSplit}.
@author Stephan Bezoen
-@version 21 Juli 2005
*/
class org.asapframework.util.StringUtils {
Modified: trunk/asapframework/org/asapframework/util/StringUtilsSplit.as
===================================================================
--- trunk/asapframework/org/asapframework/util/StringUtilsSplit.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/StringUtilsSplit.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
Split trimmming methods.
More string manipulation methods in {@link StringUtils}.
@author Arthur Clemens
-@version 26 July 2005
*/
class org.asapframework.util.StringUtilsSplit {
Modified: trunk/asapframework/org/asapframework/util/StringUtilsTrim.as
===================================================================
--- trunk/asapframework/org/asapframework/util/StringUtilsTrim.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/StringUtilsTrim.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -18,7 +18,6 @@
String trimmming methods.
More string manipulation methods in {@link StringUtils}.
@author Arthur Clemens
-@version 15 Jan 2005
*/
class org.asapframework.util.StringUtilsTrim {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQAddMove.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQAddMove.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQAddMove.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
ActionQueue method that controls the relative position of a movieclip.
Lets a movieclip or button move a specified number of pixels added to its current location, without specifying its end location.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQAddMove {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQBlink.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQBlink.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQBlink.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
/**
ActionQueue methods to make a movieclip blink.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQBlink {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQColor.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQColor.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQColor.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
/**
ActionQueue methods that control the color of a movieclip. Most methods call methods from {@link ColorUtils}.
@author Arthur Clemens
-@version 14 Jan 2006
*/
class org.asapframework.util.actionqueue.AQColor {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQFade.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQFade.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQFade.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
ActionQueue method that controls the alpha blend of a movieclip.
See also {@link AQPulse} to fade a movieclip in a pulsating manner.
@author Arthur Clemens
-@version 14 Jan 2006
*/
class org.asapframework.util.actionqueue.AQFade {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQFollowMouse.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQFollowMouse.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQFollowMouse.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -26,7 +26,6 @@
/**
ActionQueue method to let a movieclip follow the mouse, with location and time parameters for precise control.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQFollowMouse {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQMove.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQMove.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQMove.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
ActionQueue method to control the position of a movieclip over time.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQMove {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQMoveRel.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQMoveRel.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQMoveRel.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
ActionQueue method that moves a movieclip over a relative distance.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQMoveRel {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQProperty.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQProperty.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQProperty.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
ActionQueue method to change an object's property over time.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQProperty {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQPulse.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQPulse.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQPulse.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
/**
ActionQueue methods to let a movieclip (or any objectys' property) pulsate.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQPulse {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQReturnValue.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQReturnValue.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQReturnValue.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
ActionQueue method that returns a calculated (percentage) value of an animation in time.
Use this method to keep track of a (animated/calculated) value without directly manipulating a movieclip - to store the value or use it to update multiple other clips or values.
@author Arthur Clemens
-@version 11 Feb 2006
*/
class org.asapframework.util.actionqueue.AQReturnValue {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQRotate.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQRotate.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQRotate.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
ActionQueue method to rotate a movieclip over time.
@author Arthur Clemens
-@version 4 Feb 2006
*/
class org.asapframework.util.actionqueue.AQRotate {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQScale.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQScale.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQScale.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
ActionQueue method to control the scaling of a movieclip.
See also {@link AQPulse} to scale a movieclip in a pulsating manner.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQScale {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQSet.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQSet.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQSet.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -27,7 +27,6 @@
ActionQueue methods to set various parameters/states of a movieclip.
Some of these methods use {@link MovieClipUtils}.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQSet {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQTimeline.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQTimeline.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQTimeline.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -17,7 +17,6 @@
/**
ActionQueue methods to control the movieclip's timeline.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQTimeline {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQWorker.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQWorker.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQWorker.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -20,7 +20,6 @@
/**
This class is used by ActionQueue and various AQxxx classes; you should not instantiate this class yourself.
@author Arthur Clemens
-@version 29 Jan 2006
*/
dynamic class org.asapframework.util.actionqueue.AQWorker {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/AQZoom.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/AQZoom.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/AQZoom.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -32,7 +32,6 @@
@usageNote From Flash 8 Help: <em>Avoid zooming into cached surfaces. If you overuse bitmap caching, a large amount of memory is consumed (see previous bullet), especially if you zoom in on the content.</em>
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.AQZoom {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/ActionQueue.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/ActionQueue.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/ActionQueue.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -52,9 +52,7 @@
<b>Simultaneous effects</b>
To control different movieclip aspects at the same time, for instance to move a clip and fade it out, use {@link #addInAction}, or use {@link AQReturnValue} (example given below at {@link #addAction}).
-
@author Arthur Clemens
- @version 13 Apr 2006
@use
This code example demonstrates a combination of ActionQueue methods, to give an idea of how this class can be used in an application.
<code>
Modified: trunk/asapframework/org/asapframework/util/actionqueue/ActionQueueEvent.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/ActionQueueEvent.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/ActionQueueEvent.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -18,7 +18,6 @@
/**
Event objects that are dispatched by {@link ActionQueue}.
-@version 4 Jan 2006
*/
class org.asapframework.util.actionqueue.ActionQueueEvent extends Event {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/ActionQueuePerformData.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/ActionQueuePerformData.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/ActionQueuePerformData.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -18,7 +18,6 @@
/**
Data storage class to pass UIAction <em>perform actions</em>. Used by {@link ActionQueue}.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.ActionQueuePerformData {
Modified: trunk/asapframework/org/asapframework/util/actionqueue/ExtendedActionQueue.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/ExtendedActionQueue.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/ExtendedActionQueue.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -42,7 +42,6 @@
extendedQueue.run();
</code>
@author Arthur Clemens
-@version 13 Apr 2006
@todo Check if addContinueOnMessage still works with quirky setInterval in AS2.0.
*/
Modified: trunk/asapframework/org/asapframework/util/actionqueue/ExtendedActionQueueData.as
===================================================================
--- trunk/asapframework/org/asapframework/util/actionqueue/ExtendedActionQueueData.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/actionqueue/ExtendedActionQueueData.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
Data storage class used by {@link ExtendedActionQueue}.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.actionqueue.ExtendedActionQueueData extends ActionQueueData {
Modified: trunk/asapframework/org/asapframework/util/debug/Console.as
===================================================================
--- trunk/asapframework/org/asapframework/util/debug/Console.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/debug/Console.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -17,7 +17,6 @@
/**
Console creates a debugging window on the stage that can be invoked with a configurable string. Close the window by double-clicking the bar.
@author Jeremy Brown, Arthur Clemens
-@version 2 May 2005
@use
The console is enabled by default. If you don't want to use the console, add this class to the exclude xml.
You can set a character or word to activate the console. To set the activation string, use:
Modified: trunk/asapframework/org/asapframework/util/debug/Log.as
===================================================================
--- trunk/asapframework/org/asapframework/util/debug/Log.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/debug/Log.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -54,7 +54,6 @@
The number "11" is the time at which the log message was generated. This time is not kept in the LogEvent class.
@author stephan.bezoen
-@version 13 March 2006
*/
class org.asapframework.util.debug.Log extends Dispatcher {
Modified: trunk/asapframework/org/asapframework/util/framepulse/FramePulse.as
===================================================================
--- trunk/asapframework/org/asapframework/util/framepulse/FramePulse.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/framepulse/FramePulse.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -48,7 +48,6 @@
@implementationNote Creates an empty clip named "__FramePulseClip" (by default on _level0, at depth 9888).
@author Martijn de Visser
-@version 10 May 2005
*/
class org.asapframework.util.framepulse.FramePulse extends Dispatcher {
Modified: trunk/asapframework/org/asapframework/util/framepulse/FramePulseEvent.as
===================================================================
--- trunk/asapframework/org/asapframework/util/framepulse/FramePulseEvent.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/framepulse/FramePulseEvent.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,8 +19,7 @@
/**
Event object that is dispatched by {@link FramePulse}.
-@author Martijn de Visser
-@version 10 May 2005
+@author Martijn de Visser
*/
class org.asapframework.util.framepulse.FramePulseEvent extends Event {
Modified: trunk/asapframework/org/asapframework/util/loader/LoaderEvent.as
===================================================================
--- trunk/asapframework/org/asapframework/util/loader/LoaderEvent.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/loader/LoaderEvent.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,7 +19,6 @@
/**
Event object that is dispatched by {@link Loader}.
-@version 3 July 2005
*/
class org.asapframework.util.loader.LoaderEvent extends Event {
Modified: trunk/asapframework/org/asapframework/util/system/LocalData.as
===================================================================
--- trunk/asapframework/org/asapframework/util/system/LocalData.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/system/LocalData.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -18,7 +18,6 @@
A class for storing typed data locally. Wraps the SharedObject class.
Based on Colin Moock's class - http://moock.org/asdg/technotes/saveDataToDisk/
@author Martijn de Visser
-@version 0.2
@example
<code>
// Check if user has visited the site before
Modified: trunk/asapframework/org/asapframework/util/transitions/tween/Bezier.as
===================================================================
--- trunk/asapframework/org/asapframework/util/transitions/tween/Bezier.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/transitions/tween/Bezier.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -17,7 +17,6 @@
/**
Bezier tween function.
@author Arthur Clemens
-@version 14 Jan 2006
*/
class org.asapframework.util.transitions.tween.Bezier {
Modified: trunk/asapframework/org/asapframework/util/transitions/tween/Sine.as
===================================================================
--- trunk/asapframework/org/asapframework/util/transitions/tween/Sine.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/transitions/tween/Sine.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -17,7 +17,6 @@
/**
Sine tween functions.
@author Arthur Clemens
-@version 29 Jan 2006
*/
class org.asapframework.util.transitions.tween.Sine {
Modified: trunk/asapframework/org/asapframework/util/watch/RollOverWatcher.as
===================================================================
--- trunk/asapframework/org/asapframework/util/watch/RollOverWatcher.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/watch/RollOverWatcher.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -19,10 +19,9 @@
import org.asapframework.util.framepulse.FramePulseEvent;
/**
-* @author Arthur Clemens
-* @version 0.5
-* @description Checks the mouse location for movement. If the mouse has not moved in the set time period, a fallback function is called, allowing for instance a buttonclip to perform a rollout.
-* This class is useful to 'catch' the mouse if it has disappeared from the edge of the Flash stage. If this happens fast, or if the Flash movie is occupied, the movieclips don't receive any more mouse events, and stick to their current state. A RollOverWatcher object equals a out-of-stage mouse to a still mouse.
+Checks the mouse location for movement. If the mouse has not moved in the set time period, a fallback function is called, allowing for instance a buttonclip to perform a rollout.
+This class is useful to 'catch' the mouse if it has disappeared from the edge of the Flash stage. If this happens fast, or if the Flash movie is occupied, the movieclips don't receive any more mouse events, and stick to their current state. A RollOverWatcher object equals a out-of-stage mouse to a still mouse.
+@author Arthur Clemens
*/
class org.asapframework.util.watch.RollOverWatcher {
Modified: trunk/asapframework/org/asapframework/util/watch/Watcher.as
===================================================================
--- trunk/asapframework/org/asapframework/util/watch/Watcher.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/watch/Watcher.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -28,7 +28,6 @@
Watching may be a one-time hit, or perpetuously until the value is met or the Watcher is stopped.
@author Arthur Clemens
-@version 13 Apr 2006
@use
The following example shows how to check for value of the MovieClip's <code>_alpha</code> variable; when <code>_alpha</code> has gone to 0, the method 'afterZero' is called. Checking is done each 12th of a second and perpetuously until the clips' _alpha has turned to 0.
<code>
Modified: trunk/asapframework/org/asapframework/util/xml/XML2Object.as
===================================================================
--- trunk/asapframework/org/asapframework/util/xml/XML2Object.as 2006-10-10 09:01:43 UTC (rev 585)
+++ trunk/asapframework/org/asapframework/util/xml/XML2Object.as 2006-10-12 09:19:40 UTC (rev 586)
@@ -27,7 +27,6 @@
}
</code>
@author Arthur Clemens, Alessandro Crugnola
-@version 30 Sep 2004
@use With the following xml file:
<code>
<?xml version="1.0" encoding="utf-8" ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aci...@us...> - 2006-10-10 09:01:52
|
Revision: 585
http://svn.sourceforge.net/asapframework/?rev=585&view=rev
Author: acidcats
Date: 2006-10-10 02:01:43 -0700 (Tue, 10 Oct 2006)
Log Message:
-----------
Documentation update
Modified Paths:
--------------
trunk/asapframework/org/asapframework/data/loader/Parser.as
Modified: trunk/asapframework/org/asapframework/data/loader/Parser.as
===================================================================
--- trunk/asapframework/org/asapframework/data/loader/Parser.as 2006-10-10 06:03:19 UTC (rev 584)
+++ trunk/asapframework/org/asapframework/data/loader/Parser.as 2006-10-10 09:01:43 UTC (rev 585)
@@ -24,22 +24,57 @@
When the XML structure is changed, only the parsing function in the DataValueObject class has to be changed, thereby facilitating maintenance and development.
@use
+Consider an XML file with the following content:
+<code>
+<?xml version="1.0" encoding="UTF-8"?>
+ <settings>
+ <urls>
+ <url name="addressform" url="../xml/address.xml" />
+ <url name="entries" url="../xml/entries.xml" />
+ </urls>
+ </settings>
+</code>
+See the {@link DataLoader} for an example of how to load this XML and get it as an Object. Once the XML has been loaded and parsed into an Object, it can be converted into an Array of URLData objects with the following code:
+<code>
+ // objects of type URLData
+ private var mURLs:Array;
+
+ // parse an Object containing converted XML
+ // @param o: Object from DataLoader or XML2Object
+ // @return true if parsing went ok, otherwise false
+ private function handleSettingsLoaded (o:Object) : Boolean {
+ mURLs = Parser.parseList(o.settings.urls.url, org.asapframework.data.loader.URLData, false);
+
+ return (mURLs != null);
+ }
+</code>
+After calling this function, the member variable <code>mURLs</code> contains a list of objects of type URLData, filled with the content of the XML file.
+Notes to this code:
+<ul>
+<li>The first parameter to {@link parseList} is a (can be a) repeating node where each node contains similar data to be parsed into </li>
+<li>Conversion of nodes to an Array is not necessary. If the <urls>-node in the aforementioned XML file would contain only one <url>-node, the parser still returns an Array, with one object of type URLData.</li>
+<li>Since the last parameter to the call to {@link #parseList} is false, an error in the xml data will result in mURLs being null. The parsing class determines when this is the case.</li>
+</ul>
*/
class org.asapframework.data.loader.Parser {
/**
- *
+ * Parse an array of objects from XML into an array of the specified class instance by calling its parseObject function
+ * @param inObject: object from XML2Object (usually), will be converted to an Array if it isn't already
+ * @param f: classname to be instanced
+ * @param ignoreError: if true, the return value of {@link #parseObject} is always added to the array, and the array itself is returned. Otherwise, an error in parsing will return null.
+ * @return Array of new objects of the specified type, cast to IParsable, or null if parsing returned false
*/
- public static function parseList (inListObj:Object, f:Function) : Array {
+ public static function parseList (inListObj:Object, f:Function, ignoreError:Boolean) : Array {
var list:Array = XML2Object.makeArray(inListObj);
var a:Array = new Array();
var len:Number = list.length;
for (var i : Number = 0; i < len; i++) {
- var newObject:IParsable = parseObject(list[i], f);
- if (newObject == null) return null;
+ var newObject:IParsable = parseObject(list[i], f, ignoreError);
+ if ((newObject == null) && !ignoreError) return null;
else a.push(newObject);
}
@@ -50,11 +85,12 @@
* Parse an object from XML into the specified class instance by calling its parseObject function
* @param inObject: object from XML2Object (usually)
* @param f: classname to be instanced
+ * @param ignoreError: if true, the return value of {@link IParsable#parseObject} is ignored, and the newly created object is always returned.
* @return a new object of the specified type, cast to IParsable, or null if parsing returned false
*/
- public static function parseObject (inObject:Object, f:Function) : IParsable {
+ public static function parseObject (inObject:Object, f:Function, ignoreError:Boolean) : IParsable {
var ip:IParsable = new f();
- if (ip.parseObject(inObject)) {
+ if (ip.parseObject(inObject) || ignoreError) {
return ip;
} else {
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-10 06:03:26
|
Revision: 584
http://svn.sourceforge.net/asapframework/?rev=584&view=rev
Author: aclemens
Date: 2006-10-09 23:03:19 -0700 (Mon, 09 Oct 2006)
Log Message:
-----------
removing old NotificationCenter files
Removed Paths:
-------------
trunk/asapframework/org/asapframework/events/Notification.as
trunk/asapframework/org/asapframework/events/NotificationCenter.as
trunk/asapframework/org/asapframework/events/NotificationObserverData.as
Deleted: trunk/asapframework/org/asapframework/events/Notification.as
===================================================================
--- trunk/asapframework/org/asapframework/events/Notification.as 2006-10-10 06:01:09 UTC (rev 583)
+++ trunk/asapframework/org/asapframework/events/Notification.as 2006-10-10 06:03:19 UTC (rev 584)
@@ -1,42 +0,0 @@
-/*
-Copyright 2005-2006 by the authors of asapframework, http://asapframework.org
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/**
-Data structure for {@link NotificationCenter}.
-@author Arthur Clemens
-@version 29 December 2004
-*/
-
-class org.asapframework.events.Notification {
-
- public var name:String;
- public var object:Object;
- public var data:Object;
-
- public function Notification (inName:String,
- inObject:Object,
- inData:Object) {
- name = inName;
- object = inObject;
- data = inData;
- }
-
- public function toString () : String
- {
- return "Notification: name=" + name + "; object=" + object + ";data=" + data;
- }
-
-}
\ No newline at end of file
Deleted: trunk/asapframework/org/asapframework/events/NotificationCenter.as
===================================================================
--- trunk/asapframework/org/asapframework/events/NotificationCenter.as 2006-10-10 06:01:09 UTC (rev 583)
+++ trunk/asapframework/org/asapframework/events/NotificationCenter.as 2006-10-10 06:03:19 UTC (rev 584)
@@ -1,431 +0,0 @@
-/*
-Copyright 2005-2006 by the authors of asapframework, http://asapframework.org
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-import org.asapframework.events.Notification;
-import org.asapframework.events.NotificationObserverData;
-import org.asapframework.util.debug.Log;
-
-/**
-NotificationCenter provides a way for objects that don't know about each other to communicate. It receives Notification objects and broadcasts them to all interested objects.<br />
-This is an almost complete ActionScript implementation of Apple Cocoa's <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/index.html">NSNotificationCenter</a>.
-@author Arthur Clemens
-@use
-Add an observer:
-<code>
-NotificationCenter.getDefaultCenter().addObserver(this,
- "handleAdviceAccordionDidUpdate",
- "AdviceAccordionDidUpdateNotification");
-</code>
-The 'this' object will now listen to the notifications with name "AdviceAccordionDidUpdateNotification". This notification can be sent by any object, also from the timeline (see below).
-When the notification "AdviceAccordionDidUpdateNotification" is posted, method <code>handleAdviceAccordionDidUpdate</code> is called (second argument).
-<hr>
-The receiving class (the 'this' in the example above) should implement the method handleAdviceAccordionDidUpdate:
-<code>
-private function handleAdviceAccordionDidUpdate (inNote:Notification) : Void
-{
- var notificationName:String = inNote.name;
- var notificationObject:Object = inNote.object;
- var productData:Object = inNote.data;
- // do something with productData ...
-}
-</code>
-<hr />
-In a class, let's say class A, the object will post a notification like this:
-<code>
-NotificationCenter.getDefaultCenter().post("AdviceAccordionDidUpdateNotification",
- null,
- prodData);
-</code>
-In our example, <code>prodData</code> is an object that will be used by the receiving class.
-<hr />
-Unregister the observer from the notification with:
-<code>
-NotificationCenter.getDefaultCenter().removeObserver(this,
- "AdviceAccordionDidUpdateNotification");
-</code>
-<hr />
-<b>Timeline notifications</b>
-The whole idea is that the posting object does not have to know the receiving object. This can be useful for sending an event somewhere from a (nested) timeline.
-
-For example we want to draw a background before playing an external movie. At the last frame of the background drawing, we put:
-<code>
-stop();
-
-import org.asapframework.events.NotificationCenter;
-NotificationCenter.getDefaultCenter().post("MovieBackgroundDidFinishNotification");
-</code>
-And in our manager class we implement:
-<code>
-NotificationCenter.getDefaultCenter().addObserver(this,
- "handleMovieBackgroundDidFinishNotification",
- "MovieBackgroundDidFinishNotification");
-</code>
-<hr />
-<b>On naming</b><br />
-Apple uses a naming convention for notification names. Examples of notification names are:
-<verbatim>
-Task<span style="color:green">Did</span>Terminate<span style="color:orange">Notification</span>
-Menu<span style="color:green">Will</span>Fold<span style="color:orange">Notification</span>
-</verbatim>
-So the formula is:
-<verbatim>
-Class of Affected Object + <span style="color:green">Did/Will</span> + Action + <span style="color:orange">Notification</span>
-</verbatim>
-@todo Find out if this can be used for Key-value observing similar to <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/DependentKeys.html">Cocoa's Registering Dependent Keys</a>.
-@history 3 Apr 2005: Added NotificationObserverData
-*/
-
-class org.asapframework.events.NotificationCenter {
-
- private static var DEFAULT_NOTIFICATION_NAME:String = "__0__";
-
- private static var sDefaultCenter:NotificationCenter = new NotificationCenter(true);
- private var mObservers:Object; /**< Key value object with notification name as key and an array as value; the array stores a value object with the properties observer, method, note and object. */
- private var mObjects:Object; /**< For optimized object retrieval in post; key value object with object name as key and an array as value; the array stores NotificationObserverData objects */
- private var mTempCleanupList:Array; /**< Marked observerData objects to be removed */
- private var mCheckOnAdding:Boolean; /**< Check for doubles flag */
- private var mNotifyErrors:Boolean; /**< Will report errrors flag */
-
- /**
- Creates a new NotificationCenter. Call this constructor only if you explicitely don't want to use the default NotificationCenter, for instance if you want to control performance.
- @param inShouldNotifyErrors (optional) if true, the NotificationCenter will report errors to the {@link Console}; by default error reporting is off.
- @see #getDefaultCenter
- */
- public function NotificationCenter (inShouldNotifyErrors:Boolean)
- {
- mObservers = {};
- mObjects = {};
- mTempCleanupList = [];
- mCheckOnAdding = false;
- mNotifyErrors = (inShouldNotifyErrors != undefined) ? inShouldNotifyErrors : false;
- }
-
- /**
- @param inFlag : If true, NotificationCenter will report errors to the {@link Console}. Error reporting is off by default.
- */
- public function setNotifyErrors (inFlag:Boolean) : Void
- {
- mNotifyErrors = inFlag;
- }
-
- /**
- Accesses the default notification center. For most cases you can just use this default notification center. If performance becomes problematic (if you have a few thousand observers, and need to do frequent adding and removing) it makes sense to instantiate a custom NotificationCenter object.
- @return Reference to the static NotificationCenter (Singleton).
- */
- public static function getDefaultCenter () : NotificationCenter
- {
- return sDefaultCenter;
- }
-
- /**
- Registers inObserver to receive notifications with the name inNotificationName and/or containing inNotificationObject.
- When a notification of name inNotificationName containing the object inNotificationObject is posted, inObserver's method inMethodName is called with a {@link Notification} as the argument. If inNotificationName is undefined, the notification center notifies the observer of all notifications with an object matching inNotificationObject. If inNotificationObject is nil, the notification center notifies the observer of all notifications with the name inNotificationName. inObserver may not be undefined.
- @param inObserver : object to receive notifications
- @param inMethodName : The observer's method that will be called when sent a notification. This method should only have one argument (of type Notification).
- @param inNotificationName : (optional) notification identifier name; if undefined, you must use inNotificationObject
- @param inNotificationObject : (optional) notification identifier object; the notification center notifies the observer of all notifications with an object matching this object
- @example
- This example adds an observer 'this', to let method 'doSomething' be called as soon as the notification named 'PanelWillUpdateNotification' is posted:
- <code>
- NotificationCenter.getDefaultCenter().addObserver(this,
- "doSomething",
- "PanelWillUpdateNotification");
- </code>
- <hr />
- In the following example, we don't specify a notification name:
- <code>
- NotificationCenter.getDefaultCenter().addObserver(this,
- "updatePanel",
- null,
- myPanel);
- </code>
- Now all notifications with 'myPanel' as object argument will be passed (we'll pass the current time as data):
- <code>
- NotificationCenter.getDefaultCenter().post(null,
- myPanel,
- getTimer());
- </code>
- */
- public function addObserver (inObserver:Object,
- inMethodName:String,
- inNotificationName:String,
- inNotificationObject:Object) : Void
- {
- if (inNotificationName == undefined) {
- inNotificationName = DEFAULT_NOTIFICATION_NAME; // dummy because empty string cannot be searched on
- }
- if (mObservers[inNotificationName] == undefined) {
- mObservers[inNotificationName] = new Array();
- }
- // check if alreay in list with the same arguments
- if (mNotifyErrors && mCheckOnAdding && contains(mObservers, inObserver, inMethodName, inNotificationName, inNotificationObject)) {
- Log.warn("addObserver - Observer already added with same arguments: '" + arguments + "' -- not added.", toString());
- return;
- }
- var observerData:NotificationObserverData = new NotificationObserverData(inObserver,
- inMethodName,
- inNotificationName,
- inNotificationObject);
- mObservers[inNotificationName].push(observerData);
-
- // optimize object handling, to retrieve all messages targeted to the object
- if (inNotificationObject != null) {
- if (mCheckOnAdding && contains(mObjects, inObserver, inMethodName, inNotificationName, inNotificationObject)) {
- // No warning, should be covered by previous warning message.
- return;
- }
- if (mObjects[inNotificationObject] == undefined) {
- mObjects[inNotificationObject] = new Array();
- }
- mObjects[inNotificationObject].push(observerData);
- }
- }
-
- /**
- Set checking for doubles when calling addObserver. If true, each entry is checked if it is already in the list. For performance, checking is off by default.
- @param inFlag : When true, newly added observers will be checked if they are already in the list.
- */
- public function checkOnAdding (inFlag:Boolean) : Void
- {
- mCheckOnAdding = inFlag;
- }
-
- /**
- Removes inObserver as the observer of notifications with the name inNotificationName and object inNotificationObject from the object. inObserver may not be nil. Be sure to invoke this method before removing the observer object or any object specified in addObserver.
- If inNotificationName is nil, inObserver is removed as an observer of all notifications containing inNotificationObject. If inNotificationObject is nil, inObserver is removed as an observer of inNotificationName containing any object.
- @param inObserver: observing object
- @param inNotificationName: (optional) notification identifier name; if undefined, you must use inNotificationObject
- @param inNotificationObject: (optional) notification identifier object; specify when the observer listens to notifications with an object matching this object
- @example
- To unregister someObserver from all notifications it had previously registered for, you would send this method:
- <code>
- NotificationCenter.getDefaultCenter().removeObserver(someObserver);
- </code>
- To unregister the observer from the particular notification theNotificationName, use:
- <code>
- NotificationCenter.getDefaultCenter().removeObserver(someObserver, theNotificationName);
- </code>
- */
- public function removeObserver (inObserver:Object,
- inNotificationName:String,
- inNotificationObject:Object) : Void
- {
- if (mObservers[inNotificationName].length == 0) {
- if (mNotifyErrors) {
- Log.info("removeObserver - Nothing to remove.", toString());
- }
- return;
- }
- var removed:Boolean;
- removed = removeFromCollection(mObservers, inObserver, inNotificationName, inNotificationObject);
- if (mNotifyErrors && !removed) {
- Log.warn("removeObserver - Nothing removed from mObservers: " + arguments, toString());
- }
- if (inNotificationObject != null) {
- removed = removeFromCollection(mObjects, inObserver, inNotificationName, inNotificationObject);
- if (mNotifyErrors && !removed) {
- Log.warn("removeObserver - Nothing removed from mObjects: " + arguments, toString());
- }
- }
-
- // erase marked observerData objects
- var len:Number = mTempCleanupList.length;
- if (len > 0) {
- if (mNotifyErrors) {
- Log.info("removeObserver - Removing: " + len + " objects.", toString());
- }
- var i:Number = len;
- while (--i != -1) {
- removeObject(mTempCleanupList[i]);
- }
- mTempCleanupList = [];
- }
- }
-
- /**
- Creates a {@link Notification} instance and passes this to the observers associated through inNotificationName or inNotificationObject.
- @param inNotificationName : (optional) notification identifier name; if undefined, you must use inNotificationObject
- @param inNotificationObject : (optional) notification identifier object; typically the object posting the notification; may be null; if not null, any message is sent that is directed to this object
- @param inData : (optional) object to pass - this will be packed in the Notification
- @example
- This example finds all observers that are associated with the notification name 'ButtonDidUpdateNotification', and passes them a Notification object with data "My message".
- <code>
- NotificationCenter.getDefaultCenter().post("ButtonDidUpdateNotification",
- null,
- "My message");
- </code>
- The following example sends a notification to the observers that are associated with identifier object <i>anIdentifier</i>. Note that the name of the notification is not important when you pass an object - it may be an empty string. The object is associated with the observer in addObserver (<i>the notification center notifies the observer of all notifications with an object matching inNotificationObject</i>).
- <code>
- var anIdentifier:Object = this;
- NotificationCenter.getDefaultCenter().post(null,
- anIdentifier,
- "My message");
- </code>
- */
- public function post (inNotificationName:String,
- inNotificationObject:Object,
- inData:Object) : Void
- {
- var noteName:String = (inNotificationName != undefined) ? inNotificationName : DEFAULT_NOTIFICATION_NAME;
-
- var observers:Array;
-
- if (inNotificationObject == null) {
- observers = mObservers[noteName];
- } else {
- observers = mObjects[inNotificationObject];
- }
-
- if (mNotifyErrors) {
- if ( observers.length == 0 || observers.length == undefined) {
- Log.error("postNotificationName - No notification with name '" + noteName + "' known.", toString());
- return;
- }
- }
- var len:Number = observers.length;
- var i:Number = len;
- while (--i != -1) {
- var observerData:NotificationObserverData = NotificationObserverData(observers[i]);
- if (noteName != observerData.note) {
- if ((observerData.note != DEFAULT_NOTIFICATION_NAME) || inNotificationObject == null) {
- // proceed
- } else {
- continue; // skip
- }
- }
-
- if (inNotificationObject != observerData.object) {
- continue; // skip
- }
-
- var note:Notification = new Notification(observerData.note, inNotificationObject, inData);
- var func:Function = observerData.observer[observerData.method];
- if (mNotifyErrors && func == undefined) {
- Log.error("postNotificationName - Could not resolve method '" + observerData.method + "' for observer '" + observerData.observer + "'.", toString());
- continue;
- }
- // We are now calling the method directly
- // Another implementation might be to pass the Notification object to the NotificationCenter class and do the calling in another method.
- func.apply(observerData.observer, [note]);
- }
- }
-
- // PRIVATE METHODS
-
- /**
- Loops through the collection inCollection to check if the item is already present. This is very time consuming with large collections.
- @return True when in list, false when not.
- */
- private function contains (inCollection:Object,
- inObserver:Object,
- inMethodName:String,
- inNotificationName:String,
- inNotificationObject:Object) : Boolean
- {
- for (var n:String in inCollection) {
- var o:Object = inCollection[n];
- var len:Number = o.length;
- var i:Number = len;
- while (--i != -1) {
- var observerData:NotificationObserverData = o[i];
- if (observerData.isEqualToParams(inObserver, inMethodName, inNotificationName, inNotificationObject)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
-
- */
- private function removeFromCollection (inCollection:Object,
- inObserver:Object,
- inNotificationName:String,
- inNotificationObject:Object) : Boolean
- {
- var removed:Boolean = false;
- for (var n:String in inCollection) {
- var o:Object = inCollection[n];
- var len:Number = o.length;
- for (var i:Number = len - 1; i >= 0; --i) {
- var observerData:Object = o[i];
- if (observerData.observer == inObserver) {
- if (inNotificationObject != null && inNotificationName != null) {
- if (observerData.object == inNotificationObject && observerData.note == inNotificationName) {
- mTempCleanupList.push(observerData);
- if (len == 1) {
- delete o; o = null;
- }
- removed = true;
- }
- }
-
- if (inNotificationObject != null && inNotificationName == null) {
- // check for object
- if (observerData.object == inNotificationObject) {
- mTempCleanupList.push(observerData);
- if (len == 1) {
- delete o; o = null;
- }
- removed = true;
- }
- }
-
- if (inNotificationObject == null && inNotificationName != null) {
- // check for notification name
- if (observerData.note == inNotificationName) {
- mTempCleanupList.push(observerData);
- if (len == 1) {
- delete o; o = null;
- }
- removed = true;
- }
- }
-
- // else
- if (inNotificationObject == null && inNotificationName == null) {
- mTempCleanupList.push(observerData);
- if (len == 1) {
- delete o; o = null;
- }
- removed = true;
- }
- }
- }
- }
- return removed;
- }
-
- /**
- Deletes an object with its properties.
- */
- private function removeObject (o:Object) : Void
- {
- if (o == null) return;
- for (var n:String in o) {
- delete o[n];
- o[n] = null;
- }
- delete o;
- o = null;
- }
-
- public function toString() : String {
- return ";org.asapframework.events.NotificationCenter";
- }
-
-}
\ No newline at end of file
Deleted: trunk/asapframework/org/asapframework/events/NotificationObserverData.as
===================================================================
--- trunk/asapframework/org/asapframework/events/NotificationObserverData.as 2006-10-10 06:01:09 UTC (rev 583)
+++ trunk/asapframework/org/asapframework/events/NotificationObserverData.as 2006-10-10 06:03:19 UTC (rev 584)
@@ -1,62 +0,0 @@
-/*
-Copyright 2005-2006 by the authors of asapframework, http://asapframework.org
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/**
-Data structure for {@link NotificationCenter}.
-@author Arthur Clemens
-@version 3 April 2005
-*/
-
-class org.asapframework.events.NotificationObserverData {
-
- public var observer:Object;
- public var method:String;
- public var note:String;
- public var object:Object;
-
- public function NotificationObserverData (inObserver:Object,
- inMethod:String,
- inNote:String,
- inObject:Object) {
- observer = inObserver;
- method = inMethod;
- note = inNote;
- object = inObject;
- }
-
- /**
- Tests if the variables of the current NotificationObserverData object is equal to the passed parameters.
- */
- public function isEqualToParams (inObserver:Object,
- inMethod:String,
- inNote:String,
- inObject:Object) : Boolean
- {
- if (observer == inObserver &&
- method == inMethod &&
- note == inNote &&
- object == inObject) {
- return true;
- }
- return false;
- }
-
- public function toString () : String
- {
- return "NotificationObserverData: observer=" + observer + "; method=" + method + ";note=" + note + "; object=" + object;
- }
-
-}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-10 06:01:26
|
Revision: 583
http://svn.sourceforge.net/asapframework/?rev=583&view=rev
Author: aclemens
Date: 2006-10-09 23:01:09 -0700 (Mon, 09 Oct 2006)
Log Message:
-----------
putting NotificationCenter in a package
Added Paths:
-----------
trunk/asapframework/org/asapframework/events/notificationcenter/
trunk/asapframework/org/asapframework/events/notificationcenter/Notification.as
trunk/asapframework/org/asapframework/events/notificationcenter/NotificationCenter.as
trunk/asapframework/org/asapframework/events/notificationcenter/NotificationObserverData.as
Added: trunk/asapframework/org/asapframework/events/notificationcenter/Notification.as
===================================================================
--- trunk/asapframework/org/asapframework/events/notificationcenter/Notification.as (rev 0)
+++ trunk/asapframework/org/asapframework/events/notificationcenter/Notification.as 2006-10-10 06:01:09 UTC (rev 583)
@@ -0,0 +1,50 @@
+/*
+Copyright 2005-2006 by the authors of asapframework, http://asapframework.org
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/**
+Data structure for {@link NotificationCenter}.
+@author Arthur Clemens
+*/
+
+class org.asapframework.events.notificationcenter.Notification {
+
+ public var name:String;
+ public var object:Object;
+ public var data:Object;
+
+ /**
+ Creates a new Notification object.
+ @param inName: the name of the notification
+ @param inObject: the notification object
+ @param inData: the notification data
+ */
+ public function Notification (inName:String,
+ inObject:Object,
+ inData:Object) {
+ name = inName;
+ object = inObject;
+ data = inData;
+ }
+
+ /**
+
+ */
+ public function toString () : String
+ {
+ return "Notification: name=" + name + "; object=" + object + "; data=" + data;
+ }
+
+}
\ No newline at end of file
Added: trunk/asapframework/org/asapframework/events/notificationcenter/NotificationCenter.as
===================================================================
--- trunk/asapframework/org/asapframework/events/notificationcenter/NotificationCenter.as (rev 0)
+++ trunk/asapframework/org/asapframework/events/notificationcenter/NotificationCenter.as 2006-10-10 06:01:09 UTC (rev 583)
@@ -0,0 +1,430 @@
+/*
+Copyright 2005-2006 by the authors of asapframework, http://asapframework.org
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import org.asapframework.events.notificationcenter.Notification;
+import org.asapframework.events.notificationcenter.NotificationObserverData;
+import org.asapframework.util.debug.Log;
+
+/**
+NotificationCenter provides a way for objects that don't know about each other to communicate. It receives Notification objects and broadcasts them to all interested objects.<br />
+This is an almost complete ActionScript implementation of Apple Cocoa's <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/index.html">NSNotificationCenter</a>.
+@author Arthur Clemens
+@use
+Add an observer:
+<code>
+NotificationCenter.getDefaultCenter().addObserver(this,
+ "handleAdviceAccordionDidUpdate",
+ "AdviceAccordionDidUpdateNotification");
+</code>
+The 'this' object will now listen to the notifications with name "AdviceAccordionDidUpdateNotification". This notification can be sent by any object, also from the timeline (see below).
+When the notification "AdviceAccordionDidUpdateNotification" is posted, method <code>handleAdviceAccordionDidUpdate</code> is called (second argument).
+<hr>
+The receiving class (the 'this' in the example above) should implement the method handleAdviceAccordionDidUpdate:
+<code>
+private function handleAdviceAccordionDidUpdate (inNote:Notification) : Void
+{
+ var notificationName:String = inNote.name;
+ var notificationObject:Object = inNote.object;
+ var productData:Object = inNote.data;
+ // do something with productData ...
+}
+</code>
+<hr />
+In a class, let's say class A, the object will post a notification like this:
+<code>
+NotificationCenter.getDefaultCenter().post("AdviceAccordionDidUpdateNotification",
+ null,
+ prodData);
+</code>
+In our example, <code>prodData</code> is an object that will be used by the receiving class.
+<hr />
+Unregister the observer from the notification with:
+<code>
+NotificationCenter.getDefaultCenter().removeObserver(this,
+ "AdviceAccordionDidUpdateNotification");
+</code>
+<hr />
+<b>Timeline notifications</b>
+The whole idea is that the posting object does not have to know the receiving object. This can be useful for sending an event somewhere from a (nested) timeline.
+
+For example we want to draw a background before playing an external movie. At the last frame of the background drawing, we put:
+<code>
+stop();
+
+import org.asapframework.events.notificationcenter.NotificationCenter;
+NotificationCenter.getDefaultCenter().post("MovieBackgroundDidFinishNotification");
+</code>
+And in our manager class we implement:
+<code>
+NotificationCenter.getDefaultCenter().addObserver(this,
+ "handleMovieBackgroundDidFinishNotification",
+ "MovieBackgroundDidFinishNotification");
+</code>
+<hr />
+<b>On naming</b><br />
+Apple uses a naming convention for notification names. Examples of notification names are:
+<verbatim>
+Task<span style="color:green">Did</span>Terminate<span style="color:orange">Notification</span>
+Menu<span style="color:green">Will</span>Fold<span style="color:orange">Notification</span>
+</verbatim>
+So the formula is:
+<verbatim>
+Class of Affected Object + <span style="color:green">Did/Will</span> + Action + <span style="color:orange">Notification</span>
+</verbatim>
+@todo Find out if this can be used for Key-value observing similar to <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/DependentKeys.html">Cocoa's Registering Dependent Keys</a>.
+*/
+
+class org.asapframework.events.notificationcenter.NotificationCenter {
+
+ private static var DEFAULT_NOTIFICATION_NAME:String = "__0__";
+
+ private static var sDefaultCenter:NotificationCenter = new NotificationCenter(true);
+ private var mObservers:Object; /**< Key value object with notification name as key and an array as value; the array stores a value object with the properties observer, method, note and object. */
+ private var mObjects:Object; /**< For optimized object retrieval in post; key value object with object name as key and an array as value; the array stores NotificationObserverData objects */
+ private var mTempCleanupList:Array; /**< Marked observerData objects to be removed */
+ private var mCheckOnAdding:Boolean; /**< Check for doubles flag */
+ private var mNotifyErrors:Boolean; /**< Will report errrors flag */
+
+ /**
+ Creates a new NotificationCenter. Call this constructor only if you explicitely don't want to use the default NotificationCenter, for instance if you want to control performance.
+ @param inShouldNotifyErrors (optional) if true, the NotificationCenter will report errors to the {@link Console}; by default error reporting is off.
+ @see #getDefaultCenter
+ */
+ public function NotificationCenter (inShouldNotifyErrors:Boolean)
+ {
+ mObservers = {};
+ mObjects = {};
+ mTempCleanupList = [];
+ mCheckOnAdding = false;
+ mNotifyErrors = (inShouldNotifyErrors != undefined) ? inShouldNotifyErrors : false;
+ }
+
+ /**
+ @param inFlag : If true, NotificationCenter will report errors to the {@link Console}. Error reporting is off by default.
+ */
+ public function setNotifyErrors (inFlag:Boolean) : Void
+ {
+ mNotifyErrors = inFlag;
+ }
+
+ /**
+ Accesses the default notification center. For most cases you can just use this default notification center. If performance becomes problematic (if you have a few thousand observers, and need to do frequent adding and removing) it makes sense to instantiate a custom NotificationCenter object.
+ @return Reference to the static NotificationCenter (Singleton).
+ */
+ public static function getDefaultCenter () : NotificationCenter
+ {
+ return sDefaultCenter;
+ }
+
+ /**
+ Registers inObserver to receive notifications with the name inNotificationName and/or containing inNotificationObject.
+ When a notification of name inNotificationName containing the object inNotificationObject is posted, inObserver's method inMethodName is called with a {@link Notification} as the argument. If inNotificationName is undefined, the notification center notifies the observer of all notifications with an object matching inNotificationObject. If inNotificationObject is nil, the notification center notifies the observer of all notifications with the name inNotificationName. inObserver may not be undefined.
+ @param inObserver : object to receive notifications
+ @param inMethodName : The observer's method that will be called when sent a notification. This method should only have one argument (of type Notification).
+ @param inNotificationName : (optional) notification identifier name; if undefined, you must use inNotificationObject
+ @param inNotificationObject : (optional) notification identifier object; the notification center notifies the observer of all notifications with an object matching this object
+ @example
+ This example adds an observer 'this', to let method 'doSomething' be called as soon as the notification named 'PanelWillUpdateNotification' is posted:
+ <code>
+ NotificationCenter.getDefaultCenter().addObserver(this,
+ "doSomething",
+ "PanelWillUpdateNotification");
+ </code>
+ <hr />
+ In the following example, we don't specify a notification name:
+ <code>
+ NotificationCenter.getDefaultCenter().addObserver(this,
+ "updatePanel",
+ null,
+ myPanel);
+ </code>
+ Now all notifications with 'myPanel' as object argument will be passed (we'll pass the current time as data):
+ <code>
+ NotificationCenter.getDefaultCenter().post(null,
+ myPanel,
+ getTimer());
+ </code>
+ */
+ public function addObserver (inObserver:Object,
+ inMethodName:String,
+ inNotificationName:String,
+ inNotificationObject:Object) : Void
+ {
+ if (inNotificationName == undefined) {
+ inNotificationName = DEFAULT_NOTIFICATION_NAME; // dummy because empty string cannot be searched on
+ }
+ if (mObservers[inNotificationName] == undefined) {
+ mObservers[inNotificationName] = new Array();
+ }
+ // check if alreay in list with the same arguments
+ if (mNotifyErrors && mCheckOnAdding && contains(mObservers, inObserver, inMethodName, inNotificationName, inNotificationObject)) {
+ Log.warn("addObserver - Observer already added with same arguments: '" + arguments + "' -- not added.", toString());
+ return;
+ }
+ var observerData:NotificationObserverData = new NotificationObserverData(inObserver,
+ inMethodName,
+ inNotificationName,
+ inNotificationObject);
+ mObservers[inNotificationName].push(observerData);
+
+ // optimize object handling, to retrieve all messages targeted to the object
+ if (inNotificationObject != null) {
+ if (mCheckOnAdding && contains(mObjects, inObserver, inMethodName, inNotificationName, inNotificationObject)) {
+ // No warning, should be covered by previous warning message.
+ return;
+ }
+ if (mObjects[inNotificationObject] == undefined) {
+ mObjects[inNotificationObject] = new Array();
+ }
+ mObjects[inNotificationObject].push(observerData);
+ }
+ }
+
+ /**
+ Set checking for doubles when calling addObserver. If true, each entry is checked if it is already in the list. For performance, checking is off by default.
+ @param inFlag : When true, newly added observers will be checked if they are already in the list.
+ */
+ public function checkOnAdding (inFlag:Boolean) : Void
+ {
+ mCheckOnAdding = inFlag;
+ }
+
+ /**
+ Removes inObserver as the observer of notifications with the name inNotificationName and object inNotificationObject from the object. inObserver may not be nil. Be sure to invoke this method before removing the observer object or any object specified in addObserver.
+ If inNotificationName is nil, inObserver is removed as an observer of all notifications containing inNotificationObject. If inNotificationObject is nil, inObserver is removed as an observer of inNotificationName containing any object.
+ @param inObserver: observing object
+ @param inNotificationName: (optional) notification identifier name; if undefined, you must use inNotificationObject
+ @param inNotificationObject: (optional) notification identifier object; specify when the observer listens to notifications with an object matching this object
+ @example
+ To unregister someObserver from all notifications it had previously registered for, you would send this method:
+ <code>
+ NotificationCenter.getDefaultCenter().removeObserver(someObserver);
+ </code>
+ To unregister the observer from the particular notification theNotificationName, use:
+ <code>
+ NotificationCenter.getDefaultCenter().removeObserver(someObserver, theNotificationName);
+ </code>
+ */
+ public function removeObserver (inObserver:Object,
+ inNotificationName:String,
+ inNotificationObject:Object) : Void
+ {
+ if (mObservers[inNotificationName].length == 0) {
+ if (mNotifyErrors) {
+ Log.info("removeObserver - Nothing to remove.", toString());
+ }
+ return;
+ }
+ var removed:Boolean;
+ removed = removeFromCollection(mObservers, inObserver, inNotificationName, inNotificationObject);
+ if (mNotifyErrors && !removed) {
+ Log.warn("removeObserver - Nothing removed from mObservers: " + arguments, toString());
+ }
+ if (inNotificationObject != null) {
+ removed = removeFromCollection(mObjects, inObserver, inNotificationName, inNotificationObject);
+ if (mNotifyErrors && !removed) {
+ Log.warn("removeObserver - Nothing removed from mObjects: " + arguments, toString());
+ }
+ }
+
+ // erase marked observerData objects
+ var len:Number = mTempCleanupList.length;
+ if (len > 0) {
+ if (mNotifyErrors) {
+ Log.info("removeObserver - Removing: " + len + " objects.", toString());
+ }
+ var i:Number = len;
+ while (--i != -1) {
+ removeObject(mTempCleanupList[i]);
+ }
+ mTempCleanupList = [];
+ }
+ }
+
+ /**
+ Creates a {@link Notification} instance and passes this to the observers associated through inNotificationName or inNotificationObject.
+ @param inNotificationName : (optional) notification identifier name; if undefined, you must use inNotificationObject
+ @param inNotificationObject : (optional) notification identifier object; typically the object posting the notification; may be null; if not null, any message is sent that is directed to this object
+ @param inData : (optional) object to pass - this will be packed in the Notification
+ @example
+ This example finds all observers that are associated with the notification name 'ButtonDidUpdateNotification', and passes them a Notification object with data "My message".
+ <code>
+ NotificationCenter.getDefaultCenter().post("ButtonDidUpdateNotification",
+ null,
+ "My message");
+ </code>
+ The following example sends a notification to the observers that are associated with identifier object <i>anIdentifier</i>. Note that the name of the notification is not important when you pass an object - it may be an empty string. The object is associated with the observer in addObserver (<i>the notification center notifies the observer of all notifications with an object matching inNotificationObject</i>).
+ <code>
+ var anIdentifier:Object = this;
+ NotificationCenter.getDefaultCenter().post(null,
+ anIdentifier,
+ "My message");
+ </code>
+ */
+ public function post (inNotificationName:String,
+ inNotificationObject:Object,
+ inData:Object) : Void
+ {
+ var noteName:String = (inNotificationName != undefined) ? inNotificationName : DEFAULT_NOTIFICATION_NAME;
+
+ var observers:Array;
+
+ if (inNotificationObject == null) {
+ observers = mObservers[noteName];
+ } else {
+ observers = mObjects[inNotificationObject];
+ }
+
+ if (mNotifyErrors) {
+ if ( observers.length == 0 || observers.length == undefined) {
+ Log.error("postNotificationName - No notification with name '" + noteName + "' known.", toString());
+ return;
+ }
+ }
+ var len:Number = observers.length;
+ var i:Number = len;
+ while (--i != -1) {
+ var observerData:NotificationObserverData = NotificationObserverData(observers[i]);
+ if (noteName != observerData.note) {
+ if ((observerData.note != DEFAULT_NOTIFICATION_NAME) || inNotificationObject == null) {
+ // proceed
+ } else {
+ continue; // skip
+ }
+ }
+
+ if (inNotificationObject != observerData.object) {
+ continue; // skip
+ }
+
+ var note:Notification = new Notification(observerData.note, inNotificationObject, inData);
+ var func:Function = observerData.observer[observerData.method];
+ if (mNotifyErrors && func == undefined) {
+ Log.error("postNotificationName - Could not resolve method '" + observerData.method + "' for observer '" + observerData.observer + "'.", toString());
+ continue;
+ }
+ // We are now calling the method directly
+ // Another implementation might be to pass the Notification object to the NotificationCenter class and do the calling in another method.
+ func.apply(observerData.observer, [note]);
+ }
+ }
+
+ // PRIVATE METHODS
+
+ /**
+ Loops through the collection inCollection to check if the item is already present. This is very time consuming with large collections.
+ @return True when in list, false when not.
+ */
+ private function contains (inCollection:Object,
+ inObserver:Object,
+ inMethodName:String,
+ inNotificationName:String,
+ inNotificationObject:Object) : Boolean
+ {
+ for (var n:String in inCollection) {
+ var o:Object = inCollection[n];
+ var len:Number = o.length;
+ var i:Number = len;
+ while (--i != -1) {
+ var observerData:NotificationObserverData = o[i];
+ if (observerData.isEqualToParams(inObserver, inMethodName, inNotificationName, inNotificationObject)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+
+ */
+ private function removeFromCollection (inCollection:Object,
+ inObserver:Object,
+ inNotificationName:String,
+ inNotificationObject:Object) : Boolean
+ {
+ var removed:Boolean = false;
+ for (var n:String in inCollection) {
+ var o:Object = inCollection[n];
+ var len:Number = o.length;
+ for (var i:Number = len - 1; i >= 0; --i) {
+ var observerData:Object = o[i];
+ if (observerData.observer == inObserver) {
+ if (inNotificationObject != null && inNotificationName != null) {
+ if (observerData.object == inNotificationObject && observerData.note == inNotificationName) {
+ mTempCleanupList.push(observerData);
+ if (len == 1) {
+ delete o; o = null;
+ }
+ removed = true;
+ }
+ }
+
+ if (inNotificationObject != null && inNotificationName == null) {
+ // check for object
+ if (observerData.object == inNotificationObject) {
+ mTempCleanupList.push(observerData);
+ if (len == 1) {
+ delete o; o = null;
+ }
+ removed = true;
+ }
+ }
+
+ if (inNotificationObject == null && inNotificationName != null) {
+ // check for notification name
+ if (observerData.note == inNotificationName) {
+ mTempCleanupList.push(observerData);
+ if (len == 1) {
+ delete o; o = null;
+ }
+ removed = true;
+ }
+ }
+
+ // else
+ if (inNotificationObject == null && inNotificationName == null) {
+ mTempCleanupList.push(observerData);
+ if (len == 1) {
+ delete o; o = null;
+ }
+ removed = true;
+ }
+ }
+ }
+ }
+ return removed;
+ }
+
+ /**
+ Deletes an object with its properties.
+ */
+ private function removeObject (o:Object) : Void
+ {
+ if (o == null) return;
+ for (var n:String in o) {
+ delete o[n];
+ o[n] = null;
+ }
+ delete o;
+ o = null;
+ }
+
+ public function toString() : String {
+ return ";org.asapframework.events.NotificationCenter";
+ }
+
+}
\ No newline at end of file
Added: trunk/asapframework/org/asapframework/events/notificationcenter/NotificationObserverData.as
===================================================================
--- trunk/asapframework/org/asapframework/events/notificationcenter/NotificationObserverData.as (rev 0)
+++ trunk/asapframework/org/asapframework/events/notificationcenter/NotificationObserverData.as 2006-10-10 06:01:09 UTC (rev 583)
@@ -0,0 +1,61 @@
+/*
+Copyright 2005-2006 by the authors of asapframework, http://asapframework.org
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/**
+Data structure for {@link NotificationCenter}.
+@author Arthur Clemens
+*/
+
+class org.asapframework.events.notificationcenter.NotificationObserverData {
+
+ public var observer:Object;
+ public var method:String;
+ public var note:String;
+ public var object:Object;
+
+ public function NotificationObserverData (inObserver:Object,
+ inMethod:String,
+ inNote:String,
+ inObject:Object) {
+ observer = inObserver;
+ method = inMethod;
+ note = inNote;
+ object = inObject;
+ }
+
+ /**
+ Tests if the variables of the current NotificationObserverData object is equal to the passed parameters.
+ */
+ public function isEqualToParams (inObserver:Object,
+ inMethod:String,
+ inNote:String,
+ inObject:Object) : Boolean
+ {
+ if (observer == inObserver &&
+ method == inMethod &&
+ note == inNote &&
+ object == inObject) {
+ return true;
+ }
+ return false;
+ }
+
+ public function toString () : String
+ {
+ return "NotificationObserverData: observer=" + observer + "; method=" + method + ";note=" + note + "; object=" + object;
+ }
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <acl...@us...> - 2006-10-09 22:53:35
|
Revision: 582
http://svn.sourceforge.net/asapframework/?rev=582&view=rev
Author: aclemens
Date: 2006-10-09 15:53:28 -0700 (Mon, 09 Oct 2006)
Log Message:
-----------
small demo update
Modified Paths:
--------------
trunk/asapframework/demos/NotificationCenter/src/flash/NotificationCenter.fla
trunk/asapframework/demos/NotificationCenter/web/static/swf/NotificationCenter.swf
Modified: trunk/asapframework/demos/NotificationCenter/src/flash/NotificationCenter.fla
===================================================================
(Binary files differ)
Modified: trunk/asapframework/demos/NotificationCenter/web/static/swf/NotificationCenter.swf
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|