Processing ArrayCollection or XML in PHP from Flex
I know this is a Flex forum, but after I use HTTPService with
POST and an ArrayCollection or XML object as the parameter, anybody
have the PHP code I would use to grab the parameter on the server
side?
Once I have grabbed it and put it in a PHP variable I can
figure out the rest.
Thanks!
One caveat for POST ing XML from AIR is that there is a bug
and it submits as GET instead. Work-around I had to use was to
upload XML file instead and then parse it.... otherwise from FLEX
If you POST the XML as a parameter like so
var params:Object = new Object()
params.postText = myXML
myHTTPService.send(params)
and your XML is something like.....
<root>
<record><data>mydata</data></record>
</root>
then the PHP script looks something like.........
foreach($_POST AS $key => $value) { ${$key} = $value; }
if(isset($postText)){
//echo $postText;
$xml = new SimpleXMLElement($postText, LIBXML_NOCDATA);
$record = $xml->record;
// use first record to capture column names into array
foreach($record[0]->record->children() as $col){
$colNames[] = $col->getName();
// then for each column , record get the values
foreach($record->record as $row){
foreach($colNames as $column){
$values[] = $row->$column;
//do something with the record
else{
exit;
//get record level element name;
$act = $xml->act;
$table = $xml->table;
$record = $xml->records;
// get column names
Similar Messages
-
Need Help with send raw xml to PHP from flex
Hello all,
I am trying to pass raw XML from flex to php.
I can pass the data using get but need to use POST.
When I submit the data via POST
the data is not available in $HTTP_RAW_POST_DATA.
Any help is greatly appreciattedHello all,
I am trying to pass raw XML from flex to php.
I can pass the data using get but need to use POST.
When I submit the data via POST
the data is not available in $HTTP_RAW_POST_DATA.
Any help is greatly appreciatted -
How to send xml to javascript from flex?
Hello,
I am using Flex Builder......I read blogs and wonderful tutorials on adobe website. But I found that I can only have data from Flex to script placed within main.template.html file.....when i tried to get same data by in my other .html or .aspx page, it did not work. Another thing I noticed in following tutorial
http://blog.flexexamples.com/2008/03/09/calling-javascript-functions-from-your-flex-applic ations-using-the-externalinterface-api/
is that we placed <iframe> in our html page to host flex object instead of using <object> tag etc.
Please just let me know how to do very same thing as defined in tutorial but by hosting out flex object using <object><embed> tags etc and how to get data into our .html or .aspx page rather putting javascript (to receive data) in main.template.html file generated by Flex Builder...???Thanks for replying,
Now I am facing another problem....I have added a script tag in index.template.html file that also contains other useful code used in my aspx page. I wanted to have that reply on my aspx page. So I placed all the script in a Core.js file and also the recieving method from flex in same Core.js file. I thought this way i will be able to access data coming from flex project to my aspx page. But something strange is happening, when i run .html file in bin-debug folder it fires receiving method placed in Core.js........but when I host that flex project .html file in my aspx page, it is not firing method. And also not firing when I run .html in bin-release folder....what am I doing wrong? -
Sending an E-mail with attachment with PHP from Flex
Hey,
I've made a custom compontent wich mails your own drawings to you. But I have a problem to send an e-mail with attachment.
I use the HttpService to send the data to the php-file, but I always get the Fault message (form phpFault()).
This is my code in Flex:
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.graphics.codec.PNGEncoder;
import mx.events.ValidationResultEvent;
import mx.controls.Alert;
[Bindable]
private var byteArray:ByteArray;
private function mailImage(comp:DisplayObject):void
var emailValidation:ValidationResultEvent = validEmail.validate();
if(emailValidation.type == ValidationResultEvent.INVALID)
Alert.show("Invalid E-mail");
else
var bitmapData:BitmapData = new BitmapData(comp.width, comp.height);
bitmapData.draw(comp);
var png:PNGEncoder = new PNGEncoder();
byteArray = png.encode(bitmapData);
httpMail.send();
private function phpResult(evt:ResultEvent):void
Alert.show("You've got mail.");
private function phpFault(evt:FaultEvent):void
Alert.show("Something went wrong. /n" + evt.message.toString());
]]>
</mx:Script>
<mx:EmailValidator id="validEmail" source="{ipEmail}" property="text"/>
<mx:HTTPService id="httpMail" url="php/byte-receiver.php" method="POST" result="phpResult(event)" fault="phpFault(event)">
<mx:request>
<img>{byteArray}</img>
<mail>{ipEmail.text}</mail>
</mx:request>
</mx:HTTPService>
<mx:Label text="draw your own image" styleName="h1" x="10" y="0" width="493" height="60"/>
<mx:Canvas
id="drawCanvas"
x="10" y="77"
width="561" height="245"
borderStyle="solid" borderColor="#A6A6A6">
</mx:Canvas>
<mx:Label x="10" y="329" text="Your e-mail:" styleName="text"/>
<mx:TextInput
id="ipEmail"
x="86" y="324" width="417"/>
<mx:Label
id="lblMailImage"
x="10" y="383"
text="Mail my image"
click="mailImage(drawCanvas)"
mouseOver="lblMailImage.setStyle('color', '#00067b')"
mouseOut="lblMailImage.setStyle('color', '#717171')"
styleName="button"/>
</mx:Canvas>
This is my PHP code
<?php
$fileatt_type = "application/octet-stream"; // File Type
$fileatt_name = "ImgContact.png"; // Filename that will be used for the file as the attachment
$email_from = "[email protected]"; //Who the email is from
$email_subject = "Contact Winckelmans.net"; // The Subject of the email
$email_message = "Mail send by winckelmans.net. Your drawing is in the attachment"; // Message that the email has in it
$email_to = $_POST['mail']; // Who the email is too
$headers = "From: $email_from";
$data= $_POST['img'];
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message . "\n\n";
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
$mailsend = mail($email_to, $email_subject, $email_message, $headers);
echo $mailsend;
?>
This is the error I get in an Alert:
(mx.messaging.messages::ErrorMessage)#0
body = ""
clientId = "DirectHTTPChannel0"
correlationId = "F3C16CE1-65CF-E690-1907-D28293FD6BB9"
destination = ""
extendedData = (null)
faultCode = "Server.Error.Request"
faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: php/byte-receiver.php"]. URL: php/byte-receiver.php"
faultString = "HTTP request error"
headers = (Object)#1
DSStatusCode = 0
messageId = "7A1DCDBE-0358-7E39-3AF8-D282945A7748"
rootCause = (flash.events::IOErrorEvent)#2
bubbles = false
cancelable = false
currentTarget = (flash.net::URLLoader)#3
bytesLoaded = 0
bytesTotal = 0
data = ""
dataFormat = "text"
eventPhase = 2
target = (flash.net::URLLoader)#3
text = "Error #2032: Stream Error. URL: php/byte-receiver.php"
type = "ioError"
timestamp = 0
timeToLive = 0
Thanks in advance
VincentHi
I'm having the same issue, except my application actually sends the email but the attachment is 0 octet and it doesn't even give me an error... Any chance you found a solution for this and could share it ?
Thanks -
How to receive XML from Flex HTTP POST
Hi,
We curreontly have a setup where we have a FLEX frontend send an XML through a HTTP POST and awaiting a response also in XML. On the backend this is handled relatively simply by a PHP script that basically does the following:
read data (in XML)from FlEX HTTP POST into a new temp XML file.
execute a c++ program with the XML file as one of the parameter.
return the result to FLEX
We have decided to move to BlazeDS for various reasons.
Looking at the examples bundled with BlazeDS they have a jsp example that returns an XML result to FLEX so that part is fine. I am trying to find an example of JSP (or Servlet) that is able to read the XML data from FLEX and write it into a temp XML file. I would then try to use runtime.exec to invoke a local C++ program to process the XML file the result of which will be sent back to FLEX.
Any help will be very much appreciated!<div class=Section1><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>I’d avoid calling an executable just to process XML –your<br />application server would provide enough support for reading and writing XML, no?<br />Also, if you’re only planning on working with XML then even BlazeDS might<br />be overkill because its focus is on sending strongly typed ActionScript data efficiently<br />to and from a client (it’s true that it does have a proxy service, but<br />that is not involved with processing the actual XML data).<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>How complex is your XML? Do you need to resolve ids and<br />references or can you parse it top down in a single pass? There are several<br />well known libraries in Java for dealing with XML – the choice depends on<br />how you need to interact with the XML. Most of them take an InputStream as a<br />source for reading XML and you can get the InputStream from the servlet<br />request. Googling should turn up numerous examples.<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Pete<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><br /><br /><div><br /><br /><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><br /><br /><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span<br />style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> khwong<br />[mailto:[email protected]] <br><br /><b>Sent:</b> Sunday, September 28, 2008 12:09 PM<br><br /><b>To:</b> [email protected]<br><br /><b>Subject:</b> How to receive XML from Flex HTTP POST<o:p></o:p></span></p><br /><br /></div><br /><br /></div><br /><br /><p class=MsoNormal><o:p> </o:p></p><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>A new discussion was started by<br />khwong in <br><br /><br><br /><b>General Discussion</b> --<br><br /> How to receive XML from Flex HTTP POST<br><br /><br><br />Hi, <br><br /><br><br />We curreontly have a setup where we have a FLEX frontend send an XML through a<br />HTTP POST and awaiting a response also in XML. On the backend this is handled<br />relatively simply by a PHP script that basically does the following: <br><br /><br><br />read data (in XML)from FlEX HTTP POST into a new temp XML file. <br><br />execute a c++ program with the XML file as one of the parameter. <br><br />return the result to FLEX <br><br /><br><br />We have decided to move to BlazeDS for various reasons. <br><br /><br><br />Looking at the examples bundled with BlazeDS they have a jsp example that<br />returns an XML result to FLEX so that part is fine. I am trying to find an<br />example of JSP (or Servlet) that is able to read the XML data from FLEX and<br />write it into a temp XML file. I would then try to use runtime.exec to invoke a<br />local C++ program to process the XML file the result of which will be sent back<br />to FLEX. <br><br /><br><br />Any help will be very much appreciated! <o:p></o:p></p><br /><br /><div class=MsoNormal><br /><br /><hr size=2 width=200 style='width:150.0pt' align=left><br /><br /></div><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>View/reply at <a<br />href="http://www.adobeforums.com/webx?13@@.59b69b23">How to receive XML from<br />Flex HTTP POST</a><br><br />Replies by email are OK.<br><br />Use the <a<br />href="http://www.adobeforums.com/webx?280@@.59b69b23!folder=.3c061a83">unsubscribe</a>< br />form to cancel your email subscription.<o:p></o:p></p><br /><br /></div><br /><br /></div>
-
Completely different AMF request packets for same remote service call from Flex to PHP using ZendAMF
I was trying to debug why one of the remote-services in our Flex application was failing randomly. What I found was interesting. Completely different AMF request packets were sent for same remote service call from Flex to PHP.
When the service call succeeds the AMF request packet looks like the following:
POST /video/flex/bin-debug/gateway.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Cookie: PHPSESSID=j6u30i8uu6c3cvp8f4kipcpf05
Referer: http://localhost/video/flex/bin-debug/main.swf/[[DYNAMIC]]/5
Content-type: application/x-amf
C ontent-length: 305
Flex Message (flex.messaging.messages.RemotingMessage) operation = getMemberFromEvent clientId = 2F997CD0-7D08-8D09-1A9B-0000422676C8 destination = MembereventService messageId = B46AB58D-2241-83F0-41E4-9FE745565492 timestamp = 0 timeToLive = 0 body = [ 280 ] hdr(DSId) = nil
And when the service fails the AMF request packet looks like this:
ServiceRequest: getMemberFromEvent; RemoteService; getMemberFromEvent
(mx.messaging.messages::RemotingMessage)#0
body = (Array)#1
[0] 250
clientId = "1AA4FAAB-AEA5-8109-4B0D-000002B3A9A1"
destination = "MembereventService"
headers = (Object)#2
DSEndpoint = (null)
DSId = "nil"
messageId = "2F92E6C0-FE92-A09B-B150-9FE2F28D9738"
operation = "getMemberFromEvent"
source = "MembereventService"
timestamp = 0
timeToLive = 0
Also, following is the error message on Flex when the service fails:
{Fault code=Channel.Call.Failed, Fault string=error, Fault detail=NetConnection.Call.Failed: HTTP: Failed, Destination=MembereventService}
We are using Swiz as the micro-architecture for Flex development and Zend AMF for remoting between Flex and PHP.
Any ideas what is wrong here, what is causing Flex to send different request packets for the same service & what I can do to fix it?Hi, I know that your post is almost 5 years ago, but have you found the solution to this issue?
Thanks. -
How to get Checkbox Value from Flex in PHP.
Hi,
I need to know how to get a checkbox value from flex in PHP-POST/GET because I don't know what is the value property of a checkbox in flex.
Please Help.Hi,
It is very simple. Follow the steps below to achieve the solution,
1. Write a check-box change event to capture the value of the check box. Store this value in a variable(say bolChkSelected:Boolean).
2. In step 1 you got the value of the check box. Now your aim is to send the value to php. Declare a httpService in your flex application(i think you are aware of using it).Ok..im writing it
<mx:HTTPService id="sampleService" resultFormat='e4x' url='http://yourdomain/file.php' result='handleResult()' fault='handleFault()'>
</mx:HTTPService>
3. Now the actual solution... u need to send the shcStatus in to php..
Declare an object to hold the data
var objparameters:Object={};
objparameters['CheckBoxdata'] = bolChkSelected;
--in the above line... 'CheckBoxdata' is used as a parameter to php..you shud have the same variable name while accessing in php file also..
in php file..
checkboxstatus = $_POST[''CheckBoxdata''];
echo checkboxstatus
thats it.. -
Urgent help for processing XML stream read from a JAR file
Hi, everyone,
Urgently need your help!
I am reading an XML config file from a jar file. It can print out the result well when I use the following code:
===============================================
InputStream is = getClass().getResourceAsStream("conf/config.xml");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line); // It works fine here, which means that the inputstream is correct
// process the XML stream I read from above
NodeIterator ni = processXPath("//grid/gridinfo", is);
Below is the processXPath() function I have written:
public static NodeIterator processXPath(String xpath, InputStream byteStream) throws Exception {
// Set up a DOM tree to query.
InputSource in = new InputSource(byteStream);
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
dfactory.setNamespaceAware(true);
Document doc = dfactory.newDocumentBuilder().parse(in);
// Use the simple XPath API to select a nodeIterator.
System.out.println("Querying DOM using " + xpath);
NodeIterator ni = XPathAPI.selectNodeIterator(doc, xpath);
return ni;
It gives me so much errors:
org.xml.sax.SAXParseException: The root element is required in a well-formed doc
ument.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213
at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XM
LDocumentScanner.java:570)
at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.endO
fInput(XMLDocumentScanner.java:790)
at org.apache.xerces.framework.XMLDocumentScanner.endOfInput(XMLDocument
Scanner.java:418)
at org.apache.xerces.validators.common.XMLValidator.sendEndOfInputNotifi
cations(XMLValidator.java:712)
at org.apache.xerces.readers.DefaultEntityHandler.changeReaders(DefaultE
ntityHandler.java:1031)
at org.apache.xerces.readers.XMLEntityReader.changeReaders(XMLEntityRead
er.java:168)
at org.apache.xerces.readers.UTF8Reader.changeReaders(UTF8Reader.java:18
2)
at org.apache.xerces.readers.UTF8Reader.lookingAtChar(UTF8Reader.java:19
7)
at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.disp
atch(XMLDocumentScanner.java:686)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
canner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.
java:195)
at processXPath(Unknown Source)
Thank you very much!
Sincerely Yours
Davidorg.xml.sax.SAXParseException: The root element is required in a well-formed document.This often means that the parser can't find the document. You think it should be able to find the document because your test code could. However if your test code was not in the same package as your real (failing) code, your test is no good because getResourceAsStream("conf/config.xml") is looking for that file name relative to the package of the class that contains that line of code.
If your test code wasn't in any package, put a slash before the filename and see if that works. -
Special Character XML Web Service call from Flex
Hi,
Let me first give a little background.
I have to query and return data in XML format. To do so, I have created a custom DSC component. In cases where XML has special characters, LC throws error saying that XML is not properly formed. To over come this issue I used CDATA tag at DSC component. Now LC works as it should and I returns correct result.
I have a web service call from Flex to get this XML result. Every time i trigger this web service I get an error message saying </document> tag is missing.
I understand in Flex, web service returned data is wrapped in CDATA tag, thats what i causing all this issue.
I am not sure, how to handle this situation, I am sure this is a common problem and there should be ways to work around it.
I would really appreciate if any one could point me in the right direction.
Thank you ..The web service has four operations in it, I need pingQuery operation execution code since it doesnot need any input value.
I have used code something like this.. Any one please correct me if I am wrong..
<mx:WebService
<mx:WebService> id="webService" wsdl=""https://hydrogen.csd.sc.edu/axis2/services/AcademicHistoryService?wsdl
>
<mx:operation name="pingQuery"resultFormat="
object"result="resultHandler(event);"
fault="faultHandler(event);"
>
<mx:request>
<PingQuerySpecification>
<value>
fsdf
</value>
</PingQuerySpecification>
</mx:request>
</mx:operation>
</mx:WebService>
private function resultHandler(evt:ResultEvent):void {Alert.show(ObjectUtil.toString(evt.result));
private function faultHandler(evt:FaultEvent):void {Alert.show(evt.message.toString()); -
DateField from Flex 4 to PHP-mysql
Problem :
when inserting a record from flex to mysql the date is reduced by 1 day.
changes the date to 1 days ahead..like flex"13/12/2009" to mysql"12/12/2009"
in Flex m15.POSTON = pOSTONDateField2.selectedDate;
PHP is genereated by Flash Builder ..no changes in that.
$item->POSTON->toString('YYYY-MM-dd HH:mm:ss')
mySQL works fine.
Here is the interesting bit..when I change my computer location from UTC +10( Australia) to UTC + 0..it works fine.
changed the PHP setting date.timezone ="Australia/Brisbane"
date_default_timezone_set('Australia/Brisbane');
stilll same result..
Why dose this happen how do I fix it.
Thanks
KWe've converted our Flex base Ultimate DataGrid (http://www.flexicious.com/Home/Ultimate) to HTML (http://www.htmltreegrid.com/Home/Demo) with a with EXT JS, DOJO, or Jquery flavors. We have built AS - JS code converters, as well as display list/event dispatcher API ported to JS and are assisting customers with migration, if you are interested.
-
Help with TaskManagerService.processSearch from Flex
I am trying to use TaskManagerService.processSearch from Flex (and from C#) but I am having trouble populating the conditions array.All the documentation and examples I could find were in java, and thus use addContidion()... which I do not have access to.
What I'm after is an Object (or XML) representation of a processSearchFilter.
I am trying with something like:
{conditions:[{property:"provCar.RequestID", operator:"=",value:"53"}],
serviceName:"SBDBWorkflow/RequestWorkflow"
and I am getting an error saying my condition cannot be cast to com.adobe.dsc.filter.Condition!
If I use:
conditions:[{name:"provCar.RequestID", operator:"=",value:"53"}],
serviceName:"SBDBWorkflow/RequestWorkflow"
the condition is ignored and I get back all my process instances.
Any idea what I am getting wrong on the Condition object?
TIA
julioHi again,
the xml for the combobox datasource is as follows
<animals>
<animal>
<id>1</id>
<name>dog</name>
</animal>
<animal>
<id>2</id>
<name>cat</name>
</animal>
<animal>
<id>3</id>
<name>horse</name>
</animal>
</animals>
and my <mx:HTTPService> is:
<mx:HTTPService id="dropDown" useProxy="false" url="
http://localhost/~ronnyk/combobox.php"
resultFormat="e4x" result="get_drop_down(event)" />
public function get_drop_down(e:ResultEvent):void{
var dropArr:XML = e.result as XML;
cb.dataProvider = dropArr.animal;
cb.labelField = "name";
cb.data = "id";
public function clickme():void{
txtinput.text = cb.selectedItem as String;
I can't figure out which part I did wrong, in order to get
the id instead of the name when the user clicks the button -
How to Call a AIR application from Flex Application
Hi,
I have Used AIR (Desktop application) in Flex Builder to Upload a File from a local path and save it it a server path.
I need to Call this AIR(Desktop application) from my Flex Application.... i.e
I am using a link button to send a event using Script and Forward that Desktop application from Flex Screen
But it doesnot load that (Desktop application) in Screen. Only Balnk screen is loaded from path
Here is the code
AIR(Desktop application)
<?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="openBrowseWindow();">
<mx:HTTPService id="urlpath" showBusyCursor="true" useProxy="false" method="
POST" url="http://localhost:8080/nat/FlexAction.do?method=UrlPath"result="pathresult(event)"
fault="faultHandler(event)"
>
</mx:HTTPService>
<mx:Script>
<![CDATA[
import mx.events.FileEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
private
var openFile:File = new File()
private
function openBrowseWindow():void{openFile.addEventListener(Event.SELECT, onOpenFileComplete);
openFile.addEventListener(Event.OPEN, load);
openFile.browse();
private
function load():void{Alert.show(
"load");
var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
//var textTypes:FileFilter = new FileFilter("Text Files (*.txt, *.rtf)", "*.txt; *.rtf");
var allTypes:Array = new Array(imageTypes);openFile.browse(allTypes);
private
function faultHandler(event:FaultEvent):void {
//Alert.show("Fault")Alert.show(ObjectUtil.toString(event.fault));
private
function pathresult(event:ResultEvent):void{Alert.show(
"res")
//Alert.show(ObjectUtil.toString(event.result));}private
function onOpenFileComplete(event:Event):void{
//mx.controls.Alert.show("event: "+event.target.nativePath +"UR!!!");
var pPath = event.target.nativePath;
var parameters:Object = {FlexActionType:"PATH",path:pPath};
// Alert.show("Image Selected from Path : "+pPath); urlpath.send(parameters);
//Alert.show("Passed.."+parameters);}
]]>
</mx:Script>
<mx:Button click="openBrowseWindow();onOpenFileComplete(event)" name="Upload" label="Upload" x="120.5" y="10"/>
Here is Mxml Code for Flex Application
<?xml version="1.0" encoding="utf-8"?><mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns="http://ns.adobe.com/air/application/1.0.M4" >
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function Upload():void{
// CursorManager.setBusyCursor();
//var url:String = "HomeAction.do?method=onLoad";
//var url:String = "assets/Air.swf";
var url1:URLRequest = new URLRequest("assets/Air.swf");navigateToURL(url1,
"_self");
// CursorManager.removeBusyCursor(); }
]]>
</mx:Script>
<mx:LinkButton id="up" click="Upload()" x="295" y="215" label="UpLoad"/>
In this code i forward using s url to Open tat Desktop application but a blank screen appears with out the proper output...
Please Help me in this to forward AIR from Flex Screen..
Thanks in Advance
With Regards
Gopinath.A
Software Developer
First Internet Systems Pvt. Ltd.,
Chennaitry this
http://www.leonardofranca.com/index.php/2009/09/17/launching-an-installed-air-application- from-the-browser/
regards
Leonardo França
Adobe Certified Expert Flex 3 with AIR
Adobe Certified Expert Rich Internet Application Specialist v1.0
Adobe Certified Expert Flash CS3 Professional
Certified Professional Adobe Flex 2 Developer
Adobe Certified Professional Flash MX 2004 Developer
http://www.leonardofranca.com
http://twitter/leofederal
Manager AUGDF - Adobe User Group do Distrito Federal
http://www.augdf.com.br
http://twitter/augdf -
Air 1.5 debug from flex 3
With the update of flex to 3.2.0 is not possible to debug an
application. When start a debug session the application start but
the breakpoint don't works. Closed the application, flex notify the
error to establishing a debug session. I'm working on Mac OSX
10.5.5.
This is the simple code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
private function init():void {
trace('init!');
]]>
</mx:Script>
</mx:WindowedApplication>
Starting the debug session the application start but the
trace command has no output in console panel and if I put a
breakpoint on row 6 the application don't stop!
This is the result output at the end of the application:
Process terminated without establishing connection to
debugger.
Command:
"/Applications/Adobe Flex Builder 3/sdks/3.2.0/bin/adl"
-runtime "/Applications/Adobe Flex Builder
3/sdks/3.2.0/runtimes/air/mac" "/Users/sbaldizz/Documents/Flex
Builder 3/bbb/bin-debug/bbb-app.xml"
"/Users/sbaldizz/Documents/Flex Builder 3/bbb/bin-debug"
Output from command:
init!I'm also having this problem. Changed the NS to 1.5, set the
htmlPlayer to 10.0.0, updated FB, ensured the SDK was at 3.2,
installed the FP 10 debugger AX plugin as well as the mozilla
plugin.
Still can't debug. I am dead in the water, lost two days of
work, and would have preferred to just use AIR 1.1 if I had of
known, but the autoupdate screwed my program up. -
Not able to call Java from flex using RemoteObject
hi,
I am badly stuck in compiling my flex app to connect to Java code on the server side using LCDS remoteObject component.
My swf file wouldn't trigger a method on the Java class, below is the snippet of all relevant codes, i just don't know what to do.
Please help on what am i missing or what i am doing wrong in this.
------> 1. here is the ant target that uses mxmlc compiler option
<target name="flex-compile" depends="copy-all">
<mxmlc
file="${uisrc}/OnlineServicesPortal.mxml"
output="${prjdeploydir}/OnlineServicesPortal.swf"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="true"
incremental="true"
as3="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs" />
</library-path>
<compiler.source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.include-libraries dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs/datavisualization.swc" />
<include name="libs/fds.swc" />
<include name="libs/player/10/playerfds.swc" />
<include name="locale/en_US/datavisualization_rb.swc" />
<include name="locale/en_US/fds_rb.swc" />
</compiler.include-libraries>
<!--compiler.services filename="${src}/flex/services-config.xml"/-->
<!--context-root context-path="portal"/-->
<default-size width="500" height="600" />
</mxmlc>
</target>
---------2. services-config.xml file
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
<channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
</channel-definition>
----------3. remoting-config.xml file
<service id="remoting-service"
class="flex.messaging.services.RemotingService">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
<channel ref="my-http"/>
</default-channels>
<destination id="portal">
<properties>
<source>com.mssb.portal.impl.PortalService</source> <!---this class file is valid & exists-->
</properties>
</destination>
</service>
-----------4. mxml file
<mx:RemoteObject id="myRO" destination="portal" result="createFieldsResultHandler();" fault="createFieldsFaultHandler();">
</mx:RemoteObject>
myRO.persistServiceDefinition(serviceDef) //called from action script function invoked upon a click of a button.actually , I have laready given print stataement for the data in the context property file that you can see in the output. Today I am also able to call the bpel process using the same java program from my DOS command promt(cmd). Don't understand why the problem is occuring in unix.
please help. -
Export ArrayCollection into XML file
Hello all,
Is it at all possible to export an ArrayCollection from Flex, into a XML file.
My array collection is being viewed in a datagrid as follows
<mx:DataGrid x="360" y="120" width="448" height="200" dataProvider="{questionsArr}">
<mx:columns>
<mx:DataGridColumn headerText="Question" dataField="question"/>
<mx:DataGridColumn headerText="Start" dataField="start" width="40" textAlign="center"/>
<mx:DataGridColumn headerText="Stop" dataField="stop" width="40" textAlign="center"/>
</mx:columns>
</mx:DataGrid>
And i want the output of the XML to look like this
<Cue>
<section question="" start="" stop=""/>
<section question="" start="" stop=""/>
<section question="" start="" stop=""/>
</Cue>
Is it at all possible ? I mean all the data is there ready, it just needs to be saved . .Hi djh88ukwb,
Check out the link below, it shows an example as how to convert ArrayCollection to Object:
http://blog.flexexamples.com/2008/03/04/converting-objects-to-xml-packets-using-the-simple xmlencoder-class-in-flex/#more-543
Thanks,
Bhasker Chari
Maybe you are looking for
-
Item Code Auto Generation Based on User defined Tables
I need the Item code like PRODUCT TYPE-ITEMGROUP-ITEMCODE-SUBITEM-BRAND-COLOR e.g .FG-01-01-00-001-00. I created the following User define Tables and link to Item Master data U_PRO - FOR PRODUCT TYPE U_GROUP - FOR ITEM GROUP U_IT
-
Files Need to be Picked from the Webservice.
Hi Gurus, Have a requirement , Need to Pick the Files from the Webpage . Please suggest me what adapter i have to use and what congifurations need to be done over here. Thanks and Regards, Ram.
-
My problem comes up in iMovie '11 (v. 9.0.4/build 1634) and has done so from the beginning of my using the software. I want to determine the length of time that I want a a still to show (in the context of stills and movie clips). However, I cannot re
-
Hi all, I have a piece of code that initializes Java help on windows perfectly but the same code causes an exception in Linux. below is the exception I am getting in Linux. because of this, the applications help is not appearing in Linux. Does anybod
-
what is the diffs b/w safety stock, reorder point, backflush