A Three-Pound Monkey Brain: ActionScript 3.0 Libraries
As you can see, there is still much to be done. But it's a start, and it's available to anyone.
Merry Solsticetime, everyone!
Merry Solsticetime, everyone!





The white arrows indicate inheritance, i.e., "is-a" relationships. For example, a PhyloDefinition is a type of Definition. The black diamonds indicate composition, i.e., "has" relationships. For example, a Definition has any number of Anchor entities, each of which has exactly one Signifier entity."'Aves' refers to the crown clade stemming from the most recent common ancestor of Ratitae (Struthio camelus Linnaeus 1758), Tinamidae (Tetrao [Tinamus] major Gmelin 1789), and Neognathae (Vultur gryphus Linnaeus 1758)."
<apply>
xmlns="http://www.w3.org/1998/Math/MathML"
<csymbol
definitionURL="http://namesonnodes.org/2008/phylo/math/nodeClade"/>
<csymbol
definitionURL="urn:isbn:0-85301-006-4/Struthio+camelus"/>
<csymbol
definitionURL="urn:isbn:0-85301-006-4/Tetrao+major"/>
<csymbol
definitionURL="urn:isbn:0-85301-006-4/Vultur+gryphus"/>
</apply>
<pn:definition
xmlns="http://www.w3.org/1998/Math/MathML"
xmlns:pn="http://namesonnodes.org/2008/phylo/names">
<apply>
<csymbol
definitionURL="http://namesonnodes.org/2008/phylo/math/clade">
<mi form="prefix">Clade</mi>
</csymbol>
<apply>
<csymbol
definitionURL="http://namesonnodes.org/2008/phylo/math/nodeAncestors">
<mo form="infix">+</mo>
</csymbol>
<csymbol
definitionURL="urn:isbn:0-85301-006-4/Struthio+camelus">
<![CDATA[<i>Ratitae</i> (<i>Struthio camelus</i> Linnaeus 1758)]]>
</csymbol>
<csymbol
definitionURL="urn:isbn:0-85301-006-4/Tetrao+major">
<![CDATA[<i>Tinamidae</i> (<i>Tetrao</i> [<i>Tinamus</i>] <i>major</i> Gmelin 1789)]]>
</csymbol>
<csymbol
definitionURL="urn:isbn:0-85301-006-4/Vultur+gryphus">
<![CDATA[<i>Neognathae</i> (<i>Vultur gryphus</i> Linnaeus 1758)]]>
</csymbol>
</apply>
</apply>
</pn:definition>
threelbmonkeybrain package, and specifically at moving a lot of reuseable code from Names on Nodes into threelbmonkeybrain. It's looking like it could be a pretty gigantic package. So big that I started thinking of breaking it down into the Three-Pound Monkey Brain family of packages.base, net, calc, persist, anim. I dunno, what do you guys think?

