MACROMEDIA FLASH 8-FLASH Spécifications Page 265

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 290
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 264
Extend the MovieClip class to create a new class 265
4. In the Name text box, enter myShape.
5. In the AS 2.0 Class text box, enter Drag.
Click OK. This associates the movie clip with the Drag class that
you’ll create.
6. Using the Property inspector, assign the movie clip an instance name,
then save the FLA file.
7. Create an ActionScript file by selecting File > New > ActionScript File
(Not Flash Document). Save the document with the name Drag.as, in
the same location where you saved Shape.fla.
8. In the ActionScript file that you just created, create a new class and
constructor called
Drag:
class Drag extends MovieClip
{
function Drag ()
{
onPress=doDrag;
onRelease=doDrop;
}
}
9.
Define private methods in the class that use the existing movie clip
methods,
startDrag() and stopDrag():
class Drag extends MovieClip
{
function Drag()
{
onPress=doDrag;
onRelease=doDrop;
}
private function doDrag():Void
{
this.startDrag();
}
private function doDrop():Void
{
this.stopDrag()
}
}
10.
Save the ActionScript file.
NOTE
A finished sample file of the document you just created, named
handson3.fla, is located in your finished files folder. For the path, see “Set
up your workspace” on page 256.
Vue de la page 264
1 2 ... 260 261 262 263 264 265 266 267 268 269 270 ... 289 290

Commentaires sur ces manuels

Pas de commentaire