From your code I can say that you need to instantiate ns.PreDefCDMTypes first:
var obj:JSDynamic = new JSDynamic("ns.PreDefCDMTypes");
then call method
var result:String = obj.mergeDefinitions(typeDefinitions);
In your case typeDefinitions is a complex type -- multidimensional
collection, so in JavaScript it may appear as FLObject instance. To
prevent this, wrap your data into JSSimple instance while sending to
JavaScript:
var result:String = obj.mergeDefinitions(new JSSimple(typeDefinitions));
This will guarantee that your data will be transfered as is, like
using ExternalInterface, just copied.
If you want to preserve connection to Flash data(this means any
changes made in JavaScript will take place with original data in flash
player), check this docs
http://code.google.com/p/jsinterface/wiki/help_english#javascript
2011/10/28 neerajs...@yahoo.com <neerajs...@yahoo.com>:
--
Oleg Galaburda
http://blog.actualwave.com/
http://jsinterface.googlecode.com/
http://guibuilder.org/
ActionScript code:
package{
import aw.external.JSInterface;
import aw.external.jsinterface.JSDynamic;
import flash.display.Sprite;
public class JSITest extends Sprite{
public function JSITest():void{
super();
initialize();
}
private function initialize():void{
JSInterface.initialize();
var obj:JSDynamic = new JSDynamic("ns.TestObject");
var result:String = obj.stringifyMyList(["1", "2", "3", "4", "5"]);
trace(result);
}
}
}
Output:
1, 2, 3, 4, 5
Everything working as expected, problem is specific for your project.
Move this code to your project and try to run it.
Check if you initialized JSInterface before using.
JavaScript should be accessible(loaded) when you are trying to use it.
Run application under HTTP(use local HTTP server, for example).
Read docs, try examples.
2011/10/28 neerajs...@yahoo.com <neerajs...@yahoo.com>:
--