0

I have two swf files. First (let's call it A) one is a kind of host application with login UI, etc. The second one (B) is generated by Unity. So, A after some actions from user load and starts B. At this point I can easily call B (AS3) method from A (C#) and it works, but I can't call A (C#) methods from B (AS3). There is no any information about this direction communication on official documentation page.

So, I've tried this way, but it doesn't work for me. So what 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 with 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, it crashes with this error:

[Fault] exception, information=ReferenceError: Error #1065: Variable FlashCB is not defined.

Am I doing something wrong?

1 Answer 1

1

I don't know what's about Unity, but I've also made a C# app with Flash inside. I used this code, and it works fine:

AS3:

ExternalInterface.call('myfunction', >params<);

C#:

flashPlayer.FlashCall += new _IShockwaveFlashEvents_FlashCallEventHandler(flashPlayer_FlashCall); //this var is your Flash
private void flashPlayer_FlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
{
    //your flash call handler here
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, but this is not what I'm looking for. I have a C# Unity project which is converted to AS3 (swf) and have to communicate with another nested swf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.