MACROMEDIA FIREWORKS 8-EXTENDING FIREWORKS Specifiche Pagina 26

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 35
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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;
}
}
Vedere la pagina 25
1 2 ... 21 22 23 24 25 26 27 28 29 30 31 ... 34 35

Commenti su questo manuale

Nessun commento