1 Reply Latest reply on Oct 20, 2010 2:56 AM by bradt8

    TextFields in Custom Class

    bradt8

      I trying to create a TextField in a Actionscript file, But when I try to create an instance of the class in flash no textfield is appearing. Am I doing this correct?

       

      package parts{

           import flash.text.TextField;

           import flash.text.TextFormat;

           import flash.display.MovieClip;

       

           public class Bcard extends MovieClip{

                //private var dis_txt:TextField;

       

                public function Bcard(){

                //Display Box for displaying numbers.

                var dis_txt = new TextField();

                dis_txt.x = 20;

                dis_txt.y = 20;

                dis_txt.width = 285;

                dis_txt.height = 45;

                dis_txt.visible = true;

                dis_txt.background = true;

                dis_txt.border = true;

                var dis_for = new TextFormat();

                dis_for.font = "Verdana";

                dis_for.size = 27.5;

                dis_for.bold = true;

                dis_for.color = 0xFF0000;

                dis_for.align = "right";

                dis_txt.defaultTextFormat = dis_for;

                addChild(dis_txt);

                dis_txt.text = "Hello World";

                trace("Hello World");

                }

           }

      }

       

      ---------------------

      import parts.*

      var myText:Bcard = new Bcard();

       

      any help would be great.