Hello,
I’m tearing my hair out over this! I’m trying to emulate a flash accordion where one menu item is clicked and the others slide to the opposite end of the stage.
It’s the movement of the menu strips which is causing me problems.
Here’s a link to where I’ve got to
http://www.iconymous.com/clients/andy/slider/
And here’s my script. It’s probably not very sophisticated so any help would be appreciated!
/////////////////////////////// XML LOADING ///////////////////////////////
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function(loaded) {
if (loaded) {
currentCount = 2
currentpage = "SECTION TWO"
_level0.storyBoard.attachMovie("numBoxHolder", "numBoxHolder", 49)
storyBoard._x += 68
loadMenu();
loadSlides()
whenLoaded()
} else {}
}
xmlData.load("slideshow.xml");
/////////////////////////////// LOADSLIDES ///////////////////////////////
function loadMenu() {
items = xmlData.firstChild.childNodes;
menu_count = 0;
initmX = 0;
initmY = 0;
//this bit determines which Slideshow Node is being used
for ( i = 0; i<items.length; i++) {
menu_count++;
var menuBox = this.attachMovie("menubox","menubox" + menu_count, menu_count+10);
menuBox._x = initmX;
menuBox.menu_count = menu_count;
initmX +=34;
if (this.menu_count != currentCount){
menuBox.onPress = menubtnOnPress;}
//getPage();
//getNumBoxes()
//trace(xmlData.firstChild.childNodes*.attributes.pagename)
//trace(items*.attributes.pagename)
menuBox.menuBoxStrip.menu_txt.text = items*.attributes.pagename
var my_color:Color = new Color(menuBox.menuBoxStrip.bgMenuBoxStrip);
my_color.setRGB(items*.attributes.color); // my_mc turns red
if (menuBox.menu_count > currentCount){
menuBox._x += 800
}
if (menuBox.menu_count < currentCount){
menuBox._x -= 0
}
}}
//////////////////////////////
//////////////////////////
function loadSlides() {
items = xmlData.firstChild.childNodes;
//this bit determines which Slideshow Node is being used
for ( i = 0; i<items.length; i++) {
if (items*.attributes.pagename == currentpage) {
//if (items*.attributes.pagename == "Home") {
xmlNode = xmlData.firstChild.childNodes*;
//trace(xmlData.firstChild.childNodes*)
image = [];
description = [];
strap = [];
total = xmlNode.childNodes.length;
getNumBoxes()
}
}
//////////////////////////
}
function btnOnPress(){
whenLoaded();
}
function btnOnRollover(){
p = this.item_count-1;
}
function menubtnOnPress(){
currentpage = this.menuBoxStrip.menu_txt.text
currentCount = this.menu_count
unloadMovieNum(49)
_level0.storyBoard.attachMovie("numBoxHolder", "numBoxHolder", 49)
if(this._x > 400){storyBoard._x = this._x -766}else {storyBoard._x = this._x+34}
loadMenu();
loadSlides();
//this._alpha = 20
whenLoaded()
}
/////////////////////////////////////GETNUMBOXES
function getNumBoxes() {
p=0;
var item_count = 0;
var initX = 10;
var initY = 460;
for (z=0; z<total; z++) {
image[z] = xmlNode.childNodes[z].childNodes[0].firstChild.nodeValue;
description[z] = xmlNode.childNodes[z].childNodes[1].firstChild.nodeValue;
strap[z] = xmlNode.childNodes[z].childNodes[2].firstChild.nodeValue;
item_count++;
var numBox = _level0.storyBoard.numBoxHolder.attachMovie("numBox","box" + item_count, item_count);
numBox._x = initX;
numBox._y = initY;
numBox.item_count = item_count;
numBox.num_txt.text = item_count;
numBox.onPress = btnOnPress;
numBox.onRollOver = btnOnRollover;
numBox.onRollOut = btnOnRollout;
initX +=30;
}
}
/////////////////////////////////////
this.onEnterFrame = function() {
filesize = storyBoard.picture.movingpicture.pix.getBytesTotal();
loaded = storyBoard.picture.movingpicture.pix.getBytesLoaded();
storyBoard.preloader._visible = true;
if (loaded != filesize) {
storyBoard.preloader.preload_bar._xscale = 100*loaded/filesize;
}
else {
storyBoard.preloader._visible = false;
if (storyBoard.picture.movingpicture.pix._alpha<100) {
storyBoard.picture.movingpicture.pix._alpha += 25; }
}
}
function whenLoaded() {
if (loaded == filesize) {
storyBoard.picture.movingpicture.pix._alpha = 0;
storyBoard.picture.movingpicture.pix.loadMovie(image[p], 1);
picture_num();
storyBoard.picture.gotoAndPlay(1);
storyBoard.strap_txt.text = strap[p];
storyBoard.bgstrip.gotoAndStop(1);
storyBoard.bgstrip.strip.imagetitle_txt.htmlText = description[p];
}
}