diff --git a/.gitignore b/.gitignore
index d11897e..2a4307a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -105,8 +105,6 @@
 /contrib/fb303/py/fb303/ttypes.py
 /depcomp
 /install-sh
-/lib/as3/.gradle/
-/lib/as3/build/
 /lib/cl/backport-update.zip
 /lib/cl/lib
 /lib/cl/run-tests
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ea71cc..d151fc0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,10 +98,6 @@
     endif()
 endif()
 
-if(BUILD_AS3)
-    add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/as3)
-endif()
-
 if(BUILD_C_GLIB)
     add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/c_glib)
     if(BUILD_TESTING)
diff --git a/LANGUAGES.md b/LANGUAGES.md
index 08c431d..4d88721 100644
--- a/LANGUAGES.md
+++ b/LANGUAGES.md
@@ -1,6 +1,8 @@
 # Apache Thrift Language Support #
 
-Guidance For: 0.13.0 | 
+Guidance For: 0.15.0 | 
+[0.14.0](https://github.com/apache/thrift/blob/v0.14.0/LANGUAGES.md) | 
+[0.13.0](https://github.com/apache/thrift/blob/v0.13.0/LANGUAGES.md) | 
 [0.12.0](https://github.com/apache/thrift/blob/v0.12.0/LANGUAGES.md) | 
 [0.11.0](https://github.com/apache/thrift/blob/0.11.0/LANGUAGES.md)
 
@@ -58,17 +60,6 @@
 </thead>
 <tbody>
 <tr align=center>
-<td align=left><a href="https://github.com/apache/thrift/blob/master/lib/as3/README.md">ActionScript</a></td>
-<!-- Since -----------------><td>0.3.0</td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Language Levels -------><td colspan=2>FLEX SDK 4.6</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
-<td align=left><a href="https://issues.apache.org/jira/issues/?jql=project%20%3D%20THRIFT%20AND%20component%20in%20(%22AS3%20-%20Compiler%22%2C%20%22AS3%20-%20Library%22)%20and%20status%20not%20in%20(fixed%2C%20resolved%2C%20closed)">ActionScript</a></td>
-</tr>
-<tr align=center>
 <td align=left><a href="https://github.com/apache/thrift/blob/master/lib/c_glib/README.md">C (glib)</a></td>
 <!-- Since -----------------><td>0.6.0</td>
 <!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 0675f0e..34604d0 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -72,7 +72,6 @@
 endmacro()
 
 # The following compiler can be enabled or disabled
-THRIFT_ADD_COMPILER(as3     "Enable compiler for ActionScript 3" ON)
 THRIFT_ADD_COMPILER(c_glib  "Enable compiler for C with Glib" ON)
 THRIFT_ADD_COMPILER(cl      "Enable compiler for Common LISP" ON)
 THRIFT_ADD_COMPILER(cpp     "Enable compiler for C++" ON)
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 05c9121..2b83d94 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -69,8 +69,7 @@
                  src/thrift/platform.h
 
 # Specific client generator source
-thrift_SOURCES += src/thrift/generate/t_as3_generator.cc \
-                  src/thrift/generate/t_c_glib_generator.cc \
+thrift_SOURCES += src/thrift/generate/t_c_glib_generator.cc \
                   src/thrift/generate/t_cl_generator.cc \
                   src/thrift/generate/t_cpp_generator.cc \
                   src/thrift/generate/t_d_generator.cc \
diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj
index dc9793f..31bc595 100644
--- a/compiler/cpp/compiler.vcxproj
+++ b/compiler/cpp/compiler.vcxproj
@@ -53,7 +53,6 @@
   <ItemGroup>
     <ClCompile Include="src\thrift\audit\t_audit.cpp" />
     <ClCompile Include="src\thrift\common.cc" />
-    <ClCompile Include="src\thrift\generate\t_as3_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_c_glib_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_cl_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_cpp_generator.cc" />
diff --git a/compiler/cpp/compiler.vcxproj.filters b/compiler/cpp/compiler.vcxproj.filters
index 360c446..b5fdce7 100644
--- a/compiler/cpp/compiler.vcxproj.filters
+++ b/compiler/cpp/compiler.vcxproj.filters
@@ -92,9 +92,6 @@
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\audit\t_audit.cpp"/>
-    <ClCompile Include="src\generate\t_as3_generator.cc">
-      <Filter>generate</Filter>
-    </ClCompile>
     <ClCompile Include="src\generate\t_cocoa_generator.cc">
       <Filter>generate</Filter>
     </ClCompile>
diff --git a/compiler/cpp/src/thrift/generate/t_as3_generator.cc b/compiler/cpp/src/thrift/generate/t_as3_generator.cc
deleted file mode 100644
index fa2967b..0000000
--- a/compiler/cpp/src/thrift/generate/t_as3_generator.cc
+++ /dev/null
@@ -1,2592 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include <sstream>
-#include <string>
-#include <fstream>
-#include <iostream>
-#include <vector>
-#include <cctype>
-
-#include <sys/stat.h>
-#include <stdexcept>
-
-#include "thrift/platform.h"
-#include "thrift/generate/t_oop_generator.h"
-
-using std::map;
-using std::ostream;
-using std::ostringstream;
-using std::string;
-using std::stringstream;
-using std::vector;
-
-static const string endl = "\n"; // avoid ostream << std::endl flushes
-
-/**
- * AS3 code generator.
- *
- */
-class t_as3_generator : public t_oop_generator {
-public:
-  t_as3_generator(t_program* program,
-                  const std::map<std::string, std::string>& parsed_options,
-                  const std::string& option_string)
-    : t_oop_generator(program) {
-    (void)option_string;
-    std::map<std::string, std::string>::const_iterator iter;
-
-    bindable_ = false;
-    for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
-      if( iter->first.compare("bindable") == 0) {
-        bindable_ = true;
-      } else {
-        throw "unknown option as3:" + iter->first;
-      }
-    }
-
-    out_dir_base_ = "gen-as3";
-  }
-
-  /**
-   * Init and close methods
-   */
-
-  void init_generator() override;
-  void close_generator() override;
-
-  void generate_consts(std::vector<t_const*> consts) override;
-
-  /**
-   * Program-level generation functions
-   */
-
-  void generate_typedef(t_typedef* ttypedef) override;
-  void generate_enum(t_enum* tenum) override;
-  void generate_struct(t_struct* tstruct) override;
-  void generate_xception(t_struct* txception) override;
-  void generate_service(t_service* tservice) override;
-
-  void print_const_value(std::ostream& out,
-                         std::string name,
-                         t_type* type,
-                         t_const_value* value,
-                         bool in_static,
-                         bool defval = false);
-  std::string render_const_value(ostream& out,
-                                 std::string name,
-                                 t_type* type,
-                                 t_const_value* value);
-
-  /**
-   * Service-level generation functions
-   */
-
-  void generate_as3_struct(t_struct* tstruct, bool is_exception);
-
-  void generate_as3_struct_definition(std::ostream& out,
-                                      t_struct* tstruct,
-                                      bool is_xception = false,
-                                      bool in_class = false,
-                                      bool is_result = false);
-  // removed -- equality,compare_to
-  void generate_as3_struct_reader(std::ostream& out, t_struct* tstruct);
-  void generate_as3_validator(std::ostream& out, t_struct* tstruct);
-  void generate_as3_struct_result_writer(std::ostream& out, t_struct* tstruct);
-  void generate_as3_struct_writer(std::ostream& out, t_struct* tstruct);
-  void generate_as3_struct_tostring(std::ostream& out, t_struct* tstruct, bool bindable);
-  void generate_as3_meta_data_map(std::ostream& out, t_struct* tstruct);
-  void generate_field_value_meta_data(std::ostream& out, t_type* type);
-  std::string get_as3_type_string(t_type* type);
-  void generate_reflection_setters(std::ostringstream& out,
-                                   t_type* type,
-                                   std::string field_name,
-                                   std::string cap_name);
-  void generate_reflection_getters(std::ostringstream& out,
-                                   t_type* type,
-                                   std::string field_name,
-                                   std::string cap_name);
-  void generate_generic_field_getters_setters(std::ostream& out, t_struct* tstruct);
-  void generate_generic_isset_method(std::ostream& out, t_struct* tstruct);
-  void generate_as3_bean_boilerplate(std::ostream& out, t_struct* tstruct, bool bindable);
-
-  void generate_function_helpers(t_function* tfunction);
-  std::string get_cap_name(std::string name);
-  std::string generate_isset_check(t_field* field);
-  std::string generate_isset_check(std::string field);
-  void generate_isset_set(ostream& out, t_field* field);
-  // removed std::string isset_field_id(t_field* field);
-
-  void generate_service_interface(t_service* tservice);
-  void generate_service_helpers(t_service* tservice);
-  void generate_service_client(t_service* tservice);
-  void generate_service_server(t_service* tservice);
-  void generate_process_function(t_service* tservice, t_function* tfunction);
-
-  /**
-   * Serialization constructs
-   */
-
-  void generate_deserialize_field(std::ostream& out, t_field* tfield, std::string prefix = "");
-
-  void generate_deserialize_struct(std::ostream& out, t_struct* tstruct, std::string prefix = "");
-
-  void generate_deserialize_container(std::ostream& out, t_type* ttype, std::string prefix = "");
-
-  void generate_deserialize_set_element(std::ostream& out, t_set* tset, std::string prefix = "");
-
-  void generate_deserialize_map_element(std::ostream& out, t_map* tmap, std::string prefix = "");
-
-  void generate_deserialize_list_element(std::ostream& out,
-                                         t_list* tlist,
-                                         std::string prefix = "");
-
-  void generate_serialize_field(std::ostream& out, t_field* tfield, std::string prefix = "");
-
-  void generate_serialize_struct(std::ostream& out, t_struct* tstruct, std::string prefix = "");
-
-  void generate_serialize_container(std::ostream& out, t_type* ttype, std::string prefix = "");
-
-  void generate_serialize_map_element(std::ostream& out,
-                                      t_map* tmap,
-                                      std::string iter,
-                                      std::string map);
-
-  void generate_serialize_set_element(std::ostream& out, t_set* tmap, std::string iter);
-
-  void generate_serialize_list_element(std::ostream& out, t_list* tlist, std::string iter);
-
-  void generate_as3_doc(std::ostream& out, t_doc* tdoc);
-
-  void generate_as3_doc(std::ostream& out, t_function* tdoc);
-
-  /**
-   * Helper rendering functions
-   */
-
-  std::string as3_package();
-  std::string as3_type_imports();
-  std::string as3_thrift_imports();
-  std::string as3_thrift_gen_imports(t_struct* tstruct, string& imports);
-  std::string as3_thrift_gen_imports(t_service* tservice);
-  std::string type_name(t_type* ttype, bool in_container = false, bool in_init = false);
-  std::string base_type_name(t_base_type* tbase, bool in_container = false);
-  std::string declare_field(t_field* tfield, bool init = false);
-  std::string function_signature(t_function* tfunction, std::string prefix = "");
-  std::string argument_list(t_struct* tstruct);
-  std::string type_to_enum(t_type* ttype);
-  std::string get_enum_class_name(t_type* type) override;
-
-  bool type_can_be_null(t_type* ttype) {
-    ttype = get_true_type(ttype);
-
-    return ttype->is_container() || ttype->is_struct() || ttype->is_xception()
-           || ttype->is_string();
-  }
-
-  std::string constant_name(std::string name);
-
-private:
-  /**
-   * File streams
-   */
-
-  std::string package_name_;
-  ofstream_with_content_based_conditional_update f_service_;
-  std::string package_dir_;
-
-  bool bindable_;
-};
-
-/**
- * Prepares for file generation by opening up the necessary file output
- * streams.
- *
- * @param tprogram The program to generate
- */
-void t_as3_generator::init_generator() {
-  // Make output directory
-  MKDIR(get_out_dir().c_str());
-  package_name_ = program_->get_namespace("as3");
-
-  string dir = package_name_;
-  string subdir = get_out_dir();
-  string::size_type loc;
-  while ((loc = dir.find(".")) != string::npos) {
-    subdir = subdir + "/" + dir.substr(0, loc);
-    MKDIR(subdir.c_str());
-    dir = dir.substr(loc + 1);
-  }
-  if (dir.size() > 0) {
-    subdir = subdir + "/" + dir;
-    MKDIR(subdir.c_str());
-  }
-
-  package_dir_ = subdir;
-}
-
-/**
- * Packages the generated file
- *
- * @return String of the package, i.e. "package org.apache.thriftdemo;"
- */
-string t_as3_generator::as3_package() {
-  if (!package_name_.empty()) {
-    return string("package ") + package_name_ + " ";
-  }
-  return "package ";
-}
-
-/**
- * Prints standard as3 imports
- *
- * @return List of imports for As3 types that are used in here
- */
-string t_as3_generator::as3_type_imports() {
-  return string() + "import org.apache.thrift.Set;\n" + "import flash.utils.ByteArray;\n"
-         + "import flash.utils.Dictionary;\n\n";
-}
-
-/**
- * Prints standard as3 imports
- *
- * @return List of imports necessary for thrift
- */
-string t_as3_generator::as3_thrift_imports() {
-  return string() + "import org.apache.thrift.*;\n" + "import org.apache.thrift.meta_data.*;\n"
-         + "import org.apache.thrift.protocol.*;\n\n";
-}
-
-/**
- * Prints imports needed for a given type
- *
- * @return List of imports necessary for a given t_struct
- */
-string t_as3_generator::as3_thrift_gen_imports(t_struct* tstruct, string& imports) {
-
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-
-  // For each type check if it is from a differnet namespace
-  for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    t_program* program = (*m_iter)->get_type()->get_program();
-    if (program != nullptr && program != program_) {
-      string package = program->get_namespace("as3");
-      if (!package.empty()) {
-        if (imports.find(package + "." + (*m_iter)->get_type()->get_name()) == string::npos) {
-          imports.append("import " + package + "." + (*m_iter)->get_type()->get_name() + ";\n");
-        }
-      }
-    }
-  }
-  return imports;
-}
-
-/**
- * Prints imports needed for a given type
- *
- * @return List of imports necessary for a given t_service
- */
-string t_as3_generator::as3_thrift_gen_imports(t_service* tservice) {
-  string imports;
-  const vector<t_function*>& functions = tservice->get_functions();
-  vector<t_function*>::const_iterator f_iter;
-
-  // For each type check if it is from a differnet namespace
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    t_program* program = (*f_iter)->get_returntype()->get_program();
-    if (program != nullptr && program != program_) {
-      string package = program->get_namespace("as3");
-      if (!package.empty()) {
-        if (imports.find(package + "." + (*f_iter)->get_returntype()->get_name()) == string::npos) {
-          imports.append("import " + package + "." + (*f_iter)->get_returntype()->get_name()
-                         + ";\n");
-        }
-      }
-    }
-
-    as3_thrift_gen_imports((*f_iter)->get_arglist(), imports);
-    as3_thrift_gen_imports((*f_iter)->get_xceptions(), imports);
-  }
-
-  return imports;
-}
-
-/**
- * Nothing in As3
- */
-void t_as3_generator::close_generator() {
-}
-
-/**
- * Generates a typedef. This is not done in As3, since it does
- * not support arbitrary name replacements, and it'd be a wacky waste
- * of overhead to make wrapper classes.
- *
- * @param ttypedef The type definition
- */
-void t_as3_generator::generate_typedef(t_typedef* ttypedef) {
-  (void)ttypedef;
-}
-
-/**
- * Enums are a class with a set of static constants.
- *
- * @param tenum The enumeration
- */
-void t_as3_generator::generate_enum(t_enum* tenum) {
-  // Make output file
-  string f_enum_name = package_dir_ + "/" + (tenum->get_name()) + ".as";
-  ofstream_with_content_based_conditional_update f_enum;
-  f_enum.open(f_enum_name);
-
-  // Comment and package it
-  f_enum << autogen_comment() << as3_package() << endl;
-
-  scope_up(f_enum);
-  // Add as3 imports
-  f_enum << string() + "import org.apache.thrift.Set;" << endl << "import flash.utils.Dictionary;"
-         << endl;
-
-  indent(f_enum) << "public class " << tenum->get_name() << " ";
-  scope_up(f_enum);
-
-  vector<t_enum_value*> constants = tenum->get_constants();
-  vector<t_enum_value*>::iterator c_iter;
-  for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
-    int value = (*c_iter)->get_value();
-    indent(f_enum) << "public static const " << (*c_iter)->get_name() << ":int = " << value << ";"
-                   << endl;
-  }
-
-  // Create a static Set with all valid values for this enum
-  f_enum << endl;
-
-  indent(f_enum) << "public static const VALID_VALUES:Set = new Set(";
-  indent_up();
-  bool firstValue = true;
-  for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
-    // populate set
-    f_enum << (firstValue ? "" : ", ") << (*c_iter)->get_name();
-    firstValue = false;
-  }
-  indent_down();
-  f_enum << ");" << endl;
-
-  indent(f_enum) << "public static const VALUES_TO_NAMES:Dictionary = new Dictionary();" << endl;
-
-  scope_up(f_enum);
-  for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
-    indent(f_enum) << "VALUES_TO_NAMES[" << (*c_iter)->get_name() << "] = \""
-                   << (*c_iter)->get_name() << "\";" << endl;
-  }
-  f_enum << endl;
-
-  scope_down(f_enum);
-
-  scope_down(f_enum); // end class
-
-  scope_down(f_enum); // end package
-
-  f_enum.close();
-}
-
-/**
- * Generates a class that holds all the constants.
- */
-void t_as3_generator::generate_consts(std::vector<t_const*> consts) {
-  if (consts.empty()) {
-    return;
-  }
-
-  string f_consts_name = package_dir_ + "/" + program_name_ + "Constants.as";
-  ofstream_with_content_based_conditional_update f_consts;
-  f_consts.open(f_consts_name);
-
-  // Print header
-  f_consts << autogen_comment() << as3_package();
-
-  scope_up(f_consts);
-  f_consts << endl;
-
-  f_consts << as3_type_imports();
-
-  indent(f_consts) << "public class " << program_name_ << "Constants {" << endl << endl;
-  indent_up();
-  vector<t_const*>::iterator c_iter;
-  for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
-    print_const_value(f_consts,
-                      (*c_iter)->get_name(),
-                      (*c_iter)->get_type(),
-                      (*c_iter)->get_value(),
-                      false);
-  }
-  indent_down();
-  indent(f_consts) << "}" << endl;
-  scope_down(f_consts);
-  f_consts.close();
-}
-
-void t_as3_generator::print_const_value(std::ostream& out,
-                                        string name,
-                                        t_type* type,
-                                        t_const_value* value,
-                                        bool in_static,
-                                        bool defval) {
-  type = get_true_type(type);
-
-  indent(out);
-  if (!defval) {
-    out << (in_static ? "var " : "public static const ");
-  }
-  if (type->is_base_type()) {
-    string v2 = render_const_value(out, name, type, value);
-    out << name;
-    if (!defval) {
-      out << ":" << type_name(type);
-    }
-    out << " = " << v2 << ";" << endl << endl;
-  } else if (type->is_enum()) {
-    out << name;
-    if (!defval) {
-      out << ":" << type_name(type);
-    }
-    out << " = " << value->get_integer() << ";" << endl << endl;
-  } else if (type->is_struct() || type->is_xception()) {
-    const vector<t_field*>& fields = ((t_struct*)type)->get_members();
-    vector<t_field*>::const_iterator f_iter;
-    const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
-    map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
-    out << name << ":" << type_name(type) << " = new " << type_name(type, false, true) << "();"
-        << endl;
-    if (!in_static) {
-      indent(out) << "{" << endl;
-      indent_up();
-      indent(out) << "new function():void {" << endl;
-      indent_up();
-    }
-    for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
-      t_type* field_type = nullptr;
-      for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-        if ((*f_iter)->get_name() == v_iter->first->get_string()) {
-          field_type = (*f_iter)->get_type();
-        }
-      }
-      if (field_type == nullptr) {
-        throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string();
-      }
-      string val = render_const_value(out, name, field_type, v_iter->second);
-      indent(out) << name << ".";
-      out << v_iter->first->get_string() << " = " << val << ";" << endl;
-    }
-    if (!in_static) {
-      indent_down();
-      indent(out) << "}();" << endl;
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-    out << endl;
-  } else if (type->is_map()) {
-    out << name;
-    if (!defval) {
-      out << ":" << type_name(type);
-    }
-    out << " = new " << type_name(type, false, true) << "();" << endl;
-    if (!in_static) {
-      indent(out) << "{" << endl;
-      indent_up();
-      indent(out) << "new function():void {" << endl;
-      indent_up();
-    }
-    t_type* ktype = ((t_map*)type)->get_key_type();
-    t_type* vtype = ((t_map*)type)->get_val_type();
-    const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
-    map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
-    for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
-      string key = render_const_value(out, name, ktype, v_iter->first);
-      string val = render_const_value(out, name, vtype, v_iter->second);
-      indent(out) << name << "[" << key << "] = " << val << ";" << endl;
-    }
-    if (!in_static) {
-      indent_down();
-      indent(out) << "}();" << endl;
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-    out << endl;
-  } else if (type->is_list() || type->is_set()) {
-    out << name;
-    if (!defval) {
-      out << ":" << type_name(type);
-    }
-    out << " = new " << type_name(type, false, true) << "();" << endl;
-    if (!in_static) {
-      indent(out) << "{" << endl;
-      indent_up();
-      indent(out) << "new function():void {" << endl;
-      indent_up();
-    }
-    t_type* etype;
-    if (type->is_list()) {
-      etype = ((t_list*)type)->get_elem_type();
-    } else {
-      etype = ((t_set*)type)->get_elem_type();
-    }
-    const vector<t_const_value*>& val = value->get_list();
-    vector<t_const_value*>::const_iterator v_iter;
-    for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
-      string val = render_const_value(out, name, etype, *v_iter);
-      indent(out) << name << "." << (type->is_list() ? "push" : "add") << "(" << val << ");"
-                  << endl;
-    }
-    if (!in_static) {
-      indent_down();
-      indent(out) << "}();" << endl;
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-    out << endl;
-  } else {
-    throw "compiler error: no const of type " + type->get_name();
-  }
-}
-
-string t_as3_generator::render_const_value(ostream& out,
-                                           string name,
-                                           t_type* type,
-                                           t_const_value* value) {
-  (void)name;
-  type = get_true_type(type);
-  std::ostringstream render;
-
-  if (type->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-    switch (tbase) {
-    case t_base_type::TYPE_STRING:
-      render << '"' << get_escaped_string(value) << '"';
-      break;
-    case t_base_type::TYPE_BOOL:
-      render << ((value->get_integer() > 0) ? "true" : "false");
-      break;
-    case t_base_type::TYPE_I8:
-      render << "(byte)" << value->get_integer();
-      break;
-    case t_base_type::TYPE_I16:
-      render << "(short)" << value->get_integer();
-      break;
-    case t_base_type::TYPE_I32:
-      render << value->get_integer();
-      break;
-    case t_base_type::TYPE_I64:
-      render << value->get_integer() << "L";
-      break;
-    case t_base_type::TYPE_DOUBLE:
-      if (value->get_type() == t_const_value::CV_INTEGER) {
-        render << "(double)" << value->get_integer();
-      } else {
-        render << value->get_double();
-      }
-      break;
-    default:
-      throw "compiler error: no const of base type " + t_base_type::t_base_name(tbase);
-    }
-  } else if (type->is_enum()) {
-    render << value->get_integer();
-  } else {
-    string t = tmp("tmp");
-    print_const_value(out, t, type, value, true);
-    render << t;
-  }
-
-  return render.str();
-}
-
-/**
- * Generates a struct definition for a thrift data type. This is a class
- * with data members, read(), write(), and an inner Isset class.
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_struct(t_struct* tstruct) {
-  generate_as3_struct(tstruct, false);
-}
-
-/**
- * Exceptions are structs, but they inherit from Exception
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_xception(t_struct* txception) {
-  generate_as3_struct(txception, true);
-}
-
-/**
- * As3 struct definition.
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_as3_struct(t_struct* tstruct, bool is_exception) {
-  // Make output file
-  string f_struct_name = package_dir_ + "/" + (tstruct->get_name()) + ".as";
-  ofstream_with_content_based_conditional_update f_struct;
-  f_struct.open(f_struct_name.c_str());
-
-  f_struct << autogen_comment() << as3_package();
-
-  scope_up(f_struct);
-  f_struct << endl;
-
-  string imports;
-
-  f_struct << as3_type_imports() << as3_thrift_imports() << as3_thrift_gen_imports(tstruct, imports)
-           << endl;
-
-  if (bindable_ && !is_exception) {
-    f_struct << "import flash.events.Event;" << endl << "import flash.events.EventDispatcher;"
-             << endl << "import mx.events.PropertyChangeEvent;" << endl;
-  }
-
-  generate_as3_struct_definition(f_struct, tstruct, is_exception);
-
-  scope_down(f_struct); // end of package
-  f_struct.close();
-}
-
-/**
- * As3 struct definition. This has various parameters, as it could be
- * generated standalone or inside another class as a helper. If it
- * is a helper than it is a static class.
- *
- * @param tstruct      The struct definition
- * @param is_exception Is this an exception?
- * @param in_class     If inside a class, needs to be static class
- * @param is_result    If this is a result it needs a different writer
- */
-void t_as3_generator::generate_as3_struct_definition(ostream& out,
-                                                     t_struct* tstruct,
-                                                     bool is_exception,
-                                                     bool in_class,
-                                                     bool is_result) {
-  generate_as3_doc(out, tstruct);
-
-  bool is_final = (tstruct->annotations_.find("final") != tstruct->annotations_.end());
-  bool bindable = !is_exception && !in_class && bindable_;
-
-  indent(out) << (in_class ? "" : "public ") << (is_final ? "final " : "") << "class "
-              << tstruct->get_name() << " ";
-
-  if (is_exception) {
-    out << "extends Error ";
-  } else if (bindable) {
-    out << "extends EventDispatcher ";
-  }
-  out << "implements TBase ";
-
-  scope_up(out);
-
-  indent(out) << "private static const STRUCT_DESC:TStruct = new TStruct(\"" << tstruct->get_name()
-              << "\");" << endl;
-
-  // Members are public for -as3, private for -as3bean
-  const vector<t_field*>& members = tstruct->get_members();
-  vector<t_field*>::const_iterator m_iter;
-
-  for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    indent(out) << "private static const " << constant_name((*m_iter)->get_name())
-                << "_FIELD_DESC:TField = new TField(\"" << (*m_iter)->get_name() << "\", "
-                << type_to_enum((*m_iter)->get_type()) << ", " << (*m_iter)->get_key() << ");"
-                << endl;
-  }
-
-  out << endl;
-
-  for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    generate_as3_doc(out, *m_iter);
-    indent(out) << "private var _" << (*m_iter)->get_name() + ":" + type_name((*m_iter)->get_type())
-                << ";" << endl;
-
-    indent(out) << "public static const " << upcase_string((*m_iter)->get_name())
-                << ":int = " << (*m_iter)->get_key() << ";" << endl;
-  }
-
-  out << endl;
-
-  // Inner Isset class
-  if (members.size() > 0) {
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-      if (!type_can_be_null((*m_iter)->get_type())) {
-        indent(out) << "private var __isset_" << (*m_iter)->get_name() << ":Boolean = false;"
-                    << endl;
-      }
-    }
-  }
-
-  out << endl;
-
-  generate_as3_meta_data_map(out, tstruct);
-
-  // Static initializer to populate global class to struct metadata map
-  indent(out) << "{" << endl;
-  indent_up();
-  indent(out) << "FieldMetaData.addStructMetaDataMap(" << type_name(tstruct) << ", metaDataMap);"
-              << endl;
-  indent_down();
-  indent(out) << "}" << endl << endl;
-
-  // Default constructor
-  indent(out) << "public function " << tstruct->get_name() << "() {" << endl;
-  indent_up();
-  for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    if ((*m_iter)->get_value() != nullptr) {
-      indent(out) << "this._" << (*m_iter)->get_name() << " = "
-                  << (*m_iter)->get_value()->get_integer() << ";" << endl;
-    }
-  }
-  indent_down();
-  indent(out) << "}" << endl << endl;
-
-  generate_as3_bean_boilerplate(out, tstruct, bindable);
-  generate_generic_field_getters_setters(out, tstruct);
-  generate_generic_isset_method(out, tstruct);
-
-  generate_as3_struct_reader(out, tstruct);
-  if (is_result) {
-    generate_as3_struct_result_writer(out, tstruct);
-  } else {
-    generate_as3_struct_writer(out, tstruct);
-  }
-  generate_as3_struct_tostring(out, tstruct, bindable);
-  generate_as3_validator(out, tstruct);
-  scope_down(out);
-  out << endl;
-}
-
-/**
- * Generates a function to read all the fields of the struct.
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_as3_struct_reader(ostream& out, t_struct* tstruct) {
-  out << indent() << "public function read(iprot:TProtocol):void {" << endl;
-  indent_up();
-
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  // Declare stack tmp variables and read struct header
-  out << indent() << "var field:TField;" << endl << indent() << "iprot.readStructBegin();" << endl;
-
-  // Loop over reading in fields
-  indent(out) << "while (true)" << endl;
-  scope_up(out);
-
-  // Read beginning field marker
-  indent(out) << "field = iprot.readFieldBegin();" << endl;
-
-  // Check for field STOP marker and break
-  indent(out) << "if (field.type == TType.STOP) { " << endl;
-  indent_up();
-  indent(out) << "break;" << endl;
-  indent_down();
-  indent(out) << "}" << endl;
-
-  // Switch statement on the field we are reading
-  indent(out) << "switch (field.id)" << endl;
-
-  scope_up(out);
-
-  // Generate deserialization code for known cases
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    indent(out) << "case " << upcase_string((*f_iter)->get_name()) << ":" << endl;
-    indent_up();
-    indent(out) << "if (field.type == " << type_to_enum((*f_iter)->get_type()) << ") {" << endl;
-    indent_up();
-
-    generate_deserialize_field(out, *f_iter, "this.");
-    generate_isset_set(out, *f_iter);
-    indent_down();
-    out << indent() << "} else { " << endl << indent() << "  TProtocolUtil.skip(iprot, field.type);"
-        << endl << indent() << "}" << endl << indent() << "break;" << endl;
-    indent_down();
-  }
-
-  // In the default case we skip the field
-  out << indent() << "default:" << endl << indent() << "  TProtocolUtil.skip(iprot, field.type);"
-      << endl << indent() << "  break;" << endl;
-
-  scope_down(out);
-
-  // Read field end marker
-  indent(out) << "iprot.readFieldEnd();" << endl;
-
-  scope_down(out);
-
-  out << indent() << "iprot.readStructEnd();" << endl << endl;
-
-  // in non-beans style, check for required fields of primitive type
-  // (which can be checked here but not in the general validate method)
-  out << endl << indent() << "// check for required fields of primitive type, which can't be "
-                             "checked in the validate method" << endl;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    if ((*f_iter)->get_req() == t_field::T_REQUIRED && !type_can_be_null((*f_iter)->get_type())) {
-      out << indent() << "if (!__isset_" << (*f_iter)->get_name() << ") {" << endl << indent()
-          << "  throw new TProtocolError(TProtocolError.UNKNOWN, \"Required field '"
-          << (*f_iter)->get_name()
-          << "' was not found in serialized data! Struct: \" + toString());" << endl << indent()
-          << "}" << endl;
-    }
-  }
-
-  // performs various checks (e.g. check that all required fields are set)
-  indent(out) << "validate();" << endl;
-
-  indent_down();
-  out << indent() << "}" << endl << endl;
-}
-
-// generates as3 method to perform various checks
-// (e.g. check that all required fields are set)
-void t_as3_generator::generate_as3_validator(ostream& out, t_struct* tstruct) {
-  indent(out) << "public function validate():void {" << endl;
-  indent_up();
-
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  out << indent() << "// check for required fields" << endl;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
-      if (type_can_be_null((*f_iter)->get_type())) {
-        indent(out) << "if (" << (*f_iter)->get_name() << " == null) {" << endl;
-        indent(out) << "  throw new TProtocolError(TProtocolError.UNKNOWN, \"Required field '"
-                    << (*f_iter)->get_name() << "' was not present! Struct: \" + toString());"
-                    << endl;
-        indent(out) << "}" << endl;
-      } else {
-        indent(out) << "// alas, we cannot check '" << (*f_iter)->get_name()
-                    << "' because it's a primitive and you chose the non-beans generator." << endl;
-      }
-    }
-  }
-
-  // check that fields of type enum have valid values
-  out << indent() << "// check that fields of type enum have valid values" << endl;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    t_field* field = (*f_iter);
-    t_type* type = field->get_type();
-    // if field is an enum, check that its value is valid
-    if (type->is_enum()) {
-      indent(out) << "if (" << generate_isset_check(field) << " && !" << get_enum_class_name(type)
-                  << ".VALID_VALUES.contains(" << field->get_name() << ")){" << endl;
-      indent_up();
-      indent(out) << "throw new TProtocolError(TProtocolError.UNKNOWN, \"The field '"
-                  << field->get_name() << "' has been assigned the invalid value \" + "
-                  << field->get_name() << ");" << endl;
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-  }
-
-  indent_down();
-  indent(out) << "}" << endl << endl;
-}
-
-/**
- * Generates a function to write all the fields of the struct
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_as3_struct_writer(ostream& out, t_struct* tstruct) {
-  out << indent() << "public function write(oprot:TProtocol):void {" << endl;
-  indent_up();
-
-  string name = tstruct->get_name();
-  const vector<t_field*>& fields = tstruct->get_sorted_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  // performs various checks (e.g. check that all required fields are set)
-  indent(out) << "validate();" << endl << endl;
-
-  indent(out) << "oprot.writeStructBegin(STRUCT_DESC);" << endl;
-
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    bool could_be_unset = (*f_iter)->get_req() == t_field::T_OPTIONAL;
-    if (could_be_unset) {
-      indent(out) << "if (" << generate_isset_check(*f_iter) << ") {" << endl;
-      indent_up();
-    }
-    bool null_allowed = type_can_be_null((*f_iter)->get_type());
-    if (null_allowed) {
-      out << indent() << "if (this." << (*f_iter)->get_name() << " != null) {" << endl;
-      indent_up();
-    }
-
-    indent(out) << "oprot.writeFieldBegin(" << constant_name((*f_iter)->get_name())
-                << "_FIELD_DESC);" << endl;
-
-    // Write field contents
-    generate_serialize_field(out, *f_iter, "this.");
-
-    // Write field closer
-    indent(out) << "oprot.writeFieldEnd();" << endl;
-
-    if (null_allowed) {
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-    if (could_be_unset) {
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-  }
-  // Write the struct map
-  out << indent() << "oprot.writeFieldStop();" << endl << indent() << "oprot.writeStructEnd();"
-      << endl;
-
-  indent_down();
-  out << indent() << "}" << endl << endl;
-}
-
-/**
- * Generates a function to write all the fields of the struct,
- * which is a function result. These fields are only written
- * if they are set in the Isset array, and only one of them
- * can be set at a time.
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_as3_struct_result_writer(ostream& out, t_struct* tstruct) {
-  out << indent() << "public function write(oprot:TProtocol):void {" << endl;
-  indent_up();
-
-  string name = tstruct->get_name();
-  const vector<t_field*>& fields = tstruct->get_sorted_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  indent(out) << "oprot.writeStructBegin(STRUCT_DESC);" << endl;
-
-  bool first = true;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    if (first) {
-      first = false;
-      out << endl << indent() << "if ";
-    } else {
-      out << " else if ";
-    }
-
-    out << "(this." << generate_isset_check(*f_iter) << ") {" << endl;
-
-    indent_up();
-
-    indent(out) << "oprot.writeFieldBegin(" << constant_name((*f_iter)->get_name())
-                << "_FIELD_DESC);" << endl;
-
-    // Write field contents
-    generate_serialize_field(out, *f_iter, "this.");
-
-    // Write field closer
-    indent(out) << "oprot.writeFieldEnd();" << endl;
-
-    indent_down();
-    indent(out) << "}";
-  }
-  // Write the struct map
-  out << endl << indent() << "oprot.writeFieldStop();" << endl << indent()
-      << "oprot.writeStructEnd();" << endl;
-
-  indent_down();
-  out << indent() << "}" << endl << endl;
-}
-
-void t_as3_generator::generate_reflection_getters(ostringstream& out,
-                                                  t_type* type,
-                                                  string field_name,
-                                                  string cap_name) {
-  (void)type;
-  (void)cap_name;
-  indent(out) << "case " << upcase_string(field_name) << ":" << endl;
-  indent_up();
-  indent(out) << "return this." << field_name << ";" << endl;
-  indent_down();
-}
-
-void t_as3_generator::generate_reflection_setters(ostringstream& out,
-                                                  t_type* type,
-                                                  string field_name,
-                                                  string cap_name) {
-  (void)type;
-  (void)cap_name;
-  indent(out) << "case " << upcase_string(field_name) << ":" << endl;
-  indent_up();
-  indent(out) << "if (value == null) {" << endl;
-  indent(out) << "  unset" << get_cap_name(field_name) << "();" << endl;
-  indent(out) << "} else {" << endl;
-  indent(out) << "  this." << field_name << " = value;" << endl;
-  indent(out) << "}" << endl;
-  indent(out) << "break;" << endl << endl;
-
-  indent_down();
-}
-
-void t_as3_generator::generate_generic_field_getters_setters(std::ostream& out,
-                                                             t_struct* tstruct) {
-
-  std::ostringstream getter_stream;
-  std::ostringstream setter_stream;
-
-  // build up the bodies of both the getter and setter at once
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    t_field* field = *f_iter;
-    t_type* type = get_true_type(field->get_type());
-    std::string field_name = field->get_name();
-    std::string cap_name = get_cap_name(field_name);
-
-    indent_up();
-    generate_reflection_setters(setter_stream, type, field_name, cap_name);
-    generate_reflection_getters(getter_stream, type, field_name, cap_name);
-    indent_down();
-  }
-
-  // create the setter
-  indent(out) << "public function setFieldValue(fieldID:int, value:*):void {" << endl;
-  indent_up();
-
-  indent(out) << "switch (fieldID) {" << endl;
-
-  out << setter_stream.str();
-
-  indent(out) << "default:" << endl;
-  indent(out) << "  throw new ArgumentError(\"Field \" + fieldID + \" doesn't exist!\");" << endl;
-
-  indent(out) << "}" << endl;
-
-  indent_down();
-  indent(out) << "}" << endl << endl;
-
-  // create the getter
-  indent(out) << "public function getFieldValue(fieldID:int):* {" << endl;
-  indent_up();
-
-  indent(out) << "switch (fieldID) {" << endl;
-
-  out << getter_stream.str();
-
-  indent(out) << "default:" << endl;
-  indent(out) << "  throw new ArgumentError(\"Field \" + fieldID + \" doesn't exist!\");" << endl;
-
-  indent(out) << "}" << endl;
-
-  indent_down();
-
-  indent(out) << "}" << endl << endl;
-}
-
-// Creates a generic isSet method that takes the field number as argument
-void t_as3_generator::generate_generic_isset_method(std::ostream& out, t_struct* tstruct) {
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  // create the isSet method
-  indent(out) << "// Returns true if field corresponding to fieldID is set (has been assigned a "
-                 "value) and false otherwise" << endl;
-  indent(out) << "public function isSet(fieldID:int):Boolean {" << endl;
-  indent_up();
-  indent(out) << "switch (fieldID) {" << endl;
-
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    t_field* field = *f_iter;
-    indent(out) << "case " << upcase_string(field->get_name()) << ":" << endl;
-    indent_up();
-    indent(out) << "return " << generate_isset_check(field) << ";" << endl;
-    indent_down();
-  }
-
-  indent(out) << "default:" << endl;
-  indent(out) << "  throw new ArgumentError(\"Field \" + fieldID + \" doesn't exist!\");" << endl;
-
-  indent(out) << "}" << endl;
-
-  indent_down();
-  indent(out) << "}" << endl << endl;
-}
-
-/**
- * Generates a set of As3 Bean boilerplate functions (setters, getters, etc.)
- * for the given struct.
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_as3_bean_boilerplate(ostream& out,
-                                                    t_struct* tstruct,
-                                                    bool bindable) {
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    t_field* field = *f_iter;
-    t_type* type = get_true_type(field->get_type());
-    std::string field_name = field->get_name();
-    std::string cap_name = get_cap_name(field_name);
-
-    // Simple getter
-    generate_as3_doc(out, field);
-    indent(out) << "public function get " << field_name << "():" << type_name(type) << " {" << endl;
-    indent_up();
-    indent(out) << "return this._" << field_name << ";" << endl;
-    indent_down();
-    indent(out) << "}" << endl << endl;
-
-    // Simple setter
-    generate_as3_doc(out, field);
-    std::string propName = tmp("thriftPropertyChange");
-    if (bindable) {
-      indent(out) << "[Bindable(event=\"" << propName << "\")]" << endl;
-    }
-    indent(out) << "public function set " << field_name << "(" << field_name << ":"
-                << type_name(type) << "):void {" << endl;
-    indent_up();
-    indent(out) << "this._" << field_name << " = " << field_name << ";" << endl;
-    generate_isset_set(out, field);
-
-    if (bindable) {
-      // We have to use a custom event rather than the default, because if you use the default,
-      // the setter only gets called if the value has changed - this means calling
-      // foo.setIntValue(0)
-      // will not cause foo.isIntValueSet() to return true since the value of foo._intValue wasn't
-      // changed
-      // so the setter was never called.
-      indent(out) << "dispatchEvent(new Event(\"" << propName << "\"));" << endl;
-
-      // However, if you just use a custom event, then collections won't be able to detect when
-      // elements
-      // in the collections have changed since they listed for PropertyChangeEvents.  So, we
-      // dispatch both.
-      indent(out) << "dispatchEvent(new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE));"
-                  << endl;
-    }
-    indent_down();
-    indent(out) << "}" << endl << endl;
-
-    // Unsetter
-    indent(out) << "public function unset" << cap_name << "():void {" << endl;
-    indent_up();
-    if (type_can_be_null(type)) {
-      indent(out) << "this." << field_name << " = null;" << endl;
-    } else {
-      indent(out) << "this.__isset_" << field_name << " = false;" << endl;
-    }
-    indent_down();
-    indent(out) << "}" << endl << endl;
-
-    // isSet method
-    indent(out) << "// Returns true if field " << field_name
-                << " is set (has been assigned a value) and false otherwise" << endl;
-    indent(out) << "public function is" << get_cap_name("set") << cap_name << "():Boolean {"
-                << endl;
-    indent_up();
-    if (type_can_be_null(type)) {
-      indent(out) << "return this." << field_name << " != null;" << endl;
-    } else {
-      indent(out) << "return this.__isset_" << field_name << ";" << endl;
-    }
-    indent_down();
-    indent(out) << "}" << endl << endl;
-  }
-}
-
-/**
- * Generates a toString() method for the given struct
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_as3_struct_tostring(ostream& out,
-                                                   t_struct* tstruct,
-                                                   bool bindable) {
-  // If it's bindable, it extends EventDispatcher so toString is an override.
-  out << indent() << "public " << (bindable ? "override " : "") << "function toString():String {"
-      << endl;
-  indent_up();
-
-  out << indent() << "var ret:String = new String(\"" << tstruct->get_name() << "(\");" << endl;
-  out << indent() << "var first:Boolean = true;" << endl << endl;
-
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  bool first = true;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    bool could_be_unset = (*f_iter)->get_req() == t_field::T_OPTIONAL;
-    if (could_be_unset) {
-      indent(out) << "if (" << generate_isset_check(*f_iter) << ") {" << endl;
-      indent_up();
-    }
-
-    t_field* field = (*f_iter);
-
-    if (!first) {
-      indent(out) << "if (!first) ret +=  \", \";" << endl;
-    }
-    indent(out) << "ret += \"" << (*f_iter)->get_name() << ":\";" << endl;
-    bool can_be_null = type_can_be_null(field->get_type());
-    if (can_be_null) {
-      indent(out) << "if (this." << (*f_iter)->get_name() << " == null) {" << endl;
-      indent(out) << "  ret += \"null\";" << endl;
-      indent(out) << "} else {" << endl;
-      indent_up();
-    }
-
-    if (field->get_type()->is_binary()) {
-      indent(out) << "  ret += \"BINARY\";" << endl;
-    } else if (field->get_type()->is_enum()) {
-      indent(out) << "var " << field->get_name()
-                  << "_name:String = " << get_enum_class_name(field->get_type())
-                  << ".VALUES_TO_NAMES[this." << (*f_iter)->get_name() << "];" << endl;
-      indent(out) << "if (" << field->get_name() << "_name != null) {" << endl;
-      indent(out) << "  ret += " << field->get_name() << "_name;" << endl;
-      indent(out) << "  ret += \" (\";" << endl;
-      indent(out) << "}" << endl;
-      indent(out) << "ret += this." << field->get_name() << ";" << endl;
-      indent(out) << "if (" << field->get_name() << "_name != null) {" << endl;
-      indent(out) << "  ret += \")\";" << endl;
-      indent(out) << "}" << endl;
-    } else {
-      indent(out) << "ret += this." << (*f_iter)->get_name() << ";" << endl;
-    }
-
-    if (can_be_null) {
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-    indent(out) << "first = false;" << endl;
-
-    if (could_be_unset) {
-      indent_down();
-      indent(out) << "}" << endl;
-    }
-    first = false;
-  }
-  out << indent() << "ret += \")\";" << endl << indent() << "return ret;" << endl;
-
-  indent_down();
-  indent(out) << "}" << endl << endl;
-}
-
-/**
- * Generates a static map with meta data to store information such as fieldID to
- * fieldName mapping
- *
- * @param tstruct The struct definition
- */
-void t_as3_generator::generate_as3_meta_data_map(ostream& out, t_struct* tstruct) {
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  // Static Map with fieldID -> FieldMetaData mappings
-  indent(out) << "public static const metaDataMap:Dictionary = new Dictionary();" << endl;
-
-  if (fields.size() > 0) {
-    // Populate map
-    scope_up(out);
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-      t_field* field = *f_iter;
-      std::string field_name = field->get_name();
-      indent(out) << "metaDataMap[" << upcase_string(field_name) << "] = new FieldMetaData(\""
-                  << field_name << "\", ";
-
-      // Set field requirement type (required, optional, etc.)
-      if (field->get_req() == t_field::T_REQUIRED) {
-        out << "TFieldRequirementType.REQUIRED, ";
-      } else if (field->get_req() == t_field::T_OPTIONAL) {
-        out << "TFieldRequirementType.OPTIONAL, ";
-      } else {
-        out << "TFieldRequirementType.DEFAULT, ";
-      }
-
-      // Create value meta data
-      generate_field_value_meta_data(out, field->get_type());
-      out << ");" << endl;
-    }
-    scope_down(out);
-  }
-}
-
-/**
- * Returns a string with the as3 representation of the given thrift type
- * (e.g. for the type struct it returns "TType.STRUCT")
- */
-std::string t_as3_generator::get_as3_type_string(t_type* type) {
-  if (type->is_list()) {
-    return "TType.LIST";
-  } else if (type->is_map()) {
-    return "TType.MAP";
-  } else if (type->is_set()) {
-    return "TType.SET";
-  } else if (type->is_struct() || type->is_xception()) {
-    return "TType.STRUCT";
-  } else if (type->is_enum()) {
-    return "TType.I32";
-  } else if (type->is_typedef()) {
-    return get_as3_type_string(((t_typedef*)type)->get_type());
-  } else if (type->is_base_type()) {
-    switch (((t_base_type*)type)->get_base()) {
-    case t_base_type::TYPE_VOID:
-      return "TType.VOID";
-      break;
-    case t_base_type::TYPE_STRING:
-      return "TType.STRING";
-      break;
-    case t_base_type::TYPE_BOOL:
-      return "TType.BOOL";
-      break;
-    case t_base_type::TYPE_I8:
-      return "TType.BYTE";
-      break;
-    case t_base_type::TYPE_I16:
-      return "TType.I16";
-      break;
-    case t_base_type::TYPE_I32:
-      return "TType.I32";
-      break;
-    case t_base_type::TYPE_I64:
-      return "TType.I64";
-      break;
-    case t_base_type::TYPE_DOUBLE:
-      return "TType.DOUBLE";
-      break;
-    default:
-      throw std::runtime_error("Unknown thrift type \"" + type->get_name()
-                               + "\" passed to t_as3_generator::get_as3_type_string!");
-      break; // This should never happen!
-    }
-  } else {
-    throw std::runtime_error(
-        "Unknown thrift type \"" + type->get_name()
-        + "\" passed to t_as3_generator::get_as3_type_string!"); // This should never happen!
-  }
-}
-
-void t_as3_generator::generate_field_value_meta_data(std::ostream& out, t_type* type) {
-  out << endl;
-  indent_up();
-  indent_up();
-  if (type->is_struct() || type->is_xception()) {
-    indent(out) << "new StructMetaData(TType.STRUCT, " << type_name(type);
-  } else if (type->is_container()) {
-    if (type->is_list()) {
-      indent(out) << "new ListMetaData(TType.LIST, ";
-      t_type* elem_type = ((t_list*)type)->get_elem_type();
-      generate_field_value_meta_data(out, elem_type);
-    } else if (type->is_set()) {
-      indent(out) << "new SetMetaData(TType.SET, ";
-      t_type* elem_type = ((t_list*)type)->get_elem_type();
-      generate_field_value_meta_data(out, elem_type);
-    } else { // map
-      indent(out) << "new MapMetaData(TType.MAP, ";
-      t_type* key_type = ((t_map*)type)->get_key_type();
-      t_type* val_type = ((t_map*)type)->get_val_type();
-      generate_field_value_meta_data(out, key_type);
-      out << ", ";
-      generate_field_value_meta_data(out, val_type);
-    }
-  } else {
-    indent(out) << "new FieldValueMetaData(" << get_as3_type_string(type);
-  }
-  out << ")";
-  indent_down();
-  indent_down();
-}
-
-/**
- * Generates a thrift service. In C++, this comprises an entirely separate
- * header and source file. The header file defines the methods and includes
- * the data types defined in the main header file, and the implementation
- * file contains implementations of the basic printer and default interfaces.
- *
- * @param tservice The service definition
- */
-void t_as3_generator::generate_service(t_service* tservice) {
-  // Make interface file
-  string f_service_name = package_dir_ + "/" + service_name_ + ".as";
-  f_service_.open(f_service_name.c_str());
-
-  f_service_ << autogen_comment() << as3_package();
-
-  scope_up(f_service_);
-
-  f_service_ << endl << as3_type_imports() << as3_thrift_imports()
-             << as3_thrift_gen_imports(tservice);
-
-  if (tservice->get_extends() != nullptr) {
-    t_type* parent = tservice->get_extends();
-    string parent_namespace = parent->get_program()->get_namespace("as3");
-    if (!parent_namespace.empty() && parent_namespace != package_name_) {
-      f_service_ << "import " << type_name(parent) << ";" << endl;
-    }
-  }
-
-  f_service_ << endl;
-
-  generate_service_interface(tservice);
-
-  scope_down(f_service_);
-  f_service_.close();
-
-  // Now make the implementation/client file
-  f_service_name = package_dir_ + "/" + service_name_ + "Impl.as";
-  f_service_.open(f_service_name.c_str());
-
-  f_service_ << autogen_comment() << as3_package();
-
-  scope_up(f_service_);
-
-  f_service_ << endl << as3_type_imports() << as3_thrift_imports()
-             << as3_thrift_gen_imports(tservice);
-
-  if (tservice->get_extends() != nullptr) {
-    t_type* parent = tservice->get_extends();
-    string parent_namespace = parent->get_program()->get_namespace("as3");
-    if (!parent_namespace.empty() && parent_namespace != package_name_) {
-      f_service_ << "import " << type_name(parent) << "Impl;" << endl;
-    }
-  }
-
-  f_service_ << endl;
-
-  generate_service_client(tservice);
-  scope_down(f_service_);
-
-  f_service_ << as3_type_imports();
-  f_service_ << as3_thrift_imports();
-  f_service_ << as3_thrift_gen_imports(tservice);
-  if (!package_name_.empty()) {
-    f_service_ << "import " << package_name_ << ".*;" << endl;
-  }
-
-  generate_service_helpers(tservice);
-
-  f_service_.close();
-
-  // Now make the processor/server file
-  f_service_name = package_dir_ + "/" + service_name_ + "Processor.as";
-  f_service_.open(f_service_name.c_str());
-
-  f_service_ << autogen_comment() << as3_package();
-
-  scope_up(f_service_);
-
-  f_service_ << endl << as3_type_imports() << as3_thrift_imports()
-             << as3_thrift_gen_imports(tservice) << endl;
-
-  generate_service_server(tservice);
-  scope_down(f_service_);
-
-  f_service_ << as3_type_imports();
-  f_service_ << as3_thrift_imports();
-  f_service_ << as3_thrift_gen_imports(tservice) << endl;
-  if (!package_name_.empty()) {
-    f_service_ << "import " << package_name_ << ".*;" << endl;
-  }
-
-  generate_service_helpers(tservice);
-
-  f_service_.close();
-}
-
-/**
- * Generates a service interface definition.
- *
- * @param tservice The service to generate a header definition for
- */
-void t_as3_generator::generate_service_interface(t_service* tservice) {
-  string extends_iface = "";
-  if (tservice->get_extends() != nullptr) {
-    extends_iface = " extends " + tservice->get_extends()->get_name();
-  }
-
-  generate_as3_doc(f_service_, tservice);
-  f_service_ << indent() << "public interface " << service_name_ << extends_iface << " {" << endl
-             << endl;
-  indent_up();
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    generate_as3_doc(f_service_, *f_iter);
-    if (!(*f_iter)->is_oneway()) {
-      if ((*f_iter)->get_returntype()->is_void()) {
-        indent(f_service_) << "//function onError(Error):void;" << endl;
-        indent(f_service_) << "//function onSuccess():void;" << endl;
-      } else {
-        indent(f_service_) << "//function onError(Error):void;" << endl;
-        indent(f_service_) << "//function onSuccess(" << type_name((*f_iter)->get_returntype())
-                           << "):void;" << endl;
-      }
-    }
-    indent(f_service_) << function_signature(*f_iter) << ";" << endl << endl;
-  }
-  indent_down();
-  f_service_ << indent() << "}" << endl << endl;
-}
-
-/**
- * Generates structs for all the service args and return types
- *
- * @param tservice The service
- */
-void t_as3_generator::generate_service_helpers(t_service* tservice) {
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    t_struct* ts = (*f_iter)->get_arglist();
-    generate_as3_struct_definition(f_service_, ts, false, true);
-    generate_function_helpers(*f_iter);
-  }
-}
-
-/**
- * Generates a service client definition.
- *
- * @param tservice The service to generate a server for.
- */
-void t_as3_generator::generate_service_client(t_service* tservice) {
-  string extends = "";
-  string extends_client = "";
-  if (tservice->get_extends() != nullptr) {
-    extends = tservice->get_extends()->get_name();
-    extends_client = " extends " + extends + "Impl";
-  }
-
-  indent(f_service_) << "public class " << service_name_ << "Impl" << extends_client
-                     << " implements " << service_name_ << " {" << endl;
-  indent_up();
-
-  indent(f_service_) << "public function " << service_name_ << "Impl"
-                     << "(iprot:TProtocol, oprot:TProtocol=null)" << endl;
-  scope_up(f_service_);
-  if (extends.empty()) {
-    f_service_ << indent() << "iprot_ = iprot;" << endl;
-    f_service_ << indent() << "if (oprot == null) {" << endl;
-    indent_up();
-    f_service_ << indent() << "oprot_ = iprot;" << endl;
-    indent_down();
-    f_service_ << indent() << "} else {" << endl;
-    indent_up();
-    f_service_ << indent() << "oprot_ = oprot;" << endl;
-    indent_down();
-    f_service_ << indent() << "}";
-  } else {
-    f_service_ << indent() << "super(iprot, oprot);" << endl;
-  }
-  scope_down(f_service_);
-  f_service_ << endl;
-
-  if (extends.empty()) {
-    f_service_ << indent() << "protected var iprot_:TProtocol;" << endl << indent()
-               << "protected var oprot_:TProtocol;" << endl << endl << indent()
-               << "protected var seqid_:int;" << endl << endl;
-
-    indent(f_service_) << "public function getInputProtocol():TProtocol" << endl;
-    scope_up(f_service_);
-    indent(f_service_) << "return this.iprot_;" << endl;
-    scope_down(f_service_);
-    f_service_ << endl;
-
-    indent(f_service_) << "public function getOutputProtocol():TProtocol" << endl;
-    scope_up(f_service_);
-    indent(f_service_) << "return this.oprot_;" << endl;
-    scope_down(f_service_);
-    f_service_ << endl;
-  }
-
-  // Generate client method implementations
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::const_iterator f_iter;
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    string funname = (*f_iter)->get_name();
-
-    // Open function
-    if (!(*f_iter)->is_oneway()) {
-      if ((*f_iter)->get_returntype()->is_void()) {
-        indent(f_service_) << "//function onError(Error):void;" << endl;
-        indent(f_service_) << "//function onSuccess():void;" << endl;
-      } else {
-        indent(f_service_) << "//function onError(Error):void;" << endl;
-        indent(f_service_) << "//function onSuccess(" << type_name((*f_iter)->get_returntype())
-                           << "):void;" << endl;
-      }
-    }
-    indent(f_service_) << "public " << function_signature(*f_iter) << endl;
-    scope_up(f_service_);
-
-    // Get the struct of function call params
-    t_struct* arg_struct = (*f_iter)->get_arglist();
-
-    string argsname = (*f_iter)->get_name() + "_args";
-    vector<t_field*>::const_iterator fld_iter;
-    const vector<t_field*>& fields = arg_struct->get_members();
-
-    // Serialize the request
-    f_service_ << indent() << "oprot_.writeMessageBegin(new TMessage(\"" << funname << "\", "
-               << ((*f_iter)->is_oneway() ? "TMessageType.ONEWAY" : "TMessageType.CALL")
-               << ", seqid_));" << endl << indent() << "var args:" << argsname << " = new "
-               << argsname << "();" << endl;
-
-    for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
-      f_service_ << indent() << "args." << (*fld_iter)->get_name() << " = "
-                 << (*fld_iter)->get_name() << ";" << endl;
-    }
-
-    f_service_ << indent() << "args.write(oprot_);" << endl << indent()
-               << "oprot_.writeMessageEnd();" << endl;
-
-    if ((*f_iter)->is_oneway()) {
-      f_service_ << indent() << "oprot_.getTransport().flush();" << endl;
-    } else {
-      f_service_ << indent() << "oprot_.getTransport().flush(function(error:Error):void {" << endl;
-      indent_up();
-      f_service_ << indent() << "try {" << endl;
-      indent_up();
-      string resultname = (*f_iter)->get_name() + "_result";
-      f_service_ << indent() << "if (error != null) {" << endl << indent()
-                 << "  if (onError != null) onError(error);" << endl << indent() << "  return;"
-                 << endl << indent() << "}" << endl << indent()
-                 << "var msg:TMessage = iprot_.readMessageBegin();" << endl << indent()
-                 << "if (msg.type == TMessageType.EXCEPTION) {" << endl << indent()
-                 << "  var x:TApplicationError = TApplicationError.read(iprot_);" << endl
-                 << indent() << "  iprot_.readMessageEnd();" << endl << indent()
-                 << "  if (onError != null) onError(x);" << endl << indent() << "  return;" << endl
-                 << indent() << "}" << endl << indent() << "var result :" << resultname << " = new "
-                 << resultname << "();" << endl << indent() << "result.read(iprot_);" << endl
-                 << indent() << "iprot_.readMessageEnd();" << endl;
-
-      // Careful, only return _result if not a void function
-      if (!(*f_iter)->get_returntype()->is_void()) {
-        f_service_ << indent() << "if (result." << generate_isset_check("success") << ") {" << endl
-                   << indent() << "  if (onSuccess != null) onSuccess(result.success);" << endl
-                   << indent() << "  return;" << endl << indent() << "}" << endl;
-      }
-
-      t_struct* xs = (*f_iter)->get_xceptions();
-      const std::vector<t_field*>& xceptions = xs->get_members();
-      vector<t_field*>::const_iterator x_iter;
-      for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
-        f_service_ << indent() << "if (result." << (*x_iter)->get_name() << " != null) {" << endl
-                   << indent() << "  if (onError != null) onError(result." << (*x_iter)->get_name()
-                   << ");" << endl << indent() << "  return;" << endl << indent() << "}" << endl;
-      }
-
-      // If you get here it's an exception, unless a void function
-      if ((*f_iter)->get_returntype()->is_void()) {
-        f_service_ << indent() << "if (onSuccess != null) onSuccess();" << endl << indent()
-                   << "return;" << endl;
-      } else {
-
-        f_service_ << indent() << "if (onError != null) onError(new "
-                                  "TApplicationError(TApplicationError.MISSING_RESULT, \""
-                   << (*f_iter)->get_name() << " failed: unknown result\"));" << endl;
-      }
-      indent_down();
-      f_service_ << indent() << "} catch (e:TError) {" << endl << indent()
-                 << "  if (onError != null) onError(e);" << endl << indent() << "}" << endl;
-
-      indent_down();
-      indent(f_service_) << "});" << endl;
-    }
-    // Close function
-    scope_down(f_service_);
-    f_service_ << endl;
-  }
-
-  indent_down();
-  indent(f_service_) << "}" << endl;
-}
-
-/**
- * Generates a service server definition.
- *
- * @param tservice The service to generate a server for.
- */
-void t_as3_generator::generate_service_server(t_service* tservice) {
-  // Generate the dispatch methods
-  vector<t_function*> functions = tservice->get_functions();
-  vector<t_function*>::iterator f_iter;
-
-  // Extends stuff
-  string extends = "";
-  string extends_processor = "";
-  if (tservice->get_extends() != nullptr) {
-    extends = type_name(tservice->get_extends());
-    extends_processor = " extends " + extends + "Processor";
-  }
-
-  // Generate the header portion
-  indent(f_service_) << "public class " << service_name_ << "Processor" << extends_processor
-                     << " implements TProcessor {" << endl;
-  indent_up();
-
-  indent(f_service_) << "public function " << service_name_ << "Processor(iface:" << service_name_
-                     << ")" << endl;
-  scope_up(f_service_);
-  if (!extends.empty()) {
-    f_service_ << indent() << "super(iface);" << endl;
-  }
-  f_service_ << indent() << "iface_ = iface;" << endl;
-
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    f_service_ << indent() << "PROCESS_MAP[\"" << (*f_iter)->get_name()
-               << "\"] = " << (*f_iter)->get_name() << "();" << endl;
-  }
-
-  scope_down(f_service_);
-  f_service_ << endl;
-
-  f_service_ << indent() << "private var iface_:" << service_name_ << ";" << endl;
-
-  if (extends.empty()) {
-    f_service_ << indent() << "protected const PROCESS_MAP:Dictionary = new Dictionary();" << endl;
-  }
-
-  f_service_ << endl;
-
-  // Generate the server implementation
-  string override = "";
-  if (tservice->get_extends() != nullptr) {
-    override = "override ";
-  }
-  indent(f_service_) << override
-                     << "public function process(iprot:TProtocol, oprot:TProtocol):Boolean" << endl;
-  scope_up(f_service_);
-
-  f_service_ << indent() << "var msg:TMessage = iprot.readMessageBegin();" << endl;
-
-  // TODO(mcslee): validate message, was the seqid etc. legit?
-  // AS- If all method is oneway:
-  // do you have an oprot?
-  // do you you need nullcheck?
-  f_service_
-      << indent() << "var fn:Function = PROCESS_MAP[msg.name];" << endl << indent()
-      << "if (fn == null) {" << endl << indent() << "  TProtocolUtil.skip(iprot, TType.STRUCT);"
-      << endl << indent() << "  iprot.readMessageEnd();" << endl << indent()
-      << "  var x:TApplicationError = new TApplicationError(TApplicationError.UNKNOWN_METHOD, "
-         "\"Invalid method name: '\"+msg.name+\"'\");" << endl << indent()
-      << "  oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));"
-      << endl << indent() << "  x.write(oprot);" << endl << indent() << "  oprot.writeMessageEnd();"
-      << endl << indent() << "  oprot.getTransport().flush();" << endl << indent()
-      << "  return true;" << endl << indent() << "}" << endl << indent()
-      << "fn.call(this,msg.seqid, iprot, oprot);" << endl;
-
-  f_service_ << indent() << "return true;" << endl;
-
-  scope_down(f_service_);
-  f_service_ << endl;
-
-  // Generate the process subfunctions
-  for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-    generate_process_function(tservice, *f_iter);
-  }
-
-  indent_down();
-  indent(f_service_) << "}" << endl << endl;
-}
-
-/**
- * Generates a struct and helpers for a function.
- *
- * @param tfunction The function
- */
-void t_as3_generator::generate_function_helpers(t_function* tfunction) {
-  if (tfunction->is_oneway()) {
-    return;
-  }
-
-  t_struct result(program_, tfunction->get_name() + "_result");
-  t_field success(tfunction->get_returntype(), "success", 0);
-  if (!tfunction->get_returntype()->is_void()) {
-    result.append(&success);
-  }
-
-  t_struct* xs = tfunction->get_xceptions();
-  const vector<t_field*>& fields = xs->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    result.append(*f_iter);
-  }
-
-  generate_as3_struct_definition(f_service_, &result, false, true, true);
-}
-
-/**
- * Generates a process function definition.
- *
- * @param tfunction The function to write a dispatcher for
- */
-void t_as3_generator::generate_process_function(t_service* tservice, t_function* tfunction) {
-  (void)tservice;
-  // Open class
-  indent(f_service_) << "private function " << tfunction->get_name() << "():Function {" << endl;
-  indent_up();
-
-  // Open function
-  indent(f_service_) << "return function(seqid:int, iprot:TProtocol, oprot:TProtocol):void" << endl;
-  scope_up(f_service_);
-
-  string argsname = tfunction->get_name() + "_args";
-  string resultname = tfunction->get_name() + "_result";
-
-  f_service_ << indent() << "var args:" << argsname << " = new " << argsname << "();" << endl
-             << indent() << "args.read(iprot);" << endl << indent() << "iprot.readMessageEnd();"
-             << endl;
-
-  t_struct* xs = tfunction->get_xceptions();
-  const std::vector<t_field*>& xceptions = xs->get_members();
-  vector<t_field*>::const_iterator x_iter;
-
-  // Declare result for non oneway function
-  if (!tfunction->is_oneway()) {
-    f_service_ << indent() << "var result:" << resultname << " = new " << resultname << "();"
-               << endl;
-  }
-
-  // Try block for a function with exceptions
-  if (xceptions.size() > 0) {
-    f_service_ << indent() << "try {" << endl;
-    indent_up();
-  }
-
-  // Generate the function call
-  t_struct* arg_struct = tfunction->get_arglist();
-  const std::vector<t_field*>& fields = arg_struct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-
-  f_service_ << indent();
-  if (tfunction->is_oneway()) {
-    f_service_ << "iface_." << tfunction->get_name() << "(";
-    bool first = true;
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-      if (first) {
-        first = false;
-      } else {
-        f_service_ << ", ";
-      }
-      f_service_ << "args." << (*f_iter)->get_name();
-    }
-    f_service_ << ");" << endl;
-  } else {
-    f_service_ << "// sorry this operation is not supported yet" << endl;
-    f_service_ << indent() << "throw new Error(\"This is not yet supported\");" << endl;
-  }
-
-  // Set isset on success field
-  if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()
-      && !type_can_be_null(tfunction->get_returntype())) {
-    f_service_ << indent() << "result.set" << get_cap_name("success") << get_cap_name("isSet")
-               << "(true);" << endl;
-  }
-
-  if (!tfunction->is_oneway() && xceptions.size() > 0) {
-    indent_down();
-    f_service_ << indent() << "}";
-    for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
-      f_service_ << " catch (" << (*x_iter)->get_name() << ":"
-                 << type_name((*x_iter)->get_type(), false, false) << ") {" << endl;
-      if (!tfunction->is_oneway()) {
-        indent_up();
-        f_service_ << indent() << "result." << (*x_iter)->get_name() << " = "
-                   << (*x_iter)->get_name() << ";" << endl;
-        indent_down();
-        f_service_ << indent() << "}";
-      } else {
-        f_service_ << "}";
-      }
-    }
-    f_service_ << " catch (th:Error) {" << endl;
-    indent_up();
-    f_service_ << indent() << "trace(\"Internal error processing " << tfunction->get_name()
-               << "\", th);" << endl << indent()
-               << "var x:TApplicationError = new "
-                  "TApplicationError(TApplicationError.INTERNAL_ERROR, \"Internal error processing "
-               << tfunction->get_name() << "\");" << endl << indent()
-               << "oprot.writeMessageBegin(new TMessage(\"" << tfunction->get_name()
-               << "\", TMessageType.EXCEPTION, seqid));" << endl << indent() << "x.write(oprot);"
-               << endl << indent() << "oprot.writeMessageEnd();" << endl << indent()
-               << "oprot.getTransport().flush();" << endl << indent() << "return;" << endl;
-    indent_down();
-    f_service_ << indent() << "}" << endl;
-  }
-
-  // Shortcut out here for oneway functions
-  if (tfunction->is_oneway()) {
-    f_service_ << indent() << "return;" << endl;
-    scope_down(f_service_);
-
-    // Close class
-    indent_down();
-    f_service_ << indent() << "}" << endl << endl;
-    return;
-  }
-
-  f_service_ << indent() << "oprot.writeMessageBegin(new TMessage(\"" << tfunction->get_name()
-             << "\", TMessageType.REPLY, seqid));" << endl << indent() << "result.write(oprot);"
-             << endl << indent() << "oprot.writeMessageEnd();" << endl << indent()
-             << "oprot.getTransport().flush();" << endl;
-
-  // Close function
-  scope_down(f_service_);
-  f_service_ << endl;
-
-  // Close class
-  indent_down();
-  f_service_ << indent() << "}" << endl << endl;
-}
-
-/**
- * Deserializes a field of any type.
- *
- * @param tfield The field
- * @param prefix The variable name or container for this field
- */
-void t_as3_generator::generate_deserialize_field(ostream& out, t_field* tfield, string prefix) {
-  t_type* type = get_true_type(tfield->get_type());
-
-  if (type->is_void()) {
-    throw "CANNOT GENERATE DESERIALIZE CODE FOR void TYPE: " + prefix + tfield->get_name();
-  }
-
-  string name = prefix + tfield->get_name();
-
-  if (type->is_struct() || type->is_xception()) {
-    generate_deserialize_struct(out, (t_struct*)type, name);
-  } else if (type->is_container()) {
-    generate_deserialize_container(out, type, name);
-  } else if (type->is_base_type() || type->is_enum()) {
-
-    indent(out) << name << " = iprot.";
-
-    if (type->is_base_type()) {
-      t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-      switch (tbase) {
-      case t_base_type::TYPE_VOID:
-        throw "compiler error: cannot serialize void field in a struct: " + name;
-        break;
-      case t_base_type::TYPE_STRING:
-        if (type->is_binary()) {
-          out << "readBinary();";
-        } else {
-          out << "readString();";
-        }
-        break;
-      case t_base_type::TYPE_BOOL:
-        out << "readBool();";
-        break;
-      case t_base_type::TYPE_I8:
-        out << "readByte();";
-        break;
-      case t_base_type::TYPE_I16:
-        out << "readI16();";
-        break;
-      case t_base_type::TYPE_I32:
-        out << "readI32();";
-        break;
-      case t_base_type::TYPE_I64:
-        out << "readI64();";
-        break;
-      case t_base_type::TYPE_DOUBLE:
-        out << "readDouble();";
-        break;
-      default:
-        throw "compiler error: no As3 name for base type " + t_base_type::t_base_name(tbase);
-      }
-    } else if (type->is_enum()) {
-      out << "readI32();";
-    }
-    out << endl;
-  } else {
-    printf("DO NOT KNOW HOW TO DESERIALIZE FIELD '%s' TYPE '%s'\n",
-           tfield->get_name().c_str(),
-           type_name(type).c_str());
-  }
-}
-
-/**
- * Generates an unserializer for a struct, invokes read()
- */
-void t_as3_generator::generate_deserialize_struct(ostream& out, t_struct* tstruct, string prefix) {
-  out << indent() << prefix << " = new " << type_name(tstruct) << "();" << endl << indent()
-      << prefix << ".read(iprot);" << endl;
-}
-
-/**
- * Deserializes a container by reading its size and then iterating
- */
-void t_as3_generator::generate_deserialize_container(ostream& out, t_type* ttype, string prefix) {
-  scope_up(out);
-
-  string obj;
-
-  if (ttype->is_map()) {
-    obj = tmp("_map");
-  } else if (ttype->is_set()) {
-    obj = tmp("_set");
-  } else if (ttype->is_list()) {
-    obj = tmp("_list");
-  }
-
-  // Declare variables, read header
-  if (ttype->is_map()) {
-    indent(out) << "var " << obj << ":TMap = iprot.readMapBegin();" << endl;
-  } else if (ttype->is_set()) {
-    indent(out) << "var " << obj << ":TSet = iprot.readSetBegin();" << endl;
-  } else if (ttype->is_list()) {
-    indent(out) << "var " << obj << ":TList = iprot.readListBegin();" << endl;
-  }
-
-  indent(out) << prefix << " = new " << type_name(ttype, false, true)
-              // size the collection correctly
-              << "("
-              << ");" << endl;
-
-  // For loop iterates over elements
-  string i = tmp("_i");
-  indent(out) << "for (var " << i << ":int = 0; " << i << " < " << obj << ".size"
-              << "; "
-              << "++" << i << ")" << endl;
-
-  scope_up(out);
-
-  if (ttype->is_map()) {
-    generate_deserialize_map_element(out, (t_map*)ttype, prefix);
-  } else if (ttype->is_set()) {
-    generate_deserialize_set_element(out, (t_set*)ttype, prefix);
-  } else if (ttype->is_list()) {
-    generate_deserialize_list_element(out, (t_list*)ttype, prefix);
-  }
-
-  scope_down(out);
-
-  // Read container end
-  if (ttype->is_map()) {
-    indent(out) << "iprot.readMapEnd();" << endl;
-  } else if (ttype->is_set()) {
-    indent(out) << "iprot.readSetEnd();" << endl;
-  } else if (ttype->is_list()) {
-    indent(out) << "iprot.readListEnd();" << endl;
-  }
-
-  scope_down(out);
-}
-
-/**
- * Generates code to deserialize a map
- */
-void t_as3_generator::generate_deserialize_map_element(ostream& out, t_map* tmap, string prefix) {
-  string key = tmp("_key");
-  string val = tmp("_val");
-  t_field fkey(tmap->get_key_type(), key);
-  t_field fval(tmap->get_val_type(), val);
-
-  indent(out) << declare_field(&fkey) << endl;
-  indent(out) << declare_field(&fval) << endl;
-
-  generate_deserialize_field(out, &fkey);
-  generate_deserialize_field(out, &fval);
-
-  indent(out) << prefix << "[" << key << "] = " << val << ";" << endl;
-}
-
-/**
- * Deserializes a set element
- */
-void t_as3_generator::generate_deserialize_set_element(ostream& out, t_set* tset, string prefix) {
-  string elem = tmp("_elem");
-  t_field felem(tset->get_elem_type(), elem);
-
-  indent(out) << declare_field(&felem) << endl;
-
-  generate_deserialize_field(out, &felem);
-
-  indent(out) << prefix << ".add(" << elem << ");" << endl;
-}
-
-/**
- * Deserializes a list element
- */
-void t_as3_generator::generate_deserialize_list_element(ostream& out,
-                                                        t_list* tlist,
-                                                        string prefix) {
-  string elem = tmp("_elem");
-  t_field felem(tlist->get_elem_type(), elem);
-
-  indent(out) << declare_field(&felem) << endl;
-
-  generate_deserialize_field(out, &felem);
-
-  indent(out) << prefix << ".push(" << elem << ");" << endl;
-}
-
-/**
- * Serializes a field of any type.
- *
- * @param tfield The field to serialize
- * @param prefix Name to prepend to field name
- */
-void t_as3_generator::generate_serialize_field(ostream& out, t_field* tfield, string prefix) {
-  t_type* type = get_true_type(tfield->get_type());
-
-  // Do nothing for void types
-  if (type->is_void()) {
-    throw "CANNOT GENERATE SERIALIZE CODE FOR void TYPE: " + prefix + tfield->get_name();
-  }
-
-  if (type->is_struct() || type->is_xception()) {
-    generate_serialize_struct(out, (t_struct*)type, prefix + tfield->get_name());
-  } else if (type->is_container()) {
-    generate_serialize_container(out, type, prefix + tfield->get_name());
-  } else if (type->is_base_type() || type->is_enum()) {
-
-    string name = prefix + tfield->get_name();
-    indent(out) << "oprot.";
-
-    if (type->is_base_type()) {
-      t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-      switch (tbase) {
-      case t_base_type::TYPE_VOID:
-        throw "compiler error: cannot serialize void field in a struct: " + name;
-        break;
-      case t_base_type::TYPE_STRING:
-        if (type->is_binary()) {
-          out << "writeBinary(" << name << ");";
-        } else {
-          out << "writeString(" << name << ");";
-        }
-        break;
-      case t_base_type::TYPE_BOOL:
-        out << "writeBool(" << name << ");";
-        break;
-      case t_base_type::TYPE_I8:
-        out << "writeByte(" << name << ");";
-        break;
-      case t_base_type::TYPE_I16:
-        out << "writeI16(" << name << ");";
-        break;
-      case t_base_type::TYPE_I32:
-        out << "writeI32(" << name << ");";
-        break;
-      case t_base_type::TYPE_I64:
-        out << "writeI64(" << name << ");";
-        break;
-      case t_base_type::TYPE_DOUBLE:
-        out << "writeDouble(" << name << ");";
-        break;
-      default:
-        throw "compiler error: no As3 name for base type " + t_base_type::t_base_name(tbase);
-      }
-    } else if (type->is_enum()) {
-      out << "writeI32(" << name << ");";
-    }
-    out << endl;
-  } else {
-    printf("DO NOT KNOW HOW TO SERIALIZE FIELD '%s%s' TYPE '%s'\n",
-           prefix.c_str(),
-           tfield->get_name().c_str(),
-           type_name(type).c_str());
-  }
-}
-
-/**
- * Serializes all the members of a struct.
- *
- * @param tstruct The struct to serialize
- * @param prefix  String prefix to attach to all fields
- */
-void t_as3_generator::generate_serialize_struct(ostream& out, t_struct* tstruct, string prefix) {
-  (void)tstruct;
-  out << indent() << prefix << ".write(oprot);" << endl;
-}
-
-/**
- * Serializes a container by writing its size then the elements.
- *
- * @param ttype  The type of container
- * @param prefix String prefix for fields
- */
-void t_as3_generator::generate_serialize_container(ostream& out, t_type* ttype, string prefix) {
-  scope_up(out);
-
-  if (ttype->is_map()) {
-    string iter = tmp("_key");
-    string counter = tmp("_sizeCounter");
-    indent(out) << "var " << counter << ":int = 0;" << endl;
-    indent(out) << "for (var " << iter << ":* in " << prefix << ") {" << endl;
-    indent(out) << "  " << counter << +"++;" << endl;
-    indent(out) << "}" << endl;
-
-    indent(out) << "oprot.writeMapBegin(new TMap(" << type_to_enum(((t_map*)ttype)->get_key_type())
-                << ", " << type_to_enum(((t_map*)ttype)->get_val_type()) << ", " << counter << "));"
-                << endl;
-  } else if (ttype->is_set()) {
-    indent(out) << "oprot.writeSetBegin(new TSet(" << type_to_enum(((t_set*)ttype)->get_elem_type())
-                << ", " << prefix << ".size));" << endl;
-  } else if (ttype->is_list()) {
-    indent(out) << "oprot.writeListBegin(new TList("
-                << type_to_enum(((t_list*)ttype)->get_elem_type()) << ", " << prefix << ".length));"
-                << endl;
-  }
-
-  string iter = tmp("elem");
-  if (ttype->is_map()) {
-    indent(out) << "for (var " << iter << ":* in " << prefix << ")";
-  } else if (ttype->is_set()) {
-    indent(out) << "for each (var " << iter << ":* in " << prefix << ".toArray())";
-  } else if (ttype->is_list()) {
-    indent(out) << "for each (var " << iter << ":* in " << prefix << ")";
-  }
-
-  scope_up(out);
-
-  if (ttype->is_map()) {
-    generate_serialize_map_element(out, (t_map*)ttype, iter, prefix);
-  } else if (ttype->is_set()) {
-    generate_serialize_set_element(out, (t_set*)ttype, iter);
-  } else if (ttype->is_list()) {
-    generate_serialize_list_element(out, (t_list*)ttype, iter);
-  }
-
-  scope_down(out);
-
-  if (ttype->is_map()) {
-    indent(out) << "oprot.writeMapEnd();" << endl;
-  } else if (ttype->is_set()) {
-    indent(out) << "oprot.writeSetEnd();" << endl;
-  } else if (ttype->is_list()) {
-    indent(out) << "oprot.writeListEnd();" << endl;
-  }
-
-  scope_down(out);
-}
-
-/**
- * Serializes the members of a map.
- */
-void t_as3_generator::generate_serialize_map_element(ostream& out,
-                                                     t_map* tmap,
-                                                     string iter,
-                                                     string map) {
-  t_field kfield(tmap->get_key_type(), iter);
-  generate_serialize_field(out, &kfield, "");
-  t_field vfield(tmap->get_val_type(), map + "[" + iter + "]");
-  generate_serialize_field(out, &vfield, "");
-}
-
-/**
- * Serializes the members of a set.
- */
-void t_as3_generator::generate_serialize_set_element(ostream& out, t_set* tset, string iter) {
-  t_field efield(tset->get_elem_type(), iter);
-  generate_serialize_field(out, &efield, "");
-}
-
-/**
- * Serializes the members of a list.
- */
-void t_as3_generator::generate_serialize_list_element(ostream& out, t_list* tlist, string iter) {
-  t_field efield(tlist->get_elem_type(), iter);
-  generate_serialize_field(out, &efield, "");
-}
-
-/**
- * Returns a As3 type name
- *
- * @param ttype The type
- * @param container Is the type going inside a container?
- * @return As3 type name, i.e. HashMap<Key,Value>
- */
-string t_as3_generator::type_name(t_type* ttype, bool in_container, bool in_init) {
-  (void)in_init;
-  // In As3 typedefs are just resolved to their real type
-  ttype = get_true_type(ttype);
-  string prefix;
-
-  if (ttype->is_base_type()) {
-    return base_type_name((t_base_type*)ttype, in_container);
-  } else if (ttype->is_enum()) {
-    return "int";
-  } else if (ttype->is_map()) {
-    return "Dictionary";
-  } else if (ttype->is_set()) {
-    return "Set";
-  } else if (ttype->is_list()) {
-    return "Array";
-  }
-
-  // Check for namespacing
-  t_program* program = ttype->get_program();
-  if (program != nullptr && program != program_) {
-    string package = program->get_namespace("as3");
-    if (!package.empty()) {
-      return package + "." + ttype->get_name();
-    }
-  }
-
-  return ttype->get_name();
-}
-
-/**
- * Returns the AS3 type that corresponds to the thrift type.
- *
- * @param tbase The base type
- * @param container Is it going in a As3 container?
- */
-string t_as3_generator::base_type_name(t_base_type* type, bool in_container) {
-  (void)in_container;
-  t_base_type::t_base tbase = type->get_base();
-
-  switch (tbase) {
-  case t_base_type::TYPE_VOID:
-    return "void";
-  case t_base_type::TYPE_STRING:
-    if (type->is_binary()) {
-      return "ByteArray";
-    } else {
-      return "String";
-    }
-  case t_base_type::TYPE_BOOL:
-    return "Boolean";
-  case t_base_type::TYPE_I8:
-  case t_base_type::TYPE_I16:
-  case t_base_type::TYPE_I32:
-    return "int";
-  case t_base_type::TYPE_I64:
-    throw "i64 is not yet supported in as3";
-  case t_base_type::TYPE_DOUBLE:
-    return "Number";
-  default:
-    throw "compiler error: no As3 name for base type " + t_base_type::t_base_name(tbase);
-  }
-}
-
-/**
- * Declares a field, which may include initialization as necessary.
- *
- * @param ttype The type
- */
-string t_as3_generator::declare_field(t_field* tfield, bool init) {
-  // TODO(mcslee): do we ever need to initialize the field?
-  string result = "var " + tfield->get_name() + ":" + type_name(tfield->get_type());
-  if (init) {
-    t_type* ttype = get_true_type(tfield->get_type());
-    if (ttype->is_base_type() && tfield->get_value() != nullptr) {
-      std::ofstream dummy;
-      result += " = " + render_const_value(dummy, tfield->get_name(), ttype, tfield->get_value());
-    } else if (ttype->is_base_type()) {
-      t_base_type::t_base tbase = ((t_base_type*)ttype)->get_base();
-      switch (tbase) {
-      case t_base_type::TYPE_VOID:
-        throw "NO T_VOID CONSTRUCT";
-      case t_base_type::TYPE_STRING:
-        result += " = null";
-        break;
-      case t_base_type::TYPE_BOOL:
-        result += " = false";
-        break;
-      case t_base_type::TYPE_I8:
-      case t_base_type::TYPE_I16:
-      case t_base_type::TYPE_I32:
-      case t_base_type::TYPE_I64:
-        result += " = 0";
-        break;
-      case t_base_type::TYPE_DOUBLE:
-        result += " = (double)0";
-        break;
-      }
-
-    } else if (ttype->is_enum()) {
-      result += " = 0";
-    } else if (ttype->is_container()) {
-      result += " = new " + type_name(ttype, false, true) + "()";
-    } else {
-      result += " = new " + type_name(ttype, false, true) + "()";
-      ;
-    }
-  }
-  return result + ";";
-}
-
-/**
- * Renders a function signature of the form 'type name(args)'
- *
- * @param tfunction Function definition
- * @return String of rendered function definition
- */
-string t_as3_generator::function_signature(t_function* tfunction, string prefix) {
-  std::string arguments = argument_list(tfunction->get_arglist());
-  if (!tfunction->is_oneway()) {
-    if (arguments != "") {
-      arguments += ", ";
-    }
-    arguments += "onError:Function, onSuccess:Function";
-  }
-
-  std::string result = "function " + prefix + tfunction->get_name() + "(" + arguments + "):void";
-  return result;
-}
-
-/**
- * Renders a comma separated field list, with type names
- */
-string t_as3_generator::argument_list(t_struct* tstruct) {
-  string result = "";
-
-  const vector<t_field*>& fields = tstruct->get_members();
-  vector<t_field*>::const_iterator f_iter;
-  bool first = true;
-  for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    if (first) {
-      first = false;
-    } else {
-      result += ", ";
-    }
-    result += (*f_iter)->get_name() + ":" + type_name((*f_iter)->get_type());
-  }
-  return result;
-}
-
-/**
- * Converts the parse type to a C++ enum string for the given type.
- */
-string t_as3_generator::type_to_enum(t_type* type) {
-  type = get_true_type(type);
-
-  if (type->is_base_type()) {
-    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
-    switch (tbase) {
-    case t_base_type::TYPE_VOID:
-      throw "NO T_VOID CONSTRUCT";
-    case t_base_type::TYPE_STRING:
-      return "TType.STRING";
-    case t_base_type::TYPE_BOOL:
-      return "TType.BOOL";
-    case t_base_type::TYPE_I8:
-      return "TType.BYTE";
-    case t_base_type::TYPE_I16:
-      return "TType.I16";
-    case t_base_type::TYPE_I32:
-      return "TType.I32";
-    case t_base_type::TYPE_I64:
-      return "TType.I64";
-    case t_base_type::TYPE_DOUBLE:
-      return "TType.DOUBLE";
-    }
-  } else if (type->is_enum()) {
-    return "TType.I32";
-  } else if (type->is_struct() || type->is_xception()) {
-    return "TType.STRUCT";
-  } else if (type->is_map()) {
-    return "TType.MAP";
-  } else if (type->is_set()) {
-    return "TType.SET";
-  } else if (type->is_list()) {
-    return "TType.LIST";
-  }
-
-  throw "INVALID TYPE IN type_to_enum: " + type->get_name();
-}
-
-/**
- * Applies the correct style to a string based on the value of nocamel_style_
- */
-std::string t_as3_generator::get_cap_name(std::string name) {
-  name[0] = toupper(name[0]);
-  return name;
-}
-
-string t_as3_generator::constant_name(string name) {
-  string constant_name;
-
-  bool is_first = true;
-  bool was_previous_char_upper = false;
-  for (char character : name) {
-    bool is_upper = isupper(character);
-
-    if (is_upper && !is_first && !was_previous_char_upper) {
-      constant_name += '_';
-    }
-    constant_name += toupper(character);
-
-    is_first = false;
-    was_previous_char_upper = is_upper;
-  }
-
-  return constant_name;
-}
-
-/**
- * Emits a As3Doc comment if the provided object has a doc in Thrift
- */
-void t_as3_generator::generate_as3_doc(ostream& out, t_doc* tdoc) {
-  if (tdoc->has_doc()) {
-    generate_docstring_comment(out, "/**\n", " * ", tdoc->get_doc(), " */\n");
-  }
-}
-
-/**
- * Emits a As3Doc comment if the provided function object has a doc in Thrift
- */
-void t_as3_generator::generate_as3_doc(ostream& out, t_function* tfunction) {
-  if (tfunction->has_doc()) {
-    stringstream ss;
-    ss << tfunction->get_doc();
-    const vector<t_field*>& fields = tfunction->get_arglist()->get_members();
-    vector<t_field*>::const_iterator p_iter;
-    for (p_iter = fields.begin(); p_iter != fields.end(); ++p_iter) {
-      t_field* p = *p_iter;
-      ss << "\n@param " << p->get_name();
-      if (p->has_doc()) {
-        ss << " " << p->get_doc();
-      }
-    }
-    generate_docstring_comment(out, "/**\n", " * ", ss.str(), " */\n");
-  }
-}
-
-std::string t_as3_generator::generate_isset_check(t_field* field) {
-  return generate_isset_check(field->get_name());
-}
-
-std::string t_as3_generator::generate_isset_check(std::string field_name) {
-  return "is" + get_cap_name("set") + get_cap_name(field_name) + "()";
-}
-
-void t_as3_generator::generate_isset_set(ostream& out, t_field* field) {
-  if (!type_can_be_null(field->get_type())) {
-    indent(out) << "this.__isset_" << field->get_name() << " = true;" << endl;
-  }
-}
-
-std::string t_as3_generator::get_enum_class_name(t_type* type) {
-  string package = "";
-  t_program* program = type->get_program();
-  if (program != nullptr && program != program_) {
-    package = program->get_namespace("as3") + ".";
-  }
-  return package + type->get_name();
-}
-
-THRIFT_REGISTER_GENERATOR(
-    as3,
-    "AS3",
-    "    bindable:        Add [bindable] metadata to all the struct classes.\n")
diff --git a/compiler/cpp/src/thrift/generate/t_generator.cc b/compiler/cpp/src/thrift/generate/t_generator.cc
index d87af89..1c540d4 100644
--- a/compiler/cpp/src/thrift/generate/t_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_generator.cc
@@ -237,9 +237,6 @@
   if ((language == "csharp") || (language == "netcore")) {
     failure("The '%s' target is no longer available. Use 'netstd' instead.", language.c_str());
   }
