Inline ActionScript support.
When targetting the Flash Player, it is often convenient to be able to execute some manually written ActionScript. Examples of this would be: talking to some flash API (think networking, sockets), running some existing ActionScript code, or integrating with some 3rd party ActionScript library. You can call "handwritten" ActionScript methods, and get return values from them most easily like this:
import UnityEngine.Flash;
function Start()
{
ActionScript.Import("com.mycompany.mytool");
var name = "Lerpz";
var protocolversion = ActionScript.Expression.<int>("com.mycompany.mytool.GetProtocolVersionFromServer({0})", name);
}
using UnityEngine.Flash;
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Start() {
ActionScript.Import("com.mycompany.mytool");
string name = "Lerpz";
int protocolversion = ActionScript.Expression<int>("com.mycompany.mytool.GetProtocolVersionFromServer({0})", name);
}
}
import UnityEngine.Flash
import UnityEngine
import System.Collections
class example(MonoBehaviour):
def Start():
ActionScript.Import('com.mycompany.mytool')
name as string = 'Lerpz'
protocolversion as int = ActionScript.Expression[of int]('com.mycompany.mytool.GetProtocolVersionFromServer({0})', name)
Import |
Causes an import directive to be emitted in the ActionScript code generated for the current type. |
Statement |
Emits a block of ActionScript code in the current method translating variable and field references to their ActionScript names. |
Expression |
Emits an ActionScript expression translating variable and field references to their ActionScript names. |