Skip to main content
Inspiring
February 1, 2007
Question

MX: onEnterFrame not being triggered

  • February 1, 2007
  • 8 replies
  • 874 views
I have this code that is supposed to move a movieclip once loaded. It is loading into the initial position but doesn't then trigger the onEnterFrame
This topic has been closed for replies.

8 replies

breez11Author
Inspiring
February 1, 2007
Can you send me that file
Inspiring
February 2, 2007
Sure. It is on its way.
breez11Author
Inspiring
February 1, 2007
I don't understand how to preload the jpg's and swf's and use the getBytesLoaded() and getBytesTotal() methods. Could you give me a little more insight
breez11Author
Inspiring
February 1, 2007
breez11Author
Inspiring
February 1, 2007
tjohnson4@gmail.com
but my work computer currently uses MX

but all the code besides the :Void should work with as1
breez11Author
Inspiring
February 1, 2007
please send still I request for a version upgrade and should get it by the end of the day
breez11Author
Inspiring
February 1, 2007
when I use loadClip nothing loads but if I do tis everything appears on the stage but doesn't trigger the onEnterFrame

namesArray = new Array("bg", "widget1", "widget2", "widget3", "MainLogo", "MainMessage");
locationsArray = new Array([0, 0], [-500, 250], [275, 225], [445, 250], [530, 105], [410, 23]);
for (i=0; i<namesArray.length; i++) {
container_mc.createEmptyMovieClip(namesArray +"_mc", i);
container_mc[namesArray
+"_mc"]._x = locationsArray [0];
container_mc[namesArray
+"_mc"]._y = locationsArray [1];
if (i == 0) {
container_mc[namesArray
+"_mc"].loadMovie("images/"+namesArray +".jpg");
} else {
container_mc[namesArray
+"_mc"].loadMovie("images/"+namesArray +".swf");
}
}
breez11Author
Inspiring
February 1, 2007
nothing. I changed the array names back since these are the names of the files I am trying to load into the movieclips
also I added the movieclips name back to everywhere you deleted it since this is the location of thei images and movies

here is what I did

namesArray = new Array("bg", "widget1", "widget2", "widget3", "MainLogo", "MainMessage");
locationsArray = new Array([0, 0], [-500, 250], [275, 225], [445, 250], [530, 105], [410, 23]);
for (var i = 0; i<namesArray.length; i++) {
//create a clip on the root using a reference
var container:MovieClip = this.createEmptyMovieClip(namesArray +"_mc", i);
container[namesArray
+"_mc"]._x = locationsArray [0];
container[namesArray
+"_mc"]._y = locationsArray [1];
if (i == 0) {
loader.loadClip("images/"+namesArray
+".jpg", container.namesArray +"_mc");
} else {
loader.loadClip("images/"+namesArray
+".swf", container.namesArray +"_mc");
}
}
Inspiring
February 1, 2007
What is your email? I'll send you the fla (version 8) I'm using.
breez11Author
Inspiring
February 1, 2007
Here I tried to add a listener which is now triggering the the onEnterFrame event but is not deleting it. The script keeps trace done
done
done
done
ect.

also nothing is appearing on the stage.

here is my new code

Inspiring
February 1, 2007
Well, in the meantime I quickly edited your original code. You have to wait for the image or swf to load before you can invoke a function that performs the easing. I'm using the MovieClipLoader Class here. Now, replace the names in the names_array (I used some of my own images obviously). And I did not use a container_mc but created the container on the root.
In the code I'm passing the container to the function doEase() so all images are now eased to the same spot (just as an example, you can change that). And, the onEnterFrame keeps running - you just need to use this.onEnterFrame there (when you create the container on the root. -> edit

Edit: this.onEnterFrame kills the onEnterFrame on the target clip that is passed to the function doEase()

Inspiring
February 1, 2007
Wait for the image to load......... then trigger the onEnterFrame. You code gets executed right away so the loadMovie kills the onEnterFrame.
breez11Author
Inspiring
February 1, 2007
Don't understand why loadMovie kills onEnterFrame. What should I use instead?