A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Weird Problems- Have you had them?

  1. #1
    Death to anime
    Join Date
    Mar 2006
    Location
    Holland, MI
    Posts
    32

    Angry Weird Problems- Have you had them?

    I am making a game that uses arrays to keep track of soliders. For some reason, the arrays are very, very erratic. When I add new guys to the array, it makes is so old instances of the same type do not work. (I do use different instance names) But this only happens sometimes. Has anyone else had these problems, and could he/she tell me how to fix them.

    Thanks/
    Code:
    onClipEvent(load){
    trace("I am a geek")
    }

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Without seeing some code, difficult to say what is causing the problem.
    Try looking at where you are setting the depths, your new instances need to have unique depths.

  3. #3
    Death to anime
    Join Date
    Mar 2006
    Location
    Holland, MI
    Posts
    32

    Code

    Alright-heres the code

    The instances are already onstage-so theres no need for levels

    I am using a mac, if that matters. Similar code worked on a windows for me in MX 04.

    The code below is Flash 8

    Code:
    Your=new Array()
    Their-new Array()
    Your.push({clip:"Yourcharacter",Type:25,Order:3,Health:35,Attack:7,Buildattack:1,Defense:4,Rangedefense:4})
    Your.push({clip:"Yourwarrior1",Type:1,Order:1,Health:10,Attack:5,Buildattack:1,Defense:3,Rangedefense:3})
    for(i=1;i<5;i++){
    Their.push({clip:"Theirwarrior"+i,Type:1,Order:3,Health:10,Attack:5,Buildattack:1,Defense:3,Rangedefense:3})
    }
    Oh and, the variables still work, it's just the clip doesn't go into the array. As I said before Yourwarrior, Yourcharacter, and Theirwarrior 1-4 are already onstage.
    Last edited by cornyanimation; 08-15-2006 at 02:16 PM. Reason: Forgot something
    Code:
    onClipEvent(load){
    trace("I am a geek")
    }

  4. #4
    :
    Join Date
    Dec 2002
    Posts
    3,518
    This seems to work...
    Code:
    Your = new Array();
    Their = new Array();
    Your.push({clip:"Yourcharacter", Type:25, Order:3, Health:35, Attack:7, Buildattack:1, Defense:4, Rangedefense:4});
    Your.push({clip:"Yourwarrior1", Type:1, Order:1, Health:10, Attack:5, Buildattack:1, Defense:3, Rangedefense:3});
    for (var i = 1; i<5; i++) {
    	Their.push({clip:"Theirwarrior"+i, Type:1, Order:3, Health:10, Attack:5, Buildattack:1, Defense:3, Rangedefense:3});
    }
    trace(Their[1].clip);

  5. #5
    Death to anime
    Join Date
    Mar 2006
    Location
    Holland, MI
    Posts
    32

    Huh

    I know, it doesn't work for me though. It's so screwed up.
    Code:
    onClipEvent(load){
    trace("I am a geek")
    }

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Their = new Array();

    not

    Their - new Array();
    - The right of the People to create Flash movies shall not be infringed. -

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