Thursday, October 30, 2008

Embedding Silverlight in blogger

A post to test embedding of Silverlight applications into blogger






which was achieved by adding to my blogger html template:
<script type="text/javascript" src="http://www.figmentengine.com/assets/script/silverlight.js" ></script>

and then each time I want to embed Silverlight in a post, a holder for the control:
<div id="simplekineticsHost" style="text-align: center;"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2"></object></div>

and some javascript to control the silverlight settings:
<script type="text/javascript">  var host = "http://www.figmentengine.com/";  var source = host + "silverlight/kinetics/simplekinetics.xap";  var parentElement = document.getElementById("simplekineticsHost");  var callbackId = "simplekineticsHost2";  var properties = { width: "500", height: "350", version: "2.0.31005.0"};  var events = {};  Silverlight.createObject(source, parentElement,   callbackId, properties, events);</script>

this was based on this article, with a minor update for the release of silverlight 2.

8 comments:

Anonymous said...

That's cool! I feel like using Silverlight to do animation instead of XNA now...

Hmm... would "New particles" sound nicer? I'm just saying...

Oh, and is the bottom reflective plane somewhat lower? The balls, I mean, particles seem to disappear down there, then reappear a bit later.

Hilbert V said...

Hi,
I am using Silverlight 2 and have my .xap file. I want to host in blogger..But how..? I don't have Silverlight.js file as you specified..

Hilbert V said...

Hi,
I have got an answer for my above comment myself.. The Solution is Silverlight Streaming available at http://Silverlight.live.com

fe said...

@Hilbert V: when you create a silverlight application in visual studio it will ask you if you want to create a web site to host it - if you say yes you will find a silverlight.js in that project's directory.

Its always the same file, so you could just copy it from a test project, or my website.

Blogurway said...

Please specify where to insert these codes...I need these codes for the dynamic tag cloug..isn't it?

fe said...

@chessyman: see http://blog.figmentengine.com/2008/11/dynamic-tag-cloud-v12.html for how to insert the cloud...

Unknown said...

Where should i host my .xap file?

I have hosted silverlight.js file at googlepages.com and it works fine.

But when my .xap file is hosted on googlepages.com it does not gets displayed.

any body any help.... thanks in advance.

Unknown said...

Yes hosting silverlight.js file at googlepages.com works fine but its not fine with .xap files.

One alternate is hosting at silverlight streaming server (silverlight.live.com) but that sucks.... very unstable and very slow.....so looking for any other alternative.

Can anybody suggest alternative way for hosting SL app for getting them in blogger posts.

thanks in advance.

Thanks & Regards,
Pinal Bhatt
www.P-Bhatt.com
self@P-Bhatt.com