Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-06-2011, 12:58 AM   PM User | #1
akuria
New Coder

 
Join Date: Nov 2011
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
akuria is an unknown quantity at this point
getting 1083: Syntax error: else is unexpected

i am getting this error in my code in flash builder. here is the code i have:

protected function submit_appointment_clickHandler():void
{
var Sender:String = "";
var Email:String = "";
var HomePhone:String = "";
var CellPhone:String = "";
var Address:String = "";
var City:String = "";
var State:String = "";
var ZipCode:String = "";
var Comments:String = "";
var Interests:String = "";
var Type:String = currentState;

var evValidEmail: ValidationResultEvent = emailValidator.validate();
var evValidName: ValidationResultEvent = nameValidator.validate();
var evValidCellPhone: ValidationResultEvent = cellValidator.validate();
var evValidHomePhone: ValidationResultEvent = homeValidator.validate();

if (evValidEmail.type == ValidationResultEvent.VALID
&& evValidName.type == ValidationResultEvent.VALID
&& evValidCellPhone.type == ValidationResultEvent.VALID
&& evValidHomePhone.type == ValidationResultEvent.VALID)

else{
resultLabel.text="There are Form errors";
resultLabel.setStyle("styleName", "invalid");
}
}

any help would be appreciated
akuria is offline   Reply With Quote
Old 11-06-2011, 02:29 PM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
I see a few syntax errors in your code. Try this
PHP Code:
protected function submit_appointment_clickHandler():void
{
    var 
Sender:String "";
    var 
Email:String "";
    var 
HomePhone:String "";
    var 
CellPhone:String "";
    var 
Address:String "";
    var 
City:String "";
    var 
State:String "";
    var 
ZipCode:String "";
    var 
Comments:String "";
    var 
Interests:String "";
    var 
Type:String currentState;

    var 
evValidEmail:ValidationResultEvent emailValidator.validate();
    var 
evValidName:ValidationResultEvent nameValidator.validate();
    var 
evValidCellPhone:ValidationResultEvent cellValidator.validate();
    var 
evValidHomePhone:ValidationResultEvent homeValidator.validate();

    if (
evValidEmail.type == ValidationResultEvent.VALID
        
&& evValidName.type == ValidationResultEvent.VALID
        
&& evValidCellPhone.type == ValidationResultEvent.VALID
        
&& evValidHomePhone.type == ValidationResultEvent.VALID)
    {
        
resultLabel.text="Thank you.";
        
resultLabel.setStyle("styleName""valid");
    }
    else
    {
        
resultLabel.text="There are Form errors";
        
resultLabel.setStyle("styleName""invalid");
    }

Your strict data typing for ValidationResultEvent variables had a space after the : so that wouldn't work. You had an else nested inside of an if which wouldn't work either. The code above should work. If it doesn't give us the line number that the error occurs on as well.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 11-06-2011, 06:10 PM   PM User | #3
akuria
New Coder

 
Join Date: Nov 2011
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
akuria is an unknown quantity at this point
i did the changes and that error went went away only to give me another error at another spot. here is the code:

i put a mad face on the line where i am getting the error

1087: Syntax error: extra characters found after end of program.


protected function submit_appointment_clickHandler():void
{
var Sender:String = "";
var Email:String = "";
var HomePhone:String = "";
var CellPhone:String = "";
var Address:String = "";
var City:String = "";
var State:String = "";
var ZipCode:String = "";
var Comments:String = "";
var Interests:String = "";
var Type:String = currentState;

var evValidEmail:ValidationResultEvent = emailValidator.validate();
var evValidName:ValidationResultEvent = nameValidator.validate();
var evValidCellPhone:ValidationResultEvent = cellValidator.validate();
var evValidHomePhone:ValidationResultEvent = homeValidator.validate();

if (evValidEmail.type == ValidationResultEvent.VALID
&& evValidName.type == ValidationResultEvent.VALID
&& evValidCellPhone.type == ValidationResultEvent.VALID
&& evValidHomePhone.type == ValidationResultEvent.VALID)
{
resultLabel.text="Thank you.";
resultLabel.setStyle("styleName", "valid");
}
else
{
resultLabel.text="There are Form errors";
resultLabel.setStyle("styleName", "invalid");
}
}

switch(currentState)
{
case "appointment":
Sender = txtApptFirstName.text + " " + txtApptLastName.text;
Email = txtApptEmail.text;
HomePhone = txtApptHomePhone.text;
CellPhone = txtApptCellPhone.text;
Address = txtApptAddress.text;
City = txtApptCity.text;
State = txtApptState.text;
ZipCode = txtApptZipCode.text;
Comments = txtApptComments.text;
if(chkApptPhotography.selected) Interests = Interests + " Photography Session ";
if(chkApptChildrenFamily.selected) Interests = Interests + " Children and Family Portraits ";
if(chkApptPromSchool.selected) Interests = Interests + " Prom and School Event Photos ";
if(chkApptSeniorSchool.selected) Interests = Interests + " Senior School Photos ";
break;
case "contact":
Sender = txtContactFirstName.text + " " + txtContactLastName.text;
Email = txtContactEmail.text;
HomePhone = txtContactHomePhone.text;
CellPhone = txtContactCellPhone.text;
Address = txtContactAddress.text;
City = txtContactCity.text;
State = txtContactState.text;
ZipCode = txtContactZipCode.text;
Comments = txtContactComments.text;
if(chkContactPhotography.selected) Interests = Interests + " Photography Session ";
if(chkContactChildrenFamily.selected) Interests = Interests + " Children and Family Portraits ";
if(chkContactPromSchool.selected) Interests = Interests + " Prom and School Event Photos ";
if(chkContactSeniorSchool.selected) Interests = Interests + " Senior School Photos ";
break;
case "free_shoot":
Sender = txtFreeFirstName.text + " " + txtFreeLastName.text;
Email = txtFreeEmail.text;
HomePhone = txtFreeHomePhone.text;
CellPhone = txtFreeCellPhone.text;
Comments = txtFreeComments.text;
break;
}

emailService.send(
{
senderName: Sender,
senderEmail: Email,
senderHomePhone: HomePhone,
senderCellPhone: CellPhone,
senderAddress: Address,
senderCity: City,
senderState: State,
senderZipCode: ZipCode,
senderComments: Comments,
senderInterests: Interests,
sendType: Type
});
}


