Thanks guys, I actually didn't know that you could assign different variables values to different instances of the same object, because some options carry across all instances and that got me confused.
Back to the topic, I managed to do what I wanted using an array and an instance variable, assigning a different value to each instance (ID):
<img src="http://i.imgur.com/73QtH.jpg" border="0" />
Probably isn't the absolute best way, but at least I understand how this one works. The downside is that I have to copy and edit that part for each star on the level, but since there aren't many (1-3) I guess it's ok.
Also, right now I cannot save the array information since there isn't a way to do it, webstorage is just for variables I think, so I'll have to wait to implement a save system that saves the stars count on each level (which are stored in the array). Suggestions are very welcome.