Skip to main content
Home Forums Silverlight Design Designing with Silverlight Need Urgent Help!!
3 replies. Latest Post by jiaa1985 on June 29, 2009.
(0)
jiaa1985
Member
5 points
9 Posts
06-29-2009 6:28 AM |
Hi Folks, I am a new bee in silverlight. I want to use an silverlight animated banner for my website which was in flash earlier. I got the xaml file converted from swf file and now i have silverlight .xaml file.How can i embed that silverlight xaml into my webpage so that it starts working !! Please Help !!
jay nana...
Contributor
3388 points
624 Posts
06-29-2009 6:55 AM |
if your codebehind file is like Page.xaml.js means Javascript (Silverlight 1.0) than this code will work to embedd that.
<script type="text/javascript"> function createSilverlight() { var scene = new SilverlightSite1.Page(); Silverlight.createObjectEx({ source: "Page.xaml", parentElement: document.getElementById("silverlightControlHost"), id: "SilverlightControl", properties: { width: "100%", height: "100%", version: "1.0" }, events: { onLoad: Silverlight.createDelegate(scene, scene.handleLoad), onError: function(sender, args) { var errorDiv = document.getElementById("errorLocation"); if (errorDiv != null) { var errorText = args.errorType + "- " + args.errorMessage; if (args.ErrorType == "ParserError") { errorText += "<br>File: " + args.xamlFile; errorText += ", line " + args.lineNumber; errorText += " character " + args.charPosition; } else if (args.ErrorType == "RuntimeError") { errorText += "<br>line " + args.lineNumber; errorText += " character " + args.charPosition; } errorDiv.innerHTML = errorText; } } } }); } if (!window.Silverlight) Silverlight = {}; Silverlight.createDelegate = function(instance, method) { return function() { return method.apply(instance, arguments); } } </script>If it is not the case, can you explain in more detail. perhaps share that xaml.
milind.s...
389 points
72 Posts
06-29-2009 7:05 AM |
First of all, let me clear that animations created through action script will not get exported in xaml; (Preferably this conversion should be done with static UI) You would have to code them again. I hope you have Visual Studio 2008 & Blend 2 installed on your machine. Follow these steps now:
This is very high level process, you may have to do some rework to get exact UI & experience.
06-29-2009 7:59 AM |
Thanks Milind !! I followed steps said by you and got my silverlight control running as good as it was in flash. Thank you very much indeed!! jay nanavati Thanks for your post.