Lists using something else than numbers for keys - ANSWERED


  • Posts: 65
Hello there,

Is it possible to create "List" type attributes that use something other than number for its keys?
More like an array, the key being a text, and the value a number or text as usual

 Something like:

List X:
bananas - 2
apples - 17
grapes - 0

(I could do it on code block but im not sure if then I caould use the array in other design mode blocks)

« Last Edit: January 07, 2012, 06:05:04 pm by docskull »


  • *
  • Posts: 4645
delimiters could be used to split single items in your list into names and quantities. For instance, "Apples,4" would tell SW that you have 4 apples by separating at the delimiter - a comma in this case.
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.


  • *
  • Posts: 3130
Choose Hectate's method if you want pure Design Mode. In case you're willing to use code, that is AS3, then there several ways to implement a dictionary/map, as it seems to be what you want.

Any Object acts as dictionary and you can also use AS3's Dictionary class. Stencyl's API also offers a class named HashSet.

Behaviors are declared as dynamic classes, which means you can add members on the fly (!).
"Find the fun"


  • Posts: 65
Thanks a lot guys, trying it right now.