差分発生行の前後
無視リスト:
コミット日時:
2008/01/14 01:05:24 (2 年前)
コミッタ:
nitoyon
ログメッセージ:

--

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/as3Query/samples/CssSelectorDemo.as

    r196 r198  
    1 package 
    2 
     1package { 
    32        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
    76        import flash.filters.GlowFilter; 
    87        import com.nitoyon.as3query.*; 
    98 
     9        // import shapes and force them to be linked in the SWF file. 
    1010        import test.Circle; Circle; 
    1111        import test.Rect; Rect; 
     
    1414        import test.Star; Star; 
    1515 
    16         public class CssSelectorDemo extends Sprite 
    17         { 
     16        [SWF(width="420", height="430")] 
     17        public class CssSelectorDemo extends Sprite { 
     18                // constructor 
    1819                public function CssSelectorDemo() { 
    1920                        $(stage).attr({scaleMode: "noScale", align: "TL"}); 
     
    2425                        // construct CSS Test List 
    2526                        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, 
    3135                                                x: 1, 
    3236                                                y: i * 20 + 1, 
     
    3438                                                backgroundColor: 0xaaaaff 
    3539                                        }) 
    36                                         .hover(    // hover event 
     40                                        .hover(      // hover event (over and out) 
    3741                                                function(event:Event):void { 
    3842                                                        this.background = true; 
     
    4246                                                } 
    4347                                        ) 
    44                                         .click(    // click event 
     48                                        .click(      // click event 
    4549                                                function(event:Event):void { 
    4650                                                        $("#q").text(this.text); 
     
    5660                } 
    5761 
     62                // TextField change handler 
    5863                private function changeHandler(event:Event):void { 
    5964                        var f:GlowFilter = new GlowFilter(); 
     
    7176                ]; 
    7277 
    73                 // View XML 
     78                // An XML that markups the positions and properties of shapes and TextField. 
    7479                private var xml:XML =  
    7580                        <test.Rect width="400" height="410" x="10" y="10"> 
    7681                                <!--input space--> 
    7782                                <flash.text.TextField  
     83                                        text="Type CSS Selector:" 
     84                                        x="10" y="10" width="100" height="20" selectable="false"/> 
     85 
     86                                <flash.text.TextField  
    7887                                        id="q" type="input" 
    7988                                        text="RoundRect" 
    80                                         x="10" y="10" width="380" height="20" border="true"/> 
     89                                        x="120" y="10" width="270" height="20" border="true"/> 
    8190 
    8291                                <!--shapes--> 
     
    121130                                <test.Rect 
    122131                                        id="ex" 
    123                                         x="280" y="50" width="100" height="340" color="0xeeeeff"/> 
     132                                        x="270" y="50" width="120" height="340" color="0xeeeeff"/> 
    124133                        </test.Rect>; 
    125134        }