A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: does flash have variable indirection? if u dont know what that is, just read this...

  1. #1
    Junior Member
    Join Date
    Jul 2005
    Posts
    2

    does flash have variable indirection? if u dont know what that is, just read this...

    im trying to make a game of tanks in flash and the terrain will be just a ton of little green squares beside each other to resemble a hill....
    ______________________________________________
    var x, y
    for (x=1;x<=Stage.width/5;x++) {
    for (y=1;y<=Stage.height/2/5) {
    }
    duplicateMovieClip(Ground,#"Ground"&x&","&y,this.g etNextHighestDepth());

    }
    ______________________________________

    whoever has a Ti-89 titanium calculator and can program on it would recognize that "#" as the indirection symbol... well it didn't work in flash.

    now what i want to happen is it duplicates the "Ground" movie clip (just a simple green square) and the new movie clip will be named "Ground12,13" for example. i want the name of the movie clip to include it's x and y coordinate, or simply an incrementing number value. how can i do that??

  2. #2
    Uses MX 2004 Pro Quixx's Avatar
    Join Date
    Nov 2004
    Location
    U.S.
    Posts
    877
    You could use the depth of each new clip to differentiate the tiles. For example:

    Code:
    level=_root.getNextHighestDepth();
    duplicateMovieClip(Ground,"Ground"+level,level);
    I'm not really sure what you are trying to do (aside from creating tile effect), but I've attached an example file that may help you with the syntax you'll need to achieve your goal.

  3. #3
    The Flashman earl223's Avatar
    Join Date
    Sep 2000
    Location
    Marikina City, Philippines
    Posts
    876
    dont use the comma --> Ground12,13

    use an Underscore instead ---> Ground12_13

    duplicateMovieClip("Ground","Ground" + x + "_" + y, newLevel)
    i eat actionscripts for breakfast

  4. #4
    Junior Member
    Join Date
    Jul 2005
    Posts
    2
    hey thanks that's what i needed to know

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