文件:
- silverlightLogoLoop.wmv
- SilverlightLogo.xml
- Silverlight.js
- demo.html
SilverlightLogo.xml
<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Cursor="Hand" MouseLeftButtonDown="_LogoLinkDown"> <MediaElement x:Name="media" Loaded="root_LogoLoaded" Source="silverlightLogoLoop.wmv" Canvas.Left="20" Canvas.Top="0" Height="110" Width="110" >
<MediaElement.Clip>
<EllipseGeometry Center="55,55" RadiusX="53" RadiusY="53" />
</MediaElement.Clip>
</MediaElement>
</Canvas>
Demo.html
<script src="Silverlight.js" type="text/javascript"></script>
<script language='javascript' type='text/javascript' >
function root_LogoLoaded(sender, args) {
var media = sender.findName("media");
media.addEventListener("mediaEnded", "LogohandleCompleted");
} function LogohandleCompleted(sender, eventArgs) {
sender.stop();
sender.play();
} function _LogoLinkDown(sender, args){
window.location="http://silverlight.net/default.aspx";
}
</script>
<div id="agLogoHost">logo</div>
<script type="text/javascript">
var peLogo = document.getElementById("agLogoHost");
Silverlight.createObjectEx({source: 'SilverlightLogo.xml', parentElement:peLogo, id:'AgLogoControl', properties: {width:'143', height:'159', background:'#00000000', isWindowless:'true', framerate:'24', version:'1.0.0'}, events: {onError:null, onLoad:null}, context:null});
</script>
ps:我blog右侧就用的是这个 :-) 源文件下载