How would I put buttons or checkboxes in a scroll pane so it will scroll. I tried adding them as children but they seem to be attached to the scrollpane but not inside. they do not scroll they just extend out of it?
Is the开发者_高级运维re a way to put content in a scrollpane besides text. The problem I'm trying to solve is dealing with a large number of checkboxes in a small area. The checkboxes are dynamically generated from the script.
Thanks, Dan
If you are talking about a standard scrollpane, then it should have a .source
property. If you add the name of your checkbox, it will get into the scrollpane.
Now, if you want to add complex content, I suggest you to create an empty movieclip and put that into the scrollpane. Anything you want to add to the scrollpane, add it to this movieclip.
//create your container
var mc:MovieClip = new MovieClip();
//you don't need to add it to the displaylist (addChild(mc))
//now set it as the source of your scrollpane
your_scrollpane.source = mc;
//any time you add a new item
mc.addChild(your_checkbox);
//you can set the properties
your_checkbox.x = 0;
your_checkbox.y = 0;
//and refresh the scrollpane
your_scrollpane.update();
You can also setup your mc before making it as the source of your scrollpane.
Hope this helps.
精彩评论