Keyboard Events Won't Work Unless User Clicks Inside the Flash Movie First (and how to remove the yellow border around objects that are in focus)
Tutorials

Keyboard Events Won't Work Unless User Clicks Inside the Flash Movie First (and how to remove the yellow border around objects that are in focus)


If you find that, for some reason, you'll have to click inside your Flash movie first before the keyboard event listeners start working, then try adding a stage.focus statement to your code:
stage.focus = this;

Place this on the main timeline in order to set the focus to your Flash movie. Focus refers to the currently active object in your Flash movie. Whenever you click on something, like a MovieClip or a TextField, it becomes the active object and becomes the object that is in focus. Here, we are setting the focus back to the entire Flash movie without having to click on anywhere inside the movie. This way, the keyboard events that you've created will work right away. I've encountered this problem a couple of times and I was able to solve them by adding this line. However, adding this line might cause a yellow border to appear around the object that is in focus. If that happens, then try adding this line before the stage.focus statement:
stage.stageFocusRect = false;
stage.focus = this;

That yellow border is the stage focus rectangle which serves to highlight the object that is currently in focus. Here, we're setting the stageFocusRect property to false so that the border will not show up.




- The As3 'this' Keyword And How To Randomize The Size Of A Movieclip Instance On The Stage
In this lesson, we'll learn about the this keyword. But before I explain what the this keyword is, let's first recall that we can put some ActionScript code on keyframes in the main timeline. But we can also put some ActionScript code on the keyframes...

- As3 Dragging And Dropping Tutorial - As3 Startdrag() And As3 Stopdrag()
Exercise File: as3-drag-and-drop.fla - Flash CS4/CS5 as3-drag-and-drop.fla - Flash CS3 In this tutorial, we're going to learn how to create simple AS3 drag and drop functionality using the AS3 startDrag() and AS3 stopDrag() methods. The exercise file...

- As3: Enabling The User To Submit The Contents Inside An Input Text Field
In this lesson, we're going to learn how to add some ActionScript 3 functionality that will let a user submit the contents of an input text field by clicking on a button or pressing a keyboard key. We'll create a simple example of a Flash movie...

- Flash Actionscript 3 Tutorials - Beginners
ActionScript is a programming language used to develop applications that will run on the Adobe Flash Player platform. In this page, you'll find a list of beginner's level ActionScript 3 tutorials that will help you understand how to use the ActionScript...

- Preloading External Swf File Generates Error #1009: Cannot Access A Property Or Method Of A Null Object Reference
Exercise Files: Stage_Issue_Preloader.fla Stage_Issue_Load_This.fla When you're preloading a SWF file that has code that makes any reference to the stage, you might encounter this error: TypeError: Error #1009: Cannot access a property or method of...



Tutorials








.