dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8]How to add text scroller in textfield.

  1. #1
    Member
    Join Date
    Nov 2008
    Posts
    49

    [F8]How to add text scroller in textfield.

    Hi,

    I have made a dynamic web page that takes its text from external xml file. Its working perfect but I cant add scroller in the text field that scrolls the text when it is more than the text field. Anybody plz tell me how can I add scroller in the text field.

    Best Regards,

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    example code (text hardcoded here, for external text use a LoadVars or XML object onLoad function)

    PHP Code:
    // on stage
    // dynamic textfield - instance name - textF
    // UIScrollbar - instance name - myScroller - drag onto textfield
    // Button - instance name - btn

    function test1(){
    textF.text "";
    for(var 
    n=0;n!=100;n++) textF.text += "test1 "+n+newline;
    scrollIt();
    };

    function 
    test2(){
    textF.text "";
    textF.text "test2"+newline+"test2";
    scrollIt();
    };

    scrollIt = function(){
    textF.maxscroll ?
    myScroller._visible true :
    myScroller._visible false;
    };

    test1();

    // after text is assigned to a textfield you can check the 
    // textfields maxscroll property.  if it's greater than 1, 
    // your textfield needs to scroll to display all its contents.

    // test with a button instance - btn
    btn.onRelease = function(){
    bool = (pressed=!pressed) ? test2() : test1();


  3. #3
    Member
    Join Date
    Nov 2008
    Posts
    49
    Thank you so much bro, you are always so helpful
    I am gonna try it now.

    Regards,

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center