Welcome, Guest
  • Author Topic: flash var question thanks...  (Read 3676 times)

    melnet

    • Server what's that
    • *
    • Posts: 2
      • View Profile
      • Email
    flash var question thanks...
    « on: 09/13/08, 01:36 »
    Hi

    Code: [Select]
    num_array = new Array("null", "1", "1", "2", "2", "3", "3");
    data_array=new Array("null");
    mc_array = new Array("null");
    ttl_card = 6;
    what = 0;
    function store_num(mc:MovieClip, num:Number) {
    mc_array.push(mc);
    data_array.push(num);
    mc.gotoAndStop(num);
    //mc.fig_no = num;
    trace(num);
    }
    for (i=1; i<=ttl_card; i++) {
    what = this["data"+i];
    store_num(_root["card_mc"+i], what);
    }
    for (i=1; i<=ttl_card; i++) {
    mc_array[i].onRelease = function() {
    trace(data_array[i]);
    };
    }

    i have input value into every mc's "what" but dont konw why all of var are undefined.


    Thanks...

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: flash var question thanks...
    « Reply #1 on: 09/13/08, 02:10 »
    does the mc exist, before you call that function?
    if it does not, how would the function receive a pointer to a instance - and a nonexistant MC cannot receive a release event! - ?
    And if you just loaded it, did you wait for the loaded event, to make sure it is completely loaded, before you do any action to it?
    I realy don get the idea behind this funtion - why 3 loops?

    Why did you post this to Flash MX 2004? Are you using this old version?
    « Last Edit: 09/13/08, 02:12 by Ronald Wernecke »
    happy flashing
    8)
    Ronald

    melnet

    • Server what's that
    • *
    • Posts: 2
      • View Profile
      • Email
    Re: flash var question thanks...
    « Reply #2 on: 09/13/08, 02:51 »
    Code: [Select]
    for (i=1; i<=ttl_card; i++) {
    mc_array[i].onRelease = function() {
    trace(data_array[i]);
    };
    }
    if i change above code to following code:
    mc_array[1].onRelease = function() {
    trace(data_array[1]);
    };
    mc_array[2].onRelease = function() {
    trace(data_array[2]);
    };
    mc_array[3].onRelease = function() {
    trace(data_array[3]);
    };
    mc_array[4].onRelease = function() {
    trace(data_array[4]);
    };
    mc_array[5].onRelease = function() {
    trace(data_array[5]);
    };
    mc_array[6].onRelease = function() {
    trace(data_array[6]);
    };
    it works....i dont konw where gets wrong...
    acutally, it's a game. user takes a pair of cards.

    Thanks..... ???