private function emailResult():void
{
Alert.show("Thank you for your submission. You will contacted shortly.");
clearForm();
}


private function clearForm():void
{
txtFreeFirstName.text="";
txtFreeLastName.text="";
txtFreeEmail.text="";
txtFreeHomePhone.text="";
txtFreeCellPhone.text="";
txtFreeComments.text="";

txtApptFirstName.text="";
txtApptLastName.text="";
txtApptEmail.text="";
txtApptHomePhone.text="";
txtApptCellPhone.text="";
txtApptAddress.text="";
txtApptCity.text="";
txtApptState.text="";
txtApptZipCode.text="";
txtApptComments.text="";
chkApptPhotography;
chkApptChildrenFamily;
chkApptPromSchool;
chkApptSeniorSchool;

txtContactFirstName.text="";
txtContactLastName.text="";
txtContactEmail.text="";
txtContactHomePhone.text="";
txtContactCellPhone.text="";
txtContactAddress.text="";
txtContactCity.text="";
txtContactState.text="";
txtContactZipCode.text="";
txtContactComments.text="";
chkContactPhotography;
chkContactChildrenFamily;
chkContactPromSchool;
chkContactSeniorSchool;
}

Last edited by akuria; 11-06-2011 at 06:12 PM..
akuria is offline   Reply With Quote
Old 11-06-2011, 11:23 PM   PM User | #4
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
I didn't know you had more code. It helps to post all of your code. In the future please do so. Remove the last } after this
PHP Code:
if (evValidEmail.type == ValidationResultEvent.VALID
&& evValidName.type == ValidationResultEvent.VALID
&& evValidCellPhone.type == ValidationResultEvent.VALID
&& evValidHomePhone.type == ValidationResultEvent.VALID)
{
resultLabel.text="Thank you.";
resultLabel.setStyle("styleName""valid");
}
else
{
resultLabel.text="There are Form errors";
resultLabel.setStyle("styleName""invalid");
}

