Karl DeSaulniers wrote:
Maybe?
var clicks:Number = 0;
function checkClicks() {
clicks++;
if(clicks == 1) {
//show this
} else if(clicks == 2) {
//show this
} else if(clicks == 3) {
//show this
} else if(clicks == 4) {
//show this
} else if(clicks > 4) {
clicks = 0;
//show original state
}
}
this.button.onPress = function(){
checkClicks();
}
Its AS2, but you can get the drift. HTH
There is probably a shortened AS3 version to this.
Just an example.
Karl, thanks for the code, but I coded the equivalent of that some time
back.
It's the timing of the saving of state to avoid state loss and minimise
network traffic and database load that is the issue. The real-life
version doesn't concern just a single button either!
Paul
Karl
On Jan 18, 2010, at 8:28 AM, John McCormack wrote:
The user may go for another button click as the timer ends.
How about saving state when a non-button click occurs?
John
Nathan Mynarcik wrote:
Gotcha. That makes sense. ------Original Message------
From: Paul Andrews
Sender: flashcoders-boun...@chattyfig.figleaf.com
To: Flash Coders List
ReplyTo: Flash Coders List
Subject: Re: [Flashcoders] Design pattern?
Sent: Jan 17, 2010 2:36 PM
Nathan Mynarcik wrote:
Why not just save the state when the user clicks? Each click can
then just
overwrite the last state.
A lot of unnecessary traffic to and load upon the remote database
server.
Paul
-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of
Paul Andrews
Sent: Sunday, January 17, 2010 1:25 PM
To: Flash Coders List
Subject: [Flashcoders] Design pattern?
I am building an interface where the user updates the interface
state by clicking buttons. When a button is clicked it changes
appearance to indicate the state change.
For the purposes of my question imagine a button that first shows
"A" then when clicked changes to "B", then "C" and then "D".
Clicking when the button shows "D" moves the state back to "A".
It may be that the user clicks at "A" and keeps on clicking until
they reach "D" - so we have a series of state changes - A->B->C->D
The only thing that needs to be known is that the final state is
"D". So I need to save the update to "D", but not the intermediate
values.
I am planning to run a timer that is reset on every click, so that
when the timer expires, the state is saved. The timer would only
then restart once clicking resumes. I would most likely also have a
maximum "wait" too.
Is there an alternative pattern for this?
Paul
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Nathan Mynarcik
Interactive Web Developer
nat...@mynarcik.com
254.749.2525
www.mynarcik.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Karl DeSaulniers
Design Drumm
http://designdrumm.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders