0
작성시 XML로 채워지는 TileList가 있는데 선택한 항목의 이미지를 이미지 구성 요소의 소스로 전달하고 싶습니다.플렉스 3 XML 피드 TileList 선택한 항목을 다른 구성 요소로 전달
이 주요 응용 프로그램은 다음과 같습니다
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" backgroundColor="#FFFFFF">
<mx:ArrayCollection id="theImages"></mx:ArrayCollection>
<mx:Model id="items" source="items.xml" />
<mx:Script>
<![CDATA[
import ItemListObject;
public function initList():void
{
for each (var node:Object in items.image) {
var temp:ItemListObject = new ItemListObject();
temp.strThumbnail = node.strThumbnail;
temp.title = node.title;
theImages.addItem(temp);
}
}
]]>
</mx:Script>
<mx:XML source="adjectives.xml" id="adjectivesXML"/>
<mx:Canvas x="20" y="20">
<mx:Image
id="item"
source="????"
autoLoad="true"
width="500"
height="500"
scaleContent="true"/>
</mx:Canvas>
<mx:TileList id="imageTileList"
itemRenderer="CustomItemRenderer"
dataProvider="{theImages}"
width="400"
height="400"
columnCount="2"
creationComplete="initList();"/>
</mx:Application>
내가 이미지 구성 요소의 소스에 대한 여러 가지를 시도했지만 아무것도 그래서 그냥 4 물음표를 넣어 작동하지 않습니다. ItemsListObject.as
package
{
[Bindable]
public class ItemListObject extends Object
{
public function ItemListObject() {
super();
}
public var title:String = new String();
public var strThumbnail:String = new String();
}
}
이것은 매우 거친 예입니다,하지만 난 한 번
<?xml version="1.0" encoding="utf-8"?>
<items>
<image id="1">
<title>Image 1</title>
<strThumbnail>1.jpg</strThumbnail>
</image>
<image id="2">
<title>Image 2</title>
<strThumbnail>2.jpg</strThumbnail>
</image>
<image id="3">
<title>Image 3</title>
<strThumbnail>3.jpg</strThumbnail>
</image>
<image id="4">
<title>Image 4</title>
<strThumbnail>4.jpg</strThumbnail>
</image>
</items>
그리고 여기에 있습니다 : 여기
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalAlign="center"
verticalAlign="middle"
verticalGap="0"
width="150"
height="150"
paddingRight="5"
paddingLeft="5"
paddingTop="5"
paddingBottom="5">
<mx:Image id="img" height="100" width="100" source="{data.strThumbnail}" />
<mx:Label height="20" width="75" text="{data.title}" textAlign="center" color="0x000000" fontWeight="normal" />
</mx:VBox>
items.xml됩니다 다음은 CustomItemRenderer입니다 이 고비를 넘겨서 나는 내가하려고하는 것을 더 많이 할 수있을 것이다. 읽어 주셔서 감사합니다.