|
-
Need Urgent Help
Action Script 2.
I have a count function that counts how many times the buttons in my scene are clicked.
It counts upwards on each mouse click:
_root.count+=1
I know this is working because a trace(_root.count) shows appropriately.
When count == 6, I need to trigger a sound. My code is as follows;
onClipEvent(mouseDown)
if (_root.count==6) {
snd=new Sound();
snd.attachSound("click");
snd.start();
}
}
The problem is, it's not triggering the sound as expected, even though the _root.count trace is showing 6.
I am in desparate need of a solution. Please help!
Last edited by foreverdita; 11-07-2009 at 11:34 PM.
-
My guess is it's because when the mouse is down count is still equal to 5. Try with mouseUp instead. But it's only a guess as i didn't see the handler for the count++
To make sure, add a trace on your mouseDown:
.....
snd=new Sound();
trace(_root.count);
....
gparis
-
 Originally Posted by gparis
My guess is it's because when the mouse is down count is still equal to 5. Try with mouseUp instead. But it's only a guess as i didn't see the handler for the count++
To make sure, add a trace on your mouseDown:
.....
snd=new Sound();
trace(_root.count);
....
gparis
gparis - you are absolutely awesome, it worked beautifully! Your knowledge is invaluable to people just starting out like me - 1000% better than the Adobe website info, which tells people relatively nothing.
*THANK YOU SO MUCH*
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|