My movie is a bit more complex then indicated above - but let me see if I can sort of outline what's going on.
am loading xml data into various arrays at first, then
using a for loop to add the appropraite data into the arrays
ie:
Code:
for (i=0; i<_root.mytotal; i++) {//this loads the data into the arrays//
mytitle[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
mymessage[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
mydate[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
pic1[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
pic2[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
pic3[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
then I define the variable I referred to in the previous posts:
Code:
_root.mycurrentchoice = _root.mytotal-1; //this variable is used for the prev and next buttons
I call a function called loaddata, and in this function I create the following:
Code:
var mc:MovieClip = invis_mc.attachMovie("mytitle", "mytitle"+k, _root.mydepth);
this basically loads a bunch of movieclips (which are dyn tb's which will display the values of an xml node) - it are these movie clips which I want to target as in my previous posts.
Later below the above code I define the onPress function for var mc. Which is:
Code:
mc.onPress = function() {
_root.MainMC._y = 109.1//as user uses the scrollbar - MainMC._y changes - this sets it back.
this.gotoAndStop(2);
deletehighlight();
deletehighlight = function() {
_root.currenthighlight.gotoAndStop(1);
}
_root.currenthighlight = this;
//this puts the new entries title and message int he appropriate fields in MainMC
thisdate.text = mydate[k]; //date
titlebarmove.thistitle_mc.thistitle.text = mytitle[k];//title
MainMC.mymessage.text = mymessage[k];//blog entry
MainMC.gotoAndPlay(2);//tells the blog entry to play
_root.lines.gotoAndStop(1);//displays the lines as each entry is clicked.
_root.mycurrentchoice = k //this variable is used for the prev and next buttons
... and then some other stuff... The important piece to see in this code is that when the mc movieclip is pressed - the value of k is assisgned to _root.mycurrentchoice.
So now lets talk about the prev and next buttons.
These are simple buttons that when pressed, I want the current mc movieclip to go to the previous and next entries. I have been able to code this so that all text boxes are filled in with the correct data.. But what I want is that when the prev or next button is pressed - I want the mc movieclip which is pressed to go to the second frame - and the mc movieclip which was previousy pressed - to go back to frame 1.
(basically frame 1 is the mc movieclip and frame 2 is the mc movieclip with a highlight - so user can see which mc movieclip is currently pressed).
Ok, I hope this is not getting confusing.
The prev and next buttons are on the main timeline and I use the variable _root.mycurrentchoice to indicate which mc movieclip was pressed (at least the k value) and to load the correct data in the text fields etc.. This is why I am trying to use the code which I have previously posted. I want to be able to take the mc movieclip - and when the user presses the prev button, send it back to frame one and send the mc movieclip which was just pressed to frame two.
ie:
string = "_root.invis_mc.mytitle" + (_root.mycurrentchoice -1);
string.gotoAndStop(2);
does this make sense?
Jonathan