haxe

Haxe — Embed files like in ActionScript?

主宰稳场 提交于 2019-12-23 21:07:42
问题 In ActionScript, you can do something like this: [Embed(source = "src/myfile.xml", mimeType = "application/octet-stream")] private var xml : Class; and it will embed your file to be used in code. How can i do something similar in Haxe? 回答1: Haxe allows you to provide external resources info for embedding in hxml. You may refer to the doc. 回答2: Things have changed since the time the question was asked. With a modern version of haxe one can do: @:bitmap("test.png") class TestBMD extends

Variable number of arguments in Haxe

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 20:41:38
问题 i'm looking for a way to do something like this in Haxe: function foo(...args) { for (arg in args) { ... } } Someone around here who can help me? 回答1: Haxe doesn't have rest arguments, mostly because those are untyped by nature, and the language should help going typed to have safest code. Typed code can be checked and also optimized by the compiler. More errors compile-time, less errors run-time. Still the same result of rest arguments can be somehow achieved in a few ways, depending on what

Can Haxe compiler convert any C# code to Haxe?

蹲街弑〆低调 提交于 2019-12-23 18:12:01
问题 First I am super new to Haxe, so I am asking super noob question here, and I have 2 of them. 1) My first question is I know Haxe compiler can convert from Haxe to any other language (supported) but can it convert source code in other languages(supported) to Haxe? 2) If it can do so how much is its capability like can it only convert a few files lets say in C# to Haxe or if I give a huge repo like lets say this https://github.com/dotnet/corefx or https://github.com/tensorflow/tensorflow will

FlashDevelop/OpenFL: How to set default target to neko

半世苍凉 提交于 2019-12-23 03:52:20
问题 I am trying to write some cross-language code with Haxe/OpenFL and compile it using FalshDevelop. But I get an error as soon as I use the basic Sys.print function. A minimal example is as follows: package; import flash.display.Sprite; class Graphic extends Sprite { public function new () { super (); } static function main() { //used in standalone swf project Sys.print("Hi"); } } It turns out that the default compile command of FlashDevelop is something like: haxelib run openfl build project

FlashDevelop — Specify an HXML file?

最后都变了- 提交于 2019-12-22 09:15:12
问题 [a continuation of this question] In order to embed resources in a SWF file, I have to add lines to my HXML file. However, since I'm using FlashDevelop, I don't know where to find that. Where should I put stuff I would ordinarily specify in my HXML? 回答1: There's more detailed help about the projects settings you need in the Haxe wiki. You can use a custom .hxml file to build your project in FlashDevelop. Go to Project -> Properties... . Choose Custom Build as compilation target. Go to the

Extracting Actionscript from .fla file, without Adobe Flash

北战南征 提交于 2019-12-22 08:49:29
问题 Unlike this guy, I'm using MTASC's Haxe to compile SWF from AS. Considering I don't have Adobe CS, what are our options to extract the action scripts from any FLA file? I mean different versions, like CS4, CS5, etc. Converting older versions to CS5 would also help. 回答1: CS4 FLA container is Microsoft Structured Storage (like MS Word documents). You can open it with for example FAR Manager or OpenMCDF. Embedded AS3 code can be seen inside the objects in Unicode plaintext. You can open it with

how to write a generic compare function in Haxe (haxe3)

北慕城南 提交于 2019-12-21 20:30:51
问题 I am trying to write a generic compare function (like the c strcmp) in Haxe3 for a template type A, assuming that this template type has a less-than-or-equal-to operator "<=". I saw in the Haxe3 documentation (http://haxe.org/manual/haxe3/features) that you can do a similar job if you want to assume that a template type has the new function: @:generic static function foo<T:{function new(s:String):Void;}>(t:T) { trace(Type.typeof(t)); // TClass([class String]) / TClass([class Template]) return

FlashDevelop, Haxe import CreateJS?

我们两清 提交于 2019-12-20 02:42:08
问题 I just started trying out Haxe to make a web-app, and I would like to use CreateJS, which has a Haxe extern lib thingy. I'm using FlashDevelop as my IDE. So I created a new Haxe JS project in FlashDevelop, and installed CreateJS with "haxelib install createjs". Thougg now I try to add an import to my Main.hx, but it doesn't work. My import looks like: "import createjs.easeljs.Ticker;" (got that from an example, just copied it but didn't work :s) I also added a new map "lib" to my project, in

FlashDevelop, Haxe import CreateJS?

喜欢而已 提交于 2019-12-20 02:41:34
问题 I just started trying out Haxe to make a web-app, and I would like to use CreateJS, which has a Haxe extern lib thingy. I'm using FlashDevelop as my IDE. So I created a new Haxe JS project in FlashDevelop, and installed CreateJS with "haxelib install createjs". Thougg now I try to add an import to my Main.hx, but it doesn't work. My import looks like: "import createjs.easeljs.Ticker;" (got that from an example, just copied it but didn't work :s) I also added a new map "lib" to my project, in