I'm returning to this after a long period away, and it is really getting on my nerves, but I'm hoping that will pass as I get used to all the little (or big quirks).
Just making a note of some things I am figuring out as I go along.
1) You can't put different dynamic textboxes on the same frame.
a) If you put them on the same layer, Animate will insist that they are called by the same name. Best to just humour it and give them the same name.
2) Scope! Aaaarrrrggghhh!!!
If you use addEventListener as usual, it seems to switch to 'window'? Not really sure what this is, maybe one day it will be useful...
The syntax for 'on' is:
this.mc.on('added', function(e) {
console.log('hey there');
});
The above method seems to allow the mc to work from within itself?
On the other hand,
this.mc.addEventListener('click', someFunc.bind(this));
seems to make it have the scope of the place where the function is written, if I remember correctly. And can be altered to give it a different scope?
Each of these ways is removed differently, so that might influence what you choose to use.
CAUTION
Animate will add extra eventlisteners to the objects everytime you return to the frame, so use hasEventListener to check if the eventListener has already been attached (it only takes the event as a parameter).
3) Undefined for a movieclip that is on the screen?
So this is irritating, you are trying to do something to a movieclip that is on the stage, it has a name, so why on earth is the browser claiming it doesn't know who that is? And why is it able to find other movieclips easily?
Answer(s): You can add eventListeners to something that hasn't loaded yet, but you can't check its location or anything like that. So... use an added eventListener to check when it does exist, and then use it after that.
I have problem on old PC 2007 dual core. CPU load 100% in firefox. Any ideas?
ReplyDelete