A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Variable = Variable+num <--How do I do this?

  1. #1
    Flash Explorer
    Join Date
    Sep 2005
    Posts
    52

    (SOLVED) Variable = Variable+num <--How do I do this?

    I'm trying to increment a variable name so that it checks a hitTest against all items on the same level with the name "Card+"num. When I try to use this type of grammar in a hitTest statement, though, I get an error message.

    I get the message: "Expected a field name after the '.' operator" when I type
    Code:
    for (var cn = 0; cn<31; cn++)
       if(cn <= 10)
          if(this.hitTest(_parent."Card0"+cn) {
            trace("Hit!")
    I'm sure that this is easier than I'm making it for myself. Any help is appreciated...
    Last edited by designerTrevor; 10-03-2005 at 02:29 PM. Reason: Solved!
    Pacem!
    --T
    "Clearly I cannot choose the cup in front of you!"

  2. #2
    Senior Member Dricciotti's Avatar
    Join Date
    Aug 2002
    Posts
    2,988
    code:
    for (var cn = 0; cn<31; cn++)
    {
    if (cn<=10)
    {
    if (this.hitTest(_parent["Card0"+cn]))
    {
    trace("Hit!");
    }
    }
    }


  3. #3
    Flash Explorer
    Join Date
    Sep 2005
    Posts
    52
    Brilliant! It works!

    Thanks.
    Pacem!
    --T
    "Clearly I cannot choose the cup in front of you!"

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center