Flash as3 将影片剪辑从滚动窗格组件拖动到影片剪辑/舞台中

发布于 2024-12-07 12:14:21 字数 920 浏览 1 评论 0原文

你好,我是这个板上的新人,希望你能帮助我。

我正在尝试制作一个 Flash 地图游戏。现在我在 Movieclip 中有一些项目,并希望将此 Movieclip 放入滚动窗格组件中,但我遇到了问题,因为拖动不会超出滚动窗格。

这是我的代码

container.mc_item.buttonMode = true;

container.mc_item.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
function onDown(event:MouseEvent):void {
container.mc_item.startDrag();
}
container.mc_item.addEventListener(MouseEvent.MOUSE_UP, onUp);
function onUp(event:MouseEvent):void {
container.mc_item.stopDrag();
trace(container.mc_item.dropTarget.parent.name);   // this is the command that tells us which area the mc_item was dropped on
}
container.scrollpane.source= container.mc_item;

请帮助


我上传 cs4 中的源代码。 如果您可以使滚动窗格中的每个动态 _mc 可拖动,以拖动到外面的影片剪辑中,那就太好了。 是否可以给滚动窗格中的每个 _mc 一个标签?

http://www.speedshare.org/download.php?id=5324318F11

谢谢

Hi im new on this board hope you can help me.

Im trying to make a flash map game.Now i have got items in a Movieclip and want this Movieclip into a scrollpane component but i have got probs cause the dragging dont go outside of the scrollpane.

Here is my Code

container.mc_item.buttonMode = true;

container.mc_item.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
function onDown(event:MouseEvent):void {
container.mc_item.startDrag();
}
container.mc_item.addEventListener(MouseEvent.MOUSE_UP, onUp);
function onUp(event:MouseEvent):void {
container.mc_item.stopDrag();
trace(container.mc_item.dropTarget.parent.name);   // this is the command that tells us which area the mc_item was dropped on
}
container.scrollpane.source= container.mc_item;

Please help


I uploaded the source in cs4.
Would be great if you can make the each dynamic _mc in scrollpane dragable, to drag into the movieclip outside.
Is it possible to give each of the _mc in the scrollpane a label?

http://www.speedshare.org/download.php?id=5324318F11

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里南柯 2024-12-14 12:14:21

我认为您要么需要编写自己的滚动窗格组件,要么(我认为更容易)添加一些代码,以便当您开始拖动列表中的项目时,您会创建该项目的副本(不会添加为一个子项到滚动窗格),然后将其拖动。掉落时不要忘记将其移除:)

I think you either need to write your own scroll-pane component, or (easier I think), add some code so that when you start dragging the item in the list, you create a duplicate of the item instead (which is not added as a child to the scrollpane), and drag that instead. Don't forget to remove it when you drop it :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文