ScrollRectのテスト

by Makoto_Tanaka
♥0 | Line 27 | Modified 2010-02-17 10:22:17 | MIT License
play

ActionScript3 source code

/**
 * Copyright Makoto_Tanaka ( http://wonderfl.net/user/Makoto_Tanaka )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/axIZ
 */

// DisplayObjectのscrollRectのテスト
// 作成途中(10.2.17)
//
package {
	import flash.geom.Rectangle;
	import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
			var scrollText1:ScrollText = new ScrollText(true);
            this.addChild(scrollText1);
        }
    }
    
    public class ScrollText extends Sprite {
    		private const WIDTH:Number = 100;
    		private const HEIGHT:Number = 20;
    		
    		private var _text:TextField;
    		
    		public function ScrollText(bClip_:Boolean):void {
    			this.graphics.beginFill(0xff0000, 0.2);
    			this.graphics.drawRect(0,0,WIDTH,HEIGHT);
    			this.graphics.endFill();
    			
    			_text = new TextField();
    			_text.text = "Hello World";
    			addChild(_text);
    			
    			if (bClip_) {
    				this.scrollRect = new Rectangle(0,0,WIDTH,HEIGHT);
    			}
    		}
    }
}