Buttons and Scrollbar Component question...

philthomas
philthomas used Ask the Experts™
on
Hi, I'm having the most difficult time with this and I'm hoping I can get a hand with it...this is a 2 part question, so please bear with me.

PART I:
I have buttons throughout my flash movie that trigger MC's to load that have text content. Everything works well except one thing; when I click the buttons and then click them again I have a strange thing happen...my text fields have a component scrollbar with them and when I click the button a second time the scrollbar gets all screwed up. I have the scrollbar set to be a certain length but the second button click makes it tiny and really useless (not to mention really unprofessional looking). So my question becomes how can I click a button once and then disable it until I click another button? I already have a code that will turn the button off, but it's not what I need. I want each button, when clicked, to simply not respond to mouse clicks, but I need it to still be 'a button' and respond to rollOver's and rollOut's...any ideas??

PART II:
As I mentioned above, I'm using component scrollbars in my movie. I have numerous text files that I am importing which are of various lengths. I'd like to know how I can get the scrollbar to recognize if a text file is too long for my dynamic text box's size and to be visible if the text is indeed too long for the box and of course to be invisible if it is not needed. Right now I have (very amteurishly) turned the scrollbar on or off with the _visible ='s script by manually testing each text file within my movie but I'd rather have a script that will recognize if the scrollbar is needed or not. Obviously at this point I don't know how to script something like that at all and of course I'd like to learn what to do, so could anyone point me to a tutorial or share their experience with this kind of situation with me?

Thanks for reading, have a good day.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
test_btn.enabled = false; //To disable a button...

if yuo want other event to still trigger..

have a gobal variable named current_btn

in your btn clip, have something like this:

test_btn.onRelease = function()
{
if (_root.current_btn != this)
{
  //blah blah blah
}
else
{
   _root.current_btn = this;
}
}

-X

Author

Commented:
Sorry for the long wait between answers, but I had to get away from my computer during this long weekend. :D

Your answer has opened some doors to me and I appreciate that but I'm still foggy on how to implement this in my movie.  I've decided to get rid of the buttons and make buttons out of MC's, which as I've read over the weekend will be much more flexible for my purposes.  I'm hoping you could explain how a global variable will work?  Does it work like  a regular function where I can have the main script in one frame and then call that script anywhere else with the functions name?  Sorry if I sound amatuerish, but I am indeed a newbie.
Commented:
Hey dude,

   Sorry for all the typos... I think I was smashed at the time :O

anyways,

for the button question, what I meant was,
a)have a global variable named current_btn which stores the "name" of the current button clicked.
b)In you onRelease, check if this "current_btn" variable is equal to the current button a.k.a this

_root.currentbtn = null;
_root.button1_btn.onRelease() = function()
{
   if (_root.currentbtn != this)
   {
      _root.currentbtn = this;
      //do your thing
   }
}

Hope that made sense...

-X

Author

Commented:
Ah, yeah that makes more sense, thanks Xenophon.  Last night I worked out a solution to my button issue but it only solved half my problems.  Do you know how I can prevent the movie from resizing itself to the size of the stage instead of remaining at 100% of the browser when I click a button calling for a text file to be loaded dynamically?  I know it's the text doing that but I have no idea how to solve it and I actually had no idea it would do that when I was designing the movie, I would have done things differently.  

Commented:
Phil,

   I'll have to see it to know what you are talking about :P If you can please post the swf some where on the web...
Cheers
-X

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial