Damn... this is worthy of a blog entry, but ok.
interface IPause
{
funciton pause(){}
function resume(){}
}
So, that's the interface. Seems simple, but you'll find implement pause and
resume methods for various components is hard. For some, you do nothing.
For others, it involves a ton of logic. Just depends. So, let's say you
are using a primitive move operation:
class Circle extends MovieClip implements IPause
{
private var engine_mc:MovieClip;
function Circle()
{
engine_mc = new MovieClip();
engine_mc.addEventListener( Event.ENTER_FRAME, onCrank );
}
function onCrank()
{
x += 6;
}
}
That circle will move across the screen to the right. How do you pause it?
function pause()
{
engine_mc.removeEventListener(Event.ENTER_FRAME, onCrank);
}
How do you resume?
function resume()
{
engine_mc.addEventListener(Event.ENTER_FRAME, onCrank);
}
That wasn't so bad!
What if it used an interval instead?
function pause()
{
clearInterval ( engineID );
}
function resume()
{
clearInterval ( engineID );
engineID = setInterval ( onCrank, 300 );
}
Make sense? Same with Timer's, or setTimeout; just cancel them or resume
them.
- Original Message -
From: quasimotoca [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Wednesday, February 22, 2006 3:57 PM
Subject: [flexcoders] Re: Modal Box Popup and Wait
Hi:
OK, I tried. I failed. Do you have an example of your iPause
interface? I couldn't seem to find pause and resume public methods
(or do I build those as well?). Anyway, a quick example/pseudo code
would be very much appreciated.
Cheers,
Dave
--- In flexcoders@yahoogroups.com, quasimotoca [EMAIL PROTECTED] wrote:
Hi:
Thanks, I'll do that.
Cheers,
Dave
--- In flexcoders@yahoogroups.com, JesterXL jesterxl@ wrote:
Flash has no publicly exposed method documented to pause the
Flash
Player
scripting thread. What I've done in games in the past is have
those
classes/components that must freeze implement an IPause
interface
that has
the public methods of pause and resume. That way, I can pause
the
entire
program for classes that need to be paused.
So, unless you code the pause functionality yourself, all you
really have is
the modality functionality of the popup.
...or you could use PrintJob.send...
- Original Message -
From: quasimotoca dcook@
To: flexcoders@yahoogroups.com
Sent: Thursday, February 16, 2006 12:08 AM
Subject: [flexcoders] Modal Box Popup and Wait
Hi:
Is ther a way in Flex2 to have a modal box popup and wait. In
other
words, when my popup fires I'd like the program to wait until the
user
hits OK then resume execution of the program.
Cheers,
Dave
--
Flexcoders Mailing List
FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/