All of us during the development faced the problem of testing or debugging (that is, catching errors). Today I will tell how this can be done without special IDEs, using only the tools directly included in the flex sdk package.
So first we will type the text of our program, which will be in the HelloWorld.as file: package { import flash.display.Sprite; import flash.text.TextField; import flash.display.Stage; import flash.events.MouseEvent; public class HelloWorld extends Sprite { public function HelloWorld() { trace ('my mess'); var _text:TextField = new TextField(); _text.text = 'Hello World'; addChild(_text); stage.addEventListener(MouseEvent.MOUSE_DOWN, myTrace); } private function myTrace(event:MouseEvent):void { trace('down'); } } }
As we see here there is a conclusion of one message at the beginning of the program launch and another output by clicking on the stage. Now we compile our program in the terminal: mxmlc HelloWorld.as -debug=true
Notice the -debug = true flag, which tells the compiler not to ignore trace commands, but how to get errors. After that, you need to run the flex debuger directly with the command: fdb then let us know which file to test: file HelloWorld.swf Now let's run the test with the command: run Upon execution of this command, the default flash player should open, check that this is the debug version of the player. Finally, let's connect to our player by the memory: continue after that, the player will see the result of the program, and the output will appear in the terminal. And in order to test applications on the Internet, it is enough to transfer the url-address to file.