Sound object problem

I have this code;

stop();
bsig = 0;
screen = new Sound(this);
screen.loadSound(“burnout.mp3”, true);
time = screen.duration;

function sPos(aus, sobj) {
this[aus] = this[sobj].position;
}
// Anzeige Balken in Prozent
function s(obj, spobj) {
length = this[spobj].duration;
pos = this[spobj].position;
percent = pos*100/length;
_root[obj]._xscale = percent;
percent = parseInt()+"%";
} ect…

Sorry it was in german and I’m not finished translating, but that is not the point.

This code works just fine, there is a seconds counter and a bytes loaded and all kinds of other great stuff.

But now I change

screen.loadSound(“burnout.mp3”, true);

to

onChange = function ()
{ screen.loadSound(listbox.getSelectedItem().data[“Link”], true);};

And the whole thing falls apart. I still here music but the code above is not working, its not reading the screen = newSound or something, Because the seconds counter and bytes loaded stay at 0.

Any thoughts

if you created your sound object in the first function, it may not be available in the second. Check your debugger for values. It all depends on how you load your objects and when you call your functions.

you said;

if you created your sound object in the first function, it may not be available in the second.

What do you mean by sound object first function/ second function,
I only see one sound object.

screen = new Sound(this); :q:

that is to say…

load your sound object within this function



onChange = function () {
screen=new sound(this??) //where will it load the sound object?

screen.loadSound(listbox.getSelectedItem().data["Link"], true);};


I think that will work for you… but don’t know if it serves your purpose.

The on change function works, but other function like

_root.screen.onSoundComplete = function() {

Does not work. It is as the onSoundComplete = function does not see the sound object screen.

Hmmm.

:-\

probably the same reason. See, some of these things are quirky (to me, anyway). If you use a sound object inside a function, try to set everything that you will do with that object inside that function and it is almost sure to work. If you try to call the screen object from within another function, it most likely will not see it. For example… _root.screen doesnt really exist, until it is called by the function that happens to be in the root. Does that make sense?

Others may have had a different experience with this…

Its the same problem from the begining of this thread. The Sound object exists for one function but not another. :*(

Like you said before it may be how/when I load the sound object.

I’m gointg to crack it open and give it one more shot.:rambo: