ActionScript mouse events(?)

Discussion in 'Graphics & Multimedia' started by cre8ive, May 1, 2008.

  1. #1
    I am modifying a certain ActionScript / Flash and I want to do something upon mouse click event. I look at the code and I see this:

    LButton.onPress = function() {
    	startFlip (-1);
    }
    LButton.onReleaseOutside = function () {
    	flipRelease();
    }
    LButton.onRelease = function () {
    	flipRelease();
    }
    RButton.onPress = function() {
    	startFlip (1);
    }
    RButton.onReleaseOutside = function () {
    	flipRelease();
    }
    RButton.onRelease = function () {
    	flipRelease();
    }
    Code (markup):
    How do I modify this? Do I add something like ...

    LButton.onClick = function () {
    ...
    }
    Code (markup):
    Do I need to make a few clicks here and there inside Flash to write a function like this? How do I do this???

    (I started using Flash only several days ago by the way. This is why I'm asking a very basic question.)
     
    cre8ive, May 1, 2008 IP
  2. agilius

    agilius Well-Known Member

    Messages:
    1,021
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    100
    #2
    This is done by witting code, not my click a few stuff in flash. I can see that you are new to flash, but could you please be more specific? Are you asking us how to write a function that runs when LButton is clicked? Your question is no clear enough for me.

    Hm... on the second thought, do you want to change something that happens when Lbutton is clicked/released etc? If so, then look for startFlip() and flipRelease() functions. They are the functions that are being called.

    Say you have the code:

    public function functionClick()
    {
            /* content of the function */
    }
    
    myButton.onClick= function ()
    {
            functionClick(); 
    }
    Code (markup):
    This is the same thing as:

    myButton.onClick= function()
    {
         /*this is the same content of the function functionClick from above*/
    }
    Code (markup):
    So in your case, in order to edit the onClick function you will need to find the startFlip function.

    Good Luck.
     
    agilius, May 8, 2008 IP