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.
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.
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.
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…