Knowledge Base |
Important! All new questions are usually answered within the next business day.
Accordion Panel V3
(views: 12981)
Accordion Panel V3 is a professional accordion component that loads movies and movieclips and supports both horizontal and vertical orientation, it supports customized tweens, states and visual styles. Here are all known issues for Accordion Panel V3. If you have any questions that you think we should discuss here please let us know.
Get selected panel and content
(2008-10-29 - views: 1778)
Q: Is there a way to know which one of the panels was selected, to get its contents ?
A: Yes, it is. First of all, to get the panel's contents, simply use the content property of the panel. When a panel is selected, you can use the onPress or onRelease events to know about it (depending on the navigation mode - "press" or "release") and get the reference to the panel itself (evtObj.item). Next, get the contents of the panel: evtObj.item.content.
To know which one of the panels has been selected, place all the panels inside a list (an Array object) and compare the selected panel to the ones from the list, until you get to the panel you want and retrieve its index.
The attached files might help you understand this procedure.
Files: AccPanel_SelectedItem.zip
myEventListener = new Object();
myEventListener.onRelease= function(evtObj:Object):Void {
trace("onRelease event on panel: " + evtObj.item);
}
componentInstance.addEventListener("onRelease",myEventListener);To know which one of the panels has been selected, place all the panels inside a list (an Array object) and compare the selected panel to the ones from the list, until you get to the panel you want and retrieve its index.
The attached files might help you understand this procedure.
Files: AccPanel_SelectedItem.zip
User Comments
Get selected panel and content AS3
The code is similar to the AS2 example excepting the event code. Please find bellow the AS3 code you will have to use in order to get the selected panel.
import com.jumpeye.Events.AccordionPanelEvents;
accordionPanel.addEventListener(AccordionPanelEvents. ITEM_RELEASE, releaseHdl);
function releaseHdl (evt:AccordionPanelEvents):void {
trace(evt.item.content+" -- is the same as -- "+menuItemsList[getItemIndex(evt.item)].content);
}
I hope this helps
posted by florodebat on 2009-09-23
The code is similar to the AS2 example excepting the event code. Please find bellow the AS3 code you will have to use in order to get the selected panel.
import com.jumpeye.Events.AccordionPanelEvents;
accordionPanel.addEventListener(AccordionPanelEvents. ITEM_RELEASE, releaseHdl);
function releaseHdl (evt:AccordionPanelEvents):void {
trace(evt.item.content+" -- is the same as -- "+menuItemsList[getItemIndex(evt.item)].content);
}
I hope this helps
Login to post your comment



Hi,
can you explain how i can get the index of the selected item in actionscript 3.0?
Many thanks