PDA

View Full Version : Selection.setFocus Help


mcmcom
10-20-2004, 06:18 PM
Hi,

Did some reading about setFocus. But I am still having issues getting it to work

I would like my ScrollPane to receive focus once my movie has loaded.

I did this during the onLoad event of my scrollPane

Selection.setFocus(this);

however it doesn't work. Now I read about some problems and thought it MAY be the fact that the selection code runs before the pane is completely loaded but what i wanted to know is if I have a syntax problem or if it could be timing? Is the above code snippet correct? Or do I have to enclose THIS in quotes?

thanks
McM

silvernapalm
10-20-2004, 07:57 PM
it sounds like timing. Components load first, at least that is what I have been encountering. so the event onLoad is too late to apply it.
try removing the onLoad and set the inital selection to true

i was thinking---
just change the color of the item so it loads in as such and use a function to change it...like

function focus(textFormat){
textFormat.border=true;
textFormat.borderColor=0xff0000;
textFormat.onSetFocus=function(newFocus){
textFormat.borderColor=0xffcc00;
}
textFormat.onKillFocus = function(newFocus) {
textFormat.borderColor=0xff0000;

}
}
focus(fnText);
focus(lnText);
focus(pnText);
focus(emText);
focus(messText);

this way the inital object will load with that color and then you can use the funciton to reapply the colors you want.

mcmcom
11-01-2004, 06:56 PM
actually i believe that Selection.setFocus will NOT work with components. I tried and tried but to no avail. It will focus on clips, buttons, or text, but not a scrollPane :(

thanks.