bbindex.indd 603 i n d e x . i n d d

6 0 3 AJAX, 228, 414–422 AIR, 510 Adobe Flexlibrary, 369 Adobe FlashCS3, benefitstouse, 363 addSub, 71 addition (+), operator, binary 55 addChar, 71–72 add ActionStep library, 369 Machine2, 316 ActionScript Virtual ActionScript/ comparison ActionScript Action MessageFormat (AMF) accessor methods, withdynamic abstract valuetypes, 35–36 abstract methods, 119–120 abstract classes, 119–120 A HTML panelcontent, updating, 416–417 functions of, 414 auto-complete control, building, 417–422 strings, 71–72 lists, 47 trace, 181 structures, 354–358 statements, 354–358 properties, 356 operators, 352–353 keywords, 354–358 functions, top-level, 347–352 data types, 344–346 constant values/specialvalues, 346–347 classes, 357–359 3andFlex2,version 344 synchronous communicationin, 523–524 Screen Weaver HXextensions, 523–524 compared tohaXe. and Flash, 316 connection,Flash-to-AMF server 434 void type, 35 null type, 35 Neko andC/C++, 563–565 garbage collection, 572–573 dynamic type, 35–36 comparison server, 426 keyword, 113 See

COPYRIGHTED ActionScript/haXe MATERIAL anonymous objects, 126–127 anonymous keyword, 28 animation, Neko MediaEngine(NME), 549 AND (&&), logicalcomparisonoperator, 59 AND (&), bitwiseoperator, 56, 62 anchors, regularexpressions, 217–218 alternation, regularexpressions, 220 alloc function, 572 alloc_root function, 571–572 Array string, 66 array method, lambdaclass, 98 array(s), 40–45 arithmetic operators. arctic project, 146 application programminginterface(API) Apache web server values, conversion methods, 43–44 for,typing rules 40 method,sort 96 Neko andC/C++, 567–568 multidimensional, 45–46 lists, 46–48 lambda classformodifying, 96–98 iterator, creating, 98 instantiating, 41 initializing withliteralvalues, 41 hash tables, 48–50 functions of, 41 data type, changing, 41 copying, 44–45 stringto,converting 67 tostrings,converted 68 concatenating, 45 array fields/descriptions, 41–42 array accessoperator, 352 adding/removing itemsfrom, 42–43 API, 473–474 Remoting APIcommunicationmethods, reflection API, 464–469 haXe API, 206–208 Flash drawing API, 337–342 Flash APIclasses, 359–361 installing onWindows, 232–233 installing onLinuxUbuntu, 233–234 typedef, usewith, 128–130 declaring, syntaxfor, 126 operators 427–428 See binary binary Index 112/27/07 12:16:01 PM 2 / 2 7 / 0 7

1 2 : 1 6 : 0

1 Index

P M aspell project

aspell project, 146 buttons assignment operators Flash user interface, 376, 377 types of, 56 nGui, 488–489 uses of, 59–60 byte(s) asterisk, block commenting, 37 bytecode, Neko, 156–157 AsWing library, 369 extracting from stream, 306 asynchronous communications, 426 readBytes method, 306 AsyncAdapter, 437 writeBytes method, 308–309 AsyncConnection, 432–434, 440 AsyncDebugConnection, 437 AsyncProxy, 438 Flash-Neko communication, 518–520 C attr expressions, Templo, 262 attributes, HTML, 589–601 CalcProxy class, 438 attribute descriptions, 590–599 calculation expressions, 253 attribute groups, 589 callback attribute value types, 600–601 macros in templates, 256–257 attributes, XML nGui List control, 491–492 accessing, 457–458 callStack function, 191–193, 196–199 checking, 461–462 carriage return, escaped characters, 34 Author class, SPOD system, 287–288, case keyword, and switch statements, 77 296–297, 299 casting, 38–40 AuthorManager class, SPOD system, 300–301 cast function, operation of, 38–39 auto-complete control, building, AJAX conversion methods, types of, 39–40 technique, 417–422 type of value, comparing, 40 unsafe cast, 38–39 catchall block, for exceptions, 189 caurinaTweener project, 146 B C/C++, with Neko. See Neko and C/C++ ceil, float to int conversion, 66 back-references, regular expressions, 214, 220 Chapter class, SPOD system, 296–297, 299–300 backward slash, escaped characters, 33–34 ChapterManager class, SPOD system, 300–301 baseEncode, 69 character(s) bfailure function, 574 patterns, regular expressions, 214–215 BinaryNode class, 123 readChar method, 305–306 binary operators, 56–58 serialization, 473–474 increment/decrement, 57–58 writeChar method, 308 modulo operator, 57 character classes order of precedence, 56–57 non-alphanumeric characters, 217 Bit Block Transfer, 540 range of values, 216 bitwise mathematics, utility of, 60 regular expressions, 215–217 bitwise operators, 60–63 syntax for, 216 filtering bits, 62–63 character sets, regular expressions, 217 shifting bits, 61–62 charAT, 66–67 block commenting, 37 charCodeAt, 66–67 blog entry, constructors, use of, 108–110 Check class, XML, 458 bool child controls, Flash user interface, 376–381 standard data type, 28 chr, type data conversion, 39 type data conversion, 39 class(es), 102–103, 122–126 Boolean(s) abstract classes, 119–120 functions of, 33 ActionScript/haXe comparison, 357–359 restrictions in haXe, 33 advanced, 122 boot classes, magic, 475 exception class, 194–199 break, with loops, 84–85 extensions, use of, 133–134 bseDecode, 69 extern classes, 150, 160 buffers, display buffer, flipping, 535–536 functions, 102–103 builtins, Neko, 477 functions of, 102

604

