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
who can view flash? : Adobe flash
Describe changewatcher.watch.
which of the following is not a typical host application for the flash player? : Adobe flash
how to embed flash in html? : Adobe flash
Explain what are the data types supported by actionscript?
explain the flash vs. Animated images and java applets? : Adobe flash
which two file formats can be imported into a swf file at runtime? : Adobe flash
you want to create a rectangle shape with a defined corner radius. Which tool should you use? : Adobe flash
you understand from the sb-25 manual that the built-in, retractable bounce card is meant for use with the flash head in a vertical position? : Adobe flash
to what does object drawing model refer? : Adobe flash
Tell me what are the different ways in which the variables can be assigned?
How many menus will you find on the menu bar?
I shoot underwater with a ttl strobe that does not allow you to set flash exposure compensation. How do I set fill flash with this set up? : Adobe flash
How to embed flash in html?
which two panels can be used to change the label text of a button component? : Adobe flash