-  else if (language == "as3") {
-    pwarning(1, "The '%s' target is deprecated and will be removed in future Thrift versions.", language.c_str());
-  }
   else if (language == "hs") {
     pwarning(1, "The '%s' target is deprecated and will be removed in future Thrift versions.", language.c_str());
   }
diff --git a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
index 7f1bb6f..725a534 100644
--- a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
@@ -2975,7 +2975,7 @@
 THRIFT_REGISTER_GENERATOR(
     haxe,
     "Haxe",
-    "    callbacks        Use onError()/onSuccess() callbacks for service methods (like AS3)\n"
+    "    callbacks        Use onError()/onSuccess() callbacks for service methods\n"
     "    rtti             Enable @:rtti for generated classes and interfaces\n"
     "    buildmacro=my.macros.Class.method(args)\n"
     "                     Add @:build macro calls to generated classes and interfaces\n")
diff --git a/compiler/cpp/tests/CMakeLists.txt b/compiler/cpp/tests/CMakeLists.txt
index 924e167..57b4c09 100644
--- a/compiler/cpp/tests/CMakeLists.txt
+++ b/compiler/cpp/tests/CMakeLists.txt
@@ -97,7 +97,6 @@
 endmacro()
 
 # The following compiler with unit tests can be enabled or disabled
