It’s very common that you have to pass some predefined parameters to Flash / Silverlight in different pages of the website.
How can we achieve that? Here is a simple example.
(Please note that I have disabled the comment temporarily. It’s because there are many spam messages recently. I will fix that as soon as possible)
Comparison
Flash implementation: 20 minutes
Silverlight implementation: 40 minutes (Implemented First)
What’s the difference?
- LoaderInfo.parameters [AS3] vs InitParams[C#]
Source codes
Passing Query String [Flash 9, AS3] (7.6 KiB, 1,519 hits)
Passing Query String [Silverlight, C#] (12.2 KiB, 1,877 hits)
Flash
Silverlight
LoaderInfo.parameters [AS3] vs InitParams[C#]
In AS3, you can get either pass the parameters using URL or through JavaScript. Here is an example for URL method:
<object width=”550″ height=”400″ id=”PassingQueryString”>
<param name=”movie” value=”PassingQueryString.swf?param1=value¶m2=value”/>
<embed src=”PassingQueryString.swf?param1=value¶m2=value”/>
</object>
// AS3
// get all the parameters values
for (var key:String in loaderInfo.parameters){
var value:String = loaderInfo.parameters[key];
}
For Silverlight, you have to specific a “InitParams” parameter inside the object tag of the HTML Source. For example:
<object type=”application/x-silverlight-2″ width=”100%” height=”100%”>
<param name=”source” value=”PassingQueryString.xap”/>
<param name=”InitParams” value=”param1=value,param2=value2″/>
</object>
// C#
// get the params via the Application Class
private void Application_Startup(object sender, StartupEventArgs e)
{
IDictionary parameters = e.InitParams;
foreach (string key in parameters.Keys)
{
string value = parameters[key];
}
this.RootVisual = new Page();
}

December 19th, 2008 at 2:54 pm
How the hell is Silverlight better ?
Because of strong type and weird syntax ?
Not only that, in flash you can access those parameters at any moment, not only at application_startup (that would involve making additional code to have them available at any given time).
Most flash designers don’t have a clue about strong typing and they prefer untyped approaches cause they feel it is natural.
Now again, how in hell is Silverlight better ? I guess the ones that vote here are either MS fanboys, either they don’t pay enough attention.
January 15th, 2009 at 11:58 pm
Strong typing isn’t mandatory. It’s an option that most find quite appealing because, for instance, it provides consistency in coding and thus faster processing.
I sure would like to know what you mean “weird syntax”. The main advantage of Silverlight is precisely the fact that it’s syntax is the same as rest of the very worldwidely used .Net.
January 23rd, 2009 at 9:46 am
How would Flash people even understand the power of Silverlight… It’s like explaining to people in the 1400’s that the world isn’t flat…. [Condescendingly] You are right Flash guys…. Flash is better, but I’d get your resumes ready fast…
February 4th, 2009 at 8:02 am
“weird syntax”?
What is so weird with an open curly - close curly language? Flash lacked any sort of real OOP capabilities until after several iterations. Now that flash has finally become a first class programmatic platform instead of a design one with programming features shoe-horned in; it has a competitor.
The only sad news for flash is, that competitor knows programmers really well and designed a system that produces great effects without the daunting design platform. I love to work in photoshop, but Flash was never a pleasure until the Adobe buy out.
The good news for flash is, the silverlight community is going through all of the pains flash did leading up to version 5. When should it be used and how much? What is done in poor design? Etc.
July 30th, 2009 at 3:25 am
An alternative way to grab query parameters assuming it’s embedded within a page is to simply iterate through the IDictionary of HtmlPage.Document.QueryString. Accessible from anywhere. In flash, loaderInfo.parameters aren’t accessible from anywhere, unless you have a reference to the stage or saved those values.
May 2nd, 2010 at 12:33 am
hi!, thanks for the info, this post was really utile ! avafx forex broker
September 25th, 2010 at 4:46 pm
You had some nice factors right here. I carried out a study to the topic and obtained most peoples will concur together with your webpage.
January 12th, 2011 at 8:25 pm
As a digital artist and a .NET front-end developer, I have worked with Silverlight for 3 yrs and Flash for 11. In terms of production, flash simply outperforms it on many levels. The only reason I use Silverlight is because all the developers prefer ms products over adobe in our projects. Flash is simply a superior tool in terms of design and production. Its a nightmare just to make a simply button using xaml. Flash wins.
September 14th, 2011 at 6:28 am
You usually get some forex trading software with your online broker.
November 19th, 2011 at 10:00 pm
Hi there, simply turned into aware of your blog through Google, and found that it is really informative. I am gonna watch out for brussels. I will be grateful if you continue this in future. A lot of other people will be benefited from your writing. Cheers!
It is the best time to make a few plans for the future and it’s time to be happy. I’ve learn this post and if I could I desire to counsel you some interesting things or suggestions. Perhaps you can write next articles relating to this article. I wish to read more things approximately it!
Great post. I used to be checking continuously this weblog and I’m impressed! Very helpful information specially the last phase :) I handle such info a lot. I was seeking this particular info for a long time. Thank you and best of luck.
hey there and thanks to your information ? I have definitely picked up something new from proper here. I did alternatively experience some technical issues using this web site, since I experienced to reload the site lots of times previous to I could get it to load properly. I have been considering in case your hosting is OK? Not that I’m complaining, however slow loading cases instances will very frequently have an effect on your placement in google and could harm your high quality rating if advertising and marketing with Adwords. Anyway I am adding this RSS to my e-mail and can look out for much extra of your respective exciting content. Make sure you replace this again soon..
Wonderful items from you, man. I’ve have in mind your stuff prior to and you’re just extremely great. I actually like what you have received right here, really like what you’re stating and the way by which you assert it. You’re making it entertaining and you continue to take care of to keep it wise. I cant wait to learn much more from you. This is really a wonderful website.
Very great post. I just stumbled upon your weblog and wanted to mention that I’ve truly enjoyed surfing around your blog posts. After all I’ll be subscribing for your rss feed and I hope you write once more very soon!
I just like the valuable info you supply in your articles. I will bookmark your blog and check once more here frequently. I am slightly certain I’ll be told plenty of new stuff right right here! Good luck for the following!
I believe that is one of the such a lot vital info for me. And i’m satisfied studying your article. However wanna commentary on some normal issues, The web site taste is great, the articles is in point of fact great : D. Excellent activity, cheers
We are a gaggle of volunteers and starting a new scheme in our community. Your website offered us with helpful information to paintings on. You’ve performed a formidable job and our entire community can be thankful to you.
Definitely consider that that you stated. Your favorite justification appeared to be on the net the simplest factor to have in mind of. I say to you, I certainly get annoyed even as other folks consider concerns that they plainly do not recognise about. You managed to hit the nail upon the top as smartly as outlined out the whole thing without having side effect , people can take a signal. Will probably be back to get more. Thanks
This is very attention-grabbing, You are an excessively professional blogger. I have joined your feed and look ahead to in quest of more of your excellent post. Additionally, I have shared your website in my social networks
Hey There. I discovered your weblog the use of msn. That is a really smartly written article. I will be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will definitely comeback.
I cherished up to you will receive carried out right here. The sketch is attractive, your authored subject matter stylish. nevertheless, you command get got an shakiness over that you would like be delivering the following. sick indisputably come more previously again as exactly the similar just about a lot ceaselessly inside of case you defend this increase.
Hi, i believe that i noticed you visited my blog so i came to return the choose?.I’m attempting to in finding things to improve my web site!I assume its ok to make use of some of your ideas!!
Just want to say your article is as amazing. The clarity in your put up is just nice and that i could think you’re knowledgeable on this subject. Fine together with your permission allow me to snatch your feed to keep up to date with forthcoming post. Thanks a million and please carry on the enjoyable work.
Its like you read my thoughts! You seem to grasp so much approximately this, like you wrote the e book in it or something. I believe that you simply could do with some % to drive the message home a bit, however instead of that, this is excellent blog. A great read. I’ll definitely be back.
Thank you for the good writeup. It in fact was once a enjoyment account it. Glance complicated to far delivered agreeable from you! However, how could we keep in touch?
Hey there, You have done a fantastic job. I will definitely digg it and for my part suggest to my friends. I am sure they’ll be benefited from this web site.
Excellent beat ! I would like to apprentice even as you amend your site, how can i subscribe for a weblog website? The account aided me a appropriate deal. I have been tiny bit familiar of this your broadcast provided vibrant transparent idea
I’m extremely inspired together with your writing skills and also with the structure on your weblog. Is that this a paid topic or did you modify it yourself? Either way keep up the excellent high quality writing, it is rare to see a nice weblog like this one these days..
Attractive section of content. I simply stumbled upon your blog and in accession capital to claim that I get actually loved account your blog posts. Any way I’ll be subscribing in your feeds or even I success you get right of entry to persistently quickly.
My brother recommended I might like this blog. He was totally right. This publish actually made my day. You cann’t consider just how a lot time I had spent for this info! Thank you!
I don’t even understand how I ended up right here, however I thought this put up was once great. I don’t know who you are but definitely you’re going to a famous blogger in the event you are not already. Cheers!
Heya i’m for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I’m hoping to offer something again and help others such as you aided me.
I was suggested this web site through my cousin. I am no longer sure whether this publish is written through him as nobody else recognize such particular approximately my difficulty. You’re wonderful! Thank you!
Great weblog right here! Additionally your web site lots up fast! What host are you the use of? Can I get your affiliate hyperlink to your host? I wish my site loaded up as fast as yours lol
Wow, awesome weblog layout! How long have you ever been running a blog for? you made running a blog glance easy. The whole glance of your website is excellent, let alone the content material!
I am no longer sure the place you are getting your information, however great topic. I must spend some time learning much more or understanding more. Thanks for wonderful information I was looking for this information for my mission.
You actually make it seem so easy with your presentation however I in finding this topic to be actually something that I feel I might never understand. It kind of feels too complicated and very broad for me. I’m having a look forward in your subsequent publish, I’ll attempt to get the hold of it!
I have been surfing on-line more than three hours these days, but I by no means discovered any fascinating article like yours. It is pretty price sufficient for me. In my view, if all webmasters and bloggers made excellent content material as you did, the internet will be much more useful than ever before.
I do agree with all the concepts you’ve offered on your post. They’re really convincing and will definitely work. Nonetheless, the posts are very short for newbies. May just you please prolong them a bit from subsequent time? Thanks for the post.
You could certainly see your skills within the work you write. The arena hopes for more passionate writers such as you who are not afraid to say how they believe. All the time follow your heart.
I will immediately seize your rss as I can not to find your email subscription hyperlink or newsletter service. Do you’ve any? Kindly allow me recognize so that I could subscribe. Thanks.
A person essentially help to make seriously articles I might state. This is the very first time I frequented your website page and so far? I amazed with the analysis you made to make this particular put up extraordinary. Great job!
Magnificent web site. A lot of helpful info here. I’m sending it to several pals ans additionally sharing in delicious. And obviously, thank you for your sweat!
hi!,I really like your writing so so much! share we keep up a correspondence extra approximately your post on AOL? I need an expert in this house to unravel my problem. Maybe that is you! Taking a look forward to see you.
Tremendous things here. I am very glad to see your article. Thanks a lot and I’m taking a look forward to contact you. Will you please drop me a mail?
I just could not leave your web site before suggesting that I really loved the standard info a person supply for your guests? Is going to be back frequently to investigate cross-check new posts
You are in reality a excellent webmaster. The web site loading pace is amazing. It sort of feels that you’re doing any distinctive trick. Furthermore, The contents are masterpiece. you have done a wonderful activity on this topic!
Thanks a lot for sharing this with all of us you really recognize what you’re talking approximately! Bookmarked. Please also seek advice from my web site =). We could have a link exchange contract between us
Wonderful work! That is the type of information that are supposed to be shared across the net. Disgrace on the search engines for not positioning this publish upper! Come on over and seek advice from my site . Thank you =)
Valuable information. Lucky me I found your website unintentionally, and I’m surprised why this coincidence didn’t came about in advance! I bookmarked it.
I’ve been exploring for a bit for any high-quality articles or weblog posts in this kind of house . Exploring in Yahoo I at last stumbled upon this website. Reading this info So i am glad to express that I have an incredibly excellent uncanny feeling I discovered just what I needed. I most undoubtedly will make certain to don?t overlook this website and give it a look regularly.
Woah this blog is great i like studying your articles. Stay up the great work! You know, a lot of persons are looking around for this info, you could help them greatly.
I savor, lead to I discovered just what I was taking a look for. You’ve ended my four day long hunt! God Bless you man. Have a nice day. Bye
Thanks for some other fantastic post. Where else may just anybody get that kind of info in such a perfect method of writing? I have a presentation next week, and I’m at the search for such info.
It’s really a nice and helpful piece of information. I am satisfied that you shared this helpful info with us. Please stay us informed like this. Thank you for sharing.
Excellent submit, very informative. I ponder why the opposite experts of this sector do not understand this. You should continue your writing. I am sure, you’ve a huge readers’ base already!|What’s Going down i am new to this, I stumbled upon this I have discovered It absolutely useful and it has helped me out loads. I’m hoping to give a contribution & assist different users like its helped me. Great job.
Thank you, I have recently been searching for info approximately this subject for ages and yours is the greatest I have came upon till now. But, what in regards to the bottom line? Are you positive about the supply?|What i do not realize is if truth be told how you’re no longer actually a lot more neatly-preferred than you may be now. You are so intelligent.
You understand therefore considerably when it comes to this subject, made me for my part consider it from numerous various angles. Its like men and women don’t seem to be involved except it’s something to do with Woman gaga! Your individual stuffs excellent. Always handle it up!
Generally I don’t learn article on blogs, but I wish to say that this write-up very forced me to try and do it! Your writing style has been amazed me. Thank you, quite nice post.
Hello my loved one! I wish to say that this article is amazing, nice written and come with approximately all important infos. I’d like to look extra posts like this .
naturally like your web-site however you have to take a look at the spelling on quite a few of your posts. Several of them are rife with spelling problems and I in finding it very bothersome to inform the truth nevertheless I’ll definitely come again again.
Hi, Neat post. There’s an issue together with your web site in internet explorer, would test this? IE still is the marketplace leader and a large component of people will miss your wonderful writing because of this problem.
I’ve read some good stuff here. Definitely value bookmarking for revisiting. I wonder how a lot attempt you place to make this type of fantastic informative site.
Hiya very cool website!! Guy .. Beautiful .. Superb .. I will bookmark your website and take the feeds additionally?I am glad to seek out a lot of helpful information right here in the submit, we’d like develop extra strategies on this regard, thank you for sharing. . . . . .
It’s actually a great and useful piece of information. I’m satisfied that you simply shared this useful information with us. Please keep us informed like this. Thanks for sharing.
Fantastic issues altogether, you simply gained a new reader. What would you suggest about your publish that you made some days in the past? Any certain?
Thank you for some other informative blog. Where else may just I am getting that kind of info written in such a perfect way? I’ve a mission that I am simply now working on, and I have been at the glance out for such information.
Hi there, I discovered your blog by way of Google even as looking for a comparable subject, your site got here up, it seems to be good. I have added to my favourites|added to my bookmarks.
December 19th, 2011 at 10:55 pm
I found your weblog website on google and examine a few of your early posts. Continue to maintain up the superb operate. I just additional up your RSS feed to my MSN Information Reader. Looking for ahead to studying more from you afterward!…
December 23rd, 2011 at 10:19 am
Excellent espresso and a cold morning on the patio with the k9 reading some fantastic copy, just what more can an individual ask for?
January 2nd, 2012 at 3:56 am
Good day. Very cool web site!! Man .. Excellent .. Amazing .. I will bookmark your web site and take the feeds additionally…I am satisfied to find numerous helpful info here within the article. Thanks for sharing..