import flash.MovieClip; import flash.TextField; import flash.TextFormat; import haxe.Http; class TestRemote { static var tx : TextField; static var mc : MovieClip; static var bScrolling : Bool = false; static var testCounter : Int = 0; static function main() { mc = flash.Lib.current; mc.createTextField("tx1", 1, 0, 0, 300, 200); tx = Reflect.field(mc, "tx1"); tx.multiline = true; tx.wordWrap = true; tx.html = true; tx.htmlText = ''; var fmt : TextFormat = new TextFormat(); fmt.color = 0x000000; fmt.font = '_sans'; fmt.size = 12; tx.setTextFormat(fmt); mc.addChild(tx); mc.onEnterFrame = nextScroll; mc.onMouseDown = startScroll; mc.onMouseUp = endScroll; var x : Http = new Http('http://recipes.ordoacerbus.com/chumby/'); x.onData = gotData; x.request(false); } static function gotData(value : String) { tx.htmlText = value; } static function nextScroll() { if(bScrolling) { if(testCounter > 3) { if(mc._ymouse > 159) { if(tx.scroll < tx.maxscroll) { tx.scroll++; } } else { if(tx.scroll > 0) { tx.scroll--; } } testCounter = 0; } else { testCounter++; } } } static function startScroll() { bScrolling = true; } static function endScroll() { bScrolling = false; } }