I am trying to create a dynamic textbox that can be dragged around the screen using AS3. The problem is that I need a scroll bar on the text box because of the amount of text. I can build the text box and have attached the scrollbar component and turned it all into a movieclip. However, when I make the movieclip draggable, he scrollbar becomes inoperable. If I just make the text box draggable inside the movieclip, then the scroll bar works, but not draggable and I get an error "Error #1069: Property stopDrag not found on flash.text.TextField and there is no default value."
How do I create a draggable text box that has a scroll bar attached?
build the text box and attach the scrollbar component and turned it all into a movieclip.
but don't assign mouse listeners to the movieclip. create a child movieclip that has a dragbar or titlebar or something else that looks draggable (like a windows or mac application window). assign your mouse listeners to that titlebar.
I tried that, I think. My Movie clip is Transcript_mc. Inside that is the textbox (myTextBox) and Scrollbar and a font resizing bar (fontBar). I set the fontBar as draggable
but all that did was make the fontBar detach from the text box and the text box and scroll bar stayed where they were.
By "child movieclip" do you mean a movieClip inside the Transcript_mc, or even one deeper?
Just in case I was misunderstanding. I also tried nesting the Transcript_mc movieClip inside a test MovieClip. That had the same effect.
The arrows of the scrollbar component work because those are mouse clicks. But the scrollbar doesn't work because any drag function by the mouse is overridden.
Okay, that makes more sense. So you put the listener on the child Object, but tell the Parent to do the dragging. I had set up the listener on the child, but also was telling the child to drag.
Thanks for the help.
correct you want the child to listen for mouse events. if you assign mouse events to the parent that will prevent the children from detecting mouse events (unless you enable the capture parameter of the listener).