__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 11-07-2011, 12:43 AM   PM User | #5
akuria
New Coder

 
Join Date: Nov 2011
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
akuria is an unknown quantity at this point
now i am getting error messages at the resultLabel lines (x4) here is my entire bit of code so no hopefully no more errors. lol. thanks for the info and help so far.

1120: Access of undefined property resultLabel.

PHP Code:
<fx:Script>
        <![
CDATA[
            
import mx.collections.ArrayCollection;
            
import mx.controls.Alert;
            
import mx.events.FlexEvent;
            
import mx.events.ValidationResultEvent;
            
import mx.rpc.events.FaultEvent;
            
import mx.rpc.events.ResultEvent;
            
import mx.rpc.soap.SOAPFault;
            
import mx.rpc.soap.WebService;
            protected function 
button_clickHandler():void
            
{
                
currentState='home';
                
Sequence1.play();
            }
            protected function 
button_clickHandler_2():void
            
{
                
currentState='contact';
            }
            protected function 
button_clickHandler_1():void
            
{
                
currentState='about_team';
            }
            protected function 
button_clickHandler_14():void
            
{
                
currentState='about_what';
            }
            protected function 
button_clickHandler_15():void
            
{
                
currentState='about_who';
            }
            protected function 
button_clickHandler_16():void
            
{
                
currentState='about_team';
            }
            protected function 
button_clickHandler_19():void
            
{
                
currentState='appointment';
            }
            protected function 
button_clickHandler_20():void
            
{
                
currentState='service';
            }
            protected function 
button_clickHandler_21():void
            
{
                
navigateToURL( new URLRequestencodeURI("http://protegefoundation.org")), "_blank");
            }
            protected function 
button_clickHandler_24():void
            
{
                
currentState='testimonial';
            }
            protected function 
button_clickHandler_25():void
            
{
                
currentState='charity';
            }
            protected function 
button_clickHandler_3():void
            
{
                
currentState='studio_tour';
                
Sequence4.play();
            }
            protected function 
button_clickHandler_4():void
            
{
                
currentState='galleries';
            }
            protected function 
button_clickHandler_7():void
            
{
                
currentState='packages';
            }
            protected function 
button_clickHandler_8():void
            
{
                
currentState='shop';
            }
            protected function 
button_clickHandler_17():void
            
{
                
currentState='free_shoot';
            }
            protected function 
button_clickHandler_18():void
            
{
                
currentState='appointment';
            }


        


        


        


        


        


        


        


            protected function 
submit_appointment_clickHandler():void
            
{
                var 
Sender:String "";
                var 
Email:String "";
                var 
HomePhone:String "";
                var 
CellPhone:String "";
                var 
Address:String "";
                var 
City:String "";
                var 
State:String "";
                var 
ZipCode:String "";
                var 
Comments:String "";
                var 
Interests:String "";
                var 
Type:String currentState;
                
                var 
evValidEmail:ValidationResultEvent emailValidator.validate();
                var 
evValidName:ValidationResultEvent nameValidator.validate();
                var 
evValidCellPhone:ValidationResultEvent cellValidator.validate();
                var 
evValidHomePhone:ValidationResultEvent homeValidator.validate();
                
                if (
evValidEmail.type == ValidationResultEvent.VALID
                    
&& evValidName.type == ValidationResultEvent.VALID
                    
&& evValidCellPhone.type == ValidationResultEvent.VALID
                    
&& evValidHomePhone.type == ValidationResultEvent.VALID)
                {
                    
resultLabel.text="Thank you.";
                    
resultLabel.setStyle("styleName""valid");
                }
                else
                {
                    
resultLabel.text="There are Form errors";
                    
resultLabel.setStyle("styleName""invalid");
                }
            
            switch(
currentState)
            {
                case 
"appointment":
                    
Sender txtApptFirstName.text " " txtApptLastName.text;
                    
Email txtApptEmail.text;
                    
HomePhone txtApptHomePhone.text;
                    
CellPhone txtApptCellPhone.text;
                    
Address txtApptAddress.text;
                    
City txtApptCity.text;
                    
State txtApptState.text;
                    
ZipCode txtApptZipCode.text;
                    
Comments txtApptComments.text;
                    if(
chkApptPhotography.selectedInterests Interests " Photography Session ";
                    if(
chkApptChildrenFamily.selectedInterests Interests " Children and Family Portraits ";
                    if(
chkApptPromSchool.selectedInterests Interests " Prom and School Event Photos ";
                    if(
chkApptSeniorSchool.selectedInterests Interests " Senior School Photos ";
                    break;
                case 
"contact":
                    
Sender txtContactFirstName.text " " txtContactLastName.text;
                    
Email txtContactEmail.text;
                    
HomePhone txtContactHomePhone.text;
                    
CellPhone txtContactCellPhone.text;
                    
Address txtContactAddress.text;
                    
City txtContactCity.text;
                    
State txtContactState.text;
                    
ZipCode txtContactZipCode.text;
                    
Comments txtContactComments.text;
                    if(
chkContactPhotography.selectedInterests Interests " Photography Session ";
                    if(
chkContactChildrenFamily.selectedInterests Interests " Children and Family Portraits ";
                    if(
chkContactPromSchool.selectedInterests Interests " Prom and School Event Photos ";
                    if(
chkContactSeniorSchool.selectedInterests Interests " Senior School Photos ";
                    break;
                case 
"free_shoot":
                    
Sender txtFreeFirstName.text " " txtFreeLastName.text;
                    
Email txtFreeEmail.text;
                    
HomePhone txtFreeHomePhone.text;
                    
CellPhone txtFreeCellPhone.text;
                    
Comments txtFreeComments.text;
                    break;
            }    

            
emailService.send(
                {
                    
senderNameSender,
                    
senderEmailEmail,
                    
senderHomePhoneHomePhone,
                    
senderCellPhoneCellPhone,
                    
senderAddressAddress,
                    
senderCityCity,
                    
senderStateState,
                    
senderZipCodeZipCode,
                    
senderCommentsComments,
                    
senderInterestsInterests,
                    
sendTypeType
                
});
        }
            

            private function 
emailResult():void
            
{
                
Alert.show("Thank you for your submission. You will contacted shortly.");
                
clearForm();
            }

            
            private function 
clearForm():void
            
{
                
txtFreeFirstName.text="";
                
txtFreeLastName.text="";
                
txtFreeEmail.text="";
                
txtFreeHomePhone.text="";
                
txtFreeCellPhone.text="";
                
txtFreeComments.text="";

                
txtApptFirstName.text="";
                
txtApptLastName.text="";
                
txtApptEmail.text="";
                
txtApptHomePhone.text="";
                
txtApptCellPhone.text="";
                
txtApptAddress.text="";
                
txtApptCity.text="";
                
txtApptState.text="";
                
txtApptZipCode.text="";
                
txtApptComments.text="";
                
chkApptPhotography;
                
chkApptChildrenFamily;
                
chkApptPromSchool;
                
chkApptSeniorSchool;

                
txtContactFirstName.text="";
                
txtContactLastName.text="";
                
txtContactEmail.text="";
                
txtContactHomePhone.text="";
                
txtContactCellPhone.text="";
                
txtContactAddress.text="";
                
txtContactCity.text="";
                
txtContactState.text="";
                
txtContactZipCode.text="";
                
txtContactComments.text="";
                
chkContactPhotography;
                
chkContactChildrenFamily;
                
chkContactPromSchool;
                
chkContactSeniorSchool;
            }
    
            
            
        protected function 
button_clickHandler_5():void
        
{
            
currentState='career';
        }


        protected function 
button_clickHandler_6():void
        
{
            
navigateToURL( new URLRequestencodeURI("mailto:info@protege.tv")), "_self");
        }


        protected function 
button_clickHandler_9():void
        
{
                
navigateToURL( new URLRequestencodeURI("http://protege.tv/pdf/PROTEGE_MAP_DIRECTION.pdf")), "_self");
            }


        protected function 
button_clickHandler_10():void
        
{
            
currentState='map';
        }


        protected function 
swfcontroller2_completeHandler(event:Event):void
        
{
            
Sequence4.play();
        }
            
        protected function 
swfcontroller1_completeHandler(event:Event):void
        
{
            
Sequence1.play();
        }    

            ]]></
fx:Script>
    <
s:states>
        <
s:State fc:color="0xcc0000" name="home"/>
        <
s:State fc:color="0x0081cc" name="contact"/>
        <
s:State fc:color="0x00cc21" name="about_team"/>
        <
s:State fc:color="0xa30017" name="about_what"/>
        <
s:State fc:color="0x08ffb6" name="about_who"/>
        <
s:State fc:color="0x510900" name="free_shoot"/>
        <
s:State fc:color="0xbbcc00" name="appointment"/>
        <
s:State fc:color="0x9308ff" name="service"/>
        <
s:State fc:color="0x157100" name="charity"/>
        <
s:State fc:color="0xa30096" name="testimonial"/>
        <
s:State fc:color="0x00a38e" name="studio_tour"/>
        <
s:State fc:color="0xfe4f8d" name="packages"/>
        <
s:State fc:color="0xcca3ff" name="galleries"/>
        <
s:State fc:color="0xcc0000" name="shop"/>
        <
s:State name="career"/>
        <
s:State name="map"/>
    </
s:states>
    <
fx:Declarations>
        <
mx:HTTPService id="emailService" 
                        
url="sendEmail.php"
                        
method="POST"
                        
resultFormat="xml"
                        
result="emailResult()" 
                        
useProxy="false"/>
        <
mx:EmailValidator id="emailValidator"
                           
source="{txtFreeEmail, txtApptEmail, txtContactEmail}" property="text"
                           
requiredFieldError="Enter your email" required="true" />
        <
mx:StringValidator id="nameValidator"
                            
source="{txtFreeFirstName, txtFreeLastName, txtApptFirstName, txtApptLastName, txtContactFirstName, txtContactLastName}" property="text"
                            
requiredFieldError="Enter your name" required="true"/>
        <
mx:StringValidator id="cellValidator"
                            
source="{txtFreeCellPhone, txtApptCellPhone, txtContactCellPhone}" property="text"
                            
requiredFieldError="Enter your cell phone number" required="true"/>
        <
mx:StringValidator id="homeValidator"
                            
source="{txtFreeHomePhone, txtApptHomePhone, txtContactHomePhone}" property="text"
                            
requiredFieldError="Enter your home phone number" required="true"/>
        <
s:Parallel id="Sequence1">
            <
s:Parallel target="{swfcontroller1}">
                <
s:CallAction functionName="playSWF"/>
            </
s:Parallel>
        </
s:Parallel>
        <
s:Parallel id="Sequence3">
        </
s:Parallel>
        <
s:Parallel id="Sequence4">
            <
s:Parallel target="{swfcontroller2}">
                <
s:CallAction functionName="playSWF"/>
            </
s:Parallel>
        </
s:Parallel>
    </
fx:Declarations
akuria is offline   Reply With Quote
Old 11-09-2011, 01:47 AM   PM User | #6
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Read the error. It is telling you exactly what the problem is. Where is resultLabel defined?
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 11-09-2011, 02:16 AM   PM User | #7
akuria
New Coder

 
Join Date: Nov 2011
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
akuria is an unknown quantity at this point
Quote:
Originally Posted by _Aerospace_Eng_ View Post
Read the error. It is telling you exactly what the problem is. Where is resultLabel defined?
duh! thanks. i added the define line of code and no errors but its not working.

PHP Code:
<mx:Label id="resultLabel"/> 
i added this line of code to the declarations area of the code.
akuria is offline   Reply With Quote
Old 11-09-2011, 02:25 AM   PM User | #8
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Okay that is fine and all but what are you going to do with it? You haven't added it to the timeline or anything.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 11-09-2011, 03:10 AM   PM User | #9
akuria
New Coder

 
Join Date: Nov 2011
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
akuria is an unknown quantity at this point
Quote:
Originally Posted by _Aerospace_Eng_ View Post
Okay that is fine and all but what are you going to do with it? You haven't added it to the timeline or anything.
what do you mean? sorry i am a noob to flex.
akuria is offline   Reply With Quote
Old 11-09-2011, 06:19 AM   PM User | #10
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Where are you using resultLabel? You aren't displaying it anywhere.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 11-09-2011, 07:03 AM   PM User | #11
akuria
New Coder

 
Join Date: Nov 2011
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
akuria is an unknown quantity at this point
Quote:
Originally Posted by _Aerospace_Eng_ View Post
Where are you using resultLabel? You aren't displaying it anywhere.
this is where i am using the resultLabel.

PHP Code:
protected function submit_appointment_clickHandler():void
            
{
                var 
Sender:String "";
                var 
Email:String "";
                var 
HomePhone:String "";
                var 
CellPhone:String "";
                var 
Address:String "";
                var 
City:String "";
                var 
State:String "";
                var 
ZipCode:String "";
                var 
Comments:String "";
                var 
Interests:String "";
                var 
Type:String currentState;
                
                var 
evValidEmail:ValidationResultEvent emailValidator.validate();
                var 
evValidName:ValidationResultEvent nameValidator.validate();
                var 
evValidCellPhone:ValidationResultEvent cellValidator.validate();
                var 
evValidHomePhone:ValidationResultEvent homeValidator.validate();
                
                if (
evValidEmail.type == ValidationResultEvent.VALID
                    
&& evValidName.type == ValidationResultEvent.VALID
                    
&& evValidCellPhone.type == ValidationResultEvent.VALID
                    
&& evValidHomePhone.type == ValidationResultEvent.VALID)
                {
                    
resultLabel.text="Thank you.";
                    
resultLabel.setStyle("styleName""valid");
                }
                else
                {
                    
resultLabel.text="There are Form errors";
                    
resultLabel.setStyle("styleName""invalid");
                }
            
            switch(
currentState)
            {
                case 
"appointment":
                    
Sender txtApptFirstName.text " " txtApptLastName.text;
                    
Email txtApptEmail.text;
                    
HomePhone txtApptHomePhone.text;
                    
CellPhone txtApptCellPhone.text;
                    
Address txtApptAddress.text;
                    
City txtApptCity.text;
                    
State txtApptState.text;
                    
ZipCode txtApptZipCode.text;
                    
Comments txtApptComments.text;
                    if(
chkApptPhotography.selectedInterests Interests " Photography Session ";
                    if(
chkApptChildrenFamily.selectedInterests Interests " Children and Family Portraits ";
                    if(
chkApptPromSchool.selectedInterests Interests " Prom and School Event Photos ";
                    if(
chkApptSeniorSchool.selectedInterests Interests " Senior School Photos ";
                    break;
                case 
"contact":
                    
Sender txtContactFirstName.text " " txtContactLastName.text;
                    
Email txtContactEmail.text;
                    
HomePhone txtContactHomePhone.text;
                    
CellPhone txtContactCellPhone.text;
                    
Address txtContactAddress.text;
                    
City txtContactCity.text;
                    
State txtContactState.text;
                    
ZipCode txtContactZipCode.text;
                    
Comments txtContactComments.text;
                    if(
chkContactPhotography.selectedInterests Interests " Photography Session ";
                    if(
chkContactChildrenFamily.selectedInterests Interests " Children and Family Portraits ";
                    if(
chkContactPromSchool.selectedInterests Interests " Prom and School Event Photos ";
                    if(
chkContactSeniorSchool.selectedInterests Interests " Senior School Photos ";
                    break;
                case 
"free_shoot":
                    
Sender txtFreeFirstName.text " " txtFreeLastName.text;
                    
Email txtFreeEmail.text;
                    
HomePhone txtFreeHomePhone.text;
                    
CellPhone txtFreeCellPhone.text;
                    
Comments txtFreeComments.text;
                    break;
            }    

            
emailService.send(
                {
                    
senderNameSender,
                    
senderEmailEmail,
                    
senderHomePhoneHomePhone,
                    
senderCellPhoneCellPhone,
                    
senderAddressAddress,
                    
senderCityCity,
                    
senderStateState,
                    
senderZipCodeZipCode,
                    
senderCommentsComments,
                    
senderInterestsInterests,
                    
sendTypeType
                
});
        } 
and here is where i am declaring it

PHP Code:
<fx:Declarations>
<
mx:Label id="resultLabel"/> 
        <
mx:HTTPService id="emailService" 
                        
url="sendEmail.php"
                        
method="POST"
                        
resultFormat="xml"
                        
result="emailResult()" 
                        
useProxy="false"/>
        <
mx:EmailValidator id="emailValidator"
                           
source="{txtFreeEmail, txtApptEmail, txtContactEmail}" property="text"
                           
requiredFieldError="Enter your email" required="true" />
        <
mx:StringValidator id="nameValidator"
                            
source="{txtFreeFirstName, txtFreeLastName, txtApptFirstName, txtApptLastName, txtContactFirstName, txtContactLastName}" property="text"
                            
requiredFieldError="Enter your name" required="true"/>
        <
mx:StringValidator id="cellValidator"
                            
source="{txtFreeCellPhone, txtApptCellPhone, txtContactCellPhone}" property="text"
                            
requiredFieldError="Enter your cell phone number" required="true"/>
        <
mx:StringValidator id="homeValidator"
                            
source="{txtFreeHomePhone, txtApptHomePhone, txtContactHomePhone}" property="text"
                            
requiredFieldError="Enter your home phone number" required="true"/>
        <
s:Parallel id="Sequence1">
            <
s:Parallel target="{swfcontroller1}">
                <
s:CallAction functionName="playSWF"/>
            </
s:Parallel>
        </
s:Parallel>
        <
s:Parallel id="Sequence3">
        </
s:Parallel>
        <
s:Parallel id="Sequence4">
            <
s:Parallel target="{swfcontroller2}">
                <
s:CallAction functionName="playSWF"/>
            </
s:Parallel>
        </
s:Parallel>
    </
fx:Declarations
akuria is offline   Reply With Quote
Old 11-09-2011, 10:50 PM   PM User | #12
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
I guess I'm not too familiar with how flex apps work. Don't you have to tell flex where to display the label?
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 11-10-2011, 08:20 AM   PM User | #13
akuria
New Coder

 
Join Date: Nov 2011
Posts: 38
Thanks: 1
Thanked 0 Times in 0 Posts
akuria is an unknown quantity at this point
I don't know. I guess that's why i am asking.
akuria is offline   Reply With Quote
Old 11-13-2011, 03:29 AM   PM User | #14
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,602
Thanks: 2
Thanked 398 Times in 391 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
You don't put display elements in the Declarations tag like that; they would go in a Group/HGroup/VGroup that is your main content body, or some other element you are adding. The Declarations tag is for non-visible elements like services, validators, and effects.
Inigoesdr is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:06 AM.


Advertisement
Log in to turn off these ads.