Flash vs Silverlight: FPS Meter & Stress Test Flash vs Silverlight: Rotating Cube
Oct 02

Here is another image rotator with mask effect. The application will randomly select either rectangle mask or ellipse mask. Of course, you may further create some of your mask based on this.

If you want some more resources on image rotator, you can visit http://www.cellbi.com/svlite/Demo/SvFxDemo.html or http://www.cellbi.com/svlite/.

Comparison

Flash implementation: 15 minutes
Silverlight implementation: 50 minutes (Implemented First)
What’s the difference?

  • Enumeration: public static variable [AS3] vs enum [C#]

Source codes

Flash

Silverlight

Enumeration: public static variable [AS3] vs enum [C#]

Enumeration is a very convenient way to define various state or attributes. However, enumeration is not supported in AS3. We can use some constant variables to simulate it.

// AS3
public class GridImage {
	public static var RECTANGLE_MASK:String = "rectangleMask";
	public static var ELLIPSE_MASK:String = "ellipseMask";
}

var maskType:String = Math.random() > 0.5 ? GridImage.RECTANGLE_MASK:
	GridImage.ELLIPSE_MASK;    

Here is a simple enum usage in C#. We can use enum to achieve many other things. For more information, read this Enumerated Type.

// C#
public class GridImage{
	public enum MaskType { RECTANGLE_MASK = 1, ELLIPSE_MASK = 2};
}

int seed = (int)DateTime.Now.Ticks;
Random r = new Random(seed);
int maskType = (r.NextDouble() > 0.5) ? (int) GridImage.MaskType.RECTANGLE_MASK :
	(int) GridImage.MaskType.ELLIPSE_MASK;

Shares and Enjoy~

Did you like this post?

Subscribe here:  

7 Responses to “Silverlight vs Flash: Mask Rotator”

  1. t.a Says:

    Is no one else thinking that some silverlight zealot(s) have captured the voting process her after a while?

    I will concede that i professionally do application development targeting the Flash Platform, but that is not to say i think it is the end all to be all. And for some of these tests, I think Silverlight definitely wins - which i even find surprising due to its current release status, and actually persuedes me to look into it farther and am appreciative of your great examples.

    That said, c’mon… Some of the examples are clearly in favor of Flash and specifically speaking in recent context, the sheep example - the key invocations in Silverlight are not trapped in the plug-in and effect the page scroll of the browser. How can you determine which is better when you test the Silverlight example and it navigates away from it?!

    I think you are doing a great service in contrasting the two and in no way want you to stop doing what the interactive web community i believes needs, but there must be some type of contrasting criteria to how the voting is done.

    That’s not to say that some silverlight-fanboy(s) is/are swaying the tally or that flash-fanboy(s) don’t care enough to keep coming back to vote, but i think the rating system might be under the influence of some people who just click the ‘better’ button because of bias.

    just my thoughts, not that i actually know of any solution that might resolve my hopes that the voting process doesn’t become biased.

  2. admin Says:

    hi, t.a, . Firstly, thanks for you comment and somehow I do feedback what’s meaning of voting.

    To me, the voting is useful since all samples are not exactly identical. Otherwise, voting is not needed.

    But you are right, I know the voting may not be fair since some Microsoft lovers will definitely vote for Silverlight no matter what. However, it still reflects that many people are devoted on Silverlight and just give it a support by voting it.

    Nevertheless, I just hope the readers can easily express their feeling by just a simple click. That sounds more fun, isn’t it?

  3. Silverlight Cream for October 01, 2008 - 2 -- #385 Says:

    [...] Silverlight vs Flash: Mask Rotator [...]

  4. Marcel Says:

    t.a,

    With the sheep example, it works perfectly in IE7 and FF3. The page does not scroll when using the arrow keys in both the Silverlight and the Flash version.

    I voted the Silverlight version because the sheeps movement is much more fluent. You can’t deny that.

    Apart from your example you are probably right, Microsoft fanboys could be voting for Silverlight everytime. But you can see for yourself which is better, the voting thing means nothing.

  5. daniel Says:

    Here’s something odd…
    When I opened it up flash seemed to perform better right away, the mask on the silverlight was chugging a bit behind the flash, so flash had noticeably(to me anyway) smoother transitions.

    now I don’t know how it works in terms of competition for the CPU, but with both of them running side by side, I can see a clear winner between the two(my bias aside) which is not really seen in the votes.

    so I invite you to run this quick test.
    start both silverlight and flash at the same time and have them in the same screen. You will notice hopefully as I have that the performance drops soon of both. I found silverlight was worse from the getgo (though only mariganly and could be due to opening flash first), but both eventually slow down to almost a crawl.

    personally I find this raises more questions, first of all is there some sort of memory leak going on?
    I have seen the bad side of memory leaks in flash, and that is certainly not the case here, but I em entirely unfamiliar with silverlight so just because I don’t see the memory use expanding, doesn’t mean something fishy is not going on.

    now if you go back to our little test, try part two. Scroll down your browser so you see silverlight only and then flash only. This is why I believe flash is the clear champion. it appears that flash’s inability to perform is hindered by silverlight.

  6. rolfen Says:

    My main concern i the memory/cpu performance of Silverlight.
    With youtube and such, and HD around the corner, we need something solid and fool proof, and I would really like something that is easy on the CPU and memory so as to work well on older PCs.
    Eventually, if the performance gets really good, then we can see 3D games and such in Silverlight (or Flash, if they can improve their product well enough)

  7. Mask Image Rotator | Silverlike - A Free Microsoft Silverlight 3 Directory Says:

    [...] image rotator created by Terence Tsang. The application will randomly select either rectangle mask or ellipse [...]

Leave a Reply