Amethyst Tutorials

Back to -Tutorials -Amethyst Tutorials

Debug From .NET Into ActionScript

...and back again!

If Amethyst were to pick just one ’killer feature’ of Amethyst, this would be it! Amethyst let’s you debug between .NET and Flash applications in a single debugging session.

So if you have a Flash Platform application that cooperates with a C# or VB.NET application, you can set breakpoints in both applications and step from one to the other pretty much as you would in a regular single-language program.

One Debugging session, two languages (C#/ActionScript) and two frameworks (.NET/Flex) – the C# code is in the top window, the ActionScript below. Using Amethyst I can step from one program to the other in a single debugging session!

This video provides a simple example of how to do cross-platform debugging with C# and Amethyst. If you want to try this out yourself, we’ve bundled up the code into ready-to-use solutions for VS2008 and VS2010.

- Download Demo Solutions

This is a summary of what you need to do to use this:

- Rebuild Solution for debugging
Note: You must have the debug version of the Flash Player and the Debug option must be checked in both the C# and Amethyst Project properties (this is on the Compiler tab in Amethyst)
- Set a breakpoint on ExecCommand in and set a breakpoint on OnFlashCall in Form1.cs
- Select the DebugDemo Amethyst project in the Solution Explorer
- From the Debug menu select Listen. Amethyst is now listening for SWF debug messages - Select the Test C# project in the Solution Explorer - Right click the Test project node and select Debug, then Start New Instance

You should now see the C# form appear.

- Click Start DebugDemo in the running C# application.
- The DebugDemo SWF should now break on ExecCommand.
- Press F5 to continue.
- Click Send Command to Flash.
- The C# program should break on OnFlashCall as the DebugDemo SWF calls the C# program back.

NOTE: When embedding Flash into a Windows application your .NET program needs to reference a DLL which wraps up the Flash OCX. We have supplied the AxFlash.dll for this purpose. You simply need to add this DLL to the References node of your .NET program.

The AxFlash.dll was generated using Microsoft’s ActiveX Control Importer (Aximp.exe) which is available here: If you prefer to make your own DLL wrapper for Flash, you should run this program using the Flash OCX as input. This OCX may (for example) be found at: C:\Windows\System32\Macromed\Flash\Flash10k.ocx though the actual folder location and the OCX file name may vary.

Bookmark and Share   Keywords:  .NET  ActionScript  Amethyst  tutorial

Debug Demo

C# and Amethyst solutions to demo cross-language debugging in VS2008 and VS2010

42.8 kb
© SapphireSteel Software 2014