// ButtonImage Object // button widget with a swappable image and down/up/roll controls // 19990408 // Copyright (C) 1999 Dan Steinman // Distributed under the terms of the GNU Library General Public License // Available at http://www.dansteinman.com/dynduo/ function ButtonImage(x,y,width,height) { this.name = "ButtonImage"+(ButtonImage.count++) this.x = x this.y = y this.w = width this.h = height this.obj = this.name+"Object" eval(this.obj+"=this") this.preload = ButtonImagePreload this.setImages = ButtonImageSetImages this.build = ButtonImageBuild this.activate = ButtonImageActivate this.down = ButtonImageDown this.up = ButtonImageUp this.over = ButtonImageOver this.out = ButtonImageOut this.onDown = new Function() this.onUp = new Function() this.onOver = new Function() this.onOut = new Function() } function ButtonImageSetImages(imgOff,imgOn,imgRoll,dir) { if (!dir) dir = '' this.preload(this.obj+".imgOff",imgOff?dir+imgOff:'') this.preload(this.obj+".imgOn",imgOn?dir+imgOn:'') this.preload(this.obj+".imgRoll",imgRoll?dir+imgRoll:'') } function ButtonImagePreload(imgObj,imgSrc) { if (imgSrc) { eval(imgObj+' = new Image()') eval(imgObj+'.src = "'+imgSrc+'"') eval(imgObj+'s = true') } else eval(imgObj+'s = false') } function ButtonImageBuild() { this.css = css(this.name,this.x,this.y,this.w,this.h)+ css(this.name+'C',0,0,this.w,this.h) this.div = '