From: Clemens E. <lin...@we...> - 2003-09-23 19:29:39
|
Hi there! First of all I want to thank you very much, your ptoject seems to be what I´ve ever searched. I never used JavaScrpipt because of the lack of a powerful and portable class-library. You´ve done what MS and Netscape,... werent able to do, thanks a lot! Hmm, I started today with dynapi-3 beta1, and I´ve a piece of code that works great with Mozzi-1.3, Netscape-4.7/Linux but doesnt work at all with IE6,Konqueror or Opera6. For now its only a trial&error file, but I dont know why it doesnt work. Does anybody know why the pulling-animation (moving the mouse over other layers when mouse is pressed) doesnt work with IE? The code is really simple: <html> <head> <title>DynAPI Examples - Drag Over Event</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.api'); dynapi.library.include('dynapi.api.ext.DragEvent'); dynapi.library.include('dynapi.functions.Image'); dynapi.library.include('dynapi.gui.events.*'); </script> <script language="Javascript"> var l1 = new Array(); var counter = 0; var clicked = false; var color = 'black'; dynapi.document.setTextSelectable(false); var el2 = { onmouseover : function(e) { if(clicked==true) { // var s = e.getSource(); // s.setBgColor(color); } }, onmousemove : function(e) { if(clicked==true) { var s = e.getSource(); s.setBgColor(color); } } } var el = { onmousedown : function(e) { var source = e.getSource(); source.setBgColor(color); clicked = true; }, onclick : function(e) { var s = e.getSource(); s.setBgColor(color); }, onmouseup : function(e) { clicked = false; }, }; var constspace = 200; var lines = 0; for(counter=0; counter < 200;counter++) { if((counter%20==0) && counter!=0) { lines++; } l1[counter] = new DynLayer(); l1[counter].setBgColor('gray'); l1[counter].setSize(30, 30); l1[counter].setLocation((counter%20)*30, 30*lines+constspace); l1[counter].addEventListener(el); l1[counter].addEventListener(el2); } var counter2 =0; for(; counter2 <= counter; counter2++) { dynapi.document.addChild(l1[counter2]); } function setColor(col) { color = col; } </script> </head> <body> <script> dynapi.document.insertAllChildren(); </script> <p> <a href="javascript:setColor('green')">green</a> <a href="javascript:setColor('yellow')">yellow</a> <a href="javascript:setColor('blue')">blue</a> <a href="javascript:setColor('red')">red</a> <a href="javascript:setColor('white')">white</a> <a href="javascript:setColor('black')">black</a> </p> </body> </html> Another question regarding communication with the server. As far as I´ve noticed dynapi allows this through IOElements. How is this internally handeld? As far as I know there isnt a possibility in JS to open sockets.. Sorry for nerving with my neverending newbie-questions. Thanks a lot for this really great and cool peace software! lg Clemens |
From: Raymond I. <xw...@ya...> - 2003-09-24 02:55:55
|
Welcome aboard. Neat little demo! I might add a few other things and use it as a demo inside the examples/ folder. Agree? I've spotted a problem with you code in line 61: onmouseup : function(e) { clicked = false; }, // <--- error }; remove the extra "," It should now work fine in IE6 As for the IOElement stuff you will have to see the docs for more info on how it works See also: Tips & Tricks (docs/docs/tiptrickhtml) IOElement Basics (docs/docs/quickref.ioelement-basic.html and quickref.ioelement.html) Enjoy! -- Raymond Irving --- Clemens Eisserer <lin...@we...> wrote: > Hi there! > > First of all I want to thank you very much, your > ptoject seems to be > what I´ve ever searched. > I never used JavaScrpipt because of the lack of a > powerful and portable > class-library. You´ve done what MS and Netscape,... > werent able to do, > thanks a lot! > > Hmm, I started today with dynapi-3 beta1, and I´ve a > piece of code that > works great with Mozzi-1.3, Netscape-4.7/Linux but > doesnt work at all > with IE6,Konqueror or Opera6. > > > For now its only a trial&error file, but I dont know > why it doesnt work. > Does anybody know why the pulling-animation (moving > the mouse over other > layers when mouse is pressed) doesnt work with IE? > > > The code is really simple: > > <html> > <head> > <title>DynAPI Examples - Drag Over Event</title> > <script language="JavaScript" > src="../src/dynapi.js"></script> > <script language="Javascript"> > dynapi.library.setPath('../src/'); > dynapi.library.include('dynapi.api'); > dynapi.library.include('dynapi.api.ext.DragEvent'); > dynapi.library.include('dynapi.functions.Image'); > dynapi.library.include('dynapi.gui.events.*'); > > </script> > <script language="Javascript"> > var l1 = new Array(); > var counter = 0; > var clicked = false; > var color = 'black'; > > dynapi.document.setTextSelectable(false); > > var el2 = > { > onmouseover : function(e) > { > if(clicked==true) > { > // var s = e.getSource(); > // s.setBgColor(color); > } > }, > > onmousemove : function(e) > { > if(clicked==true) > { > var s = e.getSource(); > s.setBgColor(color); > } > } > } > > var el = > { > onmousedown : function(e) > { > var source = e.getSource(); > source.setBgColor(color); > clicked = true; > }, > > onclick : function(e) > { > var s = e.getSource(); > s.setBgColor(color); > }, > > onmouseup : function(e) > { > clicked = false; > }, > > }; > > var constspace = 200; > var lines = 0; > for(counter=0; counter < 200;counter++) > { > if((counter%20==0) && counter!=0) > { > lines++; > } > > l1[counter] = new DynLayer(); > l1[counter].setBgColor('gray'); > l1[counter].setSize(30, 30); > l1[counter].setLocation((counter%20)*30, > 30*lines+constspace); > l1[counter].addEventListener(el); > l1[counter].addEventListener(el2); > } > > var counter2 =0; > for(; counter2 <= counter; counter2++) > { > dynapi.document.addChild(l1[counter2]); > } > > function setColor(col) > { > color = col; > } > </script> > </head> > <body> > <script> > dynapi.document.insertAllChildren(); > </script> > <p> > <a href="javascript:setColor('green')">green</a> > <a href="javascript:setColor('yellow')">yellow</a> > <a href="javascript:setColor('blue')">blue</a> > <a href="javascript:setColor('red')">red</a> > <a href="javascript:setColor('white')">white</a> > <a href="javascript:setColor('black')">black</a> > </p> > </body> > </html> > > > Another question regarding communication with the > server. > As far as I´ve noticed dynapi allows this through > IOElements. > How is this internally handeld? As far as I know > there isnt a > possibility in JS to open sockets.. > > Sorry for nerving with my neverending > newbie-questions. Thanks a lot for > this really great and cool peace software! > > lg Clemens > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |