Sign in to follow this  
Genero

[web] Big problem with XML and ActionScript 2.0 Game development

Recommended Posts

Hello. I have a big problem. I have a mousecapture movieclip and xml attributes.x and attributes.y coordinates. I want to display randomly in every 7 seconds an attributes.item name and when clicked on the _root["box"+i].mcraadius add attributes.points to the score. The clicked point must give a points only when the attributes.item is equal to it. Also if do not click on the right point he gets minus score from the distance sqrt(a)+sqrt(b) = sqrt(c) attributes.item is town name and points are points displayed in xml file i have no clue how to connect them. I need : random item in 7 seconds connect item name with points distance from the mcraadius ( if the distance is farer it will be bigger minus points ) Can anyone help me please? Code: _root.mousecapture.onRelease = function(){ viga = -2; } swfArray = new Array(); var kaart_xml = new XML(); kaart_xml.ignoreWhite = true; kaart_xml.onLoad = function(success) { if (success) { var kaart = this.firstChild; Speed = kaart.attributes.speed; gametime = kaart.attributes.gametime; NUMOFPICS = kaart.childNodes.length; for (var i = 0; i<NUMOFPICS; i++) { swfArray.push(kaart.childNodes[i].attributes.item); mc.duplicateMovieClip("box"+i, i); _root["box"+i]._x = (Math.floor(kaart.childNodes[i].attributes.x)+15)-(kaart.childNodes[i].attributes.raadius/2); _root["box"+i]._y = (Math.floor(kaart.childNodes[i].attributes.y)+15)-(kaart.childNodes[i].attributes.raadius/2); _root["box"+i].mcraadius._width = kaart.childNodes[i].attributes.raadius; _root["box"+i].mcraadius._height = kaart.childNodes[i].attributes.raadius; //_root["box"+i].textfield.text = kaart.childNodes[i].attributes.item; X = (Math.floor(kaart.childNodes[i].attributes.x)+15)-(kaart.childNodes[i].attributes.raadius/2); Y = (Math.floor(kaart.childNodes[i].attributes.y)+15)-(kaart.childNodes[i].attributes.raadius/2); v = Math.sqrt(X)+Math.sqrt(Y); scored = Math.floor(kaart.childNodes[i].attributes.points); score.text = 0; _root["box"+i].mcraadius.onPress = function() { if (swfArray[timerarray]) {score.text = (Math.floor(score.text)+scored);} } } } } kaart_xml.load("linnad.xml");

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this