The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 6 of 6

Thread: Need help regarding adding Textfield to Flash document

  1. #1

    Need help regarding adding Textfield to Flash document


  2. #2
    Ummmm...here you go:
    http://livedocs.adobe.com/flash/9.0/...TextField.html

    You're far more likely to get help if you provide specific details of what your problem is.
    2006-11 GlosRFC - Searching 8,168,684,336 brain cells

  3. #3
    dear which type of text field u want to put in flash doc.

  4. #4
    my friend abrarshf it is dynamic text field

  5. #5
    Read. The. Link. : )

  6. #6
    Hi glosrfc

    please find the RunningTest.as code below and it's working fine on document class but my problem is i want to reuse the code in flash action panel with new values to instance variables and i expected output according to that. and i am expecting like this please help me to find the solution.

    var txt:RunningText = new RunningText();
    txt.fName= "Times New Roman";
    txt.tMatter1 = "Some custom Text falls here";
    addChild(txt);
    ================================================== ====================
    The error is
    ================================================== ==================

    ---------------------------------------------------------------------------------------
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at RunningText$iinit()
    at RunningText_fla::MainTimeline/RunningTextRevised_fla::frame1()

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





    package {

    import flash.display.*;
    import flash.text.*;
    import flash.events.*;

    public class RunningText extends Sprite {

    public var tField1:TextField = new TextField();
    public var tField2:TextField = new TextField();
    public var tFormat1:TextFormat;
    public var tFormat2:TextFormat;
    public var fName:String = "Arial";
    public var fColor:uint = 0xCC00CC;
    public var fSize:int = 20;
    public var tMatter1:String = "There is no topic available. Use the Search or Table of Contents to locate the desired information.Use the Search or Table of Contents ";
    public var tMatter2:String = "The String class is a data type that represents a string of characters. The String class provides methods and properties. ";
    public var valueX:int = stage.stageWidth / 2;
    public var valueY:int = stage.stageHeight / 2;
    public var speed:int = 10;
    public var endX:int = -1;
    public var distX:int = 5;


    public function RunningText(){

    tFormat1 = new TextFormat(fName,fSize,fColor);

    tField1.multiline = false;
    tField1.autoSize = TextFieldAutoSize.LEFT;
    tField1.defaultTextFormat = tFormat1;
    tField1.text = tMatter1;
    addChild(tField1);
    tField1.x = valueX;
    tField1.y = valueY;

    tField2.multiline = false;
    tField2.autoSize = TextFieldAutoSize.LEFT;
    tField2.defaultTextFormat = tFormat1;
    tField2.text = tMatter2;
    addChild(tField2);
    tField2.x = valueX + tField1.width + 2 ;
    tField2.y = valueY;

    addEventListener(Event.ENTER_FRAME,eFrame);
    }

    function eFrame(e:Event){

    tField1.x -= speed;
    tField2.x -= speed;

    var bound1 = tField1.getBounds(root);
    var bound2 = tField2.getBounds(root);

    if (bound1.right <= endX) {
    tField1.x = bound2.right + distX;
    }

    if (bound2.right <= endX) {
    tField2.x = bound1.right + distX;
    }


    }
    }

    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012