Action Script paradox
- Started
- Last post
- 5 Responses
- CyBrainX
I can't see what's wrong with this block of code. repeatAlarm is a function.
Left side of assignment operator must be variable or property.
alarmSound.onSoundComplete()=rep...Total ActionScript Errors: 1 Reported Errors: 1
- tomkat0
you have to put it in a function()
mySound.onSoundComplete = function(){
whatever;
}
- unfittoprint0
probaly the error isn't there?
if you're using MX2004 it could because of AS2.0 strict data typing [you'll have to indicate the variable is indeed a function].
http://livedocs.macromedia.com/f…if you're not in need of using AS2.0 try Publishing it using AS1.0.
- CyBrainX0
I am publishing for Flash MX/AS1
I got rid of the output error when I removed the () after the "onSoundComplete": alarmSound.onSoundComplete = repeatAlarm;
It still doesn't execute the function though.
Here is the code now with the function preceeding it.
function repeatAlarm() {
trace("This should theoretically work.");
alarmSound2 = new Sound();
alarmSound2.attachSound("gong2...
alarmSound2.start();
delete alarmSound2;
}
if ((myDate.getHours() == 12) && (myDate.getMinutes() == 47) && (myDate.getSeconds() == 0)) {
alarmSound = new Sound();
alarmSound.attachSound("alarm");
alarmSound.start();
alarmSound.onSoundComplete = repeatAlarm;
}
- CyBrainX0
Here's another question. All this onSoundComplete business is a workaround for a problem with this. (The alarmSound won't loop.)
alarmSound = new Sound();
alarmSound.attachSound("alarm");
alarmSound.start([0,3]);
- unfittoprint0
try making repeatAlarm = new function () { etc....
and you should have alarmsound2 delete in the wrong place, it shuld be the first line. Right now is just deleting without playing...