Silverlight 2 Released

Silverlight 2 has been released. This is the real silverlight release.  The release last year 1.0 was just a javascript release and only had one object, the downloader, not even a text input.  But now there are real tools like rich ui controls, services support (REST), DLR (C#, Linq, ironpython/ruby) and Sockets which are much needed for games and game platform development.

There are also much better tools at this stage:

Bam. Silverlight 2 is out. There’s the expected stuff, like the final SDK, Expression, and Silverlight tools:

And from Tim’s blog:

But there’s also Yes, that means you can code Silverlight in Eclipse. Details and progress at the Eclipse Tools for Silverlight Blog. It’ll be licensed under the EPL 1.0 License.

I have done lots of Silverlight initially when 1.0 came out as well as the agency I was working at.  We did video players, mini-games, demo apps and even the Halo 3 online manual at  But it wasn’t really ready until now.  It still has a long way to go to really be an alternative to Flash but it is capable platform at version 2 for applications, mini-games and video apps for sure. But in the end it just provides competition to make both the Flash/Flex platforms and Silveright compete for developer support.

Google Tech Talk: Simple interactive 3D modeling for all – VideoTrace

3D models from basic video… This can be huge in all sorts of ways.  For exponential growth you need to go virtual.

  • This is a technology called VideoTrace from Australia
  • The Siggraph paper describing VideoTrace is available here (pdf 6MB)
  • Larger videos available here, with a more compressed version here.

Director 11 Is Released

I was able to download the demo and it is in the store and on Adobe’s site. The new AGEIA™ PhysX™  physics engine and some sort of updated 3D with hardware rendering is nice.

But, Director is like the Rodney Dangerfield of products at Adobe.  Everywhere you have to dig for it, it doesn’t even have updated marketing in most places, the shockwave player link is still from 2002 etc.  I wish that Adobe would support it more, open it up, allow better IDEs, integrate ES4 based Actionscript 3 or 4 into it and keep the 3d market that shockwave supports moving along.

Maybe they will give Director more love but if they don’t allow for some community input and work on the platform like Flex and Flash have thrived on, well they might just lose that piece of the market (3d gaming, hardware).

First impression is the fonts do look much better.  Unicode support is so far so good and I haven’t had a chance to dig into the AEGIS PhysX engine yet but that looks very very fun.

For instance here is a Physics Engine call that creates a rigid body terrain

//JavaScript Syntax
var objTerrain= member("PhysicsWorld").createTerrain("myterrain",terrainDesc,position,orientation,1,1,1);

Or some raycasting:

//JavaScript Syntax
var lstraycast = member(“PhysicsWorld”).rayCastAll (vector(10,0,0),vector(0,0,1));
for(i = 1; i < = lstraycast.count ; i++) {   raycstEntry = lstraycast[i];   put("Name:" + raycstEntry[1].name);   put"Contact Point:" & raycstEntry[2]);   put("Contact Normal:" & raycstEntry[3]);   put("Distance:" & raycstEntry[4]); }[/sourcecode]I use the Javascript source simply because it is much more usable to me. Unfortunately the docs are only partially converted to Javascript.  Lingo is pretty close to it though but it scares people off. What Adobe needs to do is port into Flash the ability to use Shockwave3D (hardware rendering for 3d), AEGIS PhysX, would that not blow up big time or what?

Tweener AS3 extension for color properties “_brightness”, “_contrast” and “_saturation”

Jens Krause beat me to the punch. I had brightness added to Tweener AS3 and was adding contrast and saturation as needed on projects but it has already been done!

WS-Blog has added in special properties for Tweener for brightness, contrast and saturation which was the only part missing from the public version of Tweener. I am not sure of the file size with this addition (Tweener is around 9kb) but it is probably the same size with this in as brightness in my updated copy was the same. Adding special properties in Tweener is quite simple and not enormous amounts of script needed and when compressed in the swf it is very small.

There are other kits like TweenerFilterLite, Animation Package etc that do these right now but you have to wait no longer for these functions in Tweener itself which has quickly become many flash developers favorite in AS3 and since it is compatible with AS2 in the same syntax it makes animation in flash and the learning curve for that from AS2 to AS3 non existent for motion.

Jens has a sample demo, script samples and source on his blog.

The AIR iPhone Desktop Widget

merhl has created an Adobe AIR iPhone widget for using the AIR runtime that is pretty cool.  It only has some sample screens for most buttons in it but you can actually browse the web on it using the web browser and it flips sideways to show the screen flip.  Check out your website or blog on the desktop iPhone.  Get your AIR iPhone now!


merhl has made it auto updating with AIR so as he adds more functionality it will autoupdate.  That is one neat aspect of doing desktop app/widget work with flash and AS3 in AIR is that it is much more capable of syncing content and that content is usually extremely optimized for fast delivery and keeping it up to date.  Plus you can make chrome and shiny things with it.

