how to flatten an array splice?

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default how to flatten an array splice?

    var foo:Array = [1, 2, 3 ];
    var bar:Array = [9,10 ];

    foo.splice(2, 0, bar) == [1,2,[9,10],3]

    How can i splice in bar so i get a single flat result [1,2,9,10,3]?

    I know i could loop over bar and splice in each individual member into foo,
    but is there a more efficient option?

    Thank you.


    mmthm Guest

  2. Similar Questions and Discussions

    1. Array.splice is stopping the loop?
      The code that follows should loop through the 'AllTopicsGroups' array checking for any item which has the 'group_id' of '21'. It should delete these...
    2. Splice problem
      My problem is that I am splicing an array and then echoing the array <?php $input = array("red", "green", "blue", "yellow");...
    3. [PHP] Splice problem
      My problem is that I am splicing an array and then echoing the array <?php $input = array("red", "green", "blue", "yellow"); ...
    4. Flatten Layers/Flatten Selections - why?
      In looking at a couple or tutorials in Fireworks they say to flatten layers or flatten selections. I can't find much explanation in FW help...
    5. note 33609 added to function.array-splice
      I couldn't get array_splice() to insert into a multidimensional array, so I cribbed this from the notes for array_push() (a thousand thanks to jhall...
  3. #2

    Default Re: how to flatten an array splice?

    I don't think there is any efficient option.
    Sreenivas R 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