Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Why Silverlight...Why Not Flash???

0.00/5 (No votes)
8 Nov 2008 1  
Now there is no need to depend on a multimedia person to make your web page more dynamic and attractive.

Introduction

Last week, I had a presentation in my office and I chose the topic "Why Silverlight....why not Flash", because when I speak to other developers about Silverlight, they are generally very excited and motivated to learn the technology.

Just 15 days ago, I started playing with Silverlight. I am a .NET developer and have always wanted to achieve things in Flash that couldn't be done in .NET, but I did not want to learn Flash. With Silverlight, I can use all the same programming knowledge for the backend code and just learn a new frontend.

As we all know, the most popular technique to build an attractive website is to insert some animation.

But, is it the work of a developer….??

I will say that in 90% of the cases, the answer is no. Actually this is the work of the Multimedia person (i.e. the person who has knowledge of Flash/Flex).

That means every time we have to depend on some person who knows Flash/Flex.

As I have a little bit knowledge of both (definitely not perfect in both …)), I would like to share my experience.

At this point, I prefer Silverlight over Flash!!!

Silverlight…. ???

Silverlight is a new cross-browser, cross-platform implementation of the .NET framework for building and delivering the next generation of media experiences and Rich Interactive Application(RIA) for the web.

Till date, there have been two ‘major’ Silverlight releases by Microsoft: Silverlight 1.0, and Silverlight 2.0.

Silverlight 1.0 – Silverlight 1.0 applications are a mixture of XAML (Extensible Application Markup Language), HTML, and JavaScript. When a Silverlight 1.0 application is run in the browser, it invokes the Silverlight control, which in turn loads up the XAML file.

Silverlight 2.0 – Silverlight 2.0 is a superset of Silverlight 1.0. The major difference between the two lies in the fact that Silverlight 2.0 includes a refactored version of the .NET framework with CLR 3.0. This change brings along a flexible programming model and has been designed from ground up to support .NET languages like C# and VB.NET, which in turn lets you utilize your .NET skills. Silverlight 2 also supports Dynamic Language Runtime (DLR) for compilation and execution of dynamic languages like IronPython, Managed JScript and IronRuby.

Silverlight 2 comes with a subset of the WPF programming model and includes support for user interface controls, layout, databinding, documents, media, and animation. Silverlight can also deliver high-quality video to all major browsers running on the Mac OS or Windows.

Silverlight 2 is very small in size but the benefits are huge. The download contains a stripped down version of the .NET Framework in your browser. So there is no need to install the .NET framework on client machines.

Advantages

  • Support for all major browsers as well as all platforms
  • Improved server scalability and expanded advertiser support
  • Advance content Protection
  • Deep Zoom, for zooming and navigation of ultrahigh resolution imagery
  • Advance skinning and template support

Using the Code

To create this presentation, I used:

  • Visual Studio 2008
  • Microsoft Expression Blend 2.5 June 2008 preview
  • Silverlight 2 Beta 2

In this project, you will find 7 XAML presentation pages, all linked with each other.

All the XAML pages are equal in nature, the only difference is its content.

I have used two canvases, one for Animation and another one for Display Text.

Points of Interest

To move forward or backward from one XAML page to another XAML page, write a function in app.xaml.cs:

// in app.xaml.cs           
Grid mainUI = new Grid();
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = mainUI;
mainUI.Children.Add(new Page());
//this.RootVisual = new Page();
}
public static void GoToPage(UserControl nextPg)
{
try
{
App app = (App)Application.Current;
// Remove the displayed page
app.mainUI.Children.Clear();
// Show the next page
app.mainUI.Children.Add(nextPg);
}
catch
{
}
finally
{
}
}
 
// Calling this function in next/ back button click on each page                          
private void imgNext_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
try
{
App app = (App)Application.Current;
App.GoToPage(new Page2());
}
catch
{
}
finally
{
}
}

History

  • 9th November, 2008: Initial post

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here