Controlling Silverlight outside of the plugin - the .Content property
Posted on January 31, 2008
Filed Under: 1.0 Javascript, Uncategorized |
This one is pretty basic but it is useful and the info doesn’t seem to be easily accessible so I decided to post a quick example. You can use the content property of the plugin to gain access to elements in your XAML.
So say you want to have a link or button on your page control some aspect of your Silverlight App, like load a new Video into a MediaElement, you could do something like this:
function loadVideo(wmv_file) {
var videoRef
var controlRef
controlRef=document.getElementById("SilverlightControl")
videoRef=controlRef.content.findName("videoElement")
videoRef.source=wmv_file
}
and then in you could just call the loadVideo function within an onclick, onmousdown, or in the href like so:
a href="javascript:loadVideo('my_video.wmv')" mce_href="javascript:loadVideo('my_video.wmv')"
Comments
Leave a Comment
If you would like to make a comment, please fill out the form below.
Recently
- New Vectorform Blog - Microsoft Surface
- Now Hiring Silverlight Developer
- Silverlight Streaming for video assets only
- Silverlight Streaming Service
- Compressing XAML to save on file size
- Controlling Silverlight outside of the plugin - the .Content property
- Accessing the canvas in a Silverlight 1.1 User Control
- Happy Silverlight Holidays from Vectorform
- Silverlight Shooter nears completion
- Microsoft Surface Animation - The making of “Infinite Possibilities”
Categories
- 1.0 Javascript
- 1.1 Alpha
- Animation
- Application
- Career Opportunities
- Components
- Design
- Games
- News
- streaming
- Team Members
- Uncategorized
- User Interface
- video
- Web Service
- XAML
Archives
- August 2008
- June 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007