haxe

How to exit Haxe/OpenFL program?

人走茶凉 提交于 2019-12-12 08:41:18
问题 I am making a game using Haxe, OpenFL (Formerly NME) and HaxeFlixel. However, problem is, I can't seem to find a good way to make a Flixel button that will shutdown the game when pressed. I was planning to make a "quit" button on the main menu. Is there any simple method to do so or is it impossible? 回答1: It depends on the compilation target: I'm going to assume you're compiling to CPP (Windows EXE). In which case you should just be able to use the following: import flash.system.System; // Or

Conversion of Flash Components and 9-Slice Scaling to HTML5 canvas

送分小仙女□ 提交于 2019-12-12 06:38:11
问题 I am trying to help our designers export their GUI assets to HTML5 canvas, but in a way that they can keep working on these assets in Flash Pro. The assets are "dumb" in the sense that they do not contain any JavaScript, eg. the timeline in icons is used for separating mouse-over from mouse-out, and so forth, and each frame might have local animations. But in general, all application-observable state in the GUI is controlled from the application code written in Haxe, outside of Flash Pro.

Can Haxe be compiled to Coffeescript?

谁说我不能喝 提交于 2019-12-12 04:43:21
问题 I'm wondering whether it's possible to compile Haxe to Coffeescript - are there any tools that are available for this? I find Coffeescript's syntax to be much more concise than that of Javascript, so I'd like to find a Coffeescript target for Haxe (if it exists.) 回答1: Haxe already has a Javascript target, and there is already a Javascript-to-Coffeescript that is available ( http://js2coffee.org/ ), so it should be possible, as long as js2coffee does not make any errors in compiling Javascript

Haxe NME Resizing a Bitmap

送分小仙女□ 提交于 2019-12-12 02:56:41
问题 I am trying to learn NME with haxe to create a small game. I have setup NME 3.5.5 with Haxe 2.10 in FlashDevelop. To draw the game background, I'm using // Class level variable var background : nme.display.Bitmap; public function initResources() : Void { background = new Bitmap(Assets.getBitmapData("img/back.png")); } And in the render loop, I'm rendering like this. g.clear(); g.beginBitmapFill(background.bitmapData, true, true); g.drawRect(0, 0, 640, 480); g.endFill(); This is drawing the

Reading lines from a file in Haxe

て烟熏妆下的殇ゞ 提交于 2019-12-11 11:57:15
问题 In Haxe, is there any cross-language method for reading lines from a file (that works with all Haxe target languages?) Here's the method stub that I'm trying to implement: static function readLine(fileName, lineNumber){ //now how can I get this method to work with all Haxe target languages? } It might be possible to find a relevant method in the Sys class, but I haven't yet found it. 回答1: static function readLine(fileName, lineNumber) { var fin = sys.io.File.read(fileName, false); try { for

FlashDevelop / Haxe - build halted with errors (haxelib.exe)

谁说我不能喝 提交于 2019-12-11 11:55:01
问题 I'm trying to get started with Haxe but I can't even get past the easiest step, compiling the "new project" template. I'm using FlashDevelop 4, installed Haxe and used the the command haxelib install openfl to install openfl (did the same for NME) though I still get the most basic compiler error: haxelib run openfl build C:\dev\haxeBox\openFlTest\application.xml android -debug [file_contents,C:\Program Files(x86)\Haxe\haxe\lib\openfl//.current] Build halted with errors (haxelib.exe). I've

Flambe HTML Compile Issue

半世苍凉 提交于 2019-12-11 11:48:38
问题 I have just started with Haxe/Flambe, but I seem to have a problem compiling to HTML. From what I can tell it's an internal problem. It compiles to Flash just fine. Here's my console output C:\Users\UserName\Dropbox\Projects\Project\Game>flambe build --debug html Building: build/web haxe -main game.Main -lib flambe -cp src -dce full -debug --no-opt --no-inline -D html -D js-es5 -D js-flatten --macro flambe.platform.ManifestBuilder.use("build/web/assets") -D source-map-content -js build/web

Play FLV in ActionScript 2

痴心易碎 提交于 2019-12-11 10:54:12
问题 I am very new to Flash and Actionscript. I am trying to simply play an FLV file. I have the following: import flash.MovieClip; import flash.Video; import flash.NetConnection; import flash.NetStream; class Program { private var container_mc : MovieClip; private var video_mc : Video; public function new() { var mc : flash.MovieClip = flash.Lib.current; container_mc = flash.Lib._root.attachMovie("VideoContainer", "container_mc", 0); container_mc.attachMovie("VideoClip", "video_mc", 1); var my_nc

Macro --include is recursively including packages not appropriate for build target

只愿长相守 提交于 2019-12-11 05:15:04
问题 I'm building a game using the HaxeFlixel lib. In one part of my code I'm dynamically resolving classes via Type.resolveClass() . In order to avoid having to reference every potential class individually, I tried to use --macro include() by adding this to my project.xml : <haxeflag name="--macro" value="include('my.pack')" /> This worked fine when compiling against the Flash target, but when I try to compile against neko I get: C:\HaxeToolkit\haxe\lib\flixel/3,0,4/flixel/FlxG.hx:3: characters 7

How to make an parametrized enum build macro?

本小妞迷上赌 提交于 2019-12-11 04:46:17
问题 Now Solved I want to build an enum with a macro, including defining its type parameters. There are a couple of sources describing adding enum fields with macros , but I havent found any which describe how to build an enum with specified parameter types using macros. There is a documentation entry made for limitations of macros here regarding parameter types, but that is still left empty. The idea is to use a macro to generate a specified number of Either enums with increasing amount of