bbindex.inddindex.indd 604604 112/27/072/27/07 12:16:0212:16:02 PMPM division ( /) Index implementing, 123 continue, with loops, 84–85 name, elements of, 102 Control class, nGui, 485–487 public and private, 102 controls syntax for, 102 auto-complete control, AJAX technique, 414–422 template class, 252 Flash user interface, 375–376 type parameters, 123–126 HTML, 585–586 variables, 102–103 nGui library, 482 class blocks, HaXe program structure, 23 copying, arrays, 41, 44–45 class functions, 85–90 createDirectory method, Neko, 303 functions of, 85 createdOn, 112, 122 structure of, 85–86 crytpographic hashes, 224 class keyword, 28 clear, lists, 47 clear function, trace, 184 code D documenting, 166–170 libraries, 145–162 databases, Neko. See Neko database support packages, 139–145 data converstion, casting, 38–40 resources, 163–166 data types, ActionScript/haXe comparison, unit testing, 170–177 344–346 collection(s) date/time, 50–54 functions in, 94–96 components of, retrieving, 52–53 items, accessing directly, 83 date method/descriptions, 50–51 looping over, 81–82 date objects, creating, 51–52 collisions, detecting, Neko Media Engine (NME), 543–545 delta( ) function, 53 color key, Neko Media Engine, 540 format( ) function, 53–54 commenting getMonthDays( ), 54 block commenting, 37 tokens/descriptions, 54 HTML, 588 dbName method, 281 line commenting, 37 dcxml project, 146 regular expressions, 220–221 debugging, 179–199 comparison expressions, templates, 253 exception class, 194–198 comparison operators, logical comparison operator, exceptions, 185–194 58–59 trace, 179–185 compiler directives, functions of, 6 declarations, variables, 29–30 concatenation, arrays, 41, 45 decrement (--), binary operator, 55, 57–58 conditional(s), regular expressions, 220–221 default conditional statements, 74–79 haXe standard library, 145 if statement, 74–77 variable value modifier, 111 switch statement, 77–78 default case, 135 values, returning from, 78–79 default keword, and switch statements, 78 config project, 148 delayed actions, timer, 223 configStr, 68 DelayedConnection, 437 confirm message box, SysTools, 530 deleteDirectory method, Neko, 303 Connection class, Neko database support, 277–278 deleteFile method, Neko, 303 constant values, ActionScript/haXe comparison, 346–347 delimiters, string(s), 67 constant variables, 31 delta function, dates, 53 constraint parameters, 125–126 dialogs, SysTools, 529–530 constructor(s), 108–110 directory management constructor arguments, 136–138 create/delete directory, 303 enum arguments, 136–138 Neko, 303–304 of instance variables, 108–110 reading from directory, 303–304 overriding in inheritance, 118 display buffer, flipping, 535–536 syntax for, 108 division (/) containers binary operator, 55 Flash user interface, 376–377 divide by zero issue, 64–65 nGui, 487–488 modulo operator, 55, 57

605

bbindex.inddindex.indd 605605 112/27/072/27/07 12:16:0312:16:03 PMPM DNS (Domain Name Server)

DNS (Domain Name Server), 227 catchall block, 189 documentation of code, 166–170 catching exceptions, 187–189 offline, 167–169 complex, dealing with, 189–190 online, 169–170 elements of, 185–186 document definition elements, HTML, 577–578 exception class, 194–199 Document Object Model (DOM), 392–396 exceptionStack function, 193–194, 196 definitions in file, 393 manifestation of, 186–187 typedef declarations, 394–396 throwing exceptions, 188 Document Type Definition (DTD), 229–230 unexpected, catching, 191 Dojo toolkit, 399 exception class, 194–199 dot expressions, 253–254 code for, 197–199 double quotes, escaped characters, 34 creating, 194–195 dowhile loop, 80–81 debug functionality, 195–197 drag events, 515 generic output function, 197 drawing excerpt variable, 112 to display, Neko Media Engine (NME), 538–540 execute method, Web development, 242 Flash API, 337–342 exists method, 303 dynamic hash method, 49 functions, 87–88 explicit import, 142–143 keyword, accessor methods with, 113 expressions, regular. See regular expressions links, Flash, 154–156 extensions, 133–134 standard data type, 28 with classes, 133–134 variable value modifier, 111 with typedef, 134 dynamic type, 127–133 external libraries, 150–162 parameters, 127–128 extern classes, 150, 160 typedef, 128–131 Flash, 151–156 using, 35–36 JavaScript, 159–162 dynamic typing, variables, 29 Neko, 156–158 Ext library, 400

E F element Flash user interface, 374–375 failure function, 573–574 HTML, 226–227 fash package project, 146 else keyword, and if statement, 75–76 Fast class, XML, 455–456 encoding, strings for web, 71 fhx project, 146 endsWith, 69–70 field access operator, 353 enum, 134–136 FieldLayout, Flash user interface, 381 Condition, 136 file(s), database constructor arguments, 136–138 appending to existing file, 308 keyword, 28 deleting, 303 and packages, 143 directory management, 303–304 and switch, 135, 143 File class, Neko, 304–311 syntax for, 134 FileSystem class, Neko, 301–302 equal (==), 56, 58–59 path strings, 302–303 EReg class, 210–214 read data directly, 307 error handling, Neko and C/C++, 573–574 read data from stream, 305–306 escaped characters, string content, 33–34 remote files, accessing, 311 events traversing stream, 309–310 Flash, 328–331 write data to stream, 307–309 Flash user interface, 371–373 FileInput stream, 304–305 hxGtk library, 502–503 FileOutput stream, 304–305 Neko Media Engine (NME), 549–553 fill expression, Templo, 265 Screen Weaver HX window events, 515–516 fill List function, 440 exception(s), 185–194 filters callStack function, 191–193, 196–199 filtering bits, 62–63

606

