Your SlideShare is downloading. ×
Flex with AMFPHP
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Flex with AMFPHP

3,984
views

Published on

Using AMFPHP with Flex 3 to build a CRUD Application

Using AMFPHP with Flex 3 to build a CRUD Application

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,984
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
50
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Using AMFPHP with Flex 3 to build a CRUD Application By- Shreyas Tonse Final Year B Tech Student @ NIT-K, Surathkal
  • 2. Why PHP?
    • Easy to learn and get working (I use WAMP)
    • Designed for the Web
    • Open Source – Collaborative development
    • Lots of open source code & samples
    • Popular with the student community
  • 3. What is AMFPHP?
    • AMF (Action Messaging Format)
    • Uses a binary format for serialization
    • AMFPHP is a PHP open source library
    • Allows PHP Classes to talk to Flex
  • 4. Why AMFPHP?
    • Faster than any other means of communication
    • Allows Flex to send and receive AS strongly typed objects
  • 5. Setting it up
    • http://sourceforge.net/projects/amfphp/files/#files
    • Paste in into your web root
    • gateway.php to verify clean install
  • 6. Writing a Service
    • Use of Object Oriented PHP
    • CRUD => use of getters and setters
    • Can be used to return a single value, key value pairs
    • Return Objects
  • 7. Testing the Service
    • AMFPHP Browser
    • Make test calls
    • Gives elaborate statistical info
  • 8. Using the Service in Flex
    • The RemoteObject:
    •  
    • <mx:RemoteObject id=“yourRemoteObject&quot; source=&quot; yourAMFPHPClassName.ThePHPFile &quot; destination=&quot;amfphp&quot; showBusyCursor=&quot;true&quot;>
    •     <mx:method name=&quot; theFunctionYouWantToCall &quot; result=&quot;myFunctionResultHandler(event)&quot; fault=&quot;myFunctionFaultHandler(event)&quot;/>
    • </mx:RemoteObject>
  • 9. Using the Service in Flex
    • 1. yourAMFPHPClassName is the name of the folder in amfphp/services
    • 2. ThePHPFile is the PHP class file.
    • 3. You need the <mx:method name=&quot;...&quot; .../> to define the function in the PHP class you want  to call, theFunctionYouWantToCall in this case
  • 10. Using the AS Handlers
    • private function myFunctionResultHandler(event:ResultEvent):void
    • {
    • var PHPResult:String=String(event.result);
    • Alert.show(PHPResult); //will show what the PHP class returned
    • }
    • This means the PHP function has a return statement like this:
    • return $value
    • OR
    • return &quot;Test&quot;;
  • 11. Using the AS Handlers
    • private function myFunctionResultHandler(event:ResultEvent):void
    • {
    • Alert.show(&quot;Name: &quot;+event.result.name);
    • Alert.show(&quot;Age: &quot;+event.result.age);
    • }
    • This means the PHP function has a return statement like this:
    • $returnValue=array();
    • $returnValue['name']=“shreyas”;
    • $returnValue['age']=$age;
    • return $returnValue;
  • 12. Mapping Objects
    • Map Server Side VO to and from an ActionScript VO
    • Done by adding RemoteClass Meta data to your Class definition
    • Return an array of objects from AMF
  • 13. Alternatives to AMFPHP WebORB for PHP – Exists for other technologies too Zend Framework - The popular PHP framework, now supports AMF SabreAMF – A Google code project which is BSD licensed.
  • 14. Thank You
    • All resources will be put up on:
    • http://flex.tekyt.info
    • Will post this tutorial, and queries may be asked as comments
    • Twitter: @tusay
    • E-mail: shreyastonse@gmail.com