1. alert, trace에 대해서 먼저 알아보자.
전에 사용했던 프로젝트에 Debugging이라는 Form화면을 하나 만들자.
그리고 alert 와 trace라는 버튼을 만든후 각각의 버튼에 fn_alert , fn_trace라는 메소드 이름으로 Onclick이벤트 주자.

script로 이동해서 Test를 위한 alert와 trace를 작성해보자.
function fn_alert(obj:Button, e:ClickEventInfo)
{
var sName="yoo";
alert(sName);
}
{
var sName="yoo";
alert(sName);
}
function fn_trace(obj:Button, e:ClickEventInfo)
{
var sName1 = "홍길동";
trace(sName1);
}
{
var sName1 = "홍길동";
trace(sName1);
}

출력하여 확인해보자.
alert버튼 클릭!

trace버튼클릭!
콘솔창에 아까 입력한 "홍길동"이 찍히것을 볼 수 있다.

2. Debugging 방법에 대해서 알아보자.
Debugging테스트을 위해서 Debugging이름의 버튼을 하나 만든 후 fn_Debugging이라는 Onclick이벤트를 주자.

script로 이동하자.
Debugging Test를 위해서 간단하게 하게 코드를 작성해보자.
function fn_Debugging(obj:Button, e:ClickEventInfo)
{
var i=0;
i = i+1;
i = i+100;
i = i+1000;
i = i+1;
i = i+10;
i = i+1;
i = i+100;
i = i+10;
}
{
var i=0;
i = i+1;
i = i+100;
i = i+1000;
i = i+1;
i = i+10;
i = i+1;
i = i+100;
i = i+10;
}

Debugging 단축키

Break Point를 설정할 곳에 커서를 두고 F9를 누른다.

선택하였으면 F6을 눌러서 Form화면만 Debugging한다.
그리고 Debugging 버튼을 누른다.

그리고 script 화면 화단에 Variables라는 탭을 누르게 되면, 디버그 모드안에서 추적 가능한 목록들이 나오는데, obj라는 오브젝트 객체와 e라는 이벤트 객체 그리고 i변수가 있다.
아직 Break로 인에 i값이 0이다.

F10을 통해 다음 라인으로 이동이 가능하며, i값이 변하는 것을 볼 수 있다.

마지막으로 Shift+f5를 눌러서 Debugging을 종료한다.
댓글 없음:
댓글 쓰기