detecting a held button 2004-03-07 - By Andreas Weber
Back Hi Richard,
As you are loading the data from a php file I can't simulate the behavior of the code on my machine. All I can do is go through the code and _guess_ what might cause problems.
That said, I think you should move all the code for the definitions of the button handlers inside this loop:
myData.onLoad = function(succes){ if(succes){ for(var i=0; i<this.cant; i++){ this.ref["Title_txt"+i].htmlText = "<b>"+this["Title"+i]+"</b>"
// move all the code in here
}; };
As you have it now, all the code below this onLoad handler will actually execute _before_ the data are loaded. Apart from that: outside the loop the counter i will always have the same value, the handlers will - at best - get attached to one button, the last one.
Secondly, if you have more than one button (and you seem to have many) the 'clicked' counter should be timeline variable of the button, not of the timeline the button resides on (as it is now). Reason: currently all handlers increment / set to 0 the same variable which will probably not give the desired behavior. As it is very fast clicks on 2 different buttons would be interpreted as a double click.
So you would have something like
this.ref["holder_mc"+i].clicked = 0;
to inizialize clicked as a variable of each button mc.
I would also suggest that you make the test function a function of each button/mc
this.ref["holder_mc"+i].test2 = function(){
// function definition comes here
}
Hope this helps. For debugging: put at least 10 traces all over your code to see where you get undefined. (But be aware that you don't get any traces as soon as you test in the Browser)
-- ---- ------ Andreas Weber motiondraw.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected) For additional commands, e-mail: flashnewbie-help@(protected)
|
|