Hey Ryan,
The easiest way that I can think of would be to check the _currentframe
property of an mc. To do this you're going to have to check out the mc's
over two frames, and obviously if the value changes the mc is playing.
So what we'd be looking at now is a function that captures _currentframe
values then plays and compares those values in the next frame. I'd be
looking at putting a child mc on the _root with a stop on frame 1, the
capture code on the second, then the compare and stop if appropriate on
the third (damn the complexity is building now!).
First frame:
Stop();
Second frame:
mcArr = new Array();
for(var mcName in _root) {
if(typeof(_root[mcName]) == "movieclip") {
mcArr[mcName] = _root[mcName]._currentframe;
}
}
Play();
Third frame:
stopArr = new Array();
for(var mcName in _root) {
if(mcArr[mcName] != _root[mcName]._currentframe) {
_root[mcName].stop();
stopArr[stopArr.length] = mcName;
}
}
gotoAndStop(1);
Just remember that if this code is within an mc on the root it'll also
be checked to get stopped , so you're going to want to check against the
mc name to make sure you're not stopping this one.
I've written this off the top of my head, so the third frame's either
going to work fine or be a spectacular mess...
Other than the method above, you might be able to extend the movieClip
object and set a property to update itself when the play method is
called, but it's not something I've had a chance to try and play with in
the past.
For the other points you've mentioned, I find architecture can be
difficult for most professional projects unless you can get a client to
agree to the scope, but they always seem to change something no matter
how much planning goes in. Generally I think it's experience with a
client that let's you pre-empt what they are going to want that they
haven't asked for, and making all the parts of a movie as modular as
possible so you can target a certain mc or object, rather than having to
find a property which you can use to differentiate them. Although, given
that I don't know the intended purpose of the work you're doing, maybe
separating all the mc's which will be playing and those which aren't
might not be practice.
Cheers,
G
-----Original Message-----
From: Ryan Sabir [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 9 November 2004 1:06 PM
To: Flash Developers List
Subject: [fugli] RE: Pausing a Flash movie
Thanks again Grant...
I like the way this is going, but there is still a problem. In my Flash
movie there are multiple movie clips on the stage at any one time. Some
might be animating, and others might be stopped, awaiting a trigger to
animate.
If I go through all the objects adding them to my array when I stop
them, and then start everything in my array, its going to kick off all
the clips whether they were running at the time or not.
Now your note below saying that its not easy to detect if a movieclip is
currently playing... does this mean I'll need to rethink my whole movie
architecture?
Is there a standard way that people do this sort of thing? I would have
thought its a fairly common requirement, to implement a global pause
button.
bye!
Tuesday, November 9, 2004, 12:12:30 PM, you wrote:
GC> Hi again Ryan,
GC> Rather than trying to detect if a movie is currently playing (don't
GC> believe there is an easy way to do this anyway) I'd build an array
GC> in my first function, then cycle back through and start playing
GC> those clips when removing the pause.
GC> In the first run through:
GC> mcArr = new Array();
GC>> for(var i in _root) {
GC>> if(typeof(_root[i]) == "movieclip") {
GC>> _root[i].stop();
GC> mcArr[mcArr.length] = _root[i];
GC>> }
GC>> }
GC> Then when you un-pause:
GC> for(var i=0;i<mcArr.length;i++) {
GC> thisPath = eval(mcArr[i]);
GC> thisPath.play();
GC> }
GC> Not sure you're going to need the eval off the top of my head,
GC> anyway, hope that helps.
GC> Cheers,
GC> G
GC> -----Original Message-----
GC> From: Ryan Sabir [mailto:[EMAIL PROTECTED]
GC> Sent: Tuesday, 9 November 2004 12:03 PM
GC> To: Flash Developers List
GC> Subject: [fugli] RE: Pausing a Flash movie
GC> Thanks!
GC> I got it going using a similar method to what you described...
GC> Now the problem is, when I start it again, I need to know what clips
GC> were playing at the time of the pause, so only those ones get
restarted.
GC> Is there a way to find out the status of a MovieClip, i.e. whether
it is
GC> playing or not?
GC> bye!
GC> Tuesday, November 9, 2004, 11:18:46 AM, you wrote:
GC>> Hey Ryan,
GC>> Maybe you can throw in a for loop to find and stop each clip:
GC>> for(var i in _root) {
GC>> if(typeof(_root[i]) == "movieclip") {
GC>> _root[i].stop();
GC>> }
GC>> }
GC>> Not a really clean solution 'cos it'll eat processor like crazy if
GC>> you have a lot of elements in the root, but worth a try.
GC>> Cheers,
GC>> Grant
GC>> -----Original Message-----
GC>> From: Ryan Sabir [mailto:[EMAIL PROTECTED]
GC>> Sent: Tuesday, 9 November 2004 10:38 AM
GC>> To: Flash Developers List
GC>> Subject: [fugli] Pausing a Flash movie
GC>> Hey all,
GC>> I've got a Flash movie with numerous animated movieclips in it.
I've
GC>> been asked to add a pause function to it now.
GC>> Am I right in thinking I will need to send a stop() to all the
GC> embedded
GC>> movieclips? Is there a simple way to go through all the clips and
GC> pause
GC>> them, then restart them when the user unpauses?
GC>> At the moment my pause just stops the main timeline, but all the
GC>> embedded clips keep running.
GC>> thanks...
GC>> -----------------------
GC>> Ryan Sabir
GC>> Newgency Pty Ltd
GC>> 2a Broughton St
GC>> Paddington 2021
GC>> Sydney, Australia
GC>> Ph (02) 9331 2133
GC>> Fax (02) 9331 5199
GC>> Mobile: 0411 512 454
http://www.newgency.com/index.cfm?referer=rysig
GC>> ---
GC>> You are currently subscribed to fugli as: [EMAIL PROTECTED]
GC>> To unsubscribe send a blank email to
GC>> [EMAIL PROTECTED]
GC>> Aussie Macromedia Developers: http://lists.daemon.com.au/
GC>> ---
GC>> You are currently subscribed to fugli as: [EMAIL PROTECTED]
GC>> To unsubscribe send a blank email to
GC> [EMAIL PROTECTED]
GC>> Aussie Macromedia Developers: http://lists.daemon.com.au/
GC> -----------------------
GC> Ryan Sabir
GC> Newgency Pty Ltd
GC> 2a Broughton St
GC> Paddington 2021
GC> Sydney, Australia
GC> Ph (02) 9331 2133
GC> Fax (02) 9331 5199
GC> Mobile: 0411 512 454
GC> http://www.newgency.com/index.cfm?referer=rysig
GC> ---
GC> You are currently subscribed to fugli as: [EMAIL PROTECTED]
GC> To unsubscribe send a blank email to
GC> [EMAIL PROTECTED]
GC> Aussie Macromedia Developers: http://lists.daemon.com.au/
GC> ---
GC> You are currently subscribed to fugli as: [EMAIL PROTECTED]
GC> To unsubscribe send a blank email to
[EMAIL PROTECTED]
GC> Aussie Macromedia Developers: http://lists.daemon.com.au/
-----------------------
Ryan Sabir
Newgency Pty Ltd
2a Broughton St
Paddington 2021
Sydney, Australia
Ph (02) 9331 2133
Fax (02) 9331 5199
Mobile: 0411 512 454
http://www.newgency.com/index.cfm?referer=rysig
---
You are currently subscribed to fugli as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/
---
You are currently subscribed to fugli as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/