Search code examples
jsflflash-cs5.5

Read property of document class of FLA file using jsfl script



I create a script (document class) and attack into a FLA file.
Document class here.

public dynamic class MainClass extends MovieClip
{
    public var xPos:int;
    public var yPos:int;
}


Now, I run a jsfl script to read value of xPos & yPos of document class. But It does not work:

var obj = new MainClass();
fl.trace(obj.xPos+":"+obj.yPos); // edited

How can I do that?

Thanks.


Solution

  • First, ActionScript classes aren't present in JSFL. The JS in JSFL stands for JavaScript, which is a different language from ActionScript.

    Second, in order to access an objects properties (in either AS or JS) you need to use a reference to the object itself.

    var obj = new MyKlass();
    fl.trace(obj.xPos+":"+obj.yPos);