-THRIFT_ADD_COMPILER(as3     "Enable compiler for ActionScript 3" OFF)
 THRIFT_ADD_COMPILER(c_glib  "Enable compiler for C with Glib" OFF)
 THRIFT_ADD_COMPILER(cl      "Enable compiler for Common LISP" OFF)
 THRIFT_ADD_COMPILER(cpp     "Enable compiler for C++" OFF)
diff --git a/configure.ac b/configure.ac
index 608c4aa..a70a812 100755
--- a/configure.ac
+++ b/configure.ac
@@ -116,7 +116,6 @@
 have_libs=yes
 if test "$enable_libs" = "no"; then
   have_libs="no"
-  with_as3="no"
   with_cpp="no"
   with_c_glib="no"
   with_cl="no"
@@ -141,18 +140,6 @@
   with_swift="no"
 fi
 
-AX_THRIFT_LIB(as3, [as3], yes)
-have_as3=no
-if test "$with_as3" = "yes"; then
-  if test "${FLEX_HOME+set}" = set; then 
-    AC_PATH_PROGS([FLEX_COMPC], [compc], "fail", [$PATH$PATH_SEPARATOR$FLEX_HOME/bin])
-    if test "$FLEX_COMPC" != "fail"; then
-      have_as3="yes"
-    fi
-  fi
-fi
-AM_CONDITIONAL(WITH_AS3, [test "$have_as3" = "yes"])
-
 AX_THRIFT_LIB(cpp, [C++], yes)
 have_cpp=no
 if test "$with_cpp" = "yes";  then
