【发布时间】:2011-06-06 01:42:19
【问题描述】:
在使用 Flex 进行拖放的情况下,我试图让对象中心与放置点对齐 - 不知何故,不管对高度和宽度的调整如何,它总是将放置点定位到左上角。
这里是代码..
imageX = SkinnableContainer(event.currentTarget).mouseX;
imageY = SkinnableContainer(event.currentTarget).mouseY;
// Error checks if imageX/imageY dont satisfy certain conditions- move to a default position
// img.width and img.height are both defined and traced to be 10- idea to center image to drop point
Image(event.dragInitiator).x = imageX-(img.width)/2;
Image(event.dragInitiator).y = imageY-(img.height)/2
最后两行似乎没有任何效果。任何想法为什么 - 必须是直截了当的,我错过了......
【问题讨论】: