What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
I’m trying to create a list of names, with corrosponding numbers within a scrollbox.
Gold = 1
Silver = 10
Bronze = 20
I’d like to have this information contained within a scrollable dynamic text box, however I have no clue how to put multiple variables into a text box.
I tried having a simple scrollbox with gold,silver,bronze typed manually, and dynamic scrollbox next to it to contain the number values. EX:
Gold | | 1 |
Silver | | 10 |
Bronze | | 20 |
…but I do not know how to make the dynamic text box load the variables for gold/silver/bronze individually, let alone to place them each on their own line.
(I’ve already created up/down arrow buttons to scroll both text boxes.)
How can I have a single text box load different variables, 1 variable per line?
OR, if that’s impossible (or impractical),
How can I achieve that effect with many text boxes?
I’ve made a dynamic text box (with variable “orearray”) that shows both item name and it’s variable quantity;
orearray = (“Iron” + \_root.iron newline “Gold” + \_root.gold)
It ultimately was an error with the font type. Solved now.
You can make your text box have a mask that only displays 1 line at a time. Add an event listener for a click on the text box to get ‘focus’ (optional) and add a scroll event to make the object that cointains your text move up or down each time the scroll wheel is turned. If that doesn;t make sense I can whip up an example for you.
As for displaying the text in the single text box to get a new line in a string you type "text1"+"\n"+"text2"
So for your example
var goldVar:uint = 1
var silverVar:uint = 10
var bronzeVar:uint = 20
textBoxText.text = "Gold “goldVar”\n"+"Silver “silverVar”\n"+"Bronze "+bronzeVar
Will display in a text box thats big enough
* * *
Scroll event should look like this.
public function mouseWheel(event:MouseEvent)
if (event.delta == 3)
yourMoveclipThatContainsYourText.y -= scrollYOffSetScrollSpeed;
if (event.delta == -3)
yourMoveclipThatContainsYourText.y += scrollYOffSetScrollSpeed;
Where scrollYOffSetScrollSpeed is the height of 1 line of your text box. Also add a if statement to make it so the person can’t scroll it any higher than the top text or any lower then the bottom text box.
You should stop editing and just replying by the way… Im answering your questions that you keep editing over. If someone else has a similar problem or similar questions it would be good if they could see what your asking so the answers i’m giving have context.
Sorry for all the edits. I appreciate the help, but I figured out a much simpler method;
Using: orearray = new Array("Gold"+\_root.gold newline "Silver"+\_root.silver +newline+"Bronze"+\_root.bronze)
and for the scroll, I essentially wanted to click buttons to scroll, rather than a mousewheel scroll.
Solved that by using
on my up/down buttons.
My main problem was the “newline”, and the “.scroll”. I had never used either before.