Knowledge Base |
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);
}
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 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!!!!
Glad I could help you out.
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?
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.
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.
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!
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.
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);
}
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.
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!
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
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.
posted by florodebat on 2009-03-09
HiPlease 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




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!