Whatever I tried, it just wouldn't work.

I had to finally resort to giving the HTTPService object an id, and adjusting 
that object's ID inside of the initialize block.  Doing that, worked.  Setting 
the HTTPService url to the bindable var inside of the XML markup, was a no-go.




  ----- Original Message ----- 
  From: Tracy Spratt 
  To: [email protected] 
  Sent: Friday, November 30, 2007 5:23 PM
  Subject: RE: [flexcoders] Registering flashvar variables properly?



  Oops, missed that, but of course, otherwise "this[i] =" would have errored, 
since Application is not dynamic.



  Thanks' for the correction, Gordon, and never-mind, Alex.



  So, Alex, this: "url= "{scrmurl}xmlrpc/request.php"  should work.  How about 
when you do your send(), you verify scrmurl has the string in it?



  You might also try a different style of binding/assignment:

  url= "{scrmurl + 'xmlrpc/request.php'}"



  Tracy






------------------------------------------------------------------------------

  From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Gordon Smith
  Sent: Friday, November 30, 2007 4:40 PM
  To: [email protected]
  Subject: RE: [flexcoders] Registering flashvar variables properly?



  scrmurl isn't a dynamic property.. it's declared at compile time as a public 
var, and should be bindable. 



  - Gordon




------------------------------------------------------------------------------

  From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy 
Spratt
  Sent: Friday, November 30, 2007 12:23 PM
  To: [email protected]
  Subject: RE: [flexcoders] Registering flashvar variables properly?

  You won't be able to {bind} to dynamically created properties easily.  There 
may be a way to set up a binding using AS, not sure.  

  You could just set the url directly in initApp().

  Tracy


------------------------------------------------------------------------------

  From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
flexnubslice
  Sent: Friday, November 30, 2007 2:57 PM
  To: [email protected]
  Subject: [flexcoders] Registering flashvar variables properly?

  Hi,

     I'm busting my head against the wall on this one, I have to say that Flex 
is pretty frustrating when you otherwise code C++ or Java by trade.

     Poking around, I have found how to pass variables into Flex apps using 
flashvars.  If I check the Application.application.parameters value, they are 
all there.  So far so good.

     What I need to do, is pass a proxy URL from HTML, into Flex, that will be 
used as a url parameter for an HTTPService.

  I have for example:

  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
      layout="absolute" height="380" width="450" alpha="1.0" 
initialize="initApp();">

      <mx:Script>
          <![CDATA[

      [Bindable]
      public var scrmurl:String;

      private function initApp():void{
                  var elements:Array = [ "scrmurl" ]; // there's quite a few of 
these..

                  for( var i:String in elements ){            
                      if( Application.application.parameters[i] )               
 
                          this[i] = Application.application.parameters[i];
                  }    
      }
          ]]>
      </mx:Script>

  <mx:HTTPService
          contentType="application/x-www-form-urlencoded"
          id="contactform"
          method="POST"
          resultFormat="e4x"
          showBusyCursor="true"
          url= "{scrmurl}xmlrpc/request.php"
          useProxy="false"        
          fault="handleFault( event )"
          result="handleResult( event )"
  />


  The idea is to pass in scrmurl, ie http://yourdomain.com/  and the URL in 
HTTPService then becomes:
  http://yourdomain.com/xmlrpc/request.php

  Why won't they HTTPService then, acknowledge the scrmurl variable?  When it 
posts, it only posts to xmlrpc/request.php, as though the parameter is being 
completely ignored..

  Thanks!
  Alex



   

Reply via email to