Later Refactored
May 4th, 2008The infamous Later class has been refactored! foomonger.googlecode.com
… stop pretending you don’t care. Just kidding, I’ll pay you to care. More news by category Topic -: Tramadol hydrochloride tablets Safety of phentermine Pyridium Generic viagra cialis Cialis generic india Posted in foomonger | Comments Off
Code Conventions
August 3rd, 2007I always wondered why people use the conventions they use. A lot of people seem to just do things out of habit and/or because it’s how they learned by seeing some random person’s code.
I personally try to follow the Java conventions.
One great thing is that it actually gives some reasons for conventions. e.g. “Note that a blank space should not be used between a method name and its opening parenthesis. This helps to distinguish keywords from method calls.”
Flex 2.0.1 patch for Flash CS3 Professional compatibility
July 17th, 2007The project: AS3 using Flex Builder 2 (sans Flex framework)
The problem: I attempt to add SWC files to the project, but for each one Flex Builder tells me “unable to load SWC …”
The solution: Update Flex http://www.adobe.com/go/kb401493
One SWC was FLVPlaybackAS3.swc, and the other was a 3rd party SWC. Apparently SWCs created in Flash CS3 are different than ones created in Flex Builder 2. You’d think that an AS3 SWC is an AS3 SWC. But I guess not. Flex Builder 2 didn’t know how to handle the files and craps out. The same situation occurs for command line compiling using mxmlc. To update, you just replace a few jar files.
Google Code
July 8th, 2007The Foomonger ActionScript Package is now hosted on Google Code.
http://code.google.com/p/foomonger/
From there you’ll be able to get the source via zip file(s) and svn.
In addition to the wiki, there’s now an email group to help support the package:
http://groups.google.com/group/foomonger-actionscript-package
This blog will be more “news” and “updates” and less “documentation”.
Schematic
June 27th, 2007After 11 months, I’ve left BEAM to join Schematic as a senior developer.
As I pick up Flex and more AS3, I’ll have to see if the foomonger package can still cut the mustard.
LoadWatcher and Changing Total Bytes
June 5th, 2007LoadWatcher now handles situations where the bytes totals might change. e.g. When a server has gzip compression on or if XML is dynamically generated and incrementally flushed, then the bytes total will increase. The loaded bytes will then always equal the total bytes tricking the LoadWatcher into thinking it’s complete. So it checks to see if the total bytes changes.
Note:
as2_0.5.1 and as2_0.3.4 have this change.
as2_0.5.1 uses the new Later.exec() with grouping.
as2_0.3.4 uses the original Later.exec().
On that note, I’ll need create a more organized change log and actual class descriptions.
Package Update
June 2nd, 2007With suggestions by Carlos Lunetta, I’ve added some useful updates:
com.foomonger.utils.Later
-
Later.set(obj , prop, value, duration, useSeconds, group):Object
Set the given property with the given value after a given amount of time.
Example:
import com.foomonger.utils.Later;
function traceBar():Void {
trace(”bar: ” + bar);
}
var bar:Number = 100;
trace(”bar: ” + bar); // outputs “bar: 100″
Later.set(this, “bar”, 50, 5, false, 0); // sets this.bar to 50 after 5 frames
Later.exec(this, traceBar, 10, false, 0); // outputs “bar: 50″
com.foomonger.utils.LoadWatcher
-
New event, LOAD_COMPLETE_INIT:
Dispatched 1 frame after everything is loaded to make sure any loaded swf’s are initialized.
-
Additional properties added to the LOAD_PROGRESS event:
percentLoaded: Percentage (0 -> 1) of the bytes loaded.
activePercentLoaded: Percentage (0 -> 1) of the bytes loaded, taking into account the objects whose getBytesTotal() is a valid number > 0.
“activePercentLoaded” is particularly useful when watching the loads of more files than the browser can handle at time. If you use “percentLoaded”, the value can drop since the bytesTotal can change.
Notes:
as3_0.2.0 has the updates to the Later class. That is the only class in AS3 so far. Warning, this hasn’t been tested yet since my Flash 9 trial ran out. Boo.
as2_0.5.0 and as2_0.3.3 both have the Later and LoadWatcher updates. 0.3.3 just uses the non-grouped version of the Later class.
Later in AS3
April 27th, 2007With my hands on a Flash CS3 trial, I’ve created an AS3 version of the Later class.
Source:
I’ve also updated the AS2 version, and now both versions have grouping functionality. So you can now assign a group number to a Later call and abort/finish them by groups.
Note that the method has changed slightly.
Example:
Later.exec(this, foo, 1, true, 0, “bar”);
arg 1 (this) = Object where the function lives.
arg 2 (foo) = Function to call.
arg 3 (1) = Number of frames or milliseconds after which to call the given function.
arg 4 (true) = true = seconds, false = frames
arg 5 (0) = Group number to assign to the call. Default = 0.
arg 6+ (”bar”) = Array of arguments to pass to the given function.
The 5th argument is a uint that assigns a group to the Later object.
Use Later.getUniqueGroup() to ensure unique group numbers.
function foo(bar:String):Void {
trace(”foo = ” + bar);
}
var myGroup:uint = Later.getUniqueGroup();
Later.exec(this, foo, 12, false, myGroup, “hello world”);
Later.exec(this, foo, 13, false, myGroup, “hello world”);
Later.exec(this, foo, 14, false, 0, “hello moon”);
Later.abortGroup(myGroup);
This traces out only “hello moon”.
foomonger as2 package updated
March 24th, 2007I’ve made a few tweaks and added a couple more classes:
-
com.foomonger.utils.DepthUtils
Just one function: orderDepths()
-
com.foomonger.utils.Later
Static class used to call functions after a given amount of time.
-
com.foomonger.utils.LoadWatcher (new)
Watches the consolidated loading progress of the given objects.
-
com.foomonger.utils.LoopEnterFrame (new)
Static class used to run loops over frames to spread out processing.
-
com.foomonger.utils.MouseBlocker
Simple little class that creates a box that blocks mouse events.