Jump to content

Assign scrollbar to multiple dynamic textbox


Recommended Posts

HiI created multiple textfields dynamically using action script and assigned scrollbar to each of them,that too dynamically.But the problem is that scrollbar is visible to only the last text field.Other textfields can be scrolled through mouse scroll button.How can i make visible all scroll bars?my code is given below

var comment='testing';for(var i=0;i<3;i++){comment=comment+i;var dynamicText="dynamicText"+i;var dScrollbar="dScrollbar"+1;this.createTextField(dynamicText, i, x,y, 200, 50);y=y+40;this[dynamicText].wordWrap = true;textFormat = new TextFormat();textFormat = this[dynamicText].getTextFormat();textFormat.color = 0xCC3366;textFormat.size = 24;this[dynamicText].setNewTextFormat(textFormat);//this.getNextHighestDepth()//dynamicText.TextFormat(size=16);this.createClassObject(mx.controls.UIScrollBar,dSc rollbar,20);this[dScrollbar].setStyle(haloOrange);// Set the target text field for the scroll bar.this[dScrollbar].setScrollTarget(this[dynamicText]);this[dScrollbar].setSize(i, this[dynamicText]._height);// Move it next to the text field.this[dScrollbar].move(this[dynamicText]._x + this[dynamicText]._width, this[dynamicText]._y);//trace(this[dScrollbar]._targetInstanceName);this[dScrollbar].setScrollTarget(this[dynamicText]);this[dynamicText].text = comment;}

Link to comment
Share on other sites

Try to give the scrollbar a variable name.

dScrollbar = this.createClassObject(mx.controls.UIScrollBar,dSc rollbar,20)

and then instead of useing this[dScrollbar]. just call the scrollbar by dScrollbar.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...