@@ -776,7 +763,6 @@
   compiler/cpp/src/Makefile
   compiler/cpp/test/Makefile
   lib/Makefile
-  lib/as3/Makefile
   lib/cl/Makefile
   lib/cpp/Makefile
   lib/cpp/test/Makefile
@@ -857,8 +843,6 @@
   tutorial/rs/Makefile
 ])
 
-if test "$have_as3" = "yes" ; then MAYBE_AS3="as3" ; else MAYBE_AS3="" ; fi
-AC_SUBST([MAYBE_AS3])
 if test "$have_cpp" = "yes" ; then MAYBE_CPP="cpp" ; else MAYBE_CPP="" ; fi
 AC_SUBST([MAYBE_CPP])
 if test "$have_c_glib" = "yes" ; then MAYBE_C_GLIB="c_glib" ; else MAYBE_C_GLIB="" ; fi
@@ -906,7 +890,6 @@
 echo
 echo "$PACKAGE $VERSION"
 echo
-echo "Building ActionScript3 Library : $have_as3"
 echo "Building C (GLib) Library .... : $have_c_glib"
 echo "Building C++ Library ......... : $have_cpp"
 echo "Building Common Lisp Library.. : $have_cl"
@@ -928,12 +911,6 @@
 echo "Building Rust Library ........ : $have_rs"
 echo "Building Swift Library ....... : $have_swift"
 
