
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: accordion class &#8211; flash actionscript3 (as3)</title>
	<atom:link href="http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/</link>
	<description>Programming tips &#38; tools.</description>
	<lastBuildDate>Fri, 13 Jan 2012 14:25:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Roberto Leite</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1484</link>
		<dc:creator>Roberto Leite</dc:creator>
		<pubDate>Mon, 27 Jun 2011 17:56:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1484</guid>
		<description>Hi grat job.
I haven&#039;t seen a better accordion component for flash so far.
You are the man.

However, I&#039;m trying to add a event listener to the main sections in order to load a file (to be shown outside the panel) wile  that barr is clicked and the panel is just opening.
could you gimme a clue on how to do that ?
Thanks in advance.
Roberto Leite
Brazil</description>
		<content:encoded><![CDATA[<p>Hi grat job.<br />
I haven&#8217;t seen a better accordion component for flash so far.<br />
You are the man.</p>
<p>However, I&#8217;m trying to add a event listener to the main sections in order to load a file (to be shown outside the panel) wile  that barr is clicked and the panel is just opening.<br />
could you gimme a clue on how to do that ?<br />
Thanks in advance.<br />
Roberto Leite<br />
Brazil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MIchael</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1235</link>
		<dc:creator>MIchael</dc:creator>
		<pubDate>Thu, 13 Jan 2011 04:53:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1235</guid>
		<description>Hi There. great accordian.

I was wondering. do you think you could tell me how O make the content have a clear background but still mask each other out rather than just cover each panel. I wanted to use a background image on the background which I dont want to move. I only want to animate the text.

thanks very much.

Michael</description>
		<content:encoded><![CDATA[<p>Hi There. great accordian.</p>
<p>I was wondering. do you think you could tell me how O make the content have a clear background but still mask each other out rather than just cover each panel. I wanted to use a background image on the background which I dont want to move. I only want to animate the text.</p>
<p>thanks very much.</p>
<p>Michael</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michale</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1233</link>
		<dc:creator>Michale</dc:creator>
		<pubDate>Tue, 11 Jan 2011 02:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1233</guid>
		<description>I am trying to use your accordian customized for my needs. I am unable to add a list inside the panel and provide a dataProvider. If i just add the list, it just flickers inside the panel and when i provide the dataProvider, i get a compile timer error that am accessing an unknown property called dataProvider for the list component. could you please help. i am trying to figure this out for the last few hours with no progress.</description>
		<content:encoded><![CDATA[<p>I am trying to use your accordian customized for my needs. I am unable to add a list inside the panel and provide a dataProvider. If i just add the list, it just flickers inside the panel and when i provide the dataProvider, i get a compile timer error that am accessing an unknown property called dataProvider for the list component. could you please help. i am trying to figure this out for the last few hours with no progress.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lindsey</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1224</link>
		<dc:creator>Lindsey</dc:creator>
		<pubDate>Sat, 06 Nov 2010 22:31:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1224</guid>
		<description>This is very well done, thank you for sharing :D</description>
		<content:encoded><![CDATA[<p>This is very well done, thank you for sharing :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pAwAn Singh</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1219</link>
		<dc:creator>pAwAn Singh</dc:creator>
		<pubDate>Thu, 21 Oct 2010 18:43:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1219</guid>
		<description>Hi ....thanks a lot for ur code ....i modified this a bit ....it will auto height according to the content in the panel ....it&#039;s only availabel for vertical bcoz i have no time now.....


here&#039;s the code .....may be u can think of doing it properly .....

package src.navigation{
	import flash.display.*;
	import flash.geom.*;
	import flash.events.*;
	import caurina.transitions.Tweener;
	
	public class accordion extends MovieClip{
		private var mywidth;
		private var myheight;
		private var navW;
		private var navH;
		private var panelN;
		private var panelW;
		private var panelH;
		private var panelWithBtnWidth;
		private var panelWithBtnHeight;
		public var currpanel:Number;
		private var vertical:Boolean;
		private var BG_COLOR = 0xFFFFFF;
		public static const EVENT_ON_CHANGE = &quot;change&quot;;
		// first one is always open
		public function accordion($width:Number, $height:Number, panelNumber:Number=0, navWidth:Number=0,navHeight:Number=0,allignment:Boolean=false){
			vertical=allignment;
			mywidth  = $width;
			myheight = $height;
			panelN = panelNumber;
			navW = navWidth;
			navH = navHeight;
			this.graphics.beginFill(0xFFFFFF);
			this.graphics.drawRect(0,0, mywidth, myheight);
			this.graphics.endFill();
			panelW = $width-panelNumber*navWidth;
			panelH = $height-panelNumber*navHeight;
			panelWithBtnWidth=panelW+navWidth;
			panelWithBtnHeight=panelH+navHeight;
			var mk:Sprite = new Sprite();
			mk.graphics.beginFill(0xFF0000);
			mk.graphics.drawRect(0,0, mywidth, myheight);
			mk.graphics.endFill();
			this.addChild(mk);
			this.mask = mk;
		}
		public function openPanel(pNumber:Number):void{
			var obj;
			var i;
		
			for(i=1;i&lt;this.numChildren;i++){
				obj = this.getChildAt(i) as Sprite;
				obj.getChildByName(&quot;btn&quot;).addEventListener(MouseEvent.CLICK, handleOpenClick);
				obj.getChildByName(&quot;btn&quot;).buttonMode=true;
			}
			obj = this.getChildAt(pNumber) as Sprite;
			obj.getChildByName(&quot;btn&quot;).buttonMode=false;
			obj.getChildByName(&quot;btn&quot;).removeEventListener(MouseEvent.CLICK, handleOpenClick);
			var height_ = 0;
			
			// get complete height
			height_ = Sprite(this.getChildAt(pNumber)).getChildByName(&quot;content&quot;).height;
			height_ += this.numChildren*navH;
			
			for(i=pNumber+1; i&lt;this.numChildren;i++){
				obj = this.getChildAt(i);
				//height_ = obj.getChildByName(&quot;content&quot;).height;
				trace(&quot;height_ : &quot; + myheight + &quot;:&quot; + height_);
				////////////////////////
				if (!vertical)  Tweener.addTween(obj, {x:mywidth-(this.numChildren-i)*navW, time:1.0, transition:&quot;easeOutCubic&quot;, rounded:true});
				else Tweener.addTween(obj, {y:height_-(this.numChildren-i)*navH, time:1.0, transition:&quot;easeOutCubic&quot;, rounded:true});
				////////////////////////
			}
			for(i=1; i&lt;=pNumber;i++){
				obj = this.getChildAt(i);
				////////////////////////
				if (!vertical) Tweener.addTween(obj, {x:(i-1)*navW, time:1.0, transition:&quot;easeOutCubic&quot;, rounded:true});
				else Tweener.addTween(obj, {y:(i-1)*navH, time:1.0, transition:&quot;easeOutCubic&quot;, rounded:true});
				////////////////////////
			}
			currpanel=pNumber;
			dispatchEvent(new Event(EVENT_ON_CHANGE));
			
		}
		public function addPanel(btnBackground:MovieClip,contMovie:MovieClip){
			var pnl:Sprite = new Sprite();
			var color = BG_COLOR;// Math.round( Math.random()*0xFFFFFF );
			pnl.graphics.beginFill(color);
			panelWithBtnHeight = panelWithBtnHeight - navH;
			panelWithBtnHeight += contMovie.height;
			/////////////////
			if (!vertical) pnl.graphics.drawRect(0,0,panelWithBtnWidth,myheight);
			else pnl.graphics.drawRect(0,0,mywidth,panelWithBtnHeight);
			/////////////////
			pnl.graphics.endFill();
			var btn:MovieClip = getBtnBase();
			var msk:MovieClip = getBtnBase();
			pnl.addChild(btnBackground);
			pnl.addChild(btn);
			btn.addChild(msk);
			btn.mask = msk;
			var localcont = contMovie;
			pnl.addChild(localcont);
			localcont.name = &quot;content&quot;;
			pnl.name = &quot;panel&quot;;
			/////////////////
			if (!vertical) localcont.x+=navW;
			else localcont.y+=navH;
			/////////////////
			var contmask:MovieClip = getContentBase(localcont);
			localcont.addChild(contmask);
			localcont.mask = contmask;
			this.addChild(pnl);
			/////////////////
			if (!vertical) pnl.x= (this.numChildren-2)*navW;
			else pnl.y= (this.numChildren-2)*navH;
			/////////////////
			btn.panelNumber = this.numChildren-1;
			btn.mouseChildren=false;
			btn.buttonMode=true;
			btn.name=&quot;btn&quot;;
		}
		public function getPanelContentsAt(i):MovieClip{
			var obj:Sprite = this.getChildAt(i) as Sprite;
			return obj.getChildAt(2) as MovieClip;
			//trace(this.getChildAt(i).getChildAt(0));
		}
		private function handleOpenClick(evt:Event){
			if(evt.target.panelNumber){
				openPanel(evt.target.panelNumber);
			}
		}
		private function getBtnBase():MovieClip{
			var btn:MovieClip = new MovieClip();
			var color = Math.round(Math.random()*0xFFFFFF);
			btn.graphics.beginFill(color,0);
			/////////////////
			if (!vertical) btn.graphics.drawRect(0,0,navW,myheight);
			else btn.graphics.drawRect(0,0,mywidth,navH);
			/////////////////
			btn.graphics.endFill();
			return btn;
		} 
		private function getContentBase(localcont:DisplayObject):MovieClip{
			var cont:MovieClip = new MovieClip();
			var color = Math.round(Math.random()*0xFFFFFF);
			cont.graphics.beginFill(color,0.5);
			/////////////////
			if (!vertical) cont.graphics.drawRect(0,0,panelW,myheight);
			else cont.graphics.drawRect(0,0,mywidth,localcont.height);
			/////////////////
			cont.graphics.endFill();
			return cont;
		}
	}
}</description>
		<content:encoded><![CDATA[<p>Hi &#8230;.thanks a lot for ur code &#8230;.i modified this a bit &#8230;.it will auto height according to the content in the panel &#8230;.it&#8217;s only availabel for vertical bcoz i have no time now&#8230;..</p>
<p>here&#8217;s the code &#8230;..may be u can think of doing it properly &#8230;..</p>
<p>package src.navigation{<br />
	import flash.display.*;<br />
	import flash.geom.*;<br />
	import flash.events.*;<br />
	import caurina.transitions.Tweener;</p>
<p>	public class accordion extends MovieClip{<br />
		private var mywidth;<br />
		private var myheight;<br />
		private var navW;<br />
		private var navH;<br />
		private var panelN;<br />
		private var panelW;<br />
		private var panelH;<br />
		private var panelWithBtnWidth;<br />
		private var panelWithBtnHeight;<br />
		public var currpanel:Number;<br />
		private var vertical:Boolean;<br />
		private var BG_COLOR = 0xFFFFFF;<br />
		public static const EVENT_ON_CHANGE = &#8220;change&#8221;;<br />
		// first one is always open<br />
		public function accordion($width:Number, $height:Number, panelNumber:Number=0, navWidth:Number=0,navHeight:Number=0,allignment:Boolean=false){<br />
			vertical=allignment;<br />
			mywidth  = $width;<br />
			myheight = $height;<br />
			panelN = panelNumber;<br />
			navW = navWidth;<br />
			navH = navHeight;<br />
			this.graphics.beginFill(0xFFFFFF);<br />
			this.graphics.drawRect(0,0, mywidth, myheight);<br />
			this.graphics.endFill();<br />
			panelW = $width-panelNumber*navWidth;<br />
			panelH = $height-panelNumber*navHeight;<br />
			panelWithBtnWidth=panelW+navWidth;<br />
			panelWithBtnHeight=panelH+navHeight;<br />
			var mk:Sprite = new Sprite();<br />
			mk.graphics.beginFill(0xFF0000);<br />
			mk.graphics.drawRect(0,0, mywidth, myheight);<br />
			mk.graphics.endFill();<br />
			this.addChild(mk);<br />
			this.mask = mk;<br />
		}<br />
		public function openPanel(pNumber:Number):void{<br />
			var obj;<br />
			var i;</p>
<p>			for(i=1;i&lt;this.numChildren;i++){<br />
				obj = this.getChildAt(i) as Sprite;<br />
				obj.getChildByName(&quot;btn&quot;).addEventListener(MouseEvent.CLICK, handleOpenClick);<br />
				obj.getChildByName(&quot;btn&quot;).buttonMode=true;<br />
			}<br />
			obj = this.getChildAt(pNumber) as Sprite;<br />
			obj.getChildByName(&quot;btn&quot;).buttonMode=false;<br />
			obj.getChildByName(&quot;btn&quot;).removeEventListener(MouseEvent.CLICK, handleOpenClick);<br />
			var height_ = 0;</p>
<p>			// get complete height<br />
			height_ = Sprite(this.getChildAt(pNumber)).getChildByName(&quot;content&quot;).height;<br />
			height_ += this.numChildren*navH;</p>
<p>			for(i=pNumber+1; i&lt;this.numChildren;i++){<br />
				obj = this.getChildAt(i);<br />
				//height_ = obj.getChildByName(&quot;content&quot;).height;<br />
				trace(&quot;height_ : &quot; + myheight + &quot;:&quot; + height_);<br />
				////////////////////////<br />
				if (!vertical)  Tweener.addTween(obj, {x:mywidth-(this.numChildren-i)*navW, time:1.0, transition:&quot;easeOutCubic&quot;, rounded:true});<br />
				else Tweener.addTween(obj, {y:height_-(this.numChildren-i)*navH, time:1.0, transition:&quot;easeOutCubic&quot;, rounded:true});<br />
				////////////////////////<br />
			}<br />
			for(i=1; i&lt;=pNumber;i++){<br />
				obj = this.getChildAt(i);<br />
				////////////////////////<br />
				if (!vertical) Tweener.addTween(obj, {x:(i-1)*navW, time:1.0, transition:&quot;easeOutCubic&quot;, rounded:true});<br />
				else Tweener.addTween(obj, {y:(i-1)*navH, time:1.0, transition:&quot;easeOutCubic&quot;, rounded:true});<br />
				////////////////////////<br />
			}<br />
			currpanel=pNumber;<br />
			dispatchEvent(new Event(EVENT_ON_CHANGE));</p>
<p>		}<br />
		public function addPanel(btnBackground:MovieClip,contMovie:MovieClip){<br />
			var pnl:Sprite = new Sprite();<br />
			var color = BG_COLOR;// Math.round( Math.random()*0xFFFFFF );<br />
			pnl.graphics.beginFill(color);<br />
			panelWithBtnHeight = panelWithBtnHeight &#8211; navH;<br />
			panelWithBtnHeight += contMovie.height;<br />
			/////////////////<br />
			if (!vertical) pnl.graphics.drawRect(0,0,panelWithBtnWidth,myheight);<br />
			else pnl.graphics.drawRect(0,0,mywidth,panelWithBtnHeight);<br />
			/////////////////<br />
			pnl.graphics.endFill();<br />
			var btn:MovieClip = getBtnBase();<br />
			var msk:MovieClip = getBtnBase();<br />
			pnl.addChild(btnBackground);<br />
			pnl.addChild(btn);<br />
			btn.addChild(msk);<br />
			btn.mask = msk;<br />
			var localcont = contMovie;<br />
			pnl.addChild(localcont);<br />
			localcont.name = &quot;content&quot;;<br />
			pnl.name = &quot;panel&quot;;<br />
			/////////////////<br />
			if (!vertical) localcont.x+=navW;<br />
			else localcont.y+=navH;<br />
			/////////////////<br />
			var contmask:MovieClip = getContentBase(localcont);<br />
			localcont.addChild(contmask);<br />
			localcont.mask = contmask;<br />
			this.addChild(pnl);<br />
			/////////////////<br />
			if (!vertical) pnl.x= (this.numChildren-2)*navW;<br />
			else pnl.y= (this.numChildren-2)*navH;<br />
			/////////////////<br />
			btn.panelNumber = this.numChildren-1;<br />
			btn.mouseChildren=false;<br />
			btn.buttonMode=true;<br />
			btn.name=&quot;btn&quot;;<br />
		}<br />
		public function getPanelContentsAt(i):MovieClip{<br />
			var obj:Sprite = this.getChildAt(i) as Sprite;<br />
			return obj.getChildAt(2) as MovieClip;<br />
			//trace(this.getChildAt(i).getChildAt(0));<br />
		}<br />
		private function handleOpenClick(evt:Event){<br />
			if(evt.target.panelNumber){<br />
				openPanel(evt.target.panelNumber);<br />
			}<br />
		}<br />
		private function getBtnBase():MovieClip{<br />
			var btn:MovieClip = new MovieClip();<br />
			var color = Math.round(Math.random()*0xFFFFFF);<br />
			btn.graphics.beginFill(color,0);<br />
			/////////////////<br />
			if (!vertical) btn.graphics.drawRect(0,0,navW,myheight);<br />
			else btn.graphics.drawRect(0,0,mywidth,navH);<br />
			/////////////////<br />
			btn.graphics.endFill();<br />
			return btn;<br />
		}<br />
		private function getContentBase(localcont:DisplayObject):MovieClip{<br />
			var cont:MovieClip = new MovieClip();<br />
			var color = Math.round(Math.random()*0xFFFFFF);<br />
			cont.graphics.beginFill(color,0.5);<br />
			/////////////////<br />
			if (!vertical) cont.graphics.drawRect(0,0,panelW,myheight);<br />
			else cont.graphics.drawRect(0,0,mywidth,localcont.height);<br />
			/////////////////<br />
			cont.graphics.endFill();<br />
			return cont;<br />
		}<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yapi</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1153</link>
		<dc:creator>yapi</dc:creator>
		<pubDate>Wed, 14 Apr 2010 09:59:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1153</guid>
		<description>please can you help when i try to import the class with a.s / import main; 
i have nothing on  my stage</description>
		<content:encoded><![CDATA[<p>please can you help when i try to import the class with a.s / import main;<br />
i have nothing on  my stage</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1149</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 01 Apr 2010 18:12:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1149</guid>
		<description>Dude, this rocks!.. thanks</description>
		<content:encoded><![CDATA[<p>Dude, this rocks!.. thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1148</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Thu, 01 Apr 2010 04:56:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1148</guid>
		<description>Help.
How can I change the labels and load different submenus in the content?
Can&#039;t figure out at all :-(</description>
		<content:encoded><![CDATA[<p>Help.<br />
How can I change the labels and load different submenus in the content?<br />
Can&#8217;t figure out at all :-(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan Gruskoff</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1140</link>
		<dc:creator>Alan Gruskoff</dc:creator>
		<pubDate>Fri, 12 Mar 2010 04:56:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1140</guid>
		<description>Mazel Tov!
This helps me a lot.
You&#039;re a mensch.</description>
		<content:encoded><![CDATA[<p>Mazel Tov!<br />
This helps me a lot.<br />
You&#8217;re a mensch.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: neha</title>
		<link>http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/comment-page-1/#comment-1139</link>
		<dc:creator>neha</dc:creator>
		<pubDate>Wed, 10 Mar 2010 23:20:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.adylevy.com/index.php/2008/06/09/accordion-class-flash-actionscript3-as3/#comment-1139</guid>
		<description>I am looking for something like this but where each panel is part of an image and when you roll over it, it does the accordian motion and shows a different image. Can that be done with this? I am SO new to as3. 
Thank you!</description>
		<content:encoded><![CDATA[<p>I am looking for something like this but where each panel is part of an image and when you roll over it, it does the accordian motion and shows a different image. Can that be done with this? I am SO new to as3.<br />
Thank you!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