bbindex.inddindex.indd 606606 112/27/072/27/07 12:16:0312:16:03 PMPM function(s) Index lists, filter method, 95 flash package, 145 XML, rules, 462–463 Flash Player Detection Kit, 319 Firebug, haXe trace redirected to, 389–390 express install, 319 FireFox parameters, determination of, 318 Firebug, 389–390 purpose of, 315, 317 Web Developer extension, 389 Flash user interface, 369–385 first, lists, 47 containers, 376–377 flags, Screen Weaver HX window flags, 513 controls, 375–376 Flash, 315–385 element fields, 374–375 API classes, 359–361 events, 371–373 compiling to, 5–6 file structure, 370–371 development of, 316 Flash 9 implementation, 381 drawing API, 337–342 layout constructors, 374 dynamic links, 154–156 library, building, 369–371 events, 328–331 tree editor, example of, 381–384 extending methods, for MovieClip class, 342–344 Flex 2, 344 external library, 151–156 Flex Builder IDE, compiling to Flash, 6 FlashJsConnection, 435 flex project, 146 Flash-Neko communication, 517–524 float Flash-to- (AMF) Server elements of, 32 connection, 434 to int conversion, 65–66 Flash-to-JavaScript connection, 429–431 standard data type, 28 functions of, 315 floating-point numbers, double precision, 32 to haXe. See Action Script/haXe comparison floor, float to int conversion, 65–66 .hxml file compiled to, 18 fmod project, 146 JavaScript-to-Flash connection, 432 fold, lambda class, 98 LocalConnection, 435 fonts, True Type, embedding in movie magic, 477–478 clips, 368–369 Remoting API communication methods, 427–428 fonttools project, 146 and Screen Weaver HX, 517–524 for loop, 81–82 slideshow, 331–337 break and continue with, 84–85 SocketConnection, 436 IntIter object, 81–82 static links, 152–154 IntIter operator (...), 82 SWFMill, 364–369 format( ) function, dates, 53–54 SWF output, 6 forms switches, 24 HTML, 585–586 TicTacToe Game, 443–452 HTML, data validation, 404–414 trace output, 180 forward slashes, block commenting, 37 Unicode support, 221–222 framework_delfiweb project, 147 user interface, creating. See Flash user interface free_root function, 572 version 9 differences, 156 fromTime, 51 Flash movies front controller, Neko as, 238–239 clip, creating in version 9, 321–322, 324–328 FTP (file transfer protocol), 226 clip, creating in versions 6 through 8, 319–321, 324–330 fullpath method, 302 duplicating, 321 function(s), 85–98 embedding in page, sample code, 318 ActionScript/haXe comparison, 347–352 embed technique, problems/solutions, 318–319 of classes, 102–103 file extension (.), 316 class functions, 85–90 images in, 323–324 in collection objects, 94–96 mask, use on movie clip, 342–344 dynamic functions, 87–88 MovieClip class, 319–322, 342–344 elements of, 85 sounds, 325 function type inference, 87 stage and timeline, 316–317 identifiers sequence, 108 text in, 322–323 instance functions, 104–107 values, loading, 325 JavaScript, 160 variables, loading, 326–327 lambda class, 96–98 XML, loading, 327–328 local functions, 90–96

607

bbindex.inddindex.indd 607607 112/27/072/27/07 12:16:0312:16:03 PMPM function(s) (continued)

function(s) (continued) multi-function recursion, 92–93 H Neko and C/C++, 568–570 hash tables, 48–50 overriding in inheritance, 117–118 adding/removing items from, 49–50 recursive functions, 88–90 cryptographic hashes, 224 return from, 86–87 functions of, 48 static functions, 114–115 hash methods/descriptions, 49 type parameters, use of, 124–125 iterating over, 84 function keyword, 28 keys, use of, 48–49 querying keys in, 49–50 hasNext( ), 81 haXe abstract value types, 35–36 G arrays, 40–45 games, developing. See Neko Media Engine (NME) basic operation of, 8 garbage collection basic requirements, 9 abstract values, 572–573 benefits to use, 5, 7, 21, 73–74 Neko and C/C++, 571–573 casting, data conversion, 38–40 get, hash method, 49 C/C++ with, 555–575 getContent, 123, 307 commenting, 37 getDate, 50, 51 compiling to JavaScript, 6–7 getDay, 50, 51 complier directives, 6 getFullYear, 50, 51 compiling, basic operation, 17–19 getHours, 50, 53 compiling to Flash, 5–6 GET method, web server, 227–228 compiling to JavaScript, 6–7, 21–22 getMinutes, 50, 53 compiling to Neko, 7, 19–21 getMonth, 50, 51 conditional statements, 74–79 getMonthDays( ), 54 cross-platform. See regular expressions; Timer getOnlineInfo, 110 class; XML, Message0–Digest 5 (MD5) getSeconds, 50, 53 databases, working with. See Neko database support getStream method, 311–312 dates, 50–54 getter method, variable value modifier, 111 debugging, 179–199 getTime, 51, 53 file extension (.hx), 8 Glade, 503–506 file extension (.hxml), 17–19 downloading, 504 and Flash, 315–385 Glade class, 505–506 functional programming support, 7 with hxGtk library, 503–506 functions, 85–98 new project, starting, 504–505 hash tables, 48–50 global cache, SPOD system, 295 installation of, 12–14 global constants, ActionScript/haXe comparison, and JavaScript, 387–423 346–347 keywords, 28 global functions, ActionScript/haXe comparison, 347–352 language, capabilities of, 7 global properties, ActionScript/haXe comparison, 356 libraries, 8 graphical user interface (GUI) development lists, 46–48 with Flash. See Flash user interface loops, 79–85 with Glade, 503–506 magic, 475–478 hxGtk library, 499–506 -main switch, importance of, 19 installing libraries, 481 math class, 63–66 libraries, 369, 480–481 as object-oriented language, 27, 74 with Neko. See Neko desktop applications operators, 55–63 greater than (>), 55, 58–59 program structure, 22–23 greater than or equal to (>=), 55 and reflection API, 464–469 GridLayout, Flash user interface, 379–381 remoting, 425–452 grouping operators ( ), 55, 57 Runtime Type Information (RTTI), 470–473 groups, regular expressions, 219 serialization, 473–474 GTK. See hxGtk library simple value types, 31–34 Gtk class, 501 standard data types, 28 gtranslator project, 147 string functions, 66–72

608

