mercredi 15 mars 2017

Keep typing between Typescript and ActionScript 3

Is it possible to use Javascript object in parameter with Actionscript function bind with ExternalInterface.callBack method and get an instance of ActionScript class as parameter other than Array or Object ?

My purpose is to keep typing between Javascript and Actionscript.

//Javascript

var swfObject = document.getElementById(‘mySwfObject’);

var user = {
    id : 1337,
    name : ‘Foo’,
    surname : ‘BAR’
}

swfObject.myFunction(user);


//Actionscript 3

ExternalInterface.addCallBack(“myFunction”, myFunction);

// Now
private static function myFunction(user : Object)  : void
{

}

// With your help
private static function myFunction(user : UserDTO) : void
{

}

Aucun commentaire:

Enregistrer un commentaire