0

Is it possible to get and set seek position of a swf file (either in ActionScript 2/3 or ActiveX API of Flash Player) ?

I tried to use frame number at first (to determine which part of the movie is being played) however sometimes whole animation has 2 frames and it does not help.

Any ideas? Thanks.

Hayri Uğur Koltuk
  • 2,970
  • 4
  • 31
  • 60

3 Answers3

0

Not without coding something in to the SWF as far as I know. Because animations in Flash can be in embedded MovieClips, or entirely scripted in a single frame, there is no easy way to detect the total playing time or how far an animation has progressed. Any get/seek functionality, or even a progress broadcast, would have to be scripted in the SWF and accessed through ExternalInterface.

shanethehat
  • 15,460
  • 11
  • 57
  • 87
0

if your loaded SWF contains all animation on the stage timeline ( i mean the top level ) then the progress you are seeking is:

var progress:Number = swf.currentFrame / swf.totalFrames;

if you want to set seek:

swf.gotoAndPlay ( progress * swf.totalFrames )

Also it can be that the all animation is not on the top level, but in the movieClip, which address you know, i mean stage.getChildByName ( 'something ).getChildeByName ('something )...

but if you have an swf where are multiple movieclips, and they are playing independantly, then nothing i can help....

Jevgenij Dmitrijev
  • 2,228
  • 1
  • 15
  • 23
  • is there any third option? i mean a flash animation with only 1 frame and no movie clip? maybe scripting or sth? – Hayri Uğur Koltuk Jul 20 '11 at 09:34
  • that also can be the case, when all animation is programicaly based, you would be able to track it. – Jevgenij Dmitrijev Jul 20 '11 at 09:47
  • I'm not sure about your real point here, but if those are yours swf's and you creating them you can look at this: http://www.greensock.com/timelinelite/ – Jevgenij Dmitrijev Jul 20 '11 at 09:48
  • unfortunately those can be just any swf file, most likely not created by me. so if the all animation is programmed in 1 frame, then we cannot seek back and/or forth (ok maybe back), right? we will have to wait till the code executes and then we can see the results – Hayri Uğur Koltuk Jul 20 '11 at 09:55
  • and do you have any sample swf file that consists only of 1 frame and animation is completely done by scripting? i was looking for some samples on the internet however no outcome so far... – Hayri Uğur Koltuk Jul 20 '11 at 10:21
-2

Please be more specific about your problem. If your swf file is only 2 frames, then what is it that you are trying to seek through? Does your swf load a video, for example, and this is what you are trying to seek through? (In which case you can get properties of a video object's playback position and state).

Without more information, it's hard to provide a clear answer.

cleverbit
  • 5,514
  • 5
  • 28
  • 38
  • My swf file can consist of only 1 frame or it may consist of 100 frames, I am supposed to find a solution that will fit both. the problem is, lets say i have a swf with 1 frame. i want to fast-forward the animation and display things as if it was being played for 2 hours. is that possible? – Hayri Uğur Koltuk Jul 19 '11 at 14:14
  • If your swf has only 1 frame but it contains animation, then by definition it contains sub-movieclips. You could use frame navigation (goToFrame) on the root timeline and then loop through the display list to discover all the available sub-movieclips, and then use goToFrame on those. – cleverbit Jul 19 '11 at 16:07