Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
stwingy webforumsuser@macromedia.com #1
double click button(mc)
I need a way to double click a movieclip as need to be able to drag & drop it. This is a section of the code i am using
outbar1.numero = 1;
outbar2.numero = 2;
outbar3.numero = 3;
outbar4.numero = 4;
outbar5.numero = 5;
outbar6.numero = 6;
bigC = false;
function countup() {
if (counter<=50) {
counter += 1;
bigC = true;
} else if (counter>50) {
clearInterval(myInterval);
counter = 0;
bigC = false;
}
}
outbar1.onPress = outbar2.onPress=outbar3.onPress=outbar4.onPress=ou tbar5.onPress=outbar6.onPress=mover;
function mover() {
this.swapDepths(200);
clearInterval(myInterval);
myInterval = setInterval(countup, 10);
if (bigC) {
trace(this.numero);
scatter()
for (i=1; i<7; i++) {
_root["outbar"+i].slideTo(_root["outbar"+i].X, _root["outbar"+i].Y, _root["outbar"+i].speed);
}
}
this actually works and traces [outbar+i].numero on a double click but for some reason i have been unable to use this.( if you are thinking the syntax is incorrect, the function goes on another 100 lines or so.)
Please help.
Certified but not by Macromedia!
myurl
stwingy webforumsuser@macromedia.com Guest
-
double click problem
I'm having a problem with swf's continuosly loading when a button is double clicked. If the button is clicked once, it works fine. When the... -
double click on grid
I want to double click on a row within the grid and have it take me to a edit screen for that row. Currently I allow the user highlight a row and... -
WWW::Mechanize click($button) not finding right button to click
Based on wise advice from participants of this forum, I rewrote my web automation script using WWW::Mechanize. The script now successfully logs... -
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl.
Hello I have the following situation: (everything is dynamic (controls.add)) 1. Button.Init { WasButtonClickFired = true } 2.... -
Single click vs double click in mouseDown and mouseUp
For a double click mouseDown and mouseUp catch 2 event: the first report clickCount value 1 and the second report value 2. How to respond to a... -
Pea webforumsuser@macromedia.com #2
Re: double click button(mc)
Hi,
Not sure about the code, you have, but here is some code you can try for double click:
1) Place a big invisible button in the clip. This is the area you can double-click on.
2) In the clip itself, place this code:
// Set defaults
clickedOnce = false;
clickedOnceCount = 0;
// This function runs once every frame.
function doubleClickCount(){
// If we have clicked once, increase counter
if (clickedOnce){
clickedOnceCount++;
// If the count is too high, reset click (wait too
// long between clicks on double click)
if (clickedOnceCount>10){
// Stop double click
clickedOnce = false;
}
}
// Set function to run every frame
this.onEnterFrame = doubleClickCount();
3) In the actions of the button itself, place this code:
// When the button is released
on (release){
// If the button hasn't been clicked at all, start double click code
if (!clickedOnce){
// Start counting
clickedOnce = true;
clickedOnceCount=0;
}else{
// Otherwise this is the second click of a double click
// Do whatever you need to do on double clcik here!
// e.g. Start dragging the clip:
this.startDrag(false);
}
}
Thats it!
Points to note - this code runs much better at higher framerates (upwards of 20fps) because this allows it capture clicks very close together.
Also, play around with the number in bold to change the time allowed between double clicks (for example, at 20fps, clickedOnceCount>10 allows half a second between clicks).
Hope it helps,
Pea
Pea webforumsuser@macromedia.com Guest
-
stwingy webforumsuser@macromedia.com #3
Re: double click button(mc)
After looking through your code, I found it is very similar to what i was already trying to do.(i`m using setInterval + no buttons). I had missed an else statement which i doubt i would ever have spotted without reading through your post.
Thankyou
Certified but not by Macromedia!
myurl
stwingy webforumsuser@macromedia.com Guest
-
Paul J. Martinez #4
Re: double click button(mc)
This might be useful as well.
[url]http://proto.layer51.com/d.aspx?f=385[/url]
Take care,
Paul
--
[url]http://fatlogic.com/[/url]
[email]paul_NOSPAM@fatlogic.com[/email]
Paul J. Martinez Guest



Reply With Quote

