Silverlight vs Flash: Kaleidoscope Silverlight vs Flash: Mathematical Locus
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.

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);
}

Shares and Enjoy~

Did you like this post?

Subscribe here:  

6 Responses to “Flash vs Silverlight: Flip Rotator”

  1. Silverlight Cream for September 16, 2008 -- #369 Says:

    [...] Flash vs Silverlight: Flip Rotator [...]

  2. Silverlight: 3D Image Rotator Beta using Kit3D Says:

    [...] (This sample is similar to my previous post “Flip Rotator“. You may take a look as [...]

  3. marco Says:

    no comment

  4. New Silverlight Image Rotators · News Says:

    [...] Flip Rotator [...]

  5. brenda Says:

    Nice posts. Keep it up.

  6. paul Says:

    If I wanted to substitute canvasses made with Expression Blend instead of jpgs, I would delete
    private String[] IMAGES = { “images/image1.jpg”, “images/image2.jpg”, “images/image3.jpg” };

    But I am not sure how to finish the substitution. Any suggestions?

Leave a Reply