Dec 20

Finally, I have completed the 3D Image Rotator using Kit3D. If you are looking for a quick way to make a real 3D flipping rotator, this must be your choice.

Well, this time, I only got the Silverlight sample only. That’s because it really takes a lot of time to deal with 3D Graphics. I am sure I will launch the Flash demo very soon.

Images used in the application below are collected from Smashing Magazine - Christmas Wallpapers.

Demo

Source codes

Silverlight

 
(I have included a Christmas Song “Santa Claus is coming to town” inside the demo. Hope you enjoy it.)
Sep 17

This is a very simple rotator with flip effect. You may further customize it by modifying the scaleY and rotation as well.

Personally, I really like making image rotator since I always got many ideas on the transition effect. I hope I can implement as many as possible.

Vote for this sample

Flash is Better! (345 votes)
Silverlight is Better? (321 votes)

Comparison

Flash implementation: 50 minutes (Implemented First)
Silverlight implementation: 30 minutes
What’s the difference?

  • Remove Children: removeChildAt [AS3] vs Children.RemoveAt[C#]

Source codes

Flash

Silverlight

Remove Children: removeChildAt [AS3] vs Children.RemoveAt[C#]

In AS3, you have to be very carefully about null object, especially adding/removing object to the child. Otherwise, you may got into error troubles.

// AS3
// Create a triangle mask
var sprite:Sprite = new Sprite();
// ok
addChild(sprite);	

// also ok, the sprite will be added to the end of the display list
addChild(sprite); 

// will throw an error
addChild(null);	

// ok
removeChild(sprite);

// will throw an error
removeChild(sprite);	

// the best practise
if(sprite && contains(sprite){
	removeChild(spirte);
}

// remove all child
while(numChildren > 0){
	removeChildAt(0);
}

In C#, it will only throw exception for Add operation. On the other hand, the Remove function will only return a flag indicating whether the action is successful.

// C#
Rectangle rectangle = new Rectangle();

Children.Add(rectangle);

// throw an ArgumentNullException
Children.Add(rectangle);

// throw an ArgumentNullException
Children.Add(null);

// return true
Children.Remove(rectangle);

// return false
Children.Remove(null);

// remove all child
while(Children.Count > 0){
	Children.RemoveAt(0);
}