2012-12-03 3 views
0

OK 그래서 나는 다음과 같은 코드를 가지고 ...인덱스가 setChildIndex에서 범위를 벗어 났습니까?

가 어떻게해야 무슨
function fire1(e:MouseEvent) 
{ 
    firebb.addChild(fireb); 
    fireb.x=firebb.x; 
    fireb.y=firebb.y; 
    fireb.parent.setChildIndex(fireb, numChildren-1); 
    fireb.startDrag(); 
    pop.play(); 
} 

, 나는 위에 있어야하는데 사용자 정의 커서를 사용합니다 (firebb 무비 클립의 자식을 만들고 깊이를 변경할 수 있습니다 모든 것을 ...하지만 나는 내 게임이 지점에 도달 할 때이 오류가 발생합니다.

RangeError: Error #2006: The supplied index is out of bounds. 
    at flash.display::DisplayObjectContainer/setChildIndex() 
    at main_fla::MainTimeline/fire1() 

되는 setChildIndex가 이전 프레임에서 완벽하게 작동, 무슨 일이 지금 잘못?

답변

1
fireb.parent.addChild(firWb); 

또는

fireb.parent.numberChildren -1 
+0

은 (fireb NUMCHILDREN-1)이 아니라 'fireb.parent.setChildIndex이며,'? – mechanicarts

+0

예 fireb.parent.addChild (fireb); – jyf

+0

사실 나는 fireb와 커서를 모두 잡을 새로운 영화 클립을 만들었지 만, 부모님은 해결책이었습니다. – mechanicarts

관련 문제