BKWLD

Archive for November, 2007

IE6 is bugalicious with AS3

By Max on November 29, 2007 at 10:52 pm

After recently launching a flash site developed in AS3, a stupid, stupid bug appeared that caused a slight amount of brain trauma. In InternetExplorer 6 the site loaded, and worked fine. But when you would navigate elsewhere and come back to the site, everything was all screwy. The alignment was off and the site wouldn’t initialize. Clear your cache, reload and everything was perfect. So, obviously its a cache problem, and it only occurred in IE6.

Here’s how I had my project set up:

index.fla contained all the site library instances and all instances were set for export, but not on the first frame. The second frame of index.fla contained all the instances placed on the stage and the third frame was blank. MainController.as was set as the document class for index.fla. MainController.as was set up to load the site somewhat like this:

public function MainController():void {
         this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
         this.loaderInfo.addEventListener(Even.COMPLETE, onLoadComplete);
}

private function onLoadProgress(event:ProgressEvent):void {
         var bLoaded:Number = this.loaderInfo.bytesLoaded;
}

private function onLoadComplete(event:ProgressEvent):void {
        this.gotoAndStop(3);
        //load and initialize your shell file here
}

Eventually I ran across this post: http://pixelfumes.blogspot.com/2007/07/ie6-as3-preloader-events-failing.html

So what was happening is that the progess event and complete event would never fire for the load of the site once the site was cached in IE6. Also, my alignment of objects that were added to the stage before the load, like the site loader instance, were not properly aligned because I was positioning them based on stage.stageWidth/2 and stage.stageHeight/2, and for some odd reason, after being cached, in IE6 it wasn’t able to access the stage properties.

So here is a good work around. index.swf loads a new swf file, main.swf, which contains all the library instances set for export on the first frame, and initializes the site. So, index.fla contains just the instances for loading, like your loader graphics, and has a document class, maybe called MainLoader.as. MainLoader.as (index.swf’s doument class) loads main.swf. main.fla has a document class called MainController.as. MainController.as initializes your site.

There are three great advantages to this method. First, no IE6 bugs. This bug will most likely never go away, Microsoft sure as hell isn’t going to be doing anything about it, and why would Adobe want to target their application for IE6? SECOND, all your classes will be initialized in the MainController.as. So, not only will MainLoader.as load all the library instances set for export in main.fla, but it will also load all the class files for your site. BOOYAH! THIRD, no timeline, at all. It’s use was minimal with the original method, just adding 3 frames, but with this one there is no need to touch the timeline.

Sure, its a pain to have two fla’s and two document classes, but this method is the best that I have come across since it loads both the library and classes. The only other workaround would be to start a global anti-IE6 campaign. Which I am honestly thinking about doing.

Alpha Transparency vs Index Transparency For 8-bit PNGs

By Mark on November 28, 2007 at 10:22 am

The portable network graphic (PNG) is my favorite image format for the web. Its lossless compression can be beautiful for photographs with crisp details (although considerably larger than using jpeg compression), and it’s ability to pull double duty with an indexed color pallet make it super versatile. And of course there’s its ability to display graded transparency.

Its popularity has suffered for a long time, due to Microsoft’s decision to not correctly support the transparency feature in the true color versions of the format in their

Smarty

By Robert on November 27, 2007 at 9:13 am

I had started out building a new php project to have blocks of html code within class files that would do find and replace on the html, adding dynamic code where I had written special tags. Essentially, I had templates and PHP logic that powered them. In the course of researching something for this, I came across Smarty Templates. I’ve switched over to using this system to power the interaction between templates and logic on this project and I think I’ll be using it more in the future. It’s pretty dope. Fundamentally it defines special tags you instert into html and has a special class with methods designed to populate these tags. Here’s a little overview of some of the reasons I’ve decided to use them:

