Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
Came up with something similar, expect that I don't use Mouse.addListener() / removeListener() as movieclips have mouse events by default. That way you get rid of seperate listener object -- var mouseDragListener:Object = new Object(); Guess it's personal preference.. both work fine. import mx.utils.Delegate; var drag_mc:MovieClip = this.mcTruckScrubber.mcDragControl; // mousemove event handler function mouseMoveHandler() { this.asdf.text = Math.floor(this.drag_mc._x); } // // control press event handler function dragControlPressHandler() { this.drag_mc.startDrag(false, 0, 0, 300, 0); this.onMouseMove = this.mouseMoveHandler; } // // control release event handler function dragControlReleaseHandler() { this.drag_mc.stopDrag(); // manually call mousemove event to have one more update this.mouseMoveHandler(); this.onMouseMove = undefined; } // this.drag_mc.onPress = Delegate.create(this, this.dragControlPressHandler); this.drag_mc.onRelease = this.drag_mc.onReleaseOutside=Delegate.create(this, this.dragControlReleaseHandler); regards, Muzak - Original Message - From: Alain Rousseau [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Thursday, March 01, 2007 4:34 AM Subject: Re: [Flashcoders] Dragging a clip gives erratic ._x numbers Hi Paul, checked your files and indeed the position was wrong if you dragged and droped too fast. I made a simple fix to your code and now it works nicely. In your onRelease function you should grab the final position of your mc. Here is the code with a bit of cleaning up and use of Delegate to be sure the scope is respected : import mx.utils.Delegate; var mouseDragListener:Object = new Object(); var mcDrag:MovieClip = mcTruckScrubber.mcDragControl; // make a reference to the draggable mc for easier typing // This will be used when the drag/scrubber control is moved mouseDragListener.onMouseMove = Delegate.create(this, setText); function setText() { asdf.text = Math.ceil(this.mcDrag._x); }; // Watch for mouse down on the scrubber control (the little vehicle icon) this.mcDrag.onPress = Delegate.create(this, dragMC); // When the user releases the mouse button outside the drag control area, treat it like a normal release: this.mcDrag.onReleaseOutside = this.mcDrag.onRelease = Delegate.create(this, stopDragMC); function dragMC(){ mcDrag.startDrag(false,0, 0, 300, 0); // Start watching the mouse and do what the listener says: Mouse.addListener(mouseDragListener); }; function stopDragMC(){ mcDrag.stopDrag(); asdf.text = Math.ceil(this.mcDrag._x);// grab the final position of the mc Mouse.removeListener(mouseDragListener); // this stops listening to mouse move goodies }; enjoy ! Alain Paul Hoza wrote: Thanks for the reply... I tried what you're suggesting and still see the problem. I decided to make a quick example to see if anyone can see a problem in what I'm doing (and a demonstration of said funkiness.) This is out of context, so I think it's working okay as a demo. The code is included in case it sheds any light... the sample is pulled right out of my app, so it's the same controller I'm using (out of context, so there were tweaks to get it working standalone.) http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.html Code: http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.zip Thanks for any more insights! Paul Mick G wrote: Perhaps it's doing some rounding because your mouse is sitting on half pixels and it's not noticeable to the eye (if that's even possible). Have you tried putting a Math.ceil around the _x values to see if it helps always round the value up? On 2/28/07, David Cohn [EMAIL PROTECTED] wrote: Paul, I know it's no help, but I recently ran into this also and never found a workaround... I'd love to know if you find one! --Dave Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional
[Flashcoders] Dragging a clip gives erratic ._x numbers
Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional drag behavior to be roughly impossible! I'm miffed, but hopefully somebody has a clue on this and would be so kind as to throw down some helpful bits. Thanks! Paul Hoza ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
Paul, I know it's no help, but I recently ran into this also and never found a workaround... I'd love to know if you find one! --Dave Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional drag behavior to be roughly impossible! I'm miffed, but hopefully somebody has a clue on this and would be so kind as to throw down some helpful bits. Thanks! Paul Hoza ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
Perhaps it's doing some rounding because your mouse is sitting on half pixels and it's not noticeable to the eye (if that's even possible). Have you tried putting a Math.ceil around the _x values to see if it helps always round the value up? On 2/28/07, David Cohn [EMAIL PROTECTED] wrote: Paul, I know it's no help, but I recently ran into this also and never found a workaround... I'd love to know if you find one! --Dave Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional drag behavior to be roughly impossible! I'm miffed, but hopefully somebody has a clue on this and would be so kind as to throw down some helpful bits. Thanks! Paul Hoza ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
Thanks for the reply... I tried what you're suggesting and still see the problem. I decided to make a quick example to see if anyone can see a problem in what I'm doing (and a demonstration of said funkiness.) This is out of context, so I think it's working okay as a demo. The code is included in case it sheds any light... the sample is pulled right out of my app, so it's the same controller I'm using (out of context, so there were tweaks to get it working standalone.) http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.html Code: http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.zip Thanks for any more insights! Paul Mick G wrote: Perhaps it's doing some rounding because your mouse is sitting on half pixels and it's not noticeable to the eye (if that's even possible). Have you tried putting a Math.ceil around the _x values to see if it helps always round the value up? On 2/28/07, David Cohn [EMAIL PROTECTED] wrote: Paul, I know it's no help, but I recently ran into this also and never found a workaround... I'd love to know if you find one! --Dave Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional drag behavior to be roughly impossible! I'm miffed, but hopefully somebody has a clue on this and would be so kind as to throw down some helpful bits. Thanks! Paul Hoza ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
Hi Paul, checked your files and indeed the position was wrong if you dragged and droped too fast. I made a simple fix to your code and now it works nicely. In your onRelease function you should grab the final position of your mc. Here is the code with a bit of cleaning up and use of Delegate to be sure the scope is respected : import mx.utils.Delegate; var mouseDragListener:Object = new Object(); var mcDrag:MovieClip = mcTruckScrubber.mcDragControl; // make a reference to the draggable mc for easier typing // This will be used when the drag/scrubber control is moved mouseDragListener.onMouseMove = Delegate.create(this, setText); function setText() { asdf.text = Math.ceil(this.mcDrag._x); }; // Watch for mouse down on the scrubber control (the little vehicle icon) this.mcDrag.onPress = Delegate.create(this, dragMC); // When the user releases the mouse button outside the drag control area, treat it like a normal release: this.mcDrag.onReleaseOutside = this.mcDrag.onRelease = Delegate.create(this, stopDragMC); function dragMC(){ mcDrag.startDrag(false,0, 0, 300, 0); // Start watching the mouse and do what the listener says: Mouse.addListener(mouseDragListener); }; function stopDragMC(){ mcDrag.stopDrag(); asdf.text = Math.ceil(this.mcDrag._x);// grab the final position of the mc Mouse.removeListener(mouseDragListener); // this stops listening to mouse move goodies }; enjoy ! Alain Paul Hoza wrote: Thanks for the reply... I tried what you're suggesting and still see the problem. I decided to make a quick example to see if anyone can see a problem in what I'm doing (and a demonstration of said funkiness.) This is out of context, so I think it's working okay as a demo. The code is included in case it sheds any light... the sample is pulled right out of my app, so it's the same controller I'm using (out of context, so there were tweaks to get it working standalone.) http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.html Code: http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.zip Thanks for any more insights! Paul Mick G wrote: Perhaps it's doing some rounding because your mouse is sitting on half pixels and it's not noticeable to the eye (if that's even possible). Have you tried putting a Math.ceil around the _x values to see if it helps always round the value up? On 2/28/07, David Cohn [EMAIL PROTECTED] wrote: Paul, I know it's no help, but I recently ran into this also and never found a workaround... I'd love to know if you find one! --Dave Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional drag behavior to be roughly impossible! I'm miffed, but hopefully somebody has a clue on this and would be so kind as to throw down some helpful bits. Thanks! Paul Hoza ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive:
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
this seems to be tied to using a mouse listener. onMouseMove is not synchronous with the frame rate, so it can fire more than once in between framesthat being said, it still doesnt make sense that the _x seemingly increases if you drag left. if you use good ole onEnterFrame, everything works fine. On 2/28/07, Paul Hoza [EMAIL PROTECTED] wrote: Thanks for the reply... I tried what you're suggesting and still see the problem. I decided to make a quick example to see if anyone can see a problem in what I'm doing (and a demonstration of said funkiness.) This is out of context, so I think it's working okay as a demo. The code is included in case it sheds any light... the sample is pulled right out of my app, so it's the same controller I'm using (out of context, so there were tweaks to get it working standalone.) http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.html Code: http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.zip Thanks for any more insights! Paul Mick G wrote: Perhaps it's doing some rounding because your mouse is sitting on half pixels and it's not noticeable to the eye (if that's even possible). Have you tried putting a Math.ceil around the _x values to see if it helps always round the value up? On 2/28/07, David Cohn [EMAIL PROTECTED] wrote: Paul, I know it's no help, but I recently ran into this also and never found a workaround... I'd love to know if you find one! --Dave Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional drag behavior to be roughly impossible! I'm miffed, but hopefully somebody has a clue on this and would be so kind as to throw down some helpful bits. Thanks! Paul Hoza ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- John Van Horn [EMAIL PROTECTED] ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
onEnterFrame didn't give any better results either, it was definitely a case of how fast can Flash grab the exact _x postion when the button is released and the listener removed (or onEnterFrame deleted). Can't quite understand the logic of the sequence or timing, but it's definitely a case of asynchronous function call. John VanHorn wrote: this seems to be tied to using a mouse listener. onMouseMove is not synchronous with the frame rate, so it can fire more than once in between framesthat being said, it still doesnt make sense that the _x seemingly increases if you drag left. if you use good ole onEnterFrame, everything works fine. On 2/28/07, Paul Hoza [EMAIL PROTECTED] wrote: Thanks for the reply... I tried what you're suggesting and still see the problem. I decided to make a quick example to see if anyone can see a problem in what I'm doing (and a demonstration of said funkiness.) This is out of context, so I think it's working okay as a demo. The code is included in case it sheds any light... the sample is pulled right out of my app, so it's the same controller I'm using (out of context, so there were tweaks to get it working standalone.) http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.html Code: http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.zip Thanks for any more insights! Paul Mick G wrote: Perhaps it's doing some rounding because your mouse is sitting on half pixels and it's not noticeable to the eye (if that's even possible). Have you tried putting a Math.ceil around the _x values to see if it helps always round the value up? On 2/28/07, David Cohn [EMAIL PROTECTED] wrote: Paul, I know it's no help, but I recently ran into this also and never found a workaround... I'd love to know if you find one! --Dave Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional drag behavior to be roughly impossible! I'm miffed, but hopefully somebody has a clue on this and would be so kind as to throw down some helpful bits. Thanks! Paul Hoza ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
here, i set the frame rate to 1, and tried to move the mouse 1 px persecond. i added traces for everything on both enterframe and mousemove events. you can start to see the asychronicity between setting the text and redrawing the stage: onEnterFrame mc._x: 3.45 _xmouse: 149 text: 4 onMouseMove mc._x: 3.45 _xmouse: 150 text: 4 onEnterFrame mc._x: 4.45 _xmouse: 150 text: 4 onEnterFrame mc._x: 4.45 _xmouse: 150 text: 4 onMouseMove mc._x: 4.45 _xmouse: 149 text: 5 onEnterFrame mc._x: 3.45 _xmouse: 149 text: 5 On 2/28/07, Alain Rousseau [EMAIL PROTECTED] wrote: onEnterFrame didn't give any better results either, it was definitely a case of how fast can Flash grab the exact _x postion when the button is released and the listener removed (or onEnterFrame deleted). Can't quite understand the logic of the sequence or timing, but it's definitely a case of asynchronous function call. John VanHorn wrote: this seems to be tied to using a mouse listener. onMouseMove is not synchronous with the frame rate, so it can fire more than once in between framesthat being said, it still doesnt make sense that the _x seemingly increases if you drag left. if you use good ole onEnterFrame, everything works fine. On 2/28/07, Paul Hoza [EMAIL PROTECTED] wrote: Thanks for the reply... I tried what you're suggesting and still see the problem. I decided to make a quick example to see if anyone can see a problem in what I'm doing (and a demonstration of said funkiness.) This is out of context, so I think it's working okay as a demo. The code is included in case it sheds any light... the sample is pulled right out of my app, so it's the same controller I'm using (out of context, so there were tweaks to get it working standalone.) http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.html Code: http://www.gamedevschool.com/samples/flashcoders/dragproblems/dragproblems.zip Thanks for any more insights! Paul Mick G wrote: Perhaps it's doing some rounding because your mouse is sitting on half pixels and it's not noticeable to the eye (if that's even possible). Have you tried putting a Math.ceil around the _x values to see if it helps always round the value up? On 2/28/07, David Cohn [EMAIL PROTECTED] wrote: Paul, I know it's no help, but I recently ran into this also and never found a workaround... I'd love to know if you find one! --Dave Heya folks, This is baffling me (and making me very annoyed), and I haven't found an answer elsewhere, so here goes... I have a main movie with a custom drag scrubber control. At the core of my app (Flash 8 Pro) is this scrubber that needs to simply return its position so I can use it to display the proper frame of a movie clip (with many frames). Problem is that dragging the scrubber in one direction very slowly will frequently get erratic and NOT just increase or decrease relevant to the drag direction. Now, I originally thought it could be poor rounding math code on my part, but I finally put a text counter on the screen that simply displays the value of mcTheMovieClip._x which is the dragged clip. Here's what I mean by erratic: Dragging from left to right, ._x reports: ..101, 102, 101, 102, 103, 104, .. What the friggin' poo?? What exactly causes a dragged movie clip to jump back/forth a pixel or two? It's making an accurate, consistently one-directional drag behavior to be roughly impossible! I'm miffed, but hopefully somebody has a clue on this and would be so kind as to throw down some helpful bits. Thanks! Paul Hoza ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive:
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
Alain Rousseau wrote: checked your files and indeed the position was wrong if you dragged and droped too fast. I made a simple fix to your code and now it works nicely... Suhweeet... thanks a ton! That's very interesting. I'm much further towards the side of Flash Novice, but this bugger was really getting to me. Thanks also for pointing out Delegate.. another thing I'm realizing I should have implemented on another project. I recall a major problem I was having with scoping on another project and I'm going to have to revisit it using Delegate goodies. Nice. I really appreciate the time. I had stripped out a bunch of other code for this demo, so I'll roll this stuff into my main project and move on to the next bit of puzzlement. :) Regards, Paul ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Dragging a clip gives erratic ._x numbers
Wacky. Thanks for looking further into this. It's helping to understand the issues, for sure... not to say that I'm fully aware of what to do with this knowledge so far, but thanks. :) Paul John VanHorn wrote: here, i set the frame rate to 1, and tried to move the mouse 1 px persecond. i added traces for everything on both enterframe and mousemove events. you can start to see the asychronicity between setting the text and redrawing the stage: onEnterFrame mc._x: 3.45 _xmouse: 149 text: 4 onMouseMove mc._x: 3.45 _xmouse: 150 text: 4 onEnterFrame mc._x: 4.45 _xmouse: 150 text: 4 onEnterFrame mc._x: 4.45 _xmouse: 150 text: 4 onMouseMove mc._x: 4.45 _xmouse: 149 text: 5 onEnterFrame mc._x: 3.45 _xmouse: 149 text: 5 On 2/28/07, Alain Rousseau [EMAIL PROTECTED] wrote: onEnterFrame didn't give any better results either, it was definitely a case of how fast can Flash grab the exact _x postion when the button is released and the listener removed (or onEnterFrame deleted). Can't quite understand the logic of the sequence or timing, but it's definitely a case of asynchronous function call. John VanHorn wrote: this seems to be tied to using a mouse listener. onMouseMove is not synchronous with the frame rate, so it can fire more than once in between framesthat being said, it still doesnt make sense that the _x seemingly increases if you drag left. if you use good ole onEnterFrame, everything works fine. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com