PhotoDune

Detect is a SWF is playing or stopped?

842 posts
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
+2 more
marcfolio says

Is there a way to determine is a timeline is playing or stopped?

Say I have a SWF being loaded in. In that sub SWF there are several stops on the timeline animation. Is there a way to detect if that sub SWF is playing or if it’s stopped? Without dispatching an event?

1605 posts
  • Author had a Free File of the Month
  • Microlancer Beta Tester
  • Beta Tester
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 1 and 9 users
+5 more
DaniMun says

I’m not sure but maybe the Signals would be a viable solution for you :)

1663 posts
  • Sold between 50 000 and 100 000 dollars
  • Author had a Free File of the Month
  • Bought between 1 and 9 items
  • Exclusive Author
  • Europe
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
Tean says
7326 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says

why do you not want to use events? You’re otherwise going to have to test a boolean value every frame which is totally uncool…

7326 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says
MSFX said
why do you not want to use events? You’re otherwise going to have to test a boolean value every frame which is totally uncool…

what am I talking about?! Ignore me.

You could use a callback function which is fired everytime the timeline stops… so something like this should do it… this is also actually far faster than using events too

// loaded swf
public var callbackFunction:Function;

// la la la

stop();
callbackFunction();
//main swf

loadedSwf.callbackFunction = cb;

function cb() {trace("loaded swf stopped"}
1844 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says

my guess is he has no control on the loaded swf.

you could monitor frame changes but it would work with timeline based animations only

842 posts
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
+2 more
marcfolio says

Turns out FP11 has a new value you can test isPlaying(). It works, but it’s a pain in the A$$ to publish to FP11 and you can’t test it in the IDE flash player. Bummer.

I think I’ll give the kirupa sinoclar method a try.

I don’t want to dispatch an event because in the sub loaded swf is going to have a lot of stops and writing stop() is much easier than dispatch event.

And it’s more universally compatible (or so I’m thinking).

Thank you everyone for your help! This is the smartest, best, Flash community on the planet.

1127 posts
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Referred between 10 and 49 users
  • Bought between 50 and 99 items
FlashTang says

AIR3 .0 – MovieClip.isPlaying :)

New MovieClip property
A new MovieClip.isPlaying property returns the MovieClip’s current playing state.

by
by
by
by
by