使用可拖动的 Canvas 创建 TileList 时出现问题
我想创建一个图块列表,其中有不同的画布或垂直框等,并且我想让它们能够拖动。
我编写了一个代码来执行此操作,但输出没有在列表中显示任何内容。
<mx:TileList width="1500" height="1000" dragMoveEnabled="true"
selectable="true" selectionColor="#FFFFFF"
dragEnabled="true" dropEnabled="true"
columnCount="1" rowHeight="160">
<mx:dataProvider>
<mx:Array>
<mx:Canvas width="1450" height="100">
<mx:Button label="Testin the buttong"/>
</mx:Canvas>
<mx:Canvas width="1450" height="100">
<mx:Button label="Testin"/>
</mx:Canvas>
</mx:Array>
</mx:dataProvider>
</mx:TileList>
我该如何解决这个问题?或者让我知道我在这里做错了什么?
感谢和问候 泽尚
I want to create a tilelist in which there would be different canvas or vbox etc, and i want to make them drag able.
I wrote a code to do this, but the output does not shows anything in a list.
<mx:TileList width="1500" height="1000" dragMoveEnabled="true"
selectable="true" selectionColor="#FFFFFF"
dragEnabled="true" dropEnabled="true"
columnCount="1" rowHeight="160">
<mx:dataProvider>
<mx:Array>
<mx:Canvas width="1450" height="100">
<mx:Button label="Testin the buttong"/>
</mx:Canvas>
<mx:Canvas width="1450" height="100">
<mx:Button label="Testin"/>
</mx:Canvas>
</mx:Array>
</mx:dataProvider>
</mx:TileList>
How can I fix this? Or let me know what m i doing wrong here?
Thanks and Regards
Zeeshan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 dataProvider 应该具有某种类型的对象。理论上它们可以是 Canvas 的实例,但是使用可视组件作为 dataProvider 是非常不寻常的。您要做的就是阅读 itemRenderers。 itemRenderer 是一个组件,用于渲染 dataProvider 的每个实例。
尝试这样的事情:
简而言之,我使用通用对象在脚本中定义了 dataProvider。我在线定义了一个 itemRenderer 。像这样的事情至少应该有一些东西出现。
我不确定画布是否可以拖动,因为它通常没有任何可以单击来开始拖动的内容。您可能需要考虑 TitleWindow。
我在浏览器中编写了代码,因此适用标准免责声明。
Your dataProvider should have objects of some sort. In theory they could be instance of a Canvas, but that would be highly unusual to use a visual component as the dataProvider. What you want to do is read up on itemRenderers. an itemRenderer is a component that will be used to renderer each instance of your dataProvider.
Try something like this:
In short I Defined the dataProvider in script with generic objects. And I defined an itemRenderer in-line. Something like this should at least have something show up.
I'm not sure if a Canvas can be draggable, as it doesn't usually have anything to click on to start the drag. You may want to consider a TitleWindow.
I wrote the code in browser, so standard disclaimers apply.