{"id":4875,"date":"2014-03-30T16:21:51","date_gmt":"2014-03-30T16:21:51","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-haxe-collection-of-common-programming-errors\/"},"modified":"2014-03-30T16:21:51","modified_gmt":"2014-03-30T16:21:51","slug":"problem-about-haxe-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-haxe-collection-of-common-programming-errors\/","title":{"rendered":"problem about haxe-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d4046093d5c6499ff13d5b5690a6cb32?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nFlavorScape<br \/>\nsyntax compiler-errors haxe openfl<br \/>\nI don&#8217;t think my syntax is actually bad here. Or is it? This is my first stab at OpenFL. The Haxe is not compiling correctly? Am I missing a compiler directive? Do I actually have a syntax error in this function? Syntax checker in Flashdevelop says no.Here&#8217;s the command: Running process: C:\\Program Files (x86)\\FlashDevelop\\Tools\\fdbuild\\fdbuild.exe &#8220;C:\\dev\\Haxe\\TestOpenFL\\OpenFLTest.hxproj&#8221; -ipc 2e4ace78-45b9-4868-a2dd-cf2c35265f44 -version &#8220;3.0.0&#8221; -compiler &#8220;C:\\HaxeToolkit\\haxe&#8221; -library &#8220;C:\\Pr<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/185d0b2cf3eced61b683c8addf43c6bd?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLuka Sverko<br \/>\nhaxe dynamic-cast<br \/>\nIs it possible to cast a variable to another type based on information available at runtime?If I have:interface Foo { }class Bar implements Foo {public function new(){} }I want to do something like this (method is simplified for clarity):public static function dynamicCast&lt;T : Foo&gt;(target : Foo, cls : Class&lt;T&gt;) : T {var ret : T = cast(pTarget, cls);return ret; }I get the following compiler error:Unexpected )<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2d674b57d745b3096a1097276e1f3c68?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBaelnorn<br \/>\nactionscript-3 haxe<br \/>\nFirst a little background: I&#8217;m looking for a way to create a &#8220;collection&#8221; library that abstracts the Flash Player version based implementation (Vector on FP10, Array on FP9) away from the calling code. I&#8217;ve already written a small AS3 lib doing that but&#8230;&#8230;the performance is bad (especially because of two levels of indirection and the runtime type checks on the Array implementation) &#8230;the code is ugly (since Vector types need to be defined at compiletime I needed a factory returning concrete<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/37edb93ffb892ee7964e01d31fac4aed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsimo<br \/>\nlambda haxe<br \/>\nI have a map variable:var bitmapDepths:Map&lt;BitmapData, Int&gt;;What I need is to remove all keys with value of 0, I tried this:bitmapDepths= Lambda.filter(Lambda.list(bitmapDepths.keys), function(v) { return (v &gt; 0); });So, I used Lambda.list to iterate on bitmapDepths.keys inside Lambda, but I get this error:Void -&gt; Iterator&lt;flash.display.BitmapData&gt; should be Iterable&lt;Unknown&lt;0&gt;&gt;I tried Lambda.array to iterate on bitmapDepths.keys, I got the same error, so who can ha<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/db97703499589b890d4d537011612498?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nVoxl<br \/>\nflash actionscript-3 haxe<br \/>\nI am having some trouble figuring out how to overload a function in Flash using haXe. I know that Flash does not allow overloads but can accept function parameters without a type declared, but I am unsure as how to replicate this trick in haXe.EDIT: Since this does not appear to be possible, are there any known tricks that can be used to get around this limitation?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/37edb93ffb892ee7964e01d31fac4aed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsimo<br \/>\nhaxe neko<br \/>\nI have started to use haxe to convert my action script 3 projects into NME, but, I like to know please what is neko in the world of linux? I searched for it, I found its an animated cat!Can any one please explain to me?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/37edb93ffb892ee7964e01d31fac4aed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsimo<br \/>\nactionscript-3 swf haxe<br \/>\nI am a new comer to Haxe, I was wondering about loading SWF files and using assets inside them. the following questions have no clear answer to me yet, they all about using assets from external swf files ( export for ActionScript, with a known Class name to use )If I am targeting HTML5, then how would I load a SWF file and use assets inside it? can I instantiate Classes inside the external SWF file? In general, will loading a SWF file and using assets inside it easy in Haxe? What about frames in<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bc10c7edd7524e1a05de670a3f0399a4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nWill<br \/>\nflash actionscript-3 localization internationalization haxe<br \/>\nHow do you make a Flash movie (using Haxe, or Actionscript code rather than the IDE) that supports multiple languages?Can you detect the browser&#8217;s language?Are there utility classes for managing the strings and selecting the appropriate one based on language?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bd8e93613dba2b3b39c97afd6d065279?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ncodefx<br \/>\ncompiler programming-languages llvm haxe hiphop<br \/>\nI have been thinking about source transformers like HipHop and Haxe. From their respective websites, I see that these tools converts a source language to target language and then uses the compilers of the target language to produce the final executable. The part that I find confusing is that how these tools deal with the case whether the source language is a memory managed laguage (PHP, Haxe lang) and the target language is a non-memory managed language(C \/ C++). I know that Mono adds a VM at co<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/64839d31baaefafa58120e1a5a503d66?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJohn Conde<br \/>\ndart haxe<br \/>\nDoes Dart aim to accomplish a lot of the same functionality as Haxe in terms of being able to target other languages and runtimes? Is it a stated or known goal of the language &amp; tools?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/02dd8f44151d29216ac0e7c82da3f6ba?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nalmosnow<br \/>\nactionscript-3 function function-pointers anonymous-function haxe<br \/>\nI&#8217;m trying to differentiate anonymous functions like:function() { trace(&#8220;WOO&#8221;); }from the other ones (&#8216;named&#8217;?) likevar _FUNC:Dynamic = function() { trace(&#8220;WOO&#8221;); }The reason I want to do that is because I can&#8217;t compare between two anonymous functions, because they are two different ones.To help me make things clearer, consider the following quick example.var _TEST:Dynamic = function(a:Dynamic):String {var _TESTA:Dynamic = function() { trace(&#8220;WOO&#8221;); };var _TESTB:Dynamic = _FUNC;return (a == _TES<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/00ea2e95ff7c6208c5cf45f6ee5db2fd?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nxhunterko<br \/>\nhaxe<br \/>\nI&#8217;ve had to move my stuff from a failing hard drive, so I&#8217;ve had to set up and reinstall everything again. And I&#8217;ve run into a couple problems.So I&#8217;ve got two errors here. The first error that I get is when I open flashdevelop to begin working. I get the error of:Can&#8217;t Find Haxelib.exeAnd of course, I&#8217;ve installed haxe and haxelib and everything else that&#8217;s needed pre-setup. However, when I run, the flash and html5 targets work fine regardless. I don&#8217;t know why that error shows up. Any ideas?My<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/351c021c9bef28d7ea0c9002770ae5ba?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEldros<br \/>\nosx haxe<br \/>\nI wanted to do again to develop in haxe on my MacBook after quite a long time. So I go on haxe.org, download the mac installer and install the latest version of haxe with it.Then I open the terminal and type haxe, just to encounter this short error message:Bus ErrorWell, did I do something wrong? I&#8217;m using OSX 10.4, can it be that the latest version of haxe is not supported on this operating system?UPDATE:Looking into the system log, I found out that after the installer was called, the following<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/608cb2ec998f3113dbc90093cb4bb552?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nshadow_of__soul<br \/>\nandroid ios drag-and-drop touch haxe<br \/>\ni&#8217;m trying to make a simple drag and drop in haxe NME targeting touch devices, but i&#8217;m unable to.i tried, startDrag(), a combination of mouseDown, mouseUp and mouseMove,another combination of TouchEvent.TOUCH_BEGIN,TouchEvent.TOUCH_END,TouchEvent.TOUCH_MOVE and startDragTouch() etc.. but in the first 3 cases, the app crashes in androin, and in the last one, i&#8217;m getting:nme.display.Sprite has no field startTouchDragat the moment of compilation. Anyone knows a method to have drag &amp; drop suppor<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6f35bd5aec390e05f3aa5f65072ac159?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbalazon<br \/>\nandroid flashdevelop haxe build-error nme<br \/>\ni&#8217;m just getting to know nme haxe developing, i&#8217;m currently using flashdevelop. I have a problem when building a sample app (piratepig) under android platform : lots of &#8220;no such file or directory&#8221;. Everything seems fine when i choose windows, html5, or flash platforms.Here&#8217;s the output:Running process: C:\\Program Files (x86)\\FlashDevelop\\Tools\\fdbuild\\fdbuild.exe &#8220;C:\\Users\\Valentin\\Desktop\\PiratePig\\Pirate Pig.hxproj&#8221; -ipc 2a666e48-3f38-4abd-b63a-25219cb72cf4 -version &#8220;2.10&#8221; -compiler &#8220;C:\\Motion<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e2e346ca17d3ee6808427efd54facebc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlvaro Fallas<br \/>\nandroid flashdevelop haxe nme<br \/>\nI&#8217;m trying to compile my nme project for android, but until this moment it has been impossible for me. The error message that I&#8217;m getting is Running process: C:\\Program Files(x86)\\FlashDevelop\\Tools\\fdbuild\\fdbuild.exe&#8221;C:\\Users\\Andr\u00e9s\\Documents\\myOP\\project.hxproj&#8221; -ipccf7bbe3a-8e0c-47e5-aac3-4d442ae964f2 -version &#8220;2.10&#8221; -compiler&#8221;C:\\Motion-Twin\\Haxe&#8221; -notrace -library &#8220;C:\\Program Files(x86)\\FlashDevelop\\Library&#8221; -target &#8220;android&#8221; Building project haxelibrun nme build &#8220;C:\\Users\\Andr\u00e9s\\Documents\\<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ce19757772ca6c4e4665bb43fbba6678?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ncarboncopy<br \/>\nwindows haxe<br \/>\nIm trying to use the windows api in haxe to create a windows application. I have already done this using ndlls and haxe\/neko. I tried doing it with the cpp target where I embed c++ code into the haxe file using the new macro features in haxe 2.09. But, as soon as I include windows.h it gives an error.\/src\/Main.cpp(79) : error C2039: &#8216;RegisterClassA&#8217; : is not a member of &#8216;hx&#8217;.\/src\/Main.cpp(81) : error C2660: &#8216;RegisterClassA&#8217; : function does not take 9 argumentsCalled from ? line 1Called from Buil<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/db096957dce887e9ccdfb8449886e773?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHammers<br \/>\nhaxe<br \/>\nI am currently setting up a website using haxe targetting php and I&#8217;m having a problem with the haxe.Web.Dispatch library.Everything was working well until I tried to implement a doDefault() rule.I have the following rules in my dispatch api:doIndex(){ &#8230; }doPosts(){y:String, m:String, n:String){ &#8230; }And these will both redirect to the correct webpage. For example these both work fine:http:\/\/foo.com\/index http:\/\/foo.com\/posts\/2013\/01\/post-titleAnd now I&#8217;ve implementeddoDefault() {&#8230;}in order<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3e8d217e0ecf6db31de80b698726a50a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLukasz Lew<br \/>\nactionscript-3 haxe<br \/>\nI&#8217;m thinking about using Haxe in place of AS3. What are the disadventages of that? I can think about:Difficulties with using native AS3 libraries. Difficulity of debugging after language translation. Haxe is quite young, it may have some rough edges. Does it?Does any one of you have expirience with Haxe dark sides?What are the adventages? I&#8217;ve heard:Performance. Multiple targets (But I don&#8217;t see how that is useful) Better typing that AS3 Maybe better syntax.Haxe is big enough that there should b<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f46bed446cf8dbbed0bc7896eaddeff8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nShekhar<br \/>\nios haxe nme hxcpp<br \/>\nFor a client I&#8217;ve developed an iOS + Android app using Cordova (PhoneGap) for the user interface. Now, as an update to this app, I&#8217;m am attempting to add a game that was written in HaXe. Originally the game was written for the Flash target, but I&#8217;ve updated it to work with the C++ targets for Android and iOS.On Android it was easy to integrate this with the Cordova app using activities (the HaXe part runs as a separate activity), but I am having some trouble achieving a similar result on iOS.So<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ffffd204ecbbae82a04f5b574d76746b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nthedayturns<br \/>\nhaxe nme<br \/>\nWhen I try to compile to cpp on OSX Lion with Haxe and NME, I get the following backtrace: [&#8230;many lines above this one omitted&#8230;] Called from ? line 1 Called from BuildTool.hx line 1265 Called from BuildTool.hx line 554 Called from a C function Called from BuildTool.hx line 591 Called from BuildTool.hx line 710 Called from BuildTool.hx line 739 Called from BuildTool.hx line 153 Uncaught exception &#8211; Error creating pch: 256 &#8211; build cancelledHow can I fix this error?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/69e65ac52ef5fd27e73c99c1ab14562c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njrouquie<br \/>\nflash haxe nme<br \/>\nI&#8217;m using Haxe and NME and the flash target to create a .swf. How do I make sure that uncaught Exceptions are shown? Currently it seems they are just silently eaten up. I&#8217;m compiling with:haxelib run nme build path\/to\/MyNmmlFile.nmml flashI believe it is some flag I need to pass there, or something I need to set in the nmml file, but don&#8217;t know what&#8230;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/IW6pT.jpg?s=32&amp;g=1\" \/><br \/>\nAreston<br \/>\nios haxe nme<br \/>\nThere are some problems when I tend to build my openfl project on cpp and ios with my Mac.The error message is showing below.Anyone who can help me?Thanks a lot!sh: g++: command not found Called from ? line 1 &#8230; Uncaught exception &#8211; Error creating pch: 127 &#8211; build cancelled<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/8BlFv.jpg?s=32&amp;g=1\" \/><br \/>\nmattwallace<br \/>\njavascript compiler haxe<br \/>\nI am having an issue that I discussed on the haxe IRC channel but was unable to come up with a fixe. It seems to be a bug with the compiler.Here is the haxe codepackage; import js.Lib; import js.three.Three; import haxe.Timer;class Main { public var timer:Timer;public var renderer:WebGLRenderer;public var scene:Scene;public var camera:PerspectiveCamera;public function new() {timer = new Timer(30);var w = Lib.window.innerWidth;var h = Lib.window.innerHeight;scene = new Scene();\/\/ create a red<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/37edb93ffb892ee7964e01d31fac4aed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsimo<br \/>\nflashdevelop haxe createjs<br \/>\nI have installed externs for createjs libraries:haxelib install createjsI added the createjs library to compile file:-main com.ketab.createjs_js_js.Main -cp src -lib createjs -js bin\/m.jsAnd I can compile with no errors, but in chrome, I get this error:Uncaught ReferenceError: createjs is not defined for the line createjs.Ticker.useRAF = true;Here is my html file:&lt;!DOCTYPE html&gt; &lt;html lang=&#8221;en&#8221;&gt; &lt;head&gt;&lt;meta charset=&#8221;utf-8&#8243;\/&gt;&lt;title&gt;createjs_js_js&lt;\/title&gt;&lt;met<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/485331ca799b2c0a15fb554999ea41e1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nC\u00e9sar Alforde<br \/>\njavascript global-variables haxe<br \/>\nThis question only applies to Haxe version &lt; 2.10I&#8217;ve known about haxe for a while, but never really played with it until yesterday. Being curious, I decided to port showdown.js, a javascript port of markdown.pl, to haxe. This was pretty straightforward, and the javascript it generates seems to run fine (edit: If you want to see it in action, check it out here).However, I noticed that the generated code dumps a ton of stuff in the global namespace&#8230; and what&#8217;s worse, it does it by assigning<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/37edb93ffb892ee7964e01d31fac4aed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsimo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7e76c5679db012f99c3bc4d9e9ffd351?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1107412<br \/>\nhtml5 flash haxe nme<br \/>\nI have tried to build an html5 canvas version of the nme-runnermark, but without any significant success. The flash version builds without any problems. I get the following stack of errors:\/usr\/lib\/haxe\/lib\/nme\/3,5,5\/browser\/utils\/ByteArray.hx:22: characters 46-47 : Property initialization is not allowed \/usr\/lib\/haxe\/lib\/nme\/3,5,5\/browser\/utils\/ByteArray.hx:24: characters 27-28 : Member variable initialization is not allowed outside of class constructor \/usr\/lib\/haxe\/lib\/nme\/3,5,5\/browser\/utils<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FlavorScape syntax compiler-errors haxe openfl I don&#8217;t think my syntax is actually bad here. Or is it? This is my first stab at OpenFL. The Haxe is not compiling correctly? Am I missing a compiler directive? Do I actually have a syntax error in this function? Syntax checker in Flashdevelop says no.Here&#8217;s the command: Running [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4875","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4875"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4875\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}