subash


{ City } mumbai
< Country > india
* Profession * developer
User No # 42242
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 5
Users Marked my Answers as Wrong # 3
Questions / { subash }
Questions Answers Category Views Company eMail




Answers / { subash }

Question { 6903 }

Write a function that responds to a click anywhere on the
page by displaying an alert dialog. Display the event name
if the user held Shift during the mouse click. Display the
element name that triggered the event if the user held Ctrl
during the mouse click.


Answer

//1)
stage.addEventListener(MouseEvent.CLICK, clickHandler)
function clickHandler(e:MouseEvent){
trace("Mouse Clicked")
}

//2)
stage.addEventListener(MouseEvent.CLICK, shiftHandler);
function shiftHandler(e:MouseEvent) {
if (e.shiftKey) {
trace("Mouse Clicked with Shift key");
}
}
//3)MouseEvent
stage.addEventListener(MouseEvent.CLICK, controlHandler);
function controlHandler(e:MouseEvent) {
if (e.ctrlKey) {
trace("Mouse Clicked with Ctrl key");
}
}

Is This Answer Correct ?    5 Yes 3 No