pseudo.Accordion class
View Sample :: Return to index  
pseudo.Accordion.Accordion(pThis:MovieClip)
Accordion constructor. You never use the constructor to create this component.

Parameters pThis The movie clip on which the new Accordion will be drawn.
Returns Nothing
Example
    None


pseudo.Accordion.create(pOwner:MovieClip, strName:String, nDepth:Number):pseudo.Accordion
Use this static function to create new Accordion on the specified movie clip. Never use constructor directly to do it.

Parameters pOwner The movie clip on which the new Accordion will be drawn.
strName The new Accordion instance name.
nDepth The new Accordion instance depth.
Returns The reference to new Accordion instance
Example
  // Create an instance of the skin look
  var look:Object = pseudo.look.AquaLook.getInstance();

  // Create an instance of the Accorcion component
  accordion = pseudo.Accordion.create(_root, "accordion", 1);
  
  apply the slin to the accordion instance
  accordion.setLook(look);
  var curtain:pseudo.Curtain = null;

  //add pane to the curtain
  curtain = accordion.addPane(pseudo.Pane, classes.ResizeTitle);
 //initialize the pane title
  initTitle(curtain, "Pane 1");
  //initialize the page content
  initContent(curtain, "content 1");
  curtain = accordion.addPane(pseudo.Pane, classes.ResizeTitle);
  initTitle(curtain, "Pane 2");
  initContent(curtain, "content 2");
  curtain = accordion.addPane(pseudo.Pane, classes.ResizeTitle);
  initTitle(curtain, "Pane 3");
  initContent(curtain, "content 3");
  curtain = accordion.addPane(pseudo.Pane, classes.ResizeTitle);
  initTitle(curtain, "Pane 4");
  initContent(curtain, "content 4");
  curtain = accordion.addPane(pseudo.Pane, classes.ResizeTitle);
  initTitle(curtain, "Pane 5");
  initContent(curtain, "content 5");
  accordion.setSize(200, 300);
  accordion._x = accordion._y = 10;
  accordion.update();
  accordion.draw();

//functions to initialize the pane title and content
//accordion component is a set of the curtain components
//so we use the reference to the curtain to initialize its content and 
//the title

  function initTitle(curtain:pseudo.Curtain, text:String):Void
  {
	
  	var btn:pseudo.ToggleButton = pseudo.ToggleButton(curtain.getItem("layerResize"));
	  var lbl:pseudo.Label = pseudo.Label(btn.addItem(pseudo.Label));
  	lbl.setData({type:"resizeTitle"});
  	lbl.setText(text);
  }

  function initContent(curtain:pseudo.Curtain, text:String):Void
  {
	  var pane:pseudo.Pane = pseudo.Pane(curtain.getItem("pane"));
  	var lbl:pseudo.Label = pseudo.Label(pane.addItem(pseudo.Label));
  	lbl.setAutoSize(true);
  	lbl.setText(text);
  }

           


pseudo.Accordion.addPane(pClass:Function, pResize:Function, pos:Number):pseudo.Curtain
Adds pane into the accordion instance
Parameters pClass Function Content class
pResize Function Title class
pos Number Pane position. If undefined then the new pane will be added after the last pane.
Returns The instance of pseudo.Curtain class instance.
Example
  
  curtain = accordion.addPane(pseudo.Pane, classes.ResizeTitle);//add a pane and get the refference to 
                                                                // it.
  //Set the title of the new pane
  var btn:pseudo.ToggleButton = pseudo.ToggleButton(curtain.getItem("layerResize"));
  var lbl:pseudo.Label = pseudo.Label(btn.addItem(pseudo.Label));
  lbl.setData({type:"resizeTitle"});
  lbl.setAlign("left");
  lbl.setText("Pnae 1");

pseudo.Accordion.getPane(pos:Number):pseudo.Curtain
Returns the refference to the pane located in the specified position

Parameters pos Number
Returns The instance of pseudo.Curtain class instance (the pane refference) .
Example
    
  curtain = accordion.getPane(0);//Get refference to the first pane
				  

pseudo.Accordion.removePane(pos:Number):Boolean
Removes the pane located in the specified position. Returns true if the pane was successfully removed

Parameters pos Number
Returns Boolean value
Example
    
  accordion.removePane(1);//removes the second pane in the accordion
				  

 

Flash UI Components (c)TUFaT.com, All Rights Reserved.