bbindex.inddindex.indd 608608 112/27/072/27/07 12:16:0412:16:04 PMPM inheritance Index switches, 23–25 tags in, 226–227 templates, 251–268 web server, flow in, 226 text editor, use with, 17 htmlEscape, 69, 71 untyped block, 36–37 htmlUnescape, 69 variables, 28–31 HTTP protocol, 226 web development, 230–250 haxe.Http class, 415 Web site, 9, 12 JavaScript-to-Neko HTTP server, 433 and XML, 455–464 HTTPS protocol, 226 haxealtdate project, 147 hxasm project, 147 haxedoc hxDev project, 147 offline documentation, 167–169 hxDiff project, 147 syntax for, 167 hxGtk library, 499–503 haxe.Http class, 415 events, 502–503 haxelib libraries, 146–149 function proxy, 499–501 haxelib tool, use of, 148–149 Glade, use with, 503–506 included projects, listing of, 146–148 Gtk class, 501 installing, 148–149 pros/cons of, 481 haxelib-test project, 147 HxGtk project, 147 haXe.Log class, 181–185 HxJSON project, 147 haxe.Log trace, 181–182 HxLib project, 147 haxe package, 145 hxScriptlet project, 147 haxe.PosInfos, 184 hxServlet project, 147 haxe.Template, compared to mtwin.Templo, 261 hxSynth project, 147 haxe.unit package. See unit testing hyperlinks, format of, 583 haxORMap project, 147 Hello World in C/Neko compatible, 556–559 compliling, basic operation, 18–22 I creating, 17 here identifier, trace, 182–184 identifiers, instance fields, sequence of, 107 hex, 69 if statement, 74–77 hook values, custom events with, 516–517 nesting, 75–76 HTML, 228–231 images and AJAX, 414–422 in Flash movie, 323–324 attribute descriptions, 590–599 HTML, 583 attribute groups, 589 in Neko Media Engine, 538 attribute value types, 600–601 implicit import, 141–142 comments, 588 importing controls, 585–586 packages, 141–145 data validation in forms, 404–414 templates into templates, 256 document definition elements, 577–578 increment (++), binary operator, 55, 57–58 Document Object Model (DOM), 392–396 index, database fields, accessing by, 284 document structure, 229–230 indexOf, 66–67 elements in, 226–227 inequality (!=), 56, 58–59 files, root location, changing, 21–22 inference, function type, 87 forms, 585–586 info projectname project, 148 compared to haXe, 230–231 Infos interface, magic, 477 hyperlink format, 583 inheritance, 115–121 image inclusion, 583 abstract classes/methods, 119–120 link elements, 588 constructors, overriding, 118 lists, 581–582 defined, 115 maps, 584 extending class, steps in, 115–116 rules, adding to documents, 405 functions, overriding, 117–118 scripts, 587 and instance variables, 120 structural elements, 578–581 roles, different at same time, 120–121 style sheets, 586–587 single inheritance, 115 syntax for, 229, 230 and static fields, 120 tables, 582–583 super identifiers, 117 table sorting, 401–404 toString, 119 609

bbindex.inddindex.indd 609609 112/27/072/27/07 12:16:0412:16:04 PMPM insert, arrays

insert, arrays, 42, 44 external libraries, 159–162 Inspect method, RTTI, 471–473 Flash content, embedding with, 319 install projectname project, 148 FlashJsConnection, 435 instance fields, 104–114 Flash-to-JavaScript connection, 429–431 constructors, 108–110 functions, use of, 160 functions sequence, 108 HTML, traversing with, 404–414 identifiers sequence, 107 HTML Document Object Model (DOM), 392–396 inconsistencies, avoiding, 105 HTML files, necessity of, 21–22 instance functions, 104–105 JavaScript-to-Flash connection, 432 optional arguments, 106–107 JavaScript-to-Neko HTTP server, 433 variables, 107 libraries, 391–392, 399–400 variable value modifiers, 110–114 low-level access to, 396 instance functions, 104–107 magic, 478 null arguments, 105–106 Mozilla compared to Internet Explorer, 7 optional arguments, 106–107 Object Notation (JSON), 414 syntax for, 104 OnLoad problem, 396–399 XML, 207 output size, modifying, 390 instance variables, and inheritance, 120 Remoting API communication methods, 427–428 instantiating, arrays, 41 SocketConnection, 436 int switches, 24 standard data type, 28 table sorting, 401–404 type data conversion, 39 trace output, 180 integers, bits allowed, 32–33 Unicode support, 221–222 interfaces, 121–122 join body, structure of, 121–122 arrays, 42, 68 declaration, syntax for, 121 lists, 47 uses of, 122 jQuery library, 400 IntHash, 84 js package, 146 IntIter object, 81–82 IntIter operator (...), 82 isEmpty, lists, 47 is method, values, comparing types of, 40 K isOnline, blog entries, 110 isSpace, 69 keyboard, events, Flash user interface, Iterable, typedef, 131–133 372–373 iteration keying, color key, Neko Media Engine, 540 arrays, 42, 98 keys, hash tables, 48–49 database, with ResultSet, 285–286 keywords hash method, 49 ActionScript/haXe comparison, 354–358 over hash tables, 84 of haXe, 28 IntIter object, 81–82 kind method, Neko, 304 lists, 47, 98 kother method, Neko, 304 and loops, 80 template loop expressions, 254–256 iterator method, 82–83 L typedef, 131–133 labels Flash user interface, 376 nGui Label control, 484–485 J Lambda class, 96–98 array, 98 JavaScript, 387–423 fold, 98 AJAX, 414–422 map, 97–98 benefits to use, 422 mapi, 97–98 compiling to, 6–7, 21–22 methods/description, 97 cross-browser event system solution, 397–399 last, lists, 47 execution errors, redirecting, 392 lastIndexOf, 67

610

