I have a click event that needs to be run only once, but every time I click the mouse . I know that this is because this event is every time looking for images to be clicked on the canvas, but how can I find out a click event to run it exclusively? Do I need to create a completely separate click event?
$ ("# schematic_holder"). ("Click", for function (ev) {var x = ev.pageX; var y = Ev.pageY; (var img in images) {var img_x = images [img] .dest_x; var img_y = picture [ Img] .dest_y; var img_w = picture [img] .width; var img_h = image [img] height; if ((x> img_x) & amp; amp; amp; (x < Img_x + img_w) {if ((y> IMG_I) & amp; amp; y (lt; img_y + img_h)} {
This is a function that I only I want to call once but basically has created an infinite loop, which I do not want.
if (images [img] .name == "Landing gear handle") Images (img) .sarc, images [img] .name, images [img] .pazilio.x, images [img] .pio_2.i, images [img] width, images [img] .high, images [ IMG] .position_2.dest_x, images [img] .position_2.dest_y, images [img] .width, images [img] .high, images [img] .position_2.scale_x, images [img] p osition_2.scale_y);} }}}}}
An option to add a boolean that is initially false , Check whether Julian is wrong in your click handler If it is wrong, then run your work and set it to the right or return.
No comments:
Post a Comment