SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Texas
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Scrolling External Text

    I have external text loading into a dynamic text box and there are scroll buttons to the right. That part works fine.

    My question: Is it possible to make those scroll buttons disappear if they are not needed - i.e. there is only one line of text?
    Are you an 80s child?
    http://www.80schildren.com

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes its possible, is this a custom scroll bar or the one that MM put out? Regardless you should be able to set the ._visible property on it to false if the maxscroll proeprty for the textfield is not greater than 1. Meaning there is no scrolling needed.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Guru MG315's Avatar
    Join Date
    Mar 2003
    Location
    Houston, Texas
    Posts
    758
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Texas
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I'm relatively new at coding, but very excited that this can work! Would you mind giving me the code for the ._visible property assuming my textbox is named "clipeventscroll"? And does the action go on the scroll buttons (custom, not MM's btw) or on the frame?

    I did try to go through the actionscripts tutorial, MG, but I definitely don't want my text editable. But I couldn't figure out where that part was for me to remove it, so I gave up.

    Thanks so much for all your help already! I truly appreciate it!
    Are you an 80s child?
    http://www.80schildren.com

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how are you loading the external text for the textfield? Is this for MX or 5?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Texas
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is MX and I am loading the file by an action in the frame:
    Code:
      loadVariables("home.txt", this);
    and the scroll buttons have these actions
    Code:
     onClipEvent (enterFrame) {
    	if (scrolling) {
    		_root.clipeventscroll.scroll--;
    	}
    }
    and opposite for the down button.

    Does that help?
    Are you an 80s child?
    http://www.80schildren.com

  7. #7
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so I see a problem with the way you are loading the text in. With your method there is no real way to detect when the text has loaded. If you want my opinion, use LoadVars() object.

    To do so, give your text field an instance name and not a variable name. Then use

    Code:
    myVars = new LoadVars();
    myVars.load("home.txt");
    myVars.onLoad = function() {
      _root.textfieldinstancename.text = this.varnamefromtextfile;
     _root.textfieldinstancename.maxscroll < 1) _root.scrollbarinstance._visible = false;
    }
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  8. #8
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Texas
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are so great to be so patient with me.

    Here is the code I entered on a frame in the actions layer I created, but now the text does not load at all and in fact outputs the fonts I'm using for some reason.

    Code:
    myVars = new LoadVars();
    myVars.load("home.txt" );
    myVars.onLoad = function() {
     _root.clipeventscroll.text = this;
     _root.clipeventscroll.maxscroll < 1) _root.button1._visible = false;
     _root.clipeventscroll.maxscroll < 1) _root.button2._visible = false;
    }
    varnamefromtextfile <- I took that out because I'm not sure what it means. Is that the key to the puzzle?

    I also used two of the maxscroll statements because I have two buttons on the stage. Is that fine or should I make the two buttons a movie clip?

    And "clipeventscroll" is the instance name for the dynamic text box and "button1" and "button2" are the instance names of the scrolling buttons.
    Are you an 80s child?
    http://www.80schildren.com

  9. #9
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What does the text file look like? Something Like
    Code:
    myVars=fghl kfglfd lfdgfljkg kxfg lkjxfgjkfx kfnbvkfxbvk jfxvbkfb kfxjnbgkjfxgnb jfkg
    fsgv hfglkj flkjfh gklfsgk jsflgkjs flkgjfsdl jg
    f gfkjsgh kjfshgkjfshg kjfsgh kjfshkjfg kjfsgkjfsg
    ? if so myVar is what you would put in for varnamefromtextfile

    Code:
    myVars = new LoadVars();
    myVars.load("home.txt" );
    myVars.onLoad = function() {
      _root.clipeventscroll.text = this.myVar;
      _root.clipeventscroll.maxscroll < 1) _root.button1._visible = false;
      _root.clipeventscroll.maxscroll < 1) _root.button2._visible = false;
    }
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

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