Hi,
I have just started playing with the DynAPI and have some questions.
1. Is there a searchable archive of this maillist? I followed the links
from the sourceforge pages, but there didn't seem to be any good way to
search through the messages. I ended up clicking on a lot of links, seeing
a few message titles, clicking on a few of those, going back, starting
over... There's gotta be a way to search for topics/keywords that I'm
missing. Can someone point me in the right direction?
2. I've been playing with dragging layers around and have run into a problem.
I created a large layer (my masterLayer) and then gave it a couple of
children (my subLayers).
The masterLayer is draggable. When I drag it, it pulls all the subLayers
along with it, which is what I want.
The subLayers are also draggable.
Originally, I had trouble getting them out of the masterLayer. If I enabled
drag events on the subLayers, without imposing dragBroundaries, I could
drag them right off the masterLayer, and more or less, into oblivion. That
is, when they hit the edge of the masterLayer, they would disappear. (If I
did not "let go of them, I could drag them back to the masterLayer).
Then I found some code, which allowed me get the subLayers off of the
masterLayer and onto the main document.
target.removeFromParent()
DynAPI.document.addChild(target);
With this code, I can drag my subLayers right off the masterLayer, and they
don't disappear.
The problem is, that if I move the masterLayer first and then try to move a
subLayer, the subLayer first jumps to it's original position on the screen
and then, although it is not under the mouse cursor, it can be dragged
around. (The effect is actually kinda neat, but it's not what I am looking
for.)
I've tried to reset the subLayer's position in the ondragstart event to
where it actually is on screen (or where I want it to be), but this seems
to get ignored, and I end up dragging around something which is nowhere
near the mouse cursor.
Is this something that has been done before? Can someone help me out:
Here's the relevant code, in case it helps:
function createMasterLayer()
{
masterLayer = new DynLayer(null, 0, 0, 520, 520, "#dd00ff")
DynAPI.document.addChild(masterLayer)
DragEvent.setDragBoundary(masterLayer)
DragEvent.enableDragEvents(masterLayer)
}
function createSubLayer(count,x,y,w,h, color)
{
subLayer = new DynLayer(null, x, y, w, h, color)
subLayerListener=new EventListener(subLayer)
subLayerListener.ondragstart=function(e)
{
target=e.getTarget()
var absX = target.getX() + masterLayer.getX()
var absY = target.getY() + masterLayer.getY()
target.removeFromParent()
DynAPI.document.addChild(target);
target.moveTo(absX,absY)
}
subLayerListener.ondragend=function(e)
{
target=e.getTarget()
paren=e.getSource()
target.setBgColor(color)
masterLayer.setBgColor("blue")
}
subLayer.addEventListener(subLayerListener)
DragEvent.setDragBoundary(subLayer)
DragEvent.enableDragEvents(subLayer)
masterLayer.addChild(subLayer)
}
DynAPI.onLoad= function()
{
createMasterLayer()
for(x=1; x<=50; x++)
{
createSubLayer(x,x*10, x*10, 1*10,1*10,"#aa00bb")
}
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help