Knowledge Base |
Accordion (Tree) Menu V3
(views: 25390)
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 AccordionTreeMenuV3 on stage in runtime?
(2007-11-15 - views: 6982)
Q: How do I add the AccordionTreeMenuV3 on stage in runtime?
A: Here is the script you have to adapt to your project.
var acc:AccordionTreeMenuV3;
//create a listener, to find when the button is pressed
var lis = new Object()
buttonOne.addEventListener("click", lis)
lis.click = function (event:Object)
{
// 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)
removeMovieClip(acc)
// we create the menu.
acc = this.attachMovie("AccordionTreeMenuV3","acc",this.getNextHighestDepth())
// 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(100)*350
}
var acc:AccordionTreeMenuV3;
//create a listener, to find when the button is pressed
var lis = new Object()
buttonOne.addEventListener("click", lis)
lis.click = function (event:Object)
{
// 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)
removeMovieClip(acc)
// we create the menu.
acc = this.attachMovie("AccordionTreeMenuV3","acc",this.getNextHighestDepth())
// 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(100)*350
}
User Comments
Hi!
posted by Mike9823 on 2008-02-26
i need example for this question, because i try to make this and do not work.. thanks
Place the component into the Library
posted by negush on 2008-02-27
In order for the above code to work, you need to have the component into your project's Library and have a .xml file called buttonOneXML.xml in the same folder with your flash file.
Trouble embedding fonts at runtime
posted by mlandfield on 2009-01-22
For some reason, I can't seem to embed my chosen fonts at runtime when I use this script. I am able to set all of the other properties correctly. Do I need to use the embedFonts property within a onDrawComplete event handler? Please help.
Trouble embedding fonts at runtime
You need to have that font embedded in the Library, otherwise it will not be found in your Flash clip and the menu will not be able to use it. Here is a tutorial on how to embed fonts in the Library: http://www.jumpeyecomponents.com/publicfiles/tutorials/embeding_fonts.htm.
posted by negush on 2009-01-23
@mlandfieldYou need to have that font embedded in the Library, otherwise it will not be found in your Flash clip and the menu will not be able to use it. Here is a tutorial on how to embed fonts in the Library: http://www.jumpeyecomponents.com/publicfiles/tutorials/embeding_fonts.htm.
Login to post your comment