-if test "$have_as3" = "yes" ; then
-  echo
-  echo "ActionScript Library:"
-  echo "   FLEX_HOME ................. : $FLEX_HOME"
-  echo "   Using compc version ....... : $($FLEX_COMPC --version)"
-fi
 if test "$have_c_glib" = "yes" ; then
   echo
   echo "C (glib):"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5d16256..3213aff 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -20,10 +20,6 @@
 SUBDIRS = json xml
 PRECROSS_TARGET =
 
-if WITH_AS3
-SUBDIRS += as3
-endif
-
 if WITH_CPP
 SUBDIRS += cpp
 endif
@@ -106,7 +102,6 @@
 # All of the libs that don't use Automake need to go in here
 # so they will end up in our release tarballs.
 EXTRA_DIST = \
-	as3 \
 	d \
 	dart \
 	delphi \
diff --git a/lib/as3/CMakeLists.txt b/lib/as3/CMakeLists.txt
deleted file mode 100644
index 999905d..0000000
--- a/lib/as3/CMakeLists.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-if (IS_ABSOLUTE "${LIB_INSTALL_DIR}")
-    set(AS3_INSTALL_DIR "${LIB_INSTALL_DIR}/as3")
-else ()
-    set(AS3_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/as3")
-endif ()
-
-set(PRELEASE "true")
-if (CMAKE_BUILD_TYPE MATCHES DEBUG)
-    set(PRELEASE "false")
-endif ()
-
-add_custom_target(ThriftAs3 ALL
-    COMMENT "Building as3 library using Gradle Wrapper"
-    COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} compileFlex
-        --console=plain --no-daemon
-        -Prelease=${PRELEASE}
-        "-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build"
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    )
-
-# Enable publishing from CMake if the publishing information is provided
-if (NOT CMAKE_BUILD_TYPE MATCHES DEBUG)
-    add_custom_target(MavenPublishAs3
-        COMMENT "Publishing as3 library to Apache Maven staging"
-        COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} clean publishMavenPublicationToMavenRepository
-            --console=plain --no-daemon
-            -Prelease=${PRELEASE}
-            -Psign=${PRELEASE}
-            "-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build"
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    )
-endif ()
-
-# Hook the CMake install process to the results from make ALL.
-# This works best when 'make all && sudo make install/fast' is used.
-# Using slash to end the source location to avoid copying the directory path.
-install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build/libs/
-        DESTINATION ${AS3_INSTALL_DIR}
-        FILES_MATCHING PATTERN "libthrift-as3.swc")
-
-if (BUILD_TESTING)
-    add_test(NAME As3Test
-            COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} test
-                --console=plain --no-daemon
-                -Prelease=${PRELEASE}
-                "-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build"
-                "-Pthrift.compiler=${THRIFT_COMPILER}"
-            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-endif ()
diff --git a/lib/as3/Makefile.am b/lib/as3/Makefile.am
deleted file mode 100644
index 0b3c3be..0000000
--- a/lib/as3/Makefile.am
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-all-local:
-	./gradlew $(GRADLE_OPTS) compile \
-		-Prelease=true \
-		--console=plain
-
-install-exec-hook:
-	./gradlew $(GRADLE_OPTS) publishToMavenLocal \
-		-Prelease=true \
-		--console=plain
-
-clean-local:
-	./gradlew $(GRADLE_OPTS) clean \
-		-Prelease=true \
-                --console=plain
-	$(RM) -r .gradle
-
-check-local: $(THRIFT)
-	./gradlew $(GRADLE_OPTS) test \
-		-Prelease=true \
-		--console=plain
-
-maven-publish:
-	./gradlew $(GRADLE_OPTS) publishMavenPublicationToMavenRepository \
-		-Prelease=true \
-                -Psign=true \
-		--console=plain
-
-dist-hook:
-	$(RM) -r $(distdir)/.gradle/
-
-EXTRA_DIST = \
-	CMakeLists.txt \
-	README.md \
-	build.gradle \
-	coding_standards.md \
-	gradle \
-	gradle.properties \
-	gradlew \
-	gradlew.bat \
-	settings.gradle \
-	src
diff --git a/lib/as3/README.md b/lib/as3/README.md
deleted file mode 100644
index c14f8c7..0000000
--- a/lib/as3/README.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Apache Thrift ActionScript Library
-
-## Building
-
-We use gradle and gradlefx to build the as3 library.  Unfortunately gradlefx requires
-an older version of gradle (2.5) but it still works - for now.  If you use the docker
-container to do the build, the Adobe Flex SDK 4.6 is installed and the FLEX_HOME
-environment variable is configured:
-
-    dev@ubuntu:~/thrift$ docker run -v $(pwd):/thrift/src:rw -it thrift/thrift-build:ubuntu-bionic /bin/bash
-    root@7624b61bbf84:/thrift/src# cd lib/as3
-    root@7624b61bbf84:/thrift/src/lib/as3# ./gradlew -Prelease=true compileFlex
-
-    ...
-
-    :compileFlex UP-TO-DATE
-
-    BUILD SUCCESSFUL
-
-    Total time: 10.784 secs
-
-    root@7624b61bbf84:/thrift/src/lib/as3# ls -ls build/
-    total 4
-    4 -rw-r--r-- 1 root root 1379 Jan 22 19:23 libthrift-as3.swc
-
-## Publishing
-
-We use a similar gradle-based signing and publishing mechanism as in the java
-library.  See the java library [README.md](../java/README.md) for more details.
-
-To publish into a local .m2 repository you can mount a directory into the docker container,
-for example:
-
-    dev@ubuntu:~/thrift$ docker run -v~/.m2:/root/.m2 -v $(pwd):/thrift/src:rw -it thrift/thrift-build:ubuntu-bionic /bin/bash
-    root@7624b61bbf84:/thrift/src/lib/as3# ./gradlew -Prelease=true publishToMavenLocal
-
-You will find your `~/.m2` directory is now populated with a release build `swc`.
diff --git a/lib/as3/build.gradle b/lib/as3/build.gradle
deleted file mode 100644
index 7853499..0000000
--- a/lib/as3/build.gradle
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-buildscript {
-    repositories {
-        mavenLocal()
-        mavenCentral()
-    }
-    dependencies {
-        classpath group: 'org.gradlefx', name: 'gradlefx', version: '1.5.0'
-    }
-}
-
-plugins {
-    id 'maven-publish'
-    id 'signing'
-}
-
-apply plugin: 'gradlefx'
-
-description = 'Apache Thrift ActionScript Library'
-frameworkLinkage = 'none'
-group = property('thrift.groupid')
-srcDirs = ['src']
-type = 'swc'
-
-// We use the SNAPSHOT suffix for non-release versions
-if (Boolean.parseBoolean(project.release)) {
-    additionalCompilerOptions = ['-compiler.debug=false', '-compiler.strict=true']
-    version = property('thrift.version')
-} else {
-    additionalCompilerOptions = ['-compiler.debug=true', '-compiler.strict=true']
-    version = property('thrift.version') + '-SNAPSHOT'
-}
-
-defaultTasks 'compile'
-
-// Keeping the rest of the build logic in functional named scripts for clarity
-apply from: 'gradle/publishing.gradle'
-
diff --git a/lib/as3/coding_standards.md b/lib/as3/coding_standards.md
deleted file mode 100644
index fa0390b..0000000
--- a/lib/as3/coding_standards.md
+++ /dev/null
@@ -1 +0,0 @@
-Please follow [General Coding Standards](/doc/coding_standards.md)
diff --git a/lib/as3/gradle.properties b/lib/as3/gradle.properties
deleted file mode 100644
index 28f9cd5..0000000
--- a/lib/as3/gradle.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# This file is shared currently between this Gradle build and the
-# Ant builds for fd303 and JavaScript. Keep the dotted notation for
-# the properties to minimize the changes in the dependencies.
-thrift.version=0.15.0
-thrift.groupid=org.apache.thrift
-release=false
-sign=false
-
-# Local Install paths
-install.path=/usr/local/lib
-install.javadoc.path=/usr/local/lib
-
-# Test execution properties
-testPort=9090
-
-# Maven dependency download locations
-mvn.repo=https://repo1.maven.org/maven2
-apache.repo=https://repository.apache.org/content/repositories/releases
-
-# Apache Maven publish
-license=https://www.apache.org/licenses/LICENSE-2.0.txt
-maven-repository-url=https://repository.apache.org/service/local/staging/deploy/maven2
-maven-repository-id=apache.releases.https
diff --git a/lib/as3/gradle/publishing.gradle b/lib/as3/gradle/publishing.gradle
deleted file mode 100644
index 3e0ecf3..0000000
--- a/lib/as3/gradle/publishing.gradle
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// Following Gradle best practices to keep build logic organized
-
-model {
-    tasks.signMavenPublication {
-        dependsOn compileFlex
-    }
-}
-
-publishing {
-    publications {
-        maven(MavenPublication) {
-
-            groupId = "$group"
-            artifactId = "${project.name}"
-            version = "$version"
-
-            def swcFile = file("$buildDir/libthrift-as3.swc")
-            artifact(swcFile)
-
-            pom {
-                description = 'Thrift is a software framework for scalable cross-language services development.'
-                packaging = 'swc'
-
-                // older gradle doesn't recognize all the properties, so we inject them..
-                withXml {
-                    asNode().with {
-                        appendNode('name', 'Apache Thrift')
-                        appendNode('url', 'http://thrift.apache.org/')
-                        appendNode('scm').with {
-                            appendNode('url', 'https://github.com/apache/thrift/')
-                            appendNode('connection', 'scm:git:https://github.com/apache/thrift.git')
-                            appendNode('developerConnection', 'scm:git:git@github.com:apache/thrift.git')
-                        }
-                        appendNode('issueManagement').with {
-                            appendNode('url', 'https://issues.apache.org/jira/projects/THRIFT/')
-                            appendNode('system', 'Jira')
-                        }
-                        appendNode('licenses').with {
-                            appendNode('license').with {
-                                appendNode('name', 'The Apache Software License, Version 2.0')
-                                appendNode('url', "${project.license}")
-                            }
-                        }
-                        appendNode('organization').with {
-                            appendNode('name', 'The Apache Software Foundation')
-                            appendNode('url', 'http://www.apache.org/')
-                        }
-                        appendNode('developers').with {
-                            appendNode('developer').with {
-                                appendNode('id', 'dev')
-                                appendNode('name', 'Apache Thrift Developers')
-                                appendNode('email', 'dev@thrift.apache.org')
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-    repositories {
-        maven {
-            url = property('maven-repository-url')
-
-            if (project.hasProperty('mavenUser') && project.hasProperty('mavenPassword')) {
-                credentials {
-                    username = property('mavenUser')
-                    password = property('mavenPassword')
-                }
-            }
-        }
-    }
-}
-
-signing {
-    required { property('sign') }
-    sign publishing.publications.maven
-}
diff --git a/lib/as3/gradle/wrapper/gradle-wrapper.jar b/lib/as3/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 87b738c..0000000
--- a/lib/as3/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/lib/as3/gradle/wrapper/gradle-wrapper.properties b/lib/as3/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 5028f28..0000000
--- a/lib/as3/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/lib/as3/gradlew b/lib/as3/gradlew
deleted file mode 100755
index af6708f..0000000
--- a/lib/as3/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-##  Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
-    if expr "$link" : '/.*' > /dev/null; then
-        PRG="$link"
-    else
-        PRG=`dirname "$PRG"`"/$link"
-    fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
-    echo "$*"
-}
-
-die () {
-    echo
-    echo "$*"
-    echo
-    exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
-  CYGWIN* )
-    cygwin=true
-    ;;
-  Darwin* )
-    darwin=true
-    ;;
-  MINGW* )
-    msys=true
-    ;;
-  NONSTOP* )
-    nonstop=true
-    ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
-    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
-        # IBM's JDK on AIX uses strange locations for the executables
-        JAVACMD="$JAVA_HOME/jre/sh/java"
-    else
-        JAVACMD="$JAVA_HOME/bin/java"
-    fi
-    if [ ! -x "$JAVACMD" ] ; then
-        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-    fi
-else
-    JAVACMD="java"
-    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
-    MAX_FD_LIMIT=`ulimit -H -n`
-    if [ $? -eq 0 ] ; then
-        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
-            MAX_FD="$MAX_FD_LIMIT"
-        fi
-        ulimit -n $MAX_FD
-        if [ $? -ne 0 ] ; then
-            warn "Could not set maximum file descriptor limit: $MAX_FD"
-        fi
-    else
-        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
-    fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
-    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
-    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
-    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-    JAVACMD=`cygpath --unix "$JAVACMD"`
-
-    # We build the pattern for arguments to be converted via cygpath
-    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
-    SEP=""
-    for dir in $ROOTDIRSRAW ; do
-        ROOTDIRS="$ROOTDIRS$SEP$dir"
-        SEP="|"
-    done
-    OURCYGPATTERN="(^($ROOTDIRS))"
-    # Add a user-defined pattern to the cygpath arguments
-    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
-        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
-    fi
-    # Now convert the arguments - kludge to limit ourselves to /bin/sh
-    i=0
-    for arg in "$@" ; do
-        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
-        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
-
-        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
-            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
-        else
-            eval `echo args$i`="\"$arg\""
-        fi
-        i=$((i+1))
-    done
-    case $i in
-        (0) set -- ;;
-        (1) set -- "$args0" ;;
-        (2) set -- "$args0" "$args1" ;;
-        (3) set -- "$args0" "$args1" "$args2" ;;
-        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
-        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
-        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
-        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
-        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
-        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
-    esac
-fi
-
-# Escape application args
-save () {
-    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
-    echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
-  cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/lib/as3/gradlew.bat b/lib/as3/gradlew.bat
deleted file mode 100644
index 9618d8d..0000000
--- a/lib/as3/gradlew.bat
+++ /dev/null
@@ -1,100 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem      https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem  Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/lib/as3/settings.gradle b/lib/as3/settings.gradle
deleted file mode 100644
index 4932346..0000000
--- a/lib/as3/settings.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-rootProject.name = 'libthrift-as3'
diff --git a/lib/as3/src/org/apache/thrift/AbstractMethodError.as b/lib/as3/src/org/apache/thrift/AbstractMethodError.as
deleted file mode 100644
index a2082b8..0000000
--- a/lib/as3/src/org/apache/thrift/AbstractMethodError.as
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.thrift {
-
-  import flash.errors.IllegalOperationError;
-
-  public class AbstractMethodError extends IllegalOperationError {
-    
-    public function AbstractMethodError(message:String="") {
-      super("Attempt to call an abstract method");
-    }
-    
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/Set.as b/lib/as3/src/org/apache/thrift/Set.as
deleted file mode 100644
index ae5f428..0000000
--- a/lib/as3/src/org/apache/thrift/Set.as
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift {
-  import flash.utils.Dictionary;
-  
-  
-  public class Set {
-    
-    private var _elements:Dictionary = new Dictionary();
-    private var _size:int = 0;
-    
-    public function Set(... values) {
-      for each (var value:* in values) {
-        add(value);
-      }
-    }
-
-    public function add(o:*):Boolean {
-      var alreadyPresent:Boolean = _elements.hasOwnProperty(o);
-      if (! alreadyPresent) {
-        _size++;
-        _elements[o] = true;
-      }
-     
-      return ! alreadyPresent;
-    }
-
-    public function clear():void {
-      for (var value:* in _elements) {
-        remove(value);
-      }
-    }
-    
-    public function contains(o:Object):Boolean {
-      return _elements.hasOwnProperty(o);
-    }
-    
-    public function isEmpty():Boolean {
-      return _size == 0;
-    }
-    
-    public function remove(o:*):Boolean {
-      if (contains(o)) {
-        delete _elements[o];
-        _size--;
-        return true;
-      }
-      else {
-        return false;
-      }
-    }
-    
-    public function toArray():Array {
-      var ret:Array = new Array();
-      for (var key:* in _elements) {
-        ret.push(key);
-      }
-      return ret;
-    }
-    
-    public function get size():int {
-      return _size;
-    }
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/TApplicationError.as b/lib/as3/src/org/apache/thrift/TApplicationError.as
deleted file mode 100644
index 3448fce..0000000
--- a/lib/as3/src/org/apache/thrift/TApplicationError.as
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift {
-
-  import org.apache.thrift.protocol.TField;
-  import org.apache.thrift.protocol.TProtocol;
-  import org.apache.thrift.protocol.TProtocolUtil;
-  import org.apache.thrift.protocol.TStruct;
-  import org.apache.thrift.protocol.TType;
-
-  /**
-   * Application level exception
-   */
-  public class TApplicationError extends TError {
-
-    private static const TAPPLICATION_EXCEPTION_STRUCT:TStruct = new TStruct("TApplicationException");
-    private static const MESSAGE_FIELD:TField = new TField("message", TType.STRING, 1);
-    private static const TYPE_FIELD:TField = new TField("type", TType.I32, 2);
-
-    public static const UNKNOWN:int = 0;
-    public static const UNKNOWN_METHOD:int = 1;
-    public static const INVALID_MESSAGE_TYPE:int = 2;
-    public static const WRONG_METHOD_NAME:int = 3;
-    public static const BAD_SEQUENCE_ID:int = 4;
-    public static const MISSING_RESULT:int = 5;
-    public static const INTERNAL_ERROR:int = 6;
-    public static const PROTOCOL_ERROR:int = 7;
-    public static const INVALID_TRANSFORM:int = 8;
-    public static const INVALID_PROTOCOL:int = 9;
-    public static const UNSUPPORTED_CLIENT_TYPE:int = 10;
-
-    public function TApplicationError(type:int = UNKNOWN, message:String = "") {
-      super(message, type);
-    }
-
-    public static function read(iprot:TProtocol):TApplicationError {
-      var field:TField;
-      iprot.readStructBegin();
-
-      var message:String = null;
-      var type:int = UNKNOWN;
-
-      while (true) {
-        field = iprot.readFieldBegin();
-        if (field.type == TType.STOP) {
-          break;
-        }
-        switch (field.id) {
-          case 1:
-            if (field.type == TType.STRING) {
-              message = iprot.readString();
-            }
-            else {
-              TProtocolUtil.skip(iprot, field.type);
-            }
-            break;
-          case 2:
-            if (field.type == TType.I32) {
-              type = iprot.readI32();
-            }
-            else {
-              TProtocolUtil.skip(iprot, field.type);
-            }
-            break;
-          default:
-            TProtocolUtil.skip(iprot, field.type);
-            break;
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-      return new TApplicationError(type, message);
-    }
-
-    public function write(oprot:TProtocol):void {
-        oprot.writeStructBegin(TAPPLICATION_EXCEPTION_STRUCT);
-        if (message != null) {
-          oprot.writeFieldBegin(MESSAGE_FIELD);
-          oprot.writeString(message);
-          oprot.writeFieldEnd();
-        }
-        oprot.writeFieldBegin(TYPE_FIELD);
-        oprot.writeI32(errorID);
-        oprot.writeFieldEnd();
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/TBase.as b/lib/as3/src/org/apache/thrift/TBase.as
deleted file mode 100644
index 615db1d..0000000
--- a/lib/as3/src/org/apache/thrift/TBase.as
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift {
-
-  import org.apache.thrift.protocol.TProtocol;
-
-  /**
-   * Generic base interface for generated Thrift objects.
-   *
-   */
-  public interface TBase {
-  
-    /**
-     * Reads the TObject from the given input protocol.
-     *
-     * @param iprot Input protocol
-     */
-    function read(iprot:TProtocol):void;
-  
-    /**
-     * Writes the objects out to the protocol
-     *
-     * @param oprot Output protocol
-     */
-    function write(oprot:TProtocol):void;
-  
-    /**
-     * Check if a field is currently set or unset.
-     *
-     * @param fieldId The field's id tag as found in the IDL.
-     */
-    function isSet(fieldId:int):Boolean;
-  
-    /**
-     * Get a field's value by id. Primitive types will be wrapped in the 
-     * appropriate "boxed" types.
-     *
-     * @param fieldId The field's id tag as found in the IDL.
-     */
-    function getFieldValue(fieldId:int):*;
-  
-    /**
-     * Set a field's value by id. Primitive types must be "boxed" in the 
-     * appropriate object wrapper type.
-     *
-     * @param fieldId The field's id tag as found in the IDL.
-     */
-    function setFieldValue(fieldId:int, value:*):void;
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/TError.as b/lib/as3/src/org/apache/thrift/TError.as
deleted file mode 100644
index ccc13b5..0000000
--- a/lib/as3/src/org/apache/thrift/TError.as
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.thrift {
-  
-  public class TError extends Error {
-    
-    public function TError(message:String = "", errorCode:int = 0) {
-      super(message, errorCode);
-    }
-    
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/TFieldRequirementType.as b/lib/as3/src/org/apache/thrift/TFieldRequirementType.as
deleted file mode 100644
index 6fb4e58..0000000
--- a/lib/as3/src/org/apache/thrift/TFieldRequirementType.as
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift {
-
-  /**
-   * Requirement type constants.
-   *
-   */
-  public class TFieldRequirementType {
-    public static const REQUIRED:int  = 1;
-    public static const OPTIONAL:int = 2;
-    public static const DEFAULT:int = 3;
-  }
-  
-}
diff --git a/lib/as3/src/org/apache/thrift/TProcessor.as b/lib/as3/src/org/apache/thrift/TProcessor.as
deleted file mode 100644
index 850acc9..0000000
--- a/lib/as3/src/org/apache/thrift/TProcessor.as
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package org.apache.thrift {
-
-import org.apache.thrift.protocol.TProtocol;
-
-    /**
-     * A processor is a generic object which operates upon an input stream and
-     * writes to some output stream.
-     *
-     */
-    public interface TProcessor {
-      function process(input:TProtocol, output:TProtocol):Boolean;
-    }
-}
diff --git a/lib/as3/src/org/apache/thrift/meta_data/FieldMetaData.as b/lib/as3/src/org/apache/thrift/meta_data/FieldMetaData.as
deleted file mode 100644
index cb18a14..0000000
--- a/lib/as3/src/org/apache/thrift/meta_data/FieldMetaData.as
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.meta_data {
-
-  import flash.utils.Dictionary;
-
-  /**
-   * This class is used to store meta data about thrift fields. Every field in a
-   * a struct should have a corresponding instance of this class describing it.
-   *
-   */
-  public class FieldMetaData {
-  
-    public var fieldName:String;
-    public var requirementType:int;
-    public var valueMetaData:FieldValueMetaData;
-  
-    private static var structMap:Dictionary = new Dictionary();
-  
-    public function FieldMetaData(name:String, req:int, vMetaData:FieldValueMetaData) {
-      this.fieldName = name;
-      this.requirementType = req;
-      this.valueMetaData = vMetaData;
-    }
-  
-    public static function addStructMetaDataMap(sClass:Class, map:Dictionary):void{
-      structMap[sClass] = map;
-    }
-
-    /**
-     * Returns a map with metadata (i.e. instances of FieldMetaData) that
-     * describe the fields of the given class.
-     *
-     * @param sClass The TBase class for which the metadata map is requested
-     */
-    public static function getStructMetaDataMap(sClass:Class):Dictionary {
-      return structMap[sClass];
-    }
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/meta_data/FieldValueMetaData.as b/lib/as3/src/org/apache/thrift/meta_data/FieldValueMetaData.as
deleted file mode 100644
index 07fe1be..0000000
--- a/lib/as3/src/org/apache/thrift/meta_data/FieldValueMetaData.as
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.meta_data {
-
-  import org.apache.thrift.protocol.TType;
-
-  /**
-   * FieldValueMetaData and collection of subclasses to store metadata about
-   * the value(s) of a field
-   */
-  public class FieldValueMetaData {
-  
-    public var type:int;  
- 
-    public function FieldValueMetaData(type:int) {
-      this.type = type;
-    }
-  
-    public function isStruct():Boolean {
-      return type == TType.STRUCT; 
-    }
-  
-    public function isContainer():Boolean {
-      return type == TType.LIST || type == TType.MAP || type == TType.SET;
-    }
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/meta_data/ListMetaData.as b/lib/as3/src/org/apache/thrift/meta_data/ListMetaData.as
deleted file mode 100644
index a2cc732..0000000
--- a/lib/as3/src/org/apache/thrift/meta_data/ListMetaData.as
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.meta_data {
-  
-  public class ListMetaData extends FieldValueMetaData {
-    
-    public var elemMetaData:FieldValueMetaData;
-  
-    public function ListMetaData(type:int, eMetaData:FieldValueMetaData) {
-      super(type);
-      this.elemMetaData = eMetaData;
-    }    
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/meta_data/MapMetaData.as b/lib/as3/src/org/apache/thrift/meta_data/MapMetaData.as
deleted file mode 100644
index e7f1f9f..0000000
--- a/lib/as3/src/org/apache/thrift/meta_data/MapMetaData.as
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.meta_data {
-
-  public class MapMetaData extends FieldValueMetaData {
-  
-    public var keyMetaData:FieldValueMetaData;
-    public var valueMetaData:FieldValueMetaData;
-  
-    public function MapMetaData(type:int, kMetaData:FieldValueMetaData, vMetaData:FieldValueMetaData) {
-      super(type);
-      this.keyMetaData = kMetaData;
-      this.valueMetaData = vMetaData;
-    }
-  }    
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/meta_data/SetMetaData.as b/lib/as3/src/org/apache/thrift/meta_data/SetMetaData.as
deleted file mode 100644
index 390f034..0000000
--- a/lib/as3/src/org/apache/thrift/meta_data/SetMetaData.as
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.meta_data {
-
-  public class SetMetaData extends FieldValueMetaData {
-  
-    public var elemMetaData:FieldValueMetaData;
-  
-    public function SetMetaData(type:int, eMetaData:FieldValueMetaData) {
-      super(type);
-      this.elemMetaData = eMetaData; 
-    }
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/meta_data/StructMetaData.as b/lib/as3/src/org/apache/thrift/meta_data/StructMetaData.as
deleted file mode 100644
index fc9b0be..0000000
--- a/lib/as3/src/org/apache/thrift/meta_data/StructMetaData.as
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.meta_data {
-
-  public class StructMetaData extends FieldValueMetaData {
-    
-    public var structClass:Class;
-  
-    public function StructMetaData(type:int, sClass:Class) {
-      super(type);
-      this.structClass = sClass;
-    }
-  }    
-}
diff --git a/lib/as3/src/org/apache/thrift/protocol/TBinaryProtocol.as b/lib/as3/src/org/apache/thrift/protocol/TBinaryProtocol.as
deleted file mode 100644
index b2ff9d8..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TBinaryProtocol.as
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.protocol {
-
-  import flash.utils.ByteArray;
-  
-  import org.apache.thrift.TError;
-  import org.apache.thrift.transport.THttpClient;
-  import org.apache.thrift.transport.TTransport;
-    
-  /**
-   * Binary protocol implementation for thrift.
-   */
-  public class TBinaryProtocol implements TProtocol {
-
-    private static var ANONYMOUS_STRUCT:TStruct = new TStruct();
-
-    protected static const VERSION_MASK:int = int(0xffff0000);
-    protected static const VERSION_1:int = int(0x80010000);
-
-    protected var strictRead_:Boolean = false;
-    protected var strictWrite_:Boolean = true;
-    
-  /**
-   * Factory
-   */
-   /*
-  public static class Factory implements TProtocolFactory {
-    protected boolean strictRead_ = false;
-    protected boolean strictWrite_ = true;
-
-    public Factory() {
-      this(false, true);
-    }
-
-    public Factory(boolean strictRead, boolean strictWrite) {
-      strictRead_ = strictRead;
-      strictWrite_ = strictWrite;
-    }
-
-    public TProtocol getProtocol(TTransport trans) {
-      return new TBinaryProtocol(trans, strictRead_, strictWrite_);
-    }
-  }
-  */
-  
-    private var trans_:TTransport;
-    
-    /**
-     * Constructor
-     */
-    public function TBinaryProtocol(trans:TTransport, strictRead:Boolean=false, strictWrite:Boolean=true) {
-      trans_ = trans;
-      strictRead_ = strictRead;
-      strictWrite_ = strictWrite;
-    }
-  
-    public function getTransport():TTransport {
-      return trans_;
-    }
-    
-    public function writeMessageBegin(message:TMessage):void {
-        if (strictWrite_) {
-          var version:int = VERSION_1 | message.type;
-          writeI32(version);
-          writeString(message.name);
-          writeI32(message.seqid);
-        } else {
-          writeString(message.name);
-          writeByte(message.type);
-          writeI32(message.seqid);
-        }
-    }
-    
-      public function writeMessageEnd():void {}
-  
-    public function writeStructBegin(struct:TStruct):void {}
-  
-    public function writeStructEnd():void {}
-  
-    public function writeFieldBegin(field:TField):void {
-      writeByte(field.type);
-      writeI16(field.id);
-    }
-    
-    public function writeFieldEnd():void {}
-    
-    public function writeFieldStop():void {
-      writeByte(TType.STOP);
-    }
-    
-    public function writeMapBegin(map:TMap):void {
-      writeByte(map.keyType);
-      writeByte(map.valueType);
-      writeI32(map.size);
-    }
-    
-    public function writeMapEnd():void {}
-    
-    public function writeListBegin(list:TList):void {
-        writeByte(list.elemType);
-        writeI32(list.size);
-    }
-    
-    public function writeListEnd():void {}
-    
-    public function writeSetBegin(set:TSet):void {
-        writeByte(set.elemType);
-        writeI32(set.size);
-      }
-      
-      public function writeSetEnd():void {}
-      
-      public function writeBool(b:Boolean):void {
-        writeByte(b ? 1 : 0);
-      }
-      
-      private var out:ByteArray = new ByteArray();
-      public function writeByte(b:int):void {
-        reset(out);
-        out.writeByte(b);
-        trans_.write(out, 0, 1);
-      }
-      
-      public function writeI16(i16:int):void {
-        reset(out);
-        out.writeShort(i16);
-        trans_.write(out, 0, 2);
-      }
-      
-      public function writeI32(i32:int):void {
-        reset(out);
-        out.writeInt(i32);
-        trans_.write(out, 0, 4);
-      }
-      
-      //private byte[] i64out = new byte[8];
-      //public function writeI64(i64:Number):void {
-        //i64out[0] = (byte)(0xff & (i64 >> 56));
-        //i64out[1] = (byte)(0xff & (i64 >> 48));
-        //i64out[2] = (byte)(0xff & (i64 >> 40));
-        //i64out[3] = (byte)(0xff & (i64 >> 32));
-        //i64out[4] = (byte)(0xff & (i64 >> 24));
-        //i64out[5] = (byte)(0xff & (i64 >> 16));
-        //i64out[6] = (byte)(0xff & (i64 >> 8));
-        //i64out[7] = (byte)(0xff & (i64));
-        //trans_.write(i64out, 0, 8);
-      //}
-      
-      public function writeDouble(dub:Number):void {
-        reset(out);
-        out.writeDouble(dub);
-        trans_.write(out, 0, 8);
-      }
-      
-      private var stringOut:ByteArray = new ByteArray();
-      
-      public function writeString(str:String):void {
-        reset(stringOut);
-        stringOut.writeUTFBytes(str);
-        
-        writeI32(stringOut.length);
-        trans_.write(stringOut, 0, stringOut.length);
-      }
-  
-    public function writeBinary(bin:ByteArray):void {
-      writeI32(bin.length);
-      trans_.write(bin, 0, bin.length);
-    }
-  
-    /**
-     * Reading methods.
-     */
-  
-    public function readMessageBegin():TMessage {
-      var size:int = readI32();
-      if (size < 0) {
-        var version:int = size & VERSION_MASK;
-        if (version != VERSION_1) {
-          throw new TProtocolError(TProtocolError.BAD_VERSION, "Bad version in readMessageBegin");
-        }
-        return new TMessage(readString(), size & 0x000000ff, readI32());
-      }
-      else {
-        if (strictRead_) {
-          throw new TProtocolError(TProtocolError.BAD_VERSION, "Missing version in readMessageBegin, old client?");
-        }
-            return new TMessage(readStringBody(size), readByte(), readI32());
-          }
-    }
-  
-    public function readMessageEnd():void {}
-  
-    public function readStructBegin():TStruct {
-        return ANONYMOUS_STRUCT;
-      }
-  
-    public function readStructEnd():void {}
-  
-    public function readFieldBegin():TField {
-        var type:int = readByte();
-        var id:int = type == TType.STOP ? 0 : readI16();
-        return new TField("", type, id);
-    }
-  
-    public function readFieldEnd():void {}
-  
-    public function readMapBegin():TMap {
-        return new TMap(readByte(), readByte(), readI32());
-    }
-  
-    public function readMapEnd():void {}
-  
-    public function readListBegin():TList {
-        return new TList(readByte(), readI32());
-    }
-  
-    public function readListEnd():void {}
-  
-    public function readSetBegin():TSet {
-      return new TSet(readByte(), readI32());
-    }
-  
-    public function readSetEnd():void {}
-  
-    public function readBool():Boolean {
-        return (readByte() == 1);
-    }
-  
-    private var bytes:ByteArray = new ByteArray();
-    
-    public function readByte():int {
-      readAll(1);
-        return bytes.readByte();
-      }
-  
-    public function readI16():int {
-        readAll(2);
-        return bytes.readShort();
-    }
-  
-    public function readI32():int {
-      readAll(4);
-      return bytes.readInt();
-    }
-  
-    //private byte[] i64rd = new byte[8];
-    /*
-    public function readI64() throws TException {
-      readAll(i64rd, 0, 8);
-      return
-        ((long)(i64rd[0] & 0xff) << 56) |
-        ((long)(i64rd[1] & 0xff) << 48) |
-        ((long)(i64rd[2] & 0xff) << 40) |
-        ((long)(i64rd[3] & 0xff) << 32) |
-        ((long)(i64rd[4] & 0xff) << 24) |
-        ((long)(i64rd[5] & 0xff) << 16) |
-        ((long)(i64rd[6] & 0xff) <<  8) |
-        ((long)(i64rd[7] & 0xff));
-    }
-    */
-  
-    public function readDouble():Number {
-      readAll(8);
-      return bytes.readDouble();
-    }
-  
-    public function readString():String {
-      var size:int = readI32();
-        readAll(size);
-        return bytes.readUTFBytes(size);
-      }
-  
-    public function readStringBody(size:int):String {
-        readAll(size);
-        return bytes.readUTFBytes(size);
-      }
-  
-    public function readBinary():ByteArray {
-        var size:int = readI32();
-        var buf:ByteArray = new ByteArray();
-        trans_.readAll(buf, 0, size);
-        return buf;
-    }
-  
-    private function readAll(len:int):void {
-      reset(bytes);
-      
-        trans_.readAll(bytes, 0, len);
-        
-        bytes.position = 0;
-      }
-    
-    private static function reset(arr:ByteArray):void {
-      arr.length = 0;
-      arr.position = 0;
-    }
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/protocol/TField.as b/lib/as3/src/org/apache/thrift/protocol/TField.as
deleted file mode 100644
index 1277f3a..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TField.as
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.thrift.protocol {
-    
-  public class TField {
-    
-    public var name:String;
-    public var type:int;
-    public var id:int;
-      
-    public function TField(n:String = "", t:int = 0, i:int = 0) {
-      name = n;
-      type = t;
-      id = i;
-    }
-    
-    public function toString():String {
-      return "<TField name:'" + name + "' type:" + type + " field-id:" + id + ">";
-    }
-    
-    public function equals(otherField:TField):Boolean {
-      return type == otherField.type && id == otherField.id;
-    }
-        
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TList.as b/lib/as3/src/org/apache/thrift/protocol/TList.as
deleted file mode 100644
index f0bdbad..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TList.as
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.thrift.protocol {
-  
-  public class TList {
-
-    public var elemType:int;
-    public var size:int;
-  
-      public function TList(t:int = 0, s:int = 0) {
-        elemType = t;
-        size = s;
-      }
-      
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TMap.as b/lib/as3/src/org/apache/thrift/protocol/TMap.as
deleted file mode 100644
index 2298804..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TMap.as
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.thrift.protocol {
-  public class TMap {
-    
-    public var keyType:int;
-    public var valueType:int;
-    public var size:int;
-  
-    public function TMap(k:int = 0, v:int = 0, s:int = 0) {
-      keyType = k;
-      valueType = v;
-      size = s;
-    }
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TMessage.as b/lib/as3/src/org/apache/thrift/protocol/TMessage.as
deleted file mode 100644
index 9817235..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TMessage.as
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.thrift.protocol {
-  
-  public class TMessage {
-    
-    public var name:String;
-    public var type:int;
-    public var seqid:int;
-  
-    public function TMessage(n:String = "", t:int = 0, s:int = 0) {
-      name = n;
-      type = t;
-      seqid = s;
-    }
-    
-    public function toString():String {
-      return "<TMessage name:'" + name + "' type: " + type + " seqid:" + seqid + ">";
-    }
-    
-    public function equals(other:TMessage):Boolean {
-      return name == other.name && type == other.type && seqid == other.seqid;
-    }
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TMessageType.as b/lib/as3/src/org/apache/thrift/protocol/TMessageType.as
deleted file mode 100644
index 56a9ba5..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TMessageType.as
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.thrift.protocol {
-  
-  public class TMessageType {
-    public static const CALL:int  = 1;
-    public static const REPLY:int = 2;
-    public static const EXCEPTION:int = 3;
-    public static const ONEWAY:int = 4;
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TProtocol.as b/lib/as3/src/org/apache/thrift/protocol/TProtocol.as
deleted file mode 100644
index bb9d744..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TProtocol.as
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.protocol {
-
-  import org.apache.thrift.TError;
-  import org.apache.thrift.transport.TTransport;
-
-  import flash.utils.ByteArray;
-  
-  /**
-   * Protocol interface definition
-   */
-  public interface TProtocol {
-  
-    function TProtocol(trans:TTransport);
-
-    function getTransport():TTransport;
-
-    /**
-     * Writing methods.
-     */
-    function writeMessageBegin(message:TMessage):void;
-  
-    function writeMessageEnd():void;
-    
-    function writeStructBegin(struct:TStruct):void;
-    
-    function writeStructEnd():void;
-    
-    function writeFieldBegin(field:TField):void;
-    
-    function writeFieldEnd():void;
-    
-    function writeFieldStop():void;
-    
-    function writeMapBegin(map:TMap):void;
-    
-    function writeMapEnd():void;
-    
-    function writeListBegin(list:TList):void;
-    
-    function writeListEnd():void;
-    
-    function writeSetBegin(set:TSet):void;
-    
-    function writeSetEnd():void;
-    
-    function writeBool(b:Boolean):void;
-    
-    function writeByte(b:int):void;
-    
-    function writeI16(i16:int):void;
-    
-    function writeI32(i32:int):void;
-    
-    //function writeI64(i64:Number):void;
-    
-    function writeDouble(dub:Number):void;
-    
-    function writeString(str:String):void;
-    
-    function writeBinary(bin:ByteArray):void;
-    
-    /**
-     * Reading methods.
-     */
-    function readMessageBegin():TMessage;
-    
-    function readMessageEnd():void;
-    
-    function readStructBegin():TStruct;
-    
-    function readStructEnd():void;
-    
-    function readFieldBegin():TField;
-    
-    function readFieldEnd():void;
-    
-    function readMapBegin():TMap;
-    
-    function readMapEnd():void;
-    
-    function readListBegin():TList;
-    
-    function readListEnd():void;
-    
-    function readSetBegin():TSet;
-    
-    function readSetEnd():void;
-    
-    function readBool():Boolean;
-    
-    function readByte():int;
-    
-    function readI16():int;
-    
-    function readI32():int;
-    
-    //function readI64():Number;
-    
-    function readDouble():Number;
-    
-    function readString():String;
-    
-    function readBinary():ByteArray;
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TProtocolError.as b/lib/as3/src/org/apache/thrift/protocol/TProtocolError.as
deleted file mode 100644
index 9fff730..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TProtocolError.as
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.protocol {
-  
-  import org.apache.thrift.TError;
-
-  public class TProtocolError extends TError {
-    
-    public static const UNKNOWN:int = 0;
-    public static const INVALID_DATA:int = 1;
-    public static const NEGATIVE_SIZE:int = 2;
-    public static const SIZE_LIMIT:int = 3;
-    public static const BAD_VERSION:int = 4;
-    public static const NOT_IMPLEMENTED:int = 5;
-    public static const DEPTH_LIMIT:int = 6;
-  
-    public function TProtocolError(error:int = UNKNOWN, message:String = "") {
-      super(message, error);
-    }
-    
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TProtocolFactory.as b/lib/as3/src/org/apache/thrift/protocol/TProtocolFactory.as
deleted file mode 100644
index c7f5e29..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TProtocolFactory.as
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.protocol {
-
-  import org.apache.thrift.transport.TTransport;
-  
-  public interface TProtocolFactory {
-     function getProtocol(trans:TTransport):TProtocol;
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TProtocolUtil.as b/lib/as3/src/org/apache/thrift/protocol/TProtocolUtil.as
deleted file mode 100644
index 22877b7..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TProtocolUtil.as
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.protocol {
-
-  import org.apache.thrift.TError;
-
-  /**
-   * Utility class with static methods for interacting with protocol data
-   * streams.
-   *
-   */
-  public class TProtocolUtil {
-
-    /**
-     * The maximum recursive depth the skip() function will traverse before
-     * throwing a TException.
-     */
-    private static var maxSkipDepth:int = int.MAX_VALUE;
-
-    /**
-     * Specifies the maximum recursive depth that the skip function will
-     * traverse before throwing a TException.  This is a global setting, so
-     * any call to skip in this JVM will enforce this value.
-     *
-     * @param depth  the maximum recursive depth.  A value of 2 would allow
-     *    the skip function to skip a structure or collection with basic children,
-     *    but it would not permit skipping a struct that had a field containing
-     *    a child struct.  A value of 1 would only allow skipping of simple
-     *    types and empty structs/collections.
-     */
-    public function setMaxSkipDepth(depth:int):void {
-      maxSkipDepth = depth;
-    }
-
-    /**
-     * Skips over the next data element from the provided input TProtocol object.
-     *
-     * @param prot  the protocol object to read from
-     * @param type  the next value will be intepreted as this TType value.
-     */
-    public static function skip(prot:TProtocol, type:int):void {
-      skipMaxDepth(prot, type, maxSkipDepth);
-    }
-
-     /**
-     * Skips over the next data element from the provided input TProtocol object.
-     *
-     * @param prot  the protocol object to read from
-     * @param type  the next value will be intepreted as this TType value.
-     * @param maxDepth  this function will only skip complex objects to this
-     *   recursive depth, to prevent Java stack overflow.
-     */
-    public static function skipMaxDepth(prot:TProtocol, type:int, maxDepth:int):void {
-      if (maxDepth <= 0) {
-        throw new TError("Maximum skip depth exceeded");
-      }
-      switch (type) {
-        case TType.BOOL: {
-          prot.readBool();
-          break;
-        }
-        case TType.BYTE: {
-          prot.readByte();
-          break;
-        }
-        case TType.I16: {
-          prot.readI16();
-          break;
-        }
-        case TType.I32: {
-          prot.readI32();
-          break;
-        }
-        /*
-        case TType.I64: {
-          prot.readI64();
-          break;
-        }
-        */
-        case TType.DOUBLE: {
-          prot.readDouble();
-          break;
-        }
-        case TType.STRING: {
-          prot.readBinary();
-          break;
-        }
-        case TType.STRUCT: {
-          prot.readStructBegin();
-          while (true) {
-            var field:TField = prot.readFieldBegin();
-            if (field.type == TType.STOP) {
-              break;
-            }
-            skipMaxDepth(prot, field.type, maxDepth - 1);
-            prot.readFieldEnd();
-          }
-          prot.readStructEnd();
-          break;
-        }
-        case TType.MAP: {
-          var map:TMap = prot.readMapBegin();
-          for (var i:int = 0; i < map.size; i++) {
-            skipMaxDepth(prot, map.keyType, maxDepth - 1);
-            skipMaxDepth(prot, map.valueType, maxDepth - 1);
-          }
-          prot.readMapEnd();
-          break;
-        }
-        case TType.SET: {
-          var set:TSet = prot.readSetBegin();
-          for (var j:int = 0; j < set.size; j++) {
-            skipMaxDepth(prot, set.elemType, maxDepth - 1);
-          }
-          prot.readSetEnd();
-          break;
-        }
-        case TType.LIST: {
-          var list:TList = prot.readListBegin();
-          for (var k:int = 0; k < list.size; k++) {
-            skipMaxDepth(prot, list.elemType, maxDepth - 1);
-          }
-          prot.readListEnd();
-          break;
-        }
-        default:
-          throw new TProtocolError(TProtocolError.INVALID_DATA, "invalid data");
-      }
-    }
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/protocol/TSet.as b/lib/as3/src/org/apache/thrift/protocol/TSet.as
deleted file mode 100644
index 3f0e1a6..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TSet.as
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.protocol {
-  
-  public class TSet {
-
-    public var elemType:int;
-    public var size:int;
-  
-      public function TSet(t:int = 0, s:int = 0) {
-        elemType = t;
-        size = s;
-      }
-      
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TStruct.as b/lib/as3/src/org/apache/thrift/protocol/TStruct.as
deleted file mode 100644
index dffad79..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TStruct.as
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.protocol {
-  
-  public class TStruct {
-    
-    public var name:String;
-    
-    public function TStruct(n:String = "") {
-      name = n;
-    }
-    
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/protocol/TType.as b/lib/as3/src/org/apache/thrift/protocol/TType.as
deleted file mode 100644
index 69af208..0000000
--- a/lib/as3/src/org/apache/thrift/protocol/TType.as
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.protocol {
-  
-  public class TType {
-    
-    public static const STOP:int   = 0;
-    public static const VOID:int   = 1;
-    public static const BOOL:int   = 2;
-    public static const BYTE:int   = 3;
-    public static const DOUBLE:int = 4;
-    public static const I16:int    = 6;
-    public static const I32:int    = 8;
-    public static const I64:int    = 10;
-    public static const STRING:int = 11;
-    public static const STRUCT:int = 12;
-    public static const MAP:int    = 13;
-    public static const SET:int    = 14;
-    public static const LIST:int   = 15;
-
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/transport/TFullDuplexHttpClient.as b/lib/as3/src/org/apache/thrift/transport/TFullDuplexHttpClient.as
deleted file mode 100644
index 863c59b..0000000
--- a/lib/as3/src/org/apache/thrift/transport/TFullDuplexHttpClient.as
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.transport
-{
-
-    import flash.errors.EOFError;
-    import flash.events.Event;
-    import flash.events.IOErrorEvent;
-    import flash.events.ProgressEvent;
-    import flash.events.SecurityErrorEvent;
-    import flash.net.URLLoader;
-    import flash.net.URLLoaderDataFormat;
-    import flash.net.URLRequest;
-    import flash.net.URLRequestMethod;
-    import flash.utils.IDataInput;
-    import flash.utils.IDataOutput;
-    import flash.utils.ByteArray;
-    import flash.net.Socket;
-    import flash.events.EventDispatcher;
-
-
-    /**
-     * HTTP implementation of the TTransport interface. Used for working with a
-     * Thrift web services implementation.
-     * Unlike Http Client, it uses a single POST, and chunk-encoding to transfer all messages.
-     */
-
-    public class TFullDuplexHttpClient extends TTransport
-    {
-        private var socket:Socket = null;
-
-        private var host:String;
-
-        private var port:int;
-
-        private var resource:String;
-
-        private var stripped:Boolean = false;
-
-        private var obuffer:ByteArray = new ByteArray();
-
-        private var input:IDataInput;
-
-        private var output:IDataOutput;
-
-        private var bytesInChunk:int = 0;
-
-        private var CRLF:ByteArray = new ByteArray();
-
-        private var ioCallback:Function = null;
-
-        private var eventDispatcher:EventDispatcher = new EventDispatcher();
-
-        public function TFullDuplexHttpClient(host:String, port:int, resource:String):void
-        {
-            CRLF.writeByte(13);
-            CRLF.writeByte(10);
-            this.host = host;
-            this.port = port;
-            this.resource = resource;
-        }
-
-        public override function close():void
-        {
-            this.input = null;
-            this.output = null;
-            this.stripped = false;
-            socket.close()
-        }
-
-    	public override function peek():Boolean
-    	{
-			if(socket.connected)
-			{
-				trace("Bytes remained:" + socket.bytesAvailable);
-				return socket.bytesAvailable>0;
-			}
-			return false;
-		}
-
-        public override function read(buf:ByteArray, off:int, len:int):int
-        {
-            var n1:int = 0, n2:int = 0, n3:int = 0, n4:int = 0, cidx:int = 2;
-            var chunkSize:ByteArray = new ByteArray();
-
-            try
-            {
-                while (!stripped)
-                {
-                    n1 = n2;
-                    n2 = n3;
-                    n3 = n4;
-                    n4 = input.readByte();
-                    if ((n1 == 13) && (n2 == 10) && (n3 == 13) && (n4 == 10))
-                    {
-                        stripped = true;
-                    }
-                }
-
-                // read chunk size
-                if (bytesInChunk == 0)
-                {
-                    n1 = input.readByte();
-                    n2 = input.readByte();
-
-                    chunkSize.writeByte(n1);
-                    chunkSize.writeByte(n2);
-
-                    while (!((n1 == 13) && (n2 == 10)))
-                    {
-                        n1 = n2;
-                        n2 = input.readByte();
-                        chunkSize.writeByte(n2);
-                    }
-
-                    bytesInChunk = parseInt(chunkSize.toString(), 16);
-                }
-
-                input.readBytes(buf, off, len);
-                debugBuffer(buf);
-                bytesInChunk -= len;
-
-                if (bytesInChunk == 0)
-                {
-                    // advance the : "\r\n"
-                    input.readUTFBytes(2);
-                }
-                return len;
-            }
-            catch (e:EOFError)
-            {
-                trace(e);
-                throw new TTransportError(TTransportError.UNKNOWN, "No more data available.");
-            }
-            catch (e:Error)
-            {
-                trace(e);
-                // WTF??
-                throw new TTransportError(TTransportError.UNKNOWN, "Bad IO error:" + e);
-            }
-            return 0;
-        }
-
-        public function debugBuffer(buf:ByteArray):void
-        {
-            var debug:String = "BUFFER >>";
-            var i:int;
-            for (i = 0; i < buf.length; i++)
-            {
-                debug += buf[i] as int;
-                debug += " ";
-            }
-
-            trace(debug + "<<");
-        }
-
-        public override function write(buf:ByteArray, off:int, len:int):void
-        {
-            obuffer.writeBytes(buf, off, len);
-        }
-
-        public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
-        {
-            this.eventDispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
-        }
-
-        public override function open():void
-        {
-            this.socket = new Socket();
-            this.socket.addEventListener(Event.CONNECT, socketConnected);
-            this.socket.addEventListener(IOErrorEvent.IO_ERROR, socketError);
-            this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, socketSecurityError);
-            this.socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
-            this.socket.connect(host, port);
-        }
-
-        public function socketConnected(event:Event):void
-        {
-            this.output = this.socket;
-            this.input = this.socket;
-            this.output.writeUTF("CONNECT " + resource + " HTTP/1.1\n" + "Host: " + host + ":" + port + "\r\n" + "User-Agent: Thrift/AS3\r\n" + "Transfer-Encoding: chunked\r\n" + "content-type: application/x-thrift\r\n" + "Accept: */*\r\n\r\n");
-            this.eventDispatcher.dispatchEvent(event);
-        }
-
-        public function socketError(event:IOErrorEvent):void
-        {
-            trace("Error Connecting:" + event);
-            this.close();
-            if (ioCallback == null)
-            {
-                return;
-            }
-            ioCallback(new TTransportError(TTransportError.UNKNOWN, "IOError: " + event.text));
-            this.eventDispatcher.dispatchEvent(event);
-        }
-
-        public function socketSecurityError(event:SecurityErrorEvent):void
-        {
-            trace("Security Error Connecting:" + event);
-            this.close();
-            this.eventDispatcher.dispatchEvent(event);
-        }
-
-        public function socketDataHandler(event:ProgressEvent):void
-        {
-        	trace("Got Data call:" +ioCallback);
-            if (ioCallback != null)
-            {
-                ioCallback(null);
-            };
-            this.eventDispatcher.dispatchEvent(event);
-        }
-
-        public override function flush(callback:Function = null):void
-        {
-            trace("set callback:" + callback);
-            this.ioCallback = callback;
-            this.output.writeUTF(this.obuffer.length.toString(16));
-            this.output.writeBytes(CRLF);
-            this.output.writeBytes(this.obuffer);
-            this.output.writeBytes(CRLF);
-            this.socket.flush();
-            // waiting for  new Flex sdk 3.5
-            //this.obuffer.clear();
-            this.obuffer = new ByteArray();
-        }
-
-        public override function isOpen():Boolean
-        {
-            return (this.socket == null ? false : this.socket.connected);
-        }
-
-    }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/transport/THttpClient.as b/lib/as3/src/org/apache/thrift/transport/THttpClient.as
deleted file mode 100644
index 435f911..0000000
--- a/lib/as3/src/org/apache/thrift/transport/THttpClient.as
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.transport {
-
-  import flash.errors.EOFError;
-  import flash.events.Event;
-  import flash.events.IOErrorEvent;
-  import flash.events.SecurityErrorEvent;
-  import flash.net.URLLoader;
-  import flash.net.URLLoaderDataFormat;
-  import flash.net.URLRequest;
-  import flash.net.URLRequestMethod;
-  import flash.system.Capabilities;
-  import flash.utils.ByteArray;
-  
-  /**
-   * HTTP implementation of the TTransport interface. Used for working with a
-   * Thrift web services implementation.
-   */
-  public class THttpClient extends TTransport {
-
-    private var request_:URLRequest = null;
-    private var requestBuffer_:ByteArray = new ByteArray();
-    private var responseBuffer_:ByteArray = null;
-    private var traceBuffers_:Boolean = Capabilities.isDebugger;
-
-    
-    public function getBuffer():ByteArray {
-      return requestBuffer_;
-    }
-    
-    public function THttpClient(request:URLRequest, traceBuffers:Boolean=true):void {
-      request.contentType = "application/x-thrift";
-      request_ = request;
-      if(traceBuffers == false) {
-        traceBuffers_ = traceBuffers;
-      }
-    }
-    
-    public override function open():void {
-    }
-
-    public override function close():void {
-    }
- 
-    public override function isOpen():Boolean {
-      return true;
-    }
-    
-    public override function read(buf:ByteArray, off:int, len:int):int {
-      if (responseBuffer_ == null) {
-        throw new TTransportError(TTransportError.UNKNOWN, "Response buffer is empty, no request.");
-      }
-        try {
-            responseBuffer_.readBytes(buf, off, len);
-            if (traceBuffers_) {
-              dumpBuffer(buf, "READ");
-            }
-            return len;
-          }
-          catch (e:EOFError) {
-            if (traceBuffers_) {
-              dumpBuffer(requestBuffer_, "FAILED-RESPONSE-REQUEST");
-              dumpBuffer(responseBuffer_, "FAILED-RESPONSE");
-            }
-            throw new TTransportError(TTransportError.UNKNOWN, "No more data available.");
-        }
-        return 0;
-    }
-
-    public override function write(buf:ByteArray, off:int, len:int):void {
-      requestBuffer_.writeBytes(buf, off, len);
-    }
-
-    public override function flush(callback:Function=null):void {
-      var loader:URLLoader = new URLLoader();
-      if (callback != null) {
-        loader.addEventListener(Event.COMPLETE, function(event:Event):void {
-         responseBuffer_ = URLLoader(event.target).data;
-         if (traceBuffers_) {
-           dumpBuffer(responseBuffer_, "RESPONSE_BUFFER");
-         }
-         callback(null);
-         responseBuffer_ = null;
-        });
-        loader.addEventListener(IOErrorEvent.IO_ERROR, function(event:IOErrorEvent):void {
-          callback(new TTransportError(TTransportError.UNKNOWN, "IOError: " + event.text));
-          responseBuffer_ = null;
-        });
-        loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(event:SecurityErrorEvent):void {
-          callback(new TTransportError(TTransportError.UNKNOWN, "SecurityError: " + event.text));
-          responseBuffer_ = null;
-        });
-      }
-      request_.method = URLRequestMethod.POST;
-      loader.dataFormat = URLLoaderDataFormat.BINARY;
-      requestBuffer_.position = 0;
-      request_.data = requestBuffer_;
-      loader.load(request_);
-    }
-
-    private function dumpBuffer(buf:ByteArray, prefix:String):String {
-      var debugString : String = prefix + " BUFFER ";
-      if (buf != null) {
-        debugString += "length: " + buf.length + ", ";
-        for (var i : int = 0; i < buf.length; i++) {
-          debugString += "[" + buf[i].toString(16) + "]";
-        }
-      } else {
-        debugString = "null";
-      }
-      trace(debugString);
-      return debugString;
-    }
-
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/transport/TSocket.as b/lib/as3/src/org/apache/thrift/transport/TSocket.as
deleted file mode 100644
index c60d711..0000000
--- a/lib/as3/src/org/apache/thrift/transport/TSocket.as
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *		http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.transport
-{
-
-  import flash.events.EventDispatcher;
-  import flash.events.Event;
-  import flash.events.IOErrorEvent;
-  import flash.events.ProgressEvent;
-  import flash.events.SecurityErrorEvent;
-  import flash.errors.EOFError;
-  import flash.errors.IOError;
-  import flash.net.URLLoader;
-  import flash.net.URLLoaderDataFormat;
-  import flash.net.URLRequest;
-  import flash.net.URLRequestMethod;
-  import flash.utils.IDataInput;
-  import flash.utils.IDataOutput;
-  import flash.utils.ByteArray;
-  import flash.net.Socket;
-
-
-  /**
-   * Socket implementation of the TTransport interface. Used for working with a
-   * Thrift Socket Server based implementations.
-   */
-
-  public class TSocket extends TTransport
-  {
-    private var socket:Socket = null;
-
-    private var host:String;
-
-    private var port:int;
-
-    private var obuffer:ByteArray = new ByteArray();
-
-    private var input:IDataInput;
-
-    private var output:IDataOutput;
-
-    private var ioCallback:Function = null;
-
-    private var eventDispatcher:EventDispatcher = new EventDispatcher();
-
-    public function TSocket(host:String, port:int):void
-    {
-      this.host = host;
-      this.port = port;
-    }
-
-    public override function close():void
-    {
-      this.input = null;
-      this.output = null;
-      socket.close()
-    }
-
-    public override function peek():Boolean
-    {
-      if(socket.connected)
-      {
-        trace("Bytes remained:" + socket.bytesAvailable);
-        return socket.bytesAvailable>0;
-      }
-      return false;
-    }
-
-    public override function read(buf:ByteArray, off:int, len:int):int
-    {
-      var n1:int = 0, n2:int = 0, n3:int = 0, n4:int = 0, cidx:int = 2;
-      var chunkSize:ByteArray = new ByteArray();
-
-      try
-      {
-        input.readBytes(buf, off, len);
-        return len;
-      }
-      catch (e:EOFError)
-      {
-        trace(e);
-        throw new TTransportError(TTransportError.END_OF_FILE, "No more data available.");
-      }
-      catch (e:IOError)
-      {
-        trace(e);
-        if(isOpen())
-        {
-          throw new TTransportError(TTransportError.UNKNOWN, "IO error while reading: " + e);
-        }
-        else
-        {
-          throw new TTransportError(TTransportError.NOT_OPEN, "Socket seem not to be opened: " + e);
-    	}
-      }
-      catch (e:Error)
-      {
-        trace(e);
-        throw new TTransportError(TTransportError.UNKNOWN, "Bad IO error: " + e);
-      }
-      return 0;
-    }
-
-    public override function write(buf:ByteArray, off:int, len:int):void
-    {
-      obuffer.writeBytes(buf, off, len);
-    }
-
-    public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
-    {
-      this.eventDispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
-    }
-    
-    public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
-    {
-      this.eventDispatcher.removeEventListener(type, listener, useCapture);
-    }
-
-    public override function open():void
-    {
-      this.socket = new Socket();
-      this.socket.addEventListener(Event.CONNECT, socketConnected);
-      this.socket.addEventListener(IOErrorEvent.IO_ERROR, socketError);
-      this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, socketSecurityError);
-      this.socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
-      this.socket.connect(host, port);
-    }
-
-    public function socketConnected(event:Event):void
-    {
-      this.output = this.socket;
-      this.input = this.socket;
-      this.eventDispatcher.dispatchEvent(event);
-    }
-
-    public function socketError(event:IOErrorEvent):void
-    {
-      trace("Error Connecting:" + event);
-      this.close();
-      if (ioCallback == null)
-      {
-        return;
-      }
-      ioCallback(new TTransportError(TTransportError.UNKNOWN, "IOError: " + event.text));
-      this.eventDispatcher.dispatchEvent(event);
-    }
-
-    public function socketSecurityError(event:SecurityErrorEvent):void
-    {
-      trace("Security Error Connecting:" + event);
-      this.close();
-      this.eventDispatcher.dispatchEvent(event);
-    }
-
-    public function socketDataHandler(event:ProgressEvent):void
-    {
-      if (ioCallback != null)
-      {
-        ioCallback(null);
-      }
-      this.eventDispatcher.dispatchEvent(event);
-    }
-
-    public override function flush(callback:Function = null):void
-    {
-      this.ioCallback = callback;
-      this.output.writeBytes(this.obuffer);
-      this.socket.flush();
-      this.obuffer.clear();
-    }
-
-    public override function isOpen():Boolean
-    {
-      return (this.socket == null ? false : this.socket.connected);
-    }
-  }
-}
diff --git a/lib/as3/src/org/apache/thrift/transport/TTransport.as b/lib/as3/src/org/apache/thrift/transport/TTransport.as
deleted file mode 100644
index 83160af..0000000
--- a/lib/as3/src/org/apache/thrift/transport/TTransport.as
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.thrift.transport {
-  
-  import flash.utils.ByteArray;
-  import org.apache.thrift.AbstractMethodError;
-  
-  public class TTransport {
-
-    /**
-     * Queries whether the transport is open.
-       *
-     * @return True if the transport is open.
-     */
-    public function isOpen():Boolean {
-      throw new AbstractMethodError();
-    }
-    
-    /**
-     * Is there more data to be read?
-     *
-     * @return True if the remote side is still alive and feeding us
-     */
-    public function peek():Boolean {
-      return isOpen();
-    }
-
-    /**
-     * Opens the transport for reading/writing.
-     *
-     * @throws TTransportException if the transport could not be opened
-     */
-    public function open():void {
-      throw new AbstractMethodError();
-    }
-
-    /**
-     * Closes the transport.
-     */
-    public function close():void {
-      throw new AbstractMethodError();
-    };
-
-    /**
-     * Reads up to len bytes into buffer buf, starting att offset off.
-     *
-     * @param buf Array to read into
-     * @param off Index to start reading at
-     * @param len Maximum number of bytes to read
-     * @return The number of bytes actually read
-     * @throws TTransportException if there was an error reading data
-     */
-     public function read(buf:ByteArray, off:int, len:int):int {
-      throw new AbstractMethodError();
-     }
-
-    /**
-     * Guarantees that all of len bytes are actually read off the transport.
-     *
-     * @param buf Array to read into
-     * @param off Index to start reading at
-     * @param len Maximum number of bytes to read
-     * @return The number of bytes actually read, which must be equal to len
-     * @throws TTransportException if there was an error reading data
-     */
-    public function readAll(buf:ByteArray, off:int, len:int):int {
-      var got:int = 0;
-        var ret:int = 0;
-        while (got < len) {
-            ret = read(buf, off+got, len-got);
-            if (ret <= 0) {
-              throw new TTransportError(TTransportError.UNKNOWN, "Cannot read. Remote side has closed. Tried to read " + len + " bytes, but only got " + got + " bytes.");
-            }
-            got += ret;
-          }
-        return got;
-      }
-
-    /**
-     * Writes the buffer to the output
-     *
-     * @param buf The output data buffer
-     * @throws TTransportException if an error occurs writing data
-     */
-    public function writeAll(buf:ByteArray):void {
-      write(buf, 0, buf.length);
-    }
-
-    /**
-     * Writes up to len bytes from the buffer.
-     *
-     * @param buf The output data buffer
-     * @param off The offset to start writing from
-     * @param len The number of bytes to write
-     * @throws TTransportException if there was an error writing data
-     */
-    public function write(buf:ByteArray, off:int, len:int):void {
-      throw new AbstractMethodError();
-    }
-
-    /**
-     * Flush any pending data out of a transport buffer.
-     *
-     * @throws TTransportException if there was an error writing out data.
-     */
-    public function flush(callback:Function=null):void {
-      throw new AbstractMethodError();
-    }
-  }
-}
\ No newline at end of file
diff --git a/lib/as3/src/org/apache/thrift/transport/TTransportError.as b/lib/as3/src/org/apache/thrift/transport/TTransportError.as
deleted file mode 100644
index 10a6f62..0000000
--- a/lib/as3/src/org/apache/thrift/transport/TTransportError.as
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
- 
-package org.apache.thrift.transport {
-  
-  import org.apache.thrift.TError;
-
-  public class TTransportError extends TError {
-    
-    public static const UNKNOWN:int = 0;
-    public static const NOT_OPEN:int = 1;
-    public static const ALREADY_OPEN:int = 2;
-    public static const TIMED_OUT:int = 3;
-    public static const END_OF_FILE:int = 4;
-  
-    public function TTransportError(error:int = UNKNOWN, message:String = "") {
-      super(message, error);
-    }
-    
-  }
-}
\ No newline at end of file
diff --git a/sonar-project.properties b/sonar-project.properties
index 855726a..f9c9e05 100755
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -37,7 +37,7 @@
 sonar.cxx.cppcheck.reportPath=cppcheck-result.xml
 
 # List of the module identifiers
-sonar.modules=module1,module3,module4,module5,module6,module7,module8,module9,module10,module11,module12,module14
+sonar.modules=module1,module3,module4,module5,module6,module7,module8,module9,module10,module11,module12
 
 
 
@@ -48,7 +48,7 @@
 #sonar.modules=module13
 
 # phpunit plugin is broken
-#sonar.modules=module15
+#sonar.modules=module14
 
 module1.sonar.projectName=Apache Thrift - Java Library
 module1.sonar.projectBaseDir=lib/java
@@ -126,15 +126,10 @@
 module13.sonar.tests=test
 module13.sonar.language=delph
 
-module14.sonar.projectName=Apache Thrift - Flex (as3) Library
-module14.sonar.projectBaseDir=lib/as3
+module14.sonar.projectName=Apache Thrift - PHP Library
+module14.sonar.projectBaseDir=lib/php
 module14.sonar.sources=src
-module14.sonar.language=flex
-
-module15.sonar.projectName=Apache Thrift - PHP Library
-module15.sonar.projectBaseDir=lib/php
-module15.sonar.sources=src
-module15.sonar.language=php
+module14.sonar.language=php
 
 # TODO add some more languages here
 
diff --git a/tutorial/Makefile.am b/tutorial/Makefile.am
index 484b485..12b3eb5 100755
--- a/tutorial/Makefile.am
+++ b/tutorial/Makefile.am
@@ -104,7 +104,6 @@
 # Any folders or files not listed above being added to SUBDIR need to be placed here in
 # EXTRA_DIST to be included in the release
 EXTRA_DIST = \
-	as3 \
 	d \
 	delphi \
 	erl \
diff --git a/tutorial/as3/build.xml b/tutorial/as3/build.xml
deleted file mode 100644
index f7ed32d..0000000
--- a/tutorial/as3/build.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<project name="tutorial" default="dist" basedir=".">
-
-  <description>Thrift actionscript 3.0 tutorial.</description>
-
-  <property name="gen" location="gen-as3" />
-  <property name="src" location="src" />
-  <property name="thrift.src" location="../../lib/as3/src/" />
-  <property name="dist" location="dist" />
-
-  <property name="final.name" value="as3-tutorial" />
-  <property name="swf.name" value="${dist}/${final.name}.swf" />
-
-  <target name="flex.check" unless="FLEX_HOME">
-    <fail message='You must set the FLEX_HOME property pointing to your flex SDK, eg. ant -DFLEX_HOME="/Applications/Adobe Flex Builder 3/sdks/3.2.0"'/>
-  </target>
-
-  <target name="flex.init" depends="flex.check" unless="flex.finished">
-    <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
-    <property name="flex.finished" value="true"/>
-  </target>
-
-  <target name="init">
-    <tstamp />
-    <mkdir dir="${dist}"/>
-  </target>
-
-  <target name="dist" depends="generate, flex.init, init">
-    <mxmlc output="${swf.name}" file="${src}/CalculatorUI.as">
-      <source-path path-element="${gen}" />
-      <source-path path-element="${src}" />
-      <source-path path-element="${thrift.src}" />
-    </mxmlc>
-  </target>
-
-  <target name="generate">
-    <!-- Generate the thrift gen-java source -->
-    <exec executable="../../compiler/cpp/thrift" failonerror="true">
-      <arg line="--gen as3 ../shared.thrift"/>
-    </exec>
-    <exec executable="../../compiler/cpp/thrift" failonerror="true">
-      <arg line="--gen as3 ../tutorial.thrift"/>
-    </exec>
-  </target>
-
-  <target name="clean">
-    <delete dir="${gen}"/>
-    <delete dir="${dist}" />
-  </target>
-
-</project>
diff --git a/tutorial/as3/src/CalculatorUI.as b/tutorial/as3/src/CalculatorUI.as
deleted file mode 100644
index d996df5..0000000
--- a/tutorial/as3/src/CalculatorUI.as
+++ /dev/null
@@ -1,142 +0,0 @@
-package {
-  import flash.display.Sprite;
-  import flash.text.TextField;
-  import flash.text.TextFieldType;
-  import flash.events.MouseEvent;
-  import flash.system.Security;
-
-  import org.apache.thrift.transport.TSocket;
-  import org.apache.thrift.transport.TTransport;
-  import org.apache.thrift.protocol.TProtocol;
-  import org.apache.thrift.protocol.TBinaryProtocol;
-
-  /**
-   * Simple interface and connection logic implementation for tutorial.
-   */
-  public class CalculatorUI extends Sprite {
-    public static const BUTTON_PADDING:uint = 5;
-
-    private var mCalculatorClient:Calculator; // we use calculator through interface
-    private var mTransport:TTransport; // Transport, used to comunicate with server
-
-    private var mAddButton:Sprite;
-    private var mLeft:TextField;
-    private var mRight:TextField;
-    private var mResult:TextField;
-
-    private var pingButton:Sprite;
-
-    public function CalculatorUI() {
-      buildInterface();
-      initSecurity();
-      initConnection();
-    }
-
-    private function initSecurity():void {
-      Security.loadPolicyFile("xmlsocket://127.0.0.1:9092");
-    }
-
-    /**
-     * Example of initializing connection.
-     */
-    private function initConnection():void {
-      mTransport = new TSocket("127.0.0.1", 9090); // we connect to server
-      mTransport.open();
-      // initialize protocol:
-      var protocol:TProtocol = new TBinaryProtocol(mTransport, false, false);
-      mCalculatorClient = new CalculatorImpl(protocol); // finally, we create calculator client instance
-    }
-
-    private function onPingClick(me:MouseEvent):void {
-      if(!mTransport.isOpen()) return;
-      mCalculatorClient.ping(onPingError, onPingSuccess);
-    }
-
-    private function onPingError(error:Error):void {
-      trace("Error, while requesting ping.");
-      throw error;
-    }
-
-    private function onPingSuccess():void {
-      trace("Ping returned successfully");
-    }
-
-    private function onAddClick(me:MouseEvent):void {
-      if(!mTransport.isOpen()) return;
-      var num1:Number = Number(mLeft.text);
-      var num2:Number = Number(mRight.text);
-      mResult.text = "Processing...";
-      mCalculatorClient.add(num1, num2, onAddError, onAddSuccess);
-    }
-
-    private function onAddError(error:Error):void {
-      trace("Error, while requesting add.");
-      throw error;
-    }
-
-    private function onAddSuccess(res:Number):void {
-      mResult.text = String(res);
-    }
-
-    private function buildInterface():void {
-      addChild(pingButton = buildButton("PING"));
-      pingButton.x = (stage.stageWidth - pingButton.width) / 2;
-      pingButton.y = 10;
-      pingButton.addEventListener(MouseEvent.CLICK, onPingClick);
-
-      var top:Number = pingButton.y + pingButton.height + 20;
-      addChild(mLeft = buildDigitInput());
-      mLeft.x = 15;
-      mLeft.y = top + BUTTON_PADDING;
-      addChild(mRight = buildDigitInput());
-      mRight.x = mLeft.x + mLeft.width + 15;
-      mRight.y = top + BUTTON_PADDING;
-      addChild(mAddButton = buildButton("ADD"));
-      mAddButton.x = mRight.x + mRight.width + 15;
-      mAddButton.y = top;
-      mAddButton.addEventListener(MouseEvent.CLICK, onAddClick);
-      addChild(mResult = buildDigitInput());
-      mResult.x = mAddButton.x + mAddButton.width + 15;
-      mResult.y = top + BUTTON_PADDING;
-    }
-
-    /**
-     * Simple digit-only input field.
-     */
-    private function buildDigitInput():TextField {
-      var textField:TextField = new TextField;
-      textField.width = 75;
-      textField.height = 20;
-      textField.restrict = "0987654321.";
-      textField.type = TextFieldType.INPUT;
-      textField.background = true;
-      textField.backgroundColor = 0xaaaaff;
-      textField.textColor = 0xffff00;
-      return textField;
-    }
-
-    /**
-     * Simple button drawing.
-     */
-    private function buildButton(text:String):Sprite {
-      var button:Sprite = new Sprite;
-      var textField:TextField = new TextField;
-      textField.width = 4000;
-      textField.text = text;
-      textField.textColor = 0xffff00;
-      textField.width = textField.textWidth + 4;
-      textField.height = textField.textHeight + 4;
-      textField.mouseEnabled = false;
-      button.graphics.beginFill(0x0000ff);
-      button.graphics.lineStyle(0, 0x000000);
-      button.graphics.drawRoundRect(0, 0, textField.width + BUTTON_PADDING * 2,
-                                    textField.height + BUTTON_PADDING * 2, BUTTON_PADDING);
-      button.graphics.endFill();
-      button.addChild(textField);
-      textField.x = BUTTON_PADDING;
-      textField.y = BUTTON_PADDING;
-      button.useHandCursor = button.buttonMode = true;
-      return button;
-    }
-  }
-}
