C # and Flash

Is there a way for C # to get a list of methods that SWF provides through ExternaInterface?

+3
source share
3 answers

Update:

I just realized that I misunderstood your question, because you are looking for methods defined through Flex ExternalInterface class, and not those ones Shockwave ActiveX controlyourself; I am going to leave my initial answer below, as it may be useful regarding use SWFthrough C # in general.

ExternalInterface , Fun with # Flash Player 8 API , API # . ( Flash 8 Python #.)

, , , XML CallFunction() , Georges ( , , , ;)

!


SWF .NET COM-:

SWF Windows Adobe Flash Player ActiveX control, , .NET COM-.

() / Adobes, . Macromedia Flash Player # ( ), . .

, , . Macromedia Flash Player # Windows - , , / ActiveX Macromedia Flash Player, Visual Studio.NET.

, , Shockwave ActiveX control , ( ShockwaveFlashObjects Visual Studio 2008), Visual Studio, assembly Interop.ShockwaveFlashObjects; namespace ShockwaveFlashObjects, , , interface IShockwaveFlash, ( ) , #.

+3

swf ( ), , , ExternalInterface , ..

swf, swf, ExternalInterface, . swf INIT , , ExternalInterface.addCallback, describeType.

:

var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.INIT, loaded);
    loader.load(new URLRequest('externalInterfaceTest.swf'));
function loaded(e:Event):void{
    //get all the methods in the loaded swf
    var methods:XMLList = describeType(e.target.content).method;
    for each(var method:XML in methods){
        //get methods defined by the author/not belonging to flash.display.*,flash.events.*,etc
        if(method.@declaredBy.indexOf('flash') == -1){
            trace('\nmethod description start========================');
            trace('methodName: ' + method.@name);
            trace('returnType: ' + method.@returnType);
            for each(var param:XML in method.parameter){
                trace('parameter ' + param.@index + ' type: ' + param.@type + ' optional: ' + param.@optional);
            }
            trace('\nmethod description end\n========================');
        }
    }
}

, :

  • swf, , DocumentClass - , ,
  • swf, , ExternalInterface.addCallback

swf , .

- , swf. :

, , , , ( ). SWF .

, .

+2

, SWF #, - . , , , . ( - , ExternalInterface.addCallback.)

ActionScript , SWF .

0

Source: https://habr.com/ru/post/1716419/


All Articles