Apache flex 将图像从面板拖放到画布后,如何使用flex4在画布中旋转拖放的图像

Apache flex 将图像从面板拖放到画布后,如何使用flex4在画布中旋转拖放的图像,apache-flex,actionscript,Apache Flex,Actionscript,这是三维旋转的代码 <s:Rotate3D id="rotate3DX" target="{image}" angleXFrom="0" angleXTo="360" duration="2000" autoCenterTransform="true" /> <s:Ro

这是三维旋转的代码

<s:Rotate3D id="rotate3DX"
                    target="{image}"
                    angleXFrom="0"
                    angleXTo="360"
                    duration="2000"
                    autoCenterTransform="true" />


    <s:Rotate3D id="rotate3DY"
                target="{image}"
                angleYFrom="0"
                angleYTo="360"
                duration="2000"
                autoCenterTransform="true" />

    <s:Rotate3D id="rotate3DZ"
                target="{image}"
                angleZFrom="0"
                angleZTo="360"
                duration="2000"
                autoCenterTransform="true" />

</fx:Declarations>
图像是

<mx:Panel width="216" height="349" title="Parts" color="#010101"
                      cornerRadius="10">
                <mx:Image source="images\8.png" 
                          width="128" height="76" 
                          mouseMove="mouseDownHandler(event)"
                          id="image"


                         />
                <mx:Image source="images\10.jpg" 
                          width="110" height="87" 
                          mouseMove="mouseDownHandler(event)"/>
                <mx:Image source="images\9.jpg" 
                          width="111" height="88" 
                          mouseMove="mouseDownHandler(event)"/>
            </mx:Panel>

放置图像的画布是

        <mx:Canvas id="canvas1"
                   height="349" width="1080" 
                   backgroundColor="#BFBDBD"
                   cornerRadius="10"
                   borderColor="#000000"
                   borderVisible="true"
                   dropShadowVisible="true"
                   dragEnter="dragEnterHandler(event)"
                   dragDrop="dropHandler(event)"
                  >




            <mx:ControlBar width="100%" cornerRadius="0">
                <s:Button id="buttonX"
                          label="Rotate3D X-axis"
                          click="rotate3DX.play();" />
                <s:Button id="buttonY"
                          label="Rotate3D Y-axis"
                          click="rotate3DY.play();" />
                <s:Button id="bButtonZ"
                          label="Rotate3D Z-axis"
                          click="rotate3DZ.play();" />
            </mx:ControlBar>

        </mx:Canvas>


将图像放入画布后,我希望旋转图像。我可以在面板中旋转图像。

在这种情况下,您将绑定效果的目标。简单地将ID从一个组件切换到另一个组件实际上是行不通的。对原始图像的引用实际上是绑定的。您最好在dropHandler方法中以编程方式切换效果的目标

// DON'T DO THIS
newImage.id=draggedImage.id;

// DO THIS
rotate3DY.target = newImage;
rotate3DZ.target = newImage;

我可以旋转画布中最后一个拖放的图像。现在我想从多个图像中选择一个图像并旋转该特定图像。你能帮我吗?你必须有办法确定要选择哪个图像。例如,您可以单击并生成图像,在clickHandler上,您可以将效果的目标设置为该图像。长话短说-只需确保将目标设置为实际要旋转的图像的效果。
// DON'T DO THIS
newImage.id=draggedImage.id;

// DO THIS
rotate3DY.target = newImage;
rotate3DZ.target = newImage;