I am trying to build a swf file using actionscript code. I have downloaded Flex SDK. Now I am trying to compile .as file. It works fine and compiles into .swf file using the following command from the bin folder of Flex Home. .
Command: /mxmlc /home/anshul/Downloads/HelloWorld/src/Main.as
FileName: Main.as
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
public class Main extends Sprite
{
public function Main():void
{
if (stage) init();
}
private function init(e:Event = null):void
{
var tf:TextField = new TextField();
tf.text = "Hello, world!, Lets see working or not";
addChild( tf );
}
}
}
This is a basic example and works fine. But if I add a import,
import flash.net.NetworkInfo;
then it throws the following error Error: Definition flash.net:NetworkInfo could not be found.
I have gone through various tutorials but can't seem to make it work. So do I need to include any library while running the command?
As @akmozo said,
flash.net.NetworkInfo
is an AIR class, so you need to include the AIR config in your build command: