flash - How to call C# method from AS3 script? -
i have 2 swf files. first (let's call a) 1 kind of host application login ui, etc. second 1 (b) generated unity. so, after actions user load , starts b. @ point can call b (as3) method (c#) , works, can't call (c#) methods b (as3). there no information direction communication on official documentation page.
so, i've tried this way, doesn't work me. i've done:
on c# (project a) side i've created flashcb.cs:
using unityengine; using system.collections; [notrenamed] public class flashcb { public static int func() { debug.log("unity function called message. "); return 10; } } on as3 (project b) side nettest.as:
import global.flashcb; [...] public function onloadcomplete( evt : event ) : void { [...] var res:int = flashcb.func(); } finally, crashes error:
[fault] exception, information=referenceerror: error #1065: variable flashcb not defined. am doing wrong?
i don't know what's unity, i've made c# app flash inside. used code, , works fine:
as3:
externalinterface.call('myfunction', >params<); c#:
flashplayer.flashcall += new _ishockwaveflashevents_flashcalleventhandler(flashplayer_flashcall); //this var flash private void flashplayer_flashcall(object sender, _ishockwaveflashevents_flashcallevent e) { //your flash call handler here }
Comments
Post a Comment