flashactionscript-3flashliteflash-cs5

fscommand2 support in Actionscript 3.0?


I am very new to Action Script. I am using Flash Professional CS5 with ActionScript 3.0. The problem is, When I am trying to use fscommand2 function, Flash Compiler throwing an error saying:

Scene 1, Layer 'Layer 1', Frame 1, Line 7   1180: Call to a possibly undefined method fscommand2.

But, I am able to use fscommand. But, it is for different purpose, so will not fulfill my requirement to get Device(Mobile) properties like DeviceID etc.

Please help me in using fscommand2 or any equivalent API support in ActionScript 3.0. Thanks in advance.


Solution

  • It depends on which fscommand2 you want to use. fscommand2 is a Flash Lite API, so the only time you'd use it with AS3 would be if you're targeting Flash Lite 4 (which supports AS3 and is back-compatible with fscommand2).

    For general AS3 development, some fscommand2 functionalities are replaced by normal AS3 APIs. For example:

    // status = fscommand2("FullScreen", true);
    // replaced by:
    stage.displayState = StageDisplayState.FULL_SCREEN;
    
    // status = fscommand2("GetTotalPlayerMemory");
    // replaced by:
    trace( System.totalMemory );
    

    But some other fscommand2 functions, like dealing with soft keys, signal level, etc. have no AS3 equivalent. Those are mainly the commands that you couldn't use in a browser anyway though, so I don't think you actually lose any functionality for browser contents.

    Anyway, the short version is that you just have to find an equivalent AS3 command for what you'd like to do - so please let us know that, or open a followup question. ;)