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
Flip Rotator [Flash 9, AS3] (347.5 KiB, 3,575 hits)
Flip Rotator [Silverlight 2, C#] (398.3 KiB, 4,166 hits)
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);
}

September 18th, 2008 at 1:48 am
[...] Flash vs Silverlight: Flip Rotator [...]
December 19th, 2008 at 12:58 am
[...] (This sample is similar to my previous post “Flip Rotator“. You may take a look as [...]
February 12th, 2009 at 3:04 am
no comment
June 21st, 2009 at 1:21 am
[...] Flip Rotator [...]
December 6th, 2009 at 1:55 pm
Nice posts. Keep it up.
January 20th, 2010 at 4:31 pm
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?
January 6th, 2011 at 4:59 am
how can i use these sample on my .aspx page?
April 6th, 2011 at 1:26 am
Often the top practises are trivial and very easy to implement in business or even lifestyle, on the other hand occasionally issues usually are a bit more difficult and have to have qualified assistance.
May 16th, 2011 at 8:39 pm
Thank you for this put up, I’ve been at all times looking for this convenient articels all over the place but could not discover complete information provided here. thank you. and I’ll just reference some of you phrases .
June 3rd, 2011 at 11:38 pm
[...] Flash Silverlight Download [...]
August 22nd, 2011 at 6:06 am
It?s really a nice and helpful piece of information. I am glad that you simply shared this helpful info with us. Please stay us up to date like this. Thank you for sharing.