When it comes to Image Manipulation, Flash and Silverlight has much more advantages over Javascript and DHTML. In this example, when you click on the image, it will produce an amazing sponge effect. What’s more? Just to use your imagination!
It included both Flash and Silverlight version with complete source codes.
Comparison
Flash implementation: 45 minutes
Silverlight implementation: 30 minutes
Code variation in the source code:
- rotation [AS3] vs RotateTransform [C#]
Source codes
Sponge Image [Flash 9, AS3] (42.6 KiB, 1,631 hits)
Sponge Image [Silverlight 2, C#] (128.1 KiB, 2,340 hits)
Flash
Silverlight
rotation [AS3] vs RotateTransform [C#]
When rotating an object in AS3, it’s really straight forward.
// AS3 displayObject.rotation = 180; // the value can be set between 0 and 360
What about in C#? It will take 3 lines. Anyway, it can’t be considered as verbose. But when you look in to the case in XAML, you may find a hard time in modifing the XML manually (Especially for me since I am not yet an Silverlight Expert).
// C# RotateTransform r = new RotateTransform(); r.Angle = 180; // the value can be set between 0 and 360 DisplayObject.RenderTransform = r; // Setting the angle in XAML //

September 2nd, 2008 at 8:36 am
So Silverlight produced a file three times the size of Flash? 128kb vs 43kb? That’s important to know when trying to choose a tool to develop on. What’s the pro and cons when it comes to DHTML vs Flash or Flex?
September 2nd, 2008 at 8:03 pm
or JavaFX :D
September 2nd, 2008 at 9:23 pm
Le, thanks for your question. Firstly, the size in of the image is 16.1KB. In the Zip of Flash, since it inclued the FLA and swf, hence 43KB is make sense.
However, in the case of Silverlight, the debug folder will out 3 files SpongeImage.xap, SpongeImage.pdf and SpongeImage.dll. (Actually only SpongeImage.xap is needed for the application to be shown in the website). I think other files are used for debug purpose and hence the file size is larger.
Anyway, as far as I know, most of the time, the filesize of the Silverlight applicatoin is larger than that of Flash
Secondly, about the pros and cons. I think I can’t go to deep here (since I don’t have enough much information to compare them). But one can’t argue that the image rendering speed of Flash and Silverlight is much faster than DHTML.
September 18th, 2008 at 4:51 pm
RotateTransform r = new RotateTransform();
r.Angle = 180;
DisplayObject.RenderTransform = r;
Can be replaced with:
DisplayObject.RenderTransform = new RotateTransform() { Angle = 180 };
October 2nd, 2008 at 11:39 pm
Hi,
First thanks for this blog, which is really interesting and a great value for beginners with Silverlight technology. I actually referenced your site in my book Silverlight 2 Unleashed which will be published this month.
Please note that of all the files you include in your Zip file, only the XAP file (as well as possibly resources such as images or videos) need to be deployed to the web server. All the other files are source code only and only needed to work on the application for example in Visual Studio or Blend.
This is important to underline, because people have the impression that they need to deploy all these files to their server, and that they will be passed to the web client, but they don’t. The XAP file contains everything that is needed.
For what it’s worth, and without wanting to self-promote in an obnoxious way, my book was specifically written to help beginners in .NET and/or Silverlight to start gradually and to understand what files are created, how the tools work, what to deploy, etc… I would be very interested in collaborating with you on some level. I bring a large experience as .NET developer, and I have a good experience in collaborating with designers, based on my works in Windows Presentation Foundation (a rich desktop technology very close to Silverlight)
Let me know if you would be interested in such a collaboration.
Thanks,
Laurent
October 4th, 2008 at 12:28 am
Yes, Laurent is right. The real size comparison here should be between the outputs: the Flash SWF is 19KB, and the Silverlight XAP is 30KB. Note that with more efficient compression, the XAP could be down to 25KB or less. XAP is the same as ZIP file format, and the compressor used by Visual Studio is not very efficient for some reason.
Also, a Silverlight source-only distribution could be made much smaller by only including the necessary files - that is, the source code. It’s not necessary to include the obj and bin directories - these are intermediate and output files generated by Visual Studio.
Anyway, Terence, you might want to change the file sizes you display or the files you distribute to prevent misunderstandings like this. In the current approach, you present a strong context for comparison but then show two numbers that don’t really make sense to be compared.
October 4th, 2008 at 1:20 am
Tom, really thanks for you suggestoin. Actually, the filesize is generated by the plugin and it’s interested it becomes one of the comparison elements.
Acutally, in the latest samples, I have already erased all the gratuitious files before zipping the file. I hope this can give reader a fair comparsion in filesize.
February 20th, 2009 at 3:53 pm
Пинайте своего хостера - сайт с трудом открылся :(
August 15th, 2009 at 1:58 pm
[...] Read more [...]
January 28th, 2010 at 8:02 pm
Excellent read, I just passed this onto a fellow worker who was making a small research on that. And he really purchased me lunch because I got it for him.
May 25th, 2010 at 1:56 am
Online,
Тут открылось всё сразу. Чё-та у тебя там притормаживает.
August 7th, 2010 at 7:02 am
I truly liked this article, this one goes directly into my stumble upon account :)
November 20th, 2010 at 6:23 am
very nice post. Thanks for posting
November 27th, 2010 at 9:32 am
Morning i just came across your blog from Google but encountered a wierd popup about cat hospitals which is obviously not related to your blog. Is this your ads or do i have a spyware issue? Thanks.
June 3rd, 2011 at 11:38 pm
[...] Flash Silverlight Download [...]