我想,当一个页面在WP7被打开来实现这一流程:播放声音
戏情节串连图板“眨眼”⇒播放声音⇒玩故事板“运动”
我增加了听起来像MediaElement一样,你可以在代码中看到。我必须设置AutoPlay =“False”,否则打开页面时会立即播放声音。
问题是,当眨眼故事板结束声音从未播放。我将MediaEnded触发器添加到MediaElement中,相信它会引用MediaElement中指定的声音。但它什么都不做。我试图在PlaySoundAction的“Source”属性中再次指定声音,但它仍然不会播放声音。我认为MediaElement的“autoplay = false”是一个罪魁祸首,但我不能像上面描述的那样把它关掉。
<MediaElement x:Name="mysound" HorizontalAlignment="Left" Height="0" Source="/mysound.mp3" Stretch="Fill" VerticalAlignment="Top" Width="0" Volume="1" AutoPlay="False">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MediaEnded">
<eim:ControlStoryboardAction Storyboard="{StaticResource movement}"/>
</i:EventTrigger>
<eim:StoryboardCompletedTrigger Storyboard="{StaticResource blink}">
<eim:PlaySoundAction Volume="1"/>
</eim:StoryboardCompletedTrigger>
</i:Interaction.Triggers>
</MediaElement>
我首先想到为所有事物制作一个大故事板,但似乎没有在故事板中添加声音的方法,或者是否存在? – Jonny