bbindex.inddindex.indd 610610 112/27/072/27/07 12:16:0512:16:05 PMPM mask Index lastInsertID method, 281 look-around constructs layout constructors, Flash user interface, 374 regular expressions, 220–221 left shift (<<), binary operator, 55 syntax for, 221 length loops, 79–85 arrays, 41 break and continue, 84–85 database property, 286 for loop, 81–82 lists, 47 looping over collections, 82–84 string, 66 recursive functions, 88–90 less than (<), 55, 58–59 ResultSet class iteration, 285–286 less than or equal to (<=), 55 template loop expressions, 254–256 lhx project, 147 Templo loop expressions, 263–264 libraries, 145–162 while loops, 80–81 external libraries, 150–162 Loops, output string data to stream, 313 features of, 8 lpad, 69–70 GUI libraries, 480–481 Lsys project, 147 haxelib libraries, 146–149 ltrim, 69–70 hxGtk library, 499–503 JavaScript, 391–392, 399–400 Neko, 272–273 from other projects, use of, 150 M standard haXe, 145–146 SysTools, 525–530 macros line commenting, 37 calling inside template, 256–257 links with Templo, 260, 266–268 dynamic links, 154–156 magic, 475–478 HTML hyperlinks, 583 boot classes, 475 HTML link elements, 588 Flash, 477–478 static links, 152–154 Infos interface, 477 Linux JavaScript, 478 HaXe installation on, 13–14 Neko, 477 Neko installation on, 16–17 PosInfo, 477 Ubuntu, Apache installation on, 233–234 Public interface, 477 list(s), 46–48 ⎯resolve method, 475–477 adding/removing items from, 48 ⎯setfield method, 475–477 filter method, 95 static initialization, 475 functions of, 46–47 main function HTML, 581–582 execution at startup, 85, 104 iterator, creating, 98 HaXe program structure, 23 list fields/descriptions, 47 search, storing location of, 68 map method, 94–95 -main switch querying values in, 48 functions of, 19, 24 List control, nGui, 491–495 importance of, 19 list method, lambda class, 98 make method, Manager class, extending, 295 list project, 148 Manager class LocalConnection, 435 extending class, steps in, 294–295 local functions, 90–96 methods/description, 292–293 multi-function recursion, 92–93 Neko, 288, 291–295 passing functions to, 92 Neko Media Engine (NME), 534–537 structure of, 90 nGui library, 482–484 type structure, 91 map, lists, 47 variable scope, 93–94 mapi method, lambda class, 97–98 Logger class map method data requirements, 311–312 Lambda class, 97–98 Neko, 311–314 lists, 94–95 stream for output, accepting, 311–312 maps, HTML, 584 logical comparison operators, 58–59 mask logical expressions, 254 Flash movie, 342–344 Templo, 263 Neko Media Engine (NME), 540

611

bbindex.inddindex.indd 611611 112/27/072/27/07 12:16:0512:16:05 PMPM matched method, regular expressions

matched method, regular expressions, 211–213, functions of, 271–272 214–215, 218–219 installation of, 14–17 math, 63–66 integers, bits allowed, 32–33 divide by zero issue, 64–65 JavaScript-to-Neko HTTP server, 433 float to int conversion functions, 65–66 multimedia with. See Neko Media Engine (NME) math fields/descriptions, 63–64 ndll library files, 555–556 numerical validity, testing for, 65 NekoML, 9 template numeric/calculation expressions, 253 Neko script, standard, 9 menus NekoSocketConnection, 436–437 creating, nGui, 496–499 NekoTools, 20, 480 creating, SysTools, 526–529 neko.vm.Loader, 157 submenus, 497, 528 neko.Web class, 236–238 message boxes nGui library, 481–498 confirm box, 530 NXML, 9 SysTools, 529–530 Page Controller, web development, 235–236 message hooks, custom events with, 516–517 Remoting API communication methods, 428 methods, abstract methods, 119–120 Screen Weaver HX application, 511–513 MochiKit library, 400 source files, requirements for compiling, 16 mod_neko standard libraries, 272–273 installing on Linux Ubuntu, 233–234 switches, 24 installing on Windows, 232–233 Templo system, 258–268 modulo operator (%), 55, 57 toolkit, 20 in Templo, 261 trace output, 180 mootools library, 400 Unicode support, 221–222 Motion-Twin ActionScript Compiler (MTASC), 6 virtual machine, 272 mouse events, Flash user interface, 371–372 web server. See NekoTools web server movie clips. See Flash movie; SWFMiLL Web site, 9, 15 mtwin project, 147 neko_error function, 574 multidimensional arrays, 45–46 Neko and C/C++ Arrays of Arrays, 46 abstract values, 563–565 multimedia arrays, 567–568 Flash movies, 323–324 C/C++ values, passing to Neko, 562–563 with Neko. See Neko Media Engine (NME) C foreign function interface (C FFI), 555 multiplication (*), binary operator, 55 data restructuring, 560 MySQL database, connecting to, 274 error handling, 573–574 functions, Neko, executing in C/C++, 569–570 functions, passing from C/C++, 569 functions, passing from haXe, 568–569 N garbage collection, 571–573 haXe, data transit from, 559–560 name qualifier, 353 Hello World, 556–559 negation operator (!), 55 Neko library files, 556 if statement, 75 Neko primitives, 570–571 Neko objects, creating/modifying, 566–567 applications, running, 20 objects, passing from Neko, 565–566 basic requirements, 9 type checking, 560–561 builtins, 477 value struct, 558–559 bytecode, 156–157 Neko database support, 273–314 and C/C++. See Neko and C/C++ choosing database, 273–275 compiling to, 7, 19–21 Connection class, 277–278 databases, working with. See Neko database support database type, determining, 281 desktop applications. See Neko desktop applications data from executed query, container for, 283–286 downloading, 15 data integrity, insuring, 281–282 executable files, creating, 20 dbName method, 281 external libraries, 156–158 deleting records, 280–281 Flash-Neko communication, 517–524 directory management, 303–304 front controller, web development, 238–239 fields, access by index, 284

612

bbindex.inddindex.indd 612612 112/27/072/27/07 12:16:0612:16:06 PMPM object-oriented programming Index fields, access by name, 283–284 Surface class, 537–545 File class, 304–311 surface transforms, 540–543 FileSystem class, 301–302 text, adding, 537 inserting records, 281 timers, 546 iteration, 285–286 Neko.ndlls library, 158 lastInsertID method, 281 neko package, 146 length property, 286 NekoTools web server, 231–234 Logger class, 311–314 deploying website to, 20–21 Manager class, 291–295 mod_neko, installation of, 232–234 of MySQL database, 274 parameters, listing of, 231 nfields property, 284–285 root location, changing, 21, 232 object to relational mapping, 286 TicTacToe Game, 443–452 ODBC driver, 277 Neko Virtual Machine, 480, 509 path strings, 302–303 neko.Web class, 236–238 populating database, 279–281 static methods, 237–238 of PostgreSQL database, 274 static variables, 238 read data directly, 307 nesting, if statement, 75–76 read data from stream, 305–307 newlines, escaped characters, 33–34 remote files, accessing, 311 next( ), 81 request method, 278 nfields property, database, 284–285 ResultSet class, 283–286 nGame project, 147 SPOD system. See SPOD (Simple Persistent Objects nGui library. See Neko desktop applications Database) system nMagick project, 147 SQLite database, 274–275 nme project, 147 tables, creating, 278–279 nodes, XML transactions, 281–282 checking, 458–461 traversing stream, 309–310 creating, 206 updating records, 280 traversing, 456–457 write data to stream, 307–309 --no-traces compiler directive, 185 Neko desktop applications, 479–506 nPostgres project, 147 benefits to use, 479–480 null, variable value modifier, 111 Button controls, 488–489 Null, 345 container classes, 487–488 null arguments, instance functions, 105–106 Control class, 485–487 null type, functions of, 35 GUI libraries, 480–481 numbers, floating-point, 32 GUI library installation, 481 numeric expressions, 253 Label control, 484–485 List control, 491–495 Manager class, 482–484 menus, 496–499 O nGui library controls, 482 static controls, 484–485 object(s), anonymous objects, 126–127 submenus, 497 object initializer, 353 Tab control, 495–496 Objective Caml, downloading, 13 Text control, 489–491 object-oriented programming Neko Media Engine (NME), 532–553 anonymous objects, 126–127 animation, 549 classes, 102–103, 122–126 collisions, detecting, 543–545 constructor arguments, 136–138 color key, setting, 540 dynamic type, 127–133 display buffer, flipping, 535–536 enum, 134–136 events, capturing, 549–553 extensions, 133–134 images, file formats for, 538 with haXe, 27, 74 Manager class, 534–537 inheritance, 115–121 refresh rate, slowing, 536–537 instance fields, 104–114 and SDL library, 532–533 interfaces, 121–122 sprites, 546–549 polymorphism, 118 surface, drawing to display, 538–540 static fields, 114–115

