Groups | Blog | Home
all groups > flash actionscript > may 2005 >

flash actionscript : How do I watch a movie's frame location



DazFaz
5/9/2005 12:00:00 AM
I?m trying to watch or onchanged a movie's frame location. Other than having an
onenterframe function running continually, which will needlessly hammer the
processor, I need to have a function that will tell me when a movie moves on a
frame.

Has anyone any ideas. :D

GaryCCY
5/9/2005 12:00:00 AM
HI

DazFaz
5/9/2005 12:00:00 AM
That was an initial idea but the idea is to be able to load random .swf files
into a main shell . The .swf's to be loaded are very random and it would make
sense to detect the frame number using a function.
GaryCCY
5/9/2005 12:00:00 AM
[quoted text, click to view]
Then the frame number you want to detect is the same for these random swf or
not?

Anyway, you want to monitor something but cannot at a function call at that
frame and don't want to use something like onEnterFrame with _currentframe
which consumes CPU cycles, in that case, I am not good enough to think of other
possible solutions, sorry :-|
DazFaz
5/9/2005 12:00:00 AM
Thank you anyway Gary. I know its something along the lines of a "watch"
command or there abouts.

The really anoying things is that if it was a text field that I wanted to
detect a change in, it would be as simple as:

my_txt.onChanged = function(){
trace("Text changed");
}

and that it. The trace command would be triggered every time the text in that
field changed.

But trying to apply this same functioning to a movie, well as you can imagine,
is a little trickier.
GaryCCY
5/9/2005 12:00:00 AM
Think about this, a text field onChange is also a watch, isn't it?
David Stiller
5/9/2005 10:55:17 AM
[quoted text, click to view]

This is a convenient mechanism, for sure.

[quoted text, click to view]

Certainly, but a but movie (the FLA itself) is vastly different from a
TextField instance. As Gary suggested, this is probably a matter of looking
for different ways to architect your main timeline. If your main timeline
is being *sent* from one frame to another, you might consider adding
instructions to the function(s) doing the sending to also trigger your other
functions (the ones that would have been triggered by a "watch" on the frame
number).

Another suggestion was this ...

[quoted text, click to view]

.... to which you replied ...

[quoted text, click to view]

.... but I don't see where that would be problem. You could load random
files into the main shell by using setInterval(), for example, or the above
mentioned trigger script in these frames. It all depends on how you write
your "receiving" functions, y'know? It sounds like you have a certain goal
and are comfortable with one particular way of dealing with it, except that
one way is hard on the processor -- so what are your other options? It's
hard for us to know without more details.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

GaryCCY
5/11/2005 12:00:00 AM
Hi

Can try to put a

_root.onEnterFrame = myFunction;
function myFunction(){
var atFrame = myMovieClip._currentframe
if (atFrame==myMovieClip._totalFrames){
//do something
trace("movie at last frame");
}
}
//When you do not need to monitor it anymore, do
_root.onEnterFrame = null;
DazFaz
5/11/2005 8:27:31 AM
AddThis Social Bookmark Button