PDA

View Full Version : Mouse is doing wacky things.



sam.baker
March 15th, 2009, 08:27 PM
http://sambaker.net/neattools/source/neattools22.swf

If you look at the file above, you'll see a bunch of boxes. If you hover over the right edge of a box, it will glow green, if you then click and drag from that edge, what should happen is a blue line should extend from the box to the mouse. However, it doesn't.

Furthermore, the endpoint of the blue line (which should be the mouse) is somehow related to the numbered box on the right in the middle. If you drag that box around, you'll see the behavior I mentioned above change.

Here's the bit of code that draws that line:


neatGlobals.vars.moduleA.preConn.graphics.clear();
neatGlobals.vars.moduleA.preConn.graphics.lineStyl e(1,0x0077aa);
neatGlobals.vars.moduleA.preConn.graphics.moveTo(m od.x+mod.width, mod.y + (mod.height/2));
neatGlobals.vars.moduleA.preConn.graphics.lineTo(m ouseX, mouseY);

creatify
March 15th, 2009, 09:21 PM
it appears to be a scope issue - your mouseX and mouseY positions are based on the "timeline" that your code above is placed upon. This probably isn't correct, I'm not sure how everything is set up in your display list, but maybe you'll get the idea:

try:


neatGlobals.vars.moduleA.preConn.graphics.lineTo(m od.mouseX, mod.mouseY);


or maybe use the parent of mod - if it's a Sprite, then something like:


neatGlobals.vars.moduleA.preConn.graphics.lineTo(S prite(mod.parent).mouseX, Sprite(mod.parent).mouseY);

sam.baker
March 15th, 2009, 10:02 PM
http://sambaker.net/neattools/source/neattools23.swf

next try. This is what I get with your suggestions. Interestingly, both of your suggestions produce the same result. Again they all seem to reference that box on the right middle. I can only imagine that that's because it was the last one created.

A little more info: All the boxes are of the parent type "Module". there are LEDs, Buttons, Switches, Integers, and the Math ones. They all extend the Module class (which extends Sprite).

It is in side the Module class that the code appears to handle the line drawing. The frustrating part is that the logical connections are working just not the graphical connections. If you hook up the button (top left) to the LED (top right) the button controls the LED.