20.9. Calling ASP.NET Functions from Flash
Problem
You want to call ASP.NET service functions using Flash Remoting.
Solution
Use ASP.NET pages (which requires modifying the code) or, preferably, use public DLL methods (which requires no modification).
Discussion
You can call ASP.NET pages or public DLL methods as service functions from a Flash movie using Flash Remoting.
Ideally, DLL methods should be used in place of ASP.NET pages when it comes to Flash Remoting. Although some people may have hesitancy about writing/using DLLs because they require compilation, they are far more advantageous than using ASP.NET pages. Any public method of an ASP.NET DLL can be called using Flash Remoting without any modification to the DLL code. Furthermore, using DLLs allows you to separate your business logic from your presentation logic, so the same DLL can be used by multiple interfaces (Flash movies, ASP.NET pages, Windows Forms, etc.). Using DLLs for your business logic is a best practice regardless of whether you are using Flash Remoting.
To call a DLL method from a Flash movie, you should place that DLL in the web application’s bin directory and create a service object that maps to the class within it. The correct service name to use is the fully qualified class name, which must include the namespace. For example:
// Create a service object that maps to theBookclass in theOReilly.ASCBnamespace. myService = myConnection.getService("OReilly.ASCB.Book"); // Call thegetTitle( )method of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access