Can someone help me get on the path with this listener business?
I am trying to set up a listener to connect the menubar component (instance name menuBar) that ships with mx2004pro with Scotty’s resizing gallery, the multiple gallery version.
Here is the xml, which I’ve connected to with the connector component, and it populates the menu just fine.
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<menu-title label="Carved Basses">
<menu-item label="1975 Pollmann Busetto Model" action="0"/>
<menu-item label="1942 Mario Bedocchi" action="1"/>
<menu-item label="EM Pollmann 1968" action="2"/>
<menu-item label="Testore Model" action="3"/>
<menu-item label="Fully Carved Roundback" action="4"/>
<menu-item label="Hurst Five Eighths" action="5"/>
<menu-item label="Romanian Corsini Flatback" action="6"/>
<menu-item label="1820's French Flatback" action="7"/>
<menu-item label="1983 EM Pollmann" action="8"/>
</menu-title>
<menu-title label="Hybrids and Laminates">
<menu-item label="Romanian Hybrid" action="9"/>
<menu-item label="Romanian Plywood" action="10"/>
</menu-title>
<menu-title label="Shen Models">
<menu-item label="Grand Panormo" action="11"/>
<menu-item label="Rogeri" action="12"/>
<menu-item label="Rogeri Willow" action="13"/>
<menu-item label="Gumunder Willow Seven Eighths" action="14"/>
<menu-item label="Shen Willow Three Quarter" action="15"/>
<menu-item label="Shen Gamba Three Quarter" action="16"/>
<menu-item label="SB180 Hybrid" action="17"/>
<menu-item label="SB150 Hybrid" action="18"/>
<menu-item label="SB90 Blonde" action="19"/>
<menu-item label="SB100 Laminated" action="20"/>
<menu-item label="SB80 Laminated" action="21"/>
</menu-title>
</menu>
The AS for the multiple gallery is:
spacing = 0;
containerMC._alpha = 0;
var pArray = new Array();
var tArray = new Array();
var cur;
MovieClip.prototype.loadPic = function(pic) {
clearInterval(id);
containerMC._alpha = 0;
this.loadMovie(pArray[pic]);
cur = pic;
this._parent.onEnterFrame = function() {
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
bar._visible = 1;
per = Math.round((l/t)*100);
if (l== t && containerMC._width > 0&& containerMC._height > 0) {
var w = containerMC._width+spacing, h = containerMC._height+spacing;
border.resizeMe(w,h);
bar._visible = 0;
picinfo.info.text = tArray[pic];
delete this.onEnterFrame;
} else {
bar._height = per;
//gives the bar a max width 100
picinfo.info.text = per+" % loaded";
}
};
};
MovieClip.prototype.resizeMe = function(w, h, pic) {trace(w)
var speed = 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
arrowmc._x = (border._x-border._width)-47;
picinfo._y = nextb._y-5;
picinfo._x = border._x-picinfo._width/2;
shadowFollow();
if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
this._width = w;
this._height = h;
containerMC._x = this._x-this._width+spacing/2;
containerMC._y = this._y-this._height/2+spacing/2;
containerMC._alpha = 100;
delete this.onEnterFrame;
}
};
};
function galleryChoice(a) {
cur = 0;
pArray = new Array();
tArray = new Array();
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
if (success) {
var gallery = this.firstChild.childNodes[a];
title_txt.text = gallery.attributes.title;
info1.text = gallery.attributes.info1;
info2.text = gallery.attributes.info2;
info3.text = gallery.attributes.info3;
info4.text = gallery.attributes.info4;
info5.text = gallery.attributes.info5;
info6.text = gallery.attributes.info6;
info7.text = gallery.attributes.info7;
setuptitle.text = gallery.attributes.setuptitle;
setup1.text = gallery.attributes.setup1;
setup2.text = gallery.attributes.setup2;
setup3.text = gallery.attributes.setup3;
setup4.text = gallery.attributes.setup4;
setup5.text = gallery.attributes.setup5;
setup6.text = gallery.attributes.setup6;
for (var i = 0; i<gallery.childNodes.length; i++) {
tArray.push(gallery.childNodes*.attributes.title);
pArray.push(gallery.childNodes*.attributes.source);
}
//loading first picture
id=setInterval(containerMC,"loadPic",100,0);
} else {
title_txt.text = "Error!";
}
};
gallery_xml.load("bass_gallery.xml");
}
this.arrowmc.prevb.onRelease = function() {
if (cur == 0) {
containerMC.loadPic(pArray.length-1);
} else {
containerMC.loadPic(cur-1);
}
};
this.arrowmc.nextb.onRelease = function() {
trace(cur);
if (cur == pArray.length-1) {
containerMC.loadPic(0);
} else {
containerMC.loadPic(cur+1);
}
};
galleryChoice(0);
for (var i = 0; i<3; i++) {
var btn = this["but"+i];
btn.id = i;
this.menu.onRelease = function() {
galleryChoice(id);
};
}
I can’t figure out how to get the menubar selection to fire the galleryChoice, all my attempts have been a mess. Any help greatly appreciated!