Nobien A nerd blog about nerdy things by … nerdy guys?

1Jun/090

New work from Rokkan: Mafia II Game Site

Mafia II

2K Games and Rokkan launched the Mafia II website today. Very heavy experience with lots of HD video. Pretty cool stuff. Keep an eye out for new chapters to be rolled out in the near future. Shouts to Charles, Faisal, Errol, Bryan, Andy, Kat, Jessica and Mat for doing a great job.

10May/090

Flash on Tap (What to do in Boston)

So you're going to be in town for Flash on Tap and you're a fan of the beer. As I said in an earlier post, I will not be attending. But that doesn't mean I can't help out. Here's a list of places to eat and things to check out concerning Beer in Boston. Once I got going on it, it turned into a decent size, so if you leave Boston unhappy with the beer selections, it's your problem.

Filed under: Beer, Flash, Flex Continue reading
10May/092

No Flash on Tap for us.

Flash on Tap is coming up real soon (May 28th-30th). The speaker list looks amazing. But what matters more to me is the beer. Sadly neither Matt or I will be attending Flash on Tap, but if I was, I would be hitting up The Bruery, Stone and Lagunitas. Unfortunately, the cost of these conferences are pretty high for out-of-pocket, and it can be quite a hassle to try to get a company to pay for you. Either way... This looks to be a terrific Flash conference, and you can't go wrong with adding beer into the picture. Although watch out, Todd is an angry drunk.

That being said, Matt and I will be volunteering at the American Craft Beer Fest (June 19th/20th). This is one of (if not the) largest beer fests on the East Coast and shouldn't be missed. There's also a good chance I'll be attending the Great American Beer Fest.

Filed under: Beer, Flash, Flex 2 Comments
14Jan/0916

Type Coercion Failed of the Same Class?

So I have this issue that I just can't seem to figure out. The Flash Player keeps throwing a Type Coercion Failed error at runtime. Usually when this error pops up I have no problem figuring it out because its usually two different object types. However, in this case, this time its of the same type. It reads:

TypeError: Error #1034: Type Coercion failed: cannot convert super.secret.package::BeverageAsset@2f2b96a1 to super.secret.package.BeverageAsset.

Odd, right? Ok, so now let me explain the structure a bit. At the top level is app.swf. This SWF does not include the BeverageAsset class compiled into it. This SWF manages the loading and unloading of other SWF files that represent sections. One of these sections is recipes.swf. This SWF is loaded into app.swf and is the first SWF to have BeverageAsset compiled into it. This SWF also loads various SWF display assets in order to function properly. One of these SWF's is beverage01.swf. These assets are of type BeverageAsset. This class is used as the document class for each display asset which also has two movie clips on the stage.

So, when I compile recipes.swf and it runs standalone there is no type coercion failure. I only get the error when recipes.swf is loaded and run within app.swf. Now in my experience, I thought all child SWF's loaded into an app, unless explicitly told not to, would use app.swf's application domain unless a class does not exist yet. So once recipes.swf is loaded into app.swf, since BeverageAsset is compiled into recipes.swf, it would be added to the application domain. Thus, once beverage01.swf is loaded into recipes.swf the BeverageAsset class will already be in the application domain and that one will be used.

I mean, am I totally wrong? I'm totally baffled. Any help would be greatly appreciated.

UPDATE!

Thanks Steven, for pointing me in the right direction. My assumptions about the applicationDomain for any loaded SWF was entirely wrong. I really have no idea why I assumed everything was added to the system domain as SWF's are loaded into the app. So what I have done now is define the application domain of any Loader object's context.

var context:LoaderContext = new LoaderContext( false, ApplicationDomain.currentDomain );
loader.loader( request, context );

This has eliminated any type coercion errors when loading SWF's and has allowed me to refer to them as a strongly type object. Thanks again Steven. And, man, I really need a new code formatter.

17Nov/083

Just One of My Favorite Flash Tools: swffit

I just have to mention this really quickly. When working on tridentgum.com I was introduced to, what I thought might be, a little known JavaScript tool for Flash proejcts. We had to give the site a minimum height and width in the browser but still go 100% if the screen is larger than the minimum size. Something I've done before but just not so easily. At any rate, the lead developer at the other agency we were working with discovered swffit. It makes doing this sort of thing ridiculously easy. In most of my cases, I just need a minimum width and height, which is usually the width and height of my FLA's. Otherwise, the site can stretch to the size of the browser.

I recommend swffit to everyone!

Filed under: Flash, JavaScript 3 Comments
13Nov/082

Free ActionScript! AbstractButton

As many of you might know, when you're doing Flash everyday for a job, you find yourself doing a lot of the same things over and over. Such things include building a navigation system, a video player, a form, etc. At some point you say to yourself, there's got to be a way to improve my productivity with this. If I remember correctly, the first time I asked myself this I had no idea where to start. But, a couple days later it finally hit me. Probably the most common task I have when building flash content is making buttons.

Now, the kinds of designs I'm usually provided with at work are usually pretty graphic and the designers like fancy rollovers that the SimpleButton class just can't provide. Because of this I often use MovieClips as buttons and place assets within that MovieClip to animate and/or modify. So what I end up doing is creating MovieClips in the IDE and attaching a class to that MovieClip. Pretty standard.

So then I started to think, how can I make a class that is sorta like SimpleButton but gives me the flexibility I need for my "fancy" rollovers? Now, I'm no OOP wizard by any means, but it was then that I stumbled across what are called Abstract classes. Abstract classes are meant only to be extended and provide a code base for your more specific class. So It made sense to me to create an AbstractButton class that is always meant to be extended and would contain basic button functionality but remain ingorant to any animation or child objects needed for any effects.

I started experimenting and analyzing most of my previously made button classes and started to see some patterns in the basic button functionality. In the end I discovered my most used events and most used methods and added them to my AbstractButton class. I'm pretty happy with this class and it makes making buttons so much faster than it ever did before, especially with ActionScript 3. All I have to do now is create a class, extend AbstractButton and, in most cases, just override the onRollOver and onRollOut functions. Depending if the button is part of a nav system, I'll override the select() and deselect() methods as well. If the button just simply links to a URL, all I have to do is override the onClick method and add a navigateToUrl() call.

So in hopes of helping others, I'd like to share my class with all of you. I would certainly love to hear any comments, suggestions, or questions regarding the class.

Download the AbstractButton class.