「Flash/flex4」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==リファレンス== http://help.adobe.com/ja_JP/AS3LCR/Flex_4.0/ ==sperkタグリファレンス== http://help.adobe.com/ja_JP/AS3LCR/Flex_4.0/spark/components/packag...」) |
(→OK,Cancelボタン) |
||
| 行97: | 行97: | ||
} | } | ||
} | } | ||
| + | てst | ||
| + | |||
==ウィンドウサイズに合わせてスケール変更== | ==ウィンドウサイズに合わせてスケール変更== | ||
<<nowiki />mx:Application>タグに追加します。 | <<nowiki />mx:Application>タグに追加します。 | ||
initialize="systemManager.stage.scaleMode=StageScaleMode.SHOW_ALL" | initialize="systemManager.stage.scaleMode=StageScaleMode.SHOW_ALL" | ||
2015年5月20日 (水) 11:09時点における版
目次
リファレンス
http://help.adobe.com/ja_JP/AS3LCR/Flex_4.0/
sperkタグリファレンス
http://help.adobe.com/ja_JP/AS3LCR/Flex_4.0/spark/components/package-detail.html
mxタグリファレンス
http://help.adobe.com/ja_JP/AS3LCR/Flex_4.0/mx/controls/package-detail.html
helloworld
<?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" minWidth="550" minHeight="400" creationComplete="initApp()"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <fx:Script> <![CDATA[ import flash.events.Event; public var items:Array = new Array(); public function initApp():void { } private function click1(event:Event):void { trace("test"); } ]]> </fx:Script> <s:Label text="helloworld" /> <s:Button label="click1" click="click1(event)" y="20" /> </s:Application>
グループ分け
<s:VGroup x="50" y="50">
<s:VGroup>
<s:Button label="縦方向ボタン1" />
<s:Button label="ボタン2" />
<s:Button label="ボタン3" />
</s:VGroup>
<mx:HRule width="100%"/>
<s:HGroup>
<s:Button label="横方向ボタン4" />
<s:Button label="ボタン5" />
<s:Button label="ボタン6" />
</s:HGroup>
</s:VGroup>
グループを非表示
<s:VGroup visible="false"> </s:VGroup>
外部as使用
Main.mxml
<fx:Script source="Main.as" />
Main.as
import flash.events.Event;
private function click1(event:Event):void {
trace("test");
}
タグの属性をasから変更する
<s:Label id="l1" text="off" /> this.l1.text="on";
applicationにアクセス
import mx.core.FlexGlobals; FlexGlobals.topLevelApplication.buttonid1.label = "test";
Main.mxmlのthisのクラス名
var _stage:Main = this; // main.mxmlで呼び出したas内に記述
デフォルトのフォント変更
fontFamily="MS Pゴシック"を<s:Application>タグに追加
パネルにスクロールの付いたエリアを用意する
<mx:Panel id="panel1" title="" width="410" height="450"> <s:Scroller id="scroller1" minViewportInset="0" width="401" height="401"> <s:Group id="group1" width="100%" height="100%" /> </s:Scroller> </mx:Panel>
OK,Cancelボタン
// 警告
import mx.controls.Alert;
// 警告イベント
import mx.events.CloseEvent;
private function _onPressBtn(event:Event):void
{
Alert.show("body", "title", Alert.OK | Alert.CANCEL, this, _alertBtn);
}
private function _alertBtn(event:CloseEvent):void
{
if (event.detail == Alert.OK) {
trace("OK");
} else if (event.detail == Alert.CANCEL) {
trace("CANCEL");
}
}
てst
ウィンドウサイズに合わせてスケール変更
<mx:Application>タグに追加します。 initialize="systemManager.stage.scaleMode=StageScaleMode.SHOW_ALL"
