PDA

View Full Version : using dynamic input fields to manipulate MC


alimat
07-07-2005, 03:27 PM
I need some help with this MC. I have setup a time machine that reads from an XML doc.

On stage there are 2 dynamic input fields they are called numbers_txt, time_txt and previous and next buttons that will enble me to select a task that will allow the earth to rotate round the sun.

this has to be calculate through 365 day in the year.

1. You can select 1, 2, 3, 4 ,5 to 28 from numbers_txt
2. You can select Day Month Year from time_txt
3. A go button called go_btn.

for example 1 day will allow the earth to move 5 degree around sun, 2 days will move the earth 20 degrees around sun and so on.

how can I do this

thanks slaine

could someone point me in the right direction.

The code that I have done so far looks like this

// ///////////XML Loader////////////////
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("timemachine.xml");
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
dayid = [];
day = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
dayid[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
day[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
trace(dayid+" "+day);
firstDayid();
firstTime();
} else {
content = "file not loaded!";
}
}
// /////////Listener Object and button functions///////////////
Dayid = new Object();
Time = new Object();
Go = new Object();
Day.addListener(dayid);
Time.addlistener(time);
Go.addlistener(go);
prevdayid_btn.onRelease = function() {
prevDayid(dayid);
};
nextdayid_btn.onRelease = function() {
nextDayid(dayid);
};
prevtime_btn.onRelease = function() {
prevTime(time);
};
nexttime_btn.onRelease = function() {
nextTime(time);
};
go_btn.onRelease = function() {
};
// //////////Function that display to input box//////////////
p = 0;
function nextDayid() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
numbers_txt.text = dayid[p];
}
}
}
function prevDayid() {
if (p>0) {
p--;
numbers_txt.text = dayid[p];
}
}
function firstDayid() {
if (loaded == filesize) {
numbers_txt.text = dayid[0];
}
}
q = 0;
function nextTime() {
if (q<(total-1)) {
q++;
if (loaded == filesize) {
time_txt.text = day[q];
}
}
}
function prevTime() {
if (q>0) {
q--;
time_txt.text = day[q];
}
}
function firstTime() {
if (loaded == filesize) {
time_txt.text = day[0];
}
}

alimat
07-08-2005, 07:59 AM
Is there any tutorials that will help me to design this?