From 62324ad6173d44c135ad23c273040fda1030e5b7 Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:46:44 -0100 Subject: [PATCH 1/9] Add support for all OpenFL-JS Languages --- scripts/Tools.hx | 26 ++++++++---- src/swf/exporters/AnimateLibraryExporter.hx | 14 +++---- templates/animate/BitmapData.mtt | 16 -------- templates/animate/MovieClip.mtt | 18 --------- templates/animate/SimpleButton.mtt | 15 ------- templates/as3/BitmapData.mtt | 10 +++++ templates/as3/MovieClip.mtt | 14 +++++++ templates/as3/SimpleButton.mtt | 9 +++++ templates/es5/BitmapData.mtt | 14 +++++++ templates/es5/MovieClip.mtt | 14 +++++++ templates/es5/SimpleButton.mtt | 14 +++++++ templates/es6/BitmapData.mtt | 15 +++++++ templates/es6/MovieClip.mtt | 16 ++++++++ templates/es6/SimpleButton.mtt | 12 ++++++ templates/haxe/BitmapData.mtt | 12 ++++++ templates/haxe/MovieClip.mtt | 15 +++++++ templates/haxe/SimpleButton.mtt | 13 ++++++ templates/swf/BitmapData.mtt | 39 ------------------ templates/swf/MovieClip.mtt | 45 --------------------- templates/swf/SimpleButton.mtt | 39 ------------------ templates/ts/BitmapData.mtt | 14 +++++++ templates/ts/MovieClip.mtt | 15 +++++++ templates/ts/SimpleButton.mtt | 11 +++++ 23 files changed, 223 insertions(+), 187 deletions(-) delete mode 100644 templates/animate/BitmapData.mtt delete mode 100644 templates/animate/MovieClip.mtt delete mode 100644 templates/animate/SimpleButton.mtt create mode 100644 templates/as3/BitmapData.mtt create mode 100644 templates/as3/MovieClip.mtt create mode 100644 templates/as3/SimpleButton.mtt create mode 100644 templates/es5/BitmapData.mtt create mode 100644 templates/es5/MovieClip.mtt create mode 100644 templates/es5/SimpleButton.mtt create mode 100644 templates/es6/BitmapData.mtt create mode 100644 templates/es6/MovieClip.mtt create mode 100644 templates/es6/SimpleButton.mtt create mode 100644 templates/haxe/BitmapData.mtt create mode 100644 templates/haxe/MovieClip.mtt create mode 100644 templates/haxe/SimpleButton.mtt delete mode 100644 templates/swf/BitmapData.mtt delete mode 100644 templates/swf/MovieClip.mtt delete mode 100644 templates/swf/SimpleButton.mtt create mode 100644 templates/ts/BitmapData.mtt create mode 100644 templates/ts/MovieClip.mtt create mode 100644 templates/ts/SimpleButton.mtt diff --git a/scripts/Tools.hx b/scripts/Tools.hx index 9a3d0fb..2c28838 100644 --- a/scripts/Tools.hx +++ b/scripts/Tools.hx @@ -137,9 +137,9 @@ class Tools private static function generateSWFClasses(project:HXProject, output:HXProject, swfAsset:Asset, prefix:String = ""):Array { - var bitmapDataTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/swf/BitmapData.mtt"); - var movieClipTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/swf/MovieClip.mtt"); - var simpleButtonTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/swf/SimpleButton.mtt"); + var bitmapDataTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/haxe/BitmapData.mtt"); + var movieClipTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/haxe/MovieClip.mtt"); + var simpleButtonTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/haxe/SimpleButton.mtt"); var bytes = ByteArray.fromBytes(File.getBytes(swfAsset.sourcePath)); bytes = readSWC(bytes); @@ -638,7 +638,12 @@ class Tools Log.info("\x1b[1mProcessing file:\x1b[0m " + fileLabel, " - \x1b[1mProcessing file:\x1b[0m " + file + " \x1b[3;37m->\x1b[0m " + output); - processFile(file, output, filePrefix, generate); + var language = "haxe"; + if(words[words.length-1] == "haxe" || words[words.length-1] == "ts" || words[words.length-1] == "as3" || words[words.length-1] == "es5" || words[words.length-1] == "es6") + { + language = words[words.length-1]; + } + processFile(file, output, filePrefix, generate, language); } } else @@ -655,7 +660,12 @@ class Tools outputPath = Path.combine(outputPath, Path.withoutExtension(Path.withoutDirectory(inputPath)) + ".zip"); } - processFile(inputPath, outputPath, filePrefix, generate); + var language = "haxe"; + if(words[words.length-1] == "haxe" || words[words.length-1] == "ts" || words[words.length-1] == "as3" || words[words.length-1] == "es5" || words[words.length-1] == "es6") + { + language = words[words.length-1]; + } + processFile(inputPath, outputPath, filePrefix, generate, language); } } else if (words.length > 2) @@ -749,7 +759,7 @@ class Tools } } - private static function processFile(sourcePath:String, targetPath:String, prefix:String = null, generate:Bool = false):Bool + private static function processFile(sourcePath:String, targetPath:String, prefix:String = null, generate:Bool = false, language:String = "haxe"):Bool { if (targetPath == null) { @@ -768,7 +778,7 @@ class Tools var generatePath = Path.tryFullPath(Path.directory(targetPath)); var output = []; - var generatedClasses = exporter.generateClasses("", output, prefix); + var generatedClasses = exporter.generateClasses("", output, language, prefix); for (asset in output) { @@ -1066,7 +1076,7 @@ class Tools targetPath = Path.tryFullPath(targetDirectory) + "/haxe/_generated"; } - var generatedClasses = exporter.generateClasses(targetPath, output.assets, library.prefix); + var generatedClasses = exporter.generateClasses("haxe", targetPath, output.assets, library.prefix); // for (className in generatedClasses) // { diff --git a/src/swf/exporters/AnimateLibraryExporter.hx b/src/swf/exporters/AnimateLibraryExporter.hx index f36ebe7..3c5131c 100644 --- a/src/swf/exporters/AnimateLibraryExporter.hx +++ b/src/swf/exporters/AnimateLibraryExporter.hx @@ -1126,16 +1126,16 @@ class AnimateLibraryExporter return; } - public function generateClasses(targetPath:String, output:Array, prefix:String = ""):Array + public function generateClasses(targetPath:String, output:Array, language:String = "haxe", prefix:String = ""):Array { #if commonjs - var bitmapDataTemplate = File.getContent(Path.combine(js.Node.__dirname, "../templates/animate/BitmapData.mtt")); - var movieClipTemplate = File.getContent(Path.combine(js.Node.__dirname, "../templates/animate/MovieClip.mtt")); - var simpleButtonTemplate = File.getContent(Path.combine(js.Node.__dirname, "../templates/animate/SimpleButton.mtt")); + var bitmapDataTemplate = File.getContent(Path.combine(js.Node.__dirname, "../templates/" + language + "/BitmapData.mtt")); + var movieClipTemplate = File.getContent(Path.combine(js.Node.__dirname, "../templates/" + language + "/MovieClip.mtt")); + var simpleButtonTemplate = File.getContent(Path.combine(js.Node.__dirname, "../templates/" + language + "/SimpleButton.mtt")); #else - var bitmapDataTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/animate/BitmapData.mtt"); - var movieClipTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/animate/MovieClip.mtt"); - var simpleButtonTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/animate/SimpleButton.mtt"); + var bitmapDataTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/" + language + "/BitmapData.mtt"); + var movieClipTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/" + language + "/MovieClip.mtt"); + var simpleButtonTemplate = File.getContent(Haxelib.getPath(new Haxelib("swf"), true) + "/templates/" + language + "/SimpleButton.mtt"); #end var generatedClasses = []; diff --git a/templates/animate/BitmapData.mtt b/templates/animate/BitmapData.mtt deleted file mode 100644 index fbe3416..0000000 --- a/templates/animate/BitmapData.mtt +++ /dev/null @@ -1,16 +0,0 @@ -package ::PACKAGE_NAME::; - -@:access(swf.exporters.animate.AnimateLibrary) - -class ::CLASS_NAME:: extends openfl.display.BitmapData -{ - public function new(width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) - { - super(0, 0, true, 0); - - var library = swf.exporters.animate.AnimateLibrary.get("::UUID::"); - var symbol:swf.exporters.animate.AnimateBitmapSymbol = cast library.symbols.get(::SYMBOL_ID::); - var image = library.getImage(symbol.path); - __fromImage(image); - } -} \ No newline at end of file diff --git a/templates/animate/MovieClip.mtt b/templates/animate/MovieClip.mtt deleted file mode 100644 index 5aeb90c..0000000 --- a/templates/animate/MovieClip.mtt +++ /dev/null @@ -1,18 +0,0 @@ -package ::PACKAGE_NAME::; - -@:access(swf.exporters.animate) - -class ::CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::#if flash flash.display.MovieClip.MovieClip2 #else openfl.display.MovieClip #end::end:: -{ - ::foreach CLASS_PROPERTIES::@:keep ::if hidden::@:noCompletion @:dox(hide) ::end::public var ::name::(default, null):::type::; - ::end:: - - public function new() - { - var library = swf.exporters.animate.AnimateLibrary.get("::UUID::"); - var symbol = library.symbols.get(::SYMBOL_ID::); - symbol.__init(library); - - super(); - } -} \ No newline at end of file diff --git a/templates/animate/SimpleButton.mtt b/templates/animate/SimpleButton.mtt deleted file mode 100644 index 95fec87..0000000 --- a/templates/animate/SimpleButton.mtt +++ /dev/null @@ -1,15 +0,0 @@ -package ::PACKAGE_NAME::; - -@:access(swf.exporters.animate) - -class ::CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::#if flash flash.display.SimpleButton.SimpleButton2 #else openfl.display.SimpleButton #end::end:: -{ - public function new() - { - var library = swf.exporters.animate.AnimateLibrary.get("::UUID::"); - var symbol = library.symbols.get(::SYMBOL_ID::); - symbol.__init(library); - - super(); - } -} \ No newline at end of file diff --git a/templates/as3/BitmapData.mtt b/templates/as3/BitmapData.mtt new file mode 100644 index 0000000..08a506d --- /dev/null +++ b/templates/as3/BitmapData.mtt @@ -0,0 +1,10 @@ +package ::PACKAGE_NAME:: { + + public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + public function new (width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) { + super (width, height, transparent, background); + } + + } +} \ No newline at end of file diff --git a/templates/as3/MovieClip.mtt b/templates/as3/MovieClip.mtt new file mode 100644 index 0000000..3c24bf7 --- /dev/null +++ b/templates/as3/MovieClip.mtt @@ -0,0 +1,14 @@ +package ::PACKAGE_NAME:: { + import openfl.utils.Assets; + + public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + ::foreach CLASS_PROPERTIES:: public var ::name:: : ::type::; + ::end:: + + public function new () { + super (); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); + } + } +} \ No newline at end of file diff --git a/templates/as3/SimpleButton.mtt b/templates/as3/SimpleButton.mtt new file mode 100644 index 0000000..6ac465f --- /dev/null +++ b/templates/as3/SimpleButton.mtt @@ -0,0 +1,9 @@ +package ::PACKAGE_NAME:: { + public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + public function new () { + super (); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); + } + } +} diff --git a/templates/es5/BitmapData.mtt b/templates/es5/BitmapData.mtt new file mode 100644 index 0000000..e946757 --- /dev/null +++ b/templates/es5/BitmapData.mtt @@ -0,0 +1,14 @@ +"use strict" + +var Assets = require ("openfl/utils/Assets").default; + +var ::NATIVE_CLASS_NAME:: = (function(width, height, transparent, background) { + ::BASE_CLASS_NAME::.call (this, width, height, transparent, background); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); +}) + +::NATIVE_CLASS_NAME::.prototype = Object.create(::BASE_CLASS_NAME::.prototype); +::NATIVE_CLASS_NAME::.prototype.constructor = ::NATIVE_CLASS_NAME::; + +module.exports.::NATIVE_CLASS_NAME:: = ::NATIVE_CLASS_NAME::; +module.exports.default = ::NATIVE_CLASS_NAME::; diff --git a/templates/es5/MovieClip.mtt b/templates/es5/MovieClip.mtt new file mode 100644 index 0000000..cb26616 --- /dev/null +++ b/templates/es5/MovieClip.mtt @@ -0,0 +1,14 @@ +"use strict" + +var Assets = require ("openfl/utils/Assets").default; + +var ::NATIVE_CLASS_NAME:: = (function() { + ::BASE_CLASS_NAME::.call (this); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); +}) + +::NATIVE_CLASS_NAME::.prototype = Object.create(::BASE_CLASS_NAME::.prototype); +::NATIVE_CLASS_NAME::.prototype.constructor = ::NATIVE_CLASS_NAME::; + +module.exports.::NATIVE_CLASS_NAME:: = ::NATIVE_CLASS_NAME::; +module.exports.default = ::NATIVE_CLASS_NAME::; diff --git a/templates/es5/SimpleButton.mtt b/templates/es5/SimpleButton.mtt new file mode 100644 index 0000000..fb94785 --- /dev/null +++ b/templates/es5/SimpleButton.mtt @@ -0,0 +1,14 @@ +"use strict" + +var Assets = require ("openfl/utils/Assets").default; + +var ::NATIVE_CLASS_NAME:: = function() { + ::BASE_CLASS_NAME::.call (this); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); +} + +::NATIVE_CLASS_NAME::.prototype = Object.create(::BASE_CLASS_NAME::.prototype); +::NATIVE_CLASS_NAME::.prototype.constructor = ::NATIVE_CLASS_NAME::; + +module.exports.::NATIVE_CLASS_NAME:: = ::NATIVE_CLASS_NAME::; +module.exports.default = ::NATIVE_CLASS_NAME::; diff --git a/templates/es6/BitmapData.mtt b/templates/es6/BitmapData.mtt new file mode 100644 index 0000000..23fb989 --- /dev/null +++ b/templates/es6/BitmapData.mtt @@ -0,0 +1,15 @@ +"use strict"; +import Assets from "openfl/utils/Assets"; + +public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + ::foreach CLASS_PROPERTIES:: ::name::; + ::end:: + + constructor (width, height, transparent, background) { + super (width, height, transparent, background); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); + } + +} +export default ::NATIVE_CLASS_NAME::; diff --git a/templates/es6/MovieClip.mtt b/templates/es6/MovieClip.mtt new file mode 100644 index 0000000..13af2fd --- /dev/null +++ b/templates/es6/MovieClip.mtt @@ -0,0 +1,16 @@ +"use strict"; +import Assets from "openfl/utils/Assets"; + +public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + ::foreach CLASS_PROPERTIES:: ::name::; + ::end:: + + constructor () { + super (); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); + } + +} +export default ::NATIVE_CLASS_NAME::; + diff --git a/templates/es6/SimpleButton.mtt b/templates/es6/SimpleButton.mtt new file mode 100644 index 0000000..ec9bd2f --- /dev/null +++ b/templates/es6/SimpleButton.mtt @@ -0,0 +1,12 @@ +"use strict"; +import Assets from "openfl/utils/Assets"; + +public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + constructor () { + super (); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); + } + +} +export default ::NATIVE_CLASS_NAME::; diff --git a/templates/haxe/BitmapData.mtt b/templates/haxe/BitmapData.mtt new file mode 100644 index 0000000..06aedf8 --- /dev/null +++ b/templates/haxe/BitmapData.mtt @@ -0,0 +1,12 @@ +package ::PACKAGE_NAME::; +@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + + public function new (width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) { + + super (width, height, transparent, background); + + } + + +} \ No newline at end of file diff --git a/templates/haxe/MovieClip.mtt b/templates/haxe/MovieClip.mtt new file mode 100644 index 0000000..a830c36 --- /dev/null +++ b/templates/haxe/MovieClip.mtt @@ -0,0 +1,15 @@ +package ::PACKAGE_NAME::; +@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + + ::foreach CLASS_PROPERTIES::@:keep ::if hidden::@:noCompletion @:dox(hide) ::end::public var ::name:: (default, null):::type::; + ::end:: + + public function new () { + + super (); + + } + + +} \ No newline at end of file diff --git a/templates/haxe/SimpleButton.mtt b/templates/haxe/SimpleButton.mtt new file mode 100644 index 0000000..02cb109 --- /dev/null +++ b/templates/haxe/SimpleButton.mtt @@ -0,0 +1,13 @@ +package ::PACKAGE_NAME::; +@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + + public function new () { + + super (); + + } + + +} +#end \ No newline at end of file diff --git a/templates/swf/BitmapData.mtt b/templates/swf/BitmapData.mtt deleted file mode 100644 index 9a381d9..0000000 --- a/templates/swf/BitmapData.mtt +++ /dev/null @@ -1,39 +0,0 @@ -package ::PACKAGE_NAME::; #if !flash - - -import swf.exporters.swflite.SWFLite; -import openfl.display.BitmapData; -import openfl.utils.Assets; - - -class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { - - - public function new (width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) { - - super (0, 0, true, 0); - - var swfLite = SWFLite.instances.get ("::SWF_ID::"); - var symbol = swfLite.symbols.get (::SYMBOL_ID::); - - __fromSymbol (swfLite, cast symbol); - - } - - -} - - -#else -@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { - - - public function new (width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) { - - super (width, height, transparent, background); - - } - - -} -#end \ No newline at end of file diff --git a/templates/swf/MovieClip.mtt b/templates/swf/MovieClip.mtt deleted file mode 100644 index 6cc9757..0000000 --- a/templates/swf/MovieClip.mtt +++ /dev/null @@ -1,45 +0,0 @@ -package ::PACKAGE_NAME::; #if !flash - - -import swf.exporters.swflite.SWFLite; -import openfl.display.MovieClip; -import openfl.utils.Assets; - -@:access(swf.exporters.swflite) - -class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { - - - ::foreach CLASS_PROPERTIES::@:keep ::if hidden::@:noCompletion @:dox(hide) ::end::public var ::name:: (default, null):::type::; - ::end:: - - public function new () { - - var swfLite = SWFLite.instances.get ("::SWF_ID::"); - var symbol = swfLite.symbols.get (::SYMBOL_ID::); - symbol.__init(swfLite); - - super(); - - } - - -} - - -#else -@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { - - - ::foreach CLASS_PROPERTIES::@:keep ::if hidden::@:noCompletion @:dox(hide) ::end::public var ::name:: (default, null):::type::; - ::end:: - - public function new () { - - super (); - - } - - -} -#end \ No newline at end of file diff --git a/templates/swf/SimpleButton.mtt b/templates/swf/SimpleButton.mtt deleted file mode 100644 index 726e134..0000000 --- a/templates/swf/SimpleButton.mtt +++ /dev/null @@ -1,39 +0,0 @@ -package ::PACKAGE_NAME::; #if !flash - - -import swf.exporters.swflite.SWFLite; -import openfl.display.SimpleButton; -import openfl.utils.Assets; - -@:access(swf.exporters.swflite) - -class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { - - - public function new () { - - var swfLite = SWFLite.instances.get ("::SWF_ID::"); - var symbol = swfLite.symbols.get (::SYMBOL_ID::); - symbol.__init(swfLite); - - super (); - - } - - -} - - -#else -@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { - - - public function new () { - - super (); - - } - - -} -#end \ No newline at end of file diff --git a/templates/ts/BitmapData.mtt b/templates/ts/BitmapData.mtt new file mode 100644 index 0000000..ed80b84 --- /dev/null +++ b/templates/ts/BitmapData.mtt @@ -0,0 +1,14 @@ +import Assets from "openfl/utils/Assets"; + +public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + ::foreach CLASS_PROPERTIES:: ::name::; + ::end:: + + constructor (width:number = 0, height:number = 0, transparent:bool = false, background:number = 0) { + super (width, height, transparent, background); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); + } + +} +export default ::NATIVE_CLASS_NAME::; diff --git a/templates/ts/MovieClip.mtt b/templates/ts/MovieClip.mtt new file mode 100644 index 0000000..2d481cb --- /dev/null +++ b/templates/ts/MovieClip.mtt @@ -0,0 +1,15 @@ +import Assets from "openfl/utils/Assets"; + +public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + ::foreach CLASS_PROPERTIES:: ::name:: : ::type::; + ::end:: + + constructor () { + super (); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); + } + +} +export default ::NATIVE_CLASS_NAME::; + diff --git a/templates/ts/SimpleButton.mtt b/templates/ts/SimpleButton.mtt new file mode 100644 index 0000000..bd74d96 --- /dev/null +++ b/templates/ts/SimpleButton.mtt @@ -0,0 +1,11 @@ +import Assets from "openfl/utils/Assets"; + +public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + + constructor () { + super (); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); + } + +} +export default ::NATIVE_CLASS_NAME::; From a890baf4f34d4dde8e327efd99f4d2dff5c046cf Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 25 Feb 2026 15:16:00 -0100 Subject: [PATCH 2/9] Fix typo --- scripts/Tools.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Tools.hx b/scripts/Tools.hx index 2c28838..7e7b235 100644 --- a/scripts/Tools.hx +++ b/scripts/Tools.hx @@ -1076,7 +1076,7 @@ class Tools targetPath = Path.tryFullPath(targetDirectory) + "/haxe/_generated"; } - var generatedClasses = exporter.generateClasses("haxe", targetPath, output.assets, library.prefix); + var generatedClasses = exporter.generateClasses(targetPath, output.assets, "haxe", library.prefix); // for (className in generatedClasses) // { From 18baeb801b452d1d1d7bd7345d74230789d4a531 Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:38:23 -0100 Subject: [PATCH 3/9] Fix templates, how language is passed and extension of saved files --- scripts/Tools.hx | 9 +++------ src/swf/exporters/AnimateLibraryExporter.hx | 6 +++++- templates/as3/BitmapData.mtt | 6 ++++-- templates/as3/MovieClip.mtt | 5 +++-- templates/as3/SimpleButton.mtt | 7 +++++-- templates/es5/BitmapData.mtt | 12 ++++++++---- templates/es5/MovieClip.mtt | 8 ++++---- templates/es5/SimpleButton.mtt | 8 ++++---- templates/es6/BitmapData.mtt | 8 +++----- templates/es6/MovieClip.mtt | 3 ++- templates/es6/SimpleButton.mtt | 3 ++- templates/haxe/BitmapData.mtt | 3 +-- templates/haxe/MovieClip.mtt | 5 +++-- templates/haxe/SimpleButton.mtt | 6 +++--- templates/ts/BitmapData.mtt | 3 ++- templates/ts/MovieClip.mtt | 3 ++- templates/ts/SimpleButton.mtt | 3 ++- 17 files changed, 56 insertions(+), 42 deletions(-) diff --git a/scripts/Tools.hx b/scripts/Tools.hx index 7e7b235..7307103 100644 --- a/scripts/Tools.hx +++ b/scripts/Tools.hx @@ -594,10 +594,11 @@ class Tools var inputPath = words.length > 1 ? words[1] : Sys.getCwd(); var outputPath = words.length > 2 ? words[2] : null; + var language = words.length > 3 ? words[3] : "haxe"; - if (words.length < 2 || Path.extension(inputPath) == "swf" || Path.extension(inputPath) == "swc") + if (words.length < 3 || Path.extension(inputPath) == "swf" || Path.extension(inputPath) == "swc") { - if (words.length > 3) + if (words.length > 4) { Log.error("Incorrect number of arguments for command 'process'"); return; @@ -639,10 +640,6 @@ class Tools Log.info("\x1b[1mProcessing file:\x1b[0m " + fileLabel, " - \x1b[1mProcessing file:\x1b[0m " + file + " \x1b[3;37m->\x1b[0m " + output); var language = "haxe"; - if(words[words.length-1] == "haxe" || words[words.length-1] == "ts" || words[words.length-1] == "as3" || words[words.length-1] == "es5" || words[words.length-1] == "es6") - { - language = words[words.length-1]; - } processFile(file, output, filePrefix, generate, language); } } diff --git a/src/swf/exporters/AnimateLibraryExporter.hx b/src/swf/exporters/AnimateLibraryExporter.hx index 3c5131c..57b6633 100644 --- a/src/swf/exporters/AnimateLibraryExporter.hx +++ b/src/swf/exporters/AnimateLibraryExporter.hx @@ -1291,9 +1291,13 @@ class AnimateLibraryExporter context.BASE_CLASS_NAME = baseClassName; } + var languageExtension:String = ".hx"; + if(language == "es5" || language == "es6") languageExtension = ".js"; + if(language == "as3") languageExtension = ".as"; + var template = new Template(templateData); - var templateFile = new Asset("", Path.combine(Path.combine(targetPath, Path.directory(className.split(".").join("/"))), name + ".hx"), + var templateFile = new Asset("", Path.combine(Path.combine(targetPath, Path.directory(className.split(".").join("/"))), name + languageExtension), cast AssetType.TEMPLATE); templateFile.embed = false; templateFile.data = template.execute(context); diff --git a/templates/as3/BitmapData.mtt b/templates/as3/BitmapData.mtt index 08a506d..7531dcc 100644 --- a/templates/as3/BitmapData.mtt +++ b/templates/as3/BitmapData.mtt @@ -1,8 +1,10 @@ package ::PACKAGE_NAME:: { + import openfl.utils.Assets; + import openfl.display.BitmapData; - public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + public class ::NATIVE_CLASS_NAME:: extends BitmapData { - public function new (width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) { + public function ::NATIVE_CLASS_NAME:: (width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) { super (width, height, transparent, background); } diff --git a/templates/as3/MovieClip.mtt b/templates/as3/MovieClip.mtt index 3c24bf7..f9e5735 100644 --- a/templates/as3/MovieClip.mtt +++ b/templates/as3/MovieClip.mtt @@ -1,12 +1,13 @@ package ::PACKAGE_NAME:: { import openfl.utils.Assets; + :if BASE_CLASS_NAME::::else::import openfl.display.MovieClip;::end:: - public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + public class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { ::foreach CLASS_PROPERTIES:: public var ::name:: : ::type::; ::end:: - public function new () { + public function ::NATIVE_CLASS_NAME:: () { super (); Assets.initBinding(::NATIVE_CLASS_NAME::, this); } diff --git a/templates/as3/SimpleButton.mtt b/templates/as3/SimpleButton.mtt index 6ac465f..062bf8e 100644 --- a/templates/as3/SimpleButton.mtt +++ b/templates/as3/SimpleButton.mtt @@ -1,7 +1,10 @@ package ::PACKAGE_NAME:: { - public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { + import openfl.utils.Assets; + :if BASE_CLASS_NAME::::else::import openfl.display.SimpleButton;::end:: - public function new () { + public class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton::end:: { + + public function ::NATIVE_CLASS_NAME:: () { super (); Assets.initBinding(::NATIVE_CLASS_NAME::, this); } diff --git a/templates/es5/BitmapData.mtt b/templates/es5/BitmapData.mtt index e946757..ac1e0c7 100644 --- a/templates/es5/BitmapData.mtt +++ b/templates/es5/BitmapData.mtt @@ -1,13 +1,17 @@ "use strict" - var Assets = require ("openfl/utils/Assets").default; +var BitmapData = require ("openfl/display/BitmapData").default; var ::NATIVE_CLASS_NAME:: = (function(width, height, transparent, background) { - ::BASE_CLASS_NAME::.call (this, width, height, transparent, background); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + width = width || 0; + height = height || 0; + transparent = transparent || false; + background = background || 0; + BitmapData.call (this, width, height, transparent, background); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); }) -::NATIVE_CLASS_NAME::.prototype = Object.create(::BASE_CLASS_NAME::.prototype); +::NATIVE_CLASS_NAME::.prototype = Object.create(BitmapData.prototype); ::NATIVE_CLASS_NAME::.prototype.constructor = ::NATIVE_CLASS_NAME::; module.exports.::NATIVE_CLASS_NAME:: = ::NATIVE_CLASS_NAME::; diff --git a/templates/es5/MovieClip.mtt b/templates/es5/MovieClip.mtt index cb26616..5e6bd03 100644 --- a/templates/es5/MovieClip.mtt +++ b/templates/es5/MovieClip.mtt @@ -1,13 +1,13 @@ "use strict" - var Assets = require ("openfl/utils/Assets").default; +::if BASE_CLASS_NAME::::else::var MovieClip = require ("openfl/display/MovieClip").default;::end:: var ::NATIVE_CLASS_NAME:: = (function() { - ::BASE_CLASS_NAME::.call (this); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end::.call (this); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); }) -::NATIVE_CLASS_NAME::.prototype = Object.create(::BASE_CLASS_NAME::.prototype); +::NATIVE_CLASS_NAME::.prototype = Object.create(::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end::.prototype); ::NATIVE_CLASS_NAME::.prototype.constructor = ::NATIVE_CLASS_NAME::; module.exports.::NATIVE_CLASS_NAME:: = ::NATIVE_CLASS_NAME::; diff --git a/templates/es5/SimpleButton.mtt b/templates/es5/SimpleButton.mtt index fb94785..a4503c8 100644 --- a/templates/es5/SimpleButton.mtt +++ b/templates/es5/SimpleButton.mtt @@ -1,13 +1,13 @@ "use strict" - var Assets = require ("openfl/utils/Assets").default; +::if BASE_CLASS_NAME::::else::var SimpleButton = require ("openfl/display/SimpleButton").default;::end:: var ::NATIVE_CLASS_NAME:: = function() { - ::BASE_CLASS_NAME::.call (this); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton::end::.call (this); + Assets.initBinding(::NATIVE_CLASS_NAME::, this); } -::NATIVE_CLASS_NAME::.prototype = Object.create(::BASE_CLASS_NAME::.prototype); +::NATIVE_CLASS_NAME::.prototype = Object.create(::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton::end::.prototype); ::NATIVE_CLASS_NAME::.prototype.constructor = ::NATIVE_CLASS_NAME::; module.exports.::NATIVE_CLASS_NAME:: = ::NATIVE_CLASS_NAME::; diff --git a/templates/es6/BitmapData.mtt b/templates/es6/BitmapData.mtt index 23fb989..8930b2c 100644 --- a/templates/es6/BitmapData.mtt +++ b/templates/es6/BitmapData.mtt @@ -1,12 +1,10 @@ "use strict"; import Assets from "openfl/utils/Assets"; +import BitmapData from "openfl/display/BitmapData"; -public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +class ::NATIVE_CLASS_NAME:: extends BitmapData { - ::foreach CLASS_PROPERTIES:: ::name::; - ::end:: - - constructor (width, height, transparent, background) { + constructor (width = 0, height = 0, transparent = false, background = 0) { super (width, height, transparent, background); Assets.initBinding(::NATIVE_CLASS_NAME::, this); } diff --git a/templates/es6/MovieClip.mtt b/templates/es6/MovieClip.mtt index 13af2fd..6c937de 100644 --- a/templates/es6/MovieClip.mtt +++ b/templates/es6/MovieClip.mtt @@ -1,7 +1,8 @@ "use strict"; import Assets from "openfl/utils/Assets"; +:if BASE_CLASS_NAME::::else::import MovieClip from "openfl/display/MovieClip";::end:: -public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { ::foreach CLASS_PROPERTIES:: ::name::; ::end:: diff --git a/templates/es6/SimpleButton.mtt b/templates/es6/SimpleButton.mtt index ec9bd2f..b8e1fe1 100644 --- a/templates/es6/SimpleButton.mtt +++ b/templates/es6/SimpleButton.mtt @@ -1,7 +1,8 @@ "use strict"; import Assets from "openfl/utils/Assets"; +:if BASE_CLASS_NAME::::else::import SimpleButton from "openfl/display/SimpleButton";::end:: -public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton:: { constructor () { super (); diff --git a/templates/haxe/BitmapData.mtt b/templates/haxe/BitmapData.mtt index 06aedf8..e5821bd 100644 --- a/templates/haxe/BitmapData.mtt +++ b/templates/haxe/BitmapData.mtt @@ -1,6 +1,6 @@ package ::PACKAGE_NAME::; -@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends openfl.display.BitmapData { public function new (width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) { @@ -8,5 +8,4 @@ package ::PACKAGE_NAME::; } - } \ No newline at end of file diff --git a/templates/haxe/MovieClip.mtt b/templates/haxe/MovieClip.mtt index a830c36..15d1665 100644 --- a/templates/haxe/MovieClip.mtt +++ b/templates/haxe/MovieClip.mtt @@ -1,7 +1,9 @@ package ::PACKAGE_NAME::; -@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::#if flash flash.display.MovieClip.MovieClip2 #else openfl.display.MovieClip #end::end:: +{ + ::foreach CLASS_PROPERTIES::@:keep ::if hidden::@:noCompletion @:dox(hide) ::end::public var ::name:: (default, null):::type::; ::end:: @@ -11,5 +13,4 @@ package ::PACKAGE_NAME::; } - } \ No newline at end of file diff --git a/templates/haxe/SimpleButton.mtt b/templates/haxe/SimpleButton.mtt index 02cb109..7cf89dd 100644 --- a/templates/haxe/SimpleButton.mtt +++ b/templates/haxe/SimpleButton.mtt @@ -1,6 +1,7 @@ package ::PACKAGE_NAME::; -@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +@:bind @:native("::NATIVE_CLASS_NAME::") class ::CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::#if flash flash.display.SimpleButton.SimpleButton2 #else openfl.display.SimpleButton #end::end:: +{ public function new () { @@ -9,5 +10,4 @@ package ::PACKAGE_NAME::; } -} -#end \ No newline at end of file +} \ No newline at end of file diff --git a/templates/ts/BitmapData.mtt b/templates/ts/BitmapData.mtt index ed80b84..3ea7c6c 100644 --- a/templates/ts/BitmapData.mtt +++ b/templates/ts/BitmapData.mtt @@ -1,6 +1,7 @@ import Assets from "openfl/utils/Assets"; +import Assets from "openfl/display/BitmapData"; -public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +class ::NATIVE_CLASS_NAME:: extends BitmapData { ::foreach CLASS_PROPERTIES:: ::name::; ::end:: diff --git a/templates/ts/MovieClip.mtt b/templates/ts/MovieClip.mtt index 2d481cb..b0e88e4 100644 --- a/templates/ts/MovieClip.mtt +++ b/templates/ts/MovieClip.mtt @@ -1,6 +1,7 @@ import Assets from "openfl/utils/Assets"; +:if BASE_CLASS_NAME::::else::import MovieClip from "openfl/display/MovieClip";::end:: -public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { ::foreach CLASS_PROPERTIES:: ::name:: : ::type::; ::end:: diff --git a/templates/ts/SimpleButton.mtt b/templates/ts/SimpleButton.mtt index bd74d96..343cc0a 100644 --- a/templates/ts/SimpleButton.mtt +++ b/templates/ts/SimpleButton.mtt @@ -1,6 +1,7 @@ import Assets from "openfl/utils/Assets"; +:if BASE_CLASS_NAME::::else::import SimpleButton from "openfl/display/SimpleButton";::end:: -public class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton:: { constructor () { super (); From 7ec8238be3ba90d2077e002d501090950c5ef89c Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:44:09 -0100 Subject: [PATCH 4/9] Fix oversights in previous commit --- templates/as3/MovieClip.mtt | 2 +- templates/es6/MovieClip.mtt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/as3/MovieClip.mtt b/templates/as3/MovieClip.mtt index f9e5735..c5dcd44 100644 --- a/templates/as3/MovieClip.mtt +++ b/templates/as3/MovieClip.mtt @@ -1,6 +1,6 @@ package ::PACKAGE_NAME:: { import openfl.utils.Assets; - :if BASE_CLASS_NAME::::else::import openfl.display.MovieClip;::end:: + :if BASE_CLASS_NAME:::else::import openfl.display.MovieClip;::end:: public class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { diff --git a/templates/es6/MovieClip.mtt b/templates/es6/MovieClip.mtt index 6c937de..b43186b 100644 --- a/templates/es6/MovieClip.mtt +++ b/templates/es6/MovieClip.mtt @@ -2,7 +2,7 @@ import Assets from "openfl/utils/Assets"; :if BASE_CLASS_NAME::::else::import MovieClip from "openfl/display/MovieClip";::end:: -class ::NATIVE_CLASS_NAME:: extends ::BASE_CLASS_NAME:: { +class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { ::foreach CLASS_PROPERTIES:: ::name::; ::end:: From 6ec11328a8ab443560693f9aa0f72769c988f0fd Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:50:59 -0100 Subject: [PATCH 5/9] Fix missing : in if checks --- templates/as3/BitmapData.mtt | 2 +- templates/as3/MovieClip.mtt | 2 +- templates/as3/SimpleButton.mtt | 2 +- templates/es6/MovieClip.mtt | 2 +- templates/es6/SimpleButton.mtt | 2 +- templates/ts/MovieClip.mtt | 2 +- templates/ts/SimpleButton.mtt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/as3/BitmapData.mtt b/templates/as3/BitmapData.mtt index 7531dcc..9d35f16 100644 --- a/templates/as3/BitmapData.mtt +++ b/templates/as3/BitmapData.mtt @@ -4,7 +4,7 @@ package ::PACKAGE_NAME:: { public class ::NATIVE_CLASS_NAME:: extends BitmapData { - public function ::NATIVE_CLASS_NAME:: (width:Int = 0, height:Int = 0, transparent:Bool = false, background:Int = 0) { + public function ::NATIVE_CLASS_NAME:: (width:int = 0, height:int = 0, transparent:boolean = false, background:int = 0) { super (width, height, transparent, background); } diff --git a/templates/as3/MovieClip.mtt b/templates/as3/MovieClip.mtt index c5dcd44..d62c4e5 100644 --- a/templates/as3/MovieClip.mtt +++ b/templates/as3/MovieClip.mtt @@ -1,6 +1,6 @@ package ::PACKAGE_NAME:: { import openfl.utils.Assets; - :if BASE_CLASS_NAME:::else::import openfl.display.MovieClip;::end:: + ::if BASE_CLASS_NAME:::else::import openfl.display.MovieClip;::end:: public class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { diff --git a/templates/as3/SimpleButton.mtt b/templates/as3/SimpleButton.mtt index 062bf8e..385f224 100644 --- a/templates/as3/SimpleButton.mtt +++ b/templates/as3/SimpleButton.mtt @@ -1,6 +1,6 @@ package ::PACKAGE_NAME:: { import openfl.utils.Assets; - :if BASE_CLASS_NAME::::else::import openfl.display.SimpleButton;::end:: + ::if BASE_CLASS_NAME::::else::import openfl.display.SimpleButton;::end:: public class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton::end:: { diff --git a/templates/es6/MovieClip.mtt b/templates/es6/MovieClip.mtt index b43186b..514221d 100644 --- a/templates/es6/MovieClip.mtt +++ b/templates/es6/MovieClip.mtt @@ -1,6 +1,6 @@ "use strict"; import Assets from "openfl/utils/Assets"; -:if BASE_CLASS_NAME::::else::import MovieClip from "openfl/display/MovieClip";::end:: +::if BASE_CLASS_NAME::::else::import MovieClip from "openfl/display/MovieClip";::end:: class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { diff --git a/templates/es6/SimpleButton.mtt b/templates/es6/SimpleButton.mtt index b8e1fe1..c35f710 100644 --- a/templates/es6/SimpleButton.mtt +++ b/templates/es6/SimpleButton.mtt @@ -1,6 +1,6 @@ "use strict"; import Assets from "openfl/utils/Assets"; -:if BASE_CLASS_NAME::::else::import SimpleButton from "openfl/display/SimpleButton";::end:: +::if BASE_CLASS_NAME::::else::import SimpleButton from "openfl/display/SimpleButton";::end:: class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton:: { diff --git a/templates/ts/MovieClip.mtt b/templates/ts/MovieClip.mtt index b0e88e4..2fd9028 100644 --- a/templates/ts/MovieClip.mtt +++ b/templates/ts/MovieClip.mtt @@ -1,5 +1,5 @@ import Assets from "openfl/utils/Assets"; -:if BASE_CLASS_NAME::::else::import MovieClip from "openfl/display/MovieClip";::end:: +::if BASE_CLASS_NAME::::else::import MovieClip from "openfl/display/MovieClip";::end:: class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { diff --git a/templates/ts/SimpleButton.mtt b/templates/ts/SimpleButton.mtt index 343cc0a..f665553 100644 --- a/templates/ts/SimpleButton.mtt +++ b/templates/ts/SimpleButton.mtt @@ -1,5 +1,5 @@ import Assets from "openfl/utils/Assets"; -:if BASE_CLASS_NAME::::else::import SimpleButton from "openfl/display/SimpleButton";::end:: +::if BASE_CLASS_NAME::::else::import SimpleButton from "openfl/display/SimpleButton";::end:: class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton:: { From ecbd75c0cd84a6bf24c9136b8afd23df680462cc Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:52:38 -0100 Subject: [PATCH 6/9] Remove spaces in MovieClip property type names --- templates/as3/MovieClip.mtt | 2 +- templates/ts/MovieClip.mtt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/as3/MovieClip.mtt b/templates/as3/MovieClip.mtt index d62c4e5..3ada1f0 100644 --- a/templates/as3/MovieClip.mtt +++ b/templates/as3/MovieClip.mtt @@ -4,7 +4,7 @@ package ::PACKAGE_NAME:: { public class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { - ::foreach CLASS_PROPERTIES:: public var ::name:: : ::type::; + ::foreach CLASS_PROPERTIES:: public var ::name:::::type::; ::end:: public function ::NATIVE_CLASS_NAME:: () { diff --git a/templates/ts/MovieClip.mtt b/templates/ts/MovieClip.mtt index 2fd9028..a027a57 100644 --- a/templates/ts/MovieClip.mtt +++ b/templates/ts/MovieClip.mtt @@ -3,7 +3,7 @@ import Assets from "openfl/utils/Assets"; class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { - ::foreach CLASS_PROPERTIES:: ::name:: : ::type::; + ::foreach CLASS_PROPERTIES:: ::name:::::type::; ::end:: constructor () { From 54380b1224a5ac9fa77cceaeff23bf68dab69456 Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:53:57 -0100 Subject: [PATCH 7/9] Fix missing quotations in Assets.initBinding call in Templates --- templates/as3/MovieClip.mtt | 2 +- templates/as3/SimpleButton.mtt | 2 +- templates/es5/BitmapData.mtt | 2 +- templates/es5/MovieClip.mtt | 2 +- templates/es5/SimpleButton.mtt | 2 +- templates/es6/BitmapData.mtt | 2 +- templates/es6/MovieClip.mtt | 2 +- templates/es6/SimpleButton.mtt | 2 +- templates/ts/BitmapData.mtt | 2 +- templates/ts/MovieClip.mtt | 2 +- templates/ts/SimpleButton.mtt | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/templates/as3/MovieClip.mtt b/templates/as3/MovieClip.mtt index 3ada1f0..f7c1b57 100644 --- a/templates/as3/MovieClip.mtt +++ b/templates/as3/MovieClip.mtt @@ -9,7 +9,7 @@ package ::PACKAGE_NAME:: { public function ::NATIVE_CLASS_NAME:: () { super (); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } } } \ No newline at end of file diff --git a/templates/as3/SimpleButton.mtt b/templates/as3/SimpleButton.mtt index 385f224..e76f1c6 100644 --- a/templates/as3/SimpleButton.mtt +++ b/templates/as3/SimpleButton.mtt @@ -6,7 +6,7 @@ package ::PACKAGE_NAME:: { public function ::NATIVE_CLASS_NAME:: () { super (); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } } } diff --git a/templates/es5/BitmapData.mtt b/templates/es5/BitmapData.mtt index ac1e0c7..ebdf21b 100644 --- a/templates/es5/BitmapData.mtt +++ b/templates/es5/BitmapData.mtt @@ -8,7 +8,7 @@ var ::NATIVE_CLASS_NAME:: = (function(width, height, transparent, background) { transparent = transparent || false; background = background || 0; BitmapData.call (this, width, height, transparent, background); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); }) ::NATIVE_CLASS_NAME::.prototype = Object.create(BitmapData.prototype); diff --git a/templates/es5/MovieClip.mtt b/templates/es5/MovieClip.mtt index 5e6bd03..8314432 100644 --- a/templates/es5/MovieClip.mtt +++ b/templates/es5/MovieClip.mtt @@ -4,7 +4,7 @@ var Assets = require ("openfl/utils/Assets").default; var ::NATIVE_CLASS_NAME:: = (function() { ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end::.call (this); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); }) ::NATIVE_CLASS_NAME::.prototype = Object.create(::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end::.prototype); diff --git a/templates/es5/SimpleButton.mtt b/templates/es5/SimpleButton.mtt index a4503c8..50dfe91 100644 --- a/templates/es5/SimpleButton.mtt +++ b/templates/es5/SimpleButton.mtt @@ -4,7 +4,7 @@ var Assets = require ("openfl/utils/Assets").default; var ::NATIVE_CLASS_NAME:: = function() { ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton::end::.call (this); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } ::NATIVE_CLASS_NAME::.prototype = Object.create(::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::SimpleButton::end::.prototype); diff --git a/templates/es6/BitmapData.mtt b/templates/es6/BitmapData.mtt index 8930b2c..426bfa7 100644 --- a/templates/es6/BitmapData.mtt +++ b/templates/es6/BitmapData.mtt @@ -6,7 +6,7 @@ class ::NATIVE_CLASS_NAME:: extends BitmapData { constructor (width = 0, height = 0, transparent = false, background = 0) { super (width, height, transparent, background); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } } diff --git a/templates/es6/MovieClip.mtt b/templates/es6/MovieClip.mtt index 514221d..f0e6749 100644 --- a/templates/es6/MovieClip.mtt +++ b/templates/es6/MovieClip.mtt @@ -9,7 +9,7 @@ class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::e constructor () { super (); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } } diff --git a/templates/es6/SimpleButton.mtt b/templates/es6/SimpleButton.mtt index c35f710..bec5d58 100644 --- a/templates/es6/SimpleButton.mtt +++ b/templates/es6/SimpleButton.mtt @@ -6,7 +6,7 @@ class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::e constructor () { super (); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } } diff --git a/templates/ts/BitmapData.mtt b/templates/ts/BitmapData.mtt index 3ea7c6c..dc9801b 100644 --- a/templates/ts/BitmapData.mtt +++ b/templates/ts/BitmapData.mtt @@ -8,7 +8,7 @@ class ::NATIVE_CLASS_NAME:: extends BitmapData { constructor (width:number = 0, height:number = 0, transparent:bool = false, background:number = 0) { super (width, height, transparent, background); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } } diff --git a/templates/ts/MovieClip.mtt b/templates/ts/MovieClip.mtt index a027a57..59ae15a 100644 --- a/templates/ts/MovieClip.mtt +++ b/templates/ts/MovieClip.mtt @@ -8,7 +8,7 @@ class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::e constructor () { super (); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } } diff --git a/templates/ts/SimpleButton.mtt b/templates/ts/SimpleButton.mtt index f665553..9c0becc 100644 --- a/templates/ts/SimpleButton.mtt +++ b/templates/ts/SimpleButton.mtt @@ -5,7 +5,7 @@ class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::e constructor () { super (); - Assets.initBinding(::NATIVE_CLASS_NAME::, this); + Assets.initBinding("::NATIVE_CLASS_NAME::", this); } } From 3e1c5a6fa0cb5fe85e0208760ba57d7c6e9d9a5c Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:57:35 -0100 Subject: [PATCH 8/9] Fix TS MovieClip properties --- templates/ts/MovieClip.mtt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/ts/MovieClip.mtt b/templates/ts/MovieClip.mtt index 59ae15a..9406e04 100644 --- a/templates/ts/MovieClip.mtt +++ b/templates/ts/MovieClip.mtt @@ -3,7 +3,7 @@ import Assets from "openfl/utils/Assets"; class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { - ::foreach CLASS_PROPERTIES:: ::name:::::type::; + ::foreach CLASS_PROPERTIES:: public ::name::!:::type::; ::end:: constructor () { From 3a518833e63bc038a61cc5fce126052f5db93b35 Mon Sep 17 00:00:00 2001 From: Fancy2209 Date: Wed, 25 Feb 2026 17:19:25 -0100 Subject: [PATCH 9/9] Fix extra space in TS, ES6 and AS3 --- templates/as3/MovieClip.mtt | 4 ++-- templates/es6/MovieClip.mtt | 2 +- templates/ts/MovieClip.mtt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/as3/MovieClip.mtt b/templates/as3/MovieClip.mtt index f7c1b57..8cf089f 100644 --- a/templates/as3/MovieClip.mtt +++ b/templates/as3/MovieClip.mtt @@ -1,10 +1,10 @@ package ::PACKAGE_NAME:: { import openfl.utils.Assets; - ::if BASE_CLASS_NAME:::else::import openfl.display.MovieClip;::end:: + ::if BASE_CLASS_NAME::::else::import openfl.display.MovieClip;::end:: public class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { - ::foreach CLASS_PROPERTIES:: public var ::name:::::type::; + ::foreach CLASS_PROPERTIES::public var ::name:::::type::; ::end:: public function ::NATIVE_CLASS_NAME:: () { diff --git a/templates/es6/MovieClip.mtt b/templates/es6/MovieClip.mtt index f0e6749..243500f 100644 --- a/templates/es6/MovieClip.mtt +++ b/templates/es6/MovieClip.mtt @@ -4,7 +4,7 @@ import Assets from "openfl/utils/Assets"; class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { - ::foreach CLASS_PROPERTIES:: ::name::; + ::foreach CLASS_PROPERTIES::::name::; ::end:: constructor () { diff --git a/templates/ts/MovieClip.mtt b/templates/ts/MovieClip.mtt index 9406e04..fecd58e 100644 --- a/templates/ts/MovieClip.mtt +++ b/templates/ts/MovieClip.mtt @@ -3,7 +3,7 @@ import Assets from "openfl/utils/Assets"; class ::NATIVE_CLASS_NAME:: extends ::if BASE_CLASS_NAME::::BASE_CLASS_NAME::::else::MovieClip::end:: { - ::foreach CLASS_PROPERTIES:: public ::name::!:::type::; + ::foreach CLASS_PROPERTIES::public ::name::!:::type::; ::end:: constructor () {