简体   繁体   English

如何将声音放入Silverlight动画中?

[英]how I put sound in a silverlight animation?

I'm trying to put a sound to play when the animation in my silverlight animation starts. 我正在尝试在Silverlight动画中的动画开始播放时播放声音。 I put the sound in the user control with blend, selected auto-play, and created a PlaySoundAction to play the sound on load. 我通过混合将声音放入用户控件中,选择自动播放,并创建了PlaySoundAction来播放带负载的声音。 Nothing worked. 没事。 Anyone knows what I could be missing? 有人知道我可能会想念什么吗?

Did you use Media Element? 您使用媒体元素了吗? since you have not posted any code, here is a sample on how to include sound in silverlight 由于您尚未发布任何代码,因此以下是有关如何在Silverlight中包含声音的示例

MediaElement media = new MediaElement();
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("YourNameSpace.Sound1.wav");
media.SetSource(stream);
media.AutoPlay = false;

media.Stop();
media.Play();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM