在以下代码中,只有按钮图像被嵌入到flex代码中。但是,在html对象或嵌入标记中,为什么必须指定高度和宽度。即使对于这个普通的按钮,如果我们不指定高度和宽度,似乎会出现一些错误。
<div align="center">
<br />
<div style="display:block;width:100px;height:100px;" id="audio"
class="testsound" align="center"/>
<p class="clickable">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="400" height="100" id="myMovieName">
<param name="movie" value="/media/players/testsound.swf"/>
<param name="soundurl" value="/media/players/music.mp3"/>
<param name="quality" value="high"/>
<param name="bgcolor" value="#FFFFFF"/>
<embed width="100" height="100" href="/media/players/testsound.swf"
src="/media/players/testsound.swf"
flashvars="soundUrl=/media/players/music.mp3"
quality="high" bgcolor="#FFFFFF"
name="myMovieName" loop="false" align=""
type="application/x-shockwave-flash">
</embed>
</object>
</p>
</div>
MXML
<?xml version="1.0"?>
<!-- embed/EmbedSound.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.media.*;
public var snd:Sound = new sndCls() as Sound;
public var sndChannel:SoundChannel;
public function playSound():void {
sndChannel=snd.play();
}
]]>
</mx:Script>
<mx:Image id="loader1" click="playSound();"
source="@Embed(source='/opt/cloodon/site/media/img/speaker.gif')" />
</mx:Application>