• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
3

FreSharp - Build Adobe Air Native Extensions using C#

Engaged ,
Apr 23, 2017 Apr 23, 2017

Copy link to clipboard

Copied

While working on WebViewANE for Windows I wrapped FlashRuntimeExtensions in C++/CLI calls to allow me to more tightly integrate with C#.

I expanded this into a NuGet package to make writing ANEs in C# quicker.

Example - Convert a FREObject into a String, and String into FREObject

var inFre = argv[0];

try {

  var airString = new FreObjectSharp(inFre).GetAsString();

  Trace("String passed from AIR:" + airString);

}

catch (Exception e) {

  Trace(@"caught in C#: type: {0} message: {1}", e.GetType(), e.Message);

}

const string sharpString = "I am a string from C#";

return new FreObjectSharp(sharpString).Get();

Example - Call a method on an FREObject

var addition = person.CallMethod("add", new ArrayList

{

  new FreObjectSharp(100),

  new FreObjectSharp(33)

});

var sum = addition.GetAsInt();

Trace("result is: " + sum);

The source and example project is available on Github

https://github.com/tuarua/FreSharp

TOPICS
Development

Views

2.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 24, 2017 Apr 24, 2017

Copy link to clipboard

Copied

Nice idea! I am happy because I am working with C# and AS3. Yay! Hehe thanks for support! Please don't forget to release with Mono / Xamarin ( Mac, Android and iOS )! Because Adobe Air works same on Android, iOS and macOS. And for Linux? I think for packing into c drive image for wine under Ubuntu with Mono / Xamarin? I'm very happy because you have saved my life for CefSharp with Air App like nw.js and Electron. That is why it is great way with C#. PS: for Android, iOS and Mac need use CefMono ( Cef for unix-used library ) PS: How do I assign stage or nativewindow as owner from C#? Is it meaning for FreObjectSharp? Thanks for answer! Sorry for my bad English!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 25, 2017 Apr 25, 2017

Copy link to clipboard

Copied

You mention CefSharp. I built the Windows version of my WebViewANE using CefSharp. FreSharp grew out of that project.

Check it out in my github.

You will see here how I attached the Cef window to the AIR window.

WebViewANE/MainController.cs at master · tuarua/WebViewANE · GitHub

I am not familiar with Mono. It's important to note this will not allow you to create ANEs for iOS/OSX etc in C#.

It is Windows only.

For the iOS and OSX version of the WebViewANE I used Swift and the native WKWebview which is much lighter and quicker.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 26, 2017 Apr 26, 2017

Copy link to clipboard

Copied

Nice job! I have downloaded and tested. It works fine. But I have problem with packing to air-runtime 😞 Because It always show crazy like bug I already set up extendedDesktop than it cannot pack to air. Only running adl with webviewANE has not problem and it works fine. PS: Why do you use Swift / C++? You know. Xamarin released since whole support with Android, iOS and Mac. I'm not sure like you want merge dll in Mac with dylib / frameworks or You can try VS code and Net core ( dotnet with platforms ). Thanks for sharing. I will improve - If I have great ideas.... 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 27, 2017 Apr 27, 2017

Copy link to clipboard

Copied

Sorry for double post because I cannot edit it. community of Adobe freezes always. - I don't understand How do I create C++ project as "MyExtensions" How did you set up creating project from Win32 project? But from me is not working. Because I have opened propriety -> general -> net target: empty field. I already set up CLR -> CLR support... And I add include and linker from Adobe Air SDK and I add existing file to header folder than I write c++ if I check "#include "" and I switch key space and it opens popup menu and but it doesn't show "FlashRuntimeExtensions.h in my project - WHY? I always tried but It doesn't work?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 27, 2017 Apr 27, 2017

Copy link to clipboard

Copied

Please study my example here.

FreSharp/example/native_library/win/FreSharpExampleANE at master · tuarua/FreSharp · GitHub https://github.com/tuarua/FreSharp/tree/master/example

The solution contains

1. Win32 App project targeting dll. This acts as the C++ entry point and is the main dll for your ANE.

2. C# Class Library. This is where you put your C# logic.

There is 1 gotcha.

To set the .NET target in project 1 you need to modify this value by opening the .vcxproj file in a text editor. I don't know why you can't set this in VS.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 27, 2017 Apr 27, 2017

Copy link to clipboard

Copied

Also the example project has

"Additional IncludeDirectories" set to C:\Program Files\Adobe\Adobe Flash Builder 4.7 %2864 Bit%29\sdks\4.6.0\include for FlashRuntimeExtensions.h.

"Additional Library Directories" C:\Program Files\Adobe\Adobe Flash Builder 4.7 %2864 Bit%29\sdks\4.6.0\lib\win

Your AIR SDK might be in a different location so update accordingly

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 28, 2017 Apr 28, 2017

Copy link to clipboard

Copied

Thanks for answer - I have submitted issues to Github. I have tried because Adobe Air freeze if I use adl or generated native-installer. What is workaround for you? Is it correct for Adobe Air SDK 19.0? or last version? My details are Adobe Air SDK 24.0 and Net Frameworks 4.6.1. Show you my video! https://www.youtube.com/watch?v=dbyEAFxDzNE

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 28, 2017 Apr 28, 2017

Copy link to clipboard

Copied

See my response on Github

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 28, 2017 Apr 28, 2017

Copy link to clipboard

Copied

Thanks for explanation! I am trying FreSharpExampleANELib.dll in FreSharpExampleANE.dll via: AppDomain and ResolveEventHandler(myresolver); I already included FreSharpExampleANELib.dll from project and generates into standalone dll. Than Adobe Air crashed again. I know there separated dlls are easy. Example http://stackoverflow.com/questions/1978046/loading-interdependent-assemblies-from-c-cli Thanks I hope you try that. I already - How do I eventhandler from AppDomain from InitController() - Is it correct main function from initController()? I saw extern "C" {} If Initializer call "initController()" or starting main-function.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 29, 2017 Apr 29, 2017

Copy link to clipboard

Copied

Is this question still relevant?

I thought we resolved everything in the GitHub ticket?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 29, 2017 Apr 29, 2017

Copy link to clipboard

Copied

No It is not related to github tickets. It is finish. Only question about embedding dll into native extension dll. Than It doesn't need to required dlls - If who forgets to pack dlls into native installer. Thanks! Nice weekend!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 19, 2018 Jun 19, 2018

Copy link to clipboard

Copied

For anyone curious. Here is an example using FreSharp to hook into the new Windows ML feature.

It also shows how we can use UWP APIs in an ANE.

GitHub - tuarua/Windows-ML-ANE: This is a Windows AIR Native Extension to test Windows ML Preview.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 21, 2018 Jun 21, 2018

Copy link to clipboard

Copied

LATEST

I definitly love your code and ideas on how to extend AIR with modern languages.

So many thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines