ZEND+FLEXÈÏÖ¤+ÊÕ²Ø
http://corlan.org/2008/11/13/flex-and-php-remoting-with-zend-amf/ ZEND+FLEXÊÕ²Ø
http://www.keithcraigo.com/archives/66ZEND+FLEXÈÏÖ¤
http://www.keithcraigo.com/archives/181ZEND+FLEXÈÏÖ¤
http://ressources.mediabox.fr/tutoriaux:flashplatform:dynamique:remoting:zendlogin:zendlogin1ZEND+FLEXÈÏÖ¤
Flex and PHP: remoting with Zend AMF
The latest PHP library to add support for AMF and remoting is Zend Framework. The preview prelease version 1.7
offers a new component Zend_AMF that lets you create Flex applications
that talk to PHP backends using remoting. Since I am a big fan of
remoting as a way to get data to your Flex/AIR clients, I wanted to add
a short post explaining how to use it. Here
is another post I wrote on remoting with AMFPHP. Actually this post is a part of a larger article
I did for Adobe Developer Connection. I want to keep it more focused, so I wrote this one.
You can download a Flex Builder project that contains the code I explain in this article from here
. Inside of the archive you will find a readme.txt file explaining what to do with it.
Installing the Zend Framework
After downloading
the Zend Framework 1.7 archive, extract the files. Next, you have to
add the library folder to your PHP include path. Open the php.ini file
and add the path to the library folder to the include_path; on my
machine looks like:
include_path = “c:htdocszend_frameworklibrary”
Next, save the file and restart your web server. You can read more about installing Zend Framework here
. With this, you’ve completed the “installation” of Zend Framework.
What is AMF and remoting and why should you use it?
If you already know these answers, you may want to skip to the next
section. Let’s start by understanding remote procedure calls. Remote
procedure calls let Flex applications make direct calls on the methods
of your server side classes. Using BlazeDS or LiveCycle Data Services
you can expose your Java
Ïà¹ØÎĵµ£º
Ê×ÏÈÔÚfademo.mxmlÖÐÉùÃ÷Ò»¸öbutton£¬²¢Ìí¼ÓÒ»¸öbtnClick·½·¨£º
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
......
1. ×î¼òµ¥µÄ¾¯¸æ´°¿Ú
ÄãÐèÒªÏȵ¼ÈëAlertÀࣺ import mx.controls.Alert;
È»ºóÔÚÏëÒªµ¯³ö¾¯¸æµÄʱºòʹÓãº
Alert.show(“ÄãÈ·¶¨ÒªÍ˳öϵͳÂð?”,“È·ÈÏ”,Alert.YES|Alert.NO,null,logout)
²ÎÊý˵Ã÷£ºµÚÒ»¸ö²ÎÊýÊÇÒªÏÔʾµÄÎı¾£¬µÚ¶þ¸ö²ÎÊýÊÇ´°¿ÚµÄ±êÌ⣬ÕâÁ½¸ö²ÎÊýÊÇ×î¾³£Óõġ£µÚÈý¸ö²ÎÊýÊǰ´Å¥£ ......
Flex EventºÍJS EventÒ»Ñù£¬¶¼´æÔÚÒ»¸öʼþÁ÷£¬Õâ¸öʼþÁ÷³£³£»áµ¼ÖÂһЩÌäЦ½Ô·ÇµÄBugÒÔ¼°´íÎó£»
Event Flow
l Capturing:
ʼþ²¶»ñ½×¶Î£¬Èç¹ûÒ»¸ö°´Å¥B1·ÅÔÚÒ»¸öPanel P1ÈÝÆ÷µ±ÖУ¬µ±ÎÒÃǽ²P1×¢²áµã»÷ʼþEP£¬½«B1×¢²áµã»÷ʼþEB,Panel p1µÄ¸¸ÈÝÆ÷ΪApplication app£»
& ......
flexºÍºǫ́½»»¥Êý¾Ý×îÖØÒªÊÇͨ¹ýÒì¹¹´«ÊäµÄhttpserivceµÄxml½á¹¹¡£¶ø¸ßЧÂʺÏÀíµÄÒì²½´«ÊäÊý¾ÝÊÇflexµÄ¿ª·¢ÖеĺËÐÄ¡£ÎҾ͹«¿ªÒ»ÏÂ×Ô¼ºÃæÏò½Ó¿ÚµÄhttpserviceµÄд·¨¡£Ï£ÍûÓÐÈË¿ÉÒÔÖ¸Õý¡£
Ê×ÏȵÚÒ»¸ö½Ó¿ÚÊǾö¶¨Í¨¹ý»ñÈ¡xmlµÄ½Ó¿Ú£º
package com.sunshine.framework. ......
ÔÚmxmlµÄapplicationÀà¿ÉÒÔͨ¹ýgeturl»ñÈ¡µ±Ç°url¡£»ñÈ¡url¿ÉÒÔÌṩһ¸öºÜºÃµÄ·½Ê½¶Ôswf´©²ÎÊý¡£ÔÚ¹«Ë¾µÄÏîÄ¿ÖоʹóÁ¿µÄÓ¦ÓÃÏà¹ØµÄ¼¼Êõ¡£¾ÍºÍ´ó¼Ò·ÖÏíÒ»ÏÂÏà¹ØµÄд·¨£¬Èç¹ûд²»ºÃ¾Í²»ÒªÐ¦»°Å¶¡£
·ÖÎöurl²ÎÊýÀࣺ
package com.sunshine.framework.control
{
import com.sunshin ......