
转载请保持文章完整性!
本文链接地址:http://blog.desizen.com/4lone/628.html
主页:joel's blog
这个例子进行的是Tourdeflex:Containers:Canvas
简介:
简单的介绍了使用Canvas容器后,里面的类似Panel,button等内容如何与之定位的方法.
A Canvas layout container defines a rectangular region in which you place child containers and controls. It is the only container that lets you explicitly specify the location of its children within the container by using the x and y properties of each child.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" verticalAlign="middle" horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" viewSourceURL="srcview/index.html"> <!--今天打开tourdeflex,发现又更新了,看了作者很重视哦--> <mx:Canvas backgroundColor="0xffffff" width="580" height="180" backgroundAlpha="1" borderThickness="6" borderColor="0x545454" cornerRadius="4" borderStyle="solid" > <mx:Label x="10" text="The Canvas container lets you place components on top of each other."/> <mx:Panel title="Panel 1" color="0xffffff" x="10" y="20" width="240" height="100" borderColor="0xEE1122" borderAlpha="0.75"></mx:Panel><!--这个例子里面就这个borderAlpha属性最重要,因为是用来设置容器的不透明度用的--> <mx:Panel title="Panel 2" color="0xffffff" x="50" y="40" width="240" height="100" borderColor="0x22A050" borderAlpha="0.75"></mx:Panel><!--使用绝对定位的方法去显示panel的位置,相对于canvas的定位--> <mx:Panel title="Panel 3" color="0xffffff" x="100" y="60" width="240" height="100" borderColor="0x3380DD" borderAlpha="0.75"></mx:Panel> <mx:Text x="360" y="40" width="200" fontWeight="bold" color="0x0050AA" textAlign="center" text="Use absolute positioning to place the children of a Canvas container." /> <mx:Button x="416" y="86" label="Absolutly!" /> </mx:Canvas> </mx:Application>
标签:Canvas, FLEX, TourDeFlex, 例子
