Flex-scale3d-effect

提供:Dev Guides
移動先:案内検索

フレックス-Scale3D効果

前書き

Scale3Dクラスは、変換オブジェクトの周りを3次元でターゲットオブジェクトをスケーリングします。 2.0のスケールは、オブジェクトが2倍に拡大されることを意味し、0.5のスケールは、オブジェクトが2倍に縮小されることを意味します。

クラス宣言

以下は spark.effects.Scale3D クラスの宣言です-

public class Scale3D
   extends AnimateTransform3D

パブリックプロパティ

Sr.No Property & Description
1

scaleXBy : Number

オブジェクトをx方向にスケーリングする係数。

2

scaleXFrom : Number

x方向の開始スケール係数。

3

scaleXTo : Number

x方向の終了スケール係数。

4

scaleYBy : Number

オブジェクトをy方向にスケーリングする係数。

5

scaleYFrom : Number

y方向の開始スケール係数。

6

scaleYTo : Number

y方向の終了スケール係数。

7

scaleZBy : Number

オブジェクトをz方向にスケーリングする係数。

8

scaleZFrom : Number

z方向の開始スケール係数。

9

scaleZTo : Number

z方向の終了スケール係数。

パブリックメソッド

Sr.No Method & Description
1

Scale3D(target:Object = null)

コンストラクタ。

継承されるメソッド

このクラスは、次のクラスからメソッドを継承します-

  • spark.effects.AnimateTransform3D
  • spark.effects.AnimateTransform
  • spark.effects.Animate
  • mx.effects.Effect
  • flash.events.EventDispatcher
  • 対象

Flex Scale3Dエフェクトの例

テストアプリケーションを作成して、FlexアプリケーションでのScale3D効果の使用を確認するには、次の手順に従います。

Step Description
1 Create a project with a name HelloWorld under a package com.finddevguides.client as explained in the Flex - Create Application chapter.
2 Modify HelloWorld.mxml as explained below. Keep rest of the files unchanged.
3 Compile and run the application to make sure business logic is working as per the requirements.

以下は、変更されたmxmlファイル src/com.finddevguides/HelloWorld.mxml の内容です。

<?xml version = "1.0" encoding = "utf-8"?>
<s:Application xmlns:fx = "http://ns.adobe.com/mxml/2009"
   xmlns:s = "library://ns.adobe.com/flex/spark"
   xmlns:mx = "library://ns.adobe.com/flex/mx
   width = "100%" height = "100%" minWidth = "500" minHeight = "500">

   <fx:Style source = "/com/finddevguides/client/Style.css"/>
   <fx:Script>
      <![CDATA[
          private function applyScaleProperties():void {
            scaleEffect.play();
         }
     ]]>
   </fx:Script>

   <fx:Declarations>
      <s:Scale3D id = "scaleEffect" target = "{imageFlex}"
        scaleXFrom = "1.0" scaleXTo = "{Number(scalingX.text)}"
        scaleYFrom = "1.0" scaleYTo = "{Number(scalingY.text)}"
        scaleZFrom = "1.0" scaleZTo = "{Number(scalingZ.text)}"
     />
   </fx:Declarations>

   <s:BorderContainer width = "630" height = "480" id = "mainContainer"
      styleName = "container">
      <s:VGroup width = "100%" height = "100%" gap = "50"
         horizontalAlign = "center" verticalAlign = "middle">

         <s:Label id = "lblHeader" text = "Effects Demonstration"
            fontSize = "40" color = "0x777777" styleName = "heading"/>
         <s:Panel id = "scale3DPanel" title = "Using Scale3D Effect"
            width = "500" height = "300">

            <s:layout>
               <s:HorizontalLayout  gap = "10" verticalAlign = "middle"
                  horizontalAlign = "center"/>
            </s:layout>

            <s:VGroup top = "10" left = "15">
               <s:HGroup verticalAlign = "middle">
                  <s:Label text = "Scale By X:" width = "70"/>
                  <s:TextInput id = "scalingX" text = "1.4" width = "50"/>
               </s:HGroup>

               <s:HGroup verticalAlign = "middle">
                  <s:Label text = "Scale By Y:" width = "70"/>
                  <s:TextInput id = "scalingY" text = "1.4" width = "50"/>
               </s:HGroup>

               <s:HGroup verticalAlign = "middle">
                  <s:Label text = "Scale By Z:" width = "70"/>
                  <s:TextInput id = "scalingZ" text = "1.4" width = "50"/>
               </s:HGroup>

               <s:Button label = "Apply Properties" click = "applyScaleProperties()"/>
            </s:VGroup>

            <s:Image id = "imageFlex"
               source = "http://www.finddevguides.com/images/flex-mini.png"/>
         </s:Panel>
      </s:VGroup>
   </s:BorderContainer>
</s:Application>

すべての変更が完了したら、link:/flex/flex_create_application [Flex-アプリケーションの作成]の章で行ったように、アプリケーションを通常モードでコンパイルして実行します。 アプリケーションに問題がない場合、次の結果が生成されます。[link:/flex/samples/EffectsApplicationl#currentlyLoaded = Scale3D [オンラインで試す]]

Flex Scale3Dエフェクト