i’ve got an interesting conundrum for you all.

According to Flash help, ENTER_FRAME “…does not go through a ‘capture phase’ and is dispatched directly to the target, whether the target is on the display list or not.”

and it is true that an object with an ENTER_FRAME event does seem to work okay if it’s not on the display list.

however, if you start loading external assets, it seems to forget about this ENTER_FRAME event at some random point in time! insert the code below into a frame, and replace imageFile with an actual external asset. the enterFrame function should count up from 1 to infinity, but instead at around 30(for me) it stops!

however, if you add the MovieClip to the stage, it receives the ENTER_FRAME event without fail.

const imageFile:String=”put a swf here.swf”;
var tally:int=0;
var loadertally:int=0;
function setUpEnterFrame() {
var newObject:MovieClip=new MovieClip();
//this.addChild(newObject); ——-works when these comments are removed…
function nextLoader() {
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderDisplayed);
var request:URLRequest = new URLRequest(imageFile);
function enterFrame(event:Event):void {
trace(“>>>>enterFrame – “+tally);
function loaderDisplayed(event:Event):void {
if (loadertally
trace(“loader complete – “+loadertally);
function moveToRandomPlace(whichObject:DisplayObject):void {


I’ve resolved this issue with some credit to kglad in forums – the problem is that as newObject is a variable local to the nextLoader function, when this function is complete and is garbage collected, the EnterFrame no longer triggers… i initially encountered this problem with Tweens – it is a very easy mistake to make – something to be cautious of!

iOS development with Swift - book: https://manning.com/books/ios-development-with-swift video course: https://www.manning.com/livevideo/ios-development-with-swift-lv

Tagged with: ,
Posted in Flash

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: