Sep 22
This is another sample extracted from my previous project. When you mouse over on the application, a lot of attractive and colourful fireworks will be produced.
Vote for this sample
Flash is Better! (370 votes)
Silverlight is Better? (286 votes)
Comparison
Flash implementation: 20 minutes
Silverlight implementation: 30 minutes (Implemented First)
What’s the difference?
- Remove item from Array: Array.splice [AS3] vs List.Remove [C#]
Source codes
Colorful Fireworks [Flash 9, AS3] (193 KiB, 1,727 hits)
Colorful Fireworks [Silverlight 2, C#] (20 KiB, 1,349 hits)
Flash
Silverlight
Remove item from Array: Array.splice [AS3] vs List.Remove [C#]
In AS3, you can’t remove an item directly from an Array. You have to find out the index of the item first, before you can take the remove action.
// AS3 var array:Array = new Array(); var item:Object; array.push(item); var index:int = array.indexOf(item); // remove 1 element starting from index array.splice(index, 1);
While in C#, by using the List Class, manipulation of item is very simple.
// C# Listarray = new List(); Object obj = new Object(); array.Add(obj); array.Remove(obj);