HTTPService sending params
I'm trying to submit some data over the HTTPService object to
a struts2 action class. The method I'm trying to use is as follows:
<mx:HTTPService id="myRequest" url="save.action">
<mx:request xmlns="">
<user.id>{userId.text}</user.id>
<user.username>{username.text}</user.username>
<user.password>{password.text}</user.password>
<user.email>{email.text}</user.email>
</mx:request>
</mx:HTTPService>
Of course it doesn't like the "user.username" convention
which struts2 uses to submit an object. I'm trying to built a
little test flex app as a proof of concept for our existing webapp.
The html for a given input box would look like this <input
type="text" name="user.username" />.
Is there anyway to do this other than changing the
myRequest.url by adding the parameters manually?
quote:
Originally posted by:
michael_ramirez44
I think it needs to be something like this:
<user>
<id></id>
<username></username>
</user>
That solution doesn't work.
quote:
Try using script to set it when you actually send the
request:
myRequest.send({
"user.id":userId.text,
"user.username":username.text,
"user.password":password.text,
"user.email":email.text
Tim
That works great thanks. I also found that you can use the {}
in the request method/property.
Similar Messages
-
Hi, All.
I need transfer a big data module (aprox.10-20 MB) from
client to server. I'm using HTTPService.send(params) to send this.
But I get a problem on 600K and more volume. It take a long time
(40 sec. and more on 500-600K). Its inredable to transfer so little
data for big time!
And at another hand, I can read big data module by
HTTPService (12 MB and more) for 10-15 seconds!
Why it can be, and how to solute this?
Thanks... (sorry for bad english :) )Hi, All.
I need transfer a big data module (aprox.10-20 MB) from
client to server. I'm using HTTPService.send(params) to send this.
But I get a problem on 600K and more volume. It take a long time
(40 sec. and more on 500-600K). Its inredable to transfer so little
data for big time!
And at another hand, I can read big data module by
HTTPService (12 MB and more) for 10-15 seconds!
Why it can be, and how to solute this?
Thanks... (sorry for bad english :) ) -
Httpservice.send() resulting in two http requests
hi,
I am using HTTPService() to send some xml data inside an HTTP
POST request. But very often, i do
see this resulting in two local ports being opened and the
http request being sent out twice, once from each port.
is this possible in some race condition?
thanks,
Sunilsome snippets of my code:
//build the http request
var request:HTTPService = new HTTPService();
request.method = "post";
request.headers = headers[request.method];
request.url = httpServer;
request.resultFormat = HTTPService.RESULT_FORMAT_TEXT;
request.contentType = "text/xml";
request.addEventListener(InvokeEvent.INVOKE , httpInvoke,
false);
i do see the invoke callback only being called once. That
makes me guess that from the application code, httpservice.send()
is called only once.
any help will be great. -
HTTPService.send doesnt send anny data
Hi all,
I have a serious problem when my application is online, i cant send anny data with HTTPService.send command. but when locally it does.
When i click the button tho send the data it doesnt even try to connect here is my code and i cant find the problem. I hope some one can point me in the right direction
here's my code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="700" minHeight="715" width="700" height="715"
xmlns:upload="services.upload.*"
creationComplete="initVars()"
>
protected function btn_publish_clickHandler(event:MouseEvent):void
var idioot:int = 1;
var text_veld:String = new String();
text_veld = tekst_stuk.text
obj.user = idioot;
obj.titel = titel.text;
obj.keywords = zoek_data.text;
obj.text = tekst_stuk.text;
if(voor_geld.text != null)
obj.price_off = voor_geld.text + "." + voor_geld_cent.text;
else if(korting_input.text != null)
obj.price_off = korting_input.text;
if(korting_radio.selected == true)
obj.price = geld.text + "." + geld_cent.text;
obj.price_type = "p";
else if(gratis_radio.selected == true)
obj.price = "0";
obj.price_type = "g";
else if(van_voor_radio.selected == true)
obj.price = geld.text + "." + geld_cent.text;
obj.price_type = "m";
obj.img_1 = img.source;
obj.img_2 = img_2.source;
obj.img_3 = img_3.source;
obj.img_4 = img_4.source;
private function send_data_event(e:Event):void
send_data.send(obj);
send_data.showBusyCursor;
<fx:Declarations>
<mx:HTTPService id="send_data" method="POST" url="http://someURL" resultFormat="text" useProxy="false"/>
</fx:Declarations>
<mx:Image x="525" y="559" source="buttonpubliceren.png" width="150" height="30" id="btn_publish" click="btn_publish_clickHandler(event);" />The function executes when hij press the Image button:
the new code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="700" minHeight="715" width="700" height="715"
xmlns:upload="services.upload.*"
creationComplete="initVars()"
>
protected function btn_publish_clickHandler(event:MouseEvent):void
var idioot:int = 1;
var text_veld:String = new String();
text_veld = tekst_stuk.text
obj.user = idioot;
obj.titel = titel.text;
obj.keywords = zoek_data.text;
obj.text = tekst_stuk.text;
if(voor_geld.text != null)
obj.price_off = voor_geld.text + "." + voor_geld_cent.text;
else if(korting_input.text != null)
obj.price_off = korting_input.text;
if(korting_radio.selected == true)
obj.price = geld.text + "." + geld_cent.text;
obj.price_type = "p";
else if(gratis_radio.selected == true)
obj.price = "0";
obj.price_type = "g";
else if(van_voor_radio.selected == true)
obj.price = geld.text + "." + geld_cent.text;
obj.price_type = "m";
obj.img_1 = img.source;
obj.img_2 = img_2.source;
obj.img_3 = img_3.source;
obj.img_4 = img_4.source;
send_data.send(obj);
send_data.showBusyCursor
<fx:Declarations>
<mx:HTTPService id="send_data" method="POST" url="http://someURL" resultFormat="text" useProxy="false"/>
</fx:Declarations>
<mx:Image x="525" y="559" source="buttonpubliceren.png" width="150" height="30" id="btn_publish" click="btn_publish_clickHandler(event);" /> -
Hi There,
I am new to FLEX and also new to writing a client for a web service.
My question is more about flex (Flash builder 4.5) APIs, what APIs to use.
I want to access a web service, that's published here.
https://build.phonegap.com/docs/write_api
here is the description of webservice
===========
1) I have to do a post on POST https://build.phonegap.com/api/v1/apps
2) content type has to be "multipart/form-data"
3) JSON bodies of requests are expected to have the name 'data'
data will be someting like this
'data={"title":"API V1 App","package":"com.alunny.apiv1","version":"0.1.0","create_method":"file"}'
4) include a zip file in the multipart body of your post, with the parameter name 'file'.
===========
I want to make a 'multipart/form-data' Post and send
one string and one zip file.
My first question to self was If i send both string + binary data in the body ...
how will server understand where string end and where zip file starts?
Then read on W3.org( http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 )
How is text + binary data can be sent through "multipart/form-data" post requst.
there has to be some boundries.
After this I read and example in flex and tried following it.
http://codeio.wordpress.com/2010/04/03/5-minutes-on-adobe-flex-mimic-file-upload-for-in-me mory-contents/
but it doesn't seems to be working for me.
public function createNewApp(cb:Function , appFile : File):void
var service:HTTPService = new HTTPService();
service.url = ROOT+"apps";
service.showBusyCursor = true;
service.addEventListener(ResultEvent.RESULT, function(e:ResultEvent):void {
//translate JSON
trace(e.result);
var result:String = e.result.toString();
var data:Object = JSON.parse(result);
cb(data.link);
service.addEventListener(FaultEvent.FAULT, defaultFaultHandler); //todo : allow user to add his own as well
authAndUploadNewApp(service,appFile);
private function authAndUploadNewApp(service:HTTPService,appFile : File):void {
var encoder:Base64Encoder = new Base64Encoder();
encoder.encode(username + ":"+password);
service.headers = {Accept:"application/json", Authorization:"Basic " + encoder.toString()};
service.method ="POST";
var boundary:String = UIDUtil.createUID();
service.contentType = "multipart/form-data; boundary=—————————" + boundary;
var stream:FileStream = new FileStream();
stream.open(appFile, FileMode.READ);
var binaryData:ByteArray = new ByteArray();
var fileData : String = new String();
stream.readBytes(binaryData);
stream.close();
fileData = binaryData.readUTFBytes(binaryData.bytesAvailable); // I think this is where I have problem.... how do
//how do i converrt this bytearray/stream of data to string and send it in my post request's body - i guess if this step work rest should work..
var params: String = new String();
var content:String = "—————————" + boundary + "nr";
content += 'Content-Disposition: form-data; name="data";' + '{"title":"ELS test app 2","package":"com.elsapp.captivate","version":"12.3.09","create_method":"file"}' + "nr";
content += "—————————" + boundary + "nr";
content += 'Content-Disposition: form-data; name="file";' + fileData + "nr";
content += "—————————–" + boundary + "–nr";
service.request = content;
service.send();In the past I have used URLVariables with URLRequest and URLLoader to achieve this kind of requirement.
Check out http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_3 .html which should be useful. My preference has always been to use this style instead of HTTPService objects, giving you a little more control which is what you need here.
Let me know if you need any more assistance. -
HTTPService.send() only works the first time
I have the follow HTTPService defintion in my mxml page:
<mx:HTTPService
id="updateRequest"
url="{accessURL}"
useProxy="false" result="onSuccessEvent(event)"
fault="onFailEvent(event)">
<mx:request>
<username>{userName}</username>
<password>{password}</password>
<id></id>
<sname></sname>
<value></value>
<randomNum>0</randomNum>
</mx:request>
</mx:HTTPService>
Here is my call:
updateRequest.request.id= myid;
updateRequest.request.sname= myname;
updateRequest.request.value = myvalue;
updateRequest.request.randomNum = Math.random();
updateRequest.send();
The first time call is successful, but second time(after 30
seconds), after send() function call, I didn't even received
HTTPService call from server side. Is this somehow cached or I need
to reinitial it? This looks strange.I am having the same issue but have already been using the
post method. When I click my refresh button or if the timer I have
set up resets I see no request made to the server.
private function onResult(Event:ResultEvent):void {
var myNum:int = Math.round(Math.random() * 2);
var xmlResult:XML = XML(Event.result);
_xlcMyListData = new XMLListCollection(xmlResult..asset);
<mx:HTTPService id="tempXML" resultFormat="e4x"
result="onResult(event)" method="POST" url="
http://mysite.net/info_wrapper.php?customer={customer.text}&username={username.text}&a mp;password={password.text}"
useProxy="false"/>
<mx:TileList dataProvider="{_xlcMyListData}"
labelField="fleet" left="35" right="15"
width="350" backgroundColor="#000000" color="#ff0000"
fontSize="27" borderColor="#000000" columnWidth="315"
rowHeight="50" themeColor="#808080" fontWeight="bold"
allowMultipleSelection="true" id="TileList1" height="0" y="202"
x="178"/>
<mx:Button label="Refresh Page Now" height="27"
fillAlphas="[1.0, 1.0]" fillColors="[#030000, #030000, #474545,
#474545]" borderColor="#DCDEDF" click="tempXML.send();"/> -
ArrayCollection vs. Array in HTTPService sending
Hi,
I want to send the content of an ArrayCollection as one of the parameters in an HTTPService.
However, Flex concatenates the collection's values into one long string and sends it as the value of a single parameter.
Doing this with arrays work just fine, e.g. in AS3:
service.send( { name=["john", "lucy", "mark"] });
(also works in MXML using parameter binding)
So then I tried first converting the ArrayCollection using .toArray() - this is done in MXML, e.g.:
name="{controller.name.toArray()}"
But, then Flex thinks there is NO value - i.e. data binding to the result of .toArray() doesn't keep track of changes to the underlying ArrayCollection.
Is there any way to databind a single HTTPService parameter to an ArrayCollection like one can do against an Array?
JoubertIt will be easier to show you an example of the ArrayCollection. Run this example with a line break at the trace(); statement, and examine the resulting ArrayCollection's items. Once you see this, I think you'll understand why your code isn't working as you expect.
The ArrayCollection is not simply a way to store or make a single Array bindable. It is a collection of objects which you can bind to. Its methods allow you to add, delete and search for items within it. You can, in fact, store many arrays within it. And those arrays could be using Flex components as object keys. Even if you send this to a WebService, that service will likely not understand it.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="testIt()">
<mx:Script>
<![CDATA[
import mx.controls.ComboBox;
import mx.collections.ArrayCollection;
import flash.utils.Dictionary;
//Create different types of arrays:
public var indexedArray:Array = new Array("john", "lucy", "mark");
public var associativeArray:Array = new Array([
{label:"One", data:"7000"},
public var dictionaryArray:Dictionary = new Dictionary();
//Create objects for a dictionary array:
public var objectOne:Object = new Object();
public var objectTwo:Object = new Object();
public var sprite1:Sprite = new Sprite;
public var comboBox1:ComboBox = new ComboBox;
//Create an ArrayCollection:
private var myAC:ArrayCollection = new ArrayCollection;
//This function populates the ArrayCollection:
private function testIt():void{
//Add values to the objects:
objectOne = "This is a Sprite Object";
objectTwo = "This is a ComboBox Object";
//Add objects to the Dictionary:
dictionaryArray[sprite1] = objectOne;
dictionaryArray[comboBox1] = objectTwo;
//Add all the Arrays to the Collection:
myAC.addItem(indexedArray);
myAC.addItem(associativeArray);
myAC.addItem(dictionaryArray);
trace();
]]>
</mx:Script>
</mx:Application> -
Send params to an included JSP page
Hi,
I don't understand that : I use Tomcat 4.0. When I write it :
<!-- Affichage du fond de page ouvre la balise <body> (a refermer) -->
<jsp:include page="<%=JLdsWeb.URL_JSP + JLdsWeb.JSP_BACKGROUND%>" >
<%-- Emp�che l'affichage de la barre de navigation --%>
<jsp:p aram name="navigmenu" value="no" />
</jsp:include>Tomcat send an error when compiling :
Expected "param" tag with "name" and "value" attributes without the "params" tag.does someone know why ?
an how can I solve this problem ?I came across this error for an entirely different reason. I had a param tag commented out in my code.
So it read:
<!--
<jsp:include page="include/other.jsp>
-->
<jsp:include page="include/box.jsp">
<jsp:param name="id" value="center"/>
</jsp:include>
It's really obvious when you look at it, but tied me up for a few minutes \^.^/ -
Hello, is it possible to send an entire array to a server
side PHP script via the HTTPService Request tag ?
I have a user generated array within Flex. The contents vary
according to user input.
What is the best practice to prepare this Array to send via
HTTPService ?
Thanks for any advice.Okay, so <request> tag it is then!
Let's say this is your array:
[Bindable]
private var codes:Array = [11, 22, 33, 44];
and you've filled it whatever the way you have only that it's
bindable.
Now sending this array over is as simple as:
<mx:HTTPService id="arraySender" resultFormat="text"
url="
http://localhost:8080/tracking/test.do">
<mx:request xmlns="">
<codes>{codes}</codes>
</mx:request>
</mx:HTTPService>
I don't know PHP. But in the JSP I tried
request.getParameterValues("codes") gives me a string array with
all the four values I sent from Flex.
You'll need to use equivelant method in PHP.
Hope this helps.
ATTA -
HTTPService sending parameters
Hi,
I am looking for a way to send in a list of parameters to my
JSP. I already know how to use <mx:Request> tag, but it only
allows for a predefined number of parameters (at design time). What
i want to do is to send in an x number of parameters in, basically,
send in an XMLList contents as parameter list.
The documentation on HTTPService has a method xmlEncode() and
xmlDecode(). I could not get it to work and there aren't any
working examples out there. I guess i could serialize an XMLList
into a xml string myself and send it as one parameter field and
then parse it in jsp... or use JSON.
Is there a workable design pattern for sending complex
objects in?
If i was to use HTTPService in ActionScript, theoretically i
could dynamically add parameters to the Request object. I just
don't know how to create and use HTTPService fom AS... can someone
show me? is it hs:HTTPService = new HTTPService();
hs.request.add("key", "value"); ??
Thanks for any help.I personaly don't agree what they do in that example you
showed (
http://www.adobe.com/devnet/flex/articles/complex_data_02.html),
that is way too much extra unnecessary fanciness that adds
additional layer of logic on both sides, flex and jsp,which does
not really give any justifiable FLEXIbility to developer
why would you want to generate xml then on server side parse
xml when you can just as easily build request parametes on flex
side iteratively and same thing on jsp (with existing servler/jsp
API ) Exaple : iterate through all or partial request parameters
with code something like this :
for (java.util.Enumeration e = request.getParameterNames();
e.hasMoreElements() ;) {
String name = (String) e.nextElement();
String value = request.getParameter(name); -
I'm wondering if, in general, it is better to call the send()
method for HTTPService in the creationComplete event handler, or if
there is any advantage to calling send() in the initialize event
handler."Greg Lafrance" <[email protected]> wrote in
message
news:gm80e7$n6c$[email protected]..
> I'm wondering if, in general, it is better to call the
send() method for
> HTTPService in the creationComplete event handler, or if
there is any
> advantage
> to calling send() in the initialize event handler.
I think that depends on how much stuff your program has to
build, and
whether you're doing anything in the result handler that
might depend on
having things ready (and if your HTTPService is set up in
MXML, it's
probably not ready for you to be able to send anyway). -
HTTPService problems while sending a String Variable to Server
I have an xml in string form..... I want to send it as an http request to the server, which is written in .NET... server wud make its decession on the basis of this xml and wud return me another xml as http response..
Problem ---->
this request reaches server but when i look at the request reached at server it has my client infotmation but does not has my variable anywhere...... i iterate through all the parameters in Request.Params... but I don't find my string at all.... any idea why I can't find my sent variable ???
Actionscript code to send xmlString to .NET Server using HTTPService:
public function sendRequest(syncXmlString : String, httpResultHandler : Function) : void {
try {
var objectParam : Object = {name:PARAM_NAME, value:syncXmlString };
var params : Object = [objectParam];
var httpService : HTTPService = new HTTPService();
httpService.url = serverUrl;
httpService.method = HTTPRequestMessage.POST_METHOD;
httpService.contentType = HTTPService.CONTENT_TYPE_XML;
httpService.resultFormat = HTTPService.RESULT_FORMAT_XML;
httpService.addEventListener(ResultEvent.RESULT, httpResultHandler);
httpService.addEventListener(FaultEvent.FAULT, httpFaultHandler);
httpService.send(params);
} catch (err : Error) {
Alert.show(err.message);
Thanks and Regards,
Ahmed.No, that is the problem, the request object should not be an indexed array[], it should be an Object{}. Remove that imtermediate array and pass objectParams in the send()
Also, don't mess with the contentType without very good reason.
httpService.contentType = HTTPService.CONTENT_TYPE_XML;
that says you are sending XML, but you are not, you are sending the default name=value pairs. Remove that assignment and leave it at the default "form"
One more, you do not want that resultFormat, it is the legacy AS2 class. You want E4X
httpService.resultFormat = RESULT_FORMAT_E4X;
Tracy -
Possible memory leak in e4x or HTTPService with e4x format
Hello,
I think I have found a memory leak in e4x.
In very special cases (=xml) the player swallows the memory.
The little test program connects to a web server for an xml
file, and the result is converted to an array.
The array is displayed in a DataGrid.
There are two files:
leaktest.xml doesn't leak in any cases (format: e4x or xml)
pbentries.xml leaks when the format is e4x.
Choose e4x format and check Use "Leak" file! Than the program
leaks.
For the whole test case (mxml file, html file and xml files)
please contact me at
[email protected]
or
[email protected]
and I send a zip file as soon as possible.
Probably there is a bug in my test program. If so than please
send me a feedback.
Thanks,
Lacito
------ For the program cut here ------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import mx.core.Application;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.mxml.HTTPService;
protected var records_:Array = null;
protected var httpService:HTTPService = null;
[Bindable("recordsChange")]
public function set records(_records:Array):void
this.records_ = _records;
var e:Event = new Event("recordsChange");
dispatchEvent(e);
public function get records():Array
return records_;
protected function getXML():void
var resultFormat:String = cbResultFormat.selectedItem as
String;
var params:Object = new Object();
httpService = new HTTPService();
httpService.concurrency = "single";
httpService.showBusyCursor = true;
var lastIndex:int = url.lastIndexOf("/");
var fileName:String = null;
if(chbUseLeakFile.selected)
// It leaks... :(
fileName = "pbentries.xml";
else
// It doesn't leak... :)
fileName = "leaktest.xml";
var _url:String = url.substr(0, lastIndex+1) + fileName;
httpService.url = _url;
httpService.resultFormat = resultFormat;
httpService.method = "POST";
httpService.addEventListener(ResultEvent.RESULT,
processResult);
httpService.addEventListener(FaultEvent.FAULT,
processFault);
httpService.send(params);
protected function processResult(e:ResultEvent):void
var resultFormat:String = cbResultFormat.selectedItem as
String;
removeListeners();
if(resultFormat==mx.rpc.http.HTTPService.RESULT_FORMAT_XML)
setArrayFromXMLNode();
else
setArrayFromXML();
destroyHttpService();
// format= "e4x"
protected function setArrayFromXML():void
var xml_:XML = httpService.lastResult as XML;
var ar:Array = new Array();
var x:XML = null;
var xl:XMLList = xml_.phonebookEntries[0].phonebookEntry;
for each(x in xl)
var record:Object = new Object();
var prop:XML = null;
var props:XMLList = x.children();
for each(prop in props)
record[prop.localName()] = prop.toString();
ar.push(record);
records = ar;
// format= "xml"
protected function setArrayFromXMLNode():void
var xml_:XMLNode = httpService.lastResult as XMLNode;
var ar:Array = new Array();
var x:XMLNode = null;
var xl:Array = xml_.lastChild.childNodes;
for each(x in xl)
var record:Object = new Object();
var prop:XMLNode = null;
var props:Array = x.childNodes;
for each(prop in props)
record[prop.localName] = prop.firstChild!=null ?
prop.firstChild.nodeValue : null;
ar.push(record);
records = ar;
protected function destroyHttpService():void
httpService.clearResult(false);
httpService.disconnect();
httpService = null;
protected function processFault(e:FaultEvent):void
removeListeners();
Alert.show(e.fault.faultString, e.fault.faultCode);
destroyHttpService();
protected function removeListeners():void
httpService.removeEventListener(ResultEvent.RESULT,
processResult);
httpService.removeEventListener(FaultEvent.FAULT,
processFault);
protected function collect():void
// Garbage Collection
try
new LocalConnection().connect('foo');
new LocalConnection().connect('foo');
catch(e:*)
]]>
</mx:Script>
<mx:ArrayCollection id="alRecords" source="{records}"
/>
<mx:Label x="10" y="10" text="Result format:"
id="lResultFormat"/>
<mx:ComboBox x="104" y="8" id="cbResultFormat">
<mx:Array>
<mx:String>e4x</mx:String>
<mx:String>xml</mx:String>
</mx:Array>
</mx:ComboBox>
<mx:DataGrid id="dgRecords" x="10" y="36" width="936"
height="437"
dataProvider="{alRecords}"
verticalScrollPolicy="auto"
horizontalScrollPolicy="auto">
</mx:DataGrid>
<mx:Button x="355" y="496" label="Get xml" id="btnGetXML"
click="{getXML();}" />
<mx:Button x="155" y="496" label="GC" id="btnGC"
click="{collect();}" />
<mx:CheckBox x="276" y="10" label="Use
"LEAK" file:" labelPlacement="left"
id="chbUseLeakFile" selected="true"/>
</mx:Application>Hello,
After 3 months (and a new version of flex and flash player)
my test program is still leaking.
If somebody could confirm the leak it would be appreciated.
Thanks,
Lacito
P.S.: I heard that Adobe had donated ActionScript 3 VM to
Mozilla.org. Should I disturb them with my problem? -
Help needed "tabEnabling" not working in simple login page - Flex
Hello Friends,
I need a small help in Flex. I am doing a simple login page application in FlashBuilder 4.0 & i have kept 2 input boxes like Login,Password and a submit buttion. On clicking the button i am calling a method, so far everything is working fine.... But some how tabenabling is not working. suppose if you are in login inputbox and i press "tab key" it has to go to password input box.. but its not working. can any one help me on this, why it is not working. i have tried all the attempts using tabEnabled = "true". but stil i am failing to do this.
your help would be appreciated.
Rajesh
Message was edited by: Rajeshb_Flash<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%"
height="100%"
verticalAlign="middle"
horizontalAlign="center">
<mx:Script>
<![CDATA[
import com.tel.model.EventConstants;
import mx.controls.Alert;
import mx.managers.CursorManager;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.mxml.HTTPService;
private var httpService:HTTPService;
public var userID:String = "";
public function init():void{
private function mouseClickSubmit():void{
if(userName.text != "" && password.text != ""){
userID = userName.text;
initService();
}else{
if(userName.text == ""){
Alert.show("Please enter 'User Name'.","Alert!")
}else if(password.text == ""){
Alert.show("Please enter 'Password'.","Alert!")
private function initService():void{
var params:Object = new Object();
params["userName"] = userName.text;
params["password"] = password.text;
httpService = new HTTPService();
httpService.showBusyCursor = true;
httpService.resultFormat = "xml";
httpService.method=URLRequestMethod.POST;
httpService.addEventListener(ResultEvent.RESULT, httpServiceResultHandler);
httpService.addEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
httpService.url = "Login.action";
httpService.send(params);
private var boolFirstRun = true;
private function httpServiceResultHandler(event:ResultEvent):void{
httpService.removeEventListener(ResultEvent.RESULT, httpServiceResultHandler);
httpService.removeEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
httpService = null;
var resultXML:XML = new XML(event.result.toString());
if(resultXML.children().toString() == "true"){
boolFirstRun = false;
dispatchEvent(new Event(EventConstants.LOGIN_SUCCESS))
}else{
userName.text = "";
password.text = "";
Alert.show("Login Failed! Invalid 'User Name' or 'Password'.","Alert")
private function httpServiceFaultHandler(event:FaultEvent):void{
httpService.removeEventListener(ResultEvent.RESULT, httpServiceResultHandler);
httpService.removeEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
httpService = null;
]]>
</mx:Script>
<mx:Panel title="Login Page" width="400" height="300" styleName="loginPanel" verticalAlign="middle" horizontalAlign="center" backgroundImage="assets/images/hello.jpg" backgroundAlpha=".1">
<mx:VBox width="260" height="95" styleName="loginBox" backgroundAlpha=".2">
<mx:HBox width="100%">
<mx:Label width="85" text="User Name" styleName="loginTextStyle"/>
<mx:TextInput width="150" id="userName"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="85" text="Password" styleName="loginTextStyle"/>
<mx:TextInput width="150" id="password" displayAsPassword="true"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Spacer width="80%"/>
<mx:Button label="Enter" id="submit" click="mouseClickSubmit()"/>
</mx:HBox>
</mx:VBox>
</mx:Panel>
</mx:VBox> -
ExternalInterface HTTPSercvice
Hello Everyone,
I have a function that sends data to the backend on browser
close. When I set the function to be triggered by the closing of
the browser
(ExternalInterface.addCallback("myFlexFunction",sendAnalyticsAS);),
it doesn't work. I know the function works because if I call it at
other times in the code it sends the data. However when I debug,
the debugger steps all the way through the function's code , even
past "httpservice.send(params)" however the backend receives
nothing. What could I be doing wrong ... other than being dumb.
Sincerely,
JDall"drillnaut" <[email protected]> wrote in
message
news:gn04pm$3m1$[email protected]..
> Hello Everyone,
> I have a function that sends data to the backend on
browser close. When
> I
> set the function to be triggered by the closing of the
browser
>
(ExternalInterface.addCallback("myFlexFunction",sendAnalyticsAS);),
it
> doesn't
> work. I know the function works because if I call it at
other times in
> the
> code it sends the data. However when I debug, the
debugger steps all the
> way
> through the function's code , even past
"httpservice.send(params)" however
> the
> backend receives nothing. What could I be doing wrong
... other than
> being
> dumb.
You've called it after the ActiveX control has been
destroyed.
Try calling it onBeforeUnload.
Maybe you are looking for
-
Error in Team Calendar View in new WD ABAP Lea Req. app in ECC 6.0 EhP5
Hi Gurus, We have upgraded our ECC system from ECC 5.0 to ECC 6.0 EhP5 recently and deployed new Business Packages for ESS WDA 1.50 and MSS 1.51 which supports new WD Abap applications supplied in EhP 5. We have configured Leave request application a
-
How can I use the YouView remote to switch HDMI in...
I have the latest style YouView remote with the large YouView and BT Vision buttons. It's programmed to my control my Sony TV, with channel up/down, volume up/down and power on/off working fine. But there's no button that switches between HDMI inputs
-
Send a back bean to another jsf
Hi to everyone, can anyone tell me, how i can send a back bean of a jsf page to another jsf page. For example JSF1 send his to bean to JSF2. It's like a session variable? Thanxs, Fabio
-
When I crop in LR3 and move into PSE, the crop ratio changes.
I like LR's crop tool better than PSE, so I use that to crop before I move into PSE for further editing. I don't know if this would make a difference, but I do save the LR copy as a jpeg first cause I'm not always ready to finish editing it at that p
-
Print popup appears every time i save biiling document vf01/vf02
Hi All, I am facing following problem in PRD system while saving billing doc via VF01 or VF02. Whenever user saves the billing dicument popup for printing that document appears. It does not allow to cancel the print. So user has to print each n every