3 Replies Latest reply on Oct 1, 2010 1:25 PM by kglad

    dropTarget check against all objects on the stage

    5Systems Level 1

      Hey all,

       

      Not sure the best way to do this.  I have a class we will call DropActivity, here is the code

       

      package com.activitycontrol

      {

                import com.activitycontrol.DropCheck;

       

           

                public class DropActivity

                {

       

                     // Constants:

                     // Public Properties:

                     // Private Properties:

                     private var _selectedClip:Object;

       

       

                

                          // Initialization:

                          public function DropActivity(/*selectedClip:Object*/)

                          {

                             

                          }

       

                

                          // Public Methods:

                          public function set selectedClip(selectedClip:Object):void

                          {

                                    _selectedClip = selectedClip;

                          }

       

                

                          public function stopDraggingMe():void

                               {

                                         var dropCheck:DropCheck = new DropCheck();

                                         //dropCheck.checkAgainst = dropTarget.name; ///***********

       

                     

                                         if (dropCheck.canBeDropped == true)

                                         {

                                              _selectedClip.stopDrag();     

                                         }

                          }

                

                

                          // Protected Methods:

                }

      }

       

      when the stopDraggingMe() method is called from another object (code shown below) I need to see all the objects on the stage to see what objects on the stage my currently selected movie clip is over and assign it to the dropCheck.checkAgainst method (that will be checked against an array to see if it can in fact be dropped, if so set the canBeDropped value to true and therefor run the .stopDrag() ).  I have read using root is not a good coding practice in AS 3.

       

       

      call to the stopDraggingme() mehod.

      private function setDown(event:MouseEvent):void

                     {

                               var droppedItem:DropActivity = new DropActivity();

                               droppedItem.selectedClip = this;

                               droppedItem.stopDraggingMe();

                }