Resolving problems with instances in a linked class


show more Resolving problems with instances in a linked class provides you with in-depth training on Developer. Taught by Todd Perkins as part of the ActionScript 3.0 in Flash Professional CS5 Essential Training show less
please wait ...

Resolving problems with instances in a linked class

Occasionally, you'll run into problems when linking a class to a symbol. Knowing how to resolve these issues will prevent countless headaches in the future. I've mentioned before that whenever you work with instances and Timelines and object-oriented code, you could have problems. In this file here, I've connected the TrashCan symbol to the Obstacle Base Class. Let's take a look at the Obstacle Base Class.

In Obstacle.as, the constructor method adds an EventListener to listen for the ENTER_FRAME Event. Remember, the ENTER_FRAME Event executes every frame, so over and over and over again, 24 times a second or 30 times a second, depending on how fast your frame rate is for your FLA file. So every frame, I'm running this function called checkCollision. This code may be familiar to you because you used it before.

I simply copied and pasted this code from another exercise and made very small changes to it. The only change is that I added the removeEventListener line of code....

Resolving problems with instances in a linked class
Video duration: 7m 53s 7h 8m Beginner Updated May 23, 2012

Viewers:

Resolving problems with instances in a linked class provides you with in-depth training on Developer. Taught by Todd Perkins as part of the ActionScript 3.0 in Flash Professional CS5 Essential Training

please wait ...