613

bbindex.inddindex.indd 613613 112/27/072/27/07 12:16:0612:16:06 PMPM object types, Neko and C/C++

object types, Neko and C/C++, 565–567 publish, blog entry, 109–110 ODBC driver, Neko database connection, 277 pull technology, remote communication, 426 onClose events, 515 push onFilesDropped events, 516 arrays, 42, 43 online documentation, 169–170 lists, 47 onMinimize/onMaximize events, 515 push technology, remote communication, 426–427 onRightClick events, 516 opengl project, 147 operators, 55–63 ActionScript/haXe comparison, 352–353 Q assignment operators, 59–60 binary operators, 56–58 quantifiers bitwise operators, 60–63 regular expressions, 218–219 listing of, 55–56 syntax for, 218 logical comparison operators, 58–59 queued actions, timer, 223 optional arguments, 106–107 placement of, 106 OR ( | ), bitwise operator, 62 OR ( | | ), logical comparison operator, 56, 59 R raw expression, Templo, 262–263 RChoice, 460 P RData, 460–461 readAll method, 306–307 packages, 139–145 readBytes method, 306 declaring package, 140–141 readChar method, 305–306 and enum, 143 readDirectory method, Neko, 303–304 explicit import, 142–143 read-only access, variable value modifier, 111–112 implicit import, 141–142 recursive functions, 88–90 importing package, 144–145 functions of, 88 type lookup sequence, 144 multfunction recursion, 92–93 Page Controller, Neko as, 235–236 operation of, 89–90 PanelLayout, Flash user interface, 376–378 Reflect class, 122–123 parseFloat, type data conversion, 39 reflection API, 464–469 parseInt, type data conversion, 39 Reflect class, 464–466 pascal4neko project, 147 Type class, 467–469 passwords, and cryptographic hashes, 224 refresh rate, slowing, 536–537 path projectname project, 148 register project, 149 path strings, Neko, 302–303 regular expressions, 210–222 patterns, regular expressions, 214–222 alternation, 220 Person class, 438 anchors, 217–218 PersonDatabase class, 438–440 back-references, 214, 220 polymorphism, 118 character classes, 215–217 pop, arrays, 42, 43 characters, 214–215 PosInfo, magic, 477 character sets, 217 PostgreSQL database, connecting to, 274 conditionals and comments, 220–221 POST method, web server, 227–228 defined, 210 primitives, Neko and C/C++, 570–571 EReg class, 210–214 PRIVATE_FIELDS, 290 groups, 219 private classes, 102 look-around constructs, 220–221 properties, ActionScript/haXe comparison, 356 matched method, 211–213, 214–215, 218–219 Prototype library, 400 optional modifiers, 211–214 proxy patterns, 214–222 class, remoting, 437–442 quantifiers, 218–219 hxGtk function proxy, 499–501 replace method, 213–214 XML Proxy, 463–464 split method, 213 public classes, 102 Unicode support, 221–222 Public interface, magic, 477 RELATIONS method, SPOD system, 297–298

614

bbindex.inddindex.indd 614614 112/27/072/27/07 12:16:0712:16:07 PMPM spaces, in strings, removing Index remoting, 425–452 AsyncAdapter, 437 S asyncConnection, creating, 432–434 Screen Weaver HX, 510–524 AsyncDebugConnection, 437 ActionScript extensions, 523–524 connection, creating, 428–429 benefits to use, 510, 513 DelayedConnection, 437 downloading, 511 FlashJsConnection, 435 with Flash. See Flash and Screen Weaver HX Flash-Neko communication, 517–524 Flash-Neko communication, 517–524 Flash-to-Action Message Format (AMF) Server installing, 511 connection, 434 library, 480 Flash-to-JavaScript connection, 429–431 menus, creating, 526–529 functions of, 426 message boxes, creating, 529–530 JavaScript-to-Flash connection, 432 Neko application, example of, 511–513 JavaScript-to-Neko HTTP server, 433 SWF2Exe applications, 510 LocalConnection, 435 synchronous communication system, 520–524 NekoSocketConnection, 436–437 system tray icon, creating, 526 proxy class, 437–442 SysTools library, 525–530 push or pull type communication, 426–427 window events, 515–516 remote files, accessing, Neko, 311 window flags, 513 Remoting API communication methods, 427–428 window properties, 514 server side requirements, 426 script.aculo.us library, 400 SocketConnection, 436 scripts, HTML, 587 synchronous versus asynchronous search communication, 426 storing location of, 68 TicTacToe Game, 443–452 strings, 67 remove search keyword project, 149 arrays, 42, 44 SeekBegin method, 310 hash method, 49 SeekCur method, 310 lists, 47 SeekEnd method, 310 remove projectname project, 149 seek method, 309–310 replace serialization, 473–474 characters in string, 71 defined, 473 regular expressions method, 213–214 serialization API, 473–474 StringTools method, 69 serialize/deserialize process, 474 request method, Neko database support, 278 set, hash method, 49–50 reserved characters, regular expressions, 215 setColor function, trace, 184 ⎯resolve method, magic, 475–477 set expression, Templo, 264–265 resources, 163–166 ⎯setfield method, magic, 475–477 embedded XML files, use of, 163 setParser function, 401–403 resourcefile path, 163 set projectname version project, 149 templates, 257–258 setter method, variable value modifier, 111 ResultSet class, 283–286 setup project, 149 return keyword, end of function, 86–87 shifting bits, 61–62 right shift (>>), binary operator, 55 simple value types, 31–34 RList, 459–460 Booleans, 33 RMulti, 459 floating-point numbers, 32 RNode, 459 strings, 33–34 ROptional, 460 single inheritance, 115 round, float to int conversion, 66 single quotes, escaped characters, 34 rpad, 69–70 slice, arrays, 42, 44–45 rtrim, 69–70 slideshow, Flash, 331–337 rules, HTML forms, data validation, 404–414 socket connections run projectname project, 149 NekoSocketConnection, 436–437 Runtime Type Information (RTTI), 470–473 SocketConnection, 436 accessing with haXe, 471 sort method, arrays, 96 function of, 470 sounds, Flash movie, 325 Inspect method, 471–473 spaces, in strings, removing, 70 XML RTTI documents processing, 470–473

