Return to Snippet

Revision: 7690
at August 6, 2008 14:16 by FlashJunior


Initial Code
my_btn.addEventListener(MouseEvent.MOUSE_DOWN, 
                                        function(e:MouseEvent)
                                        {
                                            new OpenWebsite("http://www.flashjunior.ch","_blank");
                                        }
)

/* test class */
package 
{
    import flash.display.MovieClip
    import flash.events.MouseEvent
    import flash.display.SimpleButton
    import flash.net.navigateToURL
    import flash.net.URLRequest;

    public class OpenWebsite extends MovieClip
    {
        public function OpenWebsite(url:String,target:String):void
        {
            navigateToURL(new URLRequest(url),target);
        }
    }
}

Initial URL

                                

Initial Description
usually you made a function like "mybutonfunction" an call there e second function with parameters.. with this snippet, you can call it directly.

Initial Title
Call a function with arguments directly form a EventListener

Initial Tags

                                

Initial Language
ActionScript 3