Solved

Problems dragging overlapping buttons

Posted on 2002-04-09
5
155 Views
Last Modified: 2010-04-03
Flash 5:

I've got a vertical line overlapping a horizontal line.  The user can click and drag either one, but they always intersect.  I can do this easily by making each line a movie clip ("HorzClip" and "VertClip") and scripting them appropriately.  

The problem I had with this is that the cursor doesn't change when over the lines.  So I made the lines into buttons ("HorzButton" and "VertButton") within each corresponding movie clip.  For example, VertClip>VertButton>vertical_line.  An additional advantage of using buttons here is that I can automatically change the color of the line as the user drags it by changing the "down" state of the button.

Now here's the weird part.  The vertical line works perfectly.  But I have several problems with the horizontal line, even though the code is almost identical.

Problem 1:  If I click and hold the mouse over the horizontal line FIRST, the color of the line flickers -- it flashes to the "down" color and immediately returns to the normal color, even though I'm still holding the mouse button down.  I can drag the line and move it around but it has the wrong color.  If I click the vertical line FIRST, release it and then click the horizontal line, the color behaves and stays the "down" color (for a while, anyway... see below) until I release it.

Problem 2: If I click and drag the horizontal line for a while (several seconds), eventually the color will revert to the "up" color, even though I'm still dragging the line.

Problem 3: If I continue to drag the horizontal line, eventually it will not stop dragging even after I release the mouse button.

None of these problems occur with the vertical line.

All my code is in the button action for each line, as follows.  This is the only scripting in the whole project.  BoundsBoxVert and BoundsBoxHorz are hidden movie clips that identify the dragging constraints for each line.

VertButton:

on (press) {
  var Bounds = _parent.BoundsBoxVert.getBounds(_parent);
  var BoxLeft = Bounds.xMin;
  var BoxRight = Bounds.xMax;
  var BoxTop = Bounds.yMin;
  var BoxBottom = Bounds.yMax;
  var HalfHeight = Math.floor((BoxBottom-BoxTop)/2);
  var BoxMiddleY = BoxTop+HalfHeight;
  startDrag (this, true, BoxLeft, BoxMiddleY, BoxRight, BoxMiddleY);
}

on (release, releaseOutside) {
  stopDrag ();
}

HorzButton:

on (press) {
  var Bounds = _parent.BoundsBoxHorz.getBounds(_parent);
  var BoxLeft = Bounds.xMin;
  var BoxRight = Bounds.xMax;
  var BoxTop = Bounds.yMin;
  var BoxBottom = Bounds.yMax;
  var HalfWidth = Math.floor((BoxRight-BoxLeft)/2);
  var BoxMiddleX = BoxLeft+HalfWidth;
  startDrag(this, true, BoxMiddleX, BoxTop, BoxMiddleX, BoxBottom);
}

on (release, releaseOutside) {
  stopDrag();
}
0
Comment
Question by:GaryW021199
  • 4
5 Comments
 
LVL 6

Expert Comment

by:rootdir
ID: 6934625
Please send your movie to rotdir@hotmail.com I will take a look
0
 

Author Comment

by:GaryW021199
ID: 6934683
Is that rotdir@hotmail.com or rootdir@hotmail.com?
0
 
LVL 6

Expert Comment

by:rootdir
ID: 6934702
it is rotdir@hotmail.com
0
 
LVL 6

Expert Comment

by:rootdir
ID: 6934704
I am just waiting for your movie
0
 
LVL 6

Accepted Solution

by:
rootdir earned 100 total points
ID: 6934868
I found answer for your problem.

May be it is bug in micromedia flash.

The horizontal function looses functionlity if you try to lock the mouse pointer in center like this

startDrag(this, true, BoxMiddleX, BoxTop, BoxMiddleX, BoxBottom);


and if you make it 'false' it works

startDrag(this, false, BoxMiddleX, BoxTop, BoxMiddleX, BoxBottom);

So dont lock mouse pointer, I think this will solve your problem

Cheers
RootDir
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question