E-book details

haXe 2 Beginner's Guide. Develop exciting applications with this multi-platform programming language

haXe 2 Beginner's Guide. Develop exciting applications with this multi-platform programming language

Benjamin Dasnois, haXe PAYPAL haxelang@gmail.com

Ebook
  • haXe 2
    • Table of Contents
    • haxe 2
    • Credits
    • Foreword
    • About the Author
    • About the Reviewers
    • www.PacktPub.com
      • Support files, eBooks, discount offers and more
        • Why subscribe?
        • Free access for Packt account holders
    • Preface
      • Here is haXe
      • Where and for what is haXe used?
        • Where is haXe used?
        • What is haXe used for?
        • One language to rule them all
        • Object-oriented programming
        • haXe versions
        • haXe and the new models of web applications
        • haXe as an universal language
      • Getting help
        • Reading some documentation
        • Asking questions
          • The haXe forum
          • The haXe mailing list
            • Some advice
        • Reading some blogs
          • Nicolas Cannasse
          • Weblob
          • GameHaXe
          • A Bugs Life
          • Blog.haxe.org
      • Helping the community
        • The mailing list and the forum
        • The wiki
        • Write on your blog or website
        • Writing libraries or tools
        • Talking about haXe
      • What this book covers
      • What you need for this book
      • Who this book is for
      • Conventions
      • Time for action heading
        • What just happened?
        • Pop quiz heading
        • Have a go hero heading
      • Reader feedback
      • Customer support
        • Downloading the example code for this book
        • Errata
        • Piracy
        • Questions
    • 1. Getting to know haXe
      • Installing haXe
        • Two ways to install: The installer and sources compilation
        • Installing on Windows
        • Installing on MacOSX
        • Installing on Linux
        • Installing nightly builds
        • Verifying your installation
      • Choosing an editor
        • FlashDevelop 3
        • The TextMate bundle
        • VIM
      • Writing your first program
      • Time for action Writing a Hello World
        • What just happened?
      • A program with some interaction
      • Time for action Interacting with the user
        • What just happened?
        • Pop quiz basic knowledge
      • Summary
    • 2. Basic Syntax and Branching
      • Modules, packages, and classes
        • Packages
        • Modules
        • Classes
          • Accessing a class
      • Constants and its types
        • Booleans
        • Integers
        • Floats
          • Base 10
          • Scientific notation
        • Strings
        • Regular expressions
        • The null value
          • Flash9 and above
      • Binary and unary operators
        • Binary operators
          • Assigning values
          • Comparison operators
          • Arithmetic operators
          • Boolean operators
          • Bitwise operators
        • Unary operators
      • Blocks
      • Variable declaration and scope
        • Declaring a variable
          • At class level
      • Time for action Declaring some fields
        • What just happened?
          • In a block of instructions
      • Field access and function calls
      • Constructing class instance
      • Conditional branching
        • If
        • Switch
      • Loops
        • While
        • For
      • Break and continue
      • Time for action Using the break keyword
        • What just happened?
      • Time for action Using the continue keyword
        • What just happened?
      • Return
      • Exception handling
      • Anonymous objects
      • Local functions
      • Managing a fridge
      • Time for action Managing a fridge
        • What just happened?
        • Have a go hero Throw Exceptions to prevent crashes
      • Summary
    • 3. Being Cross-platform with haXe
      • What is cross-platform in the library
        • Object storage
        • The Std class
        • The haxe package
          • The haxe.remoting package
          • The haxe.rtti package
          • The haxe.Http class
        • Regular expressions and XML handling
          • Regular expressions
          • XML handling
        • Input and output
          • The DOM interface
          • The Flash interface
          • The standard input/output interface
      • Platform-specific packages
        • JavaScript
        • Flash
        • Neko
        • PHP
        • C++
      • Conditional compilation
        • Conditional compilation depending on flags
        • Conditional compilation depending on the target
      • The remap switch
      • Coding cross-platform using imports
      • Time for action Welcoming the user on Neko & PHP
        • What just happened?
        • Pop quiz Writing cross-platform code
        • Have a go hero Handle XML
      • Time for action Reading from the XML file
        • What just happened?
      • Time for action Writing to an XML file
        • What just happened?
      • Testing our sample
      • Making it cross-platform
      • Summary
    • 4. Understanding Types
      • Explicitly typed variables
      • Static typing
      • Values with several types
        • Defining a type
        • Inheritance
        • Multi-inheritance
        • Implementing an interface
      • Representing a blog article
      • Time for action Representing different types of articles
      • Function's type
        • Expressing a function's type
        • Functions using functions
        • Dynamic functions
      • Anonymous objects
        • Duck typing
      • Creating a function to apply another one
      • Time for action Applying a function on every item
        • What just happened?
      • Type inference
        • Assigning a value
        • Assigning the value of the variable to another one
        • Passing the variable as a parameter
      • Casting
        • Safe casting
        • Unsafe casting
        • Untyped
      • Type parameters
        • Usage of Type parameters
        • Creating a parameterized class
        • Constraint parameters
      • Extending the fridge
      • Time for action A fridge with constraints
        • What just happened?
        • Have a go hero Creating a typed container
        • Pop quiz Verify your knowledge
      • Summary
    • 5. The Dynamic Type and Properties
      • Freeing yourself from the typing system
      • Time for action Assigning to Dynamic variables
      • Time for action Assigning from Dynamic variables
        • Field access
        • Functions in Dynamic variables
      • Parameterized Dynamic class
      • Classes implementing Dynamic
      • Time for action Implementing a non-parameterized Dynamic
        • What just happened?
      • Time for action Implementing a parameterized Dynamic
        • What just happened?
      • Using a resolve function when implementing Dynamic
      • Time for action Writing our Component class
      • Time for action Parsing the configuration file
      • Time for action Testing our parser
      • Time for action Writing the configuration file
      • Time for action Testing the writer
      • The dot-notation
      • Thoughts on writing our parser
      • The dynamic keyword
      • Warning
      • Properties in classes
        • Use
        • Implementation
          • Writing the getter
          • Writing the setter
          • Defining the property
        • Accessibility
        • The default getter
        • The default setter
        • The dynamic getter and setter
        • The never getter and setter
        • A compile-time feature
        • Have a go hero Writing a person class
        • Pop Quiz Doing the things
      • Summary
    • 6. Using and Writing Interfaces, Typedefs, and Enums
      • Interfaces
        • Purpose
        • Default visibility
        • Type inference
        • Implementing an interface
          • Implementation and type inference
          • Implementation and visibility
          • Making use of interfaces
      • Typedefs
      • Time for action Naming Anonymous Types
        • What just happened?
        • Aliases
        • Visibility
          • Private typedefs
        • Duck typing
        • Typedefs to access private members
        • Creating iterable objects
      • Enums
        • Basic enums
        • Enums' constructors
        • Switching on basic enums
        • Enums with parameters
      • Time for action Switching over enums with parameters
        • What just happened?
        • Have a go hero Write a fridge with an iterator
      • Time for action Writing our Fridge class
        • What just happened?
      • Time for action Making it possible to iterate over a fridge
        • What just happened?
      • Time for action Creating the iterator
        • What just happened?
      • Our main function
        • Pop quiz Typedef, interfaces, and Enums
      • Summary
    • 7. Communication Between haXe Programs
      • The haXe serializer
        • Usefulness
        • Possibilities
          • Class instances
          • Custom serialization
          • Enum instances
          • Unserializing exceptions
          • Reducing size and preventing infinite loops
      • haXe remoting
        • Supported protocols and layers
          • Over HTTP
            • Implementation
          • Using the ExternalInterface
            • The JavaScript side
            • The Flash side
          • Using AMF
      • Time for action Writing a zoo management tool
      • The Animal class
      • Representing the zoo
      • Time for action Saving the list
      • Time for action Loading the list
      • The remoting service
        • The getList function
        • The createAnimal function
        • Tying it together
      • The client
      • Time for action Initializing the client connection
        • What just happened?
          • The createAnimal function
          • The listAnimals function
          • The main menu
        • Compiling the client
        • Have a go hero Represent data from JS in Flash
        • Pop quiz Doing the things
      • Summary
    • 8. Accessing Databases
      • Connecting to databases
        • php.db.Connection and neko.db.Connection
          • SQL usage
          • The interface
            • The close function
            • The commit function
            • The rollback function
            • The escape function
            • The quote function
            • The request function
            • The addValue function
            • The dbName function
            • The lastInsertId function
        • Connecting to the database
          • MySQL
          • SQLite
        • Dealing with results
          • Typing
      • The SPOD
        • Setting a SPOD object
        • The table name
        • Non-mapped fields
        • The cache
      • A concrete example of SPOD use
        • Setting the object
        • Setting the connection
      • The Manager
        • The all function
        • The count function
        • The delete function
        • The get function
        • The getWithKeys function
        • The object function
        • The objects function
        • The search function
      • Handling relations
      • Creating a blogging system
      • Time for action Creating the Users table
        • What just happened?
      • Time for action Creating the User class
        • What just happened?
      • Time for action Creating the Posts table
      • Time for action Creating the Post class
        • What just happened?
      • Time for action Creating the connection to the database
        • What just happened?
      • Time for action Listing posts
      • Time for action Listing users
      • Time for action Adding a user
      • Time for action Adding a post
      • Time for action Branching it with the main function
        • Have a go hero Listing posts from a specific user
        • Pop quiz Doing the things
      • Summary
    • 9. Templating
      • Introduction to the haxe.Template class
        • Printing a value
        • Branching
        • Using lists, arrays, and other iterables
      • Time for action Executing code from a template
        • What just happened?
      • Integrating subtemplates
      • Creating a blog's front page
      • Time for action Creating our SPOD class
      • Time for action Connecting to the database
      • Time for action Creating our template
      • Time for action Reading the template from resources
      • Time for action Executing the template
      • Time for action Testing the result
        • Pop quiz Doing the thing
        • Have a go hero Doing more with the thing
      • Summary
    • 10. Interfacing with the Target Platform
      • Extern classes
      • Time for action Writing an extern
        • What just happened?
        • Using an extern
        • Class path
        • Limitations
        • The __init__ magic
      • Native types and haXe types
        • The Neko and PHP cases
          • PHP functions
          • Neko functions
      • Magic functions
        • The Flash magic
          • __new__
          • __arguments__
          • __typeof__
          • __delete__
          • __eval__
          • __gettimer__
          • __geturl__
          • __instanceof__
          • __random__
          • __trace__
          • __keys__
          • __global__
          • __as__
          • __is__
          • __in__
        • The Neko magic
          • Arrays and strings
        • The PHP magic
          • __php__
          • __call__
          • __var__
          • __physeq__
        • Have a go hero Wrapping parameters in an array
        • Pop quiz Doing the things
      • Summary
    • 11. A Dynamic Website Using JavaScript
      • Manipulating the DOM
        • The browser's DOM
          • Nodes
          • Events
            • Level 1
            • Level 2
      • Time for action Using events from the DOM level 0
        • What just happened?
      • Time for action Using DOM level 2 events
        • What just happened?
      • Time for action Working around by storing reference to functions
        • What just happened?
        • Have a go hero A dynamic website with JavaScript
      • Time for action Setting up the model
      • Time for action Setting up our view
        • What just happened?
      • Time for action Setting up the controller
      • Time for action Creating a computer view
        • What just happened?
      • The main class
      • Summary
    • 12. Creating a Game with haXe and Flash
      • Embedding assets
      • Time for action Installing SWFMILL
      • Time for action Creating a library
      • Time for action Using assets
      • Event handling
        • Have a go hero A game with Flash
        • The game design
        • The assets
        • The player's character
      • Time for action Drawing the character
      • Time for action Handling moves
        • What just happened?
      • Time for action Moving the character
        • What just happened?
      • Time for action Adding balls
        • What just happened?
      • Time for action Updating the position
        • What just happened?
      • Time for action Detecting collisions
        • What just happened?
        • Have a go hero Adding a proper score display
        • Have a go hero Adding an online score table
        • Pop quiz Software used
      • Summary
    • A. Pop Quiz Answers
      • Chapter 1: Getting to know haXe
      • Chapter 3: Being Cross-platform with haXe
      • Chapter 4: Understanding Types
      • Chapter 5: The Dynamic Type and Properties
      • Chapter 6: Using and Writing Interfaces, Typedefs, and Enums
      • Chapter 7: Communication Between haXe Programs
      • Chapter 8: Accessing Databases
      • Chapter 9: Templating
      • Chapter 10: Interfacing with the Target Platform
      • Chapter 12: Creating a Game with haXe and Flash
    • Index
  • Title: haXe 2 Beginner's Guide. Develop exciting applications with this multi-platform programming language
  • Author: Benjamin Dasnois, haXe PAYPAL haxelang@gmail.com
  • Original title: haXe 2 Beginner's Guide. Develop exciting applications with this multi-platform programming language
  • ISBN: 9781849512572, 9781849512572
  • Date of issue: 2011-07-26
  • Format: Ebook
  • Item ID: e_3b6j
  • Publisher: Packt Publishing