Prev | Current Page 131 | Next

LordAlex Leon, Greg Goralski

"Foundation Flex for Designers"

Let??™s walk through it
piece by piece. The function is called dragIt and is called by the thumbnail videos whenever the user
drags a video. The next three pieces of code are all involved in instantiating the objects needed for
drag-and-drop. Instantiate is a term in object-oriented programming that means to create a specific
object that is an instance of a class. So in the first code piece, dragInitiatior, we are creating an
instance of the VideoDisplay. We also create a dragSource, which remembers which video is being
dragged, and a dragProxy. The dragProxy is the image or video you wish to show as the object is
being dragged. You can control the appearance of the dragProxy; in this case, we are setting the size
of the video being shown to 150 by 150 pixels, making it larger than the other thumbnails and so
bringing attention to it. The DragManager controls what object gets used and when. This function controls
what happens to the thumbnails during the dragging. The final piece of the code (Figure 9-28)
controls how the drop target responds.
Figure 9-28. Dropping functions
This code consists of three functions, one for each of the possible events when an object is dragged.
The first, dragEnterHandler, controls what happens when the thumbnail is dragged onto the drop target
(the main video panel). This function checks that the object being dragged is the kind that is
expected (in this case, a video). If it is, then it is accepted. Nothing has yet been added for what to do
if it is not accepted.


Pages:
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
szataniarze Giorgio Moroder Mika Matisyahu tanie linie lotnicze