Archive

You are currently browsing the Scott Morgan blog archives for June, 2006.

Jun

28

Flex 2 and ActionScript 3 extension for Flash 8 Released

By scott

The wait is over, Flex 2 has been released. The release includes Flex Builder 2, Flex Data Services 2, and the ColdFusion 7.0.2 update. Go and get Flex at the Flex Developer Center. In other news, as promised (almost), Adobe has released the Flash Professional 9 ActionScript 3.0 Preview. From what I understood Adobe would be releasing a full beta version of Flash 9. Instead Adobe has released an extension for Flash Professional 8 to include support for Actionscript 3.0, enabling you to take advantage of the new ActionScript virtual machine in Adobe Flash Player 9. The update is available on labs.adobe.com.

Lastly, with the full reelase of Flex 2 comes the official release of Flash Player 9. You can download this at the Flash Player Download Center. Make sure you tell everyone, lets get those penetration rates up so our clients will let us use Actionscript 3.

I am downloading all of this as we speak, stay tuned for my initial review. The download is really slow, I don’t think I am the only one downloading it right now :)

Jun

23

wmode = transparent == wtf?

By scott

I thought I’d seen it all, but this is one of the strangest. A developer on my team built a standard preloader using the MovieClipLoader class, been done a million times. Very standard stuff, using the onProgress event to position a progress bar by calculating the percentage with the bytesTotal and BytesLoaded arguments. Worked perfectly in IE on a PC. In Firefox the progress wouldn’t move past 0% unless the user moved their mouse. WTF?!?

After hundreds of traces, an old school loadMovie with an onEnterFrame or interval calculating the load progress with getBytesLoaded() and getBytesTotal() every iteration, Nothing!. Same thing everytime. 0% unless we moved the mouse and only in Firefox on a PC.

Pulling at straws, and approximately 2 minutes before our systems took a 3 story plunge, we removed the wmode=transparent attribute in the embed html tag. Voila, the problem magically disappeared. Again, in unison WTF?!?.

Why the heck would the transparency effect the preloader? I have run into issues with memory spikes when wmode is set to transparent but things always work, just a little slower. Don’t get me wrong, I rarely use wmode=transparent, but in this case the designer had something specific in mind and there was no way around it. Well guess what, we ended up convincing the designer to change the background so it would match seamlessly in html and flash. Now we don’t have to worry about this.

Has anyone else seen this? Are we on crack? Feel free to contact me if you have seen this behaviour before. Soon I will have the comments section built and you will be able to post your comments right here. Right now I am chalking this up as a bug in the Flash player for Firefox.

Jun

17

Web accessibility soon mandatory in Europe?

By scott

Just came across an interesting article. All European countries have signed a plan that could make accessible sites mandatory. One thing that I found interesting is currently 81 per cent of Web Sites in the United Kingdom are inaccessible. Imagine if 81 percent of shopping centers were inaccessible to people with special needs, would probably cause an uproar.

As developers this is something we should all be thinking about. As Flash developers it isn’t as easy to cover all accessibility needs. But there are accessibility classes that can enhance the experience for users in need.

One of the best ways is to give the user a choice. Flash is really just a presentation layer. The data should be seperated, provide the user with a valid HTML or XHTML layer that screen readers and other computer assistance devices will have no problem navigating. The XHTML layer can even be used as the data source for the Flash presentation layer. A good example of this approach can be seen here: http://codeazur.com.br/stuff/fugsp/.

The article I referenced can be read here: http://news.com.com/2100-1036_3-6084113.html?part=rss&tag=6084113&subj=news.

Jun

11

Now available in RSS 2.0

By scott

I have noticed a lot of interest in my blog. Why? I’m not quite sure. Anyway, one question I have been asked a few times, which is a few times too many, is why I don’t offer an RSS feed. Well, the day has come, http://blog.scottgmorgan.com/rss/ is now available. As you will notice in the top right of the page I have included a link to the feed. Feel free to add me to your RSS tool of choice. I have also submitted my self to MXNA, within a couple days my posts should start appearing there. Next addition to my homegrown blog is a comments section. Stay tuned, when I find the time I will add it.

Jun

8

Gradient masks do not work in 16 bit or 256 colours

By scott

Now that I think about this, it only makes sense. But it was a bit of a piss off when I first discovered this. Actually a co-worker of mine noticed it.

With Flash 8 you can finally use gradient masks. The only way to pull it off however is to use code. Here is an example:

myClip_mc.cacheAsBitmap = true;
myMask_mc.cacheAsBitmap = true;
myClip_mc.setMask(myMask_mc);

Pretty straight forward. In the example, myMask_mc would be a gradient shape drawn inside a movieclip.
In 32 bit this works great. Anything less you will see no masking, just your drawn mask shape or some other oddities like the mask flickering on and off.

Not 100% confirmed, but I’ve heard it from a few sources. This is only an issue on a PC. Gradient masks work fine on macs at all colour depths.

In order to get around this issue we are going to grab the colour depth with JavaScript (screen.colorDepth) and pass the value into the flash movie. Unfortunatly you can’t detect the colour depth with ActionScript, it is not a property of System.Capabilities. Any who, if the colour depth is lower than 32 bit I will draw/attach a hard edged mask. If the users system is running at 32 bit colour I will draw/attach a soft edged gradient masks.

At the time of writing this I haven’t implement this fix. But if you stay tuned to http://codex.ashesandsnow.org you will see it in action. For now change your colour depth settings and check out how *great* the site looks at 16 bit. Blah.

Added June 9, 2006

After thinking about this a bit more, the same effect could be accomplished by using blend modes and the bitmapData class. You could load an image into a movieclip, clone (draw method of the bitmap data class) the clip or attachBitmap if your image is in your library. Use the layer blendmode on the bitmap data, attach a gradient mask in the same movieclip that is holding the image (obviously on a higher depth) directly over the image and use the alpha blendmode on the attached gradient mask. This will accomplish the same effect and will work on systems lower than 32 bit colour.

import flash.display.BitmapData;

bmp = BitmapData.loadBitmap("imageFile");
this.createEmptyMovieClip('holder_mc', this.getNextHighestDepth());
holder_mc.blendMode = 'layer';
holder_mc.attachBitmap(bmp, holder_mc.getNextHighestDepth());
var mask = holder_mc.attachMovie('maskClip', 'mask_mc', holder_mc.getNextHighestDepth());
mask.blendMode = 'alpha';

This implementation would work on the site I mentioned above, however blend modes are very processor intensive and the gradient masks we are using are very large, therefore we are still going to use the solution I described above.

Happy masking!!