PDA

View Full Version : HTTPService Parse Error


MManning
06-17-2009, 07:27 PM
Hi,

I'm currently working on a little projec. I'm new to ActionScript and Flex.

Now I'm using "HTTPService" to send form information to a page written in PHP.

I'm getting a parsing error on this line:

<mx:HTTPService id="userRequest" url="test.php" useProxy="false" method="POST">

This the rest of that part:


<mx:request xmlns="">
<height1>
{wallpaper_height_feet.text}
</height1>
<height2>
{wallpaper_height_inches.text}
</height2>
<width1>
{wallpaper_width_feet.text}
</width1>
<width2>
{wallpaper_width_inches.text}
</width2>
</mx:request>
</mx:HTTPService>



If you need anything more, please just say so.

Inigoesdr
06-18-2009, 03:48 AM
Could you post the exact error, and a sample of code that generates it?

MManning
06-18-2009, 12:31 PM
It just says:

"Parse error at '<mx:HTTPService>'"

I think this is all that is relevant:


<mx:HTTPService id="userRequest" url="test.php" useProxy="false" method="POST">
<mx:request xmlns="">
<height1>
{wallpaper_height_feet.text}
</height1>
<height2>
{wallpaper_height_inches.text}
</height2>
<width1>
{wallpaper_width_feet.text}
</width1>
<width2>
{wallpaper_width_inches.text}
</width2>
</mx:request>
</mx:HTTPService>


<mx:Form x="0" y="33.35" width="518" height="232.65" defaultButton="{next1}">
<mx:Text text="Height:" fontSize="11"/>
<mx:FormItem label="Feet:" fontSize="11" borderColor="#FFFFFF">
<mx:TextInput width="80" id="wallpaper_height_feet" text="{wallpaperSubmitDimensions.wallpaper_height_feet}"/>
</mx:FormItem>
<mx:FormItem label="Inches:" fontSize="11">
<mx:TextInput width="79" id="wallpaper_height_inches">
<mx:text>{wallpaperSubmitDimensions.wallpaper_height_inches}</mx:text>
</mx:TextInput>
</mx:FormItem>
<mx:Text text="Width:" fontSize="11"/>
<mx:FormItem label="Feet:" fontSize="11" borderColor="#FFFFFF">
<mx:TextInput width="80" id="wallpaper_width_feet" text="{wallpaperSubmitDimensions.wallpaper_width_feet}"/>
</mx:FormItem>
<mx:FormItem label="Inches:" fontSize="11">
<mx:TextInput width="79" id="wallpaper_width_inches">
<mx:text>{wallpaperSubmitDimensions.wallpaper_width_inches}</mx:text>
</mx:TextInput>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Next" fontSize="11" id="next1" click="userRequest.send()"/>
</mx:FormItem>
</mx:Form>

Inigoesdr
06-20-2009, 04:28 PM
What is giving you the parse error? That snippet compiles fine for me when I remove the unreferenced bound variables. I never get a syntax error either way.

MManning
06-21-2009, 02:51 AM
Well, this is the whole code:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
horizontalAlign="center"
verticalAlign="middle"
width="550"
height="350"
backgroundGradientColors="[#ffffff,#ffffff]"
currentState="Intro"
creationComplete="userRequest.Send()"
xmlns="*">

<mx:Binding source="wallpaper_height_feet.text" destination="wallpaperSubmitDimensions.wallpaper_height_feet"/>
<mx:Binding source="wallpaper_height_inches.text" destination="wallpaperSubmitDimensions.wallpaper_height_inches"/>
<mx:Binding source="wallpaper_width_feet.text" destination="wallpaperSubmitDimensions.wallpaper_width_feet"/>
<mx:Binding source="wallpaper_width_inches.text" destination="wallpaperSubmitDimensions.wallpaper_width_inches"/>

<mx:states>
<mx:State name="Product_Choice">

<mx:Script>
<![CDATA[

public function choiceWallpaper():void {
currentState = 'Wallpaper'
}

public function choiceCustom():void {
currentState = 'Custom'
}

]]>
</mx:Script>

<mx:RemoveChild target="{panel1}"/>
<mx:AddChild position="lastChild">
<mx:Panel x="0" y="0" width="550" height="350" layout="absolute" title="Create Your Own DormPaper!">
<mx:TextArea x="43" y="33" width="444" height="51" borderStyle="none" fontSize="11">
<mx:text>So, here we go. Now we need to know if you're going to customize a wallpaper, or if you want to add a personal touch to something such as electronics or other personal items.</mx:text>
</mx:TextArea>
<mx:Button x="43" y="129" label="Wallpaper" width="195" height="46" cornerRadius="6" fontSize="11" click="choiceWallpaper()"/>
<mx:Button x="292" y="129" label="Custom items" width="195" height="46" cornerRadius="6" fontSize="11"/>
</mx:Panel>
</mx:AddChild>
</mx:State>
<mx:State name="Intro">

