AARON SMITH’S CODE ENDEAVOR

Guttershark Updates

It’s been a while since I’ve made any significant updates to guttershark - I’ve got some in the pipeline.

The most significant problem with guttershark has been that it’s really hard to create more than one guttershark application. Loading them in the same swf was not straightforward because of the Model class being a singleton.

I’ve also taken out the DocumentController and replaced it with an App class that is somewhat similar, but simplified.

Here’s an example of how you create a document class with these updates:

package
{
	import gs.core.*;
	import gs.display.*;
	import gs.support.events.*;
 
	public class Main extends CoreSprite
	{
 
		override protected function initApp():void
		{
			app=new App("default",stage,utils.player.getFlashvars(this,flashvarsForStandalone));
			app.addEventListener(AppEvent.MODEL_LOADED,onModelReady);
			app.loadModel(app.flashvars.model);
		}
 
		protected function flashvarsForStandalone():Object
		{
			return {model:"model.xml"};
		}
 
		private function onModelReady(e:AppEvent):void
		{
			app.removeEventListener(AppEvent.MODEL_LOADED,onModelReady);
			//everything's ready to kick off the site
		}
	}
}

Here are the new GS docs.

There are only a few classes that you should look through; which should indicate the changes coming.

  • gs.core.App
  • gs.display.CoreClip
  • gs.display.CoreSprite

I also changed guttershark to use a newer release of TweenMax (the com.greensock package).

I’m waiting to commit the new version until I get the examples in the repo updated - I’m about half way through. Until then, here’s a zip file of the new version that you can snoop through.

  

2 Comments so far

  1. fireball70 February 2nd, 2010 7:17 am

    Great library…
    Can you check the tool tip manager class… The class is not a singleton and no method gi()…

  2. admin February 2nd, 2010 10:48 am

    @fireball, yeah it’s actually that way on purpose. checkout gs.core.App.tooltips. It’s not a singleton because you may need more than one ToolTipManager, which would require different display objects as the tool tip container.
    -Aaron

Leave a reply