I didn’t create any entry for Mix 09 Challenge, the main reason is that I was officially invited to be the judge of MIX 09 Challenge.
Acting as judge is not easily. There are all together 105 entries and most of them are creative and interesting. It’s really a headache for me to pick up the winner.
Anyway, today I have created a 3D spiral image rotation application for all of you to navigate the entries easily. For the Flash version, you may click on the image and you will be redirected to the Entry Detail Page. This is not working for Silverlight since I have no idea how to add mouse interaction on the Kit3D Object.
Enjoy it and vote your favorite entry now!
Vote for this sample
Comparison
Flash implementation: 1 hour (Implemented First)
Silverlight implementation: 2 hours
What’s the difference?
- Loading Image [AS3] vs [C#]
Source codes
3D Spiral Image Rotation [Flash 9, AS3] (183.2 KiB, 576 hits)
3D Spiral Image Rotation [Silverlight 2, C#] (66.6 KiB, 660 hits)
Flash
Silverlight
Loading Image [AS3] vs [C#]
Loading image in Flash is simple and easy. Below is an example.
// AS3
var request : URLRequest = new URLRequest( imageURL);
var imageLoader : Loader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_complete);
imageLoader.load(request);
private function on_complete(e : Event):void{
// File downloaded successfully
var loader : LoaderInfo = e.target as LoaderInfo;
// convert it to bitmap
var bitmapData : BitmapData = new BitmapData(loader.content.width, loader.content.height);
bitmapData.draw(loader.content);
}
For Silverlight, please note that your Image must be added to the stage to trigger the download progress. Let’s see how we can achieve this.
// C# BitmapImage bitmapImage = new BitmapImage(new Uri(imagePath, UriKind.Absolute)); bitmapImage.DownloadProgress += new EventHandler(image_DownloadProgress); Image image = new Image(){ Source = bitmapImage } ; // don’t forget to add the Image Control to the stage LayoutRoot.Children.Add(image); void image_DownloadProgress(object sender, DownloadProgressEventArgs e) { if (e.Progress == 100) { // File downloaded successfully } }
