My account
Shopping cart
Knowledge base
Support

Knowledge Base

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

Accordion Panel V3

(views: 18958)

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.



Load new content without XML

(2009-02-25 - views: 3192)
Q: Is there a way to load new content into a single panel, without having to refresh the entire accordion panel with a new xml ?
A: Yes, there is a workaround. This example contains a function that will load new content into the specified panel and also can set a new title and a new content size. This is the AS3 version of the AS2 example which was previously created.

So for this to work, all you have to do is set up the fla file with the accordion panel component and two buttons, just like the AS2 example (with the same instance names) and add the following AS3 code:

 loader0_btn.addEventListener(MouseEvent.CLICK, loadInPanel0);
 loader2_btn.addEventListener(MouseEvent.CLICK, loadInPanel2);
 
 function loadInPanel0(evt:MouseEvent):void {
     changePanelData(acPanel, 0, "New Title", "images/jmp01.jpg", 100);
 }
 
 function loadInPanel2(evt:MouseEvent):void {
     changePanelData(acPanel, 2, "New Image", "images/jmp03.jpg");
 }
 
 
 /*
 
 This function loads a new content in the specified panel and sets a new title and content size. 
 
 IMPORTANT:
 By using this function, it is possible that other attributes of the accordion panel component instance 
 (like size) will not get updated. This function can be used only for the specified actions. All other 
 attributes/properties of the component will probably remain in the state they had before applying this
 function.
 
 parameters:
 acpInstance - the reference to the AccordionPanelV3AS3 component, into which the new conten will load
 panelIndex:int - the 0 based index of the panel into which the new content will load
 newTitle:String - a new title for the panel header
 newContent:String - the url for the new content
 newContentSize:Number - the new size for tha panel. If there is a new size for the content, the panel
             will resize but the panel should be closed and then opened again to have the size of the
             accordion panel component updated
 
 */
 function changePanelData(acpInstance:AccordionPanelV3AS3, panelIndex:int, newTitle:String, newContent:String, newContentSize:Number = 0):void {
     if (acpInstance == null) return;
     if (isNaN(panelIndex)) return;
     if (panelIndex >= acpInstance.items.length) return;
     // set the new size for the panel
     if ((!isNaN(newContentSize)) && (newContentSize > 0)) {
         acpInstance.items[panelIndex].contentSize = newContentSize;
         acpInstance.items[panelIndex].setSize(newContentSize, "false");
     }
     // set the new title for the header
     if (newTitle != null) {
         acpInstance.items[panelIndex]._header.accText.text = newTitle;
         acpInstance.items[panelIndex]._header.changeTextFormat(acpInstance.items[panelIndex].styleObj.textFormat);
         acpInstance.items[panelIndex].title = newTitle;
     }
     // load the new content into the panel
     if (newContent != null) {
         acpInstance.items[panelIndex].load(newContent);
         //acpInstance.items[panelIndex].source = newContent;
     }
     
     acpInstance.invalidate();
 }
 



Login to post your comment login to post your comment

Other questions in this item

Installing the Accordion Panel V3 Open the accordion panels automatically Vertical title for horizontal accordion panel Accordion Panel slide show Accordion Panel communicates with a loader Use the Accordion Panel without external XML file Stopping video content when changing the panel Auto open a panel on startup Use HandCursor on Accordion Panel's items the title isn't showing in the horizontal mode Access header title and panel content Non Latin characters Load different kind of data into AccordionPanelV3 Panel opens only after content is loaded, when loadExpandedItemsOnly is true Dimensions Open the Accordion Panel upwards Get the size of panel's content Access accordion panel loaded with loadMovie inside container clip Panel opens only after content is loaded, when loadExpandedItemsOnly is true Open URL from panel content, not from panel header Getting accurate accordion height Open URL from panel content, not from panel header Rotate the direction of the text on horizontal Accordion Flv playback inside accordion Open panels from bottom to top and left to right TEXTU appears in my file HyperLinking panels Load new content without XML Non Latin characters Graphics below the accordion panel Acces accordion panel from content Acces accordion panel from content Access header title and panel content Open panels upward for vertical accoirdion and to the left for horizontal accordion Accordion Panel communicates with a loader Panels with different sizes Open Accordion panels automatically (slide show) Get selected panel and content

Back