my reason for needing this is to build a control similar to outlooks
calendar thingy where you can drag and expand an event time span on a
calendar thing.  From another suggestion, I'm using canvas now with a
box.  The blow code, warning the colours are absolutely horrible, it
is just an example afterall, works when I drag left/right from the
within the white area of the box.  It also works the way I want when I
drag the right side of the box, the black bar on the right.  but I
can't quite get teh left black bar drag to work.  I want it so when
the left black bar is dragged left the box expands in width to the
left.  So, I have changing the widhth and moving the x coord of the
box at the same time to simulate 'strethcing' on the left side.  Seems
these two ops cancel each other out.  any ideas?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
height="500" width="500" backgroundColor="Red">
        <mx:Canvas id="myCanvas" width="400" height="400" 
             mouseMove="doMouseMove()" backgroundColor="Blue">
             <mx:Script>
                <![CDATA[
                var isDown:Boolean = false;
                var lastX:Number;
                var lastW:Number;
                
                var whereisthept:Number;
               
                function doMouseDown() {
                    isDown = true;
                    lastX = mouseX;
                    lastW = selector.width;
                    whereisthept = mouseX-myCanvas.x-selector.x;
                    //mx.controls.Alert.show(whereisthept.toString());
                }
                
                function doMouseUp() {
                     isDown = false;
                     //mx.controls.Alert.show((whereisthept).toString());
                }
                
                function doMouseMove() {
                    if (isDown) {
                        var deltaX = mouseX - lastX;
                        
                        
                        if( whereisthept > 10 && whereisthept < (lastW - 10) ) {
                                selector.x += deltaX;
                                 lastX = mouseX;
                                
                            
                        } else if(whereisthept >= (lastW - 10)) {
                                
                                selector.width = lastW + deltaX ;
                                
                                
                        } else  {
                                selector.width = lastW - deltaX ;
                                selector.x += deltaX;
                                lastX = mouseX;
                        }
                       
                    }
                }
                        ]]>
             </mx:Script>
        
            
                 
             <mx:Box 
                width="50" 
                height="50" 
                x="100"
                id="selector" 
                label="test" 
                mouseDown="doMouseDown()"
                mouseMove="doMouseMove()"
                mouseUp="doMouseUp()" 
                backgroundColor="White" 
                borderSides="left, right" 
                borderStyle="solid" 
                borderColor="Black" 
                borderThickness="10" />
        
        </mx:Canvas>
        </mx:Application>

On 8/4/05, Douglas Knudsen <[EMAIL PROTECTED]> wrote:
> interesting...thanks for the reply.
> 
> one way I just thought of was to ensure that all list items were the
> same width, something in my problem I can assume.  Then based on
> mouseX and these widths should be able to figure out which item the
> mouse is over in the slected group.
> 
> 
> DK
> 
> On 8/4/05, Aldo Bucchi <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > If there is no clean way to do it ( i would still look further ), a
> > nasty hack would be something like this:
> >
> > - when the drag starts.
> > - determine the mc below the mouse at that time ( take a look at
> > lowlevelevents, if that doesn't do it, I can give you a snippet that
> > works just fine )
> > - traverse up the _parents till you hit the one you want
> > ---- how to test?...
> > ------ first, assert that the mc is of the class that renders the item
> > you want ( probably one in the mx.controls.listclasses package )
> > ------ then you'll have to look at the specific api for a way to get
> > the data item. Or perhaps the index in the list, which is more
> > generic.
> >
> > There are others way to do the testing, use your imagination. This is
> > where exploring the api gets fun.
> >
> > Anyway, I would still look for a cleaner solution first.
> >
> > Best,
> > Aldo
> >
> > On 8/4/05, Douglas Knudsen <[EMAIL PROTECTED]> wrote:
> > > but which on eof those items is the mouse on?  Say the user selected 5
> > > items contiguously then initiated a drag on them.  I want to know
> > > which item teh mouse is on.
> > >
> > > DK
> > >
> > > On 8/4/05, Manish Jethani <[EMAIL PROTECTED]> wrote:
> > > > On 8/4/05, Douglas Knudsen <[EMAIL PROTECTED]> wrote:
> > > > > Consider using a list and the drag+drop manager.  Assume the user has
> > > > > selected three items in the list contiguously.  Can I determine which
> > > > > of the three items the users mouse is on upon a click and hold?  I
> > > > > can't seem to see anything in the docs as of yet.
> > > >
> > > > Doesn't selectedIndices give you the indices of the items?
> > > >
> > > > Manish
> > > >
> > > >
> > > >
> > > > --
> > > > Flexcoders Mailing List
> > > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > > Search Archives: 
> > > > http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Douglas Knudsen
> > > http://www.cubicleman.com
> > > this is my signature, like it?
> > >
> > >
> > >
> > > --
> > > Flexcoders Mailing List
> > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > ::::: Aldo Bucchi :::::
> > mobile (56) 8 429 8300
> >
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> 
> 
> --
> Douglas Knudsen
> http://www.cubicleman.com
> this is my signature, like it?
> 


-- 
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hiligtd/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123194415/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to