StopDrag?
here's the deal. i have a nav menu inside an mc. in the nav, i want something to follow the mouse. right now, i have a box that basically hovers over the nav choices. makeing an invisible button inside the nav mc, i can use startDrag on rollover to get the slider moving. unfortunately once that happens, it never leaves the mouse alone. it still stays within the bounds of the rectangle i defined (the nav mc), but i cannot get it to stop when i rollout. how can i get this? is there a better way? i know i've seen this done before, and think i've even seen a tutorial on it, but can't find it now.
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-22-2003, 07:15 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Stopdrag
Hi I have loaded a movie pan.swf and Its
movieheight = 250;
moviewidth = 450;
I have a startdrag and this works
but now I want it to STOP when its outside the movie..
can anyone help
:-) PAUK
STOPdrag
HI all
This movie loads an panorama
http://www.pauk.dk/pano/pan_svaneke_start.html
and the panorama-movie has an startdrag and moviesize
startDrag("", true);
movieheight = 250;
moviewidth = 450;
but since its loaded into a bigger movie I want the movie to STOPDRAG when you leave the panwindow/movie
anyone have an Idea ?
:-) PAUK
Stopdrag
I am working in Flash MX and have a problem with a movie clip containing a navigation palette. The file is being called in by a loadmovie function and allows the palette to be draggable and acts as a smaller view for scrolling the background image around a restricted area nested within the main swf file.
The problem I am having is that although the user can move the background around alright by moving the square on the navigation palette when you go to drag the whole palette to a new location on top of the background the movie rreturns to the very begginning of the main timeline. I think it must be soething to do with the nesting of movies but can't quite work it out, here is the code I have for the navigation palette -
on (press) {
startDrag("");
}
on (release) {
stopDrag();
tellTarget ("/") {
gotoAndPlay("nodockloop");
}
}
File attached - pretty big due to jpeg
Hope this makes some sense and somebody can help me out soon.
Cheers
Jamie Newbury
StopDrag()
I have
code:
if(_parent._currentframe>74){
if( _parent._ymouse > 40 && _parent._ymouse < 271 && _parent._xmouse > 25 && _parent._xmouse < 260){
startDrag(_parent.arrows, true);
Mouse.hide();
}else{
_parent.arrows.stopDrag()
_parent.arrows.ease(144,75,6);
Mouse.show();
}
}
}
This is not where my problem is...
i have a scroll bar over to the right and the drag on the bar will not work if there is a drag in this code....
I dont really understand, cause I have a direct path for the stopDrag(), but it is still causeing the scroll bars drag not to work.....
That is my problem.....
HELP !
Help On StopDrag()
hi im trying to recreate this to learn more on flash
http://www.funny-games.biz/external/traffic-jam.html
so far here is what i have right now...
but i dont know how to make them stopDrag when there is another movie clip in front of it..
can someone help me with this??
thanks
StopDrag
Is there any way to make Flash more lenient on its drag stopping?
Right now I have a scroller that, while it works fine, if you keep on pressing and go off of the scroller then release, it will continue to drag. Is there anyway to make it so that when you release the mouse button ANYWHERE at all it will stop the drag?
Also, for some reason, when you release the drag on this scroller, the cursor goes in to a perpetual state of the hand icon and, if you zoom in, you can't move around the screen to change what you're zooming in on. That doesn't really matter, it's just kind of weird. Is there any way to fix that?
Mc.startdrag / Mc.stopdrag HELP
Ola ola...
I tried :
on (rollOver) {
target_item.startDrag([true, 720, 720, 48, 483]);
}
on (rollOut) {
target_item.stopDrag();
}
but target_item follows my cursor...
WHY and how to fix it ?
Thanks and have fun...
remrem.
StopDrag() Question
I'm trying to build a drag and drop menu. However, it seems to me that I'm doing something wrong with stopDrag(), because well, dragging is not stopping.
I have the following in a movie clip.
onClipEvent(mouseUp) {
stopDrag();
}
For some reason, that isn't working.
Any help is greatly appreciated.
Startdrag & Stopdrag.
Hi.
Is it possible to f.ex. set some kind of an border around a movie, so when the user drags a "window" it's not possible to drag the "window" outside of the movie ?
It could maybe be, with the help of actions scripts.. but I can't find either the method or propertie.. for this..
Can anyone please help me ?
I'm really looking forward to hear from you.
Best regards
Raz
StopDrag On Mouse Out ?
I want to make a "stopDrag", when my mouse is out of reach of the movie. Every time I start drag the movie-clip, and I'm letting the mouse go up out of reach of the scene, the movie thinks the mouse is still up:
onClipEvent (mouseDown) {
startDrag("_root.mctotaal", false, 875, 558, -416, -287);
}
onClipEvent (mouseUp) {
stopDrag();
}
Then something has to follow like:
onClipEvent (mouseOut) {
stopDrag();
But this isn't possible in ActionScript
Thanks for answering,
Maaike
Netherlands
StartDrag + StopDrag
Im having a little porblem. I have a code to start and stop drag on different movie clips. Its all the same code, but different movie clips. The problem is when I test the movie, i can only drag one of the movie clips. And its always one specific one...I dont understand.
Why Won't StopDrag Work
This stop drag is not working, but if i change the line startDrag(this,true,0,0,100,0); to this.startDrag(); it works fine. What gives?
this.mcScrubber.onPress = function(){
startDrag(this,true,0,0,100,0);
this.onRelease = function(){
this.stopDrag();
trace("TEST");
}
}
Non-square MC For StopDrag()
I am trying to develop a drag and drop system that has dynamic 'dropzones'(moveTo() & lineTo()). These dropzones need to initate a function if the dragging object is dropped on. However, I need these dropzones to be rhombuses, not squares.
It appears that _droptarget and hitTest() use the square(x,y,height,width) of my dropzones making them bigger than they are suppose to.
Is there a mathematical way to determine whether or not the draggable object was dropped onto the rhombus hotspot?
StopDrag(); Problems
hello i am creating a dragable menu. I'm trying to have the top of the menu , ex. where it would say "drag here", to move six different movie links. heres the code if you can tell me whats wrong with it that would be a great help, thanks. ( by the way there is no line break after startDrag in the real action script, it does that only in the forum)
on(press)
{
startDrag("drag", "1", "2", "3", "4", "5", "6", "home", "gallery", "faqs", "contact", "about");
}
StopDrag Not Working..how Come?
I've got a clip that runs a drag function when a 'zoom in' button is pressed. that all works well and when the image zooms in, i can click and drag it all around. Now, when i click the 'zoom out' button, i want to turn off the drag function but i can't seem to figure out how. The function is defined in a frame on the main timeline:
Code:
function dragMe(target_mc) {
target_mc.onPress = function() {
this.startDrag(false, -60, -40, 440, 400);
};
target_mc.onRelease = function() {
this.stopDrag();
}
}
and the 'zoom in' button initiates the function:
Code:
on (release) {
_root.map_mc.scaleTo(200,0.5);
_root.dragMe(_root.map_mc);
}
So, on the 'zoom out' button, i want to cancel the drag function. So I've got:
Code:
on (release) {
_root.map_mc.scaleTo(100,0.5);
_root.map_mc.slideTo(249,264, 0.5);
_root.map_mc.stopDrag();
}
but the stopDrag(); doesn't seem to affect the movieclip. i can still drag it all around after i press the button. what am i missing?
Problem With StopDrag;
how can i make stopDrag command work? Where ever i add it, it won't work.Still drags it forever. Myby multiple values would help, but i don't know how to add them. Any ideas how to get this thing work?
code: this.ratio = 0;
dragger.onPress = function() {
this.startDrag(true, 0, 0, line._width, 0);
this.onEnterFrame = function() {
ratio = Math.round(this._x*100/line._width);
uus_interval = ratio*100;
};
};
dragger.onRelease = dragger.onReleaseOutside = function() {
ratio = Math.round(this._x*100/line._width);
uus_interval = ratio*100;
_root.interval = setInterval(_root.uuenda, uus_interval);
}
StopDrag-problem: Help
I have this mc with this drag-function. I want it to duplicate only when the mc is dropped on the mc"bordet.yta" but now it´s duplicating by just clicking on it.
what could be the problem?
-------
_root.pizza.onPress = function(){
startDrag("pizza",false,35,30,400,220);
}
_root.pizza.onRelease=function(){
this.stopDrag();
if(this._droptarget != "/bordet.ytan") {
pizza.duplicateMovieClip("pizza2",0);
setProperty("_root.pizza2",_x, 80);
setProperty("_root.pizza2",_y, 100);
setProperty("_root.pizza",_visible, false);
_root.bra++;
s = new Sound();
s.attachSound("mat");
s.start();
}
}
-----
HitTest & StopDrag
hi i wrote this simple code
Code:
stop();
square_mc.onEnterFrame=function(){
startDrag(this,true,32,32,268,268);
for(var i:Number = 1; i<=4; i++){
if (this.hitTest(this._root["bar"+i+"_mc"]))
stopDrag();
}
}
basically what it does is.. i have this square movie clip that is draggable.
upon hitting another movie clip in this case movie clips named bar1_mc, bar2_mc, etc. it suppose to stopDrag();
the code is working.. but no 100% of the time. There are times when it touches the very edge that the stopDrag doesnt execute. Is there an alternative in doing this?
I want the movie clip to stopDrag upon hitting the other movieclip 100% of the time. Is this a flash limitation?
thanks..
[F8] _rotation And StopDrag
I have a long rectangle (long horizontally) that, when clicked, rotates 90 degrees. All the code in the onRelease worked fine until i put the _rotation line in the onPress event. Now my hit test and stopdrag dont work.
Whats up with that?
My Code:
Code:
ath_pt_mc.onPress=function(){
this.startDrag();
this._rotation += 90;
}
ath_pt_mc.onRelease=function(){
stopDrag();
if(this.hitTest(ath_part_target_mc)){
this._visible = false;
bar_ath_pt_increment_mc.gotoAndPlay("c1");
}else{
this._x = 40;
this._y = 91;
}
}
Thanks!
StopDrag Not Stopping
Hullo. I've got a problem that's really driving me nuts. I have a slider that controls the playback through a number of frames in a movie clip, but the stopDrag function isn't stopping. The actionscript I use for the dragger is this:
on (press) {
startDrag(this, true, 35, 35, 335,35);
}
on (release) {
stopDrag();
}
The numbers constrain the movement of the dragger. If anyone's got a solution I'd be deeply indebted. You can view the flash at www.kaptivate.com/globe/bottom.html. Thanks!
Mike
Sound On StopDrag
what i want to do is play a sound on dropping the target and play that sounds with multiple movie clips.
example: start dragging movieclip A and play sound A when I drop it and also play sound A when I drag and drop movieclip B.
StopDrag Problem
Have a problem with some code, or perhaps the overall method of how I'm doing this.
I have a map loaded up with a green background that is a button. This allows me to drag the map around within a masked area of my overall map display.
It works good if you click, drag and let off, within that masked area. But if the user clicks, and drags outside of the masked area, the map stays locked to the mouse and is dragged around even after they left off, unless they move the mouse back into the masked viewable area and click it off.
how can I fix this so that it functions properly? I think the best would be to have it drop the map when you drag outside the masked viewable area....
http://wwwdev.selu.edu/test/dakota/
Code:
_root.mainMap.mainMap.drag_button.onRollOver = function () {
_root.hand_cursor._visible = true;
_root.hand_cursor.gotoAndStop(1);
Mouse.hide();
}
_root.mainMap.mainMap.drag_button.onRollOut = function () {
Mouse.show();
_root.hand_cursor._visible = false;
_root.mainMap.stopDrag();
_root.hand_cursor.gotoAndStop(1);
}
_root.mainMap.mainMap.drag_button.onPress = function () {
_root.mainMap.startDrag();
_root.hand_cursor.gotoAndStop(2);
}
_root.mainMap.mainMap.drag_button.onRelease = function () {
_root.mainMap.stopDrag();
_root.hand_cursor.gotoAndStop(1);
}
_root.mainMap.mainMap.drag_button.releaseOutside = function () {
_root.mainMap.stopDrag();
_root.hand_cursor.gotoAndStop(1);
}
_root.mainMap.mainMap.drag_button.dragOut = function () {
_root.mainMap.stopDrag();
_root.hand_cursor.gotoAndStop(1);
}
StopDrag Problem
Hi,
This is my simple code:
Code:
mc1.addEventListener(MouseEvent.MOUSE_DOWN,startToDrag);
mc1.addEventListener(MouseEvent.MOUSE_UP,stopDragging);
function startToDrag(e:Event):void {
mc1.startDrag();
}
function stopDragging(e:Event):void {
mc1.stopDrag();
}
If there is another movieclip (in this example called mc2) ontop the mc1 on a higher level (between the mouse and mc1) when I reslease it the stopDrag will not work. The mc1 will drag until I move it outside of mc2, then it will release.
I could place the mc1 on a higher level (above mc2) as soon as I start dragging it but I do not want to do that. I allways want the mc2 to be ontop of everything else on the highest level. But I also want to be able to drag mc1 and drop it under mc2.
Is there a way to avoid mc2 interfering with the dragging of mc1?
Start And StopDrag
I have a movie clip that I want to be able to drag but once it hits a defined barrier it won't go past it. I got that part down. My problem is if I hold the mouse button down past the barrier and I let go of the mouse button and move the mouse back over the movie clip will stay attached to the mouse. How do I fix this?
Here's the code I'm using:
a_mc.onPress = function() {
a_mc.startDrag(false,619,245,725,380);
};
a_mc.onRelease = function() {
a_mc.stopDrag();
};
Thanks alot!
UseHandCursor And StopDrag
Hope this is an easy one, I have an mc which is moveable (startDrag) and a mouse listener that detects if _xmouse has passes a certain co-ordinate, if it does then I tell the mc to stopDrag. Part of the moveable mc can extend beyond that point and If the user continues to drag the hand cursor persists despite me asking otherwise, even tried to delete the onPress event.
Thanks
Mikeb
Attach Code
var isMoving:Boolean = false;
target_Mc.onPress = function() {
this.startDrag();
};
target_Mc.onRelease = function() {
this.stopDrag();
};
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
isMoving = true;
};
mouseListener.onMouseMove = function() {
if (isMoving == true && _xmouse>=370) {
//delete target_Mc.onPress;
target_Mc.stopDrag();
target_Mc.useHandCursor = false; //this doesn't work until the cursor is dragged out of target_Mc
updateAfterEvent();
}
};
Mouse.addListener(mouseListener);
StopDrag When It Reaches The End Of Another MC
Ok I am having some really big problems with this. For some reason I cant get this to work for me :S. If some one can help me with it, it would be great.
This is what I tried
on (press){
if (_root.MCSmallMenu.hitTest(_root.background1, true)){
_root.MCSmallMenu.startDrag;
}else{
stopDrag();
}
Can someone tell me what I have done wrong?? I only want MCSmallMenu to drag inside background1. :S I know its only easy but for some reason my head is not working around it at all.
Problem With StopDrag;
how can i make stopDrag command work? Where ever i add it, it won't work.Still drags it forever. Myby multiple values would help, but i don't know how to add them. Any ideas how to get this thing work?
ActionScript Code:
this.ratio = 0;dragger.onPress = function() { this.startDrag(true, 0, 0, line._width, 0); this.onEnterFrame = function() { ratio = Math.round(this._x*100/line._width); uus_interval = ratio*100; }; };dragger.onRelease = dragger.onReleaseOutside = function() { ratio = Math.round(this._x*100/line._width); uus_interval = ratio*100; _root.interval = setInterval(_root.uuenda, uus_interval); }
StopDrag When It Reaches The End Of Another MC
Ok I am having some really big problems with this. For some reason I cant get this to work for me :S. If some one can help me with it, it would be great.
This is what I tried
on (press){
if (_root.MCSmallMenu.hitTest(_root.background1, true)){
_root.MCSmallMenu.startDrag;
}else{
stopDrag();
}
Can someone tell me what I have done wrong?? I only want MCSmallMenu to drag inside background1. :S I know its only easy but for some reason my head is not working around it at all.
Non-square MC For StopDrag()
I am trying to develop a drag and drop system that has dynamic 'dropzones'(moveTo() & lineTo()). These dropzones need to initate a function if the dragging object is dropped on. However, I need these dropzones to be rhombuses, not squares.
It appears that _droptarget and hitTest() use the square(x,y,height,width) of my dropzones making them bigger than they are suppose to.
Is there a mathematical way to determine whether or not the draggable object was dropped onto the rhombus hotspot?
Problem With StopDrag;
how can i make stopDrag command work? Where ever i add it, it won't work.Still drags it forever. Myby multiple values would help, but i don't know how to add them. Any ideas how to get this thing work?
ActionScript Code:
this.ratio = 0;
dragger.onPress = function() {
this.startDrag(true, 0, 0, line._width, 0);
this.onEnterFrame = function() {
ratio = Math.round(this._x*100/line._width);
uus_interval = ratio*100;
};
};
dragger.onRelease = dragger.onReleaseOutside = function() {
ratio = Math.round(this._x*100/line._width);
uus_interval = ratio*100;
_root.interval = setInterval(_root.uuenda, uus_interval);
}
StopDrag Does Not Work
What's wrong with this stopDrag script?
ActionScript Code:
stop();
q1_down.onPress = function() {
_parent.qs.startDrag();
}
q1_down.onRelease = function() {
_parent.qs.stopDrag();
}
Sandman9
Use Of StartDrag And StopDrag
Hi
Can anyone pls advise me on this problem? I would like to design the program in such a way that user is allowed to select any icons available on the program. Then he/she is supposed to drag this icon and place it in the respective boxes drawn. So if the icon is dragged and placed at the correct boxes, then a correct msg will pop out.
So now i am trouble by how to make sure that the correct icon is placed in the right box.
Thanks everyone!
Rdgs
Meilan
StopDrag Problem
Hi to everybody!
I'm new with flash so I think my problem is easy to solve.
This is my code:
xxx.onPress = function()
{
xxx.startDrag();
};
xxx.onRelease = function()
{
xxx.stopDrag();
}
I don't know why, but when i execute the code, if i click quickly on this object it doesn't drop it but it keeps it...
Do you have any advice?
Thanx a lot for your help
StartDrag / StopDrag With RollOver
Ola everybody I'm a french guy who needs some help..
I tried to stop dragging an item on a rollout action but it didn't work...
on (rollOver) {
startDrag ("target_item", true, 500, 20, 500, 280);
}
on (rollOut) {
stopDrag ();
}
I'm in serious trouble...
I have to fix it yesterday...
please HELP.
Thanks an good night...
StopDrag Working Inconsistently
In a drag and drop game I did using Flash 5, the stopDrag function sometimes doesn't work - occasionally the mouse doesn't let go of the movie clip on release. I've checked the code and see no problem with it.
2 strange things about this:
1] it affects different movie clips on different viewings
2] the problem only occurs when the movie clip is dragged onto another symbol - but this is what has to happen to play the game
It is at:
http://www.jlf.com/eg/games-bodyPartsJLF.htm
Thanks for any advice!
StopDrag Stopping ALL Drags..?
I have changed my mouse icon, and I also have draggable windows - Now, When I open a draggable window - the window drags but my mouse icon stops. When I drop the window My mouse icon does not start to move again, because to drop the window I have to use StopDrag()
Anyway to bypass BOTH of these? I want the mouse icon to move even when I am dragging the window, and still want the mouse to move AFTER I have dropped the window
thanks
StartDrag/StopDrag Limits?
How would you limit a startDrag script to X values only (draggable left and right only)?
I'm currently just using the standard:
on (press) {
startDrag ("image9");
}
on (release) {
stopDrag ();
}
Thanks for any help,
gatorage
StopDrag On Mouse Out ? Part2
(see earlier message "stopDrag on mouse out ??" )
Dear senocular, or anyone else,
I tried everything, but it still won't work:
onClipEvent (mouseMove) {
if (this.hitTest(_root._xmouse, _root._ymouse, true) stopDrag();
updateAfterEvent();
}
doesn't work, It's not possible to put stopDrag in that part of the code.
My code is now this:
onClipEvent (mouseDown) {
startDrag(this, false, 875, 558, -416, -287);
}
onClipEvent (mouseMove) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
stopDrag();
updateAfterEvent();
}
}
onClipEvent (mouseUp) {
stopDrag();
}
Did I miss anything? Maybe a code anywhere else?
What to try next?
Maaike
StopDrag On MouseOut ? Part 3
hello again, (see also stopDrag on mouse ?? part 1 and 2)
still no succes on trying to stop my movieclip to stopDrag on leaving the stage.
I've made a movieclip which is bigger than the stage itself, and I want it to stop drag when the mouse cursor isn't in the movie.
Senocular has tried to help me out (thanx), but no results........I can't get it right. I tried to get out of the movieclip by placing a sort of framesquare movieclip aroud the other movieclip (which has to stop drag). I also tried to duplicate the movieclip......
Here my code again:
onClipEvent (mouseDown) {
startDrag(this, false, 875, 558, -416, -287);
}
onClipEvent (mouseUp) {
stopDrag();
}
onClipEvent (mouseMove) {
if (this.hitTest(_root._xmouse, _root._ymouse, true) == false) {
stopDrag();
}
}
Biggest kiss for the one who helps me out
Small kiss in advance
x
Maaike
Return Instance Name On Stopdrag()
(flash MX)
I'm trying to get a dynamic text area to display the instance name of a MC when its dropped over a specific movieclip.
I currently have:
a MC with the instance name 'hotspot' used for the drop area
a MC with the instance name 'bob' which is dragable
a MC with the instance name 'fred' which is dragable
a dynamic text area called 'disp_inst'
I've put code in both 'bob' and 'fred' which, on stopdrag() sets 'disp_inst' to either 'bob' or 'fred' depending on which clip it is, but i really need to do it dynamicly, so what I *think* i need is a bit of code on each dragable MC which says 'when you're dropped, are you over 'hotspot'? if so, set 'disp_inst' to your instance name.
I'm stuck as to how I do that though, HELP!!
STOPDRAG Not Working On Level 1
Hello,
I have developed a simple shell movie which calls in external SWF files and enables variables to be passed between these external files. These files are loaded into Level 1.
The STARTDRAG actionscript in each external SWF file works when each file is played as a standalone movie. However, when I run the shell movie and call an external movie, the STARTDRAG actionscript in the external file ceases to work.
I think that this has something to do with levels and paths, but I'm not sure how how to specify these correctly.
Below is the coding I've used as part of my STARTDRAG routine. WORDMC, IBEAMMC, STARTMENU*, ALLPROGS, etc are movie clips. The STARTDRAG sits in the Level 1 movie.
All I'm doing is enabling dragging of WORDMC and checking the destination of the drag. If the user drags WORDMC onto IBEAMMC then I fade-out a number of images that are displayed (i.e. WORDMC, STARTMENU*, ALLPROGS, etc) by setting the alpha value to 0.
At the moment, I can drag WORDMC onto IBEAMMC, however the debugger tells me that the 'x' and 'y' properties of WORDMC and IBEAMMC are different (even when one is sitting over the other), hence the following never applies:
(getProperty("/wordmc", _droptarget) eq ("/ibeammc")
Could someone please help me out by giving me an example how to specify the required levels/paths so that my STARTDRAG/STOPDRAG works.
Please note that the code below works when I run my Level 1 movie in standalone mode, i.e. not via the shell (Level 0).
Thanks so much.
---------------------------------------------------------------------
on (press) {
startDrag ("/wordmc");
}
on (release, releaseOutside) {
stopDrag ();
if (getProperty("/wordmc", _droptarget) eq ("/ibeammc")) {
setProperty ("/wordmc", _alpha, 0);
setProperty ("/ibeammc", _alpha, 100);
setProperty ("/startmenu1", _alpha, 0);
setProperty ("/startmenu2", _alpha, 0);
setProperty ("/startmenu3", _alpha, 0);
setProperty ("/allprogs", _alpha, 0);
setProperty ("/ibeammc", _alpha, 0);
setProperty ("/taskbarword", _alpha, 0);
} else {
setProperty("/wordmc", _x, /:wordmc_x);
setProperty ("/wordmc", _y, /:wordmc_y);
}
}
Thanks.
Eva
StopDrag Doesn't Stop
I'm making a "makeover" game of one of my teachers to show to the entire school (with his permission) on Tuesday. I am using the following code to drag the articles of clothing.
Code:
on(press) {
this.startDrag();
this.gotoAndStop(2);
}
on(release) {
this.stopDrag();
}{
My problem is that stopDrag doesn't stop the Dragging everytime. About 10% of the time, the piece sticks to my mouse and i drag it all over, no matter how much i click. How can i fix this?
StartDrag Or StopDrag Action
Hi
Regarding MX 2004
I'm using a floating menu bar with a script:
drag = "/dragControl";
/:w = getProperty("/nav", _width);
/:xPos = getProperty(drag, _x);
/:yPos = getProperty(drag, _y);
// center the menu drag
/:xPos = /:xPos-400;
speed = 20;
setProperty("/nav", _x, getProperty("/nav", _x)-(/:xPos/speed));
if (Number(getProperty("/nav", _x))<Number(-(/:w/2))) {
setProperty("/nav", _x, 0.01);
} else if (Number(getProperty("/nav", _x))>0) {
setProperty("/nav", _x, -/:w/2);
}
For some reason my floating menu seems to be cancelling out as soon as the startDrag or stopDrag action is called in any movie clip. How come that is happening?
I need to find a way to isolate the drag action of the menu so that no other elements can interfere with it.
Thank you do much
StartDrag/stopDrag Problems
Hi everyone,
I have the following SWF
http://members.rhizome.net/stephenwilson/endgunn.html
which uses the following script to drag the orange cube,
code:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}
You'll have to forgive me because my knowledge of Actionscript is pretty basic and this is proving a little bit trying. As you can see the cubes could make up a larger cube (a bit like a rubik's cube). Is it possible to drag the orange cube according to a set path of coordinates? These coordinates would be the empty spaces in the larger cube.
LoadMovie+startDrag+stopDrag
I have a container in my swf :my_container
here I load external pictures.I want to be able to drag this pictures so I have this actionscript
movieclip.prototype.myfunction1 = function(){
this.onPress = function(){
var x = 20;
var y = 70;
var a = ((this._width/2)-260)-x;
var b = ((this._height/2)-195)-y;
var c = ((this._width/2)-260)+x;
var d = ((this._height/2)-195)+y;
this.startDrag(false, 0-a, 95-b, 260+c, 195+d);
}
this.onRelease = function(){
this.stopDrag();
}
this.onReleaseOutside = function(){
this.stopDrag();
}
}
my_container.myfunction1();
But in the same container I load others swf's .When I load a swf that have some buttons I want to be able to press those buttons.So I want to make a function myfunction2 that cancell myfunction1 when I load a swf in my_container
I made this function but this is wrong because I still cant press the buttons from loaded swf's
movieclip.prototype.vmyfunction2 = function(){
this.onPress = function(){};
this.onRelease = function(){};
this.onReleaseOutside = function(){};
}
StartDrag / StopDrag Question...
Hi all...
I have the following:
Code:
main_left.dragbar_mc.onPress = function ()
this._parent.startDrag(false);
};
main_left.dragbar_mc.onRelease = dragbar_mc.onReleaseOutside = function () {
this._parent.stopDrag();
};
Very simple, was wondering how when I drag it I can give it a bit of a tweening affect, so when you let go it still moves and slow down to a stop... Also I want to have a reset button, that when clicked brings the MC back to the original position the MC was in during the inital first play... Can this be done?
Change Colour On StopDrag();?
I am using the code below which I would like to include the possibility of changing the colour of the text inside a button, is that even possible?
code:
for (mc in this) {
this[mc].onPress = startDrag;
this[mc].onRelease = stopDrag;
}
thisLevel = this
for (i = 0; i<= 3; i++) {
thisLevel ["circle"+i].onPress = stopDrag;
this["circle"+i].onRelease = stopDrag;
}
[F8] StopDrag() Won't Stop Dragging - Please Help
Hi all,
I've built a media player which pulls in a FLV. Everything works fine but sometimes the volume slider and timeline slider don't stop dragging after the release of the mouse button. Here's the stopDrag code below for you to look at. The volume slider works in the same way.
PHP Code:
movieScrubber.scrubDot.onRelease = function():Void{
this.stopDrag();
videoDisplay.play(t);
scrubbing = false;
}
I'll add the rest of the code just in case it helps:
PHP Code:
stop();
var scrubbing:Boolean;
var t:Number; // current playhead time (in seconds)
var scrubberLength:Number = movieScrubber.clipTimeline._width;
var scrubRange:Number = scrubberLength - movieScrubber.scrubDot._width;
var volumeRange:Number = volumeSlider.volumeWedge._width - volumeSlider.volumeDot._width/2;
var soundLevel:Number;
var owner:MovieClip = this;
var configURL:String; // change path to config.xml using flashvars
// Preferences loaded via XML config file
var autoPlay:Boolean;
var flvURL:String;
var loop:Boolean;
var volume:Number;
// Listeners for MediaDisplay component
var flvListener:Object = new Object();
// called when Flash video playback is completed
flvListener.complete = function(evt:Object):Void{
videoCompleted();
}
// called repeatedly while FLV download is in progress
flvListener.progress = function(evt:Object):Void{
var bl:Number = evt.target.bytesLoaded;
var bt:Number = evt.target.bytesTotal;
movieScrubber.loadProgress._width = Math.round(bl/bt * movieScrubber.clipTimeline._width);
if(bl > 4 && bt > 4 && bl >= bt){
trace("FLV loaded");
}
}
videoDisplay.addEventListener("complete", flvListener);
videoDisplay.addEventListener("progress", flvListener);
// Play/Pause button handlers
playpauseClip.pause_btn.onRelease = function():Void{
videoDisplay.pause();
}
playpauseClip.play_btn.onRelease = function():Void{
videoDisplay.play();
}
// Video scrubber
movieScrubber.scrubDot.onPress = function():Void{
this.startDrag(false, 0, 0, scrubberLength-10, 0);
scrubbing = true;
}
movieScrubber.scrubDot.onRelease = function():Void{
this.stopDrag();
videoDisplay.play(t);
scrubbing = false;
}
movieScrubber.onEnterFrame = function():Void{
togglePlay();
if(scrubbing){
t = (this.scrubDot._x/scrubberLength) * videoDisplay.totalTime;
videoDisplay.play(t);
// this pauses video until scrubber is released
videoDisplay.pause();
}
else{
var scrubFactor:Number = videoDisplay.playheadTime/videoDisplay.totalTime;
this.scrubDot._x = scrubRange * scrubFactor;
}
}
// Volume controls
volumeSlider.volumeDot.onPress = function():Void{
this.startDrag(false, 0, -4, volumeRange, -4);
volumeSlider.onEnterFrame = function():Void{
var v:Number = Math.round((this.volumeDot._x/volumeRange)*100);
soundLevel = v;
setVolume(v);
}
}
volumeSlider.volumeDot.onRelease = function():Void{
this.stopDrag();
delete volumeSlider.onEnterFrame;
}
volumeSlider.speakerIcon.onRelease = function():Void{
var muted:Boolean = videoDisplay.volume == 0;
setVolume(muted ? soundLevel : 0);
}
// Functions
function init():Void{
// mute volume initially
setVolume(0);
// hide pause button initially
playpauseClip.pause_btn._visible = false;
// load XML preferences
loadPreferences();
}
function loadPreferences():Void{
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success:Boolean){
if(success){
trace("XML loaded.");
var prefNode:XMLNode = this.firstChild.firstChild;
while(prefNode != null){
trace(prefNode.nodeName + ": " + prefNode.firstChild.nodeValue);
// convert nodes to Timeline variables
owner[prefNode.nodeName] = prefNode.firstChild.nodeValue;
// move to next preference
prefNode = prefNode.nextSibling;
}
// set MediaDisplay properties
setupVideo();
}
else{
trace("Error loading XML preferences.");
}
}
myXML.load(configURL == null ? "ikypVideo.xml" : configURL);
}
function setupVideo():Void{
// set MediaDisplay properties
videoDisplay.autoPlay = autoPlay;
videoDisplay.contentPath = flvURL;
soundLevel = volume;
setVolume(soundLevel);
}
function setVolume(v:Number):Void{
volumeSlider.volumeDot._x = Math.round((volumeRange*v)/100);
videoDisplay.volume = v;
var speakerLevel:Number = Math.round(((volumeSlider.volumeDot._x/volumeRange)*100)/33)+1;
volumeSlider.speakerIcon.speaker_mc.gotoAndStop(speakerLevel);
}
function videoCompleted():Void{
// this moves playhead to 0
videoDisplay.stop();
}
function togglePlay():Void{
var isPlaying:Boolean = videoDisplay.playing && !scrubbing;
playpauseClip.pause_btn._visible = isPlaying;
playpauseClip.play_btn._visible = !isPlaying;
}
// Initialize movie
init();
It seems to release ok until you slide the slider to the end of it's range, then it continues dragging after release.
Can anyone shed some light on the situation?!
Many thanks in advance
Joanna
StopDrag On HitTest Problem
hi anyone knows how to stopDrag on hitTest but allows it to be able to drag again upon onRelease?
i was using this code
green1_mc.onPress = function() {
startDrag(this, false, 52, 51.2, 210, 51.9);
this.onEnterFrame = function(){
if(this.hitTest(blue4_mc)){
stopDrag();
}
if(this.hitTest(blue1_mc)){
stopDrag();
}
this.onRelease = function() {
delete this.onEnterFrame;
stopDrag();
}}}
but it wont work..
i've attatched the fla im working on..
|