Post Variables Using Actionscript

Hi,
I have seen on the docs that we could write HTTPService in
Actionscript method. I have completed the entire section based on
the description of the method defined on the doc, but I am having
some issues defining the variables to pass to the actual service
(mx:request as in MXML).
I need to know the actual variable that gets passed to the
service, because I would like to reuse the information returned
from the service for further edits. Since this information is not
stored in the XML, I wonder if anyone can tell me what is wrong
with the syntax below? Currently, all I get is this error:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
Anything is appreciated.

"alice_data" <[email protected]> wrote in
message
news:ge9nf1$1ai$[email protected]..
> Hi, Amy:
>
> Sorry, but I think I am getting a little confused at
this point. I have
> removed
> var loader:URLLoader = new URLLoader();
> loader.addEventListener(Event.COMPLETE,
function(event:Event):void {
> trace("finished sending and loading: "+ loader.data);
> });
> loader.load(request);
> and ran the code again and received the same error as
before.
>
> Part of the problems with the error I have been getting
is that I have
> not
> defined my parameters correctly, but again I tried to
take the parameter
> definition from the following line, it tells me I need
one argument:
> <mx:Button
> label="Submit" id="mySubmitButton"
click="useHttpService()"/>. What should
> I
> put in the parenthesis?
>
> The doc I referred to is at
>
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?co
>
ntext=LiveDocs_Book_Parts&file=dataservices_099_15.html, but I
think my
> main
> problem here is that I am not sure how to define the
variables and pass it
> to
> the actual service and have the variables be handled
internally through
> Actionscript. Or, is what I trying to accomplish here
not possible at all?
Try changing this:
private var request:HTTPService;
to
private var request: URLRequest;
I still think you're getting a lot of warnings you're
ignoring (check the
problems tab). You should have gotten a duplicate variable
definition for
what you had.
What you're trying to accomplish is possible, but you DO need
to pay
attention to the warnings and errors Flex is trying to tell
you about. They
are your friend.

