A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Need Urgent Help

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    6

    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.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    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

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    6
    Quote Originally Posted by gparis View Post
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center