Prev | Current Page 725 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

This
can be used also when developing Flash movies in a web page context and the ExternalInterface
feature is available. To redirect the trace command you can use the following snippet of code:
class Main
{
public static function main()
??‘
??‘
??‘
(continued)
390
Part II: Server Side, JavaScript, and Flash: Oh My!
{
if(haxe.Firebug.detect())
haxe.Firebug.redirectTraces();
trace(???Hello!???);
}
}
The haxe.Firebug.detect() returns true if the Firebug extension is available and the haxe.
Firebug.redirectTraces() simply set the trace function to use the Firebug.trace() function.
The preceding code produces the result shown in Figure 14 - 1 .
Figure 14 - 1
(continued)
When developing, remember to activate the - debug switch in your compilation command. In
JavaScript each function will be marked with its position and other information that will be very useful
when developing and an error occurs. The - debug adds extra bytes and slightly affects the
performances but it can be removed before deploying your scripts.


Pages:
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737