Thanks for the assistance, Eytan.

I have translated what I think might lead to confusion. Hope it helps!



function mainmenu(x,y,w,h,caption) {

  this.superClass=DynLayer
  this.superClass()
  this.id="mainmenu"+(mainmenu.Count++)

  this.items = new Array ()

  this.caption = caption||''

  this.moveTo(x||0,(mainmenu.Count*20)||0)
  this.setSize(w||160,h||20)
  this.bcgd = '#FFCC33'
  this.bcgd_over = '#CCFF33'
  var l= new EventListener(this)
  l.oncreate=function(e) {
  var o=e.getTarget()
  o.setBgColor(o.bcgd)

  o.lyrcaption = new DynLayer(null,1,1,o.w-2,o.h-2)
  o.lyrcaption.setHTML(o.caption)

  o.addChild(o.lyrcaption)

  o.addChild(new DynLayer(null,0,0,1,o.h,'#f0f0f0'))
  o.addChild(new DynLayer(null,0,0,o.w,1,'#f0f0f0'))
  o.addChild(new DynLayer(null,o.w-1,1,1,o.h-1,'#808080'))
  o.addChild(new DynLayer(null,1,o.h-1,o.w-1,1,'#808080'))

  o.setVisible(true) //opcional

  o.dynevents = new DynLayer(null,0,0,o.w, o.h) // capa de eventos
  o.addChild(o.dynevents)
  o.dynevents.addEventListener(o.events)

  }
  this.addEventListener(l)

  this.events = new EventListener(this)

  this.events.onmouseover = function (e) {
 o = e.getTarget()
 o.setBgColor(o.bcgd_over)
  }

  this.events.onmouseout = function (e) {
 o = e.getTarget()
 o.setBgColor(o.bcgd)
  }

  this.events.onmouseup = function (e) {
 o = e.getTarget()
 o.deslizar(o.h)
  }

  return this
}

mainmenu.Count = 0
mainmenu.prototype=new DynLayer()
mainmenu.prototype.getSubClass=function() { return mainmenu }

mainmenu.prototype.add = function (caption_s, link) { //location method not
yet implemented

   var i = this.items.length

   this.items[i] = new submenu(null,0,this.h,this.w,20)
   this.items[i].ItemIndex=i
   this.items[i].rootmenu=this
   this.setHeight(this.h+(this.items.length*20))
   this.addChild(this.items[i])

   return this.items[i]
}


menu.prototype.glide = function(y) {  // will add a nicer glide method

this.slideTo(this.x,this.y+y)

}

//sub-menus

function submenu(id,x,y,w,h) {

  this.DynLayer=DynLayer
  this.DynLayer(id,x,y,w,h)

  this.setVisible(true)
  this.setSize(w,h)
  this.moveTo(300,300)
  this.bcgd = '#FFCC33'
  this.bcgd_over = '#CCFF33'
  this.caption_s = 'Hola' //not yet related to add method above

  var l= new EventListener(this)

  l.oncreate=function(e) {
  var o=e.getTarget()
  o.setBgColor(o.bcgd)

  o.lyrcaption = new DynLayer(null,1,1,o.w-2,o.h-2)
  o.lyrcaption.setHTML(o.caption_s)

  o.addChild(o.lyrcaption)

  o.addChild(new DynLayer(null,0,0,1,o.h,'#f0f0f0'))
  o.addChild(new DynLayer(null,0,0,o.w,1,'#f0f0f0'))
  o.addChild(new DynLayer(null,o.w-1,1,1,o.h-1,'#808080'))
  o.addChild(new DynLayer(null,1,o.h-1,o.w-1,1,'#808080'))

  o.dynevents = new DynLayer(null,0,0,o.w,o.h) // capa de eventos
  o.addChild(o.dynevents)
  o.dynevents.addEventListener(o.events)

  }
  this.addEventListener(l)

  this.events = new EventListener(this)

  this.events.onmouseover = function (e) {
 o = e.getTarget()
 o.setBgColor(o.bcgd_over)
  }

  this.events.onmouseout = function (e) {
 o = e.getTarget()
 o.setBgColor(o.bcgd)
  }

  this.events.onmouseup = function (e) {
 o = e.getTarget()
 o.deslizar(o.h)
  }

  return this
}

  submenu.prototype=new DynLayer()
  submenu.prototype.getSubClass=function() { return submenu }

submenu.prototype.glide = function(y) { //will a nicer glide method
   slideTo(this.x,this.y+y)
}


And here is the corresponding HTML bit:


 <Script language="Javascript" src="jas/dynapi.js"></script>
 <Script language="Javascript">
 DynAPI.setLibraryPath('jas/lib/')
 DynAPI.include('dynapi.api.*')
 DynAPI.include('dynapi.util.thread.js');
 DynAPI.include('dynapi.util.pathanim.js');
 DynAPI.include('dynapi.propios.desplegable.js')
</script>
<script language="Javascript">

 DynAPI.onLoad=function() {

                despliega1 = new menu (500,100,null,null,'Hola');

                subm = despliega1.add('item 1', 'link')

                DynAPI.document.addChild(despliega1)

 }

 </script>
 </head>
 <body>
.......

Thanks for any advice!

Miguel
zambra.com


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

Reply via email to