Ask a Question related to Macromedia Flash, Design and Development.

  1. #1

    Default Variables

    I am trying to work out how to set up a variable for a timer kind of thing.
    My code so far is:

    Time = 1;
    txtLcd = "time - ", Time;
    gotoAndPlay(2);

    Time has been declared in an earlier frame (1) and txtLcd is a dynamic
    textbox.
    How can i get txtLcd to display like "time - 1" where 1 is the value of the
    variable Time

    TIA


    c0nF0Rm3r Guest

  2. Similar Questions and Discussions

    1. #39833 [NEW]: Session variables overwritten by local variables (register_globals=off)
      From: sup1382 at accedo dot es Operating system: OpenBSD 3.9 PHP version: 5.2.0 PHP Bug Type: Session related Bug...
    2. #39447 [NEW]: Want to optionally handle apc_upload_progress variables using session variables
      From: krudtaa at yahoo dot com Operating system: All PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug...
    3. Global variables - application variables vs include file
      What are the best methods for using global constants and variables? I've noticed that many people put all global constants in a file and include...
    4. Replacing code based on static variables to variable variables.
      Can anyone give me some help or tips in converting this code to take 2 variables that will specify the number of Pack type lines and the number of...
    5. variables that change session variables
      Hi, I'm currently writing a mulit-page form app that uses a session to retain data from each form element in order for the user to jump between...
  3. #2

    Default Re: Variables



    c0nF0Rm3r wrote:
    > How can i get txtLcd to display like "time - 1" where 1 is the value of the
    > variable Time

    txtLcd = "Time - " + Time;

    --
    Patrik

    Patrik Liljebäck Guest

  4. #3

    Default Re: Variables

    In article <3ef937b6$1@news.iconz.co.nz>, [email]pike@e3.net.nz[/email] says...
    > I am trying to work out how to set up a variable for a timer kind of thing.
    > My code so far is:
    >
    > Time = 1;
    > txtLcd = "time - ", Time;
    > gotoAndPlay(2);
    >
    > Time has been declared in an earlier frame (1) and txtLcd is a dynamic
    > textbox.
    > How can i get txtLcd to display like "time - 1" where 1 is the value of the
    > variable Time
    txtLcd = "time - " + Time;
    --
    Whitecrest Entertainment
    [url]www.whitecrestent.com[/url]
    Whitecrest Guest

  5. #4

    Default Variables

    How do you: get the OS variable that you are currently running on
    - AND -
    the name of the user that is running the application?


    Carl Yeksigian Guest

  6. #5

    Default Re: Variables

    Hi,

    At Wed, 13 Aug 2003 12:57:30 +0900,
    Carl Yeksigian wrote:
    > How do you: get the OS variable that you are currently running on
    What do you mean by "the OS variable"?
    > the name of the user that is running the application?
    $ ruby -e 'p ENV["USER"]'
    "nobu"
    $ ruby -e 'p ENV["LOGNAME"]'
    "nobu"
    $ ruby -retc -e 'p Etc.getlogin'
    "nobu"

    --
    Nobu Nakada

    nobu.nokada@softhome.net Guest

  7. #6

    Default Re: Variables

    On Wed, Aug 13, 2003 at 12:57:30PM +0900, Carl Yeksigian wrote:
    > How do you: get the OS variable that you are currently running on
    Do you mean:
    $ ruby -e "p RUBY_PLATFORM"
    "i386-freebsd4.8"

    (this is the platform the ruby interpreter was compiled under, which may or
    may not be the same thing)

    Brian Candler Guest

  8. #7

    Default Variables

    Just a quick question, wondering if someone could answer it for me.

    How can you pass variables that users complete in a form to the next page
    without them being passed through the address bar?

    Cheers
    Shaun Demellweek


    Shaun Demellweek Guest

  9. #8

    Default Re: Variables

    Shaun Demellweek wrote:
    >Just a quick question, wondering if someone could answer it for me.
    >
    >How can you pass variables that users complete in a form to the next page
    >without them being passed through the address bar?
    If i understand you correctly, just use the POST method for the form

    <form action="processform.php" method="post">
    <!-- ________________________^^^^^^^^^^^^^ -->
    User variable: <input type="text" name="uservar" />
    <input type="submit" />
    </form>


    and in processform.php you can access the uservar in the _POST array

    <?php
    if (isset($_POST['uservar']) && $_POST['uservar'] != 'OK') {
    exit('Please type "OK" (without the quotes)');
    }
    ?>


    --
    I have a spam filter working.
    To mail me include "urkxvq" (with or without the quotes)
    in the subject line, or your mail will be ruthlessly discarded.
    Pedro Guest

  10. #9

    Default Re: Variables

    On Mon, 22 Sep 2003 18:02:49 +0100, "Shaun Demellweek" <shaun@shaund.com>
    wrote:
    >Just a quick question, wondering if someone could answer it for me.
    >
    >How can you pass variables that users complete in a form to the next page
    >without them being passed through the address bar?
    POST form method, or sessions.

    --
    Andy Hassall (andy@andyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    Space: disk usage analysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    Andy Hassall Guest

  11. #10

    Default variables

    i need where "red" is to be a variable, as im creating lots of movieclips, i
    have tried and looked on google with no luck, any suggestions?

    _root.item.red.textfield.text = "test";

    Thanks
    Chris


    ChrisM Guest

  12. #11

    Default Re: variables

    Don't understand what you're trying to achieve here. Only thing I can say is
    that a variable 'red' cannot have a textfield. Maybe elaborate?

    John

    --
    ----------------------------------------------------------------------------
    -----------------------------------------
    RESOURCES
    [url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
    ----------------------------------------------------------------------------
    -----------------------------------------
    TUTORIALS
    Flash & PHP Emailform:
    [url]http://home.hccnet.nl/john.mulder/flash/tutorials/flash_php_mailform.zip[/url]
    ----------------------------------------------------------------------------
    -----------------------------------------


    Laiverd.COM Guest

  13. #12

    Default Re: variables

    > Don't understand what you're trying to achieve here. Only thing I can
    > say is that a variable 'red' cannot have a textfield. Maybe elaborate?
    >
    > John
    sorry ill try to explain, red was a static name, and textfield was a badly
    chosen example name as its actually dynamic text box, id like to have a
    variable or a construct such as "red"+i

    like _root.item."red"+i.textname.text = "test"; (but this doesnt work - does
    with setProperty for e.g. changing ._x location)

    so within a loop it would change red1, red2, red3 and so on all to have the
    text value "test"

    Thanks
    Chris



    ChrisM Guest

  14. #13

    Default Re: variables

    Just to be clear on this; red1, red2 etc. have to be movieclips; textname
    then can be a dynamic texfield (or -box, whatever). From what I understand
    you want to set some text in the textfield of either red1, red2 or etc.

    If so then something like

    _root.item["red"+i].textname.text = "test";

    should work. If i were 2, it would put "test" in the textfield called
    textname which is inside the movieclip red2.

    If this is not what your looking for then I still don't understand. In what
    you have written red1, red2 etc. cannot be the name of a variable.

    John



    --
    ----------------------------------------------------------------------------
    -----------------------------------------
    RESOURCES
    [url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
    ----------------------------------------------------------------------------
    -----------------------------------------
    TUTORIALS
    Flash & PHP Emailform:
    [url]http://home.hccnet.nl/john.mulder/flash/tutorials/flash_php_mailform.zip[/url]
    ----------------------------------------------------------------------------
    -----------------------------------------


    Laiverd.COM Guest

  15. #14

    Default Re: variables

    > Just to be clear on this; red1, red2 etc. have to be movieclips;
    > textname then can be a dynamic texfield (or -box, whatever). From
    > what I understand you want to set some text in the textfield of
    > either red1, red2 or etc.
    >
    > If so then something like
    >
    > _root.item["red"+i].textname.text = "test";
    >
    > should work. If i were 2, it would put "test" in the textfield called
    > textname which is inside the movieclip red2.
    >
    > If this is not what your looking for then I still don't understand.
    > In what you have written red1, red2 etc. cannot be the name of a
    > variable.
    >
    > John
    thankyou so much! that is exactly what i had in mind and it works perfectly!

    Thanks!
    Chris


    ChrisM Guest

  16. #15

    Default Variables

    Hi,

    I not sure if i am going crazy, but I am having great difficulty passing
    simple variables from one .mxml file to another. I have an index.mxml file with
    a form. The form has two date fields, a dropdown and 3 radio buttons.

    I need to get these parameters to another files called results.mxml. Here is
    what I have at the moment but nothing I have tried works! I am trying to get
    the radio button text accross first, i reckon once i have this working, it will
    be the same for the To and From Dates.

    Has anyone any ideas?

    Thanks in advance

    Chris C



    <!-- Here is thew form in index.mxml -->

    <mx:Script>
    <![CDATA[

    function showSelected(event) {
    mx.core.Application.application.Results.complaints .text = event;
    // this should set the text on the complaints label in results.mxml
    }

    ]]>
    </mx:Script>

    <mx:Panel title="Search Criteria" >
    <mx:VBox>
    <mx:Label text="Enter Search Criteria Below"></mx:Label>

    <mx:Form id="seachForm" verticalGap="15">
    <mx:HBox>
    <mx:Label text="Dates:"></mx:Label>
    <mx:FormItem label="From" required="true">
    <mx:DateField id="fromDate" initialize="restrictFromDate();"/>
    </mx:FormItem>
    <mx:FormItem label="To" required="true">
    <mx:DateField id="toDate" initialize="restrictToDate();"/>
    </mx:FormItem>
    </mx:HBox>
    <mx:HBox>
    <mx:Label text="Department:"/>
    <mx:ComboBox id="dept_dsc"
    dataProvider="{cmsReviewWS.getDeptList.result}" labelField="DEPT_DSC" />
    </mx:HBox>
    <mx:HBox>
    <mx:RadioButton id="showAll" label="Show All"
    click="showSelected(event.target.label);"/>
    <mx:RadioButton id="showNew" label="Show New"
    click="showSelected(event.target.label);"/>
    <mx:RadioButton id="showPrev" label="Show Previously Reveived"
    click="showSelected(event.target.label);"/>
    </mx:HBox>

    </mx:Form>
    <mx:HBox width="100%" horizontalAlign="right" marginRight="15">
    <mx:Button label="Search"
    click="{mx.validators.Validator.isStructureValid(t his, 'searchByDateModel'),
    validateForm()}"/>
    </mx:HBox>

    </mx:VBox>

    </mx:Panel>

    Now on my results page I have a datagrid with some <mx:Label> tags. e.g.

    <mx:Label id="complaints" />
    <mx:Label text="Date Range: "SelectedFromDate" to "selectedToDate"/>

    Kris Kros Guest

  17. #16

    Default Re: Variables

    Forget the variables for a second... How are you displaying results.mxml in
    index.mxml?

    You are not thinking in HTML are you? You usually want one single
    application, and you never "change pages". "Pages" are not really applicable
    to Flex ria development.

    The easiest way to break an app into multiple files is to create cusotm
    components. Your results.mxml file would be an example. Typically, it would
    be placed on a container like a ViewStack, or an Accordion, or a tab bar.
    There are other options,such as mx:Loader. And if you REALLY want to call a
    different page, you can pass values to it.

    So exactly where are you now? I can tell you how to handle the variable when
    I know.

    Tracy

    ntsiii Guest

  18. #17

    Default Re: Variables

    Hi Tracy,

    I don't think I explained myself properly in my last post. I have my
    Index.mxml file which contains a Viewstack container. Inside this container I
    have my custom components like you mentioned. So the first custom component is
    my search form and is located at index0 of my viewstack container. The second
    custom component is my results, which is a datagrid being populated by a
    webservice. I am having trouble passing the variables between the two
    conponents.

    I hope this is a bit clearer

    Thanks for you quick reply

    Chris C


    Kris Kros Guest

  19. #18

    Default Re: Variables

    Yes, excellent.

    In Results.mxml declare a public variable for each value you want to pass.
    The way to think of this is that public variables become public properties of
    your component. (you can also use getter/setter methods.)

    public var toDate:Date;
    public var fromDate;
    public var complaints:String;

    In index.html, in the viewstack code do something like:
    <Results id="resultsInstance" toDate="{toDate.selectedDate}"
    fromDate="{fromDate.selectedDate .../}"

    Note the quotes AND binding braces.

    For complaints, do:
    function showSelected(sSelected:String) {
    resultsInstance.complaints = sSelected;

    Tracy

    ntsiii Guest

  20. #19

    Default Re: Variables

    There is another option, which is passing a reference to the entire parent
    appliation into the component. If you may have many values you need to pass
    (we were passing 40+ at one time), this is a much simpler way to do it. The
    general idea is the same. The key is to getting the data type correct on the
    public property variable.

    In Results.mxml:
    public var app:Index = null; //the datatype is the name of the application
    file name!

    In Index:
    <Results id="resultsInstance" app="{this}" ...

    in this context, "this" is a ref to the application.

    In Results, you can now bind to anything in APP, for example:
    text="{app.toDate.selectedDate}"

    Tracy

    ntsiii Guest

  21. #20

    Default Re: Variables

    Hi Tracy,

    First of all, thank you for all your help. I really appreciate the time you
    give to this forum. I got my code working passing the variables to the results
    screen but i found one or two interesting things along the way. As I said
    earlier, I have a viewstack on my index.mxml page which has tree child nodes.
    In each child node I have a screen component. The funny thing was, I could only
    pass the variables to the results component if I include the search code on the
    the index.mxml page. In other words, I could not pass variables from one
    component to another. I am not sure if I am explaining myself properly but I
    have attached my code so hopefully you will understand what I mean.

    I thought that when you included a component, it was the same as if the code
    resided on the page that you called it form. Is this the case. If so, I should
    be able to include all the code for the search form in another component, e.g.
    <screen:oralCompSearhForm>. But when I do this, I get errors.

    Any ideas?

    Thanks in advance

    Chris

    Kris Kros Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139