Professional Web Applications Themes

For Statment question - Macromedia Flash

Ok I've got a For statement that works fine but I need to put a variable in the end_condition for (i=1; i< =_root.totalimages; i++) { functions(); } but it doesnt work... the var of _root.totalimages has a value that is being read in from a text file... does that mean its being read in as a string, not a numeric value?...

  1. #1

    Default For Statment question

    Ok I've got a For statement that works fine but I need to put a variable in
    the end_condition

    for (i=1; i< =_root.totalimages; i++) {
    functions();
    }

    but it doesnt work...

    the var of _root.totalimages has a value that is being read in from a text
    file... does that mean its being read in as a string, not a numeric value?


    K-Parker Guest

  2. #2

    Default Re: For Statment question

    you can change a string to a number using the number function:

    for (i=1; i< =number(_root.totalimages); i++) {
    functions();
    }

    rockman

    "K-Parker" <newsgroupkarmparker.com> wrote in message
    news:RAOAb.108$5r4.92108898news.nnrp.ca...
    > Ok I've got a For statement that works fine but I need to put a variable
    in
    > the end_condition
    >
    > for (i=1; i< =_root.totalimages; i++) {
    > functions();
    > }
    >
    > but it doesnt work...
    >
    > the var of _root.totalimages has a value that is being read in from a text
    > file... does that mean its being read in as a string, not a numeric value?
    >
    >

    CDR Guest

  3. #3

    Default Re: For Statment question

    Sorry K, i didn't see your previous post, you already know about number();

    here's how i'd do it

    myVars = new loadVars();//create a new loadVars object
    myVars.load("text.txt");//load in the file
    myVars.onLoad = function(){//when it's finished loading
    for (i=1; i< =number(myVars.images); i++) {
    functions();
    }
    }

    You must use the onLoad function to wait until the load is finished before u
    try using the variable.
    you may not need the number function after all.

    hope this helps,
    Rockman

    "CDR" <vmaxcableone.net> wrote in message
    news:vt7tdsn85vdl83corp.supernews.com...
    > you can change a string to a number using the number function:
    >
    > for (i=1; i< =number(_root.totalimages); i++) {
    > functions();
    > }
    >
    > rockman
    >
    > "K-Parker" <newsgroupkarmparker.com> wrote in message
    > news:RAOAb.108$5r4.92108898news.nnrp.ca...
    > > Ok I've got a For statement that works fine but I need to put a variable
    > in
    > > the end_condition
    > >
    > > for (i=1; i< =_root.totalimages; i++) {
    > > functions();
    > > }
    > >
    > > but it doesnt work...
    > >
    > > the var of _root.totalimages has a value that is being read in from a
    text
    > > file... does that mean its being read in as a string, not a numeric
    value?
    > >
    > >
    >
    >

    CDR Guest

  4. #4

    Default Re: For Statment question

    Variables arriving in Flash from a textfile indeed arrive as strings. Easy
    to convert using something like

    yourFlashVar = Number(yourTextVar);

    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

Similar Threads

  1. cfif statment logic
    By sviolet in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: June 15th, 01:46 AM
  2. Using an IF statment within an ItemTemplate
    By David Lozzi in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: March 16th, 08:34 PM
  3. request REMOTE_ADDR and use if/else statment, HELP PLEASE!
    By Jack Turner in forum PHP Development
    Replies: 11
    Last Post: September 24th, 11:59 PM
  4. how to tidy this if statment
    By LeeD in forum Macromedia Director Lingo
    Replies: 7
    Last Post: September 4th, 03:29 PM
  5. help with where criteria in sql statment
    By aneurin in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 10th, 07:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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