I am trying to calculate the current frame in a symbols main timeline, and I can get the current time and the duration, but the current time varies on each run depending on how the browser is handling the graphics. Has anyone found an algorithm to calculate this?
Are you saying that the browser is sticking at one point while the JS has already moved on…?
I would say even if that is the case the js should be accurate.
How are you getting the current time, are you using
I am using symbolInstance.currentTimeInTimelineNamed(‘timelineName’).
If I run a log on console I get a differing time 1.0499954223633863 one time, 1.0899954223633863 another. because it varies, it is impossible to check with complete accuracy against the duration. In Flash there had been a method to call to get the currentFrameNumber. I am trying to create a similar method, as I always found it useful.
My client is making an image heavy animation, and I only want to pull the items in on the first instance of the scene. I have seen some elegant versions which make total sense but reload the images from the resources. I am showing the new images each frame and hiding the old images each frame, and it would make it much more elegant to use the frameNumber to do that.
Does that make sense?
posting an example project always helps… well in most cases.
This possible may help ( or not )
I know, I had seen that but I imagine what hype is doing is having to pull the elements in again from the cache if to the server. If you throttle it in the developer it runs very slowly. I have tried to look under the hood and I figure that hype is using intervals and multidimensional arrays to run animations. If you don’t reload images then it is probably just turning visibility on and of. If I could get the index in the array that is firing in the “animation” I would know exactly where I am. I am trying to build a hack for something that would be a great feature.
Hype’s engine doesn’t play on frame boundaries. While you define in the editor at 30 FPS, it will play in the browser based on clock time (and typically at 60fps).
Jonathan thanks. That is what I was doing previously, I just wanted to find a cleaner way that I could reuse in the future and build events around. I am working with a designer/developer that is not as code say and I am trying to make the code as hassle free for them.
You all are doing a great job with this product, and thanks for the answer.
I ended up making a global playhead object that can monitor the current frame of any given timeline and then jump accordingly by converting it to time in seconds . Thanks for your comment earlier. It may not be as elegant as I want but I can check on anything anywhere now and manipulate based on frames rather than time.
Glad you were able to come up with a solution!