Important! All new questions are usually answered within the next business day.

Accordion (Tree) Menu V3

(views: 7272)

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

(2007-11-14 - views: 1224)

Q: I'm sure this is possible but I am just learning AS3 and I need to be able to add this component to the stage with a button click, passing in a variable that contains the xml for the menu. I have parsed a huge xml file in my class file and have broken it down into 4 new xml objects with each xml object being the navigation for each of the 4 buttons I have.

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.

A: Here is the script you have to adapt to your project.

import flash.events.MouseEvent

var acc:AccordionTreeMenuV3AS3;

//create a listener, to find when the button is pressed
buttonOne.addEventListener(MouseEvent.MOUSE_DOWN, buttonOnePress)
function buttonOnePress(event:MouseEvent)
{
    // 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)
{
    // 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 the width of it (initial is 100).
    acc.width = 200
   
    //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);
   
}


User Comments

That's almost what I need
posted by jbmurphy on 2007-11-14

I sincerely hope this is possible, but it might not be which would render this component useless for me in this application, but ... instead of an actual physical xml file I have an xml object that I have created through actionscript that traces out exactly as this component requires.

Please tell me that it is possible to do this with this component.
runtime add AccordianTreeMenuV3 for AS2?
posted by W on 2007-11-14

Can you show an example of how to add the AccordianTreeMenuV3 AS2 version of the component at runtime ? Many thanks....I didn't see an example yet.
AS2 version
posted by demiurgu on 2007-11-15

W

Se this :P

<a href='https://www.jumpeyecomponents.com/knowledgebase/Accordion-%28Tree%29-Menu-V3/How-do-I-add-the-AccordionTreeMenuV3-on-stage-in-runtime%3F~181/'>here</a>
Answer for jbmurphy
posted by demiurgu on 2007-11-15

Hi

You should use setXML(xmlObject:XML) method .

After you've added the component, instead of using the xmlPath parameter:
acc.xmlPath = xm;
you have to write this :
acc.setXML(xmlObject) where xmlOject is your xml object
That worked well, thank you.
posted by jbmurphy on 2007-11-15

Just a quick note for anyone who uses the component as I have, make sure that when you are creating an XML object in your class file that you give a "title" attribute to each item node, even if it's title="", otherwise you will get a setText() error.
perfectly true
posted by demiurgu on 2007-11-16

That's right

Thanks for bringing this to our attention. We will fix it in the next release :)
can i load .swfs into each XML node?
posted by acillustration on 2008-02-13

I bought this for a very specific project. The nav uses Arial and needs to have a significant amount of letter spacing. Your answer to my last question was that letter kerning was not possible with this component - with no solution. How can I work around this? could i load .swfs into each XML node? Can I alter anything with actionscript in the movie the component is loaded into? The beauty of working in flash is that nothing has to look like html anymore. I need a solution, please help!


Login to post your comment login to post your comment



Back

Knowledge Base Search

Enter keywords bellow:
Advanced Search

Menu

Special Offer

Special Offer - All in one Jumpeye Components bundle!

Get the JC Master Collection Now!

Free Trial Versions

The trial versions do have a major limitation. They will ONLY run into debugger flash player versions, such as the Flash IDE player and the activeX FP used by developers.

Switch from Free Trial version to Full version.

You can switch from Trial to Full versions in a blink of an eye.
See this tutorial in order to find out how.

We accept Google Checkout

Google Checkout Acceptance Mark

Secured by VeriSign