This is NOT fixed.
Here is the function as is:
DragEvent.enableDragEvents=function(f) {
 for (var i=0;i<arguments.length;i++) {
  var lyr=arguments[i];
  if (lyr.isDynLayer) lyr.addEventListener(DragEvent.lyrListener);
 }
 if(f.isDynDocument) f.addEventListener(DragEvent.docListener);
 else DynAPI.document.addEventListener(DragEvent.docListener);
};
 
No note: the functions assumes that if you are passing a dyndocument, it will be 'f'.
but 'f' is the FIRST parameter.
 
How do you enabled drage events?
enabledDragevents(theDocument,TheLayer) ?
or
enabledDragevents(TheLayer,theDocument) ?
 
Taht's right!! the _OPTIONAL_ parameter should be the second one.
So:
Calling enabledDragevents(TheLayer,theDocument)  wil _NOT_ cause the doclistener to be added
to the correct frame as the functio n only checks if the first argument (f) is a dindocument!!!!!
 
FUCK!
 
How may time do we need to go throught this?
 
Now, a CORRECTED function:
DragEvent.enableDragEvents=function() {
 var DocAdded=false;
 for (var i=0;i<arguments.length;i++) {
  var lyr=arguments[i];
  if(lyr){
   if(lyr.isDynLayer){
    lyr.addEventListener(DragEvent.lyrListener);
   }else if(lyr.isDynDocument){
    lyr.addEventListener(DragEvent.docListener);
    DocAdded=true;
   }
  }
 }
 if (!DocAdded)DynAPI.document.addEventListener(DragEvent.docListener);
};
Now this function does not cxare WHAT order you pass your arguments in.
Not only that, but _THIS ONE WORKS_.
 
scenerio.
Two Frames:
One has the Dynapi.onload stuff in it.
The other does not.
the frame that has DynAPI.onload in it creates a
DynDocument reffering to the other frame.
A DynLayer is then added to the other frame.
The dynlayer is then mad draggable -  _In the other frame!!_
 
I dare you to make this work with the current function.
 
so:
var myDynDoc = new DynDocument(top.frame2);
var myLayer = myDynDoc.addChild(new DynLayer(null,10,10,100,100));
DragEvent.EnableDragevents(myLayer,myDynDoc);
 
You may now drag the layer.

Reply via email to