全部博文(315)
分类:
2008-04-02 13:54:22
转自:
嵌入图像(多个实例)
layout=”horizontal” width=”350″ height=”250″>
[Embed(source=”assets/logo.png”)]
[Bindable]
public var Logo:Class;
]]>
嵌入一个图像(单个实例)
width=”200″ height=”240″>
嵌入使用 scale-9 缩放的图像
layout=”vertical” width=”400″ height=”480″>
[Embed(
source=”assets/fancy_border.png”,
scaleGridTop=”55″, scaleGridBottom=”137″,
scaleGridLeft=”57″, scaleGridRight=”266″
)]
[Bindable]
public var FancyBorderImage:Class;
]]>
使用 CSS 为皮肤嵌入图像
layout=”horizontal” width=”270″ height=”100″
horizontalAlign=”center” verticalAlign=”middle” >
Button
{
upSkin: Embed(”assets/box_closed.png”);
overSkin: Embed(”assets/box.png”);
downSkin: Embed(”assets/box_new.png”);
}
嵌入 SWF 文件
layout=”horizontal” width=”290″ height=”290″
horizontalAlign=”center” verticalAlign=”middle”>
[Embed(source=”assets/hourglass.swf”)]
[Bindable]
public var Hourglass:Class;
]]>
嵌入 SWF 库资源
viewSourceURL=”src/EmbeddingSwfLibraryAssets/index.html”
layout=”horizontal” width=”450″ height=”240″
horizontalAlign=”center” verticalAlign=”bottom” >
[Embed(source=”assets/library.swf”, symbol=”BadApple”)]
[Bindable]
public var BadApple:Class;
[Embed(source=”assets/library.swf”, symbol=”Pumpkin”)]
[Bindable]
public var Pumpkin:Class;
]]>
嵌入声音文件
import mx.core.SoundAsset;
import flash.media.*;
[Embed(source=”assets/pie-yan-knee.mp3″)]
[Bindable]
public var Song:Class;
public var mySong:SoundAsset = new Song() as SoundAsset;
public var channel:SoundChannel;
public function playSound():void
{
// Make sure we don’t get multiple songs playing at the same
time
stopSound();
// Play the song on the channel
channel = mySong.play();
}
public function stopSound():void
{
// Stop the channel, but only if it exists
if ( channel != null ) channel.stop();
}
]]>
嵌入字体
layout=”horizontal”
horizontalAlign=”center”
verticalAlign=”center” >
@font-face
{
font-family: Copacetix;
src: url(”assets/copacetix.ttf”);
unicode-range:
U+0020-U+0040, /* Punctuation, Numbers */
U+0041-U+005A, /* Upper-Case A-Z */
U+005B-U+0060, /* Punctuation and Symbols */
U+0061-U+007A, /* Lower-Case a-z */
U+007B-U+007E; /* Punctuation and Symbols */
}
.MyTextStyle
{
font-family: Copacetix;
font-size: 24pt;
}