<mx:Script>
<![CDATA[

private function accept():void {
currentState = 'Product_Choice'
}

]]>
</mx:Script>

<mx:AddChild position="lastChild">
<mx:Panel x="0" y="0" width="550" height="350" layout="absolute" title="Create Your Own DormPaper!">
</mx:Panel>
</mx:AddChild>
<mx:AddChild position="lastChild">
<mx:TextArea x="47" y="56" width="456" height="240" wordWrap="true" editable="false" enabled="true" fontSize="11" borderStyle="none">
<mx:text>Welcome! Here you can upload, edit, and customize your own images and designs for your custom order. Create wallpapers, covers for electronics, and much more. Once you have finished, the design will be sent to our team where they will estimate the cost and you will recieve a personal quote. If you have any question or concerns, please e-mail us at support@dormpaper.com</mx:text>
</mx:TextArea>
</mx:AddChild>
<mx:AddChild position="lastChild">
<mx:TextArea x="128" y="234" width="288" fontSize="9" borderColor="#FFFFFF" height="38">
<mx:text>By clicking continue, you agree to the Terms of Use, which can be found in a link at the bottom of every page.</mx:text>
</mx:TextArea>
</mx:AddChild>
<mx:AddChild position="lastChild">
<mx:Button x="193" y="171" width="158" height="41" label="Continue" fontSize="11" click="accept()"/>
</mx:AddChild>
<mx:RemoveChild target="{panel1}"/>
</mx:State>


<mx:State name="Wallpaper">

<mx:Script>
<![CDATA[

import WallpaperSubmitDimensions

[Bindable]
public var wallpaperSubmitDimensions : WallpaperSubmitDimensions = new WallpaperSubmitDimensions();

]]>
</mx:Script>


<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:TabNavigator x="0" y="0" width="530" height="310">
<mx:Canvas label="Dimensions" width="100%" height="100%" id="canvasDimensions">
<mx:TextArea x="75.5" y="10" width="378" fontSize="11" borderStyle="none" height="22" editable="false">
<mx:text>Ok, now we need the dimensions you want your wallpaper to be.</mx:text>
</mx:TextArea>

<mx:HTTPService id="userRequest" url="test.php" useProxy="false" method="POST">
<mx:request xmlns="">
<height1>
{wallpaper_height_feet.text}
</height1>
<height2>
{wallpaper_height_inches.text}
</height2>
<width1>
{wallpaper_width_feet.text}
</width1>
<width2>
{wallpaper_width_inches.text}
</width2>
</mx:request>
</mx:HTTPService>


<mx:Form x="0" y="33.35" width="518" height="232.65" defaultButton="{next1}">
<mx:Text text="Height:" fontSize="11"/>
<mx:FormItem label="Feet:" fontSize="11" borderColor="#FFFFFF">
<mx:TextInput width="80" id="wallpaper_height_feet" text="{wallpaperSubmitDimensions.wallpaper_height_feet}"/>
</mx:FormItem>
<mx:FormItem label="Inches:" fontSize="11">
<mx:TextInput width="79" id="wallpaper_height_inches">
<mx:text>{wallpaperSubmitDimensions.wallpaper_height_inches}</mx:text>
</mx:TextInput>
</mx:FormItem>
<mx:Text text="Width:" fontSize="11"/>
<mx:FormItem label="Feet:" fontSize="11" borderColor="#FFFFFF">
<mx:TextInput width="80" id="wallpaper_width_feet" text="{wallpaperSubmitDimensions.wallpaper_width_feet}"/>
</mx:FormItem>
<mx:FormItem label="Inches:" fontSize="11">
<mx:TextInput width="79" id="wallpaper_width_inches">
<mx:text>{wallpaperSubmitDimensions.wallpaper_width_inches}</mx:text>
</mx:TextInput>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Next" fontSize="11" id="next1" click="userRequest.send()"/>
</mx:FormItem>
</mx:Form>


</mx:Canvas>
<mx:Canvas label="Design" width="100%" height="100%" id="canvasDesign">
<mx:Button x="70" y="36" label="Button" click=""/>
</mx:Canvas>
</mx:TabNavigator>
</mx:AddChild>
</mx:State>
<mx:State name="Custom"/>
</mx:states>


</mx:Application>


I also just came across another problem. The state, wallpaper, doesn't show up in design view, nor does it show up when I run it. Sorry for any stupid mistakes.

Inigoesdr
06-21-2009, 03:29 PM
The HTTPService needs to be outside of the Canvas and State tags. Move it up to where your bindings are. Not sure about your wallpaper issue. I don't have your custom "WallpaperSubmitDimensions" class. You have a couple of things, including the AddChild tag in the Wallpaper state bound to "panel1", which wasn't part of the code you posted.