cgakidis
YaBB Newbies
Offline
Posts: 7
Re: Sample isn't stopping
Reply #2 - Jun 20th , 2006, 11:15pm
i' ve tried both ess and sonia and it trhows me the same exception. So i guess it's a java problem. Here is all the inner class: class SoundBox{ int posx; int posy; int nx; int ny; int rsize; int bdifx = 0; int bdify = 0; boolean otherslocked = false; boolean locked = false; boolean press; SoundBox[] others; String sbox; Sample sound; String swave; String fotext; SoundBox(int rpx, int rpy, int rs, int difx, int dify, SoundBox[] o, String string, String wavestring){ nx = rpx; ny = rpy; bdifx = difx; bdify = dify; rsize = rs; others = o; sbox = string; swave = wavestring; } void update() { posx =nx + bdifx; posy =ny + bdify; for(int i=0; i<num; i++) { if(others[i].locked == true) { otherslocked = true; break; } else { otherslocked = false; } } if(press) { bdifx = lock(mouseX-rsize/2,0,w-rsize/2); bdify = lock(mouseY-rsize/2,0,h-rsize/2); } if (posy != ny || posx != nx){ posy = bdify; posx = bdifx; } if(otherslocked == false) { over(); press(); } } void over() { if(overs (posx, posy, rsize)) { bover = true; } else { bover = false; } } void press() { if(bover && mousePressed) { press = true; locked = true; sound = new Sample(swave); if (sound.isPlaying()){ sound.stop(1); sound = null; println("stamathse"); } else{ sound.play(); println("isPlaying"); } } else { press = false; } } void release(){ locked = false; } void drag(){ sound.stop(1); } void display(){ if(bover){ fill(231, 199, 58, 155); } else{ fill(245, 228, 47, 155); } if(press) { fill(255, 255, 255, 30); stroke(255); } else{ stroke(88); } rect(posx, posy, rsize, rsize); textFont(bfont,10); fill(0); text(sbox, posx, posy, rsize, rsize); } int positionx(){ return posx; } int positiony(){ return posy; } String wavename(){ return swave; } void writext(){ int tx = positionx(); int ty = positiony(); //String swn = sBox[i].wavename(); if(tx >= 0 && tx < w/3 && ty >= 6*(h/10) && ty <= h){ fotext = swave +" "+"Lyriki"; println("---------------------"); } else if(tx >= w/3 && tx < 2*(w/3) && ty >= 6*(h/10) && ty <= h){ fotext = swave +" "+"Dramatikh"; println("*********************"); } else if(tx >= 2*(w/3) && tx <3* (w/3) && ty >= 6*(h/10) && ty <= h){ fotext = swave +" "+"Elafria"; println("SSSSSSSSSSSSSSSSSSSSSS"); } else { fotext = "Den exei kathgoriopoih8ei"; } } String pl (){ return fotext; } }