Knowledge Base

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

Accordion (Tree) Menu V3

(views: 20450)

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.



Go to different frames by pressing a menu item

(2008-10-24 - views: 4687)
Q: How can I go to a certain frame of my movie clip when I click on a menu item ?
A: Here is the AS3 code for this example. Just download the AS2 example, transform the AS2 file into an AS3 file and replace the AS2 component from the Library with the AS3 version. Inside the Actions panel, replace the AS2 code with the following one:

import com.jumpeye.Events.AccordionMenuEvents;

// Listen for the event dispatched when a menu item is pressed ().
accTree.addEventListener(AccordionMenuEvents.ITEM_PRESS, pressHandler);

function pressHandler(evtObj:AccordionMenuEvents):void {
    // We are accessing the 'frame' property on the child object and call
    // the useFrame() function that will make use of the frame variable.
    var frame:Object = (evtObj.item.frame != undefined) ? evtObj.item.frame : 0;
    useFrame(frame);
}

// The frame in the xml file cn be identified by its number or label, so
// the parameter passed to the useFrame() function, does not have an exact
// type.
function useFrame(frame:Object):void {
    frameNumber.text = "frame "+frame;
    gotoAndStop(frame);
}


User Comments

What if the menu is nested in a child movieclip?
posted by kryppled on 2008-10-24
Hello thank you very much for your help! My menu is located in a nested movie clip and I need to control the main timeline. I tried this with no luck.

import com.jumpeye.Events.AccordionMenuEvents;

// Listen for the event dispatched when a menu item is pressed ().
accTree.addEventListener(AccordionMenuEvents.ITEM_PRESS, pressHandler);

function pressHandler(evtObj:AccordionMenuEvents):void {
// We are accessing the 'frame' property on the child object and call
// the useFrame() function that will make use of the frame variable.
var frame:Object = (evtObj.item.frame != undefined) ? evtObj.item.frame : 0;
useFrame(frame);
}

// The frame in the xml file cn be identified by its number or label, so
// the parameter passed to the useFrame() function, does not have an exact
// type.
function useFrame(frame:Object):void {
this.parent.frameNumber.text = "frame "+frame;
this.parent.gotoAndStop(frame);
}

I also tried stage instead of this.parent with no luck..Thx you guys rock!
What if the menu is nested in a child movieclip?
posted by negush on 2008-10-27
It all depends to where "this" points to. Maybe you should try accTree.parent.parent.gotoAndStop(frame) in the useFrame() function.
Thank you so much!!!!
posted by kryppled on 2008-10-27
Duh, in AS3 parent child relationships can and did change cause of a loader. I will never use "this." again. I will be back for other components without hesitation. You have really helped me out. 1000% worth the money!! Bless B
Thank you so much!!!!
posted by negush on 2008-10-28
Indeed, in AS3, the "this" keyword points to the current class instance (in a class environment) or the stage (in the flash timeline), regardless of the function it is located in (regular function or event handler).

Glad I could help you out.
what would I change for Drop Down Menu?
posted by jcaseyo on 2009-02-10
I want to do this but for the Drop Down Menu, what would I alter, thanks!
what would I change for Drop Down Menu?
posted by jcaseyo on 2009-02-10
I want to do this but for the Drop Down Menu, what would I alter, thanks!
what would I change for Drop Down Menu?
posted by florodebat on 2009-02-11
Hello ,

All you have to do is to replace the Accordion Tree Menu component with the Drop Down Menu then give it an Instance Name . Also please make sure that it 's xmlPath parameter is set to the same xml like the Accordion Tree Menu.
AccordionMenuV3-AS3 - loading into content box.
posted by w46ch5 on 2009-02-28
Hi,
Sorry to bother you, I'm trying to load an external swf into a content container. I'm using Accordion Menu V3 (AS3) and Flash CS3, with Action Script 3. There is a related post in your knowledge base section for a similar question (for a Drop down Menu) with a code sample but I couldn't modify it it for AccordionMenu and after a couple of hours I decided to ask for help - I'm missing something! Is there any way you could post a working example - I'm sure it will help lots of other people like me.
Many thanks!
AccordionMenuV3-AS3 - loading into content box.
posted by florodebat on 2009-03-02
Hello,

That code should work for the AccordionMenuV3 to. You only have to import the AccordionMenuEvents instead of the DropDownMenuEvents. Also please make sure that you have metioned in the xml fle the "path " attribute .
So if you want to use that code for the AccordionMenuV3 component instead of DropDownMenu then the code should look like this:

import com.jumpeye.Events. AccordionMenuEvents;

// Create the loader object and add it inside the container_mc
// movie clip. This is not necessary, it could be placed directly
// on the root.
var contentLoader:Loader = new Loader();
addChild(contentLoader);

// Listen for the "onRelease" event, to know when a menu item
// has been selected.
myMenu.addEventListener( AccordionMenuEvents.ITEM_RELEASE, releaseHandler);

function releaseHandler(evtObj:AccordionMenuEvents):void {
// evt.item represents the selected menu item Each menu item
// has extra properties that are the actual xml node attributes.
if (evtObj.item.path != undefined) {
var request:URLRequest = new URLRequest(evtObj.item.path);
// If the menu item has an extra property called "path",
// then load the content found at that location.
contentLoader.load(request);
}
AccordionMenuV3-AS3 - loading into content box.
posted by w46ch5 on 2009-03-06
Thank you very much for your message!
I feel like an idiot, I'm missing something really simple but I can not find the cause of the problem. I've followed your instructions and I'm still getting output error messages:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.jumpeye.menu::AccordionMainMenu/com.jumpeye.menu:AccordionMainMenu::realDraw()
at AccordionMenuV3AS3/AccordionMenuV3AS3::draw()
at fl.core::UIComponent/::callLaterDispatcher()
Is there any way I can get a simple working example saved as a Flash file? Sorry for the trouble once again!
AccordionMenuV3-AS3
posted by florodebat on 2009-03-09
Hi

Please send us an email to (support [at] jumpeyecomponents [dot] com) with a detailed description of your problem. Please send the email from the same email address which you have used to bought the Accordion Tree Menu component and please write the order ID number too.

Thank you.




Login to post your comment login to post your comment

Other questions in this item

Call JavaScript from XML Open menu item pages into target - "_self" Can I add a rollover sound? Change Text Color on Rollover Item description from XML Load movies on item select Use hand cursor on menu Go to different frames by pressing a menu item Transparent background menu Add different styles for each main items. Insert a line break into label Disable-Enable Accordion (Tree) Menu V3 Keep the Accordion (Tree) Menu V3 vertically aligned Referencing item's textfield in Accordion (Tree) Menu V3 How do I add the AccordionTreeMenuV3 on stage in runtime? Align header text to right Underline On Rollover Use hand cursor on menu Scene navigation Adding icons Selected item level acc.height not updated? How do I add the AccordionTreeMenuV3AS3 from class file to stage how to change fontsize hotwo: submenus already expanded on activation? Animated items Accordion Tree Menu expandAll() Automatic Collapse Add a fixed item under the menu Get the type of the selected item clickItem() and expandItem() do not execute actions of menu item Letter kerning Autoexpand on Start Change the position of the menu icons Go To First Child When Select Top Level Menu Item Children of a menu item Open menu upwards Change the position of the folder icons Rotated text for menu items Reference to text fields within menu items Spacing between menu items Step backwards and forwards through menu Menu Item visibility / disable Accordion menu accurate size Letter kerning Title on multiple lines

Back