Professional Web Applications Themes

define variable problem - Macromedia Flash Actionscript

I am attaching values to a array from XML. When I trace the variable the output gives me the values, no problem so far. the values are always going to be an integer. The problem is, when I create a if statement looking for a specific value, flash just skips over it. The number value from the XML is already a string, correct? So, I don't see the need to convert it to a integer. I am very confused. here is what I got so far: //finish is the node value in the XML var finish = eventData.finish; if (finish ...

  1. #1

    Default define variable problem

    I am attaching values to a array from XML.
    When I trace the variable the output gives me the values, no problem so far.

    the values are always going to be an integer.
    The problem is, when I create a if statement looking for a specific value,
    flash just skips over it.

    The number value from the XML is already a string, correct? So, I don't see
    the need to convert it to a integer. I am very confused.

    here is what I got so far:
    //finish is the node value in the XML
    var finish = eventData.finish;
    if (finish == "1") {
    var medalColor = new Color (eventMenuItem);
    medalColor.setRGB(0xFF3300);
    }

    grover970 Guest

  2. #2

    Default Re: define variable problem

    So when you trace(finish) you get '1' ?

    Have you tried to convert it to an integer anyway, to see if it works?
    Also, have you checked for spaces that could be before or after the values?
    e.g. "1 " - try trimming the 'finish' string first..

    Hope it helps,
    Peter

    Pea Guest

  3. #3

    Default Re: define variable problem

    Yes when I trace (finish), I get a value for each item in the array. Depending
    on the value, (1) in this case, will define the color of the array. If I don 't
    use an if statement, and just go ahead and change the color for all the items
    it works fine. But I need specific items to be specific colors.

    grover970 Guest

Similar Threads

  1. using string variable to define object
    By Jaguar280 in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: May 22nd, 12:17 PM
  2. #40137 [Opn]: in-function-call variable-define bug
    By kolypto at mail dot ru in forum PHP Bugs
    Replies: 0
    Last Post: January 16th, 03:42 AM
  3. drop down menu to define a variable
    By darrylfrith in forum Dreamweaver AppDev
    Replies: 0
    Last Post: March 18th, 04:01 PM
  4. How to define a member variable?
    By Bruce W...1 in forum PHP Development
    Replies: 4
    Last Post: October 15th, 02:33 AM
  5. template parameters : define a new variable?
    By dc in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 28th, 06:04 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