Knowledge Base |
Accordion (Tree) Menu V3
Accordion Menu V3 and Accordion Tree Menu V3 are xml flash accordion menus featuring customized states, customized transitions and tweens. Here are all known issues for Accordion Menu V3 and Accordion Tree Menu V3, they should be similar, since basically it is the same component. If you have any questions that you think we should discuss here please let us know.
How do I add the AccordionTreeMenuV3AS3 from class file to stage
So for example I have a button on stage called "buttonOne". I also have an XML object called "buttonOneXML". I would like to add the AccordionTreeMenuV3AS3 to the stage when "buttonOne" is pressed and tell it to use "buttonOneXML" as it's source.
Please help, this is a fairly urgent request and I cannot find any documentation on adding the component at run-time.
import flash.events.MouseEvent;
import com.jumpeye.Events.AccordionMenuEvents;
var acc:AccordionTreeMenuV3AS3;
//create a listener, to find when the button is pressed
buttonOne.addEventListener(MouseEvent.MOUSE_DOWN, buttonOnePress);
function buttonOnePress(event:MouseEvent):void
{
// when the button is pressed, we call de attachMenu function to create another AccordionTreeMenuV3AS3
attachMenu("buttonOneXML.xml");
}
// the function that attach a new AccordionTreeMenuV3AS3.
function attachMenu(xm:String):void
{
// if another menu already exist, we remove it.
if(acc != null)
this.removeChild(acc);
// we create the menu.
acc = new AccordionTreeMenuV3AS3();
// set the xml for the menu.
acc.xmlPath = xm;
//we set a random position, to know that a new menu was created.
acc.x = Math.random()*350;
//and finaly, we add the menu on the stage.
this.addChild(acc);
// we need to know when the menu has finished drawing itself on the stage,
// because only than can we set the width property (which does not exist
// until then).
acc.addEventListener(AccordionMenuEvents.DRAW, drawHdl);
}
// after the entire component has been drawn, we can set the width of the menu.
function drawHdl(evt:AccordionMenuEvents):void {
acc.width = 200;
}