|
|
|
|
![]() ![]() |
Nov 2 2005, 02:12 AM
Post
#1
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 51 Joined: 28-October 05 From: mexico Member No.: 13,497 |
AMFPHP in a short way is a library of php files that let u manage in
JUST ONE FILE what u would do in many files like for example queries to mysql. So u can have tons of queries to mysql and all of them in just ONE FILE! so what is a RIA? a RIA is a Rich Internet Application commonly given to flash applications, not the animations or presentations we see daily on the internet but very useful and cool programs made in flash. the fisrt step u need to take is to download the AMFPHP library directly from its site at www.amfphp.org, in some free hosted sites the latest versions doesnt run but the .9 version does...happily at trap17.net i could run the latest version 1 milestone 3 and some of the main changes (since the milestone 1) include the utf8_decode so u can store frech, spanish, german names, streets etc. ok now while u are downloading AMFPHP lets go to the flash side, u can download the latest version at macromedia.com (latest is 8) and as we want to trace every action we perform we should (for sure) download the remoting components (http://www.macromedia.com/software/flashremoting/downloads/components/) it helps to build easily our RIA..ok i'll wait while u download it... alredy downloaded it... so lets go to the construction of our first mini RIA: Installation NOTE: first install Flash 8 and then the remoting components the first time u open flash u'll see the welcome window and a bunch of typefiles u can choose from... and as we want to just start, choose the flash file (fla), after u load ur new document by default Flash has some opened panels but maybe the components panel is not! so if it is not opened in the right panel go to Window>Component Panel and u'll see that that new panel opens and some "compenent directories are shown", look very closely to the User Interface and Data Components that are the ones we are gonna use... oh! we finished downloading AMFPHP good!... we are not gonna change anything from any file just uncompress the folder and give a name like "flashservices" (just for fun hosting server, site or just move the folder if u are running a webserver in ur computer to the root folder of the folder that ur server use to use the files eg. for IIS the folder is C:\Inetpub\wwwroot and for apache in my computer is C:\Program Files\Apache Group\htdocs... now it fits just like this: >http://localhost/flashservices< lets leave AMFPHP and continue with flash...now that we have seen the Groups's Components drag a Combobox, a DataGrid, a TextArea and Three buttons give each component an instance name for the combobox>cb, for the Datagrid> dg fo the textArea> ta_txt and for the buttons> btn1, btn2, btn3 and put each button below each component i mean below the combobox the btn1 and so on... ok now that u have the compoents positioned in the stage go again to the Components Panel and drag 3 Dataset from the Data group and 3 RemotinConnector from the Data Components Group(in flash 8, in previous versions both are under Data Componets) and give an instance name for each component such as ds_1 and r_con1 and so on.... ok now lets bind each component to be able to drive the data to the correct place... select the r_con1 and in the component inspector(if it is not opend go to Window>Component Inspector) select BINDINGS and click on the big + and select Results:Object and then click ok...u'll see an item is added below, click the item and in its properties select "bound to:" and select the ds_1... do the same thing with the rest of the components... now u finished binding the components click on the FIRST frame and go to ACTIONS (if it is not opend press F9) and paste this code: CODE btn1.onPress=function(){ r_con1.trigger(); } btn2.onPress=function(){ r_con2.trigger(); } btn3.onPress=function(){ r_con3.trigger(); } ooops! i almost forget select the remoting connectors and modify its gateway to ur current location (where u put the flash services folder) e.g. http://localhost/flashservices/gateway.php and for the service write myTest and for the method of each component write myCb for the remotingconnector of the combobox, myDg for the datagrid's and myText for the TextArea's... ok now we finished the flash side in amfphp files are stored as classes it means the name of the file is gonna be called as the class conatained in it... also is good to mention that u must declare each function that is gonna be used in order to be recognized by php... copy this file under flashservices>services folder and save the file as myTest.php CODE <?php class myTest{ //change to match your needs var $dbhost = "localhost"; var $dbname = "ur database name"; var $dbuser = "ur user"; var $dbpass = "ur password"; function myTest(){ $this->methodTable = array( "myDg" => array( "description" => "Returns products table", "access" => "remote" // available values are private, public, remote //"arguments" => array ("message") ), "myCb" => array( "description" => "Returns products table", "access" => "remote" // available values are private, public, remote //"arguments" => array ("message") ), "myText" => array( "description" => "Echoes the passed argument back to Flash (no need to set the return type)", "access" => "remote", // available values are private, public, remote "arguments" => array ("rs") ) ); // Initialize db connection $this->conn = mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass); mysql_select_db ($this->dbname); } function myDg(){ return mysql_query("select * from mydg"); } function myCb(){ return mysql_query("select * from mycombo"); } function myText(){ return mysql_query("select myText from mytext") } ?> ok we are almost done... now set up three tables with phpMyAdmin called "mydg, mycombo and mytext" for the mydg table set up these fields ID, Name; for the mycombo set up JUST myNames and for text use ID and myText... in the mydg table write new records as follows: ID Name 1 Andrés 2 Güero fo mycombo table set: myNames Andrés Güero and finally for myText: Andrés is a Güero friend after u save all this info u can return to flash publish ur work and pressed ur buttons to see the results! and using the utf8_decode.... now we are done! cheers! This post has been edited by BuffaloHELP: Nov 5 2005, 12:15 AM |
|
|
|
Aug 7 2008, 07:43 AM
Post
#2
|
|
|
Hail Caesar! ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 5,876 Joined: 21-September 07 Member No.: 50,369 |
Problems in IIS 7
Getting Started With Amfphp And Rias Hallo my frined, Firstly let me thank you for this helpfull example. I followed all the steps of the example one after the other but unfortunatelly it doesn't working. I also found that when I am typing in url: //localhost/flashservices/browser/ then it comes up a page that needs a simple registration (which unfortunately doesn't works). I have Windows Vista Premium with IIS 7. Could you please post an example for Vista and IIS 7, or give some details who to solve this problem ? Thank you -reply by kostas |
|
|
|
Aug 19 2008, 11:37 PM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 8 Joined: 19-August 08 Member No.: 66,638 |
hey bro my friend was looking for this i gave him the link and he like everything you said and he want me to say thank you so thank you very much
and hope this will help other people like it helped my friend |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 12th October 2008 - 04:23 PM |