beno wrote: 
> Kieth Reinfeld sent along a humorous version of my fla/as 
> that seems to have the element that I'm looking for... 
 
BTW, the rule is 'i' before 'e' except when it's my first and/or last name. 
 
> Would you mind sending your *.as file along? 
> Sure would like to see what you're doing!
 
I know. 
 
> Glen Pike has kindly sent along some code...  
> Thanks for all your help, Glen! And next time, 
> make me work a little harder! 
 
How can I do any less? 
 
beno, the enclosed code contains comments which you should read as
instructions (i.e. what you need to do.) 
 
NOTE:   beno, in your .fla, you will need to go into the library and edit
mcCloseThumbTop and mcCloseThumbBottom to correct those graphics as they are
way out of position relative to the registration point. Also, turn off
Slice-9 on mcCloseThumbBottom. 
 
I hope I haven't made it too easy for you. 
 
 
Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Character.as (document class) 
 
package { 
        import flash.events.Event; 
        import flash.display.MovieClip; 
        import flash.utils.Timer; 
        import flash.events.TimerEvent; 
        import com.greensock.*; 
        import com.greensock.easing.*; 
 
        public class Character extends MovieClip { 
                private var head:HatAndFace; 
                private var leftEye:Eyeball; 
                private var rightEye:Eyeball; 
                private var leftHand:Hand; 
                private var myThumbTop:CloseThumbTop; 
                private var myThumbBottom:CloseThumbBottom; 
                private var _character:MovieClip = new MovieClip(); 
                private var _rightHand:MovieClip = new MovieClip(); 
                private var _timer:Timer; 
 
                public function Character() { 
                        addEventListener(Event.ADDED_TO_STAGE, init, false,
0, true); 
                } 
 
                private function init(e:Event):void { 
                        removeEventListener(Event.ADDED_TO_STAGE, init); 
                        _character.alpha = 0; 
                        addChild(_character); 
                        hatAndFace(); 
                        eyeball1(); 
                        eyeball2(); 
                        myLeftHand(); 
                        myRightHand(); 
                        TweenMax.to(_character, 2, {autoAlpha:1,
onComplete:onFadeInFinished}); 
                } 
 
                private function onFadeInFinished():void { 
                        // Instantiate the Timer. Tell it to run once. 
                        // Listen for the Timer event. 
                        // Start the Timer. 
                } 
 
                private function hatAndFace():void { 
                        head = new HatAndFace(); 
                        head.x = stage.stageWidth / 2; 
                        head.y = stage.stageHeight / 4; 
                        // Add head as a child of _character. 
                } 
 
                private function eyeball1():void { 
                        leftEye = new Eyeball(); 
                        leftEye.x = -30; 
                        leftEye.y = 15; 
                        // Add leftEye as a child of head. 
                } 
 
                private function eyeball2():void { 
                        rightEye = new Eyeball(); 
                        rightEye.x = 30; 
                        rightEye.y = 15; 
                        // Add rightEye as a child of head. 
                } 
 
                private function myLeftHand():void { 
                        leftHand = new Hand(); 
                        leftHand.x = head.x + 480; 
                        leftHand.y = head.y + 50; 
                        // Tell leftHand to go to frame one and stop.  
                        // Add leftHand as a child of _character. 
                } 
 
                private function myRightHand():void { 
                        theThumbTop(); 
                        theThumbBottom(); 
                        _rightHand.x = 120; 
                        _rightHand.y = 357; 
                        // Add _rightHand as a child of _character. 
                } 
 
                private function theThumbTop():void {  
                        myThumbTop = new CloseThumbTop(); 
                        myThumbTop.x = 0; 
                        myThumbTop.y = 0; 
                        // Tell myThumbTop to go to frame one and stop. 
                        // Add myThumbTop as a child of _rightHand. 
                } 
 
                private function theThumbBottom():void {  
                        myThumbBottom = new CloseThumbBottom(); 
                        myThumbBottom.x = 0; 
                        myThumbBottom.y = 0; 
                        // Add myThumbBottom as a child of _rightHand. 
                } 
 
                private function onTimer(e:TimerEvent):void { 
                        // Tell myThumbTop to start playing from frame one. 
                        // Tell leftHand to start playing from frame one. 
                        myThumbTop.addEventListener(Event.ENTER_FRAME,
checkFrame); 
                        leftHand.addEventListener(Event.ENTER_FRAME,
checkFrame); 
                        // Remove the Timer event listener. 
                } 
 
                private function checkFrame(e:Event):void { 
                        if (e.currentTarget.currentFrame ==
e.currentTarget.totalFrames) { 
        
e.currentTarget.gotoAndStop(e.currentTarget.totalFrames); 
        
e.currentTarget.removeEventListener(Event.ENTER_FRAME, checkFrame); 
                                TweenMax.to(_rightHand, .4,
{shortRotation:{rotation:60}, ease:Back.easeOut}); 
                        } 
                } 
 
        } 
} 



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

Reply via email to