내가 이것을 시도하면 오른쪽 버튼이 제거되지 않습니다. 잘못된 방향을 찾아내는 데 올바른 방향으로 나를 가리 키시겠습니까?Flex에서 버튼을 어떻게 눌러 제거 할 수 있습니까?
private var myArray:Array = [];
private var myButton:Button;
public function addButton():void {
var i:uint = myArray.length;
myButton = new Button();
myButton.label = "New Button"+ String(i);
myButton.id= "myButton" + String(i);
myGroup.addElement(myButton);
myArray.push(myGroup.addElement(myButton));
myButton.addEventListener(MouseEvent.CLICK, removeButton);
}
public function removeButton(event:MouseEvent):void {
//myGroup.removeElement(myArray.splice(2,1)); don´t work
//myGroup.removeElement(myArray.pop()); remove the last one
}
그래서 어떻게 될까요? 그리고 무엇을 고치려고 했습니까? 일부 내용을 입력하십시오 –
응답 해 주셔서 감사합니다. –
답장을 보내 주셔서 감사합니다. 버튼을 클릭하지 말고 시도하고 있습니다. 예 : 3 버튼 - b1, b2 및 b3을 추가합니다. array.pop을 사용하고 b1을 누르면 b3 (마지막)이 제거됩니다. 이건 내가 원하는 건 아니고, 나는 b1을 제거하고 싶다. 호프가 의미가 있습니다 ... –