-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This test verifies the behavior of focus-related events when the window focus is lost.
- Loading branch information
Showing
6 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package { | ||
|
||
import flash.display.InteractiveObject; | ||
import flash.display.MovieClip; | ||
import flash.display.Sprite; | ||
import flash.events.Event; | ||
import flash.events.KeyboardEvent; | ||
import flash.events.MouseEvent; | ||
|
||
[SWF(width="50", height="50", backgroundColor="#000000")] | ||
public class Test extends MovieClip { | ||
private var clip:Sprite; | ||
|
||
public function Test() { | ||
super(); | ||
|
||
this.clip = new Sprite(); | ||
this.clip.x = 15; | ||
this.clip.y = 15; | ||
this.clip.graphics.beginFill(0xFF00FF); | ||
this.clip.graphics.drawRect(0, 0, 20, 20); | ||
this.clip.name = "clip"; | ||
this.clip.tabEnabled = true; | ||
this.clip.tabIndex = 1; | ||
|
||
this.stage.addChild(this.clip); | ||
|
||
stage.addEventListener("keyDown", function(evt:KeyboardEvent):void { | ||
if (evt.keyCode == 9) { | ||
trace("Tab pressed"); | ||
} | ||
}); | ||
|
||
function eventListener(obj: InteractiveObject): Function { | ||
return function(evt: Event): void { | ||
var str; | ||
if (evt is MouseEvent) { | ||
str = evt.formatToString( | ||
"MouseEvent", "type", "cancelable", "eventPhase", | ||
"relatedObject", "ctrlKey", "altKey", "shiftKey"); | ||
} else { | ||
str = evt.toString(); | ||
} | ||
trace(" " + obj.name + ", " + evt.target.name + ": " + str); | ||
} | ||
} | ||
|
||
for each (var obj: InteractiveObject in [ | ||
clip, stage | ||
]) { | ||
obj.addEventListener("focusIn", eventListener(obj)); | ||
obj.addEventListener("focusOut", eventListener(obj)); | ||
obj.addEventListener("mouseDown", eventListener(obj)); | ||
obj.addEventListener("mouseUp", eventListener(obj)); | ||
obj.addEventListener("click", eventListener(obj)); | ||
obj.addEventListener("mouseFocusChange", eventListener(obj)); | ||
obj.addEventListener("keyFocusChange", eventListener(obj)); | ||
obj.addEventListener("rollOut", eventListener(obj)); | ||
obj.addEventListener("rollOver", eventListener(obj)); | ||
obj.addEventListener("mouseOver", eventListener(obj)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "FocusLost" }, | ||
{ "type": "FocusGained" }, | ||
{ "type": "Wait" } | ||
] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Tab pressed | ||
null, null: [FocusEvent type="keyFocusChange" bubbles=true cancelable=true eventPhase=2 relatedObject=[object Sprite] shiftKey=false keyCode=9] | ||
clip, clip: [FocusEvent type="focusIn" bubbles=true cancelable=false eventPhase=2 relatedObject=null shiftKey=false keyCode=0] | ||
null, clip: [FocusEvent type="focusIn" bubbles=true cancelable=false eventPhase=3 relatedObject=null shiftKey=false keyCode=0] | ||
Tab pressed | ||
clip, clip: [FocusEvent type="keyFocusChange" bubbles=true cancelable=true eventPhase=2 relatedObject=[object Sprite] shiftKey=false keyCode=9] | ||
null, clip: [FocusEvent type="keyFocusChange" bubbles=true cancelable=true eventPhase=3 relatedObject=[object Sprite] shiftKey=false keyCode=9] | ||
clip, clip: [FocusEvent type="focusOut" bubbles=true cancelable=false eventPhase=2 relatedObject=null shiftKey=false keyCode=0] | ||
null, clip: [FocusEvent type="focusOut" bubbles=true cancelable=false eventPhase=3 relatedObject=null shiftKey=false keyCode=0] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
num_ticks = 1 | ||
|
||
image_comparisons."output".trigger = 1 | ||
|
||
[player_options] | ||
with_renderer = { optional = true, sample_count = 1 } |