MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 Spezifikationen Seite 30

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 40
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 29
This is the Title of the Book, eMatter Edition
Copyright © 2003 O’Reilly & Associates, Inc. All rights reserved.
28
|
Chapter 1: Introduction to Flash Remoting
Switch back to the Flash movie and change the myURL variable in Example 1-1 to
point to the .NET version of the Flash Remoting gateway, such as:
var myURL = "http://yourservername/flashremoting/gateway.aspx";
This is the only change that has to be made to the Flash movie. It is necessary
because the .NET version of the Flash Remoting gateway is implemented differently
than the Java and ColdFusion MX versions.
Save the Flash movie and test it. You should see the output from the DLL (“Hello
World from ASP.NET DLL”) in Flash’s Output window.
PHP
The Hello World application (and other applications) must be set up a bit differ-
ently in PHP than in other environments. Flash Remoting with PHP is class-based,
due to requirements of the AMFPHP library. That is to say, all Flash Remoting ser-
vices must be written as classes in PHP. To install the AMFPHP library, simply
download the source release package and copy its flashservices directory to your web
server’s document root (see Chapter 9 for additional details). Because the class is
named com.oreilly.frdg.HelloWorld, AMFPHP searches in the services path for a
HelloWorld.php file. The main flashservices directory resides under the web root,
with the AMFPHP classes in that directory. The services directory resides in this
flashservices directory as well.
When building PHP remote services, you should include a gateway.php file in your
server-side application in the directory for your current project. This creates the
Flash Remoting gateway and includes the necessary files. The gateway.php file
(shown in Example 1-6) for the Hello World example should be saved in the
webroot\
com\oreilly\frdg directory.
Create a file named HelloWorld.php and place it into the following directory, where
webroot is the root of your web server and com\oreilly\frdg\ matches the service path
specified by the initial portion of the
myServicePath variable in Example 1-1:
webroot\flashservices\services\com\oreilly\frdg
Add the code shown in Example 1-7 to your HelloWorld.php page.
Example 1-6. PHP Remoting gateway.php file contents
<?php
/* File: gateway.php
Instantiates the Gateway for the HelloWorld Application */
require_once '/app/Gateway.php'; /* Require files */
$gateway = new Gateway( ); /* Create the gateway */
$gateway->setBaseClassPath('/services/com/oreilly/frdg');
/* Set the path to where the service lives */
$gateway->service( ); /* Start the service */
?>
Seitenansicht 29
1 2 ... 25 26 27 28 29 30 31 32 33 34 35 ... 39 40

Kommentare zu diesen Handbüchern

Keine Kommentare