Simple StartDrag() Referencing Problem?
Ok, this is simple stuff, I'm pretty sure I'm just being a complete nonce here but I just cant work it out....
Pretty simple, I have a function that's called from one point in the movie (I put a trace in this function so it is being called correctly). This function amongst other thing contains a startDrag() for a button. This button, when you click it, is what calls the function and also is the button that I want to make draggable.
The setup is like this:
_root -> MC1 -> MC2 -> button
So _root has in it MC1 which has in it MC2 which in turn has in it the button. the function code is on the _root timeline, and is called when you click the button and the button is also the subject of the startDrag() content of the function.
I use a with() command in the function to save a bit of code, in this case:
with(MC1.MC2){}
The startDrag() command in this with command this is then set like this:
button.startDrag(false, var, ious, para, meters);
Pretty straightforward huh? The problem is the button just wont drag! I cannot for the life of me work out why, its starting to drive me round the bend! I have also tried the old way of referencing:
startDrag("button", false, var, ious, para, meters); and also startDrag(button, false, var, ious, para, meters);
I have also traced the boundary parameters to make sure they are right and even taken them away completely to no affect. My conclusion is I must be referencing the button incorrectly, but to me the code all looks good, can anyone else spot anything?
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 03-19-2006, 12:04 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
A Simple StartDrag() Question
If I use startDrag how do I make the dragged clip stay at the position it was dragged to. I tried
on (releasem releaseOutside) {
stopDrag();
this._x = _xmouse;
this._y = _ymouse;
}
but that ends up with the clip at position (0,0). Can anyone help or give me an idea?
Simple StartDrag Question
Hi there,
i want to use the simple startDrag-function to drag a movieclip. when the option to lock the movieclip is set to false, there's no problem but when i set this option to true, so the movieclip should follow the mouse locked to the center, my movieclip just disappears...
i used this code:
onClipEvent (mouseDown) {
startDrag("", false); //true doesn't work...
}
onClipEvent (mouseUp) {
stopDrag();
}
it would be nice if someone could help me out with this tiny problem!!!
thx
BoRn
Simple StartDrag Question
Hi there,
i want to use the simple startDrag-function to drag a movieclip. when the option to lock the movieclip is set to false, there's no problem but when i set this option to true, so the movieclip should follow the mouse locked to the center, my movieclip just disappears...
i used this code:
onClipEvent (mouseDown) {
startDrag("", false); //true doesn't work...
}
onClipEvent (mouseUp) {
stopDrag();
}
it would be nice if someone could help me out with this tiny problem!!!
thx
BoRn
Simple Buttons Won't Work After Startdrag And Stopdrag
why doesn't my buttons that are in the MC: buttonmenu_mc, work?
i put the AS:
PHP Code:
this.buttonmenu_mc.onPress = function() {
// dragging buttonmenu_mc
_root.buttonmenu_mc.dragger_mc._visible = true;
startDrag(this);
};
this.buttonmenu_mc.onRelease = function() {
reActivateBtns();
changeOptionColor(this, overColor);
//this.enabled = false;
var old_x = this._x;
var old_y = this._y;
// moving position and scaling smaller of the buttonmenu_mc
this._x = Number(old_x);
this._y = old_y;
this._width = 500;
this._height = 200;
this.drag_txt.text = "Drag away";
// doesn't work?
this.drag_txt.onPress = this.drag_txt.onRollOver=function () {
this.text = "";
trace("dragtxt onpress");
};
_level0.myMCL.loadClip("page_info.swf", 5);
stopDrag();
};
if i onPress on this MC, it works, thus it drags..
after onRelease, it stops dragging. so that works.
But after onReleased, the buttons that are in that movie click don't work (won't trace, won't onRollover, won 't function), why?
Referencing Buttons (simple)
I feel like chump at the moment... you guys are the only ones i can turn to for a quick answer.
All i need to know is how to referrence buttons and assign actions to them. I don't want to put the code directly on the button instance, but rather referrence the button from an actions layer.
Here is what I had.
HTML Code:
DRW.onRelease=function() { trace ("Hello")}
DRW is the instance name of the button.
Eek!
Simple Referencing Problem
Having a problem getting data to display in my dynamic text fields. have a movieclip and onRollOver it laods a movie clip to the stage which has the dynamic text fields in it. but at the moment it just displays: _level0.popout1.add1 However if i put the movieclip on the stage and give it the same instance name ("popout") it then displays the values and not the above. At the moment it has been assigned an identifier of "popout" in the library. Can anyone explain why?
Simple Question About Referencing Forms
I have what I hope is a simple question. Could someone please provide a primer on how to reference forms (and things contained in forms) in AS2? Specifically, I am having trouble referencing a form loaded into another form. Here is my form structure:
Application
Form1
Form2
Loaded into Form1 is an swf containing another set of forms, with this structure:
NewApplication
NewForm1
NewForm2
So, how do I reference NewForm1 from Application and vice versa?
Thanks.
-Brian
What Is The Simple Equivalent For Referencing The _root Timeline?
I've got a .swf (movie B) that gets loaded into a clip in my main movie(movie A). Movie B needs to control another clip within movie A.
In AS2, i would simply start off with a _global var on the main _root timeline, like this:
_global.home=this;
then, later in my seconday movie (movie B) i would reference that timeline simply like: home.myClip.gotoAndStop("whatever");
What is the simple equivalent for referencing the _root timeline? I've tried _parent with no results.
I'm looking forward to utilizing classes more, but for now I've got timeline code (on a single frame at least), with aspirations of moving toward a 'class-based' development style.
thanks for any help!
Simple Problem - Referencing Objects By Variable Name
I have a simple function that dynamically creates text fields. My text field name is referenced by var thisTextField. Problem is, when i try to do things with my text field, actionscript shoots back an error as such:
There is no property with the name 'text'.
How am i supposed to apply properties to my object if my objects name is a variable?
Code:
function showProducts() {
var products:Number = 0;
var thisTextField:String = "product" + products + "_txt";
for (var itemID in _global.rtsData[_global.rtsPos]["products"]) {
this.createTextField(thisTextField,1,25,75,350,50);
trace(thisTextField);
thisTextField.autoSize = true;
product+products+_txt.text = _global.rtsData[_global.rtsPos]["products"][itemID]["products_name"];
products++;
}
_root.products_mc.gotoAndPlay("fadeIn");
}
Simple Problem - Referencing Object Array Properties
Sure this is dead straightforward. My flash creates a bunch of objects with x and y properties. These all get pushed into an array and then my .NET aspx page gets the array as an argument. This seems to be an ArrayList (although the documentation seemed to say it would be a HashTable) of ASObjects. How do I then refereence the x and y properties of the ASObject - is this what is now referred to as a Key?
StartDrag()?
I must be missing something here. I set my mc up to be dragged around the main stage when mousedown and stopDrag when mouse up. But I only want it to be able to be dragged when the mouse it over the clip. Right now when mouse down on any part of the screen it drags. What am I not doing right???? Hers my code so far:
onClipEvent (mouseDown) {
startDrag ("");
}
onClipEvent (mouseUp) {
stopDrag ();
}
This is on the mc thats loaded into the main.swf by a button action.
StartDrag
does anyone know how to edit startDrag (constrain to triangle) limits??
For example changing
<code>startDrag("drag-me", false,0,0,300,300)</code>
to
<code>startDrag("drag-me", false,50,50,300,0)</code>
I want to change a slider bar that has been previously created in another .fla and the movie exploper won't let me edit it??
thanks in advance
des
StartDrag Help
ok i made a move(site) and it loads a movie(navigation menu) so it wil lstay on top when u switch through scenes. and now i load another movie(cursor) so i can have a custom cursor...but now when u drag the navigation menu it stops dragging the cursor(MC)...can anybody help me out? basically what im trying to do is have a custom cursor and still be able to drag a menu, thanx.
StartDrag ?
Can someone please explain to me how the parameters of the startDrag function go. I have tried to make it work and I still cannot figure out why the clip will not drag in the place that I want it to. Thanks to all who help.
Help With Startdrag()
I know how to make something draggable, but I can't make it so that I can have more than one thing draggable. Can someone help me out? If I see the script I'll probably be able to figure it out.
check out my website: http://www.theultimatewebpage.com
StartDrag
I want to to be able to drag a movie clip but want to only be able to move it horizontally and only between to x points. I have looked up the start drag and the code is as follows.
_root.paddle.startDrag([true, 0, 0, 100, 0]);
This obviuosly doesn't work or I wouldn't be asking for help. For some reason it will still let me drag anywhere on the screen. Any help will be greatly appreciated.
StartDrag Help
If
StartDrag (true, 0, 225, 0, 400);
draggs from the left in the default settings, how do i get it on the right? i tried several combinations of the above with no luck.
[EDIT] Does the numbering go Left, top, bottom, right? Or does it go some other order?
[/EDIT]
-Thanks
StartDrag: Can You Help Me Out?
Hello,
i create a MC and i placed this code there:
on(press) {
startDrag(this, true, 0, 0, 110, 20);
}
on(release) {
this.stopDrag();
}
I have 2 questions:
1. Sometimes when i release the mouse, the MC keeps moving...why?
2. Shouldn't startDrag command work only with Buttons? What is going on here?
I am using Flash MX.
Thanks,
Miguel
StartDrag Help
I was wondering if anyone could help me, i have something that drags, but i want to block it so you can't drag it past a certain area.
I checked the actionscript Dictionary and it said that i can plug it into the start drag actionscript with left, right, top, and bottom; can any of you help figure out how in the hell i can do that?
About StartDrag
I have a object, and I have set it to move with mouse.
I want it move only up and down but not left and right.
So, how to write the script?
StartDrag=WTF?
ERm...
I dont see ANYTHING wrong with this fla. For some reason i put this on a button:
code:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}
And everything in the movie starts dragging, even thigns that arent symbols. Please help this has to be the biggest WTF question.
please help this is a huge headache.
I attached the fla with it (MX format)
StartDrag (i Think)
ello.
probably gonna look like a bit of a newbie ere (which i am really ) But how would i go about something like this :
Ive got 1 movie with 1 scene
The canvas size is 100x100
I have movie clip1 thats 900x100 , and contains 9x 100x100 Movie clips(2-10) that each contain buttons.
On the movie start up the movieclip1 is at 0,0.
What i need to do is on the click of each button , drag the main Movieclip1 to new co-ords.
ie to see the 2nd movie clip in the line , drag the main movieclip1 to 100,0 , for the next 200,0 etc etc.
Dont want it to just appear though (or i may aswell use scenes) , after something like a 100 frame motion tween with "50 In"
I know this could be done by creating movie clips for every possible action , but surely there has to be some faster way ?
Cheers in advance
Matt
Startdrag
Hi people,
I have a problem about trying to use two statdrag which is not possible in Flash MX.
what I need is to be able to drag say an apply across a table and yet able to move the table across the floor.. the tricky part is when I move the table the apple will need to stay on the table.
dragging the apply is restricted to only the top of the table .. meaning we can't leave it off the table...
I was think of nesting buttons in movie clips having startdrag in each of them .. but as we all know it won't work..
any help ?
thanks for saving the half left of my hair! :-)
Kurt.
I Cannot Use The StartDrag, I Must Use Something Else, Can You Help?
Hi all, I have always used the startDrag and stopDrag to move elements around the stage. However because I am using this method for my hover captions, apparently you cannot apply this method for anything else otherwise it ruins the captions position. So I need to apply a different techneque to the other elements.
Can anyone provide me with the solution for this, as I am unsure on how to achieve this. The effect I am after is similar to windows, in terms of being able to move the windows about.
But with me not being able to use the startDrag emthod I am unsure on how to go about it, any ideas??
Please help
Trev
StartDrag
Hi, I could really use some help!!
I have a custom cursor that uses the startDrag() command. I also have a music volume slider that uses startDrag(). When I use the slider, the cursor drag disengages and the cursor no longer moves. Even after I release the mouse button, the cursor is still immobile.
Is there any way around this? Is there a way to drag multiple objects? Or is there a way to re-engage the cursor drag after using the slider? Or is there even another way of creating a slider that doesn't use the startDrag() command? (I don't think that makes sense, but you never know.)
Please help!! I'd really appreciate it.
Thanks a lot,
Carl
StartDrag On A Mc Help
Ok I have a bands website I'm working on, there are five members and I want it when the mouse is over each member there is a graphic/mc with the band members name on it.
It doesn't seem real hard but I'm struggling with it.
I created a mc over each member and dropped the alpha to 0% and gave each clip an instance name numbered one - five.
Here is the code I have so far...
code: three.onRollOver = function() {
aaron_name.startDrag();
};
three.onRollOut = function() {
aaron_name.stopDrag();
};
thanks to any of you that can help me,
StartDrag Help
I'm building a prototype that has a draggable portlet (movieClip). When you start to drag this movieClip, I want a highlight to appear that shows where this movieClip is going to land. I guess this highlight would be the hitTarget that would be triggered when I start to drag this movieClip.
to better explain see this:
http://www.giltstudios.com/startDrag/
Startdrag
hey, i have two questions. the first is this. i have 12 layers w/ a movie clip in each. in that movie clip i have 2 frames, a picture in both, and a tooltip on the second. i attached startdrag (true) to the tooltip, but it goes behind the movieclip pictres on higher layers in the main timeline. is there a way to tell this startdrag object to go to the highest level of any movieclip in the entire project?
the second question i have is: i have several times when i have to do the exact same animation for several different objects. so, is there a way i can make like a "master"clip that just animates the properties (blur, size, etc.) then i can just dynamically add each clip to that animated one? basically i only want to have to animate once for all 12 objects. if this isnt too hard or tedious please help me out. THANKS!
StartDrag
Hi I am trying to use startDrag by referring to a movie clip that I have called "box1_mc". For some reason it isn't working. Can anyone help me?
Thank you.
In the Actions Layer, frame 1 I have the following:
box1_mc.onPress = function() {
this.startDrag;
}
StartDrag()
Can it be slowed down?
Also, can we make it so that the little hand appears so that the user knows he/she can drag?
Help With StartDrag
Hey all, here is what i am looking to do and am having a bit of trouble....I want to pull in external images, set the depths, let the user drag where ever (all while bringing the clicked to the front) and then click a reset button to put them all back at the coords they started with (so i guess they will need coordinates too in the beginning.
Like i said, im new to trying all this dynamic coding in flash so any help would greatly be appreciated... thanks again...
Someone did this for me but im not sure about the rest of it...
ActionScript Code:
var w:Number = 100;
var topDepth:Number = 5;
for(var i:Number = 0; i < topDepth; i++) {
var depth:Number = i + 1;
var square:MovieClip = _root.createEmptyMovieClip("clip" + depth, depth);
square.lineStyle(0, 0, 100);
square.beginFill(0xFF0000, 100);
square.lineTo(w, 0);
square.lineTo(w, w);
square.lineTo(0, w);
square.lineTo(0, 0);
square.endFill();
square._x = i * w / 3;
square._y = i * w / 3;
square.onPress = pressHandler;
square.onRelease = square.onReleaseOutside = releaseHandler;
}
function pressHandler():Void {
this.startDrag();
this.onMouseMove = updateHandler;
this.swapDepths(topDepth);
}
function releaseHandler():Void {
this.stopDrag();
}
function updateHandler():Void {
updateAfterEvent();
}
StartDrag
Hi all
I have a flash file in which there is a movieClip that moves up and down as you move your mouse. The code I used is
onClipEvent (load) {
startDrag (this, true, 0, 600, 0, 0);
}
In this movieClip, there are some buttons that are not working once I put the code on the MC.
How can I make my buttons work while the clip is dragging ?
StartDrag()
I'm trying to use the startDrag method with an onRollOver and onRollOut function but it works for the rollOver event but the onRollOut doesn't seem to trigger.
If I take the startDrag method out and do a trace the onRollOut then works.
Somehow the startDrag method is over riding something.
Has anyone else had this problem?
Thanks
ActionScript Code:
dragTop = 60;
dragBottom = 100;
btnDrag.onRollOver = function() {
btnDrag.startDrag(false, 72, dragTop, 72, dragBottom);
this.dragging = true;
updateAfterEvent();
};
btnDrag.onRollOut = function() {
btnDrag.stopDrag();
this.dragging = false;
};
Help With StartDrag
I've got a "filmstrip" in this movie. Each frame is a different picture. When the user drags the filmstrip to the left, I'd like the last image on the right to go no further than necessary to have it's right edge visible. And when they drag the strip to the right, I'd like the first (left) image to stop where it's left edge is visible. I've played around with the parameters in startDrag, but I can't seem to figure it out. Can anyone take a look at my clip and let me know where I'm off? Thanks.
StartDrag() X 2? Help Please...
Hi. I need a custom cursor to work with an MC that I am already using the startDrag(); method on. I know, in theory, startDrag(); can only be used for the mc it's applied and can't be included to ALSO drag another MC that's nested inside the parent MC, i.e. a custom cursor. So...I am really curious as to how to achieve this. Here is the code I am currently working with:
ActionScript Code:
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
drag = true;
startDrag(this, false, 0, 0, 800, 600);
Mouse.hide();
}
}
onClipEvent (mouseUp) {
drag = false;
stopDrag();
Mouse.show();
}
I believe I can use the _xmouse & _ymouse properties to accomplish this, but haven't experimented enough with this method and lack the knowledge to accomplish it on my own! So I turn to you, Flash Guru Gods/Godesses for your help and knowledge!
Any help or advise is greatly appreciated. Thanks!
morosa
StartDrag With AS3
I'll get over it, but could use some help; here's what I am trying to do. I have an image of a bee, it's an instance on stage (ins_bee), I simply want to use it as a mouse pointer, but cannot seem to identify the bounds correctly:
import flash.events.MouseEvent;
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE,moveBee);
function moveBee(e:MouseEvent):void {
this.ins_bee.startDrag(true, ***need help here***);
}
StartDrag Help
Hi,
I have a movieclip called "dragger" that slides along a movie "slidepath". I used the startDrag and stopDrag commands...
The code I am using is below...
The dragger slides beautifully along it's path...
However, I would like to load a different movie into a different level when the "dragger" is over each target square...
What is my best approach? Should I call each square a button to load each movie? Should I have that movie unload from that level before loading a new movie into that level upon going to the next target square? Should I give aset of coordinates for each target square with a load movie command in an if statement?
Please help!
thanks
Attach Code
"dragger" code:
on (press) {
startDrag("", false, 540,450,926,450);
}
on (release) {
stopDrag();
}
---------------------------------------------------------------------------------
root_frame code:
function floatTo(theSquare) {
loadMovieNum ("eventsWRD.swf",3);
DraggerTargetLoc = slidepath._x + (theSquare * slidepathPieceWidth) - (slidepathPieceWidth / 2)
-----------------------------------------------------------------------------------------------
slider bar code:
function floatTo(theSquare) {
loadMovieNum ("eventsWRD.swf",3);
DraggerTargetLoc = slidepath._x + (thePiece * slidepathPieceWidth) - (slidepathPieceWidth / 2)
Another StartDrag
Hi,
I had a bug on my site http://www.balanceimages.org with using 2 startDrag scripts and one cancelling the other out. It was suggested that I use another script for one of the drags by someone on this site (one is a scroll bar and the other a hover caption) take a look and see if you find the problem.
Anyway, does anyone know of other code that'll do the same as the startDrag so both effects will work?
Thanks,
Robert Power
StartDrag
Hi, I had a problem for a game I am making. I am trying to make a sliding invitory (can't spell) and it doesn't wanna work for me.
This what I have so far:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}
I don't know what settings to use in the startDrag option. Please help?
Please Help With StartDrag
Okay, so I have my startDrag actionscript working marvelously. What I have are file folders on a desk and you can click on one of the folders tabs and it comes to the front and you can click and hold and drag the file around.
My question is, is there a way to script like a "reset" button of sorts that you can click on and the folders can go back to their original starting position? When you drag them around too much, they start to cover the other folders.
Thanks in advance
StartDrag Help
I'm building a prototype that has a draggable portlet (movieClip). When you start to drag this movieClip, I want a highlight to appear that shows where this movieClip is going to land. I guess this highlight would be the hitTarget that would be triggered when I start to drag this movieClip.
to better explain see this:
http://www.giltstudios.com/startDrag/
Startdrag Just On The Y
Is there a way to constrain a mc being dragged to just the y coordinate?
Here is the code I'm using so far:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}
Thanks!
StartDrag();
How come this script really messes up if there is another MC on top of it or something, even if the other MC has no script on it?
StartDrag Only _x
Hello Guys!
knob.onPress = function() {
startDrag(this)
}
How can I make the knob drags only _x, I need the _y stays as it is!
thanks!
StartDrag()
hello.
I am having issues with startDrag().
I have a movie clip called circle.
Inside circle, I have a movie clip called circleFill and another called circleOutline.
onEnterFrame, this movieClip is duplicated 4 times.
______________________
When I use this:
private function onPressNow(event:MouseEvent):void
{
startDrag();
}
IT DRAGS ALL 4 MOVIECLIPS.
______________________
When I use this:
private function onPressNow(event:MouseEvent):void
{
event.target.startDrag();
}
IT DRAGS circleFill and NOT outlineFill + circleFill.
MY QUESTION:
how can I make it drag my movieClip called circle? (meaning both circleFill and outlineFill)
Help With StartDrag
Okey so I click on my little button in my movie and write in the following code
ActionScript Code:
on(press) {this.startDrag(false);}on(release) {stopDrag();}
It looks ok to me, but when i preview it, instead of draggin' the button it drags the whole movie??? =S
anyone know wht the prob is?
StartDrag
Hi, I had a problem for a game I am making. I am trying to make a sliding invitory (can't spell) and it doesn't wanna work for me.
This what I have so far:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}
I don't know what settings to use in the startDrag option. Please help?
StartDrag Only _x
Hello Guys!
knob.onPress = function() {
startDrag(this);
}
How can i make the knob drags only _x?
Thanks
[as] StartDrag
This is the code I'm using:
ActionScript Code:
on (press) {
// object, boolean true or false,left(x),top(y),right(x),bottom(y)
startDrag("_root.news_mc", false, 30, 4, 450.9, 733);
}
on (release) {
stopDrag ();
}
For some reason it will only constrain the mc I'm dragging to the left and not to the right or bottom. for the top it constrains it to a different value. I can't figure out what I did wrong. Help!
|