-1
만약 내가 배열 배열의 항목에 대한AS3 : 두 항목을 다른 위치에 연결 하시겠습니까?
private var temp:Array = [item1, item2, item3, item4, item5, item6, item7...etc];
과 두 개의 변수 :
private var firstPosition;
private var secondPosition;
한 번에 둘 항목을 제거하는 방법이 있나요?
말해, 만약 firstPosition의 =의 item4 및 secondPosition = item7 ... 다음 firstPosition = 온도 [3] secondPosition = 온도 [6]
하지만 쓰면 :
temp.splice(firstPosition, 1);
이어서 secondPosition temp [6] 대신 temp [5]입니다. 배열에서 하나가 제거 되었기 때문입니다.
내가 작성되었습니다
temp.splice(firstPosition,1);
temp.splice(secondPosition-1,1);
내가이 생각하지 않는 것은 secondPosition는 "온도"배열의 시작 부분에 특히 ... 바로 (즉 온도 [0]).
나란히 배열되지 않은 경우 배열에서 두 항목을 한 번에 제거 할 수있는 방법이 있습니까 ?? 최대 인덱스 위치에서 제거
firstPosition과 secondPosition의 두 변수를 어떻게 정렬합니까? indexOf 사용? – redconservatory
변수를 정렬 할 수 없습니다. 그것들을 비교하여'firstPosition secondPosition) swap_values_of (firstPosition, secondPosition)' –