In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

TextField Sample

Get Adobe Flash player
by goh 22 Feb 2010
/**
 * Copyright goh ( http://wonderfl.net/user/goh )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/jk5t
 */

package {
	import flash.display.Sprite; 
    import flash.text.*;

    import flash.events.MouseEvent; 
 
    public class TextWithImage extends Sprite 
    { 
        private var myTextBox:TextField = new TextField(); 
        private var myText:String = "Hello World! \nI'm a sake brewer."; 
 
        public function TextWithImage() 
        {
        		myTextBox.type = TextFieldType.INPUT;  
            myTextBox.text = myText; //
            myTextBox.width = 100; 
            myTextBox.height = 20; 
            myTextBox.multiline = true; 
            myTextBox.wordWrap = true; 
            myTextBox.background = true; 
            myTextBox.border = true; 
            myTextBox.scaleX = 4;
            myTextBox.scaleY = 3.5;
            myTextBox.x = 150;
            myTextBox.y = 70;
            myTextBox.backgroundColor = 0x336699;
            myTextBox.rotationX = 0;
            myTextBox.rotationY = 0;
            myTextBox.rotationZ = 45;
            myTextBox.alpha = 0.7;
            
            
            var format1:TextFormat = new TextFormat();  
            format1.color = 0x333333; 
            format1.size = 9;
            var format2:TextFormat = new TextFormat(); 
            format2.color = 0xff0000; 
            format2.size = 12;
            
            myTextBox.setTextFormat(format1);
            myTextBox.setTextFormat(format2,myText.length -12,myText.length);
            addChild(myTextBox);
            myTextBox.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownScroll);
        }
        
        public function mouseDownScroll(event:MouseEvent):void 
        { 
            myTextBox.scrollV++; 
        } 
 
    } 

}