在我的Flex应用程序中,我维护着5张图片。当用户点击'下一个'按钮时,它应该显示一个图像'image1'。如果该按钮再次点击,则image1应该替换为image2等。我基本上遵循'image.visible'方法。但图像并排显示。我认为这不是正确的程序。任何选择?在此先感谢如何替换flex 3中的图像?
这是我的代码。我将所有图像和按钮保留在mx:面板中。即使我使用了不工作的x和y位置。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel
title = 'Learn and Test your Knowledge'
height = '80%'
paddingBottom = '10' paddingTop = '10'
paddingLeft = '10' paddingRight = '10'
borderAlpha='0.20' fontFamily="Verdana" fontSize="15" color="#F30C32" backgroundImage="@Embed(source='../images/lad.jpg')" width="413" x="139">
<mx:Script>
<![CDATA[
public function nextEvent():void
{
// here i should write next button code
}
]]>
</mx:Script>
<mx:Image source="../images/image1.jpg" visible="true" id="image1" />
<mx:Image source="../images/image3.jpg" visible="true" id="image2"/>
<mx:Image source="../images/image3.jpg" visible="true" id="image3"/>
<mx:Button id="next" visible="false" click="nextEvent()">
</mx:Button>
您是否已将所有图像包含在HBox中?这将把他们排列在一起。尝试将它们放入Canvas标签中。如果情况并非如此,你可以发布一个代码来展示你的图片,以便我们看到发生了什么? – martineno 2010-11-26 06:00:07