forum > Flash problem
-
Nicolás A. Ortega Jul 25 at 07:32
Hello, I currently have the latest version of HaXe installed on my computer, but I am having problems with the flash targeting. I compile the basic "Hello world" program, it doesn't show any errors, but when I run it, it doesn't show anything. I know the code is correct, I am wondering if I need to install the flash libraries like I did the hxcpp libraries, and if so, what is the name of the library I need to install?
-
If you mean this "hello world" example: http://haxe.org/doc/start/flash#helloworld only two things can have gone 'wrong':
1) You forgot to add -main Main to your hxml file or didn't choose Main as the 'main class' in your IDE.
2) You added -D fdb to your hxml file or choose a debug build in your IDE and then that trace statement does not write to the textfield in the swf but to the output console in your IDE and to your flashlog.txt file.Add the following below that trace("hello world"); statement to make sure everything works as expected:
var s = new flash.display.Sprite(); s.graphics.beginFill(0xFF0000); s.graphics.drawRect(0,0,100,100); flash.Lib.current.addChild(s);
Jan -
Nicolás A. Ortega Jul 25 at 20:36
No, I compiled it and it didn't give any errors, but when I ran it, it just showed a blank window, as it always does. Here's my code:
import flash.display.Sprite; import flash.Lib; class Hello { public static function main() { trace("Hello world!"); var s = new flash.display.Sprite(); s.graphics.beginFill(0xFF0000); s.graphics.drawRect(0, 0, 100, 100); flash.Lib.current.addChild(s); } }
I made sure to compile it correctly, but it doesn't seem to show anything. -
Paste your hxml file with the build commands.
Jan
-
Nicolás A. Ortega Jul 25 at 22:00
Here it is:
-main Hello -swf Hello.swf -
Works here.
http://www.haxer.be/guests/nicolasortega/Hello.zipJan
-
Nicolás A. Ortega Jul 25 at 23:15
I ran the swf file, but it didn't work, so I think the problem is with the flash player, not haxe, which means that I need to reinstall the flash player. Thanks!
-
Haxe compiles for FlashPlayer 10 by default. You probably still have FlashPlayer 8 (or older) installed.
You can compile for a specific version but for the code in the example you need at least FlashPlayer 9.-swf-version 9
Jan