I just bought Flash and i'm trying some stuff in Flash building a Game in as2 but if I make a object that needs to add 5 points in the variable it doesnt go to 5 and it's stuck on 0 the whole time. Is it true that variables in as2 dont work for flash CS5?
Or, you could have the text box update every time the variable is changed. You could create a movie clip with the instance name "coin_mc" Then type this one the main stage:
coin_mc.onPress = function (){ _root.score += 5 _root.score_txt.text=_root.score }
If you choose to use the first option, simply remove the "_root.score_txt.text=_root.score" from the second, but use the rest.
Either make it go to the next empty frame in the timeline of the coin movieclip (if you are using one). Or just _root.coin.removeMovieClip(); or something similar, not 100% sure how it works in as2.
And I made a few more coins but if I hit one I get like 50 score because there 10 coins on my map, how can I fix that I only get 5 score and not all the scores once?
In response to your removal problem, removeMovieClip() only works with clips created in actionscript, such as using the attachMovie() function.
As for your second problem, this is because you have multiple movie clips with the same instance name. You probably gave the first movie clip an instance name and then copied the clip, without changing it. But for what you are doing, you do not need an instance name at all, so leave the clips unnamed.
You could always try attaching the instances of your coin movie clip, and holding a reference to each one in an array. If you have a predetermined set of coins, you would have to iterate through each manually and determine its placement. Otherwise you could randomly generate coins within a given set of parameters, then add it to an array with the push() function. If you want to see an example of what I mean, check out the Kongregate tutorial, especially sections 4 and 5 where they talk about adding enemies. You might be able to adapt it to what you are doing here.