Reasons for Smarty:

  • Compiling of templates so that str_replace lag is removed (read: speed)
  • Caching of pages. This would be a way to reduce the amount of queries that are run (read: speed)
  • Full seperation between logic and code. The logic could be only in the engine while the templates follow the master, theme, client route.
  • Should allow custom templates to be a lot easier to make for noobs and may actually encourage more customization
  • Was created in like 2002 and continues to be updated even in the last week
  • Works in conjunction with popular php accelerators
  • Developed in part by php team

Some links I was looking at while researching it:

Anyway, it’s a cool system.

Flash Equalizer, Easy Peasy.

By Max on November 24, 2007 at 4:59 pm

So, my thanksgiving break consisted of 4 days of leftovers and HBO On Demand. I also decided to make this nice little thingy. I have been talking about the new SoundMixer class introduced in AS3 for some time now, but I never utilized it. Well, I decided to create an equalizer using the new SoundMixer, Graphics and ByteArray classes introduced in AS3. It’s not too hard and can be implemented in soooo many ways.
http://www.maxrox.com/expirements/equalizer/
Source Code

Taking it one step further, I decided to include a little papervision3d magic. The result ended up looking very cool. It didn’t require an insane amount of code and runs fairly smooth.
http://www.maxrox.com/expirements/3dequalizer/
Source Code

Remove SVN files with automator

By Ben on November 21, 2007 at 12:07 pm

We’ve been using subversion pretty extensively recently and loving the idea of it (though it is rather finicky). When reusing files for multiple projects, often you’ll want to just copy and paste folders and files right into another project. This poses a problem when using subversion because if the folder already contains .svn files, you won’t be able to add it to another repository. So, you first must delete those files. This is the command line script we’ve been using to remove them (recursively from the directory you are currently in):

find . -name .svn -print0 | xargs -0 rm -rf

It’s a pain having to open terminal though, so here’s a nice way of accomplishing the same result using Automator:

You can find all of these actions under “Applications” in the Automator Library. Starting with (1) Ask for confirmation, we prompt the user to make sure they want to continue. (2) Gets a list of selected finder items [if you had a group of directories selected, it makes a list of those]. At (3), the script we were using before is run on each item (removing the “.svn” file in each directory):

for f in "$@"
do
	find "$f" -name .svn -print0 | xargs -0 rm -rf
	echo "$f"
done

Then at (4) it outputs the list of items cleared to a text file on the desktop. When compiling to a plug-in (explained further down) I have this “disabled” so I don’t get that textfile every time. Perhaps you could do something like output the results to the console.

You can then go to File > Save As Plugin… Save the file (I called it “ClearSVN”) as a Plug-in for: Finder. This enables you to right click a directory, go to Automator… and select “ClearSVN” which would clear the .svn files inside that directory!

NOTE that this is for OS Tiger. In Leopard, the actions seem to be slightly different, but could be updated to work the same way.

Download source

Firefox 3 Beta Available

By Mark on November 21, 2007 at 11:06 am

In my pre-thanksgiving-lunch blitz, it completely slipped past me that Mozilla release the first public beta of Firefox 3.

Get it.

Flash player crashes browser when closing window (possible fix)

By Ben on November 21, 2007 at 9:29 am

Working with ActionScript 3, we’re finding plenty of bugs that others have found and have experienced some intermittent crashing due to garbage fonts, but yesterday we had a doosy that lasted all day. The site was running fine and frame-rates were great, but we could pretty consistently crash (or at best get a spinning color wheel on ) any browser (safari, firefox, ie 6 + 7, mac, windows) when you closed the window containing the flash movie (closing the browser window with a hot key or clicking the close button). We started by removing all our code; first papervision code, then removing the content that was being displayed, then all embedded fonts … it was pretty stripped down. It was not until the content was removed that the browser crashes subsided. So, we started googling the hell out of “flash player 9 crashes closing window” and randomly came across this post where user nikonratm noted the following:

