as3: May 2008 Archives

freddy.jpg

We here at squidder have a love/hate relationship with scrollbars. Partly because, while seemingly simple, they can overly complicated very quickly. 

So when we wrote our latest scrollbar class, we decided to try out scrollRect. Seemed pretty strait-forward -- just pass in a rectangle and it takes care of all the masking, offset and everything. Way more efficient than setting a mask and then moving that about... or so we thought. (cue dramatic crescendo)

SWFAddress plus mod_rewrite = SEO bliss

seo.jpg

We at squidder often talk about the best way to bring SEO and accessibility to our flash work. And in many ways, the work is simple when you add in fancy tools like SWFObject -- just spit out the content you want to appear to a search engine in the div that gets overwritten!

But what if you've got an extremely complex site, with many sections, pages and drill downs that you want to make accessible? One option is to simply spit out all the content, no matter how long, into that same div. Yes, that will get indexed by search engines, but not only does it make the page you're loading very large, it also doesn't link users directly to the content they searched for.

That's where SWFAddress and mod_rewrite come in. Full deets after the jump.

Dictionary + Timer = Delicious

I encountered a problem yesterday in attempting to instantiate many (5-30 ish) timer objects while needing to provide each with a unique parameter.  The ez solution?  Create a dictionary object with whatever arguments you need to pass to your timer.  Then add your timer to the dictionary.  Once your timer is up, simply look up the dictionary definition for your timer event's target.  Here we go:

private var dictionary : Dictionary = new Dictionary();


private function yourFunction(x:Number : void {

var timer:Timer = new Timer(500,1);

dictionary[timer] = x;

timer.start();

timer.addEventListener(TimerEvent.TIMER, callBack);

}


private function callBack(e:Event) : void {

trace("!! my parameter = "dictionary[e.target]);

}


AS3 and Flash you'll lose your ink over.