// Create and populate the set.
var s:HashSet = HashSet.fromObject([1, 2, 3]);
trace(s.size); // 3
trace(s[1]); // 1
trace(s[2]); // 2
trace(s[0]); // undefined
trace(s.has(1)) // true
// Trace all elements of the set.
for each (var i:int in s)
{
trace(i);
}
// Trace all elements of the set (different method).
for (var x:* in s)
{
trace(x);
}
trace(s); // {1, 2, 3}
s.add(1);
trace(s); // {1, 2, 3}
s.add(4);
trace(s); // {1, 2, 3, 4}
s.remove(1);
trace(s); // {2, 3, 4}
delete s[2];
trace(s); // {3, 4}
s[3] = undefined;
trace(s); // {4}
net.tmkeesey. But someone pointed out to me this morning that a better name was staring me in the face all this time. Thus, I have changed the packages from net.tmkeesey to ... threelbmonkeybrain! (A bit long-winded, but unfortunately you cannot start package names with numerical digits.)http://svn3.cvsdude.com/keesey/PROJECTS/ threelbmonkeybrain/as3/trunk/src/threelbmonkeybrain)threelbmonkeybrain.load and threelbmonkeybrain.net, but I have not had time to build full unit tests for them. Once that's done, I'll write more about those.
net.tmkeesey. SVN repository here.)net.tmkeesey.utils.mxnet.tmkeesey.utils.mx.ArrayCollectionUtilArrayCollection objects with filters and/or sorts.net.tmkeesey.utils.mx.FiltrationICollectionView.filterFunction.net.tmkeesey.utils.mx.ListCollectionViewUtilListCollectionView objects to arrays, using filters and/or sorts.net.tmkeesey.utils.netflash.net objects.net.tmkeesey.utils.net.URLRequestHeaderUtilURLRequestHeader objects.net.tmkeesey.utils.net.URLRequestUtilURLRequest objects.net.tmkeesey.utils.net.URLVariablesUtilURLVariables objects.net.tmkeesey. As alluded to in my last post, it's motion blur. How easy is it to use? Here:import net.tmkeesey.anim.effects.MotionBlur;
new MotionBlur(myDisplayObject);
myDisplayObject will blur whenever you move it. It even works with preexisting filters. (Note that the blur looks best for horizontal and vertical motion, though. I may work on an improvement for that later.) There are also a few optional parameters: blurFactor (how much to blur per pixel moved), optimized (optimization flag—only uses powers of two for blurring if set to true the default), and quality (blur quality).http://svn3.cvsdude.com/keesey/PROJECTS/tmkeesey/trunk
net.tmkeesey repository. They are arranged in two packages: utils.core and utils.display:net.tmkeesey.utils.coreClassUtilObjectUtilStringUtilTimerUtilUIntUtilXMLListUtilXMLUtilnet.tmkeesey.utils.displayColorUtilDisplayObjectUtilUIntUtil.closestPowerOf2() can be used to optimize blur filters. (Coming soon: MotionBlur class.)DisplayObjectUtil.findAncestor() searches an object's display ancestry for an object of a certain class. This can greatly facilitate communication between visual components. (And even nonvisual objects, as long as they have a parent property which is an instance of DisplayObjectContainer.)http://svn3.cvsdude.com/keesey/PROJECTS/tmkeesey/trunk
net.tmkeesey as a package name, but eventually I'd like to name it after something other than myself. So this is just provisional until I start opening up collaboration.assert, core, and relate. These are distilled from packages I am using for Names on Nodes and other projects.net.tmkeesey.assert.Assertionnet.tmkeesey.assert.AssertionErrornet.tmkeesey.core.Propertynet.tmkeesey.relate.ComparisonStacknet.tmkeesey.relate.EqualityEquatable.net.tmkeesey.relate.Equatableequals(Object):Boolean, for determining qualitative equality.net.tmkeesey.relate.OrderOrdered.net.tmkeesey.relate.OrderedEquatable and adds a single method, findOrder(Object):int, for determining relative order.flexunit_src folder. All code has full ASDoc comments.AVM1Movie component largely keeps the banner functionality in its own "sandbox" (with a few exceptions that need tending to). Flash banner ads have some of the hackiest programming you'll ever care to see, but fortunately AVM1Movie prevents 99% of it from affecting the rest of the site.MouseScrollCanvas component that controls those scrolling lists of links.FlowManager. This stores a navigable tree of FlowEntry objects, each associated with a visual FlowComponent.EditEntityEvent and DemandEntityEvent.EditEntityEvent comes with a persistent object (e.g., a species, a definition, a NEXUS file, etc.). The application's responsibility is to create a FlowComponent object that will display the entity and allow the user to edit it (Update).DemandEntityEvent comes with a class of persistent object (e.g., Species, Definition, Nexus, etc.). The application's responsibility, then, is to provide the "demander" with an object of that class, either by making a new one (Create) or by selecting an existing one (Retrieve).FlowComponent: one for handling EditEntityEvent requests and the other for handling DemandEntityEvent requests.EntityEditor. It basically consists of the following components:Binomen entity, something like "Prenomen nomen Author 1970");FlowComponent object, EntitySupplier, actually uses an EntityEditor object. Once the EntitySupplier object is given the class of entity that it's supposed to supply, it creates a default instance of that class and gives it to an EntityEditor, which it displays to the left. To the right, it displays a SuggestionBox, a grid showing various existing entities that might match what's in the editor.SuggestionBox uses a nonvisual object called an EntitySuggester, whose job is to watch for changes that the user makes to the persistent entity and come up with relevant, existing suggestions. For example, suppose the user is editing a new Publication object and starts to type in the authorship as "Linn". The PublicationSuggester sees this and checks the database for possible matches, coming up with "Linnaeus 1758". If this is the publication that the user wanted, then they can select it from the SuggestionBox without having to fill in any more information.import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Shape;
import flash.display.Sprite;
var list:Array = [];
list.push(1);
list.push("A String");
list.push(new Object());
list.push(new MovieClip());
list.push(new Shape());
list.push(new Sprite());
trace(list.join(", "));
// Output:
// 1, A String, [object Object], [object MovieClip], [object Shape], [object Sprite]
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Shape;
import flash.display.Sprite;
var list:Vector.<DisplayObject> = new Vector.<DisplayObject>();
list.push(1); // throws TypeError
list.push("A String"); // throws TypeError
list.push(new Object()); // throws TypeError
list.push(new MovieClip());
list.push(new Shape());
list.push(new Sprite());
var point3D:Vector.<Number> = new Vector.<Number>(3, true);
mx packages). Here's the link:loadCSSURL (which some programmers would prefer be rendered loadCssUrl).loadCSSURL, "[T]ry to avoid such names."draw as opposed to drawers or drawing?function foo():voidOver this:
{
if (test())
{
doSomething();
doSomethingElse();
}
else
{
doAnotherThing();
}
}
function foo():void {
if (test()) {
doSomething();
doSomethingElse();
} else {
doAnotherThing();
}
}eventNameHandler. I like the older ActionScript convention onEventName. Not only is it more succinct, but it has the added benefit of placing all your handlers together when you sort methods alphabetically.for (var i:int = 0; i < n; ++i) {
trace(i);
}...is faster than this:for (var i:int = 0; i < n; i++) {
trace(i);
}... then why on Earth would you ever use the latter? It's not like one is more readable than the other. They're equally legible, and one is faster—no contest.if blocks