TextFieldX

From Noisebridge
(Difference between revisions)
Jump to: navigation, search
(Created page with "A ßêãµ project <pre> package { import flash.html.HTMLLoader; import flash.net.URLRequest; import flash.display.Sprite; public class HTMLLoaderX extends Sprite ...")
 
Line 2: Line 2:
  
 
<pre>
 
<pre>
package  
+
package
 
{
 
{
import flash.html.HTMLLoader;
 
import flash.net.URLRequest;
 
 
import flash.display.Sprite;
 
import flash.display.Sprite;
 +
import flash.text.TextField;
 +
import flash.text.TextFormat;
 
 
public class HTMLLoaderX extends Sprite
+
public class TextFieldX extends Sprite
 
{
 
{
public var html:HTMLLoader;
+
public var txt:TextField;
+
public var tf:TextFormat;
private var url:String = "http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html";
+
  
public function HTMLLoaderX()  
+
public function TextFieldX()
 
{
 
{
html = new HTMLLoader();
+
tf = new TextFormat("_typewriter"); // Courier New
html.width = stage.stageWidth;
+
txt = new TextField();
html.height = stage.stageHeight;
+
txt.width = 640;
html.load(new URLRequest(url));
+
txt.height = 960;
addChild(html);
+
txt.text = "HelloWorld!";txt.setTextFormat(tf);
 +
addChild(txt);
 
}
 
}
  
Line 26: Line 26:
 
 
 
}
 
}
 +
 
</pre>
 
</pre>

Revision as of 15:31, 7 April 2013

A ßêãµ project

package
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	public class TextFieldX extends Sprite
	{
		public var txt:TextField;
		public var tf:TextFormat;

		public function TextFieldX()
		{
			tf = new TextFormat("_typewriter"); // Courier New
			txt = new TextField();
			txt.width = 640;
			txt.height = 960;
			txt.text = "HelloWorld!";txt.setTextFormat(tf);
			addChild(txt);
		}

	}
	
}

Personal tools