Apache flex 弯曲使用矩阵缩放画布

Apache flex 弯曲使用矩阵缩放画布,apache-flex,canvas,matrix,Apache Flex,Canvas,Matrix,您好,我想知道如何使用矩阵来增加画布的分量! 如果可能,显示研究代码)首先,您需要探索 然后,您可以尝试以下代码: <?xml version="1.0" encoding="utf-8"?> <mx:Application layout="absolute" minHeight="600" minWidth="955" xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![C

您好,我想知道如何使用矩阵来增加画布的分量!
如果可能,显示研究代码)

首先,您需要探索

然后,您可以尝试以下代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute" minHeight="600" minWidth="955" xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
        /**
         * Stores the button size multiplier on roll over.
         */
        public static const SIZE_MULTIPLIER:Number = 2.5;

        /**
         * Stores initial button's transfrom matrix.
         */
        private var buttonMatrix:Matrix;

        protected function zoomedButton_rollOverHandler(event:MouseEvent):void
        {
            var zoomedButton:Button = event.currentTarget as Button;
            // Get initial button transform matrix
            var matrix:Matrix = zoomedButton.transform.matrix;
            buttonMatrix = matrix.clone();
            // Modify matrix to move button's center to the Canvas (0, 0) point. 
            matrix.translate(-zoomedButton.width / 2 - zoomedButton.x,
                -zoomedButton.height / 2 - zoomedButton.y);
            // Modify matrix to scale using multiplier value
            matrix.scale(SIZE_MULTIPLIER, SIZE_MULTIPLIER);
            // Modify matrix to return button back
            matrix.translate(zoomedButton.width / 2 + zoomedButton.x,
                zoomedButton.height / 2 + zoomedButton.y);
            // Apply resulting matrix
            zoomedButton.transform.matrix = matrix;
        }

        protected function zoomedButton_rollOutHandler(event:MouseEvent):void
        {
            var zoomedButton:Button = event.currentTarget as Button;
            // Restore buttons position
            zoomedButton.transform.matrix = buttonMatrix;
        }
    ]]>
    </mx:Script>

    <mx:Panel height="50%" horizontalCenter="0" verticalCenter="0" width="50%" layout="absolute">
        <mx:Button label="Test" rollOut="zoomedButton_rollOutHandler(event)"
            rollOver="zoomedButton_rollOverHandler(event)" x="100" y="50" />
    </mx:Panel>
</mx:Application>

希望这有帮助:)

首先,您需要探索

然后,您可以尝试以下代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute" minHeight="600" minWidth="955" xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
        /**
         * Stores the button size multiplier on roll over.
         */
        public static const SIZE_MULTIPLIER:Number = 2.5;

        /**
         * Stores initial button's transfrom matrix.
         */
        private var buttonMatrix:Matrix;

        protected function zoomedButton_rollOverHandler(event:MouseEvent):void
        {
            var zoomedButton:Button = event.currentTarget as Button;
            // Get initial button transform matrix
            var matrix:Matrix = zoomedButton.transform.matrix;
            buttonMatrix = matrix.clone();
            // Modify matrix to move button's center to the Canvas (0, 0) point. 
            matrix.translate(-zoomedButton.width / 2 - zoomedButton.x,
                -zoomedButton.height / 2 - zoomedButton.y);
            // Modify matrix to scale using multiplier value
            matrix.scale(SIZE_MULTIPLIER, SIZE_MULTIPLIER);
            // Modify matrix to return button back
            matrix.translate(zoomedButton.width / 2 + zoomedButton.x,
                zoomedButton.height / 2 + zoomedButton.y);
            // Apply resulting matrix
            zoomedButton.transform.matrix = matrix;
        }

        protected function zoomedButton_rollOutHandler(event:MouseEvent):void
        {
            var zoomedButton:Button = event.currentTarget as Button;
            // Restore buttons position
            zoomedButton.transform.matrix = buttonMatrix;
        }
    ]]>
    </mx:Script>

    <mx:Panel height="50%" horizontalCenter="0" verticalCenter="0" width="50%" layout="absolute">
        <mx:Button label="Test" rollOut="zoomedButton_rollOutHandler(event)"
            rollOver="zoomedButton_rollOverHandler(event)" x="100" y="50" />
    </mx:Panel>
</mx:Application>
希望这能有所帮助:)

“画布的组件”可能意味着几件事。请澄清。我需要使用滑块更改画布的大小,画布的大小大于滚动“画布的组件”时显示的父组件,这可能意味着几件事。请澄清。我需要使用滑块更改画布的大小,并且画布的大小要大于显示滚动的父组件