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 Posted / subash

//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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is vector graphic animation? : Adobe flash

477


you want to create a rectangle shape with a defined corner radius. Which tool should you use? : Adobe flash

554


what is needed when using static text to have font outline embedded in swf file? : Adobe flash

438


How does removal of actual objects and data work in actionscript?

471


how does an xmlsocket server know when a received message is complete? : Adobe flash

479






Write a program that shows the usage of data types?

446


How to create scrolling gallery in portfolio?

501


Which is the quickest way to make the stroke around an oval shape into a dotted line? : Adobe flash

483


which text anti-aliasing property setting will result in the smallest swf file size? : Adobe flash

494


Name the as3 components?

486


what is the primary purpose of the stage object? : Adobe flash

495


which statement best describes what the #initclip num and #endinitclip commands indicate? : Adobe flash

486


Tell me what are the different ways in which the variables can be assigned?

492


which of the following is not a result of exporting a movie for a debug build? : Adobe flash

472


What are the features provided by actionscript 3.0?

488