I am looking for the AS3 code for a textbox that scrolls by dragging similar to that on an iPhone. I DO NOT want a scroll bar. I just want to be able to scroll through the text by dragging it up and down or side to side. I haven't found any complete code for this anywhere online so if someone can give me the complete AS3 code for this, that would be awesome! Thanks!
you can simply turn off the scrollPolicies of a textArea Component:
//with a TextArea Component instance _ta on stage
_ta.verticalScrollPolicy = "off";
_ta.horizontalScrollPolicy = "off";
this will hide the UIScrollbar and make the dragging you described available by clicking down inside the textarea and moving your mouse accordingly
I'm not using a Textarea Component. I am using the Text Tool. Is there a way that I could just type the text, convert it to a movie clip, and make it scrollable by dragging? This is for an iPhone app if that helps.
right click your textfield>convert to symbol>movieclip.
add a mousedown listener that adds and enterframe loop which calls a function that scrolls your textfield based on mouse position and add a stage mouseup listener to terminate the loop.
tf.scrollV = Math.min(tf.maxScrollV,Math.max(0,Math.round(m*tf.mouseY+b)));
m = (y1-y2)/(x1-x2);
b = y1-m*x1;
no, you have to adapt that to your situation.
in all cases, you'll need a mask for you movieclip and to use that code there are some paramenters you need to define and a tween class (i used tweenlite) to add.
I would have to adapt it, I knew that much already but not how to do that exactly.
I am thinking I might just stop trying to make it draggable and just make pages using frames instead. That would be much easier for me, just not for the user. Thank you for the help you have given though! I will definitely come to you if I have other questions!