19 Replies Latest reply on Jul 5, 2010 6:22 PM by paulcortez

    New To FB. Needs Guidence.

    bobbys1015

      Hi. I created a form on Photoshop, then converted it to flash catalyst to make the bitmaps into input areas. I need to make the submit button usable on the Internet, and I need it to send the information a client inputs to my email. How do I do this on FB? Please help!

        • 1. Re: New To FB. Needs Guidence.
          paulcortez

          Hi Bob, For the conversion from Photoshop to flash catalyst, I'm sorry that is i do not know. But to send an email with the use of FB, you need a server side script depending on web server setup you have. Like PHP and ASPX for example. In my case, im using PHP (AMFPHP). Would you like to discuss this further?

          1 person found this helpful
          • 2. Re: New To FB. Needs Guidence.
            bobbys1015 Level 1

            yeah please. I am stuck.I don't understand the data services connection. I am using a web server called 000webhosting. Idk which data service to choose from or how to get the info to complete that data connection...

            • 3. Re: New To FB. Needs Guidence.
              paulcortez Level 1

              Ok :-) I see the site and they are using PHP. To give you a brief insight, FB application run on the client side and not on the server that is why during the creation of new project on FB, you are asked what server technology to use. right? In our case, let's use PHP.

               

              This is my own approach and I believe there are many ways to call PHP from AScript. Each programmer has its own technique in programming and I respect that.

              1. Download amfphp from this site: http://www.amfphp.org

                   1.a. Extract the content and upload it in your site. There is an installation procedure there so just read how to setup the amfphp.

                   1.b. Once uploaded on your site, there is a folder there fservices and under that, there is services. All our PHP class, functions or methods will be           placed under services.

              2. Let's go to PHP code:

                   Below is our class written in PHP. Create that file and save that under services folder of our amfphp in your remote server.

                   filename: email.php

              <?Php
              
              class email
              {
                   function sendMail($to, $from, $subject, $msg)
                   {
                        $eol = "\r\n";
                        $setBoundary = md5(time());
                        $mimeBoundary = "x".$setBoundary."x";
                        $status = false;
                        
                        $mailTo = $to;
                        $mailSubject = $subject;
                   
                        $headers = "From: " . $from . $eol;
                        $headers .= "Reply-to: " .  $from . $eol;
                        $headers .= "Return-Path: " . $from . $eol;
                        $headers .= "Message-ID: <".time()."-" . $from . $eol;
                        $headers .= "X-Mailer: PHP v".phpversion() . $eol;
                   
                        $headers .= "MIME-Version: 1.0\n";
                        $headers .= "Content-Type: multipart/mixed;";
                        $headers .= "boundary=\"".$mimeBoundary."\"\n";
                   
                        $mailMessage = "--".$mimeBoundary."\n";
                        $mailMessage .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
                        $mailMessage .= "Content-Transfer-Encoding: 7bit\n\n";
                        $mailMessage .= $msg . $eol . $eol;
                        $mailMessage .= "--".$mimeBoundary."\n";
                   
                        $status = mail($mailTo, $mailSubject, $mailMessage, $headers);
              
                        return $status;
                   }
              }
              
              ?>
              

               

              3. Now let's move to flashbuilder. Create a project (I suggest you create a new one first to test your FB application). Insert the following code below inside the button event handler or anywhere you like to invoke the process.

              Flashbuilder:

              import flash.net.*;
              
              protected function btnSendMail_clickHandler(event:MouseEvent):void
              {
                   var netConn:NetConnection = new NetConnection();
                   var responder:Responder = new Responder(onResult);
              
                   netConn.connect("http://www.yoursite.com/fservices/gateway.php"); // Check for your correct path
                   netConn.call("email.sendMail", responder, "to@testsite.com", "fromme@testsite.com", "My Sunject here", "Ang message ko (my message)");
              
              /** netConn.call will execute the function you made under email class in PHP.
              *   The 1st parameter pointing your class and function to call. 2nd is your responder. and last are parameters
              */  inside your sendMail function.
              
                   function onResult(value:Object):void // this function could be placed outside this function
                   {
                        Alert.show(value.toString());
                        // read amfphp doc for the different return datatype 
                   }
              }
              

               

              4. Run your application and test it in livesite. Please check http://www.000webhost.com first if they support email function of PHP.

               

              I hope this one will help :-)

               

              Anyway, previously before amfphp, I'm using URLRequest, URLLoader and URLVariable function under flash.net package but i find it so slow in retrieving my data.

              1 person found this helpful
              • 4. Re: New To FB. Needs Guidence.
                bobbys1015 Level 1

                Wow this is great.

                 

                I downloaded the files and placed them in the public_html directory in the webserver. Also I placed the other email portion in my FB project. It says I have some errors.

                */  inside your sendMail function.
                
                and
                
                 function onResult(value:Object):void // this function could be placed outside this function
                
                
                

                Both of these things were highlighted as errors. Do I ignore them? will they effect my FB Project?

                 

                Also, I know this might sound stupid to you but how would you export the FB Project on my site? Do I connect the server by using the data services? or do I just upload the file to the root directory?

                • 5. Re: New To FB. Needs Guidence.
                  paulcortez Level 1

                  I'm sorry bob. I failed to include inside your sendMail function inside the comment tag. It should be:

                   

                  inside your sendMail function. */
                  

                   

                  Place the closing comment tag after my comment. Sorry for that one.

                   

                  For uploading, there is bin-debug that is automatically created and output files are all there. Just upload the content and you'r good. By the way, I still have pending issues in terms of preloader of FB and i'm still seeking help. I have another thread here that said export your project and choose Export Release. But as of today, all the files at bin-debug was uploaded to the web server where your fservices is also at.

                  • 6. Re: New To FB. Needs Guidence.
                    bobbys1015 Level 1

                    oh okay. Well you are awesome thank you. . I uploaded the files on my site.. but when I veiw the site it shows the index and then the files... not the actual created site. If you figure out the rest please let me know. . Again thank you.

                    • 7. Re: New To FB. Needs Guidence.
                      paulcortez Level 1

                      Can I ask for the link to your site? I could not visualize what you mean :-) Your web server is looking for default document to run. its either index.html or index.php. Depends on your settings.

                      • 8. Re: New To FB. Needs Guidence.
                        paulcortez Level 1

                        Here's the link to my discussion thread: http://forums.adobe.com/message/2932989#2932989

                         

                        Right click on your project, select Export. Expand Flash Builder and choose Release Build. Click next and just follow the instruction on the wizard screen. After exporting, bin-release folder will be created (or updated). Copy the files there and paste it on the root folder on your webserver and not inside the fservices that i mentioned. Maybe you are confused with that one. hehe :-) i'm sorry bob.

                        • 9. Re: New To FB. Needs Guidence.
                          bobbys1015 Level 1

                          its www.bsuaveproductions.tk . it is loading the index .html file your right. How do I make it change to the Main.html or Main.swf file?

                          • 10. Re: New To FB. Needs Guidence.
                            paulcortez Level 1

                            Ok. I see. Here's the thing you need to do:

                             

                            1. avoid using spaces in naming your folder. amfphp will do or amf. (Some script will escape when spaces are encountered. Meaning, your program is prone to errors).

                             

                            2. Folder path is deep. bring amfphp 1.9 folder higher. I mean cut amfphp 1.9 inside amfphp 1.9 folder, then back one level and paste it there. This will have this path: amfphp 1.9/gateway.php (or amfphp/gateway.php if you were able to rename it) and not this one: amfphp 1.9/amfphp 1.9/gateway.php.

                             

                            3. I see that your website is under amfphp 1.9/amfphp 1.9/services/Flash Builder path. That is not where your web files should be. It should be on your root directory. Root directory is where your amfphp 1.9 folder is. Paste it there so they are right next to each other and not inside amfphp 1.9.

                             

                            You should have this files in your root directory:

                            amfphp 1.9

                            Main.html

                            Main.swf

                            amf_config.ini

                            framework_4.0.0.14159.swz

                            gateway.php

                            history/

                            osmf_flex.4.0.0.13495.swz

                            playerProductInstall.swf

                            rpc_4.0.0.14159.swz

                            spark_4.0.0.14159.swz

                            sparkskins_4.0.0.14159.swz

                            swfobject.js

                            textLayout_1.0.0.595.swz

                             

                            4. Rename Main.html to index.html.

                             

                            Try this Bob. Let me know if you have it successfully. hehe :-)

                            • 11. Re: New To FB. Needs Guidence.
                              bobbys1015 Level 1

                              Okay . Well while I am doing that I was wondering if I did this right. If you don't mind .

                              \

                              import flash.net.*;
                                             
                                             protected function btnSendMail_clickHandler(event:MouseEvent):void
                                             {
                                                  var netConn:NetConnection = new NetConnection();
                                                  var responder:Responder = new Responder(onResult);
                                                  
                                                  netConn.connect("http://bsuaveproductions.tk/amfphp/gateway.php"); // Check for your correct path
                                                  netConn.call("email.sendMail", responder, "mailto:no-reply@bsuaveproductions.tk", "mailto:no-reply@bsuaveproductions.tk", "My Subject here", "Any message here (my message)");
                                                  
                                                  /** netConn.call will execute the function you made under email class in PHP.**/
                                                  /**   The 1st parameter pointing your class and function to call. 2nd is your responder. and last are parameters
                                                  **/
                                                  
                                                  function onResult(value:Object):void // this function could be placed outside this function
                                                  {
                                                       Alert.show(value.toString());
                                                       // read amfphp doc for the different return datatype 
                                                  }
                                             }
                              
                                        ]]>
                              
                              • 12. Re: New To FB. Needs Guidence.
                                bobbys1015 Level 1

                                Oh man. I changed the gateways location in flash builder and up loaded the new files. and I renamed the amfphp folder. But now the page is blank.

                                 

                                I have one question. The amf_config.ini file has instrustions:

                                [zend]
                                
                                ;set the absolute location path of webroot directory, example:
                                
                                ;Windows: C:\apache\www
                                
                                ;MAC/UNIX: /user/apache/www
                                
                                webroot =C:/wamp/www
                                
                                 
                                
                                ;set the absolute location path of zend installation directory, example:
                                
                                ;Windows: C:\apache\PHPFrameworks\ZendFramework\library
                                
                                ;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
                                
                                ;zend_path =
                                
                                 
                                
                                [zendamf]
                                
                                amf.production = false     
                                
                                
                                

                                What do I do here? Would my root be public_html/?

                                 

                                and is the framework_4.0.0.14159.swz the zend file?

                                • 13. Re: New To FB. Needs Guidence.
                                  paulcortez Level 1

                                  Yes. public_html is your root directory.

                                   

                                  I guess you build your project using zend framework. Here, I have sample running program. Just download and extract.

                                   

                                  - Download send e-mail application. Just unzip this file to your public_html root directory. email.php also included here as well as the amfphp so you could cleanup your root directory and upload these files. If you are wondering where I get index.html, that was originally sendMail.html which I renamed since index.html was my default web document.

                                   

                                  - Source code. Your reference to a source code.

                                   

                                  I did not setup Zend framework because of amfphp.

                                  • 14. Re: New To FB. Needs Guidence.
                                    bobbys1015 Level 1

                                    Okay. Just to make sure the public_html.zip file goes into the root directory. the email.php is already in this file. I can clean up my root directory and put the extracted public_html files in it.

                                     

                                    Okay now with sendMail.zip I am a bit confused. Is it supposed to be an example of the project I want on the site? also I don't know where you got the .services folder. Is FB supposed to generate it?

                                    • 15. Re: New To FB. Needs Guidence.
                                      paulcortez Level 1

                                      Okay now with sendMail.zip I am a bit confused. Is it supposed to be an example of the project I want on the site? also I don't know where you got the .services folder. Is FB supposed to generate it?

                                       

                                      yes. sendMail.zip is an archive of source code. Just import it in your FB.

                                       

                                      Regarding services folder, are you referring to services inside amfphp folder? that was not part of FB. that was amfphp added on the same root folder of your webfiles. Did you make it working?

                                      • 16. Re: New To FB. Needs Guidence.
                                        bobbys1015 Level 1

                                        The sendmail works. . Now do I just up load my project in place of the sendmail documents? It should work then right?

                                        • 17. Re: New To FB. Needs Guidence.
                                          bobbys1015 Level 1

                                          okay I got it thank you! However, with the contact from I already made does the email.php work for it. There are more input fields than the standard Name, Subject and Message.

                                           

                                          Also... what is the standard pixel size for a webpage??

                                          • 18. Re: New To FB. Needs Guidence.
                                            paulcortez Level 1

                                            Great! good to hear that.

                                             

                                            Yes it will work if you do this process:

                                             

                                            1. Right click on you Project.

                                            2. click on Export.

                                            3. On export window, expand Flash Builder and select Release Build.

                                            4. Click next. Just leave other settings on default and click Finish.

                                             

                                            You will have then bin-release folder. All files inside your bin-release are compiled swf files and that is the files you will upload on the web.

                                             

                                            Happy coding

                                            • 19. Re: New To FB. Needs Guidence.
                                              paulcortez Level 1

                                              72 is the default resolution. that is 72 pixel per inch.