Tweening the position of a TextField that has a mask, as soon as I close the movie window the program crashes, whether it be in the Flash (CS3) IDE or in a browser.

This was the first instance we had found where the crash was specific to closing the window. So, we went through and removed all masking and no crashes. We then added each mask back and tested and got to a point where we slimmed down the crash culprit as a directly masked text field that had a TextFormat applied to it (also it had embedded fonts, not sure if that had anything to do with it), i.e. a TextField that had a mask applied to it and not a DisplayObject containing a text field with a mask appled to the DisplayObject. You always had to put text inside MovieClips to dynamically mask in AS2 so it seems that either the implementation is faulty in AS3 or just moving or changing the text after it has been masked causes some kind of memory leak (which causes the browser to crash on close). Something like this:


var titleMasked:TextField = new TextField();
titleMasked.mask = gradient;

Perhaps a fix would be to put the text inside a sprite (at this point, I’ve spent so much time I’m not bothering to test it):


var titleSprite:Sprite = new Sprite;
var titleMasked:TextField = new TextField();
titleSprite.addChild(titleMasked);
titleSprite.mask = gradient;

To fix some of these issues, Adobe seems to think downgrading to flash player 8 is a good idea. Should we also go back to AS2 while this is resolved? I’m ready to after yesterday. Their solutions to bugs leave something to be desired. For example, one of their comments regarded the Loader classe’s inability to close streams when uploaded:

You cannot expect an “unloaded” movie to close its net streams automatically.

Well, it may not close the stream automatically, but if you create method called “unload,” I’m going to have the expectation that it’ll unload something. Perhaps there’s an undocumented unloadAndCloseStreamAutomatically.

Gamertags

By Dan on November 20, 2007 at 12:35 pm

So I thought I would do a bit of nerdery here and put my Xbox Live gamertag:

Don’t let my score fool ya, I’ve been playing games for ages, all the way back to pre-windows CGA Dos crap. I urge my other fellow Buk heads to post theirs, and if anyone wants to add us, please do!

The gamertag was a stroke of genius on Xbox’s part. Being able to easily show friends and the world what I have played, how thoroughly I played the game, who my friends are, etc. adds a level of ‘bragging’ and fun that I didn’t expect I would be so amped on.

And the coolest thing is when you’re playing the game, when you do something that’s ‘achievement’ worthy, you get a little pop-up that tells you that you’ve gained some points, and your gamerscore goes up. I love that shit! When I see it happen, especially when I am not expecting it, it’s such a pleasant surprise. All gamers talk shit, and love to rub their accomplishments in each others’ faces. Now there is tangible proof of said ass-kickery, and it rocks.

Another ‘trophy’ of sorts one can spread with their friends is the amazing system that Halo has built into their site & game. It’s a genius move of a game developer spending tons of time and resources tying their game into their site, with actual things people want to use. I’m going to post about that soon, and show some great shots of Robert, Ben and I blowing each other up in game, at super hi-res. –DAN

Back to my Mac, iChat work around

By Greg on November 17, 2007 at 1:37 pm

BTMM

Melvin Rivera posted a great work around to get “Back To My Mac” style remote acceptability to your various Leopard Macs. This is directed at non-.Mac users, however .Mac user like my self and Robert who have yet to actually get BTMM to work can take advantage as well. I have been using this method for a few days and it works like a charm!

Follow the directions and you should be in business, And don’t skip the privacy step… that could potentially end badly!

What you will need:

Ten New Things in WebKit 3

By Mark on November 15, 2007 at 9:12 am

Macie J outlines ten cool new features in the latest Safari release. This is the version of Safari that ships with Leopard, and is included with the Tiger 10.4.11 software update. One of the biggest highlights for me is full support of the TinyMCE rich text editor.

There’s also quite a bit of other super advanced stuff, like SVG, CSS3 support and the new web inspector. Stuff we’ve been enjoying for a while in the WebKit nightly is finally in the real world. Good stuff.

Next Page »