hello everyone im having some trouble meaking a php contact form the error
that returns me is this :
TypeError: Error #1034: Type Coercion failed: cannot convert
fl.controls::Button@2e35f0b1 to flash.display.MovieClip.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at com.gaiaframework.templates::AbstractBase()
at com.gaiaframework.templates::AbstractPage()
at com.FGaiaLT.pages::FormPage()
i would appreciate your help really im just a nob.
i dont know if somethins is wrong i just get the code from a tuto on
internet and tried to adapt it but with no good resul, so if someone can
check it or give me another direction, i just need to make a contact form
with a combobox and a status mesage of your message has been sent or
something like that and thats it.
this is my code:
package com.FGaiaLT.pages
{
import com.gaiaframework.templates.AbstractPage;
import com.gaiaframework.events.*;
import com.gaiaframework.debug.*;
import com.gaiaframework.api.*;
import flash.display.*;
import flash.events.*;
import com.greensock.TweenMax;
import flash.text.TextField;
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.net.URLRequestMethod;
import flash.net.URLLoaderDataFormat;
public class FormPage extends AbstractPage
{
public var status_txt:TextField;
public var name_txt:TextField;
public var name2_txt:TextField;
public var email_txt:TextField;
public var tel_txt:TextField;
public var msg_txt:TextField;
public var processing_mc:MovieClip;
public var submit_btn:MovieClip;
public var cList:MovieClip;
public function FormPage()
{
super();
alpha = 0;
// hide processing CM
processing_mc.visible = false;
// custom function we create to populate the comboBox list
addCToList ();
// Add event listener for submit button click
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
}
override public function transitionIn():void
{
super.transitionIn();
TweenMax.to(this, 0.3, {alpha:1, onComplete:transitionInComplete});
}
override public function transitionOut():void
{
super.transitionOut();
TweenMax.to(this, 0.3, {alpha:0,
onComplete:transitionOutComplete});
}
private function addCToList ():void
{
cList.addItem( { label: "Publicidad en Facebook" } );
cList.addItem( { label: "Publicidad en Google" } );
cList.addItem( { label: "Publicidad via Correo electronico" } );
cList.addItem( { label: "Volantes o Trifoliares" } );
cList.addItem( { label: "Referencia de un Amigo o Familiar" } );
cList.addItem( { label: "Paso frente a nuestras instalaciones" } );
cList.addItem( { label: "Otro" } );
}
// handler for the PHP script completion and return of status
private function completeHandler(event:Event):void
{
// remove processing clip
processing_mc.visible = false;
name_txt.text = "";
name2_txt.text = "";
name_txt.text = "";
tel_txt.text = "";
msg_txt.text = "";
// Load the response from php here
status_txt.text = event.target.data.return_msg;
}
// function ValidateAndSend
private function ValidateAndSend (event:MouseEvent):void
{
// validate fields
if(!name_txt.length)
{
status_txt.text = "Porfavor ingrese su nombre";
}
else if(!name2_txt.length)
{
status_txt.text = "Porfavor ingrese el nombre de su pequeño";
}
else if (!email_txt.length)
{
status_txt.text = "Porfavor ingrese su correo";
}
else if (!msg_txt.length)
{
status_txt.text = "Porfavor ingrese el mensaje";
}
else
{
// build variable name for the URL Variables loader
var variables:URLVariables = new URLVariables;
// Build the varSend variable
var varSend:URLRequest = new URLRequest("form_parse.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
// All is good, send the data now to PHP
processing_mc.visible = true;
// ready the variables in our form for sending
variables.userName = name_txt.text;
variables.userName2 = name2_txt.text;
variables.userTel = tel_txt.text;
variables.userEmail = email_txt.text;
variables.userMsg = msg_txt.text;
variables.userCList = cList.value;
// Send the data to PHP now
varLoader.load(varSend);
// close else condition for error handling
}
// close validate and send function
}
}
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders