Flex! 別のサーバにある Module も読み込めるかな? nariyu forked:3favorite:8lines:112license : All rights reserved modified : 2009-02-20 13:13:41 Embed Tweet <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"> <mx:VBox backgroundColor="#FFFFFF" width="100%" height="100%" verticalGap="0" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10" horizontalAlign="center"> <mx:Label text="mx.controls.Buttonを拡張してみたよ(iPhoneのUISwitch風な感じ)" fontWeight="bold"/> <mx:VBox height="100%" verticalAlign="middle"> <mx:ModuleLoader id="loader" url="http://www.playwell.jp/ModuleLoaderTest.swf"/> </mx:VBox> <mx:HBox width="100%" horizontalAlign="right"> <mx:LinkButton label="ソース" click="navigateToURL(new URLRequest('http://www.bulldog.co.jp/'))"/> </mx:HBox> <mx:filters> <mx:DropShadowFilter angle="90" blurX="10" blurY="10" distance="2" alpha="0.7"/> </mx:filters> </mx:VBox> <mx:Script> <![CDATA[ import mx.modules.Module; import mx.controls.Button; private function get slideSwitch():Button { if (!loader.child) return null; return (loader.child as Module).getChildAt(0) as Button; } private var slideSwitchLoaded:Boolean = false; private function checkLoaded():void { if (slideSwitchLoaded) return; if (slideSwitch && slideSwitch.width > 0) { slideSwitchLoaded = true; initSlideSwitch(); } } private function initSlideSwitch():void { slideSwitch["onLabel"] = "オン"; slideSwitch["offLabel"] = "オフ"; widthNS.value = slideSwitch.width; heightNS.value = slideSwitch.height; enabledCheckBox.selected = slideSwitch.enabled; onoffCheckBox.selected = slideSwitch.selected; thumbWidthNS.value = slideSwitch.getStyle("thumbWidth"); durationNS.value = slideSwitch.getStyle("duration"); onLabelText.text = slideSwitch["onLabel"]; offLabelText.text = slideSwitch["offLabel"]; slideSwitch.addEventListener(Event.CHANGE, slideSwitch_changeHandler); } private function slideSwitch_changeHandler(event:Event):void { onoffCheckBox.selected = slideSwitch.selected; } ]]> </mx:Script> <mx:Form verticalGap="3" enterFrame="checkLoaded()" paddingTop="0" paddingBottom="0" paddingLeft="0" paddingRight="0"> <mx:FormItem label="enabled"> <mx:CheckBox id="enabledCheckBox" label="ON/OFF" change="slideSwitch.enabled = enabledCheckBox.selected"/> </mx:FormItem> <mx:FormItem label="selected"> <mx:CheckBox id="onoffCheckBox" label="ON/OFF" change="slideSwitch.selected = onoffCheckBox.selected"/> </mx:FormItem> <mx:FormItem label="width" direction="horizontal"> <mx:CheckBox id="widthCheck" label="指定あり" change="widthCheck.selected ? slideSwitch.width = widthNS.value : slideSwitch.explicitWidth = NaN"/> <mx:HSlider id="widthNS" enabled="{widthCheck.selected}" minimum="10" maximum="200" value="70" liveDragging="true" snapInterval="1" change="slideSwitch.width = widthNS.value"/> <mx:Label text="{widthNS.value}px"/> </mx:FormItem> <mx:FormItem label="height" direction="horizontal"> <mx:CheckBox id="heightCheck" label="指定あり" change="heightCheck.selected ? slideSwitch.height = heightNS.value : slideSwitch.explicitHeight = NaN"/> <mx:HSlider id="heightNS" enabled="{heightCheck.selected}" minimum="10" maximum="200" value="30" liveDragging="true" snapInterval="1" change="slideSwitch.height = heightNS.value"/> <mx:Label text="{heightNS.value}px"/> </mx:FormItem> <mx:FormItem label="thumbWidth" direction="horizontal"> <mx:HSlider id="thumbWidthNS" minimum="0" maximum="200" liveDragging="true" snapInterval="1" change="slideSwitch.setStyle('thumbWidth', thumbWidthNS.value)"/> <mx:Label text="{thumbWidthNS.value}px"/> </mx:FormItem> <mx:FormItem label="duration" direction="horizontal"> <mx:HSlider id="durationNS" minimum="0" maximum="1000" liveDragging="true" snapInterval="1" change="slideSwitch.setStyle('duration', durationNS.value)"/> <mx:Label text="{durationNS.value}ms"/> </mx:FormItem> <mx:FormItem label="label"> <mx:HBox horizontalGap="0"> <mx:Label text="ON"/> <mx:TextInput id="onLabelText" width="60" change="slideSwitch['onLabel'] = onLabelText.text"/> <mx:Label text=" OFF"/> <mx:TextInput id="offLabelText" width="60" change="slideSwitch['offLabel'] = offLabelText.text"/> </mx:HBox> </mx:FormItem> </mx:Form> </mx:Application> Code Fullscreen Preview Fullscreen matacat yoropan inosyan Nyarineko : ぶるどっくw sokak : Flex nijitaro : flexソースでくそわらったw zahir : ボタン mash : buttonflexかっこいい button flex ボタン width explicitWidth explicitHeight height selected enabled label text sort new page view favorite forked pv0 forked from: Flex! 別のサーバにある Mo.. hacker_9p8x8mco forked:0 favorite:0lines:113 (diff:1) pv300 forked from: Flex! 別のサーバにある Mo.. hacker_9p8x8mco forked:0 favorite:0lines:113 (diff:1) pv0 forked from: Flex! 別のサーバにある Mo.. jokerowl forked:0 favorite:0lines:112 (diff:1)