RE: [Flashcoders] stopDrag question
function compareX():Void { if (MC_Drag._x == mc2._x) { endDrag(); } } function beginDrag():Void { MC_Drag.startDrag(false, t, l, b, r); clearInterval(compareInterval); compareInterval = setInterval(this, "compareX", 10); } function endDrag():Void { clearInterval(compareInterval): stopDrag(); } MC_Drag.onPress = Delegate.create(this, beginDrag); MC_Drag.onRelease = Delegate.create(this, endDrag); ___ 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] stopDrag question
Thanks doctor, I'm going to try this, but a question, why don't use :Number? Someone told me that this might be necessary to use numeric values for x. is that right? this.onRelease = function() { this._parent.MC2.startDrag(true); } this.onEnterFrame = function() { var mc1X: Number = this._x; var mc2X:Number = _parent.MC2._x; if ( (Math.abs(mc1X - mc2X)) <= 0.5)) { _parent.mc2.stopDrag(); } } On Mar 19, 2007, at 10:17 AM, dr.ache wrote: you compare the _x values of the mcs only once when you release mc1. when you want to check it while dragging you have to use onEnterFrame. by the way: as likely as not you will not drag your second mc exactly on the _x value of your first mc, so you should use an proximation (a region around that _x value) example(adopting your hierarchical order of mcs): [AS] this.onRelease = function() { this._parent.MC2.startDrag(true); } this.onEnterFrame = function() { var mc1X = this._x; var mc2X = _parent.MC2._x; if ( (Math.abs(mc1X - mc2X)) <= 0.5)) { _parent.mc2.stopDrag(); } } [/AS] Questions ? dr.ache Gustavo Duenas schrieb: Hi, I'm trying to stop the drag of a movie click when its x value equals the x value of other movie clip. The code is in the other object not in the drag-object. stop(); var movieClip1Pos: Number = this._x; var movieClip2Pos: Number = this._parent.MC2._x; ///here start the drag. this.OnRelease = function(){ this._parent.MC2.startDrag(true); this.control(); } var control = function(){ if( movieClip1Pos == movieClip2Pos){ this._parent.MC2.stopDrag(); } } so far it doesn't work, but I don't know why? looks good in paper but when I'm trying to use it on the flash I don't get it... the code is in the frame one of the movieClip MC1. I hope you guys can help me out. Gustavo Duenas ___ 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 Gustavo Duenas Creative Director LEFT AND RIGHT SOLUTIONS LLC 1225 w. Beaver St. suite 119 Jacksonville, FL 32204 904 . 2650330 www.leftandrightsolutions.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] stopDrag question
your function control, just run 1 time, only when you release, you should put it on the mc.onEnterFrame, or start an interval when you startdrag it --Pedro Taranto Gustavo Duenas escreveu: Hi, I'm trying to stop the drag of a movie click when its x value equals the x value of other movie clip. The code is in the other object not in the drag-object. stop(); var movieClip1Pos: Number = this._x; var movieClip2Pos: Number = this._parent.MC2._x; ///here start the drag. this.OnRelease = function(){ this._parent.MC2.startDrag(true); this.control(); } var control = function(){ if( movieClip1Pos == movieClip2Pos){ this._parent.MC2.stopDrag(); } } so far it doesn't work, but I don't know why? looks good in paper but when I'm trying to use it on the flash I don't get it... the code is in the frame one of the movieClip MC1. I hope you guys can help me out. Gustavo Duenas ___ 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] stopDrag question
you compare the _x values of the mcs only once when you release mc1. when you want to check it while dragging you have to use onEnterFrame. by the way: as likely as not you will not drag your second mc exactly on the _x value of your first mc, so you should use an proximation (a region around that _x value) example(adopting your hierarchical order of mcs): [AS] this.onRelease = function() { this._parent.MC2.startDrag(true); } this.onEnterFrame = function() { var mc1X = this._x; var mc2X = _parent.MC2._x; if ( (Math.abs(mc1X - mc2X)) <= 0.5)) { _parent.mc2.stopDrag(); } } [/AS] Questions ? dr.ache Gustavo Duenas schrieb: Hi, I'm trying to stop the drag of a movie click when its x value equals the x value of other movie clip. The code is in the other object not in the drag-object. stop(); var movieClip1Pos: Number = this._x; var movieClip2Pos: Number = this._parent.MC2._x; ///here start the drag. this.OnRelease = function(){ this._parent.MC2.startDrag(true); this.control(); } var control = function(){ if( movieClip1Pos == movieClip2Pos){ this._parent.MC2.stopDrag(); } } so far it doesn't work, but I don't know why? looks good in paper but when I'm trying to use it on the flash I don't get it... the code is in the frame one of the movieClip MC1. I hope you guys can help me out. Gustavo Duenas ___ 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] stopDrag question
Hi, I'm trying to stop the drag of a movie click when its x value equals the x value of other movie clip. The code is in the other object not in the drag-object. stop(); var movieClip1Pos: Number = this._x; var movieClip2Pos: Number = this._parent.MC2._x; ///here start the drag. this.OnRelease = function(){ this._parent.MC2.startDrag(true); this.control(); } var control = function(){ if( movieClip1Pos == movieClip2Pos){ this._parent.MC2.stopDrag(); } } so far it doesn't work, but I don't know why? looks good in paper but when I'm trying to use it on the flash I don't get it... the code is in the frame one of the movieClip MC1. I hope you guys can help me out. Gustavo Duenas ___ 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