Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-19-2006, 11:04 AM   #1
WarMecha
Registered User
 
Join Date: Apr 2003
Posts: 34
Question 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?
WarMecha is offline   Reply With Quote
Old 03-19-2006, 12:00 PM   #2
WarMecha
Registered User
 
Join Date: Apr 2003
Posts: 34
Default

this is gonna be one of those posts that no-one answers to isnt it?
WarMecha is offline   Reply With Quote
Old 03-19-2006, 03:18 PM   #3
darkzak
Registered User
 
Join Date: Apr 2003
Location: Salinas, California
Posts: 210
Default

You cannot drag the button itself. Instead you need to drag the movieclip that contains the button.

So in your example you should be dragging mc2. Which would look like:
ActionScript Code:
mc1.mc2.btn.onPress = function() {  this._parent.startDrag();//drags the mc2 movieclip }
darkzak is offline   Reply With Quote
Old 03-19-2006, 04:05 PM   #4
WarMecha
Registered User
 
Join Date: Apr 2003
Posts: 34
Default

I also thought that was the case, but actually you can drag a button. Anyhow, tried that already and it hasnt didnt work. Ended up by moving the functions onto the actual movies/buttons they are called from and got it working that way. Still dont know what the issue was but its working now anyway.
WarMecha is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Component class, problem referencing. fuqur2dom Components 4 02-17-2005 09:19 PM
An interesting problem regarding a simple way to scroll text. P-town ActionScript 1.0 (and below) 0 01-20-2005 03:39 PM
Simple Movie Clip Button Problem roboron ActionScript 1.0 (and below) 7 12-08-2004 05:43 AM
xmouse and startdrag problem marco66 ActionScript 1.0 (and below) 6 11-05-2002 08:00 AM
Simple but hard problem :S cybling boy ActionScript 1.0 (and below) 33 06-28-2002 10:33 AM


All times are GMT. The time now is 07:06 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.