| パッケージ | mx.containers |
| public class Canvas | |
| 継承 | Canvas Container UIComponent FlexSprite Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object |
x およびy プロパティを使用して明示的に指定できる唯一のコンテナです。
Canvas レイアウトコンテナの子は、それぞれの推奨されている幅および高さに設定されます。子の width プロパティを固定ピクセル値またはコンテナサイズのパーセント値に設定することにより、その子の推奨幅の値をオーバーライドできます。推奨高さも同様の方法で設定できます。
Canvas コンテナ内でパーセントによるサイズ指定を使用している場合、コンポーネントの一部が重複します。これが必要な効果でない場合は、コンポーネントの位置とサイズを慎重に計画してください。
MXML シンタックス
MXML シンタックスの非表示
<mx:Canvas> タグは、スーパークラスのすべてのタグ属性を継承します。次のシンタックスを使用します。
<mx:Canvas> ... 子タグ ... </mx:Canvas>
関連項目
| メソッド | 定義 | ||
|---|---|---|---|
| Canvas()
コンストラクタ。
| Canvas | ||
![]() | addChild(child:DisplayObject):DisplayObject
このコンテナに子 DisplayObject を追加します。
| Container | |
![]() | addChildAt(child:DisplayObject, index:int):DisplayObject
このコンテナに子 DisplayObject を追加します。
| Container | |
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
イベントリスナーオブジェクトを EventDispatcher オブジェクトに登録し、リスナーがイベントの通知を受け取るようにします。
| EventDispatcher | |
![]() | areInaccessibleObjectsUnderPoint(point:Point):Boolean
特定の
point ポイントを指定して呼び出した DisplayObjectContainer.getObjectsUnderPoint() メソッドから返されたリストに、セキュリティ上の制約のために省略される表示オブジェクトがあるかどうかを示します。 | DisplayObjectContainer | |
![]() | callLater(method:Function, args:Array = null):void
後で呼び出す関数をキューに格納します。
| UIComponent | |
![]() | clearStyle(styleProp:String):void
このコンポーネントインスタンスからスタイルプロパティを削除します。
| UIComponent | |
![]() | contains(child:DisplayObject):Boolean
指定された表示オブジェクトが、DisplayObjectContainer インスタンスの子であるか、インスタンス自体であるかを指定します。
| DisplayObjectContainer | |
![]() | contentToGlobal(point:Point):Point
Point オブジェクトをコンテンツ座標からグローバル座標に変換します。 | Container | |
![]() | contentToLocal(point:Point):Point
Point オブジェクトをコンテンツ座標からローカル座標に変換します。 | Container | |
![]() | createComponentFromDescriptor(descriptor:ComponentDescriptor, recurse:Boolean):IFlexDisplayObject
単一の UIComponentDescriptor を指定すると、対応するコンポーネントを作成し、このコンテナの子としてコンポーネントを追加します。
| Container | |
![]() | createComponentsFromDescriptors(recurse:Boolean = true):void
childDescriptors の配列を繰り返し処理し、配列の各要素に対して createComponentFromDescriptor() を呼び出します。 | Container | |
![]() | createReferenceOnParentDocument(parentDocument:IFlexDisplayObject):void
この IUIComponent オブジェクトへの
id 参照を親ドキュメントオブジェクト上に作成します。 | UIComponent | |
![]() | deleteReferenceOnParentDocument(parentDocument:IFlexDisplayObject):void
この IUIComponent オブジェクトへの
id 参照を親ドキュメントオブジェクトから削除します。 | UIComponent | |
![]() | determineTextFormatFromStyles():UITextFormat
この UIComponent のテキストスタイルに対応する UITextFormat オブジェクトを返します。
| UIComponent | |
![]() | dispatchEvent(event:Event):Boolean
イベントをイベントフローに送出します。
| EventDispatcher | |
![]() | drawFocus(focused:Boolean):void
このコンポーネントを囲むフォーカスインジケータを表示または非表示にします。
| UIComponent | |
![]() | drawRoundRect(x:Number, y:Number, w:Number, h:Number, r:Object = null, c:Object = null, alpha:Object = null, rot:Object = null, gradient:String = null, ratios:Array = null, hole:Object = null):void
このスキンの Graphics オブジェクトに、プログラムで矩形を描画します。
| UIComponent | |
![]() | effectFinished(effectInst:EffectInstance):void
コンポーネントでの再生の停止時にエフェクトインスタンスによって呼び出されます。
| UIComponent | |
![]() | effectStarted(effectInst:EffectInstance):void
コンポーネントでの再生の開始時にエフェクトインスタンスによって呼び出されます。
| UIComponent | |
![]() | endEffectsStarted():void
現在コンポーネントで再生中のすべてのエフェクトを終了します。
| UIComponent | |
![]() | executeBindings(recurse:Boolean = false):void
このコンテナのすべてのデータバインディングを実行します。
| Container | |
![]() | executeChildBindings(recurse:Boolean):void
このコンテナの子 UIComponent オブジェクトへのバインディングを実行します。
| Container | |
![]() | finishPrint(obj:Object, target:IFlexDisplayObject):void
印刷の完了後に呼び出されます。
| UIComponent | |
![]() | getBounds(targetCoordinateSpace:DisplayObject):Rectangle
targetCoordinateSpace オブジェクトの座標系を基準にして、表示オブジェクトの領域を定義する矩形を返します。 | DisplayObject | |
![]() | getChildAt(index:int):DisplayObject
n 番目の子コンポーネントオブジェクトを取得します。
| Container | |
![]() | getChildByName(name:String):DisplayObject
指定したストリングの
name プロパティを持つ子を返します。 | Container | |
![]() | getChildIndex(child:DisplayObject):int
特定の子の 0 から始まるインデックスを取得します。
| Container | |
![]() | getChildren():Array
コンテナのコンテンツの子で構成された DisplayObjects オブジェクトの配列を返します。
| Container | |
![]() | getClassStyleDeclarations():Array
この UIComponent インスタンスのタイプセレクタを探します。
| UIComponent | |
![]() | getExplicitOrMeasuredHeight():Number
明示された高さを使用するのか、それとも測定した高さを使用するのかを決定する便利なメソッドです。
| UIComponent | |
![]() | getExplicitOrMeasuredWidth():Number
明示的な幅または測定幅を使用するかどうかを決定するための便利なメソッドです。
| UIComponent | |
![]() | getFocus():InteractiveObject
現在フォーカスを持っているオブジェクトを取得します。
| UIComponent | |
![]() | getObjectsUnderPoint(point:Point):Array
指定されたポイントの下にあり、この DisplayObjectContainer インスタンスの子または孫などであるオブジェクトの配列を返します。
| DisplayObjectContainer | |
![]() | getRect(targetCoordinateSpace:DisplayObject):Rectangle
シェイプ上の線を除き、
targetCoordinateSpace パラメータによって定義された座標系に基づいて、表示オブジェクトの境界を定義する矩形を返します。 | DisplayObject | |
![]() | getRepeaterItem(whichRepeater:int = -1):Object
指定された Repeater がこの Repeater を生成するために使用した
dataProvider 内のアイテムを返します。この Repeater が繰り返されていない場合は、null を返します。 | UIComponent | |
![]() | getStyle(styleProp:String):*
このコンポーネントのスタイル参照チェーンのいずれかの場所に設定されたスタイルプロパティを取得します。
| UIComponent | |
![]() | globalToContent(point:Point):Point
Point オブジェクトをグローバル座標からコンテンツ座標に変換します。 | Container | |
![]() | globalToLocal(point:Point):Point
point オブジェクトをステージ (グローバル) 座標から表示オブジェクトの (ローカル) 座標に変換します。 | DisplayObject | |
![]() | hasEventListener(type:String):Boolean
EventDispatcher オブジェクトに、特定のイベントタイプに対して登録されたリスナーがあるかどうかを確認します。
| EventDispatcher | |
![]() | hasOwnProperty(name:String):Boolean
オブジェクトに指定されたプロパティが定義されているかどうかを示します。
| Object | |
![]() | hitTestObject(obj:DisplayObject):Boolean
表示オブジェクトを評価して、
obj 表示オブジェクトと重複または交差するかどうかを調べます。 | DisplayObject | |
![]() | hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
表示オブジェクトを評価して、
x および y パラメータで指定されたポイントと重複または交差するかどうかを調べます。 | DisplayObject | |
![]() | horizontalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix
水平方向のグラデーションを描画するときに
rot パラメータとして drawRoundRect() メソッドに渡すことのできるボックスの Matrix を返します。 | UIComponent | |
![]() | initialize():void
このコンポーネントの内部構造を初期化します。
| UIComponent | |
![]() | initializeRepeaterArrays(parent:IRepeaterClient):void
このコンポーネントの繰り返されるインスタンスを追跡する各種プロパティを初期化します。
| UIComponent | |
![]() | invalidateDisplayList():void
次に画面が更新されている間に
updateDisplayList() メソッドが呼び出されるように、コンポーネントをマークします。 | UIComponent | |
![]() | invalidateProperties():void
次に画面が更新されている間に
commitProperties() メソッドが呼び出されるように、コンポーネントをマークします。 | UIComponent | |
![]() | invalidateSize():void
次に画面が更新されている間に
measure() メソッドが呼び出されるように、コンポーネントをマークします。 | UIComponent | |
![]() | isPrototypeOf(theClass:Object):Boolean
Object クラスのインスタンスが、パラメータとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
| Object | |
![]() | localToContent(point:Point):Point
Point オブジェクトをローカル座標からコンテンツ座標に変換します。 | Container | |
![]() | localToGlobal(point:Point):Point
point オブジェクトを表示オブジェクトの (ローカル) 座標からステージ (グローバル) 座標に変換します。 | DisplayObject | |
![]() | measureHTMLText(htmlText:String):TextLineMetrics
この UIComponent のスタイルで決定される UITextFormat を使用して単一行の UITextField に表示するものとして、
<font> や <b> のような HTML タグが含まれる指定の HTML テキストを測定します。 | UIComponent | |
![]() | measureText(text:String):TextLineMetrics
この UIComponent のスタイルで決定される UITextFormat を使用して単一行の UITextField に表示するものとして、指定のテキストを測定します。
| UIComponent | |
![]() | move(x:Number, y:Number):void
親の内部の指定された位置にコンポーネントを移動します。
| UIComponent | |
![]() | notifyStyleChangeInChildren(styleProp:String, recursive:Boolean):void
スタイルの変更を子に通知します。
| UIComponent | |
![]() | owns(child:DisplayObject):Boolean
owner プロパティのチェーンが child からこの UIComponent を指定している場合に、true を返します。 | UIComponent | |
![]() | parentChanged(p:DisplayObjectContainer):void
UIComponent オブジェクトを親に対して追加または削除したときに Flex によって呼び出されます。
| UIComponent | |
![]() | prepareToPrint(target:IFlexDisplayObject):Object
印刷用の IFlexDisplayObject を準備します。
| UIComponent | |
![]() | propertyIsEnumerable(name:String):Boolean
指定されたプロパティが存在し、列挙可能かどうかを示します。
| Object | |
![]() | regenerateStyleCache(recursive:Boolean):void
このコンポーネントの CSS スタイルキャッシュを作成または再作成します。
recursive パラメータが true の場合は、このコンポーネントのすべての子孫の CSS スタイルキャッシュも作成または再作成します。 | UIComponent | |
![]() | registerEffects(effects:Array):void
各エフェクトイベントについて、EffectManager をイベントリスナーの 1 つとして登録します。
| UIComponent | |
![]() | removeAllChildren():void
このコンテナの子リストからすべての子を削除します。
| Container | |
![]() | removeChild(child:DisplayObject):DisplayObject
このコンテナの子リストから子 DisplayObject を削除します。
| Container | |
![]() | removeChildAt(index:int):DisplayObject
このコンテナの子リストから指定されたインデックス位置にある子 DisplayObject を削除します。
| Container | |
![]() | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
EventDispatcher オブジェクトからリスナーを削除します。
| EventDispatcher | |
![]() | resumeBackgroundProcessing():void
[static]
suspendBackgroundProcessing() が呼び出された後、callLater() によってキューに入れられたメソッドのバックグラウンド処理を再開します。 | UIComponent | |
![]() | setActualSize(w:Number, h:Number):void
オブジェクトのサイズを設定します。
| UIComponent | |
![]() | setChildIndex(child:DisplayObject, newIndex:int):void
特定の子のインデックスを設定します。
| Container | |
![]() | setCurrentState(stateName:String, playTransition:Boolean = true):void
現在の状態を設定します。
| UIComponent | |
![]() | setFocus():void
現在扱っているコンポーネントにフォーカスを設定します。
| UIComponent | |
![]() | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
ループ処理に対するダイナミックプロパティの可用性を設定します。
| Object | |
![]() | setStyle(styleProp:String, newValue:*):void
このコンポーネントインスタンスのスタイルプロパティを設定します。
| UIComponent | |
![]() | setVisible(value:Boolean, noEvent:Boolean = false):void
visible プロパティが変更されたときに呼び出されます。 | UIComponent | |
![]() | startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void
指定されたスプライトをユーザーがドラッグできるようにします。
| Sprite | |
![]() | stopDrag():void
startDrag() メソッドを終了します。 | Sprite | |
![]() | styleChanged(styleProp:String):void
スタイルプロパティの変更を検出します。
| UIComponent | |
![]() | stylesInitialized():void
コンポーネントのスタイルを初めて初期化するとき、Flex は
stylesInitialized() メソッドを呼び出します。 | UIComponent | |
![]() | suspendBackgroundProcessing():void
[static]
resumeBackgroundProcessing() が呼び出されるまで、callLater() によってキューに入れられたメソッドのバックグラウンド処理をブロックします。 | UIComponent | |
![]() | swapChildren(child1:DisplayObject, child2:DisplayObject):void
指定された 2 つの子オブジェクトの z 順序 (重ね順) を入れ替えます。
| DisplayObjectContainer | |
![]() | swapChildrenAt(index1:int, index2:int):void
子リスト内の指定されたインデックス位置に該当する 2 つの子オブジェクトの z 順序 (重ね順) を入れ替えます。
| DisplayObjectContainer | |
![]() | toString():String
アプリケーションの DisplayObject の階層内部でのこのオブジェクトの位置を示すストリングを返します。
| FlexSprite | |
![]() | validateDisplayList():void
子の位置とサイズを検証し、その他のビジュアルオブジェクトを描画します。
| UIComponent | |
![]() | validateNow():void
必要に応じて、このオブジェクトのプロパティとレイアウトを検証および更新し、それを再描画します。
| UIComponent | |
![]() | validateProperties():void
commitProperties() メソッドを呼び出してコンポーネントのプロパティを検証するためにレイアウトロジックによって使用されます。 | UIComponent | |
![]() | validateSize(recursive:Boolean = false):void
LayoutManager.invalidateSize() メソッドがこの ILayoutManagerClient を指定して呼び出され、測定の実行時に validateSize() メソッドが呼び出された場合に、コンポーネントの測定サイズを検証します。 | UIComponent | |
![]() | validationResultHandler(event:ValidationResultEvent):void
このコンポーネントに割り当てられたバリデータからの
valid と invalid の両方のイベントを処理します。 | UIComponent | |
![]() | valueOf():Object
指定されたオブジェクトのプリミティブ値を返します。
| Object | |
![]() | verticalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix
垂直方向のグラデーションを描画するときに
rot パラメータとして drawRoundRect() メソッドに渡すことのできるボックスの Matrix を返します。 | UIComponent | |
![]() | willTrigger(type:String):Boolean
指定されたイベントタイプについて、この EventDispatcher オブジェクトまたはその祖先にイベントリスナーが登録されているかどうかを確認します。
| EventDispatcher | |
| メソッド | 定義 | ||
|---|---|---|---|
![]() | adjustFocusRect(obj:DisplayObject = null):void
フォーカス矩形を調整します。
| UIComponent | |
![]() | attachOverlay():void
Dissolve エフェクトでコンテナのクロムにオーバーレイを追加するときに内部的に使用されます。
| Container | |
![]() | childrenCreated():void
子オブジェクトの作成後に行われる最終処理を実行します。
| UIComponent | |
![]() | commitProperties():void
コンポーネントに設定されたプロパティを処理します。
| UIComponent | |
![]() | createBorder():void
コンテナの境界線のスキンが存在しない場合、必要に応じてスキンを作成します。
| Container | |
![]() | createChildren():void
コンポーネントの子オブジェクトを作成します。
| UIComponent | |
![]() | focusInHandler(event:FocusEvent):void
UIComponent オブジェクトがフォーカスを取得したときに呼び出されるイベントハンドラです。
| UIComponent | |
![]() | focusOutHandler(event:FocusEvent):void
UIComponent オブジェクトがフォーカスを失ったときに呼び出されるイベントハンドラです。
| UIComponent | |
![]() | initializationComplete():void
このコンポーネントの初期化を完了させます。
| UIComponent | |
![]() | initializeAccessibility():void
このコンポーネントのアクセシビリティコードを初期化します。
| UIComponent | |
![]() | isOurFocus(target:DisplayObject):Boolean
通常、UITextField オブジェクトが含まれているコンポーネントのうち、UITextField オブジェクトがフォーカスを取得したコンポーネントによってオーバーライドされます。
| UIComponent | |
![]() | keyDownHandler(event:KeyboardEvent):void
keyDown イベントに対して呼び出されるイベントハンドラです。 | UIComponent | |
![]() | keyUpHandler(event:KeyboardEvent):void
keyUp イベントに対して呼び出されたイベントハンドラです。 | UIComponent | |
![]() | layoutChrome(unscaledWidth:Number, unscaledHeight:Number):void
サイズ変更に応答して、このコンテナの境界線の位置およびサイズを設定します。
| Container | |
| measure():void
Canvas の推奨最小および推奨最大サイズを計算します。
| Canvas | ||
![]() | scrollChildren():void
horizontalScrollPosition プロパティと verticalScrollPosition プロパティの値に基づいて、表示可能領域を基準とするコンテナのコンテンツ領域の相対的な位置を設定します。
| Container | |
| updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
コンテナの子のサイズを設定します。
| Canvas | ||
| Canvas | () | コンストラクタ |
public 関数 Canvas()コンストラクタ。
| measure | () | メソッド |
protected override function measure():voidCanvas の推奨最小および推奨最大サイズを計算します。
Canvas の measuredWidth は、すべての子を、切り取ることなくそれぞれの推奨幅で表示できる最小の大きさです。この measure() メソッドは、右端の子の位置を計算し、その子の右端の位置を計算してから、Canvas コンテナの境界線の幅の領域および右のパディングを追加します。measuredHeight も同様に計算されます。
Canvas コンテナの minWidth および minHeight プロパティは計算されません。したがってデフォルト値の 0 が使用されます。
Canvas コンテナの maxWidth および maxHeight プロパティは計算されません。コンテナの最大幅と最大高さは無限であると想定されます。
前述の値はすべて、Canvas の計算された幅と高さです。以下のプロパティの値を明示的に指定することにより、計算された値をオーバーライドできます。
widthheightminWidthminHeightmaxWidthmaxHeightこのメソッドを直接呼び出すことは避けてください。Flex LayoutManager が適切なタイミングで呼び出します。Flex LayoutManager は、アプリケーションの起動時に、子から親に至るすべてのコンポーネントを測定してから、それぞれに最終的なサイズを設定しようとします。
これは、サブクラスの処理で使用する高度なメソッドです。このメソッドをオーバーライドする場合は、実装で super.measure() メソッドを呼び出すか、または measuredHeight および measuredWidth プロパティを設定する必要があります。また、オプションで次のプロパティも設定できます。
measuredMinWidthmeasuredMinHeight| updateDisplayList | () | メソッド |
protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):voidコンテナの子のサイズを設定します。
Canvas は、子の位置を変更しません。それぞれの子は、その x および y プロパティの値に応じて配置されます。
width および height の値が設定されていない場合に、Canvas は各子の幅と高さをその子の measuredWidth および measuredHeight と一致するよう設定します。width や height をパーセント値に設定することで、子をサイズ変更可能にできます。サイズ変更可能な子は、Canvas コンテナの右端および下端で囲まれます。この場合は、子の minWidth、minHeight、maxWidth、および maxHeight の値が使用されます。
このメソッドを直接呼び出すことは避けてください。Flex LayoutManager が適切なタイミングで呼び出します。Flex LayoutManager は、アプリケーションの起動時に、Application オブジェクトから始まって下方向にある全コンポーネントに対して updateDisplayList() メソッドを呼び出します。
これは、サブクラスの処理で使用する高度なメソッドです。このメソッドをオーバーライドする場合は、実装で super.updateDisplayList() メソッドを呼び出して、それぞれの子で move() および setActualSize() メソッドを呼び出す必要があります。レイアウトを実行するために、このコンテナのサイズは width および height プロパティではなく、unscaledWidth および unscaledHeight の各プロパティから取得してください。width および height プロパティは、このコンテナの scaleX および scaleY プロパティの値を考慮しません。
unscaledWidth:Number — コンポーネントの scaleX プロパティの値にかかわらず、コンポーネントの座標内でピクセル単位によりコンポーネントの幅を指定します。
|
|
unscaledHeight:Number — コンポーネントの scaleY プロパティの値にかかわらず、コンポーネントの座標内でピクセル単位でコンポーネントの高さを指定します。
|
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Canvas layout container.-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Panel title="Canvas Container Example" height="95%" width="95%"
paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5">
<mx:Label width="100%" color="blue"
text="Use absolute positioning to place the children of a Canvas container."/>
<mx:Canvas borderStyle="solid" height="200" width="100%">
<!-- Stagger the position of the TextInput controls using absolute positioning.-->
<mx:TextInput width="100" x="50" y="5"/>
<mx:TextInput width="100" x="100" y="30"/>
<mx:TextInput width="100" x="150" y="55"/>
<!-- Overlap the VBox containers using layout constraints.-->
<mx:VBox right="115" bottom="50" width="75" height="75" backgroundColor="#0080C0"/>
<mx:VBox right="70" bottom="30" width="75" height="75" backgroundColor="#FFFF80"/>
<mx:VBox right="25" bottom="10" width="75" height="75" backgroundColor="#8080C0" alpha="0.8"/>
<mx:Text right="25" y="110"
text="The Canvas container lets you place components on top of each other."/>
</mx:Canvas>
</mx:Panel>
</mx:Application>