There's two things,
Your first include
         DynAPI..include('dynapi.api.*');
has a dot to many.
 
And you don't have a reference to the DynAPI object because you are outside the onload event, so the event listener is being added before the onload has fired.
Like this it should be ok:
 
-------------------code start---------------------
 
 <script language="JavaScript" src="../dynapi2_51/dynapi/src/dynapi.js"></script>
 <script language="Javascript">
 
  DynAPI.setLibraryPath('../dynapi2_51/dynapi/src/lib/');
  
  DynAPI.include('dynapi.api.*');
  DynAPI.include('dynapi.event.*')
  DynAPI.include('dynapi.gui.label.js')
  DynAPI.include('dynapi.gui.list.js')
  DynAPI.include('dynapi.util.thread.js')
  DynAPI.include('dynapi.util.pathanim.js');
  DynAPI.include('selectList.js','./')
  
  DynAPI. {
   select1 = new selectList('test')
   DynAPI.document.addChild(select1)
    
  DynAPI.document.events = new EventListener(DynAPI.document)
   DynAPI.document.>    alert('test')
   }
  DynAPI.document.addEventListener(DynAPI.document.events)
 }

 </script>
 
 
----- Original Message -----
From: Ben Empson
Sent: Thursday, April 19, 2001 1:07 AM
Subject: [Dynapi-Help] Catching events on the document

I am building a select list widget, and I wish to catch the mousedown event on the document, in order to close the select box if it is open. I have tried the following code, but I get an error saying 'DynAPI.document is null or not an object' (referring to the first line of the EventListener).
 
This doesn't make since I have already added my select list widget to the DynAPI.document object as a child (haven't I?!!!)
 
Any help appreciated, Ben
 
-------------------code start---------------------
 
 <script language="JavaScript" src="../dynapi2_51/dynapi/src/dynapi.js"></script>
 <script language="Javascript">
 
  DynAPI.setLibraryPath('../dynapi2_51/dynapi/src/lib/');
  
  DynAPI.include('dynapi.api.*');
  DynAPI.include('dynapi.event.*')
  DynAPI.include('dynapi.gui.label.js')
  DynAPI.include('dynapi.gui.list.js')
  DynAPI.include('dynapi.util.thread.js')
  DynAPI.include('dynapi.util.pathanim.js');
  DynAPI.include('selectList.js','./')
  
  DynAPI. {
   select1 = new selectList('test')
   DynAPI.document.addChild(select1)
    
  DynAPI.document.events = new EventListener(DynAPI.document)
   DynAPI.document.>    alert('test')
   }
  DynAPI.document.addEventListener(DynAPI.document.events)
 }

 </script>
 
--------------------code end----------------------------

Reply via email to