Changeset 11

Show
Ignore:
Timestamp:
02/19/08 11:56:31 (11 months ago)
Author:
nobu
Message:

ととりあえず動くよ

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Theme-1/nobu/Base.as

    r10 r11  
    3737        } 
    3838 
     39        private function showRSS(evt:Event=null):void 
     40        { 
     41            var p:Panel; 
     42            if (items.length <= 0) return; 
     43            if (index >= items.length) 
     44            { 
     45                index = 0; 
     46            } 
     47            p = addChild(new Panel(items[index++])) as Panel; 
     48            p.addEventListener(Event.REMOVED_FROM_STAGE, showRSS, false, 0, true); 
     49        } 
     50 
    3951        private function onOpen(evt:Event):void 
    4052        { 
     
    6779            if (items.length > 0) 
    6880            { 
    69                 var p:Panel = addChild(new Panel()) as Panel; 
    70                 p.initialize(items[index++]); 
     81                showRSS(); 
    7182            } 
    7283        } 
     
    7687            trace(evt); 
    7788        } 
    78  
    79         override protected function sleep(evt:Event):void 
    80         { 
    81             super.sleep(evt); 
    82         } 
    8389    } 
    8490} 
  • Theme-1/nobu/Panel.as

    r10 r11  
    33    import flash.events.Event; 
    44    import flash.text.TextField; 
     5    import flash.text.TextFieldAutoSize; 
    56    import flash.text.TextFormat; 
    67    import lib.display.MovieClipExt; 
     
    89    public class Panel extends MovieClipExt 
    910    { 
    10         public function Panel() 
    11         { 
    12             // do nothing. 
    13         } 
    14  
    15         public function initialize(p_args:Object=null):void 
     11        public function Panel(p_args:Object=null) 
    1612        { 
    1713            p_args = p_args || {}; 
    1814            title.htmlText = '<a href="'+p_args.link+'">'+p_args.title+'</a>'; 
    19             description.text = p_args.description.replace(/\r\n/g, "").replace(/\r/g, "").replace(/\n/g, ""); 
     15            title.autoSize = TextFieldAutoSize.LEFT; 
     16            description.autoSize = TextFieldAutoSize.LEFT; 
     17            description.text = p_args.description 
     18                                     .replace(/\r\n/g, "\n") 
     19                                     .replace(/\r/g, "\n") 
     20                                     .split("\n") 
     21                                     .join('') 
     22                                     .substr(0, 100) + '...'; 
     23        } 
     24 
     25        override protected function wakeUp(evt:Event):void 
     26        { 
     27            addEventListener(Event.ENTER_FRAME, slideDescription, false, 0, true); 
     28            super.wakeUp.call(this, evt); 
     29        } 
     30 
     31        private function slideDescription(evt:Event):void 
     32        { 
     33            description.x -= 5; 
     34            if (Math.abs(description.x) > description.width) 
     35            { 
     36                parent.removeChild(this); 
     37            } 
     38        } 
     39 
     40        override protected function sleep(evt:Event):void 
     41        { 
     42            removeEventListener(Event.ENTER_FRAME, slideDescription, false); 
     43            super.sleep.call(this, evt); 
    2044        } 
    2145    }