Here is another 3D application without using any 3D Library. You may navigate the application via a mouse click or mouse wheel. A spring effect is also applied. Let’s see how brilliant it is!
It included both Flash and Silverlight version with complete source codes.
My Recent Updates
Today, I was asked to convert an application, written by me in Silverlight Beta 1, to Silverlight Beta 2. I am so amazed that the project created in Beta 1 can’t be opened in Visual Studio (with the latest Silverlight Beta 2 Tool).
OK, that’s fine. I try to create a new project and copy and paste the files one by one. However, things didn’t go smoothly. Most of the Controls I created before can’t be reused again due to some syntax problem, double/int problem and some Initialization problems. Actually, I really want to say some swear words to Silverlight at that time. (Just imagine that you can’t open a Flash 8 FLA by Flash 9.)
But may be I can think in another way. Because Silverlight is such a lovely Software, it makes me the only one that can master it a little bit better than my colleague. HaHa.
If you have the same experience as me, please feel free to share with me. (Or even tell me if is there any effective way to convert Beta 1 to Beta 2.)
Comparison
Flash implementation: 1 hour 30 minutes
Silverlight implementation: 30 minutes
What’s the difference?
- Mouse Wheel Event: MouseEvent.MOUSE_WHEEL[AS3] vs Native Method [C#]
- Image Rendering
Source codes
3D Image Navigation [Flash 9, AS3] (184.4 KiB, 2,725 hits)
3D Image Navigation [Silverlight 2, C#] (448.8 KiB, 2,886 hits)
Flash
Silverlight
Mouse Wheel Event: MouseEvent.MOUSE_WHEEL[AS3] vs Native Method [C#]
Actually, there is nothing special to attach a mouse wheel event in AS3.
// AS3 stage.addEventListener(MouseEvent.MOUSE_WHEEL, on_mouse_wheel);
However, you will be amazed that Silverlight doesn’t support Mouse Wheel Event. Well, we can bear in mind that Silverlight is keep improving. Anyway, after referring to the article http://silverlight.net/blogs/msnow/archive/2008/07/29/tip-of-the-day-23-how-to-capture-the-mouse-wheel-event.aspx. I found a work around in solving this problem.
It’s very simple (but not too beautiful), just too ask the browser to capture the mouse event and handle it in our code. Since different browsers may return different parameters, you have to check everything carefully. Well, don’t think too much, just copy and paste will be ok.
// C#
HtmlPage.Window.AttachEvent("DOMMouseScroll", OnMouseWheel);
HtmlPage.Window.AttachEvent("onmousewheel", OnMouseWheel);
HtmlPage.Document.AttachEvent("onmousewheel", OnMouseWheel);
private void OnMouseWheel(object sender, HtmlEventArgs args){
double mouseDelta = 0;
ScriptObject e = args.EventObject;
// Mozilla and Safari
if (e.GetProperty("detail") != null)
{
mouseDelta = ((double)e.GetProperty("detail"));
}
// IE and Opera
else if (e.GetProperty("wheelDelta") != null)
mouseDelta = ((double)e.GetProperty("wheelDelta"));
mouseDelta = Math.Sign(mouseDelta);
}
Image Rendering
The images used in the example below are resize 2 times to it’s original scale. It’s very clear that Silverlight performs better than Flash in resizing images.
In previous article, it was discussed that there is an "Allow Smoothing" in Flash 9 than can help to produce a better rendering. However, this function cannot be applied to dynamically loaded image, which is quite useless since most of the time we need to load images from Internet.
Note: Thanks for Sasha Dzeletovic’s suggestion. Actually there is a "smoothing" property for bitmap image which can enhance the smoothness for the dynamically loaded image. (Original Post: Enable Smoothing on Images for scaling in Flex 2)

September 3rd, 2008 at 4:54 am
Hello,
Nice post and a nice test! I just wanted to point out that there is a solution for smoothing a dynamically loaded image in Flash CS3 / Flex 2&3.
You can find the details in this post (check out the comments for various implementations including dynamic):
http://weblogs.macromedia.com/mc/archives/2006/09/enable_smoothin.html
September 3rd, 2008 at 12:01 pm
Thanks for your suggestion. That’s really easy and it’s my mistake to overlook that.
I have added your suggtion at the end of the post.
September 3rd, 2008 at 5:16 pm
These comparisions you are doing are great!!!!!
September 4th, 2008 at 6:14 am
Hi Martin;
I downloaded the source for SL for th, but the code is not for this article. It is for rotating logos.
Is this a misplaced source?
Thanks!
..Ben
September 4th, 2008 at 2:18 pm
OH, yes, sorry for the mistake. I have uploaded the wrong files and they are now corrected. You may download it again.
September 7th, 2008 at 9:55 pm
[...] are done in each respective technology. Terence starts with a concept/question to himself (i.e., 3D image navigation) and then goes about creating that sample in both Flash and Silverlight…with the goal of an same [...]
September 8th, 2008 at 9:52 am
[...] done in each respective technology. Terence starts with a concept/question to himself (i.e., 3D image navigation) and then goes about creating that sample in both Flash and Silverlight…with the goal of an same [...]
September 8th, 2008 at 3:12 pm
hey, well done!
September 19th, 2008 at 4:59 am
I’d like to point out that mouse wheel support is not supported for Flash on Mac OS X. You can find a solution here: http://hasseg.org/blog/?p=138.
Keep up the great work on these Flash vs Silverlight posts!
September 23rd, 2008 at 2:48 am
[...] are done in each respective technology. Terence starts with a concept/question to himself (i.e., 3D image navigation) and then goes about creating that sample in both Flash and Silverlight…with the goal of an same [...]
September 25th, 2008 at 8:25 pm
Great job. Keep up the great work. A great resource for Flash/Silverlight creative designers and developers.
September 26th, 2008 at 1:45 am
The Image Navigation flash example is scrolling 2 itens with the mouseWheel
October 6th, 2008 at 9:12 am
Wow! Super example. Excellent stuff.
October 29th, 2008 at 5:14 am
Greets! Really interesting. keep working! Tnx! Saw!
November 2nd, 2008 at 12:59 am
I think Silverlight is much better then Flash.I choose Silverlight.:))
December 26th, 2008 at 6:15 pm
it navigates one by one . not to navigate three slides before
January 25th, 2009 at 1:35 am
Great sample!
We use it for our adult search engine made with silverlight :)
best regards
March 30th, 2009 at 7:05 am
You are a wonderful human being.
July 14th, 2010 at 2:42 am
[...] Flash Silverlight Download [...]