Knowledge Base


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

Accordion (Tree) Menu V3

(views: 18247)

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: 3679)

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 Keep the Accordion (Tree) Menu V3 vertically aligned Disable-Enable Accordion (Tree) Menu V3 Referencing item's textfield in Accordion (Tree) Menu V3 How do I add the AccordionTreeMenuV3 on stage in runtime? Underline On Rollover Scene navigation Align header text to right Adding icons Use hand cursor on menu Selected item level acc.height not updated? how to change fontsize How do I add the AccordionTreeMenuV3AS3 from class file to stage Animated items hotwo: submenus already expanded on activation? Add a fixed item under the menu Automatic Collapse Get the type of the selected item Accordion Tree Menu expandAll() clickItem() and expandItem() do not execute actions of menu item Letter kerning Autoexpand on Start Change the position of the menu icons Children of a menu item Go To First Child When Select Top Level Menu Item Open menu upwards Change the position of the folder icons Reference to text fields within menu items Rotated text for menu items Spacing between menu items Step backwards and forwards through menu Accordion menu accurate size Menu Item visibility / disable Letter kerning Title on multiple lines


Back

Knowledge Base Search

Enter keywords below:
Advanced Search
FlashEff 2.0
Create professional flash photo slideshows online

FREE Flash Stuff

Check out these free, fully functional AS3.0 Flash components by Jumpeye:

FlashEff 2.0 Free
(free for non-commercial use)

JC Panorama
(free for non-commercial use)

JC Play List
(fully free)

Basic Menu Pack V3
(free AS3 version)

MCTE V3
(free AS3 version)

JC Player
(free for non-commercial use)

JC Flash Map
(free for non-commercial use)

Flash Bookmarks
(fully free)

ActionScript Bridge AS2-AS3
(fully free)

JS Charts
(free for non-commercial use)

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