Changeset 11
- Timestamp:
- 02/19/08 11:56:31 (11 months ago)
- Files:
-
- Theme-1/nobu/Base.as (modified) (3 diffs)
- Theme-1/nobu/Panel.as (modified) (2 diffs)
- Theme-1/nobu/theme-notifier.fla (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Theme-1/nobu/Base.as
r10 r11 37 37 } 38 38 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 39 51 private function onOpen(evt:Event):void 40 52 { … … 67 79 if (items.length > 0) 68 80 { 69 var p:Panel = addChild(new Panel()) as Panel; 70 p.initialize(items[index++]); 81 showRSS(); 71 82 } 72 83 } … … 76 87 trace(evt); 77 88 } 78 79 override protected function sleep(evt:Event):void80 {81 super.sleep(evt);82 }83 89 } 84 90 } Theme-1/nobu/Panel.as
r10 r11 3 3 import flash.events.Event; 4 4 import flash.text.TextField; 5 import flash.text.TextFieldAutoSize; 5 6 import flash.text.TextFormat; 6 7 import lib.display.MovieClipExt; … … 8 9 public class Panel extends MovieClipExt 9 10 { 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) 16 12 { 17 13 p_args = p_args || {}; 18 14 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); 20 44 } 21 45 }