615

bbindex.inddindex.indd 615615 112/27/072/27/07 12:16:0712:16:07 PMPM special values, ActionScript/haXe comparison

special values, ActionScript/haXe comparison, traversing, 309–310 346–347 write data to, 307–309 splice, arrays, 42, 44 string(s), 66–72 split, 66–67 add characters to end of, 70 split method, regular expressions, 213 arrays converted to, 68 SPOD (Simple Persistent Objects Database) system, characters, extracting from, 67 286–301 constructing from smaller strings/characters, Author class, 287–288, 296–297, 299 71–72 AuthorManager class, 300–301 converting to arrays, 67 Chapter class, 296–297, 299–300 delimiters, 67 ChapterManager class, 300–301 encoding for web, 71 deleting records, 291 escaped characters, 33–34 functions of, 286 fields/descriptions, 66 global cache, 295 functions of, 33 inserting data, 291 length, determining, 67 RELATIONS method, 297–298 replace characters, 71 synchronize data, 291 searching strings, 67 table mapping, 289–291 starting/ending characters, verifying, 70 table relations, 295–301 StringBuf method, 71–72 updating records, 291 string literals, 33–34 sprites StringTools methods, 69–70 animating, 548 unwanted spaces in, 70 Neko Media Engine (NME), 546–549 verify start and end of, 70 sprite sheet, 547–548 string, standard data type, 28 SQLite database string, type data conversion, 39 connecting to, 274–275 structural elements, HTML, 578–581 hxGtk library, use of, 499–500 structures, ActionScript/haXe comparison, pros/cons of, 275 354–358 StackLayout, Flash user interface, 378–379 style sheets, HTML, 586–587 stage, Flash movie, 316–317 submenus standard data types nGui, 497 haXe types, 28 Screen Weaver HX, 528 simple value types, 31–34 submit file.zip project, 149 startsWith, 70 substr, 66–67 statements, ActionScript/haXe comparison, 354–358 subtraction (-), binary operator, 55 static controls, nGui, 484–485 super identifiers, 117–118 static fields, 114–115 Surface class, Neko Media Engine (NME), functions of, 114 537–545 and inheritance, 120 SWFMill, 364–369 static functions, 114–115 file formats supported, 365 static variables, 114–115 functions of, 364 static fromCharCode, 66 movie clip, creating, 365 static fromString, date object, 51 movie clip use with haXe, 365–368 static functions, XML, 206 parameters/description, 364 static initialization, magic, 475 transition between frames, 367–368 static links, Flash, 152–154 True Type Fonts (TTF), embedding, 368–369 static methods, neko.Web class, 237–238 SWF Studio, 510 static now, date object, 51 swhx project, 147 static variables, 103, 114–115 switch(es) declaring, syntax for, 114 all platforms, 24–25 neko.Web class, 238 Flash, 24 values, assigning, 115 JavaScript, 24 statis fromTime, date object, 51 -main switch, importance of, 19 streams Neko, 24 output string data to, 313 switch statement, 77–78 read data from, 305–307 and enum, 135, 143 stream for output, accepting, 311–312 values, returning from conditional statements, 78–79

616

bbindex.inddindex.indd 616616 112/27/072/27/07 12:16:0812:16:08 PMPM trim Index synchronous communications, 426 set expression, 264–265 in ActionScript, 523–524 Template system, 259–260 in haXe, 520–523 use expression, 265–266 Screen Weaver HX system, 520–524 TestCase, unit testing, 171–172 SysTools test file.zip project, 149 features, listing of, 525 text menus, creating, 526–529 box, Flash user interface, 376 message boxes, 529–530 editor, use with haXe, 17 Screen Weaver HX, 525–530 in Flash movie, 322–323 tray icon, creating, 526 Flash user interface, 375 systools project, 147 nGui Text control, 489–491 True Type Fonts, embedding in SWFMill movie clips, 368–369 writing, Neko Media Engine (NME), 537 T TextField class, Flash, 322–323 this keyword, current object, calling, 104 Tab control, nGui, 495–496 throwing exceptions, 188 table(s) TicTacToe Game, 443–452 database, creating, 278–279 time. See date/time; timer HTML, 582–583 timeline, Flash movie, 316–317 many-to-many relations, creating, 298–301 timer, 222–223 mapping, SPOD system, 289–291, 296 action, delayed, 223 relations, adding, SPOD system, 295–301 functions of, 222 sorting, HTML, 401–404 Neko Media Engine (NME), 546 TABLE_IDS, 290 query time, 546 TABLE_NAME, 290 queued actions, 223 tabs, escaped characters, 33–34 timer instance, creating, 222 tags, HTML, 226–227 token, date formats, 54 TDD (Test-Driven Development), 172–177 toLowerCase, 66 tell method, 309 tools package, 146 templates, 251–268 top-level domain (TLD), 227 class methods/description, 252 toString code, situations for use, 258 arrays, 42 comparison expressions, 253 date object, 51 dot expressions, 253–254 hash method, 49 file extensions, 260 inheritance, 119 functions of, 251–252 lists, 47 importing into templates, 256 string, 66, 71–72 logical expressions, 254 toUpperCase, 66 loop expressions, 254–256 trace, 179–185 macros, use of, 256–257 clear function, 184 manual compilation of, 268 Flash output, 180 numeric/calculation expressions, 253 haXe compared to ActionScript, 181 resources, 257–258 haXe.Log class, 181–185 syntax for, 253–256 haxe.Log.trace, 181–182 Templo, template engine, 258–268 haxe.PosInfos, 184 Templo, 258–268 here identifier, 182–184 attr expressions, 262 JavaScript output, 180 features of, 258–259 Neko output, 180 file extensions, 260 --no-traces compiler directive, 185 fill expression, 265 redirect to Firebug, 389–390 haxe.Template compared to mtwin.Templo, 261 setColor function, 184 installing, 259 transactions, database, 281–282 logical expressions, 263 transforms, surface, Neko Media Engine, loop expressions, 263–264 540–543 macros, 260, 266–268 tray icon, creating with SysTools, 526 raw expression, 262–263 trim, 70

