Almer/Blank Labs

ZamfBrowser 1.1

Just posted an update to ZamfBrowser.  ZamfBrowser can now generate code for use in either Flash or Flex based projects.   …read more…

Hype/Papervision3D Demo

So after getting my hands on the new Hype framework, I wanted to put together a simple demo together that utilizes a combination of the SoundAnalyzer class and some 3D eye candy (via Papervision3D).

First off, I can say that I really like being able to play around with the sound spectrum using only a couple lines of code. I also used the Rythm class to run an enter frame method, which is very convenient in that I didn't need to manually set up an event and listener.

Lastly, I wanted to also utilize a tweening engine to smooth out the particle movement, but doing so cut the framerate by about 80% (a little better with TweenMax/TweenLite, but still not good enough). I also briefly played around with the Flint particle emitter, but I'm not familiar enough with Papervision/Flint to get it working how I wanted.

UPDATE - I decided to give a tween engine one more shot, and was able to use TweenMax while keeping the framerate at an acceptable level.

UPDATE 11/06/2009 - Updated code sample to reflect demo swf.

UPDATE 3/29/2010 - It's come to my attention that Wordpress tends to be a bit moody when it comes to code formatting in posts, especially in the case of vectors (which use the greater than/less than characters). That said, I've posted a couple pastebin examples:

Link --> Document class
Link --> ApplicationView class

...read more...

Cool Features in Flash Builder 4

I was recently working on a project in the latest beta release of the forthcoming Flash Builder 4 and wanted to point out the new contextual help feature. What's nice about this feature is that I had just added the highlighted event to the event class and was busy implementing it in a view class and because of FB4's new code-hinting muscle I was able to see everything that I had documented in the event class concerning the event without having to have the event class open. This is definitely a much appreciated usability enhancement. Now, if we could just get editable code (not file) templates (think FDT, Zend Studio, etc), FB4 would be that much closer to being ready for prime time...Big grin

Organizing PureMVC Notifications

One of my favorite things about using PureMVC as my application framework are the standards established for organizing application code.  For notification names the common ways that I have seen these organized is by declaring constants on the concrete Facade, or by externalizing them to external classes.  I have tried both approaches, but my preferred method is to externalize the constants to notification classes.  Not only do I feel like its more organized because the notification names for a section of the application are centralized to different notification classes.  But, it is also a good way to clean up the amount of imports in the concrete Facade and centralize the Command registrations to these notification classes.

package com.project.controller.notifications
{
	import com.project.controller.commands.LoginCommand;
	import com.project.controller.commands.LogoutCommand;
 
	import org.puremvc.as3.interfaces.IFacade;
 
	public class LoginNotifications
	{
		static public const LOGIN:String = "LOGIN_NOTIFICATION";
 
		static public const LOGOUT:String = "LOGOUT_NOTIFICATION";
 
		public function LoginNotifications( facade:IFacade )
		{
			facade.registerCommand( LOGIN, LoginCommand );
			facade.registerCommand( LOGOUT, LogoutCommand );
		}
	}
}

Above is an example of a notification class. The constructor requires an IFacade object that it uses in the constructor to map notifications to commands using the IFacade object that is passed into the constructor. You can see how a bigger group of commands can be nicely organized into this class. Below is an example concrete Facade.

package com.project
{
	import com.project.controller.notifications.LoginNotifications;
 
	import org.puremvc.as3.patterns.facade.Facade;
 
	public class ProjectFacade extends Facade
	{
		public function ProjectFacade()
		{
			super();
		}
 
		static public function getInstance():ProjectFacade
		{
			if (!instance) instance = new ProjectFacade();
 
			return instance;
		}
 
		override protected function initializeController():void
		{
			super.initializeController();
 
			new LoginNotifications( this );
		}
	}
}

In the example above we can see the usage example for the notifications class for the login group. In the override for the initializeController() method, after initializing the controller, a LoginNotifications object is started with a reference to the IFacade instance that is the concrete facade, or simply "this". The amount of imports is reduced in the concrete facade, and there are less lines required in the initializeController() method, creating a neater, shorter concrete facade class.

This kind of organization is almost always based on personal preference, this just happens to be mine. =)

Hyped about Hype

I just came across one of the coolest AS3 toolkits I’ve seen in a long time – Hype. Basically, the point of Hype is to make UI design as easy and fast as possible. It includes commonly used algorithms used in visual and audio design such as grids, shapes, random placement, chaos patterns, and audio spectrum calculations. It’s also capable of calculations such as custom timing (run a callback every 2nd frame, etc) with minimal coding requirements, and a callback system that is much more efficient than AS3’s native Event system. Another great feature is the use of Object pooling and unordered lists. The concept of this is to minimize Object creation (thereby keeping memory requirements as small as possible) by recycling Objects rather than recreating them on the fly. This is obviously a standard best practice when designing code projects, but Hype will do the dirty work for you and let you focus on the fun stuff. From the looks of the intro video, the toolkit looks to be well-written using a combination of a core framework and an extension package (which is highly flexible and easily built upon). It looks like a minimal set is included for now, but I’m sure additional extension kits will be added along the way (plus allow developers to add/share there own). The framework is slated for release on Saturday, October 31st. Check out the video HERE, and the examples HERE. Happy coding ;)