A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Oct 2000
    Posts
    14
    From a subroutine mc, I’ve set variables for games that live in the main movie as follows:

    game1 = “/dog”
    game2 = “/cat”
    game3 = “/bird”

    Can I then target those games from the same subroutines mc as follows ?

    Set Property (“game1”,_x) = 100
    Set Property (“game2”,_x) = 200
    Set Property (“game3”,_x) = 300

    I can’t seem to get it to work.

    Can I alternatively use the following code?:

    gameCount = 1
    Set Property (“game” & gameCount,_x) = 100
    gameCount = gameCount + 1
    Set Property (“game” & gameCount,_x) = 200
    gameCount = gameCount + 1
    Set Property (“game” & gameCount,_x) = 300

    Or should it be?:

    gameCount = 1
    Set Property (Eval (“game” & gameCount),_x) = 100
    gameCount = gameCount + 1
    Set Property (Eval (“game” & gameCount),_x) = 200
    gameCount = gameCount + 1
    Set Property (Eval (“game” & gameCount),_x) = 300


    (I will be abbreviating this in a loop, but for now the problem is the targeting).

    Thanks for any help.
    DJ Rush

  2. #2
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    the correct syntax is:

    Set Property (game1,_x) = 100
    Set Property (game2,_x) = 200
    Set Property (game3,_x) = 300


    game1,game2 and game3 are variables therefore if you want to get there values they need to be expressions not strings!


    if you need more let me know!


  3. #3
    Junior Member
    Join Date
    Oct 2000
    Posts
    14
    Guy,

    Thanks for your help.
    I had mistakenly told you that my code was:

    game1 = "/dog"
    etc.

    In fact, it was:

    "game1" = "/dog"

    That is why I needed to refer to it as "game" and gameCount.

    Anyway, I got it working using an Eval statement as follows:

    Set Property ("Eval("game" & gameCount". X Position) = 100

    The point is that I realise that I can use a variable in the target of a Set Property.

    DJ Rush

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