Solved

Problems dragging overlapping buttons

Posted on 2002-04-09
5
158 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

726 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