如何在 Flex 中显示数组中的图像?
我正在 Flex 中制作一个配对游戏。我想要左侧一个数组中的图像和右侧第二个数组中的图像,以便用户可以将左侧的图像拖放到右侧的匹配图像上。
我里面有 mx:HBox 和两个 mx:VBox 。现在,如果数组的长度(图像数量)可能不同,如何在我的 gameArray 中的 VBox 中显示图像?我必须创建与 gameArray 长度一样多的 mx:Image,但是如何在 MXML 中执行此操作?
I'm making a Matching Game in Flex. I want to have images from one array on my left and images from the second array on my right, so that user can drag&drop images from the left onto matching images on the right.
I have mx:HBox and two mx:VBox inside. Now, how can I display images in VBox that I have in my gameArray, if the length of my array (amount of images) may differ? I would have to create as many mx:Image as the length of my gameArray, but how do I do it in MXML?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不将 List 与itemRenderer 来显示图像?
Why not use a List with an itemRenderer to display the image?
我将所有数据都放在一个数组中,并且更喜欢这样保存。我只是不明白为什么我的代码不起作用...
代码直接取自 http://livedocs.adobe.com/flex/3/html/help.html?content=repeater_3.html
为什么不显示图像?我调试了代码以确保数组具有正确的数据。例如 gameArray[1] 中的字符串将是“assets/image.jpg”,如果我只是将其写为源,它就可以工作。对于动态,则不然。也许 rp.currentItem 不完全是我在这种情况下应该使用的?
I have all my data in an array and prefer to keep it like this. I just dont understand why my code doesn't work...
The code is taken straight from http://livedocs.adobe.com/flex/3/html/help.html?content=repeater_3.html
Why doesn't it display the images? I debugged my code to make sure that the array has correct data. The string in, e.g. gameArray[1] will be "assets/image.jpg" and if I just write it as a source, it works. With dynamic, it does not. Maybe rp.currentItem is not exactly what I should use in this case??