Proper Way To Pass Variables

I know this is a basic question but it seems there are several different suggestions on how to do this. So using AS3 with Adobe Flash CS4, what is the correct way to pass a variable from a server side script "PHP" to my SWF?
Thanks

var urlLdr:URLLoader =  new URLLoader();
var urlVar:URLVariables = new URLVariables();
// add data to be sent
urlVar.data1 = "whatever";
urlReq.data=urlVar;
urlReq.method="POST";
// listen for data return
urlLdr.addEventListener(Event.COMPLETE, phpCompleteF, false, 0, true);
// call php
urlLdr.load(new URLRequest("yourphp.php"));
function phpCompleteF(e:Event) {
// i'm not sure everything needs to be "typed" but, it's prudent to do so
var vars:URLVariables=new URLVariables(URLLoader(e.currentTarget).data);
// vars contains your return data

Similar Messages

  • What are different ways to pass variables in a c# program?

    What are different ways to pass variables in a c# program?
    I was wondering if :
    var numbers = textBox1.Text.Split('
    .Select(int.Parse).ToArray();
    var min = numbers.Min();
    var max = numbers.Max();
    textBox2.Text = string.Format("min:
    {0} max: {1}", min, max);
    and
    private
    int[] numbers =
    new
    int[10];
     were considered passing variables and I am also interested in learning new ways.

    Hi Billst3r,
    Your examples would be considered creating variables or "instantiating" them, which basically means creating them in memory.  To pass variables, here is a brief example.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace ConsoleApplication1
    class Program
    static void Main(string[] args)
    // Declaring variables
    int num1 = 1;
    int num2 = 5;
    // Pass created variables to private method
    int answer1 = ComputeSum(num1, num2);
    // Print results
    Console.WriteLine(answer1);
    Console.ReadLine();
    private static int ComputeSum(int param1, int param2)
    // Return sum of 2 provided parameters
    return (param1 + param2);
    Best of luck.

  • Proper way to pass 'this' to an anonymous listener

    I have added a button to copy some information to the clipboard. Instead of a class-level actionPerformed() method I am using an anonymous listener:
         JButton jb = new JButton("Copy QE");
         jb.setBackground(bgc);
         jb.setForeground(Color.lightGray);
         jb.setToolTipText("copy the information below to the clipboard");
         final HelpBox that = this;
         jb.addActionListener( new ActionListener() {
             public void actionPerformed(ActionEvent e) {
              StringSelection ss = new StringSelection(that.toString());
              Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
              cb.setContents(ss, SIHwheel.logBox);
         });It seems to be working fine. I am wondering, though, is the final declaration of that the proper way? Is there a better overall methodology?

    A common approach is to encapsulate the logic into a method on the enclosing class. Then, the listener would just call the method:
    private void someMethod() {
      // init the JButton...
      jb.addActionListener( new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          updateClipboard();
    private void updateClipboard()
      StringSelection ss = new StringSelection(this.toString());
      Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
      cb.setContents(ss, SIHwheel.logBox);
    }

  • Proper way to pass a structure as FORM parameter

    Folks,
    I need to pass a table that is of type LISTZEILE to a subroutine.
    form mytest using myTable LIKE LISTZEILE.
    loop at myTable.
      write: / myTable.
    endloop.
    endform.
    Syntax checker flags this declaration as an error. Can someone please suggest me the right way to declare this?
    Just some background info. This subroutine is invoked from a custom RFC:
    FUNCTION Z_MYRFC.
    ""Local Interface:
    *"  IMPORTING
      blah
    *"  EXPORTING
      blah
    *"  TABLES
    *"      RETURNTABLE STRUCTURE  LISTZEILE
    perform MyTest using returntable.
    blah.
    endfunction.
    Thank you in advance for your help.
    Regards,
    Peter

    hi,
    try this..
    PERFORM mytest TABLES <Table name>.
    FORM mytest TABLES < table name >STRUCTURE listzeile.
      " wriite your code here
    ENDFORM.
    hope this helps
    Regards
    RItesh J

  • Best way to pass vars from html into flash?

    I've read a variety of pages that describe how to pass a variable into a flash movie (AS3, player = v9) from the html in which it is embedded.  This page describes AS3 but neglects to mention what to do with the object and embed tags in the noscript section. Furthermore, I'm not sure the javascript I see generated in my page looks like the example there (the js in my page doesn't check AC_FL_RunContenta against zero).  This page is quite long and appears to deal mostly with AS1 and AS2 approaches which I have used before and neglects entirely the newish javascript approach which appears to be used to embed flash these days (i.e., the javascript function AC_FL_RunContent).
    I was wondering if someone could spell out the proper way to pass in a variable from HTML so that flash can see it in such a way that works even if javascript is disabled, in all browsers, etc., etc.
    I've attached the HTML generated by the Flash IDE to this topic.  Any help would be much appreciated.

    You'll have to search for that concise and thorough list of steps or figure it out using the information you now have, which is sufficient to get it done.  It's not that hard--add the FlashVars in the embedding code in the three places and use the various examples you have links to to add the code in the Flash file to access and use the FlashVars.
    Your Flash will be embedded in a web page depending on the visitors settings... if they allow javascript then the javascript portion will be used.  If they don't, then either the object or embed sections will be used depending on their browser.
    As far as javascript changes go, don't sweat 'em until you have a problem... use whatever code your Flash-created html page creates to embed the file in the page.

  • Passing variable data into XSLT

    Hai all, I am trying to pass variable contents into a XSLT. I am trying the procedure given in the link below.I am not able to pass the parameter values into XSLT file.I am failing in the last step.
    Has anyone tried this example
    http://blogs.oracle.com/rammenon/2007/05/passing_bpel_variable_contents.html
    or
    Is there any other way to pass variable data into XSLT. Kindly help.
    Thank You

    True, the sample also uses the same function that I mentioned :
    <!-- convert Invoice to PO using XSLT service -->
              <assign name="transformVehicle">
              <copy>
                   <from expression="ora:processXSLT('InvToPo.xslt',bpws:getVariableData('input','payload') )"/>
                   <to variable="output" part="payload"/>
              </copy>                    
              </assign>

  • What is the proper way to javadoc a variable length argument list

    What is the proper way to javadoc a variable length argument list?
    Lets say I have the following function:
    public void foo(Integer... intArray){
    }I am just not sure how I would doc that, well, is there anything special I should note?
    Thank you for your time,
    Brandon

    Same as any other argument. Name it and say what it's for.

  • The Proper way to go - Passing Serialized Java Objects vs. Web Services?

    The team which I am apart of in our little "community" is trying to convince some "others" (management) that we should not use web services to communicate (move large data) within the same application (allbeit a huge application spanning across many servers).
    Furthermore these "others" are trying to tell us that in this same application when two small apps. inside of this large app. are both java we should not communicate via serialized java objects but instead we should use Web Services and XML. We are trying to convince them that the simplest way is best.
    They have asked us to provide them with proof that passing serialized java objects back and forth between two smaller java applications inside of a larger one is an Industry Standard. Can anyone help either straighten my fellow workers and I out or help us convince the "others" of the proper way to go?

    When I was a consultant we always gave the client what they wanted. Even if it was the wrong choice. Suck it up.
    I'm glad I wasn't one of those customers. Although I agree that a customer is the one who decides what to do, when I pay someone for consultancy, I expect them to consult me. If they know I'm trying to do something that I shouldn't be doing, I expect a good consultant to be able to show me that there's a better way (not just tell me I'm not doing it right, mind you).
    We pass a lot of data using XML and we don't have any transmission or processing speed issues.
    Then you either have a much better network than our customer did, or we're not talking about the same amounts of data here.
    I used the JAX-RPC RI ...
    That's cool... our customer was, unfortunately, infected with Borland products, so we had to use BES. The web services on BES were run by Axis.
    How large were these messages?
    Huge... each element had about 15 attributes, so 1,200 elements would require 19,200 XML nodes (envelope not included). By comparison, the serialized messages weren't even a quarter that size. It's not just about what you send across the network; it's also the effort of parsing XML compared to desrializing Java objects. Our web service wasn't exactly the only process running at the server.
    Anyone who understand the fundamental difference between ASCII (XML) and binary (serialized) formats realizes that no web service can possibly achieve the performance of binary Java services. Why do you think that work is being put into binary web services? I'm not saying XML is never a good thing; just that it's not The Holy Grail that a lot of people are making it look like.
    http://issues.apache.org/jira/browse/AXIS-688
    Ouch.

  • How can I pass variables from one project to another using Javascript?

    Hi all, I am trying to do this: let learners take one course and finish a quiz. Then based on their quiz scores, they will be sent to other differenct courses.
    However, I wish keep track on their previous quiz scores as well as many other variables.
    I found this nice widge of upload/download variables by CPguru (http://www.cpguru.com/2011/05/18/save-and-load-data-widget-for-adobe-captivate-4-and-adobe -captivate-5/). However, this widget works by storing variables from one project in local computer and then upload it to another project.
    My targeted learners may not always use the same computer though, so using this widget seems not work.
    All these courses resided in a local-made LMS which I don't have access to their code. Therefore, passing variables to PHP html files seems not work.
    Based on my limited programing knowledge, I assume that using Javascript to pass variables may be the only possible way.
    Can someone instruct me how to do this?
    Thank you very much.

    If you create two MIDlet in a midlet suite, it will display as you mentioned means you can't change the display style.

  • Is there a way of passing a mixed cluster of numbers and booleans to teststand

    Hi,
    I have a labview VI that contains an output cluster containing both numeric and boolean results and would like to pass this to Teststand. At the moment I have coverted all my boolean results to  '1/0'  so that I can create a numeric array and can quite easily pass this to Teststand (using multiple numeric limit test). 
    Is there a way to pass mixed results to Teststand and write in the limits (example PASS and GT 5V) or do I have to stick with what I have?
    Chris

    Which test step type to use depends on what you have to analyze - a boolean condition? String? Number(s)? I can't tell you because I don't know what's in your cluster. If you click on the plus sign next to the parameter name "output cluster" you will see all paramters and their types, which are passed from the VI to TestStand.
    You can either create a variable for the whole cluster, or you can assign all or just some values from within the cluster to variables.
    The name of the variable (Locals.xxxxxxx... or FileGlobals.xxxxx...) ist what you type in the value field. You can also choose the variable from the expression browser by clicking on the f(x) button.
    Are you new to TestStand, do you know how to work with variables in TS?
    Maybe the attached picture gives you an example, there I am assigning the values from VI output "VoltageOutputArray" to the TS variable locals.VoltageMeasurement.
    This variable ist used again on the tab "Data Source" as the Data Source Expression.
    Regards,
    gedi
    Attachments:
    stepsettings.jpg ‏89 KB

  • OBIEE 11g How to pass variable from one prompt to another prompt in dashboard page.

      How to pass variable from one prompt to another prompt in dashboard page.
    I have two prompt in dashboard page as below.
    Reporttype
    prompt: values(Accounting, Operational) Note: values stored as
    presentation variable and they are not coming from table.
    Date prompt values (Account_date, Operation_date)
    Note:values are coming from dim_date table.  
    Now the task is When user select First
    Prompt value  “Accounting” Then in the
    second prompt should display only Accounting_dates , if user select “operational”
    and it should display only operation_dates in second prompt.
    In order to solve this issue I made the
    first prompt “Reporttype” values(Accounting, Operational) as presentation
    values (custom specific values) and default presentation value is accounting.
    In second prompt Date are coming from
    dim_date table and I selected Sql results as shown below.
    SELECT case when '@{Reporttype}'='Accounting'
    then "Dates (Receipts)"."Acct Year"
    else "Dates (Receipts)"."Ops
    Year"  End  FROM "Receipts"
    Issue: Presentation variable value is not
    changing in sql when user select “operation” and second prompt always shows
    acct year in second prompt.
    For testing pupose I kept this presentation
    variable in text object of dashboard and values are changing there, but not in
    second prompt sql.
    Please suggest the solution.

    You will want to use the MoveClipLoader class (using its loadClip() and addListener() methods) rather than loadMovie so that you can wait for the file to load before you try to access anything in it.  You can create an empty movieclip to load the swf into, and in that way the loaded file can be targeted using the empty movieclip instance name.

  • Passing variables from web server to HTML5 Captivate File

    I am publishing a Captivate quiz as HTML5 and hosting them on a website. I would like to know how I can pass data from my site to the HTML5 based Captivate quiz.
    So far I have had success getting data out of captivate by having the file POST the results of a finished quiz to a RESTful route. However, I have not had success putting data into the file. I would like to pass information such as User ids and quiz ids, maybe even current slide position so that I can associate the quiz information with my database. I am not specifically looking for a solution to user ids, quiz ids, etc. because I can get creative in that regard, I just want to know if others have been able to set variables on Captivate file load.
    I have tried a setting variables in a couple ways:
    - Declaring the variables with javascript, then ajax loading the page into a div. This caused dependency issues since the captivate file uses relative paths for its assets folder.
    - Modifying the published html file by adding the javascript variables, this returned an error message saying I cannot override the existing captivate variables
    - Adding the js variables into the init function, this had no effect.

    To simply pass the username and an id I used the following.
    Note the URL has query string parameters that match the captivate variables
    http://mywebsite/Course/index.html?cpQuizInfoStudentID=IDHere&cpQuizInfoStudentName=Studen tNameHere
    Another way to do this to use JavaScript to read the query string, and the assign variable in CP to the query string values. I remember reading some more detail, but cant remember where.
    Hope it helps
    Luke

  • Passing variables to loaded external movie

    Ok, this problem has beaten me for the last 2 days. It seems
    to be extremely simple, I am on main movie and I am using
    MovieClipLoader class to load external movie callMe.swf into movie
    holder called holder_MC, then from main using onLoadInit or
    onLoadProgress listeners I can target dynamic text inside
    callMe.swf as holder_MC.myTXT.text = "blablabla" or I can change
    frames in callMe.swf by holder_MC.gotoAndStop(5). But HOW TO PASS
    VARIABLE myVar to callMe.swf so it executes something there? Using
    holder_MC.myVar DOESN'T WORK!!!!!!!!!!!!!!
    Thanks for any help,
    Zbynek

    UPDATE... I copied the link to another page with my variables in the image attributes as I posted above. And it works using the values that are cached for those items. Is there any way to do this on the same page as my original link without my users having to change to a different page?

  • Is there a way to pass archive file name to the command-line control?

    Hi there,
    I have been researching the flash media live encoder laterly. But still cannot find confirmed anwsers on the following questions:
    1. Is there a way to pass an archive file name to the command-line control when starting an encoder?
    2. Can the username/password to the Flash Media Server be saved in the profile? If not, is there any otherway to provide(GUI mode) them automatically,
        like as variables to a script?
    Thanks a lot in advance.
    Helen

    1. The only way to inform the command-line encoder about the archive file name is to save the FMLE session profile with the file name. The node for saving the file name is <output><file><path>C:\sample.flv</output></file></path>. The easier way to update the xml profile is to use "Save Profile" option of the GUI mode. If you want to programmatically update the file name, read the profile and update the node before launching the encoder. I hope this answers your question.
    2. No. Credentials can't be saved in the profile. The only way to provide them programmatically is to use /ap and /ab commands for the command-line encoder. For GUI mode, there is no programmable option. But still you can try capturing keystrokes.

  • How to pass variables between loaders

    Hi,
    I am trying to load an image, with descriptive text and a back button on the click of a thumbnail of the image. I am using a MovieClipLoader instance to do this.
    Here are my problems:
    1. I tried loading the image, with the text(which is within an external swf), using the same loader, but since I am placing them dynamically, depending on the dimensions of the image, I need to pass variables between the two. The image loader is taking longer than the text (obviously) but I need the dimensions of the image before I can place the text. How do I do that??
    2. I tried using two loaders, with separate listeners, and the problem once again is that the text loads before the image, and is hence placed with default values instead of the values derived from the image. The code is within onLoadInit(). Is it possible for me to get the dimensions of the image from onLoadStart()???
    3. There is a back button within the text.swf. I want the image and the text.swf to be unloaded when this button is clicked. How can I achieve that? Can I call loader.unloadClip(target), from within this? Will it recognize the variable?
    4. Is there a much easier way to do this, which I am sadly unaware of?
    Any help will be appreciated.

    Tried the onloadstart() function, but it gives target._width and _height as 0. So that is ruled out...any other suggestions?

Maybe you are looking for

  • Mail crashes from attempting to send HUGE file

    I made a mistake! I tried to send a PowerPoint file attachment (340 MB) Mail crashes, over and over and I can't delete the email from the OUT box to stop it from crashing. How can I purge this Out Box email?? iMac   Mac OS X (10.3.9)   DSL connection

  • How to create a stage with tabs?

    I tested this code to create a stage with tabs: {code} public void GeneralConfiguration()         Stage configurationStage = new Stage();         configurationStage.setTitle("General Settings");         configurationStage.initModality(Modality.WINDOW

  • Activation Serial Number CS 5

    I'm trying to get in contact with Adobe Support because I need to activate my Serial Number for CS5. I'm installing CS6 upgrade, but it keeps asking for the Serial Number of my first version CS5. The Serial number that I enter is not recognized as va

  • Customer exit for difference of weeks

    Hi All, I have two formula variables with processing from customer exit. 1. ZVAR_FV1 = getting current calendar week from system 2. ZVAR_FV2 = getting user entry week in formula variable Now I want to find the difference between the two. So if curren

  • Changing track order in DVD outline

    How do I do this. My DVD seems to play the same track (not my primary video but an "extra feature video" that I don't care about). I want a different track to be recognized as Track 1.