Thank You Sooooooooooooooooooooo Much! :D    I have been researching for over a 
month!!  I am guessing that the 'this'  is pointing to the symbol or _mc I 
attach the class to? 
I ended up doing away with all of the  "this" because I was receiving an error 
message saying  "gotoAndStop is not a function."  Also I needed to declare the 
variable  "buttonState"

Here it is!!! My first Class! 
Thank you!



###################################

package
{
        
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        

        public class ToggleButton extends MovieClip
        {
                //public var togglButton:MovieClip;
                public var buttonState = MovieClip;

                public function ToggleButton()
                {
                        // constructor code
                        
                        
                        
                        //event listeners
                        addEventListener(MouseEvent.MOUSE_OVER, rolloverToggle);
                        addEventListener(MouseEvent.MOUSE_OUT, rolloutToggle);
                        addEventListener(MouseEvent.CLICK, toggleClick);
                        buttonState = "off";


                        // Respond to mouse events
                        function rolloverToggle(event:MouseEvent)
                        {
                                gotoAndStop(buttonState+" over");

                        } //rollover f(x)

                        function rolloutToggle(event:MouseEvent)
                        {
                                gotoAndStop(buttonState);

                        } //rollout f(x)

                        function toggleClick(event:MouseEvent)
                        {
                                if (buttonState == "on")
                                {
                                        buttonState = "off";
                                } //if
                                else
                                {
                                        buttonState = "on";
                                } //else
                                gotoAndStop(buttonState+" over");
                                
                        } //toggle click f(x)
                        
                } //constructor f(x)
                
        } //class

} //package



#################################
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to