`
ljxyuer
  • 浏览: 16491 次
  • 性别: Icon_minigender_1
  • 来自: 成都
文章分类
社区版块
存档分类
最新评论
收藏列表
标题 标签 来源
Flex Html flex
xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="white" creationComplete="init()" layout="vertical">                      
       
    <mx:Script>                 
        <![CDATA[      
            import flash.net.navigateToURL;   
            import mx.controls.Alert;   
               
            private const WEB_SITE:String = "http://www.baidu.com";      
               
            private function init():void    
            {   
                var str:String = "<a href='http://www.cppzone.com'><u><font color='#2754d5'>Request to use it!</font></u></a><br>"+    
                    "<a href='event:http://www.cppzone.com'><u><font color='#2754d5'>Click to use it!</font></u></a>";   
                txt.htmlText+=str;   
                txt.addEventListener(TextEvent.LINK, doLink); //这里要监听link事件      
            }   
               
            private function doLink(evt:TextEvent):void  
            {   
                Alert.show(evt.text);   
                navigateToURL(new URLRequest(evt.text),'_self');   
            }   
        ]]>   
    </mx:Script>   
    <mx:TextArea id="txt" width="600" height="400" fontSize="12"  
                 htmlText="这是一个点击TextArea中的link到外部链接的例子,请点击下面的Click"/>
Flex自定义Button的图片 flex button
comp/MyIconButton.mxml

<?xml version="1.0" encoding="utf-8"?>   
<s:Button xmlns:fx="http://ns.adobe.com/mxml/2009"   
          xmlns:s="library://ns.adobe.com/flex/spark"   
          xmlns:mx="library://ns.adobe.com/flex/mx" skinClass="skins.MyIconSkin">   
    <fx:Script>   
        <![CDATA[  
            [Bindable]  
            public var icon:Object;  
        ]]>   
    </fx:Script>   
</s:Button>   


skins/MyIconSkin


<?xml version="1.0" encoding="utf-8"?>   
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" 
			 xmlns:s="library://ns.adobe.com/flex/spark"   
			 xmlns:fb="http://ns.adobe.com/flashbuilder/2009" 
			 minWidth="21" minHeight="21" alpha.disabled="0.5" 
			 xmlns:mx="library://ns.adobe.com/flex/mx">   
	
	<!-- host component -->   
	<fx:Metadata>   
		<![CDATA[  
		/**  
		* @copy spark.skins.spark.ApplicationSkin#hostComponent  
		*/  
		[HostComponent("MyIconButton")]  
		]]>   
	</fx:Metadata>   
	
	<s:states>
		<s:State name="up" />
		<s:State name="over" />
		<s:State name="down" />
		<s:State name="disabled" />
	</s:states>
	
	<s:Graphic>
		<s:BitmapImage source.up="{hostComponent.upIcon}"
					   source.over="{hostComponent.overIcon}"
					   source.down="{hostComponent.downIcon}"
					   source.disabled="{hostComponent.disabledIcon}"/>
	</s:Graphic>
	<s:Label id="labelDisplay"
			 textAlign="center"
			 verticalAlign="middle"
			 maxDisplayedLines="1"
			 horizontalCenter="0" verticalCenter="1"
			 left="10" right="10" top="2" bottom="2">
		
	</s:Label>  
</s:SparkSkin>  


ButtonWithIcon.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" minWidth="955" minHeight="600" xmlns:comp="comp.*" viewSourceURL="srcview/index.html">   
    <s:layout>   
        <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"/>   
    </s:layout>   
    <comp:MyIconButton icon="@Embed('assets/add.png')" label="BTN 1" />   
    <comp:MyIconButton icon="@Embed('assets/alert.png')" label="BTN 2" />   
    <comp:MyIconButton icon="@Embed('assets/back.png')" label="BTN 3" />   
</s:Application>
Global site tag (gtag.js) - Google Analytics