看板 Flash 關於我們 聯絡資訊
import com.phidgets.*; import com.phidgets.events.*; var rfid:PhidgetRFID = new PhidgetRFID(); rfid.addEventListener(PhidgetEvent.DETACH, onDetach); rfid.addEventListener(PhidgetEvent.ATTACH, onAttach); rfid.addEventListener(PhidgetErrorEvent.ERROR, onError); rfid.addEventListener(PhidgetDataEvent.TAG, onTag); rfid.addEventListener(PhidgetDataEvent.TAG_LOST, onTagLoss); antennaChk.addEventListener(MouseEvent.CLICK,updateOutputs); ledChk.addEventListener(MouseEvent.CLICK,updateOutputs); output0Chk.addEventListener(MouseEvent.CLICK,updateOutputs); output1Chk.addEventListener(MouseEvent.CLICK,updateOutputs); rfid.open("localhost", 5001); function onError(evt:PhidgetErrorEvent):void { trace(evt); } function onAttach(evt:PhidgetEvent):void{ trace(evt); Phidgetstatus.text = rfid.Name; Serialnumber.text = rfid.serialNumber; Version.text = rfid.Version; Outputs.text = rfid.OutputCount; rfid.Antenna = true; antennaChk.selected = true; rfid.LED = true; ledChk.selected = true; rfid.setOutputState(0,output0Chk.selected); rfid.setOutputState(1,output1Chk.selected); } function onDetach(evt:PhidgetEvent):void{ trace(evt); Phidgetstatus.text = ""; Serialnumber.text = ""; Version.text = ""; Outputs.text = ""; } function onTag(evt:PhidgetDataEvent):void{ trace(evt); Tagoutput.text = evt.Data; } function onTagLoss(evt:PhidgetDataEvent):void{ trace(evt); Tagoutput.text = ""; } function updateOutputs(e:MouseEvent):void { var cb:CheckBox = CheckBox(e.target); if(e.target.name == "antennaChk") { rfid.Antenna = antennaChk.selected; } if(e.target.name == "ledChk") { rfid.LED = ledChk.selected; } if(e.target.name == "output0Chk") { rfid.setOutputState(0,output0Chk.selected); } if(e.target.name == "output1Chk") { rfid.setOutputState(1,output1Chk.selected); } } --------------------------- 如何在上述程式碼裡面 加入以下這段 如何融合在一起= =?? onClipEvent (load) { var choice = 0; } onClipEvent (enterFrame) { if (choice == 11) { this.gotoAndStop(1); } if (choice == 22) { this.gotoAndStop(2); } if (choice == 33) { this.gotoAndStop(3); } } 目前卡死在這段= =" -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 192.192.213.25
pm2001:this.addEventListener(load事件,load函數名稱); 11/12 21:01
K988:感謝 11/13 12:11