![]() |
![]() |
|
| Condividi questo contenuto nei Social Network: |
|
Tweet |
|
|
|
Ti stiamo aspettando: Registrati subito e gratis. Entra a far parte di una delle comunità più attive in Italia. Se hai dimenticato i tuoi dati li puoi recuperare subito. |
||||
|
|||||||||
Hey Amico Visitatore, Condividi con noi le tue idee e la tua conoscenza Aprendo una nuova discussione nella sezione Flash & ActionScript |
|
|
LinkBack | Strumenti di discussione |
|
|
#1 (permalink) |
|
User
Data di registrazione: Jul 2011
Ubicazione: cattolica
Messaggi: 33
|
Cerco aiuto per un Form in flash
Ho un sito interamente fatto in flash e ho assolutamente bisogno di integrargli all'interno un form mail. ora io non ho idea come fare su internet ho trovato form flash da mettere solo su siti in html..come cavolo faccio sono disperato sto chiedendo in tutti i forum... se siete esperti vi prego aiutatemi
|
|
Ultima modifica di Nhatan : 19-07-11 10:15. Motivo: Maiuscolo |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Moderatore
Data di registrazione: May 2008
Messaggi: 2,551
|
Ciao ventu87 benvenuto sul forum GT, ho dovuto editare il titolo per chè non conforme al regolamento, non di questo forum ma di qualsiasi forum, lo spirito di un forum è quello di mettere a disposizione di Tutti le proprie conoscenze, quello che tratteremo quà non è che deve servire solo a te, potrà servire in futuro ad altri utenti con lo stesso problema e che probabilmente nel motore di ricerca scriveranno "form in flash" ma se tu nel titolo scrivi "ragazzi aiutatemi" la discussione non verrà mai fuori, bene scusa l'introduzione ma era mio dovere, ora vediamo di cercare di risolvere il problema, ho visto che hai scritto in altri forum e che hai anche ricevuto risposte evidentemente non abbastanza esaustive perchè ancora non hai risolto, se non sbaglio stai programmando in as3, dovresti dirmi se il sito lo hai fatto tu se è un template se lo hai ereditato, per capire le tue conoscenze di flash, inoltre vorrei sapere se hai il form da integrare altrimenti ne puoi scaricare uno da quà
http://www.ffiles.com/flash/contact_..._as3_2489.html |
|
|
|
|
|
#3 (permalink) |
|
User
Data di registrazione: Jul 2011
Ubicazione: cattolica
Messaggi: 33
|
grazie
il sito l'ho fatto io ho un livello base di as3 come conoscienza..ma non ho mai integrato un form mail in un sito fatto interamente in flash ti prego dammi una mano perchè sono disperato!!tutti i form che ho trovato flash+php sono da integrare per siti in html e non so come incorporarli nel mio sito in flash ti prego aiuto!!!inoltre nel form che mi hai inviato dovrei anche aggiungere dei campi..
|
|
|
|
|
|
#6 (permalink) |
|
Moderatore
Data di registrazione: May 2008
Messaggi: 2,551
|
Allora prova cosi: copia i due movieclip presenti nella libreria del form nella libreria del tuo sito, nel frame della pagina contatti incolla questo codice e vediamo se compare il Form.
Codice:
import flash.display.MovieClip; import flash.display.Sprite; import flash.text.*; import flash.events.*; import flash.display.Graphics; import flash.display.DisplayObject; import flash.net.*; var txtBox:textBox; var cmtBox:commentBox; var status_txt:TextField; var xPos:int=300; var yPos:int=50; var labels:Array = new Array("Name","Company","Email Address","Phone Number","Comments"); function ContactForm () { headerText(); createLabels(); createFields(); addCommentBox(); createButton(); requiredFields(); createStatusField(); } function createLabels():void { yPos=50; for(var i:int=0;i<5;i++) { var label_txt=createTextField(); label_txt.name ="lbl"+i; label_txt.text = labels[i]; if(i==4) label_txt.setTextFormat(getFormat("0x000000")); else label_txt.setTextFormat(getFormat("0xFF0000")); label_txt.x=xPos-150; label_txt.y=yPos; addChild(label_txt); yPos+=35; } } function createTextField():TextField { var textFld:TextField = new TextField(); textFld.selectable=false; textFld.autoSize=TextFieldAutoSize.LEFT; return textFld; } function createStatusField():void { status_txt=createTextField(); status_txt.text = ""; status_txt.x=xPos-120; status_txt.y=yPos+125; addChild(status_txt); } function getMailStatus(str:String):void { status_txt.text = str; status_txt.setTextFormat(getFormat()); clearTextFields(); } function requiredFields():void { var label_txt=createTextField(); label_txt.text = "Required Fields"; label_txt.setTextFormat(getFormat("0xFF0000")); label_txt.x=xPos; label_txt.y=yPos+100; addChild(label_txt); } function createFields():void { yPos=50; for(var i:int=0;i<4;i++) { var txtBox:textBox; txtBox = new textBox(); txtBox.name = "txt" +i; txtBox.txt.text= ""; txtBox.txt.addEventListener(Event.CHANGE, textInput); txtBox.x=xPos; txtBox.y=yPos; addChild(txtBox); yPos+=35; } } function textInput(evt:Event):void { //trace(evt.target.parent.name); var lblName:String = evt.target.parent.name; lblName= lblName.slice(3,lblName.length); //trace("lblname " + lblName); var target:Object= this.getChildByName("lbl"+lblName); // trace(target.text); if(evt.target.text!="") target.setTextFormat(getFormat("0x000000")); else target.setTextFormat(getFormat("0xFF0000")); } function addCommentBox():void { cmtBox = new commentBox(); cmtBox.name = "cmtbox"; cmtBox.txt.text= ""; cmtBox.x=xPos; cmtBox.y=yPos; addChild(cmtBox); } function headerText():void { var hText_txt:TextField = new TextField(); hText_txt.multiline=true; hText_txt.wordWrap = true; hText_txt.selectable=false; hText_txt.autoSize=TextFieldAutoSize.LEFT; hText_txt.defaultTextFormat=getFormat(); //hText_txt.htmlText = "Please fill out the form below with your information and any questions or comments about me." hText_txt.width=stage.stageWidth; addChild(hText_txt); } function getFormat(color:String="0x000000"):TextFormat { var format:TextFormat=new TextFormat(); format.font= "Verdana"; //FONT; format.size=16;//TEXT_SIZE; format.color=color; format.bold=true; format.leading=5; format.rightMargin=10; format.leftMargin=10; format.align= "left"; return format; } function createButton():void { var sp:Sprite = new Sprite(); sp.graphics.lineStyle(1,0x666666); sp.graphics.beginFill(0xCCCCCC,1); sp.graphics.drawRect(0,0,100,25); sp.graphics.endFill(); sp.x= xPos+130; sp.y= yPos+100; addChild(sp); sp.buttonMode=true; sp.mouseChildren=false; var label_txt:TextField = new TextField(); label_txt.selectable=false; label_txt.autoSize=TextFieldAutoSize.LEFT; label_txt.text ="Send"; label_txt.setTextFormat(getFormat()); label_txt.x= (sp.width-label_txt.width)/2; label_txt.y=(sp.height-label_txt.height)/2+2; sp.addChild(label_txt); sp.addEventListener(MouseEvent.CLICK,sendData); } function sendData(evt:Event):void { var send_arr:Array= new Array(); var ctr:int=0; for(var i:int=0;i<this.numChildren;i++) { if(this.getChildAt(i).toString()=='[object textBox]') { var item:* = this.getChildAt(i); // trace("this.getChildAt(i) " + item.name); if(item.name=="txt0" ||item.name=="txt1" ||item.name=="txt2" ||item.name=="txt3") { if(item.txt.text =="") { stage.focus = item.txt; return; } else { send_arr[ctr]= item.txt.text; ctr++; } } } } var url:String = "mail.php"; var variables:URLVariables = new URLVariables(); variables.Name = send_arr[0]; variables.Company = send_arr[1]; variables.EmailAddress=send_arr[2]; variables.Phone= send_arr[3]; variables.Comments= cmtBox.txt.text; sendVariables(url, variables); } function sendVariables(url:String, _vars:URLVariables):void { var request:URLRequest = new URLRequest(url); var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.VARIABLES; request.data = _vars; request.method = URLRequestMethod.POST; loader.addEventListener(Event.COMPLETE, handleComplete); loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError); loader.load(request); } function handleComplete(event:Event):void { var loader:URLLoader = URLLoader(event.target); trace("Message: " + loader.data.msg); var msgStr:String = loader.data.msg; getMailStatus(msgStr); } function onIOError(event:IOErrorEvent):void { trace("Error loading URL."); } function clearTextFields():void { for(var i:int=0;i<this.numChildren;i++) { if(this.getChildAt(i).toString()=='[object textBox]') { var item:* = this.getChildAt(i); trace("this.getChildAt(i)fff " + item.name); if(item.name=="txt0" ||item.name=="txt1" ||item.name=="txt2" ||item.name=="txt3") { item.txt.text=""; } //trace("name " ,this.getChildAt(i).name); } } cmtBox.txt.text=""; } ContactForm () |
|
|
|
|
|
#7 (permalink) |
|
User
Data di registrazione: Jul 2011
Ubicazione: cattolica
Messaggi: 33
|
ok me lo vede ma:
1)è troppo grosso devo ridimensionarlo e non so come fare.. 2)il pulsante send ha di fianco una scritta"required field" e il tasto send non funziona come devo fare? 3)come devo modificare i vari file in modo che l'email arrivi al mio indirizzo di posta? 4)dove devo modificare per aggiungere dei campi? |
|
|
|
|
|
#10 (permalink) |
|
Moderatore
Data di registrazione: May 2008
Messaggi: 2,551
|
Aspetta una cosa alla volta, proviamo l'invio devi mettere l'indirizzo nel file php
Codice:
<?php
$name = $_POST["Name"];
$company = $_POST["Company"];
$emailaddress = $_POST["EmailAddress"];
$phone = $_POST["Phone"];
$comments = $_POST["Comments"];
$message = "Hello "." \r\n\r\n".$comments;
$message .= "\r\n Contact Person details: ";
$message .= "\r\n Name:".$name;
$message .= "\r\n company:".$company;
$message .= "\r\n email address:".$emailaddress;
$message .= "\r\n phone:".$phone;
$headers = 'From: '.$name.' <'.$emailaddress.'>' . "\r\n";
if (mail("tuoindirizzo@gmail.com", "New contact", $message, $headers)) {
echo("msg=Messages has been sent successfully");
} else {
echo("msg=Server error");
}
?>
|
|
|
|
|
|
#15 (permalink) |
|
User
Data di registrazione: Jul 2011
Ubicazione: cattolica
Messaggi: 33
|
sei un grande funziona!!!!!!l'unica cosa me la mette sulla posta indesiderata e non so il perchè...passiamo all'altro punto devo diminuire la grandezza del form,poi un problema quando clicco su send e appare il messaggio che la mai è stata spedita questo messaggio non scompare piu cè una soluzione? poi io come ti ho già detto prima ho una maschera e il form è come se non se ne accorgesse e si sovrappone a tutte le pagine..
|
|
|
|