AS3 Mouse Events and Mouse Related User Actions

Flash is great for monitoring all actions by a user from what they type to what their mouse is doing and for how long. We have many tracking systems that rely on script in Flash and HTML when not using flash that can detect user interaction with our applications. Many tracking companies also use this info for hotspot or heat maps to see what your users are messing with.

To do all this interaction logging and tracking you need mouse events. Mouse events drive games, applications, cool user controlled interfaces, expected user direction and simplify your application. Understanding all the mouse events possible is important.

Here is a list of all the events that are clearly implemented in AS3:

CLICK : String = “click” MouseEvent
Used to detect mouse clicks.

DOUBLE_CLICK : String = “doubleClick” MouseEvent
Used to detect double clicks.

MOUSE_DOWN : String = “mouseDown” MouseEvent
Checks when mouse is pressed down.

MOUSE_LEAVE : String = “mouseLeave” Event
Monitors when the mouse leaves the stage.

MOUSE_MOVE : String = “mouseMove”
Monitors when the mouse moves.

MOUSE_OUT : String = “mouseOut”
Monitors when the mouse moves out of the attached to object of the event.

MOUSE_OVER : String = “mouseOver”
Monitors when the mouse moves over the attached to object of the event.

MOUSE_UP : String = “mouseUp”
Monitors when the mouse moves up the attached to object of the event from a click.

MOUSE_WHEEL : String = “mouseWheel”
Monitors when the mouse wheel moves, detect the positive or negative delta property for distance and direction moved.

Wiring up Events in AS3 is easier than its ever been.

// attach the event listener to this object, if you want a global event outside
// the current class attach to stage.addEventListener([event],[callback])
this.addEventListener(MouseEvent.CLICK, onMouseClickEvent);

// then make the callback
public function onMouseClickEvent(event:Event)
if(event.buttonDown) // if primary button down, left mouse button
trace("left button was down");
trace("left button was not down");

What about right clicks?

Well not all mouse equipment has right click so its not always best to implement but for the ones that have right click capabilities and other buttons there is both mouse wheel and right click support in Flash mouse events.

To detect right click:

In the MouseClick event there is a buttonDown property on the event that returns true if its a left click, false if its any other mouse button. So you could have a menu drop down on a mousewheel click, right mouse click or other mouse button clicks.

Detecting right clicks or other mouse clicks is impossible in Flash AS3. I got excited and error in testing and thought the buttonDown helped to determine the button pressed but it only listens to the left click.

What about drag over and drag out?

The buttonDown property is mainly used for drag over or drag out events (which are not an actual event) but you could do something like:

function onMouseOver(event:MouseEvent):void
// mouse is down and dragged over.
function onMouseOut(event:MouseEvent):void
// mouse is down and dragged over.

To detect when the mouse leaves the screen:

Use the MouseEvent.MOUSE_LEAVE event on your main document class or a class instantiated that assigns this event to the stage. This can be used for high intensity flash sites where performance is preserved when the user is not interacting with certain elements.

More on mouse events and timers shortly. Here’s a sample from the docs:

package {
import flash.display.Sprite;

public class MouseEventExample extends Sprite {
private var size:uint = 100;
private var bgColor:uint = 0xFFCC00;

public function MouseEventExample() {
var child:ChildSprite = new ChildSprite();

import flash.display.Sprite;

class ChildSprite extends Sprite {
private var size:uint = 50;
private var overSize:uint = 60;
private var backgroundColor:uint = 0xFFCC00;
private var overColor:uint = 0xCCFF00;
private var downColor:uint = 0x00CCFF;

public function ChildSprite() {
draw(size, size, backgroundColor);
addEventListener(MouseEvent.CLICK, clickHandler);
addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);

private function draw(w:uint, h:uint, bgColor:uint):void {
graphics.drawRect(0, 0, w, h);

private function clickHandler(event:MouseEvent):void {

private function doubleClickHandler(event:MouseEvent):void {

private function mouseDownHandler(event:MouseEvent):void {
draw(overSize, overSize, downColor);

var sprite:Sprite = Sprite(;
sprite.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

private function mouseMoveHandler(event:MouseEvent):void {

private function mouseOutHandler(event:MouseEvent):void {
draw(size, size, backgroundColor);

private function mouseOverHandler(event:MouseEvent):void {
draw(overSize, overSize, overColor);

private function mouseWheelHandler(event:MouseEvent):void {
trace("mouseWheelHandler delta: " +;

private function mouseUpHandler(event:MouseEvent):void {
var sprite:Sprite = Sprite(;
sprite.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
draw(overSize, overSize, overColor);