Hello Henrik,
I've found that the following code generated an error
eyeListener.onmouseclick = function(e) {
var o = e.getTarget();
// if (state!='active') { o.setImage(o.imgover);
o.state='active'; };
};
I've modified it to show:
eyeListener.onmouseclick = function(e) {
var o = e.getTarget();
if (state!='active') {
o.setImage(o.imgover);
o.state='active';
};
};
Hope that works
--
Raymond Irving
--- Henrik V�glin <[EMAIL PROTECTED]> wrote:
> Hello everyone!
>
> I've begun work on redesigning my own homepage and
> using DynAPI explict. Currently I've rewritten my
> old
> layerpositioning extension and begun coding a widget
> for my main sitenavigational system called Eyes.
>
> Of course I run into some bugs along the way (as
> expected), but now I find myself stuck witout errors
> but nothing happening - at least in the MacOS X
> enviroment I'm currently bound to.
>
> Here's my widget code:
>
> hvaglin.custom.eyes.js
> ----------------------
>
> /*
> Henrik V�glin's Custom Widgets & Extensions
> Eye Class
>
> This add-on set as well as the DynAPI
> Distribution
> is distributed under the terms of the GNU LGPL
> license.
>
> Requirements:
> dynapi.api.*
> dynapi.util [thread, pathanim]
> dynapi.gui [button, label, dynimage]
> */
>
> function
>
Eye(sectionname,colorset,imgopen,imgclosed,imgover,state)
> {
>
> this.DynImage = DynImage;
> this.DynImage(imgopen);
>
> this.sectionname = sectionname || 'unknown';
> this.colorset = colorset || 'white';
>
> this.imgopen = imgopen || null;
> this.imgclosed = imgclosed || null;
> this.imgover = imgover || null;
>
> this.state = state || 'open';
> this.prestate = 'closed';
>
> var eyeListener = new EventListener(this);
> eyeListener.onmouseover = function(e) {
> var o = e.getTarget();
> if (o.state!='active') { o.setImage(o.imgover);
> o.state='active'; };
> };
> eyeListener.onmouseout = function(e) {
> var o = e.getTarget();
> if (o.state!=o.prestate) {
> if (o.prestate=='closed') {
> o.setImage(o.imgclosed); o.state='closed'; };
> if (o.prestate=='open') { o.setImage(o.imgopen);
> o.state='open'; };
> };
> };
> eyeListener.onmouseclick = function(e) {
> var o = e.getTarget();
> // if (state!='active') { o.setImage(o.imgover);
> o.state='active'; };
> };
>
> this.addEventListener(eyeListener);
>
> }
> Eye.prototype = new DynImage;
>
> -----
>
> You'll find that one and others to download directly
> in my open serverfolders @
>
>
http://www.geocities.com/hvaglin/scripts/dynapi/src/lib/
>
> -----
>
> I haven't really added any methods yet but wouldn't
> that code be enough to create the eye widgets?
>
> Here's the initcode I'm using
>
> script language="JavaScript"
> src="scripts/dynapi/src/dynapi.js"
> type="text/JavaScript"></script>
> script language="JavaScript" type="text/JavaScript">
>
> //====== DYNAPI LIBRARY ===//
>
> DynAPI.setLibraryPath('scripts/dynapi/src/lib/');
>
> //***** Official distribution ***/
>
> DynAPI.include('dynapi.api.*');
> DynAPI.include('dynapi.event.*');
> DynAPI.include('dynapi.gui.dynimage.js');
> DynAPI.include('dynapi.util.thread.js');
> DynAPI.include('dynapi.util.pathanim.js');
> DynAPI.include('dynapi.ext.inline.js');
> DynAPI.include('dynapi.util.debug');
>
> //**** dyntoolbox add-ons and widgets ***/
>
> //**** my own add-ons and widgets ***/
>
> DynAPI.include('hvaglin.ext.layerpos.js');
> DynAPI.include('hvaglin.custom.eyes.js');
>
> //====== GLOBALS ======//
>
> var sections = new
>
Array('Personals','Reviews','Comics','Art','Cooking','Webdesign');
> // Main sections of the site
> var colors = new
>
Array('yellow','green','blue','purple','red','orange');
> // Colors to associate with each main section
> var eyes = new Array(); // In here goes l8r the
> dynimage eye layers that represents the main
> sections
> in the on-site navigation
>
> //***** Pathanimation ***/
>
> /* Paths divided into Y and X positions f�r
> readability.
> Numbers are pixels from the left and top of
> the
> pallette layer. */
> var pathY = new
>
Array(308,295,282,272,252,234,206,186,176,148,130,112,94,76,62,54,46,43,40,36,32);
> // The path's Y positions
> var pathX = new
>
Array(113,103,93,81,71,65,59,57,55,58,61,71,81,91,101,114,127,140,155,168,181);
> // The path's X positions
>
> /* Starting positions as of order in the pathY &
> pathX:
> orangeeyeStart = 0; redeyeStart = 4;
> purpleeyeStart = 8; blueeyeStart = 12; greeneyeStart
> =
> 16; yelloweyeStart = 20; */
>
> //====== DYNAPI FUNCTIONS ===//
>
> //********* Document load ***/
>
> DynAPI.onLoad = function() {
>
> //***** Creating the eyes ***/
>
> var j=0; // just to keep track of which ordered Y
> and
> X to get from the path array's
> k=colors.lenght-1;
> for (i=k;i>=0;i--) { // looping backwards to get the
> correct order of the eyes
>
> eye0 =
>
eval("DynImage.getImage('eyes/"+colors[i]+"eye0.gif'");
> // closed eye
> eye1 =
>
eval("DynImage.getImage('eyes/"+colors[i]+"eye1.gif'");
> // open eye
> eyeblink =
>
eval("DynImage.getImage('eyes/"+colors[i]+"eyeblink.gif'");
> // active eye, ie mouseover, loading section etc
>
> eyes[i] = new
> Eye(sections[i],colors[i],eye1,eye0,eyeblink,null);
> //
> creating a new Eye
> eyes[i].moveTo(pathY[j],pathX[j]); // putting the
> new
> eye in position according to the upper-left corner
> of
> the palettet layer
>
> DynAPI.document.addChild(eyes[i]); // attaching the
> eye to the document and not bound up to the pallete
> layer
>
> j=j+4; // jumping to the next position numbers in
> path's order
> }
>
> [...more code that does other stuff cut out... ]
>
>
> }
>
> /script>
>
> (* script tag was delibratry malformed for this
> email
>
=== message truncated ===
__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com
-------------------------------------------------------
This sf.net email is sponsored by: viaVerio will pay you up to
$1,000 for every account that you consolidate with us.
http://ad.doubleclick.net/clk;4749864;7604308;v?
http://www.viaverio.com/consolidator/osdn.cfm
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/