I too has this problem, I cound't seem to get it to work.  I was able to adjust
the location when dropped to keep it in the same place but when I removed it
from the drop target, it moved.  I haven't looked at it recently, but will look
at it again to see if I can locate the problem.  I'll keep you posted.

GORTSILAS ANDREAS wrote:

> When I try the removeFromParent and then addChild in the DynAPI.document
> from the ondragstart event, the position of the draged frame changes
> (relative to window)
>
> If I try this from code (see TestIt()) then it works correctrly (after the
> DynAPI.document.addChild the frame keeps the correct position in screen)
>
> Does anyone know why in the ondragdrop event this does not work?
>
> See the following code:
>
> <html>
> <head>
> <title>DragDrop 3 example</title>
> </head>
>
> <script name="scrBasic" language="Javascript1.1"
> src="/SrcDC/_gen/dynapi.js"></script>
> <script language="Javascript1.1">
>
> DynAPI.setLibraryPath('/SrcDC/_gen/')
>
> DynAPI.include('dynapi.api.*')
> DynAPI.include('dynapi.ext.dragdrop')
>
> var myLayer, myChild
>
> DynAPI.onLoad=function() {
>   DynAPI.document.setBgColor('white')
>
>   myLayer=new DynLayer('test',50,50,300,400,'#c0c0c0')
>   myChild=new DynLayer('child',10,30,100,100,'#808080')
>   myLayer.setHTML('testing this')
>
>   var l=new EventListener(myChild)
>   l.ondragstart = function(e) {
>     myChild.moveTo(myChild.getPageX(), myChild.getPageY());
>     myChild.removeFromParent();
>     DynAPI.document.addChild(myChild)
>   };
>
>   myChild.addEventListener(l)
>   DragEvent.setDragBoundary(myLayer)
>   DragEvent.enableDragEvents(myChild)
>
>   myLayer.addChild(myChild)
>   DynAPI.document.addChild(myLayer)
> }
>
> function TestIt() {
>   myChild.moveTo(myChild.getPageX(), myChild.getPageY());
>   myChild.removeFromParent();
>   DynAPI.document.addChild(myChild)
> }
> </script>
>
> <body>
>   <form id="frmTest" name="frmTest">
>     <input type=button value="Test" onclick="javascript: TestIt()" id=buTest
> name=buTest>
>   </form>
> </body>
>
> </html>
>
> -----Original Message-----
> From: Michael Pemberton [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 31, 2001 2:10 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [Dynapi-Help] Drag layer outside the container...
>
> look at the "drag 'n' drop" examples.  This involves removing the layer from
> it's parent
> when you start dragging  it and adding it to the document.  Then adding it
> to the target
> when you drop it over it.
>
> Andreas Gortsilas wrote:
>
> > In the following source I want to drag the "myChildLevel2" from "myChild"
> to
> > "myChild2"
> >
> > but
> >
> > when the draged layer cannot get out of the "myChild" layer (container)
> >
> > What I must do in order to allow the "myChildLevel2" layer to be draged
> > outside the container?
> >
> > Maybe I must change the container ondragstart????
> >
> > Can anyone tell me what is the approach to this?
> >
> > Thank you
> >
> > Andreas
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help

--
Michael Pemberton
[EMAIL PROTECTED]
ICQ: 12107010




_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to