Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

How to rotate instance of an object when it is at a certain point on the stage?

$
0
0

I have an instance of a watering can on the stage.  I want to use TweenLite to rotate the watering can when it gets to a certain point on the stage.  I do not want the user to have to let go to the watering can to make it rotate.  Is there any way of doing this?

 

Here is the code I have thus far:

 

                    //DRAG FOR SCENE7

                    private function drag(event:MouseEvent):void

                    {

                              scene7.wateringcandrag_mc.startDrag(false);

                    }

 

                    //TRIGGERS THE DROP FOR SCENE7

                    private function drop(event:MouseEvent):void

                    {

                              scene7.wateringcandrag_mc.stopDrag();

                              var leftBoundLeftSide = scene7.bigplant.x;

                              var rightBoundLeftSide = scene7.bigplant.x + 200;

                              var upperBoundLeftSide = 0;

                              var leftBoundRightSide = scene7.littleplant.x;

                              var rightBoundRightSide = scene7.littleplant.x + 140;

                              var upperBoundRightSide = 0;

 

 

                              if (scene7.wateringcandrag_mc.x > leftBoundLeftSide && scene7.wateringcandrag_mc.x < rightBoundLeftSide && scene7.wateringcandrag_mc.y > upperBoundLeftSide)

                              {

                                        scene7.wateringcandrag_mc.x = 170;

                                        scene7.wateringcandrag_mc.y = -150;

 

                                        if (bigplantcounter == 0)

                                        {

                                                  scene7.bigplantgrow.gotoAndPlay(3);

                                                  bigplantcounter = 1;

                                        }

 

                                        else if (bigplantcounter == 1)

                                        {

                                                  scene7.bigplantgrow.gotoAndPlay(41);

                                                  bigplantcounter = 2;

                                        }

                              }

 

                              else if (scene7.wateringcandrag_mc.x > leftBoundRightSide && scene7.wateringcandrag_mc.x < rightBoundRightSide && scene7.wateringcandrag_mc.y > upperBoundRightSide)

                              {

                                        scene7.wateringcandrag_mc.x = 170;

                                        scene7.wateringcandrag_mc.y = -150;

 

                                        if (smallplantcounter == 0)

                                        {

                                                  scene7.smallplantgrow.gotoAndPlay(3);

                                                  smallplantcounter = 1;

                                        }

 

                                        else if (smallplantcounter ==1)

                                        {

                                                  scene7.smallplantgrow.gotoAndPlay(168);

                                                  smallplantcounter = 2;

                                        }

                              }

 

                              else

                              {

                                        scene7.wateringcandrag_mc.x = 170;

                                        scene7.wateringcandrag_mc.y = -150;

                              }

                    }

 

Essentially, I want to add this somewhere:

 

if (scene7.wateringcandrag_mc.x < 100)

{

     trace('Watering Can will now rotate!');

}

 

I just can't figure out where I need to put it so that the user doesn't have to let go of the watering can!  Thank you very much in advanced!

 

-TitanVex


Viewing all articles
Browse latest Browse all 238792

Trending Articles