Problem with scrollBar

Here is the dilemma, I think I need a second pair of eyes. Thats it! :thumb:

Seriously though, I have an issue with the scrollBar. It works fine, but when I come back to the frame, it literally shoots me an error message.

Imagine using just 2 frames. On frame 1, I have the following code:

var scrollBar:UIScrollBar = new UIScrollBar();
 //Create the scrollBar instance
			scrollBar.scrollTarget = displayTextBox;
			//make the height the same as the textfield
			scrollBar.height = displayTextBox.height;
			//Move the scrollbar to the righthand side
			scrollBar.move(displayTextBox.x + displayTextBox.width - 14, displayTextBox.y);
			//add it to the stage
			addChild(scrollBar);

Now on that frame 1, I have a textField with the name “displayTextBox”. So basically, I am just attaching the scrollBar to this textField. Imagine now, on Frame 1 a button that allows you to goto frame 2. So, you goto frame 2, and there is a button to go back to frame 1. So you click to go back to frame 1. Now, flash doesn’t recognize the textField “displayTextBox” any longer, and sees it as a NULL object. What is the deal with that?

If I remove the “addChild(scrollBar)”, going back and forth is fine, and I am able to “trace (displayTextBox)” which tells me that it is indeed a textField. When I attach the scrollBar, and try to “trace (displayTextBox)” after going from frame 1, to frame 2, and then back to frame 1; it tells me that the “displayTextBox” is NULL.

I am losing my mind, and have a feeling this is going to be a simple fix, but again I need that second pair of eyes :luigi:

Thanks!