Adding a listener

hello!
i have a dynamic textbox (txtBox) in a mc, and two buttons to scroll up and down (scrollUp & Down)

here’s what i want to do:

the scroll buttons should remain invisible until the textbox is updated

i’m doing this with actionscript so i believe i cannot use the textboxe’s onChanged method, but have to set up a listener

ok, here’s what i have on teh first ferame of the mc:

// set buttons to invisible
scrollUp._visible = false;
scrollDown._visible = false;

// define listener
checkStatus = {};
checkStatus.onChanged = function(){
scrollUp._visible = true;
scrollDown._visible = true;
}

txtBox.addListener(checkStatus);

hmm, am i anywhere near the goal?
:-\

Wel, it’s working, no?

This should work, unless your using a dynamic text field, it won’t work though, only on Input TextFields.

scrollUp._visible = false;
scrollDown._visible = false;

myField.onChanged = function(){
scrollUp._visible = true;
scrollDown._visible = true;
}

ah, no it’s not working :frowning:

and yes, i’m using a dynamic textbox

i just thought: i could declare a variable to hold all the text that i’m loading, and if that variable is equal to something, THEN i could load the textbox and set the scroll buttons to visible

unless there’s a way of dong it without creating a new var

cheers so far (-:

Try anything other than onChanged. :-\

i now turn the scroll butons to visible within the function that loads the file (if it loads the file ok) - i don’t know why i didn;t think of that - it’s prety logical

so i got:
// function
loadText.onLoad = function(success) {
if (success){
// load text into text box
_root.text_mc.txtBox.text = this.fileText;
// and turn the scroll buttons to visible
_root.text_mc.scrollUp._visible=true;
_root.text_mc.scrollDown._visible=true;

sorry about that :A+: (more thought next time)

cheers

Glad you got it working. :slight_smile: