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

we need to create a Alert Window class. If write in trace it
won't display in Alert dialog. It will display only on
output window.

use following code

package com.whatever {

//Imports
import flash.display.Shape;
import flash.display.Sprite;
import flash.geom.Rectangle;
import flash.events.MouseEvent;

//Class
public class AlertWindow extends Sprite {

//Vars
protected var box:Shape;
protected var yesBtn:Sprite;

//Constructor
public function AlertWindow (obj:Rectangle):void {

//Initialise
box = new Shape()
yesBtn = new Sprite()
addChild(box)
addChild(yesBtn)

//Render
with (box.graphics) {
lineStyle(1)
beginFill(0, 0.4)
drawRect(obj.x, obj.y, obj.width, obj.height)
endFill()
}

with (yesBtn.graphics) {
lineStyle(1, 0x00FF00)
beginFill(0x00FF00, 0.4)
drawRect(obj.x+obj.width-100,
obj.y,obj.height-40, 80, 20)
endFill()
}

//Events
yesBtn.addEventListener(MouseEvent.CLICK,
yesClickHandler, false, 0, true)
yesBtn.addEventListener(MouseEvent.MOUSE_OVER,
yesOverHandler, false, 0, true)

}

//Handlers
protected function yesClickHandler($):void {}
protected function yesOverHandler($):void {}
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the recommended character to use to separate target level paths levels? : Adobe flash

502


Tell me what are the functions used with flash media?

433


Do you know what are the ways in which actionscript's code can be protected?

449


How to start a graphic animation at a specific frame?

554


Do you know how does removal of actual objects and data work in actionscript?

470






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

483


what are the statements best describes an event handler? : Adobe flash

519


What are the changes presented by actionscript?

455


What is meant by vector graphic animation?

463


you are creating a form that will fade out when the user submits it. What must you do to with the text fields to ensure that text entered by the user will fade out? : Adobe flash

448


what is default frame rate of the time line in frame per second? : Adobe flash

566


What are the features involved in updating a language?

472


who can create flash movies? : Adobe flash

478


what is the advantage of progressive video download? : Adobe flash

516


what are the statements uses proper for loop syntax? : Adobe flash

494