Hi all,
Having a problem with deleting an on.EnterFrame (code below and trace output). Obviously what is happening is that it stuck in a continual loop and it is not even hitting the ‘else if’ and continues until user activates ‘teal5_mc.onPress’. I am probably doing something very obvious but I have been looking at the code too long…
Also, if anyone knows of a better way of including a sound to the rollover that would be bonus. Creating a mechanical sliding door sound effect to reveal a link to another site underneath that door.
The whole fla is working currently but obviously the sound loops and is distorted and not good practice to have the continual loop
Cheers,
Dave
//Teal 5 Intertia variables
var teal5up = -450;
var teal5down = 0;
//inertia formula and sound attach
teal5_mc.onRollOver = function() {
if (teal5_mc._y>-445){
this.onEnterFrame = function() {
this._y = this._y+((teal5up-this._y)/16);
sound1.attachSound(“Servo01.mp3”);
sound1.start(0,1);
trace(teal5_mc._y);
};
}else if (teal5_mc._y>=-445) {
delete this.onEnterFrame;
};
};
teal5_mc.onPress = function() {
if (teal5_mc._y<0){
this.onEnterFrame = function() {
this._y = this._y+((teal5down-this._y)/16);
};
}else if (teal5_mc._y==0) {
delete this.onEnterFrame;
};
};
Output Panel displays from trace
-448.85
-448.9
-448.95
-449
-449.05
-449.1
-449.15
-449.2
-449.25
-449.25
-449.25
-449.25 And continues until user activates ‘teal5_mc.onPress’