Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
detecting a held button

detecting a held button

2004-03-07       - By Andreas Weber

 Back
Reply:     1     2     3     4     5     6     7     8     9     10  

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)