Flash CS4에서 Actionscript 3 응용 프로그램을 만들고 있습니다. DreamDown이라는 Actionscript를 내보내는 dropDown이라는 무비 클립을 만들었습니다. 이 무비 클립 내에서 numericStepper 구성 요소가 삭제되었습니다. 또한 Actionscript에 DropDownBtn으로 내보내기 드롭 다운 추가라는 텍스트가있는 상자의 기본 무비 클립이 있습니다. 정말 기본.AS3 NumericStepper 구성 요소
드롭 다운 추가 버튼은 이벤트 리스너 및 콜백 함수를 통해 영화 클립 인스턴스를 만듭니다.
인스턴스가 만들어지면 Numeric Stepper의 값에 액세스하는 것 같습니다.
//create the load dropdown button
var newButton = new DropDownBtn();
//position the button
newButton.x = 20;
newButton.y = 20;
//and add it to the stage
addChild(newButton);
//add the event listener to the button
newButton.addEventListener(MouseEvent.MOUSE_DOWN, addDropdown);
function addDropdown(e:MouseEvent):void{
//create and instance of the drop down
var newDropDown = new dropDown();
//move it over beside the add dropdown button
newDropDown.x = newButton.width+40;
newDropDown.y = 20;
//add the instance of the newDropDown to the display stack
addChild(newDropDown);
//add the event listener to the dropdown
newDropDown.addEventListener(Event.CHANGE, useDropDownValue);
}
function useDropDownValue(e:Event):void{
//this is where I need to utilize the value of the Numeric Stepper
//I thought it would be accessed as follows but it doesn't seem to work
//I added a trace to make sure this function is being executed and that works
//when i comment out my attempt at using the Numeric Stepper Value
trace("useDropDownValue Function Accessed");
var dropDownValue = newDropdown.value;
}
범위 문제 일 수 있다고 생각했습니다. 객체의 인스턴스가 이제 감사 외부에 존재합니다. 그래도 문제가 하나 더 있습니다. dropDown 무비 클립 안에 있고 newDropDown으로 인스턴스화 된 NumericStepper의 값을 얻는 것 같습니다. newDropDown.value 시도하고 작동하지 않는 것. 어떤 아이디어? – Laurence