filling a components array with createClassObject self destructive?

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default filling a components array with createClassObject self destructive?

    i´m having a hard time creating an array of Loaders. what i have so far is:

    import mx.controls.Loader;
    var i;
    at = new Array();
    for (i=0;i<10;i++){
    at = new Object();
    at = createClassObject(Loader,"p"+i,1,{autoLoad:true,sc aleContent:true});
    with (at){
    load("pix/crcl_mgr_" + String(i+1) + ".jpg");
    _x = i*120;
    _y = 0;
    _width =100;
    _height = 75;
    }
    }

    the thing is that it succsessfully creates ONE object instead of 10. it seems to me it destroys the last created object every time it creates a new one. why?
    any help would be gratly apreciated.


    jony_calavera webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. Nested NonVisual Components in an array oracollection???
      I have been wasting almost an entire 2 days trying to answer my flex2 as3 questions myself through experimentation... I am brand new, and here is...
    2. Please help! Problem with createClassObject
      The createClassObject function seems always replace the previouly created objects. I have a function to create a labels in a canvas: function...
    3. Destructive type conversion (to_i!, to_f!)
      Hi, There have been a few times in which I have wanted to destructively change the type of a variable, yet as fas I can determine there are only...
    4. Efficiently & safely (re)filling array from $_POST
      I'm using a single script to generate a table with <input>s in each row. I fill the array with initial values, then write it out to the table and...
    5. filling an array
      Anthony J Segelhorst wrote: Maybe try: /^EXCEL/ and @fields = split for `$lcf_tools/pslist EXCEL`; Also, take a look at Proc::ProcessTable...
  3. #2

    Default Re:filling a components array with createClassObject self destructive?

    you are not using the array as it was intended. I change the code so it will work...

    import mx.controls.Loader;
    var i;
    at = new Array();
    for (i=0;i<10;i++) {
    at = new Object(); // you need to address the object in the array
    // not over write you aray into a new Object
    // basically, you destroyed the array you just created

    // this is not how to initiate the new object, but would work
    //at = createClassObject(Loader,"p"+i,1,{autoLoad:true,sc aleContent:true});

    // try this...
    at = new Object(createClassObject(Loader,"p"+i,1,{autoLoad: true,scaleContent:true}));

    with (at) {
    load("pix/crcl_mgr_" + String(i+1) + ".jpg");
    _x = i*120;
    _y = 0;
    _width =100;
    _height = 75;
    }
    }


    Please understand that I am new to Flash, but not to JavaScript, which is what ActiveScript seems to be derived off of. If this is not accurate, please, someone let me know. But if ActiveScript is just like JS w/ additions, then there is no doubt in my mind that this will work (given that you function calls where write from the start).

    - rashad: [email]rashadriveraSPAM_IS_BAD@FIGHT_THE_SPAM.hotmail.com[/email]

    - rashad
    [email]rashadriveraIN_VALID@NO_SPAM_HERE_.hotmail.com[/email]
    rashadrivera webforumsuser@macromedia.com Guest

  4. #3

    Default Re:filling a components array with createClassObject self destructive?

    i got the same result. :(



    jony_calavera webforumsuser@macromedia.com Guest

  5. #4

    Default Re:filling a components array with createClassObject self destructive?

    i made a few changes this seems to work but fails to set some properties:

    var i;
    for(i=0;i<=2;i++) {
    _root.strip.createClassObject(mx.controls.Loader,' pic'+i,i+1,{autoLoad:true,scaleContent:true,conten tPath:"pix/crcl_mgr_"+String(i+1)+".jpg"});
    with (_root.strip['pic'+i]){
    _x=i*120;
    _y=0;
    _width=100; //fails to set this width
    _height=75; //also this height
    }
    }

    what could be the problem??
    any help would be greatly apreciated.



    jony_calavera webforumsuser@macromedia.com Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139