hide side navigation
    5 most recent
    Web Services
    Library's
    Component's
    Applications
    Articles
  Flash streaming servers  Flash button as Flex icon  Flex form by email  Hello Remoting with AS3  AS3 Saving data from Flash  AS3 Loading data into Flash  Fire Effect  Contact form  Dragable buttons  Hello World with openamf  Loading helper classes  Upload with Flash 8  Transitions effects  Snapshot with Flash 8  Hello World Remoting AS2  Flash AS2 Remoting Connector  Saving data from Flash  Loading data into Flash  FlashCom & Remoting login  Cell Renderer API  Editing a table using remoting components  Flash MX2004 web service classes  Browsing a catalog  amfphp Documentation  Hello World Remoting  Online Store with AMFPHP  Flash clients for Web Services  Web Service Walk Though with NuSoap  Popup windows in flash with javascript  Installing Apache/PHP  MoreOver News Feeds  Load Edit Save Text Files via CGI  Save Movie Clip Postion via PHP and MySQL
Current Page (1) Next Page >>  View Article Example >> 1 | 2 | 3 | 4

The Scene & components:

Let us see a general image of the form, with all the enumerated components.

Imagen general

Number
Kind of component
Name
Variable
1
Input text
FirstName
2
Input text
Email
3
Input text
Company
4
Input text
Comments
5
Input text
About
6
Button clip
7
Dynamic text
textos
EmailStatus

Layers and its programming:

We are going to enumerate the keyframes that contain programming.

Layers enumeration

On the keyframe one of the layer Buttons "1"...


 
stop
();
// This code cleans the fields when we returned of the shipment if the user wants to repeat the shipment. 
FirstName "";
Email "";
Company "";
Comments "";
About "";
EmailStatus "";

On the button send marked as "6" (image of the paragraph "The Scene & components") in the keyframe one, layer buttons "1";

 
on
(release) {
    var 
partes Email.split("@");
    var 
usuario partes[0];
    var 
dominio partes[1];
    var 
caracteresProhibidos = new Array("º""ª""!""#""$""%""&""¬""/""("")""=""?""¿""¡"","";"":""[""]""{""}""á""é""í""ó""ú""Á""É""Í""Ó""Ú");
    var 
numCaracteresProhibidos 0;
    var 
partes_dominio dominio.split(".");
    var 
extension partes_dominio[partes_dominio.length-1];
    for (var 
0k<caracteresProhibidos.lengthk++) {
        if (
usuario.indexOf(caracteresProhibidos[k]) != -1) {
            
numCaracteresProhibidos++;
        }
    }
    if (!
FirstName.length) {
        
EmailStatus "Introduce your name before the shipment";
    } else if (!
Email.length || Email == "" || Email == null || Email == "null" || Email == undefined || Email == "undefined") {
        
EmailStatus "Please, introduces a mail address";
    } else if (!
Email.length || Email.indexOf("@") == -|| Email.indexOf("@") != Email.lastIndexOf("@") || Email.indexOf(".") == -1) {
        
EmailStatus "Please, introduces a valid mail address";
    } else if (
usuario.length<3) {
        
EmailStatus "The user mail chain is too short";
    } else if (
dominio.indexOf(".") == -|| dominio.length<1) {
        
EmailStatus "The mail domain name does not seem valid";
    } else if (
numCaracteresProhibidos>0) {
        
EmailStatus "They do not admit this type of characters in the mail address";
    } else if (
dominio.length-extension.length<4) {
        
EmailStatus "A name of so short domain for a mail address does not exist";
    } else if (
extension.length<|| extension.length>4) {
        
EmailStatus "The mail domain name is not correct";
    } else if (!
Comments.length) {
        
EmailStatus "Your commentaries are important for us";
    } else {
        
EmailStatus "";
        
play();
        
//If everything is correct, we drained the text field of State of the form and we continued the animation to the next keyframe, where we will make the communication with AMFPHP and we will send the data, awaiting the result. 
    
}
};

On the keyframe two of the layer Buttons "2"...

 
stop
();
// Import the remoting class and debuger to send the message and to analyze the responses of the communication.
import mx.remoting.*;
import mx.rpc.*;
import mx.remoting.debug.NetDebug;
// We declared the address in which we have installed AMFPHP.
// We have two options Here..
// One, that the form is within a presentation CD, outside our server, with which the URL would have to be "http://www.yourserver.com/amfphp/gateway.php".
// Two, that the form this in  our server, with which we could use a relative or semiabsolute URL to indicate where to find our door to him AMFPHP.
var gatewayUrl:String "/amfphp/gateway.php";
// We initiated the debuger to be able to control the results.
NetDebug.initialize();
//  We declared the service to which it must call.
var service:Service = new Service(gatewayUrlnull'maileador');
// And the corresponding instruction of which it must be pending.
var pc:PendingCall service.mailear(FirstNameCompanyEmailCommentsAbout);
// The answer relay, as much if it obtains it, as if it gives error.
pc.responder = new RelayResponder(this"handleResult""handleError");
// If the result is valid, it will put the message that commands to us in the text field of State of the form, concretely the word "Sending" and will start up the animation.
function handleResult(re:ResultEvent) {
    
textos.text re.result;
    
tempor.play();
}
// If the result fails,  shows it in the text field of State of the form and sends us to keyframe 1.
function handleError(fe:FaultEvent) {
    
textos.text 'There was an error';
    
gotoAndStop(1);
}

Current Page (1) Next Page >> 1 | 2 | 3 | 4