617

bbindex.inddindex.indd 617617 112/27/072/27/07 12:16:0812:16:08 PMPM true, and if statement

true, and if statement, 75–76 True Type Fonts (TTF), embedding in SWFMill V movie clips, 368–369 val_print function, 574 try...catch block, 304–305 val_throw and val_rethrow function, 573 twister project, 148 value(s) type(s), lookup sequence, 144 arrays, adding/removing, 43–44 type checking, Neko and C/C++, 560–561 C/C++ values, passing to Neko, 562–563 Type class, 122–123 comparing types of, 40 reflection API, 467–469 Flash movie, loading, 325 typedef, 128–131 lists, adding/removing, 47 with anonymous objects, 128–130 querying in lists, 48 benefits to use, 129–130 returned by functions, 87 declaring, syntax for, 128 returning from conditional statements, 78–79 extensions, use of, 134 variable modifiers of, 110–114 external structure mapping, 150 value struct, 558–559 HTML DOM declarations, 394–396 variables, 28–31 Iterator and Iterable, 131–133 of classes, 102–103 keyword, 28 constant variables, 31 type operator, 353 declarations, 29–30 type parameters, 123–126 dynamic typing, 29 constraints on, 125–126 Flash movie, loading, 326–327 at function level, 124–125 identifiers sequence, 107 situations for use, 123–124 initializing, 29 typing instance fields, 107 dynamic typing, 29 local functions, 90–91, 93–94 type inference, 30–31 modified, syntax for, 110 untyped block, 36–37 scope, local functions, 93–94 static variables, 103, 114–115, 238 type inference, 30–31 value modifiers, 110–114 U var keyword, 29 Unicode support Window class, 514 characters, embedding in source code, 222 XML, 208 scope of, 221–222 var keyword, 29 unit testing, 170–177 vector graphics, Flash drawing API, 337–342 haxe.unit package, 171–177 VectorSpace project, 148 purpose of, 170–171 virtual machine, Neko, 272 TDD (Test-Driven Development), 172–177 void TestCase method, 171–172 functions of, 35 unknown keyword, 28 standard data type, 28, 87 unmake method, Manager class, extending, 295 Unobtrusive Flash Objects (UFO), Flash content, embedding with, 319 unpublish, blog entry, 109–110 unsafe cast, 38–39 W Unserializer class, 474 Web Developer extension, FireFox, 389 unshift, arrays, 42, 43 web development, 225–250 untyped block, 36–37 Apache web server, 232–234 upgrade project, 149 behavior layer problems, 388–389 URI (Unified Resource Identifier) blog entries, 108–110 URL rewritten to, 231 Firefox extensions, 389 web server, 226, 228 GUI. See graphical user interface (GUI) development urlDecode, 70 haXe compared to HTML, 230–231 urlEncode, 70, 71 haxe.Http class, 415 use expression, Templo, 265–266 HTML, 228–231 user interface. See graphical user interface (GUI) movie clips. See Flash; Flash movies development remote communication. See remoting user username project, 149 Screen Weaver HX, 510–524

618

bbindex.inddindex.indd 618618 112/27/072/27/07 12:16:0912:16:09 PMPM Zinc Index site domains, levels of, 227 class instance functions, 207 strings, encoding for web, 71 class static functions, 206 web page, layers of, 387–388 class variables, 208 web server, 226–228 config information, storing, 163–165 Wiki site development example, 238–250 document creation, 209–210 See also Java Script; Neko documents, structure of, 203–206 web server, 226–228 Fast class, 455–456 accessing, addresses for, 227 filter rules, 462–463 content distribution with, 226–228 Flash movie, loading, 327–328 functions of, 226 haXe API, 206–208 GET method, 227–228 nodes, checking, 458–461 information flow in, 226 nodes, creating, 206 NekoTools. See NekoTools web server nodes, traversing, 455–457 POST method, 227–228 online documentation, 169–170 Remoting API communication methods, 427–428 Proxy class, 463–464 templates, Templo, 258–268 RChoice, 460 URI addresses, 226, 228 RData, 460–461 websites, development of. See web development RList, 459–460 while loops, 80–81 RMulti, 459 break and continue with, 84–85 RNode, 459 while and do while, 80–81 ROptional, 460 Wiki, site development, example of, 238–239 SWFMill movie clips, 364–368 Windows traversing documents, 208–209 Apache, installation of, 233–234 validation rule, 458 HaXe installation on, 12–13 XML RTTI documents processing, 470–473 Neko installation on, 14–16 XOR (^), bitwise operator, 56, 62 Screen Weaver HX functionality, 513–517 xpath project, 148 Unicode support, 221–222 writeBytes method, 308–309 Y X Yahoo! User Interface Library, 400 xcross project, 148 Xinf, 480 xinf project, 148 Z XML, 455–464 attributes, accessing, 457–458 zero, divide by zero issue, 64–65 attributes, checking, 461–462 Zinc, 510

619

bbindex.inddindex.indd 619619 112/27/072/27/07 12:16:0912:16:09 PMPM