Answers

Question and Answer:

  Home  Action Script

⟩ How to write a program use a text field and display it using the ActionScript?

- The ActionScript uses some APIs to create the objects to display it using the scripts and different functions.

- The text field is accessed and created using the following functions as shown below:

var hello:TextField = new TextField();

hello.text = "Hello World";

this.addChild(hello);

- The program that is written is complex and larger in size to be displayed at faster pace on the browser.

- The program show the use of text field in an object oriented manner with the help of IDE and other programs and it is shown as:

package com.example

{

import flash.text.TextField;

import flash.display.Sprite;

public class Greeter extends Sprite

{

public function Greeter()

{

var txtHello:TextField = new TextField();

txtHello.text = "Hello World";

addChild(txtHello);

}

}

}

 135 views

More Questions for you: