MACROMEDIA FIREWORKS 8-EXTENDING FIREWORKS Spécifications Page 26

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 35
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 25
214
CHAPTER 11
The changes here are minor and no different than any ActionScript 2 to ActionScript 3 migration.
With the event handlers in place and assigned, this FLA can be published and executed in Fireworks.
The functionality should be equivalent between the two. Note that MMExecute(jsfCode) has remained
the same. Since ActionScript 3 supports the include statement, our workflow has remained relatively
unchanged.
Responding to Fireworks events in ActionScript 3
Responding to Fireworks events in ActionScript 3 is a bit more structured than in ActionScript 2.
Whereas in ActionScript 2 you simply define a function with the name of the event, in ActionScript
3 you must register an event handler for the events you want to listen to (just like we registered
event handlers for our buttons using addEventListener). The following code shows how to register
Fireworks events using the ExternalInterface object:
// Constructor
public function DrawRect()
{
// Register all Fireworks Event Handlers
ExternalInterface.addCallback("IsFwCallbackInstalled",
IsFwCallbackInstalled);
ExternalInterface.addCallback("onFwActiveToolChange",
onFwActiveToolChange);
ExternalInterface.addCallback("setfwActiveToolForSWFs",
setfwActiveToolForSWFs);
ExternalInterface.addCallback("onFwActiveSelectionChange",
onFwActiveSelectionChange);
}
// Fireworks calls IsFwCallbackInstalled whenever an event is generated
// Return true when you wish to handle the event.
function IsFwCallbackInstalled(funcName:String):Boolean
{
switch( funcName )
{
case "onFwActiveToolChange":
return true;
case "setfwActiveToolForSWFs":
return true;
case "onFwActiveSelectionChange" :
return true;
default :
return false;
}
}
Vue de la page 25
1 2 ... 21 22 23 24 25 26 27 28 29 30 31 ... 34 35

Commentaires sur ces manuels

Pas de commentaire