Similar Messages

  • Need help with setting a variable using actionscript

    So I am trying to import in XML and this is working fine, But
    once in flash I need to reference this variable in a later script.
    Here is what I got.
    function loadXML(loaded) {
    if (loaded) {
    /////this is the variable, which is working, it pulls the
    info from the xml document properly.
    var node1 =
    this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
    ////another variable, etc...
    var node2 =
    this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
    /////when traced it outputs the proper value.
    trace(node1);
    ////////does not work here though.
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("co.xml");
    var latmin = 37;
    var latmax = 41;
    var lonmin = -109;
    var lonmax = -102;
    this.geoPlotter_gp.setRange(latmin, latmax, lonmin, lonmax);
    this.geoPlotter_gp.setNodeSymbol("geoPloterNodeSymbol");
    this.geoPlotter_gp.addNode(40.48, -107);
    ////////////////This is where I need to now use the variables
    defined above//////////////
    this.geoPlotter_gp.addNode(node1);// Boulder
    this.geoPlotter_gp.addNode(node2);// Denver
    /////any ideas all? I am sure this is something simple...I am
    just overlooking something.

    when you prefix a variable using var within a function,
    you're making it local to that function. ie, node1 and node2 are
    undefined outside loadXML().
    to remedy, don't prefix with var.

  • Formula variable using Replacement path not working

    Dear All,
    I am using a query to calculate YTD values in the report. I am using a formula variable to calculate the number of months. Formula is
    Month To - Month From+1
    When I am giving the range from 001 to 006 for period in th evariable screen,
    I am gettung Month To as 6 and Month From as 6 with total no . of months as 1.
    I think Month From is not being caculated properly. I created another formul variable using Replacement path, for characteristic Posting period, replace with a Key and dimension ID as number with out any offset.
    Still not working.
    Any suggestions.
    Thanks and Regards,
    Srini
    Edited by: Srinivas on Apr 24, 2008 11:13 AM

    Hello,
    I have seen this document already. It is slightly different from what I am trying to do here than what the post shows. How ever,  I did everything right, atleast seems to be and don´t know why I am not getting the From value from the posting period selected. To value variable is coming right.
    Any more sugegstions.?
    Thanks and Regards,
    Srini

  • Praoblems in creating a variable using JSP - el

    Posting this again :
    Please help
    How to create a variable using <c:set> whose value is
    specified within the tag body . I want to use this
    variable created as one of the parameters in a
    javascript method call . But my problem is when I run
    my application and do the view source , the HTML page
    shows me the variable as it is without substituting
    its value .
    can anyone help ??? its urgentThis is my code :
    <c:forEach var="photo" items="${photos}" varStatus="status" >
    <c:set var="photolink${status.index}" >
    Click to view full-size:<br><img style=margin-left:20px src='http://147.147.2.91:7001/pfk-deploy/thumbnail.do?photo="{photo.photoid}"' border=0 width=75 height=56><br><br>
    </c:set>
    doSearch( "<%=desc%>", '{c:out value="${photolink}"/}');
    </c:forEach>
    Iam using weblogic 8.1 and my web.xml says Web Application 2.3.
    Can this be a problem.

    Posting this again :
    Please helpWhy? How'll that help - you should have posted the extra info in your original post - http://forum.java.sun.com/thread.jspa?messageID=4327403. Double post.
    ram.

  • Inserting text from a variable in actionscript

    what is it called when you insert text from a variable in actionscript?

    Your question is not clear.  There is no specific name for the process of inserting text from a variable that I am aware of.
    If you have a dynamic textfield that you have assigned an instance name to, let's say you named it "tField", then to assign a variable called "aVar" to that textfield you would use:
    tField.text = aVar;

  • How to adjust the path of a tween using actionscript

    I'm a novice at Actionscript3 and would greatly appreciate an answer to what seems like a simple question:
    Here's my project:
    http://home.comcast.net/~samiri/director/mortals/amadoFlashPortrait/index.htm
    Click on the gray scale frame images. A larger version of that image tweens out along the z axis. However it comes from 'somewhere else' not from 'within the frame.' How do I get the each larger gray scale frame image to look like it comes directly from the place where the user clicks (not to one side or the other)?
    So I guess what I'm asking is how to adjust the path of the tween along the x and y axis using the actionscript code (below).
    My method:
    I'm using this line of code in my script:
    var myTween:Tween = new Tween(mdImg, "z", Strong.easeOut, 300, 0, 1, true);
    "mdImg" is the variable that holds the name of the hotspot clicked upon by the user.
    I have the larger (faded edge) image positioned directly on top of the frame image and just kept invisible until the User clicks on the hotspot over the frame image.
    Thanks much.

    Thanks moccamaximum,
    By "do your tweens manually" you mean to use the timeline to do frame-based tweening? That is an option but I'm wondering (as a newbie): Isn't it better to use actionscript to do animation since you have more control and it's time based rather than frame-rate based (and works better on low performance machines)? Just curious if I should be spending the time to learn actionscript or do it in the traditional way.
    Thanks

  • How to get/set value in illustrator preference file using ActionScript 3.0

    Hi all,
    I want to get/set the flex panel components preference in illustrator preference file using ActionScript 3.0.
    I tried to achieve this  like --
    import com.adobe.illustrator.Preferences;
    var pref : Prefereneces = new Preferences();
    //To set value I used  this...
    pref.setStringPreference("url", id1.text);
    //To get value I used this..
    id1.text = pref.getStringPreference("url");
    i think there is prb in creating  Preference variable but I am unable to resolve.
    plz help.
    Thanks.

    I am having trouble with setStringPreference. It seems to be setting the value to 0 in the Prefs file. When I first wrote the code, it was working, but something is keeping it from saving the right value now. Did you get yours working? Any ideas?

  • Spry XML data set and dynamic post variables

    Hi,
    I am trying to create an XML data set that has dynamic post
    variables.
    Everytime something is pressed on the page a variable changes
    and I then want to reload the XML data set using the new variable.
    I know I can just pull in an XML with all possible variables
    and filter client side but this would make it way too large.
    Does anyone know what I may need to do.
    I tried this:
    var myVar = 0;
    var dss = new Spry.Data.XMLDataSet (
    '../../cgi-bin/server_details.pl' , 'top' , { method: 'POST' ,
    postData: sid=ajaja21&ip=127.0.0.1&cid=' . myVar ,
    subPaths: [ "auth" , "plugins" , "plugins/plugin" ] , keepSorted:
    "true", sortOnLoad: "plugins/plugin/order", sortOrderOnLoad:
    "descending", useCache: false, loadInterval: 10000 } );
    onclick="myVar=1";
    But the script doesn't understand the post variables sent (it
    does when I remove the . myVar part and put in a static value). I
    think it isn't sending that dynamic variable with the post
    variables.
    Any ideas anyone?
    Thanks

    Well I had it working when I stripped back everything and
    just had the dss data set and a single onclick function, but now
    that I put it back together it hash foobared again.
    Here are the relevant bits of code that I've changed.
    The function to change server id:
    //function to run when changing the server id
    function changeServer ( sid ) {
    //set the url to use the current server id
    dss.setURL = ( '../../cgi-bin/server_details.pl' , { method:
    'POST' , postData:
    'sid=7gv1m3vjvagfl7h7qeefb8iodj8evhmb&ip=127.0.0.1&cid='+sid
    //force a reload of the server data
    dss.loadData();
    The inital load of the data set
    var dss = new Spry.Data.XMLDataSet (
    '../../cgi-bin/server_details.pl' , 'yams' , { method: 'POST' ,
    postData:
    'sid=7gv1m3vjvagfl7h7qeefb8iodj8evhmb&ip=127.0.0.1&cid=0' ,
    subPaths: [ "auth" , "plugins" , "plugins/plugin" ] , keepSorted:
    "true", sortOnLoad: "plugins/plugin/order", sortOrderOnLoad:
    "descending", useCache: false, loadInterval: 10000 } );
    And the part that changes the server id
    <td align="left" style="cursor:default; width:174px;"
    onclick="changeServer({dsv::servers/server/@id})">{dsv::servers/server/name}</td>
    I checked that the function is receiving the correct server
    id and I even tried hard coding the cid variable to 2 in the change
    function but it still wasn't changing on the server side.
    Any ideas?
    Thanks

  • Retrieve POST variables just like in a normal HTTP forms

    Hi All :D
    Can anyone tell me how to retrieve POST variables just like
    in a normal HTTP form?
    I have 2 flex applications. One will send the POST variables
    and I would like the other to retrieve
    these variables. How to implement this?
    Thanks :D

    "JuggerOgre" <[email protected]> wrote in
    message
    news:g92bce$kgf$[email protected]..
    > Hi All :D
    >
    > Can anyone tell me how to retrieve POST variables just
    like in a normal
    > HTTP
    > form?
    > I have 2 flex applications. One will send the POST
    variables and I would
    > like
    > the other to retrieve
    > these variables. How to implement this?
    Flex is a client side application. You could send them from
    one client and
    then request them from the other client, or you could use
    something like
    BlazeDS to "push" the information.
    HTH;
    Amy

  • Php parse variable using javascript

    hey there,
    i am trying to parse a php variable using the allwebmenu
    program. Never done this before and wondering what javascript needs
    to be created and inserted to replicate the
    http://www.backyardcanvas.com/coremember/profileview.php?recordID=<?php
    echo $row_table['field'];?>
    normal syntax.
    Help greatly appreciated
    Thanks

    Hi there,
    Thanks for the reply, and yes you're right it IS a bit of an elephant.  However, when I posted it, I had formatted it so that one little bit was highlighted showing the problematic portion of code.  The rest was just there for background (and was formatted to be much friendlier to read).
    For some reason this forum wipes all text formatting.  Anyway, here's the query - now extracted from the elephant...
    Let's say that stored in my form1.SCO variables object there is the following...
    var Cityscope_NorthSydney_CostUser1 = 120.55;
    Now let's also say that in the scope of a specific form object...
    var ScopeAreaSelected = "NorthSydney";
    Within the form object scope (same scope as ScopeAreaSelected), I am trying to create a variable called "CostUser1" that stores the price of the variable in the form1.SCO as follows...
    var CostUser1 = sco.window["Cityscope_" + ScopeAreaSelected + "_CostUser1"];
    I've used both "window" in Javascript before to make such frankenstein variable names work (using "window" to reference the top-level variable scope) but the code I am using here doesn't work.
    While it's probably not the greatest all-round solution, do you know how I would get this to work?
    Cheers,
    Stanbridge

  • Using ActionScript to control where a break happens in TLF linked text boxes

    Let's say you want to display a directory of people including name and department person works in. This information is in an xml file and ActionScript is used to read the information in and display the text in TLF text boxes that are linked. Is there a way to use ActionScript to control orphans/widows? Meaning, let's say that the first TLF text box fills up and at the very bottom of that text box another person's name appears. Then at the top of the linked text box the department name that person works in appears. Is there a way to use ActionScript to control it so that the persons name doesn't get separated from the department name? Thanks for any help!!

    Thanks for taking time to answer my post, kglad.
    Yes. I believe I understand. I could create another button
    and call it "Reset Grid" and call this function, however what I am
    hoping for is to have the grid redraw simply by the user entering
    new values for the width and height and then clicking "draw
    floorplan" again.
    Currently the first line of code is:
    my_button.addEventListener("onPress",gridf); Should not the grid
    redraw each time and then parse the new values in the width and
    height fields? I am sure I am just dense but my grid is not
    clearing each time the "draw " button is clicked.
    You can see this happen on the sample link below. After
    entering say 20 width and 20 height values and clicking "draw"
    button, the grid is created perfectly. Then if, say new values of
    10 width and 10 height are entered and "draw" button is clicked,
    the grid does not redraw correctly using these new values.
    Sample link:
    http://216.197.127.249/grid/grid_sample_1.html
    Could the problem be that the gridf function should happen as
    the first function in the script before the new values are parsed
    again? Should a: grid_container.removeMovieClip(); execute before
    anything else is executed each time the "draw" button is clicked?

  • Forwarding A Servlet Post Variables

    Hello, I'm trying to forward some posted variables from form A to this servlet where I am adding one more then forwarding it on. How can I get it to forward and show up in the URL window instead of how I'm doing it here with the servlet context?
    package com.shoponlinesecure.order;
       import java.io.*;
       import javax.servlet.*;
       import javax.servlet.http.*;
       import java.util.*;
       public class AddHashAndForward extends HttpServlet {
          public void doPost(HttpServletRequest request,
          HttpServletResponse response)throws ServletException, IOException {
             response.setContentType("text/html");
             PrintWriter out = response.getWriter();
             HttpSession session = request.getSession(true);
            out.write(AuthorizeNetFingerPrint.insertFP("wil481306225","AMONaKPAIXGdLUgB","10.50",
            "789", null));
            out.close();
            RequestDispatcher dispatcher =
            getServletContext().getRequestDispatcher("https://secure.authorize.net/gateway/transact.dll");
            dispatcher.forward(request, response);
          }-thanks

    This is basically what I'm trying to do in java without any javascript. They have this thing as you can see called a <%ret variable%> that only gets executed when you hit the submit button. I'm trying to do it the way I am becuase I do not want to use javascript to simulate the asp ret variable. So I thought I forwarded it to a servlet that added it then forwarded it to the gateway I would be ok?
    Example 1 � Minimum requirements for requesting a Payment Form
    The following HTML code along with the server-side script represents the minimum data that would need to be inserted into a page to provide a connection to the system. It shows that the fingerprint, time stamp, and the sequence number are inserted into the HTML form POST along with Login ID and other required fields. The result of this HTML code snippet is a button. Clicking on the button will take the user to the gateway�s Payment Form.
    A call to generate the fingerprint should be made when the button is clicked and before the Payment Form request is made to the gateway. A sequence number should be generated and the total amount of the tranaction calculated before the call to generate the fingerprint is made. The function used to generate the fingerprint takes these fields (amount, transaction key, Login ID, and sequence number) The transaction amount should not change after the fingerprint is generated. All trailing spaces need to be removed from the fields used to generate the fingerprint
    <!--#INCLUDE FILE="simlib.asp"-->
    <FORM METHOD=POST ACTION="https://secure.authorize.net/gateway/transact.dll">
    <% ret = InsertFP (loginid, txnkey, amount, sequence) %>
    <INPUT TYPE=HIDDEN NAME="x_login" VALUE="your login ID goes here">
    <INPUT TYPE=HIDDEN NAME="x_show_form" VALUE="PAYMENT_FORM">
    <INPUT TYPE=HIDDEN NAME="x_amount" VALUE="amount goes here">
    <INPUT TYPE=SUBMIT VALUE="Click here for secure payment form">
    </FORM>
    The function InsertFP is provided by the gateway and can be downloaded from the Merchant Interface. This function must be called within a server-side script on the merchant Web server. The above example shows the call being made in an ASP scripting environment.

  • Accessing ICS variable using EL

    Can we access ics variable using EL. Hope this query is already posted. but I tried the solution. it is not working
    I have set an  ics variable in a CSElement and I tried to access that in the next line using EL. but I am not getting the values
    e.g
    <%
    ics.SetVar("testvar","testvalue")
    %>
    fetching value using cs : {cs.testvar}
    fetching value using ics : {ics.testvar}
    No results for both the line. Is it not possible to access ics object using EL?

    Hello
    Could you try something like:
    e.g
    <%
    ics.SetVar("testvar","testvalue")
    %>
    fetching value using cs : ${cs.testvar}
    Hope it helps.
    Gerardo

  • Post variables not via URL

    Hello to all,
    I build a site based on the JSP - servlet technology . My problem is that I want to post variables from JSP to servlet and vise vera without reveal their value to the end user through the URL. I am using the setAttribute parameter but by this way even user's password is visible in the url. I 've heard that there is an invisible way posting variables, but I don't know how. Does anybody know how this can be done?
    Tnx in advance

    You use <form method="post">
    This prevents the request parameters from being shown in the URL.
    request.setAttribute() will not affect the URL at all - it is the preferred way to pass values between jsps and servlets when using the requestDispatcher at the servlet end.
    Cheers,
    evnafets

  • What variable use to show number of quiz ?

    what variable use to show number of quiz ?
    (it like Absolute)
    it is not in (reference of captivate)
    for example, quiz have 5 page.
    on test page 1 show 1.
    on test page 2 show 2.
    on test page 5 show 5.
    it like microsoft word show page number when print
    sorry if you not understand.

    All quizzing system variables are described in these blog posts: System variables in Captivate 6 - Captivate blog    and for 7.0.1: New features in Captivate 7.01 - Captivate blog. In 8 no variables were added to the category Quizzing. And there is no progress quizzing system variable. Only the total number of questions, second part of the progress indicator, is available: cpQuizIntoTotalQuestionsPerProject.
    You'll have to create and populate a user variable. Some help maybe in: Customized Progress Indicator - Captivate blog

Maybe you are looking for

  • Can not load data into the ods.

    When I was trying to load data into BW3.5 from R3 system, I am getting this message "For InfoSource ZSD_A507_011, there is no Hierarchies for master data in source system R3PCLNT300 "  any idea.  There is no hierarchies for this.

  • Problem with: Show video behind the title

    In the editing window titles, the actualized image of the video behind the title is not the one that is displayed at this moment. Is the one I used just before and then i actualized it with photoshop. In the video the image is correctly displayed but

  • Apple needs to put a security key on the icloud.

    I think that apple should have a securitypassword when changing options on the icloud. Because if i were to steal and iphone all i have to do is go to the settings, go to icloud, and a simple swipe of the find my iphone and there is nothing they can

  • Invoking other apps with the custom URL schemes from AIR apps ?

    Hi , I want to start(invoke) any non-air application from my Flex application build for ipad . Is there any way(example) for doing such a thing? I have defined schema in non air (native)ipad application. And I am trying to call  from flex  applicatio

  • Does disk utility repair delete any files on external hard drive?

    Does disk utility repair disk delete any files on the external hard drive?