Solved

Problems dragging overlapping buttons

Posted on 2002-04-09
5
160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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,…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

705 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