这部分代码是自己写flex flash播放系统,左边为播放列表,右边为swf文件播放区。
这部分代码没有太高的水平,是即学即用的。我是用它来做公司的flash小游戏网站的。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Array id="swf">
<mx:String>1.swf</mx:String>
<mx:String>2.swf</mx:String>
<mx:String>3.swf</mx:String>
</mx:Array>
<mx:Array id="images">
<mx:String>1.jpg</mx:String>
<mx:String>2.jpg</mx:String>
<mx:String>3.jpg</mx:String>
</mx:Array>
<!--两种播放列表形式 第三种 -->
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
[Bindable]
public var selectedItem:Object;
[Bindable]
public var TitleList:Class;
[Bindable]
public var event:Event;
private function showMessage(event:Event):void {
message.text = event.currentTarget.selectedItem.label;
}
]]>
</mx:Script>
<mx:TileList id="AppSelection" width="121" height="493" color="0x323232" columnWidth="126" rowHeight="120" maxColumns="1"
itemClick="showMessage(event)" x="1333" y="108" backgroundColor="#0D0A0A" direction="vertical" allowMultipleSelection="false">
<mx:dataProvider>
<mx:Array>
<mx:Object label="1.swf" icon="@Embed('1.jpg')"/>
<mx:Object label="2.swf" icon="@Embed('2.jpg')"/>
<mx:Object label="3.swf" icon="@Embed('3.jpg')"/>
</mx:Array>
</mx:dataProvider>
</mx:TileList>
<mx:Text id="message"
paddingTop="20" enabled="false" x="857" y="42" width="142"/>
<!--两种播放列表形式 第三种 -->
<!--两种播放列表形式 第一种 -->
<mx:List id="ctlImage" dataProvider="{swf}" selectedIndex="0" width="127" x="0" y="165" height="493">
<mx:itemRenderer>
<mx:Component>
<mx:Image source="{data}" width="100" height="100"/>
</mx:Component>
</mx:itemRenderer>
</mx:List>
<!--两种播放列表形式 第一种 -->
<!--两种播放列表形式 第二种 -->
<!-- <mx:List id="ctlImage" dataProvider="{swf}"
selectedIndex="0" width="181" height="537" backgroundColor="#908E8E" x="0" y="121"/>-->
<!--两种播放列表形式 第二种 -->
<!--加载游戏文件-->
<mx:SWFLoader width="666" height="518" source="{this.message.text}" autoLoad="true" scaleContent="true" x="205" y="130"/>
</mx:Application>