- コミット日時:
- 2008/01/14 01:05:24 (2 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/as3Query/samples/CssSelectorDemo.as
r196 r198 1 package 2 { 1 package { 3 2 import flash.display.*; 4 import flash.text. *;TextField;5 import flash. events.*;6 import flash. utils.*;3 import flash.text.TextField; 4 import flash.text.StyleSheet; 5 import flash.events.Event; 7 6 import flash.filters.GlowFilter; 8 7 import com.nitoyon.as3query.*; 9 8 9 // import shapes and force them to be linked in the SWF file. 10 10 import test.Circle; Circle; 11 11 import test.Rect; Rect; … … 14 14 import test.Star; Star; 15 15 16 public class CssSelectorDemo extends Sprite 17 { 16 [SWF(width="420", height="430")] 17 public class CssSelectorDemo extends Sprite { 18 // constructor 18 19 public function CssSelectorDemo() { 19 20 $(stage).attr({scaleMode: "noScale", align: "TL"}); … … 24 25 // construct CSS Test List 25 26 as3Query.each(cssTest, function(i:int, css:String):void { 26 $(TextField) // $(ClassName) == $(new ClassName()) 27 .attr({ // set attributes by Object 28 text: css, 29 width: Number($("#ex").attr("width")) - 1, 30 height: 20, 27 $(TextField) // $(ClassName) equals $(new ClassName()) 28 .css("p", { // set CSS 29 fontFamily: "sans-serif" 30 }) 31 .attr({ // set the attributes 32 text: "<p>" + css + "</p>", 33 width: Number($("#ex").attr("width")) - 2, 34 height: 19, 31 35 x: 1, 32 36 y: i * 20 + 1, … … 34 38 backgroundColor: 0xaaaaff 35 39 }) 36 .hover( // hover event40 .hover( // hover event (over and out) 37 41 function(event:Event):void { 38 42 this.background = true; … … 42 46 } 43 47 ) 44 .click( // click event48 .click( // click event 45 49 function(event:Event):void { 46 50 $("#q").text(this.text); … … 56 60 } 57 61 62 // TextField change handler 58 63 private function changeHandler(event:Event):void { 59 64 var f:GlowFilter = new GlowFilter(); … … 71 76 ]; 72 77 73 // View XML78 // An XML that markups the positions and properties of shapes and TextField. 74 79 private var xml:XML = 75 80 <test.Rect width="400" height="410" x="10" y="10"> 76 81 <!--input space--> 77 82 <flash.text.TextField 83 text="Type CSS Selector:" 84 x="10" y="10" width="100" height="20" selectable="false"/> 85 86 <flash.text.TextField 78 87 id="q" type="input" 79 88 text="RoundRect" 80 x="1 0" y="10" width="380" height="20" border="true"/>89 x="120" y="10" width="270" height="20" border="true"/> 81 90 82 91 <!--shapes--> … … 121 130 <test.Rect 122 131 id="ex" 123 x="2 80" y="50" width="100" height="340" color="0xeeeeff"/>132 x="270" y="50" width="120" height="340" color="0xeeeeff"/> 124 133 </test.Rect>; 125 134 }

