Hello all,
I am trying to put together a little accordion animation for a site. I am using code from this site:
http://www.freeactionscript.com/2009/10/simple-accordion-menu/
I only need 3 panels instead of 4 so I took the code and changed it to this:
package
{
/**
* Accordion Menu
*
* @author Philip Radvan
* @url http://www.freeactionscript.com
* @version 1.0
*
*/
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import gs.TweenLite;
public class Accordion extends MovieClip
{
var speed:Number = 1;
public function Accordion()
{
card1.addEventListener(MouseEvent.CLICK, clickHandler, false, 0, true);
card2.addEventListener(MouseEvent.CLICK, clickHandler, false, 0, true);
card3.addEventListener(MouseEvent.CLICK, clickHandler, false, 0, true);
}
protected function clickHandler(event:MouseEvent):void
{
if(event.target == card1)
{
TweenLite.to(card1, speed, { x:500, y:0 } );
TweenLite.to(card2, speed, { x:0, y:0 } );
TweenLite.to(card3, speed, { x:723.95, y:0 } );
}
else if(event.target == card2)
{
TweenLite.to(card1, speed, { x:352.95, y:0 } );
TweenLite.to(card2, speed, { x:384.45, y:0 } );
TweenLite.to(card3, speed, { x:23.95, y:0 } );
}
else if(event.target == card3)
{
TweenLite.to(card1, speed, { x:352.95, y:0 } );
TweenLite.to(card2, speed, { x:384.45, y:0 } );
TweenLite.to(card3, speed, { x:413.95, y:0 } );
}
}
}
}
You would think that SOMETHING would happen now. Even if its just a strange movement of some kind. But nothing does happen. Not even an error message of any sort. I started messing with that X and Y value but nadda thing. All of my movie clips are named correctly. card1, card2 and card3. Maybe it has something to do with the packages? I have never used components before like tweenlite. I took the files and just placed them in the folder with my flash movie. Was there another step I am missing? Any help would be appreciated. Thanks in advance!!!