alexvesna
10-23-2007, 10:56 PM
I am not very keen in scripting. I've got a code for my panorama and now I'd like to add some sounds at the certain places in it. (Eg. When a TV appears I'd like use a sound for it. As soon as it disappears from the screen I want to fade out its sound. I've tried with setPan and _x coordinate but unfortunately it didn't work for me.
stop();
nav.attachMovie("butn", "butn1", 41);
nav.attachMovie("butn", "butn2", 42, {_x:nav.butn1._x-3738});
//nav.attachMovie("butn", "butn1", 42,{_x:-3161});
this.onEnterFrame = function() {
var xcenter = Stage.width/2;
var speed = 0.01500;
var distance = -(_root._xmouse-xcenter);
if (nav._ymouse<0 || nav._ymouse>Stage.height) {
speed = 0;
}
if ((_root._xmouse+200>Stage.width) and (_root._xmouse>xcenter)) {
speed = 0.00800;
} else {
speed = 0;
}
if ((_root._xmouse<200) and (_root._xmouse<xcenter)) {
speed = 0.00800;
} else {
//speed = 0;
}
if (nav._x<=-2738) {
nav._x += 3738;
}
if ((nav._x+20>=0) and (_root._xmouse<xcenter)) {
if (nav._x>=3738) {
nav._x -= 3738;
}
}
if ((nav._x+nav._width-190<=Stage.width) and (_root._xmouse>xcenter)) {
if (nav._x>=-2738) {
nav._x += 3738;
}
trace(nav._x);
}
nav._x = nav._x+distance*speed;
//trace(mouseMOVE);
mouseMOVE = false;
};
// loop sound
var my_loop:Sound = new Sound(_root.nav);
my_loop.attachSound("loop");
my_loop.start(1,999);
// end loop sound
Any advise will be appreciated.
stop();
nav.attachMovie("butn", "butn1", 41);
nav.attachMovie("butn", "butn2", 42, {_x:nav.butn1._x-3738});
//nav.attachMovie("butn", "butn1", 42,{_x:-3161});
this.onEnterFrame = function() {
var xcenter = Stage.width/2;
var speed = 0.01500;
var distance = -(_root._xmouse-xcenter);
if (nav._ymouse<0 || nav._ymouse>Stage.height) {
speed = 0;
}
if ((_root._xmouse+200>Stage.width) and (_root._xmouse>xcenter)) {
speed = 0.00800;
} else {
speed = 0;
}
if ((_root._xmouse<200) and (_root._xmouse<xcenter)) {
speed = 0.00800;
} else {
//speed = 0;
}
if (nav._x<=-2738) {
nav._x += 3738;
}
if ((nav._x+20>=0) and (_root._xmouse<xcenter)) {
if (nav._x>=3738) {
nav._x -= 3738;
}
}
if ((nav._x+nav._width-190<=Stage.width) and (_root._xmouse>xcenter)) {
if (nav._x>=-2738) {
nav._x += 3738;
}
trace(nav._x);
}
nav._x = nav._x+distance*speed;
//trace(mouseMOVE);
mouseMOVE = false;
};
// loop sound
var my_loop:Sound = new Sound(_root.nav);
my_loop.attachSound("loop");
my_loop.start(1,999);
// end loop sound
Any advise will be appreciated.