Skip to main content
Home Forums General Silverlight Hosting and Streaming Package Blend 2.5 SL 1.0 Projects with JS
5 replies. Latest Post by Frogs69 on April 2, 2008.
(0)
ap0110
Member
20 points
9 Posts
03-11-2008 9:39 PM |
I'm developing a simple SL 1.0 project using Blend 2.5 March 2008 Preview. I'm having a heckuva time getting the xaml.js to execute.
Here's what my .zip contains:
And the contents of manifest.xml:
<?xml version="1.0" encoding="utf-8" ?><SilverlightApp> <source>Page.xaml</source> <onLoad>CreateSilverlight()</onLoad> <version>1.0</version> <width>640</width> <height>480</height> <inPlaceInstallPrompt>true</inPlaceInstallPrompt> <jsOrder> <js>http://agappdom.net/h/silverlight.js</js> <js>Page.xaml.js</js> </jsOrder></SilverlightApp>
Am I missing something in the manifest file? Should I be adding something in Page.xaml or Page.xaml.js? Should I include anything from Default.html or its javascript? So far I've found around 5 or 6 DIFFERENT techniques for packaging for SL Streaming and none of them are working or match up with the default files in Blend 2.5.
Thanks
03-12-2008 3:43 AM |
Ok, I finally found the answer. Hopefully I'm not being a total idiot and someone can actually benefit from this, because I swear I haven't found this anywhere except for one blog entry.
In the absence of an html file and all the code that goes with that, you need something to kick off the javascript. So I changed the above manifest.xml to the following:
<?xml version="1.0" encoding="utf-8" ?><SilverlightApp> <source>Page.xaml</source> <onLoad>onLoad</onLoad> <version>1.0</version> <width>640</width> <height>480</height> <inPlaceInstallPrompt>true</inPlaceInstallPrompt> <jsOrder> <js>Page.xaml.js</js> <js>PlayThisShite.js</js> </jsOrder></SilverlightApp>
Note that I changed the onLoad and took out the silverlight.js, then added a new js file. Here's the content of PlayThisShite.js:
Silverlight.createDelegate = function(instance, method) { return function() { return method.apply(instance, arguments); }}function onLoad(sender, context, source){ var scene = new SL1Test.Page(); scene.handleLoad(sender, context, source);}
SL1Test is the name of my project. When I started the project in Blend 2.5 (I haven't tried Blend 2 in awhile but it's probably the same), these are the first few lines of the default. Page.xaml.js file:
if (!window.SL1Test) SL1Test = {};SL1Test.Page = function() {}
The project works fine now. Btw, here's what I'm using for this project:
cigdem
44 points
1 Posts
03-17-2008 3:53 PM |
I had some problems with the manifest.xml, but realized that I had to create the ZIP file inside the project directory level and not at the directory level. When I made that discovery, I also tried out your solution and it worked, however using your manifest.xml or using the manifest.xml seen below made no difference:
<?xml version="1.0" encoding="utf-8" ?><SilverlightApp> <source>Page.xaml</source> <version>1.0</version> <width>640</width> <height>480</height> <jsOrder> <js>Page.xaml.js</js> </jsOrder></SilverlightApp>
Right now, there are no further problems, but I wanted to share my experiments, because I am using the same tools you listed down:
Blend 2.5Silverlight Site project - SL1.0Silverlight Streaming Beta
Thanks.
Frogs69
Participant
798 points
219 Posts
03-18-2008 12:23 AM |
I am sorry to see you could only find the answer to your issue on that one blog posting (see more references below), and that I only got to read your post now...
Out of curiosity, did you check the SLS SDK and if yes did it not help you out? I am thinking in particular of the following page: http://msdn2.microsoft.com/en-us/library/bb851612.aspx
Additional info about cigdem's reply.
IMPORTANT TO NOTE: we actually want to deprecate this JavaScript invocation syntax, and while it is still supported, the preferred invocation syntax is the iframe (http://msdn2.microsoft.com/en-us/library/bb802533.aspx) and the Windows Live control (http://msdn2.microsoft.com/en-us/library/cc304460.aspx). Both are much simpler, and the latter will get richer over time to become more powerful than the script invocation syntax.
A couple additional blog references:
03-22-2008 6:16 AM |
Thank you for the links. Are these new posts? I searched all over MSDN and found about 4 or 5 DIFFERENT instructions for packaging these files, none of which are the links you have here. (Please don't ask me to remember where I found all the bad information.)
I haven't tried your suggestions yet. I've been in "just get it done" mode.
04-02-2008 12:24 AM |
They are not really new posts. We released the SDK at the same time as the service and we kept updating it to make sure it was on par with the service updates...
Cheers.