Flex中如何利用Repeater组件载入XML并显示图片文件

本文介绍了一个使用MXML编写的图片展示应用案例。该应用通过读取images.xml文件加载多个图片资源,并利用Repeater组件实现图片的循环显示。每张图片还附带了描述性的toolTip属性,提供额外信息。此外,通过Zoom效果增强用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Download: main.mxml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml"
  3. layout="vertical"
  4. verticalAlign="middle"
  5. backgroundColor="white">
  6. <mx:XMLid="imagesXML" source="images.xml" />
  7. <mx:Zoomid="zoom" />
  8. <mx:HBoxid="hBox">
  9. <mx:Repeaterid="rep"
  10. dataProvider="{imagesXML.image}">
  11. <mx:Imagesource="{rep.currentItem.@src}"
  12. toolTip="{rep.currentIndex}:{rep.currentItem.@alt}"
  13. completeEffect="{zoom}"/>
  14. </mx:Repeater>
  15. </mx:HBox>
  16. </mx:Application>

Download: images.xml
<?xml version="1.0" encoding="utf-8"?>
<images>
  1. <imagesrc="images/Button.png" alt="Button" />
  2. <imagesrc="images/ButtonBar.png" alt="ButtonBar" />
  3. <imagesrc="images/CheckBox.png" alt="CheckBox" />
  4. <imagesrc="images/ColorPicker.png" alt="ColorPicker" />
  5. <imagesrc="images/ComboBox.png" alt="ComboBox" />
  6. <imagesrc="images/DataGrid.png" alt="DataGrid" />
  7. <imagesrc="images/DateChooser.png" alt="DateChooser" />
  8. <imagesrc="images/DateField.png" alt="DateField" />
  9. </images>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值